@loftyshaky/shared 0.0.30 → 0.0.34

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 (267) hide show
  1. package/_locales/de/messages.json +128 -0
  2. package/_locales/en/messages.json +127 -118
  3. package/_locales/ru/messages.json +124 -115
  4. package/app.d.ts +0 -0
  5. package/app.js +1 -1
  6. package/{chunk-main-ab64b6fe.js → chunk-main-00a79e55.js} +1 -1
  7. package/chunk-main-707d1b35.js +1 -0
  8. package/chunk-main-bacabf12.js +1 -0
  9. package/ext.d.ts +0 -0
  10. package/ext.js +1 -1
  11. package/index.d.ts +1 -1
  12. package/index.js +1 -1
  13. package/inputs.d.ts +0 -0
  14. package/inputs.js +1 -1
  15. package/js/ext/env.js +16 -16
  16. package/js/ext/locales.js +42 -42
  17. package/js/ext/manifest.js +58 -58
  18. package/js/ext/webpack.config.js +113 -113
  19. package/js/package/plugins/rollup-plugin-copy.js +169 -169
  20. package/js/package/plugins/watcher.js +54 -48
  21. package/js/package/terser.js +18 -18
  22. package/js/project_name.js +5 -5
  23. package/js/projects_path.js +5 -5
  24. package/js/task_scheduler.js +39 -31
  25. package/package.json +14 -14
  26. package/scss/settings/ext_version.scss +7 -7
  27. package/scss/settings/index.scss +7 -7
  28. package/scss/settings/main.scss +19 -18
  29. package/scss/settings/scrollbar.scss +12 -4
  30. package/scss/settings/section_btns.scss +40 -39
  31. package/scss/settings/sections.scss +22 -22
  32. package/scss/settings/transitions.scss +20 -20
  33. package/scss/shared/all.scss +3 -3
  34. package/scss/shared/btns.scss +30 -26
  35. package/scss/shared/checkboxes.scss +38 -38
  36. package/scss/shared/color_pickers.scss +94 -94
  37. package/scss/shared/colors.scss +85 -75
  38. package/scss/shared/crash_handler.scss +36 -36
  39. package/scss/shared/css_vars.scss +4 -4
  40. package/scss/shared/embed/error.scss +96 -96
  41. package/scss/shared/embed/font_face.scss +5 -5
  42. package/scss/shared/embed/loading_screen.scss +35 -35
  43. package/scss/shared/embed/no_tr.scss +3 -3
  44. package/scss/shared/focus.scss +78 -78
  45. package/scss/shared/help.scss +66 -66
  46. package/scss/shared/hr.scss +6 -0
  47. package/scss/shared/index.scss +28 -26
  48. package/scss/shared/input_btns.scss +11 -11
  49. package/scss/shared/inputs.scss +69 -73
  50. package/scss/shared/inset_border.scss +20 -20
  51. package/scss/shared/link_btns.scss +12 -12
  52. package/scss/shared/links.scss +11 -11
  53. package/scss/shared/mixins.scss +130 -130
  54. package/scss/shared/mods.scss +35 -22
  55. package/scss/shared/range.scss +46 -45
  56. package/scss/shared/scrollbar.scss +35 -32
  57. package/scss/shared/selects.scss +14 -14
  58. package/scss/shared/text.scss +20 -20
  59. package/scss/shared/textareas.scss +7 -7
  60. package/scss/shared/themes/colors/dark.scss +17 -17
  61. package/scss/shared/themes/colors/light.scss +17 -17
  62. package/scss/shared/themes/colors/very_dark.scss +17 -17
  63. package/scss/shared/themes/general/dark_theme.scss +7 -7
  64. package/scss/shared/themes/general/light_theme.scss +7 -7
  65. package/scss/shared/themes/general/template.scss +241 -212
  66. package/scss/shared/themes/general/template_focus.scss +48 -54
  67. package/scss/shared/themes/general/very_dark_theme.scss +7 -7
  68. package/scss/shared/transitions.scss +31 -30
  69. package/scss/shared/upload_box.scss +67 -0
  70. package/scss/shared/vars.scss +18 -17
  71. package/settings.d.ts +1 -1
  72. package/settings.js +1 -1
  73. package/ts/error_modules/crash_handler/components/body.d.ts +0 -0
  74. package/ts/error_modules/crash_handler/components/index.d.ts +0 -0
  75. package/ts/error_modules/crash_handler/components/prop_types/body.d.ts +0 -0
  76. package/ts/error_modules/crash_handler/components/prop_types/index.d.ts +0 -0
  77. package/ts/error_modules/crash_handler/data/fatal_error.d.ts +0 -0
  78. package/ts/error_modules/crash_handler/data/index.d.ts +0 -0
  79. package/ts/error_modules/crash_handler/data/visibility.d.ts +0 -0
  80. package/ts/error_modules/crash_handler/scripts/index.d.ts +0 -0
  81. package/ts/error_modules/crash_handler/scripts/page.d.ts +0 -0
  82. package/ts/error_modules/css/scripts/index.d.ts +0 -0
  83. package/ts/error_modules/css/scripts/main.d.ts +0 -0
  84. package/ts/error_modules/error/components/body.d.ts +0 -0
  85. package/ts/error_modules/error/components/close_btn.d.ts +0 -0
  86. package/ts/error_modules/error/components/ext_name.d.ts +0 -0
  87. package/ts/error_modules/error/components/index.d.ts +0 -0
  88. package/ts/error_modules/error/components/msg.d.ts +0 -0
  89. package/ts/error_modules/error/components/prop_types/body.d.ts +0 -0
  90. package/ts/error_modules/error/components/prop_types/index.d.ts +0 -0
  91. package/ts/error_modules/error/data/index.d.ts +0 -0
  92. package/ts/error_modules/error/data/main.d.ts +0 -0
  93. package/ts/error_modules/error/data/msg.d.ts +0 -0
  94. package/ts/error_modules/error/data/state.d.ts +0 -0
  95. package/ts/error_modules/error/interfaces/error.d.ts +0 -0
  96. package/ts/error_modules/error/interfaces/error_obj.d.ts +0 -0
  97. package/ts/error_modules/error/interfaces/index.d.ts +0 -0
  98. package/ts/error_modules/error/interfaces/observable_keys.d.ts +0 -0
  99. package/ts/error_modules/error/interfaces/show_error.d.ts +0 -0
  100. package/ts/error_modules/error/interfaces/timeout_observable_keys.d.ts +0 -0
  101. package/ts/error_modules/error/scripts/globals.d.ts +1 -0
  102. package/ts/error_modules/error/scripts/index.d.ts +0 -0
  103. package/ts/error_modules/internal.d.ts +0 -0
  104. package/ts/inputs/color/components/body.d.ts +0 -0
  105. package/ts/inputs/color/components/color_picker.d.ts +0 -0
  106. package/ts/inputs/color/components/fill_shadow.d.ts +0 -0
  107. package/ts/inputs/color/components/index.d.ts +0 -0
  108. package/ts/inputs/color/components/prop_types/body.d.ts +0 -0
  109. package/ts/inputs/color/components/prop_types/color_picker.d.ts +0 -0
  110. package/ts/inputs/color/components/prop_types/fill_shadow.d.ts +0 -0
  111. package/ts/inputs/color/components/prop_types/index.d.ts +0 -0
  112. package/ts/inputs/color/components/prop_types/visualization.d.ts +0 -0
  113. package/ts/inputs/color/components/visualization.d.ts +0 -0
  114. package/ts/inputs/color/data/color.d.ts +2 -1
  115. package/ts/inputs/color/data/index.d.ts +0 -0
  116. package/ts/inputs/color/data/visibility.d.ts +2 -0
  117. package/ts/inputs/color/interfaces/color.d.ts +0 -0
  118. package/ts/inputs/color/interfaces/color_picker_state.d.ts +0 -0
  119. package/ts/inputs/color/interfaces/color_picker_state_one.d.ts +0 -0
  120. package/ts/inputs/color/interfaces/i.d.ts +0 -0
  121. package/ts/inputs/color/interfaces/index.d.ts +0 -0
  122. package/ts/inputs/color/obj/color.d.ts +3 -0
  123. package/ts/inputs/color/obj/index.d.ts +0 -0
  124. package/ts/inputs/color/scripts/color_picker.d.ts +0 -0
  125. package/ts/inputs/color/scripts/index.d.ts +0 -0
  126. package/ts/inputs/color/scripts/position.d.ts +0 -0
  127. package/ts/inputs/components/btn.d.ts +0 -0
  128. package/ts/inputs/components/checkbox.d.ts +0 -0
  129. package/ts/inputs/components/file.d.ts +0 -0
  130. package/ts/inputs/components/help.d.ts +0 -0
  131. package/ts/inputs/components/help_btn.d.ts +0 -0
  132. package/ts/inputs/components/hr.d.ts +3 -0
  133. package/ts/inputs/components/index.d.ts +2 -0
  134. package/ts/inputs/components/input_item.d.ts +0 -0
  135. package/ts/inputs/components/label.d.ts +0 -0
  136. package/ts/inputs/components/link.d.ts +0 -0
  137. package/ts/inputs/components/link_btn.d.ts +0 -0
  138. package/ts/inputs/components/prop_types/btn.d.ts +0 -0
  139. package/ts/inputs/components/prop_types/checkbox.d.ts +0 -0
  140. package/ts/inputs/components/prop_types/file.d.ts +0 -0
  141. package/ts/inputs/components/prop_types/help.d.ts +0 -0
  142. package/ts/inputs/components/prop_types/help_btn.d.ts +0 -0
  143. package/ts/inputs/components/prop_types/hr.d.ts +4 -0
  144. package/ts/inputs/components/prop_types/index.d.ts +2 -0
  145. package/ts/inputs/components/prop_types/input_item.d.ts +0 -0
  146. package/ts/inputs/components/prop_types/label.d.ts +0 -0
  147. package/ts/inputs/components/prop_types/link.d.ts +0 -0
  148. package/ts/inputs/components/prop_types/link_btn.d.ts +2 -3
  149. package/ts/inputs/components/prop_types/range.d.ts +0 -0
  150. package/ts/inputs/components/prop_types/section.d.ts +0 -0
  151. package/ts/inputs/components/prop_types/section_btn.d.ts +0 -0
  152. package/ts/inputs/components/prop_types/section_content.d.ts +0 -0
  153. package/ts/inputs/components/prop_types/select.d.ts +0 -0
  154. package/ts/inputs/components/prop_types/text.d.ts +0 -0
  155. package/ts/inputs/components/prop_types/text_btn.d.ts +1 -1
  156. package/ts/inputs/components/prop_types/textarea.d.ts +0 -0
  157. package/ts/inputs/components/prop_types/upload_box.d.ts +4 -0
  158. package/ts/inputs/components/range.d.ts +0 -0
  159. package/ts/inputs/components/section.d.ts +0 -0
  160. package/ts/inputs/components/section_btn.d.ts +0 -0
  161. package/ts/inputs/components/section_content.d.ts +0 -0
  162. package/ts/inputs/components/select.d.ts +0 -0
  163. package/ts/inputs/components/text.d.ts +0 -0
  164. package/ts/inputs/components/text_btn.d.ts +0 -0
  165. package/ts/inputs/components/textarea.d.ts +0 -0
  166. package/ts/inputs/components/upload_box.d.ts +3 -0
  167. package/ts/inputs/data/help.d.ts +0 -0
  168. package/ts/inputs/data/index.d.ts +2 -0
  169. package/ts/inputs/data/input_width.d.ts +4 -3
  170. package/ts/inputs/data/label.d.ts +0 -0
  171. package/ts/inputs/data/nested_input.d.ts +4 -2
  172. package/ts/inputs/data/text.d.ts +21 -0
  173. package/ts/inputs/data/upload_box.d.ts +20 -0
  174. package/ts/inputs/data/val.d.ts +0 -0
  175. package/ts/inputs/interfaces/index.d.ts +2 -0
  176. package/ts/inputs/interfaces/input.d.ts +1 -1
  177. package/ts/inputs/interfaces/inputs.d.ts +0 -0
  178. package/ts/inputs/interfaces/links.d.ts +0 -0
  179. package/ts/inputs/interfaces/options.d.ts +0 -0
  180. package/ts/inputs/interfaces/sections.d.ts +0 -0
  181. package/ts/inputs/interfaces/state_cond.d.ts +4 -0
  182. package/ts/inputs/interfaces/text_btn.d.ts +7 -0
  183. package/ts/inputs/internal.d.ts +0 -0
  184. package/ts/inputs/obj/btn.d.ts +0 -0
  185. package/ts/inputs/obj/checkbox.d.ts +0 -0
  186. package/ts/inputs/obj/file.d.ts +2 -0
  187. package/ts/inputs/obj/hr.d.ts +5 -0
  188. package/ts/inputs/obj/index.d.ts +3 -0
  189. package/ts/inputs/obj/input_base.d.ts +12 -2
  190. package/ts/inputs/obj/link.d.ts +0 -0
  191. package/ts/inputs/obj/link_btn.d.ts +5 -0
  192. package/ts/inputs/obj/option.d.ts +1 -1
  193. package/ts/inputs/obj/range.d.ts +0 -0
  194. package/ts/inputs/obj/section.d.ts +1 -0
  195. package/ts/inputs/obj/select.d.ts +0 -0
  196. package/ts/inputs/obj/text.d.ts +5 -1
  197. package/ts/inputs/obj/textarea.d.ts +0 -0
  198. package/ts/inputs/obj/upload_box.d.ts +14 -0
  199. package/ts/inputs/scripts/index.d.ts +1 -0
  200. package/ts/inputs/scripts/resolve.d.ts +0 -0
  201. package/ts/inputs/scripts/upload_box.d.ts +8 -0
  202. package/ts/settings/components/body.d.ts +0 -0
  203. package/ts/settings/components/index.d.ts +0 -0
  204. package/ts/settings/components/prop_types/body.d.ts +0 -0
  205. package/ts/settings/components/prop_types/index.d.ts +0 -0
  206. package/ts/settings/data/back_up.d.ts +1 -1
  207. package/ts/settings/data/index.d.ts +0 -0
  208. package/ts/settings/data/sections.d.ts +7 -1
  209. package/ts/settings/init.d.ts +0 -0
  210. package/ts/settings/internal.d.ts +2 -0
  211. package/ts/settings/optional_permissions/data/index.d.ts +1 -0
  212. package/ts/settings/optional_permissions/data/main.d.ts +11 -0
  213. package/ts/settings/optional_permissions/interfaces/index.d.ts +1 -0
  214. package/ts/settings/optional_permissions/interfaces/optional_permission_checkbox_dict.d.ts +3 -0
  215. package/ts/settings/scripts/index.d.ts +0 -0
  216. package/ts/settings/scripts/theme.d.ts +3 -1
  217. package/ts/shared/app.d.ts +0 -0
  218. package/ts/shared/app_ext_globals.d.ts +0 -0
  219. package/ts/shared/css_vars/scripts/index.d.ts +0 -0
  220. package/ts/shared/css_vars/scripts/main.d.ts +0 -0
  221. package/ts/shared/data/data/index.d.ts +0 -0
  222. package/ts/shared/data/data/main.d.ts +0 -0
  223. package/ts/shared/data/interfaces/index.d.ts +0 -0
  224. package/ts/shared/data/interfaces/val.d.ts +0 -0
  225. package/ts/shared/ext.d.ts +0 -0
  226. package/ts/shared/ext_version/components/body.d.ts +0 -0
  227. package/ts/shared/ext_version/components/index.d.ts +0 -0
  228. package/ts/shared/functions.d.ts +1 -0
  229. package/ts/shared/globals.d.ts +0 -0
  230. package/ts/shared/init.d.ts +0 -0
  231. package/ts/shared/internal.d.ts +0 -1
  232. package/ts/shared/keep_alive/scripts/index.d.ts +0 -0
  233. package/ts/shared/keep_alive/scripts/tabs.d.ts +0 -0
  234. package/ts/shared/loading_screen/components/body.d.ts +2 -3
  235. package/ts/shared/loading_screen/components/index.d.ts +0 -0
  236. package/ts/shared/loading_screen/data/index.d.ts +0 -0
  237. package/ts/shared/loading_screen/data/main.d.ts +0 -0
  238. package/ts/shared/no_tr/scripts/index.d.ts +0 -0
  239. package/ts/shared/no_tr/scripts/main.d.ts +0 -0
  240. package/ts/shared/svg.d.ts +0 -0
  241. package/ts/shared/t.d.ts +0 -0
  242. package/ts/shared/tab_index/interfaces/index.d.ts +0 -0
  243. package/ts/shared/tab_index/interfaces/set_Input_type_event.d.ts +0 -0
  244. package/ts/shared/tab_index/scripts/index.d.ts +0 -0
  245. package/ts/shared/tab_index/scripts/main.d.ts +0 -0
  246. package/ts/shared/theme/scripts/index.d.ts +0 -0
  247. package/ts/shared/theme/scripts/main.d.ts +3 -1
  248. package/ts/shared/tr/components/base_tr.d.ts +0 -0
  249. package/ts/shared/tr/components/index.d.ts +0 -0
  250. package/ts/shared/tr/components/prop_types/base_tr.d.ts +1 -1
  251. package/ts/shared/tr/components/prop_types/index.d.ts +0 -0
  252. package/ts/shared/tr/data/index.d.ts +0 -0
  253. package/ts/shared/tr/data/transition.d.ts +0 -0
  254. package/ts/shared/tr/interfaces/index.d.ts +0 -0
  255. package/ts/shared/tr/interfaces/transitions.d.ts +0 -0
  256. package/ts/shared/tr/obj/index.d.ts +0 -0
  257. package/ts/shared/tr/obj/transition.d.ts +0 -0
  258. package/ts/shared/utils/scripts/index.d.ts +0 -0
  259. package/ts/shared/utils/scripts/main.d.ts +0 -0
  260. package/ts/shared/vars.d.ts +0 -0
  261. package/ts/shared/viewport/scripts/index.d.ts +0 -0
  262. package/ts/shared/viewport/scripts/main.d.ts +0 -0
  263. package/ts/shared/x.d.ts +4 -0
  264. package/chunk-main-38f4a769.js +0 -1
  265. package/chunk-main-775b8143.js +0 -1
  266. package/ts/shared/loading_screen/components/prop_types/body.d.ts +0 -8
  267. package/ts/shared/loading_screen/components/prop_types/index.d.ts +0 -1
@@ -1,169 +1,169 @@
1
- const path = require('path');
2
- const util = require('util');
3
- const fs = require('fs-extra');
4
- const isObject = require('is-plain-object');
5
- const globby = require('globby');
6
- const { bold, green, yellow } = require('colorette');
7
-
8
- function stringify(value) {
9
- return util.inspect(value, { breakLength: Infinity });
10
- }
11
-
12
- async function isFile(filePath) {
13
- const fileStats = await fs.stat(filePath);
14
-
15
- return fileStats.isFile();
16
- }
17
-
18
- function renameTarget(target, rename) {
19
- const parsedPath = path.parse(target);
20
-
21
- return typeof rename === 'string'
22
- ? rename
23
- : rename(parsedPath.name, parsedPath.ext.replace('.', ''));
24
- }
25
-
26
- async function generateCopyTarget(src, dest, { flatten, rename, transform }) {
27
- if (transform && !(await isFile(src))) {
28
- throw new Error(`"transform" option works only on files: '${src}' must be a file`);
29
- }
30
-
31
- const { base, dir } = path.parse(src);
32
- const destinationFolder =
33
- flatten || (!flatten && !dir) ? dest : dir.replace(dir.split('/')[0], dest);
34
-
35
- return {
36
- src,
37
- dest: path.join(destinationFolder, rename ? renameTarget(base, rename) : base),
38
- ...(transform && { contents: await transform(await fs.readFile(src)) }),
39
- renamed: rename,
40
- transformed: transform,
41
- };
42
- }
43
-
44
- module.exports = function copy(options = {}) {
45
- const {
46
- copyOnce = false,
47
- flatten = true,
48
- hook = 'buildEnd',
49
- targets = [],
50
- verbose = false,
51
- callback_start,
52
- callback_end,
53
- ...restPluginOptions
54
- } = options;
55
-
56
- let copied = false;
57
-
58
- return {
59
- name: 'copy',
60
- [hook]: async () => {
61
- if (callback_start != null) {
62
- await callback_start();
63
- }
64
-
65
- if (copyOnce && copied) {
66
- return;
67
- }
68
-
69
- const copyTargets = [];
70
-
71
- if (Array.isArray(targets) && targets.length) {
72
- for (const target of targets) {
73
- if (!isObject(target)) {
74
- throw new Error(`${stringify(target)} target must be an object`);
75
- }
76
-
77
- const { dest, rename, src, transform, ...restTargetOptions } = target;
78
-
79
- if (!src || !dest) {
80
- throw new Error(
81
- `${stringify(target)} target must have "src" and "dest" properties`,
82
- );
83
- }
84
-
85
- if (rename && typeof rename !== 'string' && typeof rename !== 'function') {
86
- throw new Error(
87
- `${stringify(
88
- target,
89
- )} target's "rename" property must be a string or a function`,
90
- );
91
- }
92
-
93
- const matchedPaths = await globby(src, {
94
- expandDirectories: false,
95
- onlyFiles: false,
96
- });
97
-
98
- if (matchedPaths.length) {
99
- for (const matchedPath of matchedPaths) {
100
- const generatedCopyTargets = Array.isArray(dest)
101
- ? await Promise.all(
102
- dest.map((destination) =>
103
- generateCopyTarget(matchedPath, destination, {
104
- flatten,
105
- rename,
106
- transform,
107
- }),
108
- ),
109
- )
110
- : [
111
- await generateCopyTarget(matchedPath, dest, {
112
- flatten,
113
- rename,
114
- transform,
115
- }),
116
- ];
117
-
118
- copyTargets.push(...generatedCopyTargets);
119
- }
120
- }
121
- }
122
- }
123
-
124
- if (copyTargets.length) {
125
- setTimeout(async () => {
126
- if (verbose) {
127
- console.log(green('copied:'));
128
- }
129
-
130
- for (const copyTarget of copyTargets) {
131
- const { contents, dest, src, transformed } = copyTarget;
132
-
133
- if (transformed) {
134
- await fs.outputFile(dest, contents, restPluginOptions);
135
- } else {
136
- try {
137
- await fs.copy(src, dest, restPluginOptions);
138
- } catch (error_obj) {}
139
- }
140
-
141
- if (verbose) {
142
- let message = green(` ${bold(src)} → ${bold(dest)}`);
143
- const flags = Object.entries(copyTarget)
144
- .filter(
145
- ([key, value]) =>
146
- ['renamed', 'transformed'].includes(key) && value,
147
- )
148
- .map(([key]) => key.charAt(0).toUpperCase());
149
-
150
- if (flags.length) {
151
- message = `${message} ${yellow(`[${flags.join(', ')}]`)}`;
152
- }
153
-
154
- console.log(message);
155
- }
156
- }
157
-
158
- if (callback_end != null) {
159
- callback_end();
160
- }
161
- }, 0);
162
- } else if (verbose) {
163
- console.log(yellow('no items to copy'));
164
- }
165
-
166
- copied = true;
167
- },
168
- };
169
- };
1
+ const path = require('path');
2
+ const util = require('util');
3
+ const fs = require('fs-extra');
4
+ const isObject = require('is-plain-object');
5
+ const globby = require('globby');
6
+ const { bold, green, yellow } = require('colorette');
7
+
8
+ function stringify(value) {
9
+ return util.inspect(value, { breakLength: Infinity });
10
+ }
11
+
12
+ async function isFile(filePath) {
13
+ const fileStats = await fs.stat(filePath);
14
+
15
+ return fileStats.isFile();
16
+ }
17
+
18
+ function renameTarget(target, rename) {
19
+ const parsedPath = path.parse(target);
20
+
21
+ return typeof rename === 'string'
22
+ ? rename
23
+ : rename(parsedPath.name, parsedPath.ext.replace('.', ''));
24
+ }
25
+
26
+ async function generateCopyTarget(src, dest, { flatten, rename, transform }) {
27
+ if (transform && !(await isFile(src))) {
28
+ throw new Error(`"transform" option works only on files: '${src}' must be a file`);
29
+ }
30
+
31
+ const { base, dir } = path.parse(src);
32
+ const destinationFolder =
33
+ flatten || (!flatten && !dir) ? dest : dir.replace(dir.split('/')[0], dest);
34
+
35
+ return {
36
+ src,
37
+ dest: path.join(destinationFolder, rename ? renameTarget(base, rename) : base),
38
+ ...(transform && { contents: await transform(await fs.readFile(src)) }),
39
+ renamed: rename,
40
+ transformed: transform,
41
+ };
42
+ }
43
+
44
+ module.exports = function copy(options = {}) {
45
+ const {
46
+ copyOnce = false,
47
+ flatten = true,
48
+ hook = 'buildEnd',
49
+ targets = [],
50
+ verbose = false,
51
+ callback_start,
52
+ callback_end,
53
+ ...restPluginOptions
54
+ } = options;
55
+
56
+ let copied = false;
57
+
58
+ return {
59
+ name: 'copy',
60
+ [hook]: async () => {
61
+ if (callback_start != null) {
62
+ await callback_start();
63
+ }
64
+
65
+ if (copyOnce && copied) {
66
+ return;
67
+ }
68
+
69
+ const copyTargets = [];
70
+
71
+ if (Array.isArray(targets) && targets.length) {
72
+ for (const target of targets) {
73
+ if (!isObject(target)) {
74
+ throw new Error(`${stringify(target)} target must be an object`);
75
+ }
76
+
77
+ const { dest, rename, src, transform, ...restTargetOptions } = target;
78
+
79
+ if (!src || !dest) {
80
+ throw new Error(
81
+ `${stringify(target)} target must have "src" and "dest" properties`,
82
+ );
83
+ }
84
+
85
+ if (rename && typeof rename !== 'string' && typeof rename !== 'function') {
86
+ throw new Error(
87
+ `${stringify(
88
+ target,
89
+ )} target's "rename" property must be a string or a function`,
90
+ );
91
+ }
92
+
93
+ const matchedPaths = await globby(src, {
94
+ expandDirectories: false,
95
+ onlyFiles: false,
96
+ });
97
+
98
+ if (matchedPaths.length) {
99
+ for (const matchedPath of matchedPaths) {
100
+ const generatedCopyTargets = Array.isArray(dest)
101
+ ? await Promise.all(
102
+ dest.map((destination) =>
103
+ generateCopyTarget(matchedPath, destination, {
104
+ flatten,
105
+ rename,
106
+ transform,
107
+ }),
108
+ ),
109
+ )
110
+ : [
111
+ await generateCopyTarget(matchedPath, dest, {
112
+ flatten,
113
+ rename,
114
+ transform,
115
+ }),
116
+ ];
117
+
118
+ copyTargets.push(...generatedCopyTargets);
119
+ }
120
+ }
121
+ }
122
+ }
123
+
124
+ if (copyTargets.length) {
125
+ setTimeout(async () => {
126
+ if (verbose) {
127
+ console.log(green('copied:'));
128
+ }
129
+
130
+ for (const copyTarget of copyTargets) {
131
+ const { contents, dest, src, transformed } = copyTarget;
132
+
133
+ if (transformed) {
134
+ await fs.outputFile(dest, contents, restPluginOptions);
135
+ } else {
136
+ try {
137
+ await fs.copy(src, dest, restPluginOptions);
138
+ } catch (error_obj) {}
139
+ }
140
+
141
+ if (verbose) {
142
+ let message = green(` ${bold(src)} → ${bold(dest)}`);
143
+ const flags = Object.entries(copyTarget)
144
+ .filter(
145
+ ([key, value]) =>
146
+ ['renamed', 'transformed'].includes(key) && value,
147
+ )
148
+ .map(([key]) => key.charAt(0).toUpperCase());
149
+
150
+ if (flags.length) {
151
+ message = `${message} ${yellow(`[${flags.join(', ')}]`)}`;
152
+ }
153
+
154
+ console.log(message);
155
+ }
156
+ }
157
+
158
+ if (callback_end != null) {
159
+ callback_end();
160
+ }
161
+ }, 0);
162
+ } else if (verbose) {
163
+ console.log(yellow('no items to copy'));
164
+ }
165
+
166
+ copied = true;
167
+ },
168
+ };
169
+ };
@@ -1,48 +1,54 @@
1
- const path = require('path');
2
-
3
- const appRoot = require('app-root-path').path;
4
- const recursiveReaddir = require('recursive-readdir');
5
- const _ = require('lodash');
6
-
7
- const { TaskScheduler } = require('../../task_scheduler');
8
-
9
- const task_scheduler = new TaskScheduler();
10
-
11
- const generate_watch_files = async () => {
12
- let watch_files = [];
13
-
14
- const src_dir = path.join(appRoot, 'src');
15
-
16
- const dirs = [
17
- path.join(appRoot, 'js'),
18
- path.join(src_dir, '_locales'),
19
- path.join(src_dir, 'scss'),
20
- ];
21
-
22
- await Promise.all(
23
- dirs.map(async (dir) => {
24
- const files = await recursiveReaddir(dir);
25
-
26
- watch_files = _.union(watch_files, files);
27
- }),
28
- );
29
-
30
- return watch_files;
31
- };
32
-
33
- module.exports = function watcher({ mode }) {
34
- return {
35
- async buildStart() {
36
- await task_scheduler.unlock_dist({
37
- package_name: 'Shared',
38
- remove_dist: mode === 'production',
39
- });
40
-
41
- const watch_files = await generate_watch_files();
42
-
43
- watch_files.forEach((file) => {
44
- this.addWatchFile(file);
45
- });
46
- },
47
- };
48
- };
1
+ const path = require('path');
2
+
3
+ const appRoot = require('app-root-path').path;
4
+ const recursiveReaddir = require('recursive-readdir');
5
+ const _ = require('lodash');
6
+
7
+ const { TaskScheduler } = require('../../task_scheduler');
8
+
9
+ const task_scheduler = new TaskScheduler();
10
+
11
+ let initial_run_completed = false;
12
+
13
+ const generate_watch_files = async () => {
14
+ let watch_files = [];
15
+
16
+ const src_dir = path.join(appRoot, 'src');
17
+
18
+ const dirs = [
19
+ path.join(appRoot, 'js'),
20
+ path.join(src_dir, '_locales'),
21
+ path.join(src_dir, 'scss'),
22
+ ];
23
+
24
+ await Promise.all(
25
+ dirs.map(async (dir) => {
26
+ const files = await recursiveReaddir(dir);
27
+
28
+ watch_files = _.union(watch_files, files);
29
+ }),
30
+ );
31
+
32
+ return watch_files;
33
+ };
34
+
35
+ module.exports = function watcher({ mode }) {
36
+ return {
37
+ async buildStart() {
38
+ if (!initial_run_completed) {
39
+ await task_scheduler.unlock_dist({
40
+ package_name: 'Shared',
41
+ remove_dist: mode === 'production',
42
+ });
43
+
44
+ initial_run_completed = true;
45
+ }
46
+
47
+ const watch_files = await generate_watch_files();
48
+
49
+ watch_files.forEach((file) => {
50
+ this.addWatchFile(file);
51
+ });
52
+ },
53
+ };
54
+ };
@@ -1,18 +1,18 @@
1
- class Terser {
2
- config = {
3
- output: {
4
- comments(node, comment) {
5
- const text = comment.value;
6
- const { type } = comment;
7
- if (type === 'comment2') {
8
- return /@preserve|@license|@cc_on/i.test(text);
9
- }
10
-
11
- return undefined;
12
- },
13
- },
14
- mangle: false,
15
- };
16
- }
17
-
18
- module.exports = { Terser };
1
+ class Terser {
2
+ config = {
3
+ output: {
4
+ comments(node, comment) {
5
+ const text = comment.value;
6
+ const { type } = comment;
7
+ if (type === 'comment2') {
8
+ return /@preserve|@license|@cc_on/i.test(text);
9
+ }
10
+
11
+ return undefined;
12
+ },
13
+ },
14
+ mangle: false,
15
+ };
16
+ }
17
+
18
+ module.exports = { Terser };
@@ -1,5 +1,5 @@
1
- class ProjectName {
2
- transform = ({ project }) => project.toLowerCase().replace(/ /g, '-');
3
- }
4
-
5
- module.exports = { ProjectName };
1
+ class ProjectName {
2
+ transform = ({ project }) => project.toLowerCase().replace(/ /g, '-');
3
+ }
4
+
5
+ module.exports = { ProjectName };
@@ -1,5 +1,5 @@
1
- const projects_path = {
2
- q: 'D:\\Cloud\\Projects',
3
- };
4
-
5
- module.exports = { projects_path };
1
+ const projects_path = {
2
+ q: process.os === 'win32' ? 'D:\\Cloud\\Projects' : '/media/d/Cloud/Projects',
3
+ };
4
+
5
+ module.exports = { projects_path };
@@ -1,31 +1,39 @@
1
- const path = require('path');
2
- const fs = require('fs-extra');
3
- const childProcess = require('child_process');
4
-
5
- const { ProjectName } = require('./project_name');
6
-
7
- const project_name = new ProjectName();
8
-
9
- class TaskScheduler {
10
- unlock_dist = async ({ package_name, remove_dist }) => {
11
- if (fs.existsSync(path.join('C:', 'Program Files', 'LockHunter', 'LockHunter.exe'))) {
12
- childProcess.execSync(`SCHTASKS.EXE /RUN /TN "Unlock ${package_name} dist dir"`);
13
-
14
- if (remove_dist) {
15
- // eslint-disable-next-line global-require
16
- const { projects_path } = require('./projects_path');
17
-
18
- fs.removeSync(
19
- path.join(
20
- projects_path.q,
21
- package_name,
22
- project_name.transform({ project: package_name }),
23
- 'dist',
24
- ),
25
- );
26
- }
27
- }
28
- };
29
- }
30
-
31
- module.exports = { TaskScheduler };
1
+ const path = require('path');
2
+ const fs = require('fs-extra');
3
+ const childProcess = require('child_process');
4
+
5
+ const { ProjectName } = require('./project_name');
6
+
7
+ const project_name = new ProjectName();
8
+
9
+ class TaskScheduler {
10
+ unlock_dist = async ({ package_name, remove_dist }) => {
11
+ const is_windows = process.os === 'win32';
12
+
13
+ if (
14
+ (is_windows &&
15
+ fs.existsSync(path.join('C:', 'Program Files', 'LockHunter', 'LockHunter.exe'))) ||
16
+ !is_windows
17
+ ) {
18
+ if (is_windows) {
19
+ childProcess.execSync(`SCHTASKS.EXE /RUN /TN "Unlock ${package_name} dist dir"`);
20
+ }
21
+
22
+ if (remove_dist) {
23
+ // eslint-disable-next-line global-require
24
+ const { projects_path } = require('./projects_path');
25
+
26
+ fs.removeSync(
27
+ path.join(
28
+ projects_path.q,
29
+ package_name,
30
+ project_name.transform({ project: package_name }),
31
+ 'dist',
32
+ ),
33
+ );
34
+ }
35
+ }
36
+ };
37
+ }
38
+
39
+ module.exports = { TaskScheduler };
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
- {
2
- "name": "@loftyshaky/shared",
3
- "description": "-",
4
- "version": "0.0.30",
5
- "author": "loftyshaky",
6
- "license": "MIT",
7
- "repository": {
8
- "type": "git",
9
- "url": "https://github.com/loftyshaky/shared.git"
10
- },
11
- "scripts": {
12
- "pub": "npm publish --access public"
13
- }
14
- }
1
+ {
2
+ "name": "@loftyshaky/shared",
3
+ "description": "-",
4
+ "version": "0.0.34",
5
+ "author": "loftyshaky",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/loftyshaky/shared.git"
10
+ },
11
+ "scripts": {
12
+ "pub": "npm publish --access public"
13
+ }
14
+ }
@@ -1,7 +1,7 @@
1
- .ext_version {
2
- position: relative;
3
- bottom: -$main_margin + 4px;
4
- right: -$main_margin_2 + 6px;
5
- float: right;
6
- font-size: 14px;
7
- }
1
+ .ext_version {
2
+ position: relative;
3
+ bottom: -$main_margin + 4px;
4
+ right: -$main_margin_2 + 6px;
5
+ float: right;
6
+ font-size: 14px;
7
+ }
@@ -1,7 +1,7 @@
1
- @import '../shared/index';
2
- @import 'ext_version';
3
- @import 'main';
4
- @import 'scrollbar';
5
- @import 'section_btns';
6
- @import 'sections';
7
- @import 'transitions';
1
+ @import '../shared/index';
2
+ @import 'ext_version';
3
+ @import 'main';
4
+ @import 'scrollbar';
5
+ @import 'section_btns';
6
+ @import 'sections';
7
+ @import 'transitions';