@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,29 @@
1
+ [![npm version](https://badge.fury.io/js/@topvisor%2Fui.svg)](https://badge.fury.io/js/@topvisor%2Fui)
2
+
3
+ # Использование в других проектах
4
+
5
+ ## Использование @topvisor/ui после публикации, пример с topvisor.com
6
+
7
+ Опубликованный пакет можно сразу использовать через публичный [CDN](PUBLISH.md#публикация-в-cdn).
8
+
9
+ Подключение js пактов в topvisor.com настраивается в файле [requirejs.json](https://gitlab.topvisor.com/topvisor/topvisor.com/-/tree/master/requirejs.json).
10
+
11
+ ## Тестирование сборки @topvisor/ui без публикации
12
+
13
+ Для тестирования сборки используется локальный сервер предпросмотра vite preview с автосборкой vite build --watch.
14
+
15
+ Получаемые файлы с этого сервера не кешируются.
16
+
17
+ Режим автосборки автоматически пересобирает проект и новая сборка доступна на сервере предпросмотра.
18
+
19
+ Адрес севера предпросмотра по умолчанию: http://localhost:4173
20
+
21
+ - `npm run preview` - запустить сервер предпросмотра с автосборкой
22
+ - в нужном проекте замените путь к @topvisor/ui на сервер предпросмотра
23
+
24
+ Например: `https://cdn.jsdelivr.net/npm/@topvisor/ui` => `http://localhost:4173`
25
+
26
+ ## Использование topvisor-ui в другом проекте без публикации, пример с topvisor.dev
27
+
28
+ - ```git submodule init``` - инициализация подмодуля в проекте
29
+ - ```git submodule update``` - загрузка подмодуля, будет произведен clone репозитория подмодуля
@@ -0,0 +1,12 @@
1
+ echo ''
2
+ echo 'run afterBuild...'
3
+
4
+ echo '- remove /dist/for-delete/'
5
+ rm -rf dist/for-delete/
6
+
7
+ echo '- add icomoon'
8
+ cp -r src/resources/icomoon dist/
9
+
10
+ echo '- make package.json'
11
+ cp package.json dist/
12
+ npm pkg --prefix dist delete scripts devDependencies
@@ -0,0 +1,39 @@
1
+ import stringHash from "string-hash";
2
+
3
+ // https://github.com/madyankin/postcss-modules/blob/325f0b33f1b746eae7aa827504a5efd0949022ef/src/scoping.js#L36
4
+ function generateScopedNameDefault(name, filename, css) {
5
+ const i = css.indexOf(`.${name}`);
6
+ const lineNumber = css.substr(0, i).split(/[\r\n]/).length;
7
+ const hash = stringHash(css).toString(36).substr(0, 5);
8
+
9
+ return `_${name}_${hash}_${lineNumber}`;
10
+ }
11
+
12
+ export default {
13
+ /**
14
+ * Оставить глобальные классы без преобразования
15
+ * С глобальными классами нельзя работать через css module
16
+ * С глобальными классами можно работать, определяя их их в интерфесе vue css module
17
+ * @param {type} name - имя класса
18
+ * @param {type} filename - файл стилей
19
+ * @param {type} css - стили
20
+ * @returns {String} - имя класса после предкомпиляции
21
+ */
22
+ generateScopedName: (name: string, filename: string, css: string) => {
23
+ const isGlobalCSS = (name: string, filename: string) => {
24
+ // классы topvisor-ui
25
+ if (name.indexOf('top-') === 0) return true;
26
+
27
+ return false;
28
+ };
29
+
30
+ if (isGlobalCSS(name, filename)) {
31
+ return name;
32
+ }
33
+
34
+ return generateScopedNameDefault(name, filename, css);
35
+ },
36
+ // globalModulePaths: [],
37
+ // scopeBehaviour: 'global',
38
+ // exportGlobals: true,
39
+ }
@@ -0,0 +1,46 @@
1
+ import glob from 'glob';
2
+ import fs from 'fs';
3
+ import type { UserConfig } from 'vite'
4
+
5
+ /**
6
+ * опеределить значение переменной vue в импорте requriejs
7
+ * vue не предоставляет export для amd
8
+ */
9
+ export default () => {
10
+ return {
11
+ name: 'amd-fix',
12
+
13
+ async closeBundle() {
14
+ console.log('fix amd')
15
+
16
+ const amdFilenames = glob.sync('dist/**/*.amd.js');
17
+
18
+ const fixAMDFile = async (amdFilename: string) => {
19
+ console.log(amdFilename);
20
+
21
+ const data = await fs.promises.readFile(amdFilename, 'utf8');
22
+ const result = data.replace(/"use strict";/g, '"use strict"; if(typeof vue === "undefined") var vue = window.Vue;');
23
+ await fs.promises.writeFile(amdFilename, result, 'utf8');
24
+ }
25
+
26
+ console.time('amd-fix');
27
+
28
+ const tasks = amdFilenames.map((amdFilename) => fixAMDFile(amdFilename));
29
+
30
+ await Promise.all(tasks);
31
+
32
+ console.timeEnd('amd-fix');
33
+ },
34
+
35
+ config(config: UserConfig, env: { mode: string, command: string }) {
36
+ // в режиме watch запись в папку и ее очистка одновременно работать не будут
37
+ if (!config.build?.watch) return;
38
+
39
+ return {
40
+ build: {
41
+ emptyOutDir: false
42
+ }
43
+ }
44
+ }
45
+ }
46
+ }
@@ -0,0 +1,18 @@
1
+ import type { RollupOptions } from 'rollup';
2
+
3
+ export default {
4
+ external: ['vue'],
5
+ output: {
6
+ globals: {
7
+ vue: 'Vue',
8
+ },
9
+
10
+ // часто используемые компоненты вручную группируются по файлам
11
+ manualChunks: {
12
+ forms: [
13
+ './src/components/forms/forms.ts',
14
+ ],
15
+ },
16
+ chunkFileNames: '.chunks/[name]-[hash].[format].js',
17
+ },
18
+ } satisfies RollupOptions;
@@ -0,0 +1,11 @@
1
+ auxiliary.org-netbeans-modules-css-prep.less_2e_compiler_2e_options=
2
+ auxiliary.org-netbeans-modules-css-prep.less_2e_enabled=false
3
+ auxiliary.org-netbeans-modules-css-prep.less_2e_mappings=/less:/css
4
+ auxiliary.org-netbeans-modules-css-prep.sass_2e_compiler_2e_options=
5
+ auxiliary.org-netbeans-modules-css-prep.sass_2e_enabled=false
6
+ auxiliary.org-netbeans-modules-css-prep.sass_2e_mappings=/scss:/css
7
+ auxiliary.org-netbeans-modules-javascript2-json.json_2e_comments=true
8
+ auxiliary.org-netbeans-modules-javascript2-requirejs.enabled=true
9
+ files.encoding=UTF-8
10
+ site.root.folder=
11
+ source.folder=
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project xmlns="http://www.netbeans.org/ns/project/1">
3
+ <type>org.netbeans.modules.web.clientproject</type>
4
+ <configuration>
5
+ <data xmlns="http://www.netbeans.org/ns/clientside-project/1">
6
+ <name>topvisor-ui</name>
7
+ </data>
8
+ </configuration>
9
+ </project>
package/package.json CHANGED
@@ -1,19 +1,68 @@
1
- {
2
- "name": "@topvisor/ui",
3
- "private": false,
4
- "version": "0.0.34",
5
- "type": "module",
6
- "description": "Topvisor UI-kit Vue",
7
- "author": "Topvisor",
8
- "keywords": [
9
- "topvisor",
10
- "vue",
11
- "ui framework",
12
- "component framework",
13
- "component library"
14
- ],
15
- "license": "MIT",
16
- "peerDependencies": {
17
- "vue": "^3.3.4"
18
- }
19
- }
1
+ {
2
+ "name": "@topvisor/ui",
3
+ "private": false,
4
+ "version": "0.0.35",
5
+ "type": "module",
6
+ "description": "Topvisor UI-kit Vue",
7
+ "scripts": {
8
+ "storybook": "storybook dev -p 6006 --ci",
9
+ "preview": "concurrently \"npx vite build -w\" \"bash build/afterBuild.sh\" \"npx vite preview --port 4173\"",
10
+ "build": "vite build && bash build/afterBuild.sh",
11
+ "publish-without-change-version": "npm run build && cd dist/ && npm config set registry https://registry.npmjs.org/ && npm login && npm publish --access=public",
12
+ "publish": "npm version patch && npm run publish-without-change-version"
13
+ },
14
+ "author": "Topvisor",
15
+ "keywords": [
16
+ "topvisor",
17
+ "vue",
18
+ "ui framework",
19
+ "component framework",
20
+ "component library"
21
+ ],
22
+ "license": "MIT",
23
+ "devDependencies": {
24
+ "@rollup/plugin-babel": "^6.0.3",
25
+ "@rollup/plugin-commonjs": "^25.0.4",
26
+ "@rollup/plugin-node-resolve": "^15.1.0",
27
+ "@rollup/plugin-terser": "^0.4.3",
28
+ "@storybook/addon-a11y": "^7.4.6",
29
+ "@storybook/addon-console": "^2.0.0",
30
+ "@storybook/addon-controls": "^7.4.6",
31
+ "@storybook/addon-designs": "^7.0.5",
32
+ "@storybook/addon-docs": "^7.4.6",
33
+ "@storybook/addon-essentials": "^7.4.6",
34
+ "@storybook/addon-interactions": "^7.4.6",
35
+ "@storybook/addon-links": "^7.4.6",
36
+ "@storybook/addon-mdx-gfm": "^7.4.6",
37
+ "@storybook/addon-storysource": "^7.4.6",
38
+ "@storybook/addon-toolbars": "^7.4.6",
39
+ "@storybook/addons": "^7.4.6",
40
+ "@storybook/api": "^7.4.6",
41
+ "@storybook/blocks": "^7.4.6",
42
+ "@storybook/global": "^5.0.0",
43
+ "@storybook/manager-api": "^7.4.6",
44
+ "@storybook/react": "^7.4.6",
45
+ "@storybook/react-vite": "^7.4.6",
46
+ "@storybook/testing-library": "^0.2.2",
47
+ "@storybook/theming": "^7.4.6",
48
+ "@storybook/vue3": "^7.4.6",
49
+ "@storybook/vue3-vite": "^7.4.6",
50
+ "@vitejs/plugin-vue": "^4.0.0",
51
+ "@vuelidate/core": "^2.0.0",
52
+ "@vuelidate/validators": "^2.0.0",
53
+ "@whitespace/storybook-addon-html": "^5.1.6",
54
+ "clean-css-cli": "^5.6.2",
55
+ "concurrently": "^8.2.1",
56
+ "lightningcss": "^1.21.8",
57
+ "prop-types": "^15.8.1",
58
+ "react": "^18.2.0",
59
+ "react-dom": "^18.2.0",
60
+ "storybook": "^7.4.6",
61
+ "storybook-addon-pseudo-states": "^2.1.1",
62
+ "string-hash": "^1.1.3",
63
+ "vite": "^4.4.11"
64
+ },
65
+ "peerDependencies": {
66
+ "vue": "^3.3.4"
67
+ }
68
+ }
@@ -0,0 +1,63 @@
1
+ # UI kit Topvisor Vue
2
+
3
+ ## Vue компоненты
4
+
5
+ Компоненты поставляются в двух форматах:
6
+
7
+ - amd (requirejs)
8
+ - es
9
+
10
+ Компоненты делятся на разные модули и доступны через импорт этих модулей.
11
+
12
+ Каждый модуль находится в отдельной папке, соответствующей имени модулю.
13
+
14
+ Все стили модулей находятся в корневой папке в файлах соответствующих имени модулю.
15
+
16
+ Список всех компонентов см. на [npmjs](https://www.npmjs.com/package/topvisor-ui?activeTab=code).
17
+
18
+ ## Другие ресурсы
19
+
20
+ - [core.css](core.css) - основная палитра цветов и стили компонентов
21
+ - [light.css](light.css) - светлая тема
22
+ - [dark.css](dark.css) - темная тема
23
+
24
+ ## Подключение стилей
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
+ ```
@@ -0,0 +1 @@
1
+ // export { default as Icon } from './icon/icon.vue'
@@ -0,0 +1,4 @@
1
+ export interface Props {
2
+ icon?: string
3
+ icon2?: string
4
+ }
@@ -0,0 +1,15 @@
1
+ <script setup lang="ts">
2
+ import type { Props } from './icon'
3
+
4
+ defineProps<Props>()
5
+ </script>
6
+
7
+ <template>
8
+ <div
9
+ :data-top-icon="icon"
10
+ :data-top-icon2="icon2"
11
+ ></div>
12
+ </template>
13
+
14
+ <!-- см resources/styles/core/icon.css -->
15
+ <style></style>
@@ -0,0 +1,133 @@
1
+ import DOM from '@/core/utils/dom';
2
+
3
+ /**
4
+ * Базовый компонент для js компонентов, не имеет отношения к Vue
5
+ */
6
+ class Component {
7
+
8
+ static componentName = 'Top';
9
+
10
+ componentName: string | undefined; // имя класса компонента
11
+ className: string | undefined; // имя css класса компонента
12
+ uid: string | undefined; // уникальный id компонента
13
+ el: Element | undefined; // элемент, связанный с компонентом
14
+ options = {}; // параметры компонента
15
+
16
+ unmountEls: Element[] = [];
17
+ unmountEvents: any[] = [];
18
+
19
+ // переопредлять нельзя
20
+ // если компонент инициирован, необходимо сразу его вернуть и выполнить reInit() вместо mount()
21
+ // используется init вместо constructor, так как super constructor выполняется до Object.defineProperty() параметров класса
22
+ init (componentName: string, el: Element, options: object): Component | void {
23
+ if (!el) {
24
+ throw componentName + ': el is undefined';
25
+ }
26
+
27
+ const component = Component.getComponent(el, componentName);
28
+
29
+ if (component) {
30
+ component.reInit(options);
31
+
32
+ return component;
33
+ }
34
+
35
+ this.componentName = componentName;
36
+ this.className = 'top' + componentName[0].toUpperCase() + componentName.substring(1);
37
+ this.uid = this.componentName + (Math.random() + '').replace('.', '');
38
+
39
+ this._setComponent(el);
40
+ this.el = el;
41
+ this.el.classList.add(this.className);
42
+ this.options = Object.assign(this.options, options);
43
+
44
+ this.mount();
45
+ }
46
+
47
+ // получить инициированный компонент
48
+ static getComponent (el: Element, componentName: string): any {
49
+ return DOM.storage(el, '#' + componentName);
50
+ }
51
+
52
+ // устанвоить компонент
53
+ _setComponent (el: Element) {
54
+ DOM.storage(el, '#' + this.componentName, this);
55
+ }
56
+
57
+ // функция подключения компонента
58
+ mount (): void {
59
+ throw 'Please, add method mount() to component: ' + this.componentName;
60
+ }
61
+
62
+ // функция отключения компонента
63
+ unmount (): void {
64
+ DOM.storage(this.el, '#' + this.componentName, null);
65
+
66
+ this.unmountEls.forEach((el) => {
67
+ el.remove();
68
+ });
69
+
70
+ this.unmountEls = [];
71
+
72
+ this.unmountEvents.forEach((eventData) => {
73
+ eventData.el.removeEventListener(eventData.type, eventData.listener, eventData.options);
74
+ });
75
+
76
+ this.unmountEvents = [];
77
+ }
78
+
79
+ // указание новые элементы, которые должны будут удалиться после unmount
80
+ registerElForUnmount (el: Element): void {
81
+ this.unmountEls.push(el);
82
+ }
83
+
84
+ // указание новые события, которые должны будут удалиться после unmount
85
+ addEventListenerWithUnmount (
86
+ el: Element | Document,
87
+ type: keyof GlobalEventHandlersEventMap,
88
+ listener: (this: Element, e: Event) => any,
89
+ options?: any,
90
+ ): void {
91
+ el.addEventListener(type, listener, options);
92
+
93
+ this.registerEventForUnmount(el, type, listener, options);
94
+ }
95
+
96
+ // указание новые события, которые должны будут удалиться после unmount
97
+ registerEventForUnmount (
98
+ el: Element | Document,
99
+ type: keyof GlobalEventHandlersEventMap,
100
+ listener: (this: Element, e: Event) => any,
101
+ options?: any
102
+ ): void {
103
+ const eventData = {
104
+ el: el,
105
+ type: type,
106
+ listener: listener,
107
+ options: options,
108
+ };
109
+
110
+ this.unmountEvents.push(eventData);
111
+ }
112
+
113
+ // функция перенастройки уже подключенного компонента
114
+ reInit (_options: object): void {
115
+ throw 'Please, add method reInit() to component: ' + this.componentName;
116
+ }
117
+
118
+ static detach (nodes: Node[]): void
119
+ static detach (nodes: Element): void
120
+
121
+ // удалить элементы из DOM, но не из памяти
122
+ static detach (nodes: any): void {
123
+ if (nodes.forEach) {
124
+ nodes.forEach((node: Node) => node.parentElement?.removeChild(node));
125
+ } else {
126
+ const el = nodes;
127
+ el.parentElement?.removeChild(el);
128
+ }
129
+ }
130
+
131
+ }
132
+
133
+ export default Component;
@@ -0,0 +1,112 @@
1
+ import type { Meta, StoryObj } from '@storybook/vue3';
2
+
3
+ import { genArgsTypes, genOverviewStory } from '@/components/helpersStories';
4
+ import Component from './button.vue';
5
+ import * as ComponentsConst from './button';
6
+ import ReadMe from './stories/README.md?raw';
7
+ import OverviewComponent from './stories/overview.vue';
8
+
9
+ const argTypes = genArgsTypes(Component, ComponentsConst, true);
10
+
11
+ const meta = {
12
+ component: Component,
13
+ tags: ['autodocs'],
14
+ argTypes,
15
+ parameters: {
16
+ docs: {
17
+ description: {
18
+ component: ReadMe,
19
+ },
20
+ },
21
+ design: {
22
+ type: 'figma',
23
+ url: 'https://www.figma.com/file/M7y5HgfqK3JK3Nyy7XnCJx/Princip-Design-components?type=design&node-id=2505%3A69049&mode=design&t=J7nDcOXsvdJ3b4wE-1',
24
+ },
25
+ },
26
+ } satisfies Meta<typeof Component>;
27
+
28
+ type Story = StoryObj<typeof meta>;
29
+
30
+ export const Playground = {} satisfies Story;
31
+
32
+ export const Overview: Story = genOverviewStory({
33
+ args: {
34
+ disabled: false,
35
+ isSubmit: false,
36
+ isActive: false,
37
+ isProgress: false,
38
+ href: '',
39
+ icon: '😊',
40
+ icon2: '😁',
41
+ },
42
+ }, OverviewComponent);
43
+
44
+ export const Regular = {
45
+ args: {
46
+ default: 'Первостепенная цветная',
47
+ title: 'Стандартня кнопка первостепенного значения, цвет настраивается через props color',
48
+ color: 'blue',
49
+ },
50
+ } satisfies Story;
51
+
52
+ export const RegularTheme = {
53
+ args: {
54
+ default: 'Второстепенная Theme',
55
+ title: 'Стандартня кнопка второстепенного значения, цвет Theme',
56
+ color: 'theme',
57
+ },
58
+ } satisfies Story;
59
+
60
+ export const Soft = {
61
+ args: {
62
+ default: 'Мягкая цветная',
63
+ title: 'Для выраженных второстепенных кнопок',
64
+ color: 'blue',
65
+ styling: 'soft',
66
+ },
67
+ } satisfies Story;
68
+
69
+ export const SoftTheme = {
70
+ args: {
71
+ default: 'Мягкая Theme',
72
+ title: 'Для выраженных второстепенных кнопок',
73
+ color: 'theme',
74
+ styling: 'soft',
75
+ },
76
+ } satisfies Story;
77
+
78
+ export const Outline = {
79
+ args: {
80
+ default: 'Без фона цветная',
81
+ title: 'Для кнопок дополнительного функционала',
82
+ color: 'blue',
83
+ styling: 'outline',
84
+ },
85
+ } satisfies Story;
86
+
87
+ export const OutlineTheme = {
88
+ args: {
89
+ default: 'Без фона Theme',
90
+ title: 'Для кнопок дополнительного функционала',
91
+ color: 'theme',
92
+ styling: 'outline',
93
+ },
94
+ } satisfies Story;
95
+
96
+ export const Icons = {
97
+ args: {
98
+ default: 'Кнопка с иконками',
99
+ title: 'В качестве иконок можно вставлять emoji или символы шрифта с иконками. Меняйте props icon и icon2',
100
+ icon: '😊',
101
+ icon2: '😁',
102
+ },
103
+ } satisfies Story;
104
+
105
+ export const OnlyOneIcons = {
106
+ args: {
107
+ title: 'Кнопка с иконкой без текста',
108
+ icon: '😊',
109
+ },
110
+ } satisfies Story;
111
+
112
+ export default meta;
@@ -0,0 +1,51 @@
1
+ import type { Size } from '@/components/forms/helpers';
2
+ import { sizes } from '@/components/forms/helpers';
3
+
4
+ /**
5
+ * Определение параметров
6
+ */
7
+ export interface Props {
8
+ color?: Color;
9
+ styling?: Style; // bug: name = style init with object type
10
+ size?: Size;
11
+
12
+ name?: string;
13
+ title?: string;
14
+ icon?: string;
15
+ icon2?: string;
16
+
17
+ href?: string; // если установлена ссылка, isSubmit не может быть true
18
+ // value?: string
19
+
20
+ disabled?: boolean;
21
+ isSubmit?: boolean;
22
+ isActive?: boolean;
23
+ isProgress?: boolean;
24
+ }
25
+
26
+ /**
27
+ * Определение событий
28
+ */
29
+ export interface Emits {}
30
+
31
+ export const colors = {
32
+ theme: 'theme',
33
+ blue: 'blue',
34
+ green: 'green',
35
+ orange: 'orange',
36
+ red: 'red',
37
+ pink: 'pink',
38
+ } as const;
39
+
40
+ export type Color = typeof colors[keyof typeof colors];
41
+
42
+ export const styles = {
43
+ Regular: '',
44
+ Outline: 'outline',
45
+ Soft: 'soft',
46
+ Transparent: 'transparent',
47
+ } as const;
48
+
49
+ export type Style = typeof styles[keyof typeof styles];
50
+
51
+ export { sizes };