@topvisor/ui 0.0.34 → 0.0.35

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/.storybook/TopTheme.js +82 -0
  2. package/.storybook/TopThemeManager.js +44 -0
  3. package/.storybook/main.ts +43 -0
  4. package/.storybook/manager.ts +28 -0
  5. package/.storybook/preview-head.html +16 -0
  6. package/.storybook/preview.ts +48 -0
  7. package/.storybook/vue/coreDecorator.ts +19 -0
  8. package/.storybook/vue/vModelDecorator.ts +27 -0
  9. package/.vscode/extensions.json +11 -0
  10. package/.vscode/keybindings.example.json +121 -0
  11. package/.vscode/settings.json +46 -0
  12. package/Dockerfile +3 -0
  13. package/NPM.md +25 -0
  14. package/PUBLISH.md +18 -0
  15. package/README.md +19 -52
  16. package/STORYBOOK.md +27 -0
  17. package/USE_IN_PROJECT.md +29 -0
  18. package/build/afterBuild.sh +12 -0
  19. package/build/cssModules.ts +39 -0
  20. package/build/plugin/amdFix.ts +46 -0
  21. package/build/rollup.config.ts +18 -0
  22. package/nbproject/project.properties +11 -0
  23. package/nbproject/project.xml +9 -0
  24. package/package.json +68 -19
  25. package/public/README.md +63 -0
  26. package/src/components/common/common.ts +1 -0
  27. package/src/components/common/icon/icon.ts +4 -0
  28. package/src/components/common/icon/icon.vue +15 -0
  29. package/src/components/component.ts +133 -0
  30. package/src/components/forms/button/button.stories.ts +112 -0
  31. package/src/components/forms/button/button.ts +51 -0
  32. package/src/components/forms/button/button.vue +75 -0
  33. package/src/components/forms/button/stories/README.md +35 -0
  34. package/src/components/forms/button/stories/overview.vue +33 -0
  35. package/src/components/forms/button/style/button.css +124 -0
  36. package/src/components/forms/button/style/style-outline.css +42 -0
  37. package/src/components/forms/button/style/style-soft.css +31 -0
  38. package/src/components/forms/button/style/style-transparent.css +35 -0
  39. package/src/components/forms/checkbox/checkbox.stories.ts +33 -0
  40. package/src/components/forms/checkbox/checkbox.ts +23 -0
  41. package/src/components/forms/checkbox/checkbox.vue +135 -0
  42. package/src/components/forms/checkbox/stories/overview.vue +171 -0
  43. package/src/components/forms/controlLabel/controlLabel.stories.ts +38 -0
  44. package/src/components/forms/controlLabel/controlLabel.ts +4 -0
  45. package/src/components/forms/controlLabel/controlLabel.vue +48 -0
  46. package/src/components/forms/forms.ts +10 -0
  47. package/src/components/forms/helpers.ts +10 -0
  48. package/src/components/forms/hint/hint.stories.ts +46 -0
  49. package/src/components/forms/hint/hint.ts +8 -0
  50. package/src/components/forms/hint/hint.vue +32 -0
  51. package/src/components/forms/input/input.stories.ts +31 -0
  52. package/src/components/forms/input/input.ts +34 -0
  53. package/src/components/forms/input/input.vue +170 -0
  54. package/src/components/forms/input/stories/overview.vue +61 -0
  55. package/src/components/forms/inputDate/datepicker.css +233 -0
  56. package/src/components/forms/inputDate/datepicker.ts +101 -0
  57. package/src/components/forms/inputDate/inputDate.stories.ts +41 -0
  58. package/src/components/forms/inputDate/inputDate.ts +4 -0
  59. package/src/components/forms/inputDate/inputDate.vue +127 -0
  60. package/src/components/forms/inputDate/stories/overview.vue +35 -0
  61. package/src/components/forms/radio/radio.stories.ts +34 -0
  62. package/src/components/forms/radio/radio.ts +15 -0
  63. package/src/components/forms/radio/radio.vue +107 -0
  64. package/src/components/forms/radio/stories/overview.vue +79 -0
  65. package/src/components/forms/select/select.stories.ts +34 -0
  66. package/src/components/forms/select/select.ts +36 -0
  67. package/src/components/forms/select/select.vue +253 -0
  68. package/src/components/forms/select/stories/exampleOptions.ts +71 -0
  69. package/src/components/forms/select/stories/overview.vue +60 -0
  70. package/src/components/forms/switcher/stories/overview.vue +139 -0
  71. package/src/components/forms/switcher/switcher.stories.ts +33 -0
  72. package/src/components/forms/switcher/switcher.ts +22 -0
  73. package/src/components/forms/switcher/switcher.vue +113 -0
  74. package/src/components/forms/textarea/stories/overview.vue +62 -0
  75. package/src/components/forms/textarea/textarea.stories.ts +33 -0
  76. package/src/components/forms/textarea/textarea.ts +38 -0
  77. package/src/components/forms/textarea/textarea.vue +119 -0
  78. package/src/components/formsExt/editArea/editArea.stories.ts +72 -0
  79. package/src/components/formsExt/editArea/editArea.ts +25 -0
  80. package/src/components/formsExt/editArea/editArea.vue +172 -0
  81. package/src/components/formsExt/editArea/stories/README.md +17 -0
  82. package/src/components/formsExt/editArea/stories/overview.vue +66 -0
  83. package/src/components/formsExt/editInput/editInput.stories.ts +36 -0
  84. package/src/components/formsExt/editInput/editInput.ts +20 -0
  85. package/src/components/formsExt/editInput/editInput.vue +57 -0
  86. package/src/components/formsExt/editInput/stories/overview.vue +54 -0
  87. package/src/components/formsExt/formsExt.ts +3 -0
  88. package/src/components/formsExt/radioGroup/radioGroup.stories.ts +51 -0
  89. package/src/components/formsExt/radioGroup/radioGroup.ts +28 -0
  90. package/src/components/formsExt/radioGroup/radioGroup.vue +143 -0
  91. package/src/components/formsExt/radioGroup/stories/overview.vue +78 -0
  92. package/src/components/formsExt/radioGroup/styles/top-scrollBar.css +52 -0
  93. package/src/components/helper.js +10 -0
  94. package/src/components/helpersStories.ts +151 -0
  95. package/src/components/popup/lib/popup.globalEvents.js +205 -0
  96. package/src/components/popup/lib/popup.js +702 -0
  97. package/src/components/popup/lib/worker.globalEvents.js +78 -0
  98. package/src/components/popup/lib/worker.js +232 -0
  99. package/src/components/popup/popup/listItem.vue +42 -0
  100. package/src/components/popup/popup/opener.vue +74 -0
  101. package/src/components/popup/popup/popup.stories.ts +68 -0
  102. package/src/components/popup/popup/popup.ts +93 -0
  103. package/src/components/popup/popup/popup.vue +95 -0
  104. package/src/components/popup/popup/stories/README.md +34 -0
  105. package/src/components/popup/popup/stories/listItems.vue +44 -0
  106. package/src/components/popup/popup/stories/listSubItems.vue +52 -0
  107. package/src/components/popup/popup/stories/overview.vue +208 -0
  108. package/src/components/popup/popup/style/popup.css +243 -0
  109. package/src/components/popup/popup/style/popup.m.css +71 -0
  110. package/src/components/popup/popup/style/popup.pc.css +28 -0
  111. package/src/components/popup/popup.ts +3 -0
  112. package/src/components/popup/worker.ts +1 -0
  113. package/src/components/tabs/tabs/content.vue +24 -0
  114. package/src/components/tabs/tabs/stories/README.md +10 -0
  115. package/src/components/tabs/tabs/tab.vue +52 -0
  116. package/src/components/tabs/tabs/tabs.stories.ts +171 -0
  117. package/src/components/tabs/tabs/tabs.ts +22 -0
  118. package/src/components/tabs/tabs/tabs.vue +64 -0
  119. package/src/components/tabs/tabs.ts +3 -0
  120. package/src/core/base/Colors.stories.ts +15 -0
  121. package/src/core/base/Layout.stories.ts +15 -0
  122. package/src/core/base/Properties.stories.ts +15 -0
  123. package/src/core/base/base.mdx +21 -0
  124. package/src/core/core/core.ts +144 -0
  125. package/src/core/core/events.ts +54 -0
  126. package/src/core/core/options.ts +15 -0
  127. package/src/core/core/state.ts +44 -0
  128. package/src/core/directives/tooltip.ts +55 -0
  129. package/src/core/theme/Colors.stories.ts +15 -0
  130. package/src/core/theme/Properties.stories.ts +15 -0
  131. package/src/core/theme/theme.mdx +15 -0
  132. package/src/core/utils/date.ts +164 -0
  133. package/src/core/utils/device.ts +48 -0
  134. package/src/core/utils/dom.ts +185 -0
  135. package/src/core//320/235/320/260/320/261/320/276/321/200 /320/270/320/272/320/276/320/275/320/276/320/272/gallery.vue" +72 -0
  136. package/src/core//320/235/320/260/320/261/320/276/321/200 /320/270/320/272/320/276/320/275/320/276/320/272//320/235/320/260/320/261/320/276/321/200 /320/270/320/272/320/276/320/275/320/276/320/272.mdx" +31 -0
  137. package/src/core//320/235/320/260/320/261/320/276/321/200 /320/270/320/272/320/276/320/275/320/276/320/272//320/235/320/260/320/261/320/276/321/200 /320/270/320/272/320/276/320/275/320/276/320/272.stories.ts" +14 -0
  138. package/src/docs/CSS/FAQ.mdx +43 -0
  139. package/src/docs/CSS//320/236/320/261/321/211/320/270/320/265 /320/274/320/276/320/264/320/270/321/204/320/270/320/272/320/260/321/202/320/276/321/200/321/213.mdx" +156 -0
  140. package/src/docs/CSS//320/237/320/265/321/200/320/265/320/274/320/265/320/275/320/275/321/213/320/265.mdx +47 -0
  141. package/src/docs/CSS//320/237/321/200/320/265/320/264/320/277/321/200/320/276/321/206/320/265/321/201/321/201/320/276/321/200/321/213.mdx +15 -0
  142. package/src/docs/CSS//320/240/320/265/320/272/320/276/320/274/320/265/320/275/320/264/320/260/321/206/320/270/320/270 /320/221/320/255/320/234.mdx" +49 -0
  143. package/src/docs/CSS//320/241/321/202/320/270/320/273/320/270.md +53 -0
  144. package/src/docs/CSS//320/241/321/202/320/270/320/273/320/270.mdx +4 -0
  145. package/src/docs/CSS//320/247/321/202/320/276 /321/202/320/260/320/272/320/276/320/265 css /320/274/320/276/320/264/321/203/320/273/321/214.mdx" +53 -0
  146. package/src/docs/ROADMAP.md +17 -0
  147. package/src/docs/Roadmap.mdx +4 -0
  148. package/src/docs//320/222/320/262/320/265/320/264/320/265/320/275/320/270/320/265 /320/262 Storybook.mdx" +323 -0
  149. package/src/docs//320/232/320/276/320/274/320/277/320/276/320/275/320/265/320/275/321/202/321/213.mdx +20 -0
  150. package/src/docs//320/237/320/276/320/273/320/265/320/267/320/275/320/260/321/217 /320/270/320/275/321/204/320/276/321/200/320/274/320/260/321/206/320/270/321/217.mdx" +8 -0
  151. package/src/docs//320/241/321/202/320/260/320/275/320/264/320/260/321/200/321/202/321/213 /320/272/320/276/320/264/320/260/IDE.mdx" +42 -0
  152. package/src/docs//320/241/321/202/320/260/320/275/320/264/320/260/321/200/321/202/321/213 /320/272/320/276/320/264/320/260//320/233/320/270/320/275/321/202/320/265/321/200.mdx" +72 -0
  153. package/src/docs//320/241/321/202/320/260/320/275/320/264/320/260/321/200/321/202/321/213 /320/272/320/276/320/264/320/260//320/241/321/202/320/260/320/275/320/264/320/260/321/200/321/202/321/213 /320/272/320/276/320/264/320/260.mdx" +29 -0
  154. package/src/globals.d.ts +1 -0
  155. package/{icomoon → src/resources/icomoon}/demo-files/demo.css +161 -161
  156. package/{icomoon → src/resources/icomoon}/demo-files/demo.js +30 -30
  157. package/{icomoon → src/resources/icomoon}/demo.html +2945 -2945
  158. package/{icomoon → src/resources/icomoon}/fonts/Topvisor-2.svg +232 -232
  159. package/{icomoon → src/resources/icomoon}/style.css +647 -647
  160. package/src/resources/styles/core/colors.css +204 -0
  161. package/src/resources/styles/core/components.css +70 -0
  162. package/src/resources/styles/core/core.ts +10 -0
  163. package/src/resources/styles/core/forms/clear.css +19 -0
  164. package/src/resources/styles/core/forms/controls.css +20 -0
  165. package/src/resources/styles/core/forms/focusable.css +26 -0
  166. package/src/resources/styles/core/forms/forms.css +100 -0
  167. package/src/resources/styles/core/icon.css +58 -0
  168. package/src/resources/styles/core/layout.css +40 -0
  169. package/src/resources/styles/core/modifiers/as.css +9 -0
  170. package/src/resources/styles/core/modifiers/ellipsis.css +18 -0
  171. package/src/resources/styles/core/modifiers/modifiers.css +81 -0
  172. package/src/resources/styles/core/modifiers/only.css +19 -0
  173. package/src/resources/styles/core/select.css +16 -0
  174. package/src/resources/styles/jquery-ui.min.css +6 -0
  175. package/src/resources/styles/storybook.css +11 -0
  176. package/src/resources/styles/themes/dark/theme.css +139 -0
  177. package/src/resources/styles/themes/dark.ts +1 -0
  178. package/src/resources/styles/themes/light/theme.css +139 -0
  179. package/src/resources/styles/themes/light.ts +1 -0
  180. package/src/storybook/components/color.vue +45 -0
  181. package/src/storybook/components/colors.vue +34 -0
  182. package/src/storybook/components/icomoon.ts +38 -0
  183. package/src/storybook/components/properties.vue +82 -0
  184. package/src/storybook/resources/accessibility.png +0 -0
  185. package/src/storybook/resources/accessibility.svg +5 -0
  186. package/src/storybook/resources/addon-library.png +0 -0
  187. package/src/storybook/resources/assets.png +0 -0
  188. package/src/storybook/resources/context.png +0 -0
  189. package/src/storybook/resources/discord.svg +15 -0
  190. package/src/storybook/resources/docs.png +0 -0
  191. package/src/storybook/resources/figma-plugin.png +0 -0
  192. package/src/storybook/resources/github.svg +3 -0
  193. package/src/storybook/resources/share.png +0 -0
  194. package/src/storybook/resources/styling.png +0 -0
  195. package/src/storybook/resources/testing.png +0 -0
  196. package/src/storybook/resources/theming.png +0 -0
  197. package/src/storybook/resources/tutorials.svg +12 -0
  198. package/src/storybook/resources/youtube.svg +4 -0
  199. package/src//320/224/320/276/320/261/321/200/320/276 /320/277/320/276/320/266/320/260/320/273/320/276/320/262/320/260/321/202/321/214.mdx" +3 -0
  200. package/tsconfig.json +62 -0
  201. package/vite.config.ts +91 -0
  202. package/.chunks/datepicker-0b648b9f.es.js +0 -275
  203. package/.chunks/datepicker-0b648b9f.es.js.map +0 -1
  204. package/.chunks/datepicker-0e9a0541.amd.js +0 -234
  205. package/.chunks/datepicker-0e9a0541.amd.js.map +0 -1
  206. package/.chunks/forms-02202302.amd.js +0 -3
  207. package/.chunks/forms-02202302.amd.js.map +0 -1
  208. package/.chunks/forms-eb00d0c1.es.js +0 -946
  209. package/.chunks/forms-eb00d0c1.es.js.map +0 -1
  210. package/.chunks/popup-6f73b4b2.es.js +0 -700
  211. package/.chunks/popup-6f73b4b2.es.js.map +0 -1
  212. package/.chunks/popup-e1f34511.amd.js +0 -341
  213. package/.chunks/popup-e1f34511.amd.js.map +0 -1
  214. package/common/common.amd.js +0 -2
  215. package/common/common.amd.js.map +0 -1
  216. package/common/common.js +0 -2
  217. package/common/common.js.map +0 -1
  218. package/core/core.amd.js +0 -2
  219. package/core/core.amd.js.map +0 -1
  220. package/core/core.js +0 -6
  221. package/core/core.js.map +0 -1
  222. package/core.css +0 -1
  223. package/dark.css +0 -1
  224. package/forms/forms.amd.js +0 -2
  225. package/forms/forms.amd.js.map +0 -1
  226. package/forms/forms.js +0 -15
  227. package/forms/forms.js.map +0 -1
  228. package/forms/helpers.amd.js +0 -2
  229. package/forms/helpers.amd.js.map +0 -1
  230. package/forms/helpers.js +0 -9
  231. package/forms/helpers.js.map +0 -1
  232. package/forms.css +0 -1
  233. package/formsExt/formsExt.amd.js +0 -3
  234. package/formsExt/formsExt.amd.js.map +0 -1
  235. package/formsExt/formsExt.js +0 -152
  236. package/formsExt/formsExt.js.map +0 -1
  237. package/formsExt.css +0 -1
  238. package/light.css +0 -1
  239. package/popup/popup.amd.js +0 -3
  240. package/popup/popup.amd.js.map +0 -1
  241. package/popup/popup.js +0 -144
  242. package/popup/popup.js.map +0 -1
  243. package/popup/worker.amd.js +0 -2
  244. package/popup/worker.amd.js.map +0 -1
  245. package/popup/worker.js +0 -154
  246. package/popup/worker.js.map +0 -1
  247. package/popup.css +0 -1
  248. package/tabs/tabs.amd.js +0 -3
  249. package/tabs/tabs.amd.js.map +0 -1
  250. package/tabs/tabs.js +0 -97
  251. package/tabs/tabs.js.map +0 -1
  252. package/tabs.css +0 -1
  253. package/utils/date.amd.js +0 -2
  254. package/utils/date.amd.js.map +0 -1
  255. package/utils/date.js +0 -6
  256. package/utils/date.js.map +0 -1
  257. package/utils/device.amd.js +0 -2
  258. package/utils/device.amd.js.map +0 -1
  259. package/utils/device.js +0 -6
  260. package/utils/device.js.map +0 -1
  261. package/utils/dom.amd.js +0 -2
  262. package/utils/dom.amd.js.map +0 -1
  263. package/utils/dom.js +0 -64
  264. package/utils/dom.js.map +0 -1
  265. /package/{icomoon → src/resources/icomoon}/fonts/Topvisor-2.ttf +0 -0
  266. /package/{icomoon → src/resources/icomoon}/fonts/Topvisor-2.woff +0 -0
  267. /package/{icomoon → src/resources/icomoon}/selection.json +0 -0
@@ -0,0 +1,82 @@
1
+ import { global } from '@storybook/global';
2
+
3
+ import light from '@/resources/styles/themes/light/theme.css?raw';
4
+ import dark from '@/resources/styles/themes/dark/theme.css?raw';
5
+
6
+ export const themes = {
7
+ light,
8
+ dark,
9
+ };
10
+
11
+ /**
12
+ * Загрузка выбранной темы
13
+ * Тема, указанная в адресной строке приоритетна
14
+ * @returns {keyof themes} - имя темы
15
+ */
16
+ function load() {
17
+ let theme = location.search.match(/topTheme:(\w+)/)?.[1];
18
+ if (!theme) theme = localStorage.getItem('topTheme');
19
+ if (!theme) theme = 'light';
20
+
21
+ setCSS(theme);
22
+
23
+ return theme;
24
+ }
25
+
26
+ /**
27
+ * Сохранение выбранной темы
28
+ * @param {keyof themes} theme
29
+ */
30
+ function save(theme) {
31
+ localStorage.setItem('topTheme', theme);
32
+
33
+ setCSS(theme);
34
+ }
35
+
36
+ /**
37
+ * Установить тему
38
+ * @param {keyof themes} theme
39
+ */
40
+ function setCSS(theme) {
41
+ // см. preview-head.html
42
+ if (global.topThemeStyle.dataset.theme !== theme) {
43
+ global.topThemeStyle.dataset.theme = theme;
44
+
45
+ global.topThemeStyle.innerHTML = themes[theme];
46
+ }
47
+ }
48
+
49
+ /**
50
+ * Получить стили текущей темы
51
+ * @returns css стили
52
+ */
53
+ export function getCurrentCSS() {
54
+ return global.topThemeStyle.innerHTML;
55
+ }
56
+
57
+ export const decorator = (story, context) => {
58
+ save(context.globals.topTheme);
59
+
60
+ return story(context);
61
+ };
62
+
63
+ export const type = {
64
+ description: 'Выбор темы',
65
+ defaultValue: load(),
66
+ toolbar: {
67
+ title: 'Выбор темы',
68
+ items: [
69
+ {
70
+ icon: 'sun',
71
+ title: 'light',
72
+ value: 'light'
73
+ },
74
+ {
75
+ icon: 'moon',
76
+ title: 'dark',
77
+ value: 'dark'
78
+ }
79
+ ],
80
+ dynamicTitle: true
81
+ },
82
+ };
@@ -0,0 +1,44 @@
1
+ import { create } from '@storybook/theming/create';
2
+
3
+ /**
4
+ * Получение имени выбранной темы
5
+ */
6
+ function getName() {
7
+ let theme = location.search.match(/topTheme:(\w+)/)?.[1];
8
+ if (!theme) theme = localStorage.getItem('topTheme');
9
+ if (!theme) theme = 'light';
10
+
11
+ return theme;
12
+ }
13
+
14
+ /**
15
+ * Получение настроек выбранной темы
16
+ * Для смены темы Storybook надо перезагружать страницу
17
+ */
18
+ export function get() {
19
+ if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
20
+ return themes.dark;
21
+ }
22
+
23
+ return themes.light;
24
+ }
25
+
26
+ // https://storybook.js.org/docs/vue/configure/theming
27
+ const themeBase = {
28
+ brandTitle: 'Topvisor Princip',
29
+ brandUrl: 'https://topvisor.com',
30
+ brandTarget: '_blank',
31
+ }
32
+
33
+ export const themes = {
34
+ light: create({
35
+ ...themeBase,
36
+ base: 'light',
37
+ brandImage: 'https://topvisor.com/images/ru/logo/mods/light/tv.svg',
38
+ }),
39
+ dark: create({
40
+ ...themeBase,
41
+ base: 'dark',
42
+ brandImage: 'https://topvisor.com/images/ru/logo/mods/dark/tv.svg',
43
+ })
44
+ }
@@ -0,0 +1,43 @@
1
+ import type { StorybookConfig } from '@storybook/vue3-vite';
2
+ import { dirname, join } from 'path';
3
+
4
+ function getAbsolutePath (value: string): string {
5
+ return dirname(require.resolve(join(value, 'package.json')));
6
+ }
7
+
8
+ const config = {
9
+ stories: [
10
+ '../src/**/*.mdx',
11
+ '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)',
12
+ ],
13
+ addons: [
14
+ // https://storybook.js.org/docs/react/essentials/introduction
15
+ // getAbsolutePath("@storybook/addon-backgrounds"),
16
+ getAbsolutePath('@storybook/addon-controls'),
17
+
18
+ // https://github.com/storybookjs/storybook/issues/23787
19
+ getAbsolutePath('@storybook/addon-actions'),
20
+ getAbsolutePath('@storybook/addon-docs'),
21
+ getAbsolutePath('@storybook/addon-highlight'),
22
+ getAbsolutePath('@storybook/addon-measure'),
23
+ getAbsolutePath('@storybook/addon-outline'),
24
+ getAbsolutePath('@storybook/addon-toolbars'),
25
+ getAbsolutePath('@storybook/addon-viewport'),
26
+
27
+ getAbsolutePath('@storybook/addon-links'),
28
+ getAbsolutePath('@storybook/addon-interactions'),
29
+ getAbsolutePath('@storybook/addon-a11y'),
30
+ getAbsolutePath('@storybook/addon-designs'),
31
+ getAbsolutePath('@storybook/theming'),
32
+ getAbsolutePath('storybook-addon-pseudo-states'),
33
+ ],
34
+ framework: {
35
+ name: '@storybook/vue3-vite',
36
+ options: {},
37
+ },
38
+ docs: {
39
+ autodocs: 'tag',
40
+ },
41
+ } satisfies StorybookConfig;
42
+
43
+ export default config;
@@ -0,0 +1,28 @@
1
+ import { addons } from '@storybook/manager-api';
2
+ import * as TopThemeManager from './TopThemeManager';
3
+
4
+ addons.setConfig({
5
+ isFullscreen2: false,
6
+ showNav: true,
7
+ showPanel: true,
8
+ panelPosition: 'right',
9
+ enableShortcuts: true,
10
+ showToolbar: true,
11
+ theme: TopThemeManager.get(),
12
+ selectedPanel: undefined,
13
+ initialActive: 'sidebar',
14
+ sidebar: {
15
+ showRoots: true,
16
+ collapsedRoots: [
17
+ 'docs',
18
+ 'core',
19
+ ],
20
+ },
21
+ toolbar: {
22
+ title: { hidden: false },
23
+ zoom: { hidden: false },
24
+ eject: { hidden: false },
25
+ copy: { hidden: false },
26
+ fullscreen: { hidden: false },
27
+ },
28
+ });
@@ -0,0 +1,16 @@
1
+ <link
2
+ href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@300..800&display=swap"
3
+ rel="stylesheet"
4
+ crossorigin="anonymous"
5
+ >
6
+
7
+ <link
8
+ href="/src/resources/styles/jquery-ui.min.css"
9
+ rel="stylesheet"
10
+ crossorigin="anonymous"
11
+ >
12
+
13
+ <script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
14
+ <script src="https://code.jquery.com/ui/1.13.2/jquery-ui.min.js"></script>
15
+
16
+ <style id="topThemeStyle"></style>
@@ -0,0 +1,48 @@
1
+ import type { Preview } from '@storybook/vue3';
2
+ import * as TopTheme from './TopTheme';
3
+ import * as TopThemeManager from './TopThemeManager';
4
+ import vModelDecorator from './vue/vModelDecorator';
5
+ import coreDecorator from './vue/coreDecorator';
6
+ import Core from '@/core/core/core';
7
+
8
+ Core.defineOptions({});
9
+
10
+ import '@/resources/styles/storybook.css';
11
+ import '@/resources/styles/core/core';
12
+ import '@/resources/icomoon/style.css';
13
+
14
+ const preview = {
15
+ parameters: {
16
+ actions: { argTypesRegex: '^on[A-Z].*' },
17
+ controls: {
18
+ matchers: {
19
+ color: /(background|color)$/i,
20
+ date: /Date$/,
21
+ },
22
+ },
23
+ docs: {
24
+ theme: TopThemeManager.get(),
25
+ },
26
+ options: {
27
+ storySort: {
28
+ order: [
29
+ 'Добро пожаловать',
30
+ 'docs',
31
+ 'core',
32
+ 'components',
33
+ ],
34
+ },
35
+ },
36
+ },
37
+ decorators: [
38
+ // если декораторы меняют args, то show code перестает работать и выводит {} satisfies Story
39
+ TopTheme.decorator,
40
+ coreDecorator,
41
+ vModelDecorator,
42
+ ],
43
+ globalTypes: {
44
+ topTheme: TopTheme.type,
45
+ },
46
+ } satisfies Preview;
47
+
48
+ export default preview;
@@ -0,0 +1,19 @@
1
+ import type { Preview } from '@storybook/vue3';
2
+ import { getCurrentInstance } from 'vue';
3
+ import Core from '@/core/core/core';
4
+
5
+ type Decorator = Required<Preview>['decorators'][number];
6
+
7
+ /**
8
+ * Подключение Core UI
9
+ */
10
+ const coreDecorator: Decorator = (story, context) => {
11
+ const app = getCurrentInstance()?.appContext.app;
12
+ app?.use(Core, {
13
+ dateFormat: 'd.m.Y',
14
+ });
15
+
16
+ return story(context);
17
+ };
18
+
19
+ export default coreDecorator;
@@ -0,0 +1,27 @@
1
+ import type { Preview } from '@storybook/vue3';
2
+ import { useArgs } from '@storybook/preview-api';
3
+
4
+ type Decorator = Required<Preview>['decorators'][number];
5
+
6
+ /**
7
+ * Двусторонняя привязка v-model vue и args storybook
8
+ */
9
+ const vModelDecorator: Decorator = (story, context) => {
10
+ const [args, updateArgs] = useArgs();
11
+
12
+ if ('modelValue' in args) {
13
+ const onUpdate = args['onUpdate:model-value'] || args['onUpdate:modelValue'];
14
+ args['onUpdate:model-value'] = undefined;
15
+
16
+ args['onUpdate:modelValue'] = (...params) => {
17
+ onUpdate?.(...params);
18
+
19
+ const modelValue = params[0] === undefined ? null : params[0];
20
+ updateArgs({ modelValue });
21
+ };
22
+ }
23
+
24
+ return story(context);
25
+ };
26
+
27
+ export default vModelDecorator;
@@ -0,0 +1,11 @@
1
+ {
2
+ "recommendations": [
3
+ "ruakr.ftp-kr",
4
+ "unifiedjs.vscode-mdx",
5
+ "vue.vscode-typescript-vue-plugin",
6
+ "vue.volar",
7
+ "dbaeumer.vscode-eslint",
8
+ "bmewburn.vscode-intelephense-client",
9
+ "neilbrayfield.php-docblocker"
10
+ ]
11
+ }
@@ -0,0 +1,121 @@
1
+ [
2
+ {
3
+ "key": "ctrl+shift+alt+u",
4
+ "command": "git.pull"
5
+ },
6
+ {
7
+ "key": "ctrl+alt+r",
8
+ "command": "git.cleanAll"
9
+ },
10
+ {
11
+ "key": "ctrl+alt+s",
12
+ "command": "git.commit"
13
+ },
14
+ {
15
+ "key": "ctrl+shift+alt+s",
16
+ "command": "git.push"
17
+ },
18
+ {
19
+ "key": "ctrl+shift+alt+e",
20
+ "command": "git.openChange"
21
+ },
22
+ {
23
+ "key": "ctrl+q",
24
+ "command": "workbench.action.navigateToLastEditLocation"
25
+ },
26
+ {
27
+ "key": "f4",
28
+ "command": "workbench.action.toggleZenMode"
29
+ },
30
+ {
31
+ "key": "f7",
32
+ "command": "outline.focus"
33
+ },
34
+ {
35
+ "key": "alt+1",
36
+ "command": "workbench.files.action.showActiveFileInExplorer"
37
+ },
38
+ {
39
+ "key": "alt+2",
40
+ "command": "copyRelativeFilePath"
41
+ },
42
+ {
43
+ "key": "alt+3",
44
+ "command": "revealFileInOS"
45
+ },
46
+ {
47
+ "key": "ctrl+c",
48
+ "command": "-gitlens.views.commits.copy",
49
+ "when": "gitlens:enabled && focusedView =~ /^gitlens\\.views\\.commits/"
50
+ },
51
+ {
52
+ "key": "ctrl+c",
53
+ "command": "-gitlens.views.branches.copy",
54
+ "when": "gitlens:enabled && focusedView =~ /^gitlens\\.views\\.branches/"
55
+ },
56
+ {
57
+ "key": "ctrl+c",
58
+ "command": "-gitlens.views.fileHistory.copy",
59
+ "when": "gitlens:enabled && focusedView =~ /^gitlens\\.views\\.fileHistory/"
60
+ },
61
+ {
62
+ "key": "ctrl+c",
63
+ "command": "-gitlens.views.contributors.copy",
64
+ "when": "gitlens:enabled && focusedView =~ /^gitlens\\.views\\.contributors/"
65
+ },
66
+ {
67
+ "key": "ctrl+c",
68
+ "command": "-gitlens.views.lineHistory.copy",
69
+ "when": "gitlens:enabled && focusedView =~ /^gitlens\\.views\\.lineHistory/"
70
+ },
71
+ {
72
+ "key": "ctrl+c",
73
+ "command": "-gitlens.views.remotes.copy",
74
+ "when": "gitlens:enabled && focusedView =~ /^gitlens\\.views\\.remotes/"
75
+ },
76
+ {
77
+ "key": "ctrl+c",
78
+ "command": "-gitlens.views.repositories.copy",
79
+ "when": "gitlens:enabled && focusedView =~ /^gitlens\\.views\\.repositories/"
80
+ },
81
+ {
82
+ "key": "ctrl+c",
83
+ "command": "-gitlens.views.searchAndCompare.copy",
84
+ "when": "gitlens:enabled && focusedView =~ /^gitlens\\.views\\.searchAndCompare\\b/"
85
+ },
86
+ {
87
+ "key": "ctrl+c",
88
+ "command": "-gitlens.views.stashes.copy",
89
+ "when": "gitlens:enabled && focusedView =~ /^gitlens\\.views\\.stashes/"
90
+ },
91
+ {
92
+ "key": "ctrl+c",
93
+ "command": "-gitlens.views.tags.copy",
94
+ "when": "gitlens:enabled && focusedView =~ /^gitlens\\.views\\.tags/"
95
+ },
96
+ {
97
+ "key": "ctrl+shift+d",
98
+ "command": "ftpkr.download"
99
+ },
100
+ {
101
+ "key": "ctrl+shift+u",
102
+ "command": "ftpkr.upload"
103
+ },
104
+ {
105
+ "key": "ctrl+shift+alt+r",
106
+ "command": "git.revertSelectedRanges"
107
+ },
108
+ {
109
+ "key": "ctrl+k ctrl+r",
110
+ "command": "-git.revertSelectedRanges",
111
+ "when": "isInDiffEditor && !operationInProgress"
112
+ },
113
+ {
114
+ "key": "alt+4",
115
+ "command": "-workbench.action.openEditorAtIndex4"
116
+ },
117
+ {
118
+ "key": "alt+4",
119
+ "command": "gl.openActiveFile"
120
+ }
121
+ ]
@@ -0,0 +1,46 @@
1
+ {
2
+ "git.autofetch": true,
3
+ "git.confirmSync": false,
4
+ "git.enableSmartCommit": true,
5
+ "zenMode.hideActivityBar": false,
6
+ "zenMode.hideLineNumbers": false,
7
+ "[json]": {
8
+ "editor.defaultFormatter": "vscode.json-language-features"
9
+ },
10
+ "[javascript]": {
11
+ "editor.defaultFormatter": "vscode.typescript-language-features"
12
+ },
13
+ "intelephense.phpdoc.useFullyQualifiedNames": true,
14
+ "intelephense.format.braces": "k&r",
15
+ "explorer.confirmDelete": false,
16
+ "zenMode.hideStatusBar": false,
17
+ "zenMode.hideTabs": false,
18
+ "zenMode.centerLayout": false,
19
+ "zenMode.fullScreen": false,
20
+ "editor.lineHeight": 17,
21
+ // "editor.hover.enabled": false,
22
+ "editor.hover.delay": 1000,
23
+ "workbench.tree.indent": 24,
24
+ "workbench.editor.pinnedTabSizing": "shrink",
25
+ "workbench.editor.highlightModifiedTabs": true,
26
+ "editor.rulers": [
27
+ 150
28
+ ],
29
+ "editor.formatOnType": true,
30
+ "git.allowForcePush": false,
31
+ "npm.packageManager": "npm",
32
+ "files.eol": "auto",
33
+ "html.format.wrapAttributes": "force-expand-multiline",
34
+ "css.format.newlineBetweenRules": false,
35
+ "css.format.maxPreserveNewLines": 2,
36
+ "css.format.spaceAroundSelectorSeparator": true,
37
+ "css.lint.emptyRules": "ignore",
38
+ "vue.codeLens.enabled": false,
39
+ "git.useEditorAsCommitInput": false,
40
+ "git.postCommitCommand": "sync",
41
+ "files.exclude": {
42
+ "**/nbproject": true,
43
+ "**/node_modules": true,
44
+ },
45
+ "typescript.tsdk": "node_modules/typescript/lib"
46
+ }
package/Dockerfile ADDED
@@ -0,0 +1,3 @@
1
+ FROM nginx:alpine
2
+
3
+ COPY ./storybook-static /usr/share/nginx/html
package/NPM.md ADDED
@@ -0,0 +1,25 @@
1
+ # Введение в npm
2
+
3
+ Скачать node.js (npm входит в состав node.js): https://nodejs.org/ru/download
4
+
5
+ Описание файлов:
6
+
7
+ - **package.json** - настройки разрабатываемого пакета, а также его зависимости, [документация](https://docs.npmjs.com/cli/v9/configuring-npm/package-json)
8
+ - **package-lock.json** - информация об установленных версиях пакетов, [документация](https://docs.npmjs.com/cli/v9/configuring-npm/package-lock-json)
9
+
10
+ Описание команд:
11
+
12
+ > `npm i` - является сокращенной командой `npm install`
13
+
14
+ > `npm i -D` - является сокращенной командой `npm install --save-dev`
15
+
16
+ - `npm i -g npm@latest` - обновление npm до последней версии
17
+ - `npm i` - установка зависимостей из файла **package.json**
18
+ - `npm- ci i` - установка зависимостей из файла **package-lock.json**
19
+ - `npm i {{ name }}` - установка конкретного пакета
20
+ - `npm i -D {{ name }}` - установка конкретного пакета как dev зависимости
21
+
22
+ Команду **npm ci** необходимо использовать в случаях, когда есть необходимость загрузки конкретных версий.
23
+ Обычно это нужно для отладки и в сценариях CI/CD, которые обязаны использовать указанные вами версии.
24
+
25
+ Если вы не знакомы с **npm** рекомендуется прочитать статью на хабре: [npm, package.json и package-lock.json](https://habr.com/ru/companies/ruvds/articles/423703/)
package/PUBLISH.md ADDED
@@ -0,0 +1,18 @@
1
+ # Публикация в npm
2
+
3
+ Не путать с публикацией Storybook.
4
+
5
+ https://www.npmjs.com/package/topvisor-ui.
6
+
7
+ Настройки и скрипты сборки см. в папке [build/](build/)
8
+
9
+ - `npm run build` - выполнить сбоку
10
+ - убедиться, что в сборке нет приватных данных, после публикации все файлы в /dist/ доступны в открытом доступе
11
+ - `npm run publish` - запустить публикацию
12
+
13
+ ## Публикация в CDN
14
+
15
+ После публикации в npm пакет будет автоматически доступен на следующих CDN:
16
+
17
+ - https://unpkg.com/@topvisor/ui/
18
+ - https://cdn.jsdelivr.net/npm/@topvisor/ui/
package/README.md CHANGED
@@ -1,63 +1,30 @@
1
- # UI kit Topvisor Vue
2
1
 
3
- ## Vue компоненты
2
+ [![pipeline status](https://gitlab.topvisor.com/topvisor/ui/badges/master/pipeline.svg)](https://gitlab.topvisor.com/topvisor/ui/-/commits/master)
3
+ [![npm version](https://badge.fury.io/js/@topvisor%2Fui.svg)](https://badge.fury.io/js/@topvisor%2Fui)
4
4
 
5
- Компоненты поставляются в двух форматах:
5
+ # Topvisor UI kit, Vue 3
6
6
 
7
- - amd (requirejs)
8
- - es
7
+ Документация по работе с UI-kit и разработке компонентов см. здесь: https://ui.topvisor.com/.
9
8
 
10
- Компоненты делятся на разные модули и доступны через импорт этих модулей.
9
+ npm пакет см. здесь: https://www.npmjs.com/package/@topvisor/ui
11
10
 
12
- Каждый модуль находится в отдельной папке, соответствующей имени модулю.
11
+ В проекте необходимо использовать самую свежую версию node.js LTS и npm.
13
12
 
14
- Все стили модулей находятся в корневой папке в файлах соответствующих имени модулю.
13
+ - [Введение в npm](NPM.md)
14
+ - [Storybook](STORYBOOK.md)
15
+ - [Публикация новой версии](PUBLISH.md)
16
+ - [Использование в проектах](USE_IN_PROJECT.md)
15
17
 
16
- Список всех компонентов см. на [npmjs](https://www.npmjs.com/package/topvisor-ui?activeTab=code).
18
+ ## Локальный сервер разработки
17
19
 
18
- ## Другие ресурсы
20
+ Для проверки написанных компонентов в проекте предусмотрена интеграция со Storybook.
19
21
 
20
- - [core.css](core.css) - основная палитра цветов и стили компонентов
21
- - [light.css](light.css) - светлая тема
22
- - [dark.css](dark.css) - темная тема
22
+ Storybook настроен для работы с Vite и Vue с поддержкой Hot Module Replacement.
23
23
 
24
- ## Подключение стилей
24
+ Шаги для быстрой настройке локального сервера:
25
25
 
26
- Стили компонентов подгружаются автоматически.
27
-
28
- Стили core.css необходимо подгрузить на страницу.
29
-
30
- ```js
31
- import '@topvisor/ui/core.css';
32
- ```
33
-
34
- Стили темы необходимо подгрузить на страницу.
35
-
36
- Для смены темы необходимо подгрузить файл стилей необходимой темы и сразу отключить стили предыдущей темы.
37
-
38
- ```js
39
- import '@topvisor/ui/light.css';
40
- ```
41
-
42
- Стили icomoon необходимо подгрузить на страницу.
43
-
44
- ```js
45
- import '@topvisor/ui/icomoon/style.css';
46
- ```
47
-
48
- ## Подключение компонентов
49
-
50
- Пример подключения библиотеки Forms и компонента Button:
51
-
52
- ```javascript
53
- requirejs(['@topvisor/ui/forms/forms.amd'], ({Button}) => {
54
- console.log(Button);
55
- });
56
-
57
- requirejs(['@topvisor/ui/forms/forms.amd'], Forms => {
58
- const { Button } = Forms;
59
-
60
- console.log(Forms);
61
- console.log(Button);
62
- });
63
- ```
26
+ 1. Установить node.js (npm входит в состав node.js): https://nodejs.org/ru/download
27
+ 2. `git clone https://gitlab.topvisor.com/topvisor/ui.git` - склонировать проект или установить его другим удобным способом
28
+ 3. `npm i -g npm@latest` - обновить до последней версии npm
29
+ 4. `npm i` - установить зависимости
30
+ 5. `npm run storybook` - запустить локальный сервер Storybook
package/STORYBOOK.md ADDED
@@ -0,0 +1,27 @@
1
+ # Storybook
2
+
3
+ https://storybook.js.org/
4
+
5
+ ## Основные команды Storybook
6
+
7
+ Информация о параметрах dev сервера и сборки: https://storybook.js.org/docs/react/api/cli-options
8
+
9
+ - `npx storybook@latest init` - установка файлов Storybook в проект (в этом проекте повторно не выполнять)
10
+ - `npx storybook@latest upgrade` - обновить Storybook в случае необходимости
11
+ - `storybook dev` - запуск локального сервера Storybook
12
+ - `storybook build` - запуск сборки Storybook
13
+
14
+ ## Локальный сервер разработки
15
+
16
+ - `npm -i` - загрузить все зависимости проекта (выполнять один раз)
17
+ - `npx storybook@latest upgrade` - обновить Storybook (в случае необходимости)
18
+ - `npm run storybook` - запуск локального сервера Storybook
19
+
20
+ ## Сборка storybook в статический сайт
21
+
22
+ Не путать со сборкой проекта @topvisor/ui.
23
+
24
+ `storybook build` - выполнить сборку
25
+
26
+ Сборка Storybook производится автоматически через CI/CD и публикуется по адресу: https://ui.topvisor.com/.
27
+ Вам нет необходимости делать сборку самостоятельно.