@weavix/cli 0.1.0-dev

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 (47) hide show
  1. package/README.md +94 -0
  2. package/build/index.js +2568 -0
  3. package/build/templates/.arcignore +35 -0
  4. package/build/templates/_shared/.arcignore +20 -0
  5. package/build/templates/_shared/.prettierrc.js +6 -0
  6. package/build/templates/_shared/.stylelintrc +3 -0
  7. package/build/templates/_shared/eslint.config.js +12 -0
  8. package/build/templates/_shared/manifest.schema.json +438 -0
  9. package/build/templates/_shared/marketplace/README.md +12 -0
  10. package/build/templates/_shared/npmrc.template +2 -0
  11. package/build/templates/_shared/package.json +69 -0
  12. package/build/templates/_shared/public/README.md +12 -0
  13. package/build/templates/_shared/public/fonts/ys-text-display-wide-110.woff +0 -0
  14. package/build/templates/_shared/public/fonts/ys-text-display-wide-110.woff2 +0 -0
  15. package/build/templates/_shared/src/main.tsx +21 -0
  16. package/build/templates/_shared/src/reset.css +55 -0
  17. package/build/templates/_shared/src/styles-360.scss +81 -0
  18. package/build/templates/_shared/src/styles-gravity.scss +249 -0
  19. package/build/templates/_shared/src/vite-env.d.ts +2 -0
  20. package/build/templates/_shared/tsconfig.json +16 -0
  21. package/build/templates/_shared/vite.config.ts +66 -0
  22. package/build/templates/attachment.viewer.action/index.html +14 -0
  23. package/build/templates/attachment.viewer.action/src/App.tsx +59 -0
  24. package/build/templates/default/index.html +14 -0
  25. package/build/templates/default/src/App.tsx +10 -0
  26. package/build/templates/goal.action/index.html +14 -0
  27. package/build/templates/goal.action/src/App.tsx +39 -0
  28. package/build/templates/issue.action/index.html +14 -0
  29. package/build/templates/issue.action/src/App.tsx +36 -0
  30. package/build/templates/issue.block/index.html +14 -0
  31. package/build/templates/issue.block/src/App.tsx +34 -0
  32. package/build/templates/issue.comment.action/index.html +14 -0
  33. package/build/templates/issue.comment.action/src/App.tsx +33 -0
  34. package/build/templates/issue.floatingbottom.action/index.html +14 -0
  35. package/build/templates/issue.floatingbottom.action/src/App.tsx +28 -0
  36. package/build/templates/issue.tab/index.html +14 -0
  37. package/build/templates/issue.tab/src/App.tsx +36 -0
  38. package/build/templates/navigation/index.html +14 -0
  39. package/build/templates/navigation/src/App.tsx +15 -0
  40. package/build/templates/portfolio.action/index.html +14 -0
  41. package/build/templates/portfolio.action/src/App.tsx +44 -0
  42. package/build/templates/project.action/index.html +14 -0
  43. package/build/templates/project.action/src/App.tsx +44 -0
  44. package/build/templates/trigger.action/index.html +14 -0
  45. package/build/templates/trigger.action/src/App.scss +46 -0
  46. package/build/templates/trigger.action/src/App.tsx +153 -0
  47. package/package.json +35 -0
@@ -0,0 +1,55 @@
1
+ /* Minimal CSS Reset */
2
+
3
+ html {
4
+ line-height: 1.15;
5
+ -webkit-text-size-adjust: 100%;
6
+ }
7
+
8
+ body {
9
+ margin: 0;
10
+ }
11
+
12
+ h1, h2, h3,
13
+ h4, h5, h6,
14
+ p, blockquote, pre,
15
+ figure, dl, dd,
16
+ ul, ol {
17
+ margin: 0;
18
+ padding: 0;
19
+ }
20
+
21
+ ul, ol {
22
+ list-style: none;
23
+ }
24
+
25
+ img, svg, video,
26
+ canvas, audio, iframe,
27
+ embed, object {
28
+ display: block;
29
+ }
30
+
31
+ img, video {
32
+ max-width: 100%;
33
+ height: auto;
34
+ }
35
+
36
+ button, input, optgroup,
37
+ select, textarea {
38
+ font-family: inherit;
39
+ font-size: 100%;
40
+ line-height: 1.15;
41
+ margin: 0;
42
+ }
43
+
44
+ button {
45
+ cursor: pointer;
46
+ }
47
+
48
+ table {
49
+ border-collapse: collapse;
50
+ border-spacing: 0;
51
+ }
52
+
53
+ td, th {
54
+ padding: 0;
55
+ }
@@ -0,0 +1,81 @@
1
+ @import './reset.css';
2
+
3
+ @import '@gravity-ui/uikit/styles/fonts.css';
4
+ @import '@gravity-ui/uikit/styles/styles.css';
5
+ @import '@yandex-data-ui/gravity-themes/dist/fonts/ys-text.css';
6
+ @import '@yandex-data-ui/gravity-themes/dist/yandex-cloud.css';
7
+ @import '@yandex-data-ui/gravity-themes/dist/yandex-360.css';
8
+
9
+ @font-face {
10
+ font-family: 'YS Text Wide 110';
11
+ src: url('../public/fonts/ys-text-display-wide-110.woff2') format('woff2'),
12
+ url('../public/fonts/ys-text-display-wide-110.woff') format('woff');
13
+ font-weight: 500;
14
+ font-style: normal;
15
+ }
16
+
17
+ .g-root {
18
+ --g-font-family-sans: 'YS Text', 'Helvetica Neue', 'Arial', 'Helvetica', sans-serif;
19
+ --g-font-family-monospace:
20
+ 'Menlo', 'Monaco', 'Consolas', 'Liberation Mono', 'Ubuntu Mono', 'DejaVu Sans Mono',
21
+ 'Courier New', 'Courier', monospace;
22
+
23
+ --g-text-header-font-family: 'YS Text Wide 110', 'Helvetica Neue', 'Arial', 'Helvetica', sans-serif;
24
+ --g-text-subheader-font-family: 'YS Text Wide 110', 'Helvetica Neue', 'Arial', 'Helvetica', sans-serif;
25
+
26
+ --g-text-header-font-weight: 500;
27
+ --g-text-subheader-font-weight: 500;
28
+ --g-text-display-font-weight: 500;
29
+ --g-text-accent-font-weight: 500;
30
+
31
+ --g-text-body-1-font-size: 14px;
32
+ --g-text-body-1-line-height: 18px;
33
+
34
+ --g-text-body-2-font-size: 14px;
35
+ --g-text-body-2-line-height: 20px;
36
+
37
+ --g-text-body-3-font-size: 16px;
38
+ --g-text-body-3-line-height: 24px;
39
+
40
+ --g-text-body-short-font-size: 14px;
41
+ --g-text-body-short-line-height: 18px;
42
+
43
+ --g-text-caption-1-font-size: 11px;
44
+ --g-text-caption-1-line-height: 12px;
45
+
46
+ --g-text-caption-2-font-size: 12px;
47
+ --g-text-caption-2-line-height: 16px;
48
+
49
+ --g-text-subheader-1-font-size: 14px;
50
+ --g-text-subheader-1-line-height: 18px;
51
+
52
+ --g-text-subheader-2-font-size: 16px;
53
+ --g-text-subheader-2-line-height: 20px;
54
+
55
+ --g-text-subheader-3-font-size: 16px;
56
+ --g-text-subheader-3-line-height: 24px;
57
+
58
+ --g-text-subheader-3-font: 700
59
+ var(--g-text-subheader-3-font-size) / var(--g-text-subheader-3-font-size)
60
+ var(--g-text-subheader-font-family);
61
+
62
+ --g-border-radius-xs: 1000px;
63
+ --g-border-radius-s: 8px;
64
+ --g-border-radius-m: 10px;
65
+ --g-border-radius-l: 12px;
66
+ --g-border-radius-xl: 16px;
67
+ --g-border-radius-2xl: 24px;
68
+
69
+
70
+ }
71
+
72
+ .g-root_theme_light,
73
+ .g-root_theme_light-hc {
74
+ --orb-elevation-sunken: rgb(237, 239, 240);
75
+
76
+ }
77
+
78
+ .g-root_theme_dark,
79
+ .g-root_theme_dark-hc {
80
+ --orb-elevation-sunken: rgb(20, 20, 23);
81
+ }
@@ -0,0 +1,249 @@
1
+ @import './reset.css';
2
+
3
+ @import '@gravity-ui/uikit/styles/fonts.css';
4
+ @import '@gravity-ui/uikit/styles/styles.css';
5
+ @import '@yandex-data-ui/gravity-themes/dist/fonts/ys-text.css';
6
+ @import '@yandex-data-ui/gravity-themes/dist/yandex-cloud.css';
7
+
8
+ :root {
9
+ /* Высота шапки */
10
+ --header-height-s: 26px;
11
+ --header-height-m: 44px;
12
+ --header-height-l: 56px;
13
+ --header-height: var(--header-height-m);
14
+
15
+ /** Высота текста табов на странице задачи */
16
+ --tab-line-height: 32px;
17
+
18
+ --yfm-tab-size-code: 4;
19
+
20
+ --g-border-radius-2xl: 16px;
21
+
22
+ /* page sticky elements top (the unit needed for calculations) */
23
+ // stylelint-disable-next-line length-zero-no-unit
24
+ --page-layout-top: 0px;
25
+ /* page sticky elements right (the unit needed for calculations) */
26
+ // stylelint-disable-next-line length-zero-no-unit
27
+ --page-layout-right: 0px;
28
+ /* page sticky elements bottom (the unit needed for calculations) */
29
+ // stylelint-disable-next-line length-zero-no-unit
30
+ --page-layout-bottom: 0px;
31
+ }
32
+
33
+ .g-root {
34
+ --yc-color-yandex-red: #fc3f1d;
35
+ // Косяк в uikit, используется старая переменная
36
+ --g-tooltip-max-width: var(--g-popover-max-width);
37
+
38
+ --mermaid-zoom-control-color: var(--g-color-text-primary);
39
+
40
+ /** Высота строк для многострочного текста */
41
+ --g-text-body-1-line-height-rel: 1.385;
42
+ --g-text-body-2-line-height-rel: 1.333;
43
+ --g-text-body-3-line-height-rel: 1.412;
44
+ --g-text-body-short-line-height-rel: 1.231;
45
+ --g-text-caption-1-line-height-rel: 1.333;
46
+ --g-text-caption-2-line-height-rel: 1.455;
47
+ --g-text-header-1-line-height-rel: 1.2;
48
+ --g-text-header-2-line-height-rel: 1.167;
49
+ --g-text-subheader-1-line-height-rel: 1.385;
50
+ --g-text-subheader-2-line-height-rel: 1.333;
51
+ --g-text-subheader-3-line-height-rel: 1.412;
52
+ --g-text-display-1-line-height-rel: 1.286;
53
+ --g-text-display-2-line-height-rel: 1.25;
54
+ --g-text-display-3-line-height-rel: 1.2;
55
+ --g-text-display-4-line-height-rel: 1.083;
56
+ --g-text-code-1-line-height-rel: 1.5;
57
+ --g-text-code-2-line-height-rel: 1.429;
58
+ --g-text-code-3-line-height-rel: 1.5;
59
+ --g-text-code-inline-1-line-height-rel: 1.167;
60
+ --g-text-code-inline-2-line-height-rel: 1.143;
61
+ --g-text-code-inline-3-line-height-rel: 1.25;
62
+
63
+ --clb-color-private-black-500: rgba(79, 78, 78, 0.7);
64
+ --clb-color-private-white-500: rgba(192, 192, 192, 0.7);
65
+
66
+ --g-color-base-selection-solid: #ebf4fe;
67
+
68
+ /** fix error in uikit for high contrast theme */
69
+ --g-color-base-modal: var(--g-color-base-background);
70
+
71
+ --g-popup-border-radius: var(--g-border-radius-s);
72
+ --g-modal-border-radius: var(--g-border-radius-s);
73
+
74
+ line-height: var(--g-text-body-1-line-height-rel);
75
+
76
+ // yarozhkov: STARTREK-32280: fix conflict between @yandex-cloud/uikitt and @gravity-ui/uikit
77
+ .g-label .g-label__icon {
78
+ position: absolute;
79
+ }
80
+
81
+ .page_name_issue,
82
+ .page_name_createIssue,
83
+ .page_name_portfolio,
84
+ .page_name_projects,
85
+ .page_name_goal,
86
+ .page_name_dashboard,
87
+ .page_name_agile-board,
88
+ .side-card {
89
+ --g-md-toolbar-sticky-inset: calc(-1 * var(--g-spacing-2));
90
+ --g-md-toolbar-sticky-border: none;
91
+ }
92
+
93
+ --status-type-new-color: var(--g-color-text-misc-heavy);
94
+ --status-type-new-background-color: var(--g-color-base-misc-light);
95
+ --status-type-new-background-color-hover: var(--g-color-base-misc-light-hover);
96
+ --status-type-new-bar-color: var(--g-color-base-misc-medium);
97
+
98
+ --status-type-in-progress-color: var(--g-color-text-info);
99
+ --status-type-in-progress-background-color: var(--g-color-base-info-light);
100
+ --status-type-in-progress-background-color-hover: var(--g-color-base-info-light-hover);
101
+ --status-type-in-progress-bar-color: var(--g-color-base-info-medium);
102
+
103
+ --status-type-paused-color: var(--g-color-text-warning-heavy);
104
+ --status-type-paused-background-color: var(--g-color-base-warning-light);
105
+ --status-type-paused-background-color-hover: var(--g-color-base-warning-light-hover);
106
+ --status-type-paused-bar-color: var(--g-color-base-warning-medium);
107
+
108
+ --status-type-postponed-color: var(--g-color-text-hint);
109
+ --status-type-postponed-background-color: var(--g-color-base-warning-light);
110
+ --status-type-postponed-background-color-hover: var(--g-color-base-warning-light-hover);
111
+ --status-type-postponed-bar-color: var(--g-color-base-warning-medium);
112
+
113
+ --status-type-blocked-color: var(--g-color-text-danger-heavy);
114
+ --status-type-blocked-background-color: var(--g-color-base-danger-light);
115
+ --status-type-blocked-background-color-hover: var(--g-color-base-danger-light-hover);
116
+ --status-type-blocked-bar-color: var(--g-color-base-danger-medium);
117
+
118
+ --status-type-done-color: var(--g-color-text-positive);
119
+ --status-type-done-background-color: var(--g-color-base-positive-light);
120
+ --status-type-done-background-color-hover: var(--g-color-base-positive-light-hover);
121
+ --status-type-done-bar-color: var(--g-color-base-positive-medium);
122
+
123
+ --status-type-exceeded-color: var(--g-color-text-utility);
124
+ --status-type-exceeded-background-color: var(--g-color-base-utility-light);
125
+ --status-type-exceeded-background-color-hover: var(--g-color-base-utility-light-hover);
126
+ --status-type-exceeded-bar-color: var(--g-color-base-utility-medium);
127
+
128
+ --status-type-cancelled-color: var(--g-color-text-complementary);
129
+ --status-type-cancelled-background-color: var(--g-color-base-generic);
130
+ --status-type-cancelled-background-color-hover: var(--g-color-base-generic-hover);
131
+ --status-type-cancelled-bar-color: var(--g-color-base-generic-medium);
132
+
133
+ --status-type-unknown-color: var(--g-color-text-misc-heavy);
134
+ --status-type-unknown-background-color: var(--g-color-base-misc-light);
135
+ --status-type-unknown-background-color-hover: var(--g-color-base-misc-light-hover);
136
+ --status-type-unknown-bar-color: var(--g-color-base-misc-medium);
137
+
138
+ --status-type-draft2-color: var(--g-color-text-hint);
139
+ --status-type-draft2-background-color: var(--g-color-base-warning-light);
140
+ --status-type-draft2-background-color-hover: var(--g-color-base-warning-light-hover);
141
+ --status-type-draft2-bar-color: var(--g-color-base-warning-medium);
142
+ }
143
+
144
+ body {
145
+ text-size-adjust: none;
146
+ }
147
+
148
+ body.g-root {
149
+ background-color: var(--g-color-base-generic-ultralight);
150
+ }
151
+
152
+ .g-button_view_flat-secondary.g-button_disabled:not(.g-button_loading)::before,
153
+ .g-button_view_flat-secondary.g-button_disabled:not(.g-button_loading):hover::before {
154
+ background-color: transparent;
155
+ }
156
+
157
+ .g-button_disabled {
158
+ // forced `pointer-events: none` on a disabled element prevents it from
159
+ // showing its `title` tooltip explaining the reason of its being disabled
160
+ pointer-events: auto;
161
+ }
162
+
163
+ .g-dialog-btn-close[class] {
164
+ inset-inline-end: 20px;
165
+ }
166
+
167
+ .g-help-mark__popover {
168
+ max-width: 250px;
169
+ }
170
+
171
+ .user-org_billing-method_360 {
172
+ --nv-compact-content-max-height: none;
173
+ }
174
+
175
+ .g-user__info .g-user__name[class] {
176
+ font-size: inherit;
177
+ font-weight: inherit;
178
+ line-height: inherit;
179
+ }
180
+
181
+ .yfm {
182
+ // Fix mermaid in Safari
183
+ .mermaid svg {
184
+ max-height: none;
185
+ }
186
+ }
187
+
188
+ .g-hotkey[class] {
189
+ border-radius: var(--g-border-radius-s);
190
+ }
191
+
192
+ .yc-help-center__docs[class] {
193
+ padding-bottom: 0;
194
+ }
195
+
196
+ .yc-help-center__footer[class] {
197
+ padding-top: 0;
198
+ }
199
+
200
+ .g-actions-panel__note-wrapper[class] {
201
+ font-family: var(--g-text-body-font-family);
202
+ }
203
+
204
+ @media (prefers-reduced-motion: reduce) {
205
+ *,
206
+ *::before,
207
+ *::after {
208
+ /* stylelint-disable-next-line declaration-no-important */
209
+ scroll-behavior: auto !important;
210
+ /* stylelint-disable-next-line declaration-no-important */
211
+ transition-duration: 0.001ms !important;
212
+ /* stylelint-disable-next-line declaration-no-important */
213
+ animation-duration: 0.001ms !important;
214
+ /* stylelint-disable-next-line declaration-no-important */
215
+ animation-iteration-count: 1 !important;
216
+ }
217
+ }
218
+
219
+ .g-root_theme_dark {
220
+ // text
221
+ --g-color-text-primary: var(--g-color-text-light-primary);
222
+ --g-color-text-light-primary: rgba(255, 255, 255, 0.9); // --g-color-private-white-900
223
+
224
+ --g-color-text-complementary: var(--g-color-private-white-700);
225
+ --g-color-text-light-complementary: rgba(255, 255, 255, 0.9); // var(--g-color-private-white-750);
226
+
227
+ --g-color-text-secondary: var(--g-color-text-light-secondary);
228
+ --g-color-text-light-secondary: rgba(255, 255, 255, 0.55); // var(--g-color-private-white-550);
229
+
230
+ // Семантический цвет текста в лейблах:
231
+ --g-color-text-info-heavy: rgba(145, 179, 255, 1); // var(--g-color-private-blue-700-solid);
232
+ --g-color-text-positive-heavy: rgba(124, 196, 121, 1); // var(--g-color-private-green-650-solid);
233
+ --g-color-text-warning-heavy: rgba(255, 203, 0, 1); // var(--g-color-private-yellow-550-solid);
234
+ --g-color-text-danger-heavy: rgba(239, 127, 125, 1); // var(--g-color-private-red-700-solid);
235
+ --g-color-text-utility-heavy: rgba(236, 129, 248, 1); // var(--g-color-private-purple-750-solid);
236
+ --g-color-text-misc-heavy: rgba(160, 179, 195, 1); // var(--g-color-private-cool-grey-750-solid);
237
+
238
+ // lines
239
+ --g-color-line-generic: rgba(255, 255, 255, 0.25); // var(--g-color-private-white-250);
240
+ --g-color-line-generic-hover: rgba(255, 255, 255, 0.3); // var(--g-color-private-white-300);
241
+ --g-color-line-generic-active: rgba(255, 255, 255, 0.4); // var(--g-color-private-white-400);
242
+ --g-color-line-generic-accent: var(--g-color-line-generic);
243
+ }
244
+
245
+ .g-root_theme_light {
246
+ --g-color-text-secondary: var(--g-color-text-dark-secondary);
247
+ --g-color-text-dark-secondary: rgba(0, 0, 0, 0.55); // var(--g-color-private-black-550);
248
+ --g-color-line-generic: rgba(0, 0, 0, 0.15); // var(--g-color-private-black-150);
249
+ }
@@ -0,0 +1,2 @@
1
+ /// <reference types="vite/client" />
2
+ /// <reference types="vite-plugin-svgr/client" />
@@ -0,0 +1,16 @@
1
+ {
2
+ "extends": "@gravity-ui/tsconfig/tsconfig",
3
+ "compilerOptions": {
4
+ "noEmit": true,
5
+
6
+ "target": "ES2020",
7
+ "module": "ESNext",
8
+ "moduleResolution": "bundler",
9
+ "jsx": "react-jsx",
10
+
11
+ "isolatedModules": true,
12
+ "resolveJsonModule": true,
13
+ "types": ["vite/client", "vite-plugin-svgr/client"],
14
+ },
15
+ "include": ["src/**/*.ts", "src/**/*.tsx", "vite.config.ts"],
16
+ }
@@ -0,0 +1,66 @@
1
+ import fs from 'fs';
2
+ import type { IncomingMessage, ServerResponse } from 'http';
3
+ import path from 'path';
4
+ import { fileURLToPath } from 'url';
5
+
6
+ import react from '@vitejs/plugin-react';
7
+ import type { ViteDevServer } from 'vite';
8
+ import { defineConfig } from 'vite';
9
+ import svgr from 'vite-plugin-svgr';
10
+
11
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
12
+
13
+ export default defineConfig(() => {
14
+ return {
15
+ base: './',
16
+ server: {
17
+ cors: true,
18
+ headers: {
19
+ 'Access-Control-Allow-Origin': '*',
20
+ 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, PATCH, OPTIONS',
21
+ 'Access-Control-Allow-Headers': 'X-Requested-With, content-type, Authorization',
22
+ },
23
+ },
24
+ plugins: [
25
+ svgr(),
26
+ react(),
27
+ {
28
+ name: 'serve-config-from-root',
29
+ apply: 'serve',
30
+ configureServer(server: ViteDevServer) {
31
+ server.middlewares.use(
32
+ (req: IncomingMessage, res: ServerResponse, next: () => void) => {
33
+ if (req.url === '/config.json') {
34
+ const configPath = path.resolve(__dirname, 'config.json');
35
+ if (fs.existsSync(configPath)) {
36
+ res.setHeader('Content-Type', 'application/json');
37
+ res.setHeader('Access-Control-Allow-Origin', '*');
38
+ res.setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS');
39
+ res.setHeader('Access-Control-Allow-Headers', 'Content-Type');
40
+ res.end(fs.readFileSync(configPath, 'utf-8'));
41
+ return;
42
+ }
43
+ }
44
+ next();
45
+ },
46
+ );
47
+ },
48
+ },
49
+ ],
50
+ build: {
51
+ sourcemap: true,
52
+ cssCodeSplit: true,
53
+ rollupOptions: {
54
+ output: {
55
+ sourcemapIgnoreList: () => false,
56
+ },
57
+ },
58
+ },
59
+ css: {
60
+ devSourcemap: true,
61
+ preprocessorOptions: {
62
+ scss: {},
63
+ },
64
+ },
65
+ };
66
+ });
@@ -0,0 +1,14 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <meta name="description" content="Web site created using vite" />
7
+ <title>Default Plugin</title>
8
+ </head>
9
+ <body class="g-root g-root_theme_dark">
10
+ <noscript>You need to enable JavaScript to run this app.</noscript>
11
+ <div id="root"></div>
12
+ <script type="module" src="/src/main.tsx"></script>
13
+ </body>
14
+ </html>
@@ -0,0 +1,59 @@
1
+ import { useCallback } from 'react';
2
+
3
+ import { Card, DefinitionList, ThemeProvider, Text as Typography } from '@gravity-ui/uikit';
4
+ import {
5
+ getField,
6
+ hostApi,
7
+ trackerApi,
8
+ useTrackerPluginContext,
9
+ } from '@yandex-data-ui/tracker-plugin-sdk-react';
10
+
11
+ const App = () => {
12
+ const { theme, slotContext } = useTrackerPluginContext<'attachment.viewer.action'>();
13
+
14
+ const save = useCallback(async (blob: Blob, filename: string): Promise<void> => {
15
+ const file = new File([blob], filename, { type: blob.type || 'image/png' });
16
+
17
+ const response = await trackerApi.v3.post['/attachments']({
18
+ bodyParams: { filename },
19
+ file,
20
+ });
21
+
22
+ hostApi.close({ attachments: [response.data] });
23
+ }, []);
24
+
25
+ if (!slotContext) {
26
+ return null;
27
+ }
28
+
29
+ const attachmentBlob = getField<string>(slotContext, 'attachmentBlob');
30
+
31
+ const id = getField<string>(slotContext, 'meta.id', 'Без идентификатора');
32
+ const mimetype = getField<string>(slotContext, 'meta.mimetype', 'Без типа');
33
+ const url = getField<string>(slotContext, 'meta.url', 'Без ссылки');
34
+ const name = getField<string>(slotContext, 'meta.name', 'Без названия');
35
+ const size = getField<number>(slotContext, 'meta.size', 0);
36
+ const date = getField<string>(slotContext, 'meta.date', 'Без даты');
37
+
38
+ return (
39
+ <ThemeProvider theme={theme}>
40
+ <div style={{ width: '800px', padding: '50px' }}>
41
+ <Card style={{ padding: '20px' }}>
42
+ <Typography variant="header-1" as="div" style={{ marginBottom: '16px' }}>
43
+ Текущий контекст в проде
44
+ </Typography>
45
+ <DefinitionList>
46
+ <DefinitionList.Item name="Идентификатор">{id}</DefinitionList.Item>
47
+ <DefinitionList.Item name="Название">{name}</DefinitionList.Item>
48
+ <DefinitionList.Item name="Тип">{mimetype}</DefinitionList.Item>
49
+ <DefinitionList.Item name="Адрес">{url}</DefinitionList.Item>
50
+ <DefinitionList.Item name="Размер">{size}</DefinitionList.Item>
51
+ <DefinitionList.Item name="Дата">{date}</DefinitionList.Item>
52
+ </DefinitionList>
53
+ </Card>
54
+ </div>
55
+ </ThemeProvider>
56
+ );
57
+ };
58
+
59
+ export default App;
@@ -0,0 +1,14 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <meta name="description" content="Web site created using vite" />
7
+ <title>Default Plugin</title>
8
+ </head>
9
+ <body class="g-root g-root_theme_dark">
10
+ <noscript>You need to enable JavaScript to run this app.</noscript>
11
+ <div id="root"></div>
12
+ <script type="module" src="/src/main.tsx"></script>
13
+ </body>
14
+ </html>
@@ -0,0 +1,10 @@
1
+ import { ThemeProvider } from '@gravity-ui/uikit';
2
+ import { useTrackerPluginContext } from '@yandex-data-ui/tracker-plugin-sdk-react';
3
+
4
+ const App = () => {
5
+ const { theme } = useTrackerPluginContext();
6
+
7
+ return <ThemeProvider theme={theme}>Write your plugin here!</ThemeProvider>;
8
+ };
9
+
10
+ export default App;
@@ -0,0 +1,14 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <meta name="description" content="Web site created using vite" />
7
+ <title>Project Actions Plugin</title>
8
+ </head>
9
+ <body class="g-root g-root_theme_dark">
10
+ <noscript>You need to enable JavaScript to run this app.</noscript>
11
+ <div id="root"></div>
12
+ <script type="module" src="/src/main.tsx"></script>
13
+ </body>
14
+ </html>
@@ -0,0 +1,39 @@
1
+ import { Card, DefinitionList, ThemeProvider, Text as Typography } from '@gravity-ui/uikit';
2
+ import { getField, useTrackerPluginContext } from '@yandex-data-ui/tracker-plugin-sdk-react';
3
+
4
+ const App = () => {
5
+ const { theme, slotContext } = useTrackerPluginContext<'goal.action'>();
6
+
7
+ if (!slotContext) {
8
+ return null;
9
+ }
10
+
11
+ const summary = getField<string>(slotContext, 'fields.summary.value', 'Без названия');
12
+ const description = getField<string>(
13
+ slotContext,
14
+ 'fields.description.value',
15
+ 'Пустое описание',
16
+ );
17
+ const status = getField<string>(slotContext, 'fields.entityStatus.value', 'Не указан');
18
+ const progress = getField<number>(slotContext, 'fields.progressPercentage.value', 0);
19
+
20
+ return (
21
+ <ThemeProvider theme={theme}>
22
+ <div style={{ width: '800px', padding: '50px' }}>
23
+ <Card style={{ padding: '20px' }}>
24
+ <Typography variant="header-1" as="div" style={{ marginBottom: '16px' }}>
25
+ Текущий контекст в проде
26
+ </Typography>
27
+ <DefinitionList>
28
+ <DefinitionList.Item name="Название">{summary}</DefinitionList.Item>
29
+ <DefinitionList.Item name="Описание">{description}</DefinitionList.Item>
30
+ <DefinitionList.Item name="Статус">{status}</DefinitionList.Item>
31
+ <DefinitionList.Item name="Прогресс">{progress}</DefinitionList.Item>
32
+ </DefinitionList>
33
+ </Card>
34
+ </div>
35
+ </ThemeProvider>
36
+ );
37
+ };
38
+
39
+ export default App;
@@ -0,0 +1,14 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <meta name="description" content="Web site created using vite" />
7
+ <title>Issue Actions Plugin</title>
8
+ </head>
9
+ <body class="g-root g-root_theme_dark">
10
+ <noscript>You need to enable JavaScript to run this app.</noscript>
11
+ <div id="root"></div>
12
+ <script type="module" src="/src/main.tsx"></script>
13
+ </body>
14
+ </html>