@vc-shell/create-vc-app 1.1.98-rc.4 → 1.1.99-alpha.0

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 (83) hide show
  1. package/README.md +552 -26
  2. package/dist/cli/argv.d.ts +4 -0
  3. package/dist/cli/argv.d.ts.map +1 -0
  4. package/dist/cli/constants.d.ts +4 -0
  5. package/dist/cli/constants.d.ts.map +1 -0
  6. package/dist/cli/errors.d.ts +12 -0
  7. package/dist/cli/errors.d.ts.map +1 -0
  8. package/dist/cli/help.d.ts +3 -0
  9. package/dist/cli/help.d.ts.map +1 -0
  10. package/dist/cli/run.d.ts +2 -0
  11. package/dist/cli/run.d.ts.map +1 -0
  12. package/dist/cli/runtime.d.ts +7 -0
  13. package/dist/cli/runtime.d.ts.map +1 -0
  14. package/dist/cli/types.d.ts +30 -0
  15. package/dist/cli/types.d.ts.map +1 -0
  16. package/dist/cli/utils.d.ts +4 -0
  17. package/dist/cli/utils.d.ts.map +1 -0
  18. package/dist/cli/validation.d.ts +5 -0
  19. package/dist/cli/validation.d.ts.map +1 -0
  20. package/dist/commands/generate-blade.d.ts +16 -0
  21. package/dist/commands/generate-blade.d.ts.map +1 -0
  22. package/dist/index.js +1900 -530
  23. package/dist/templates/base/_package.json +5 -5
  24. package/dist/templates/base/ai-guides/.cursorrules-vc-shell +529 -0
  25. package/dist/templates/base/ai-guides/README.md +360 -0
  26. package/dist/templates/base/ai-guides/guides/AI_GUIDE.md +195 -0
  27. package/dist/templates/base/ai-guides/guides/blade-patterns.md +384 -0
  28. package/dist/templates/base/ai-guides/guides/complete-workflow.md +781 -0
  29. package/dist/templates/base/ai-guides/guides/composables-reference.md +338 -0
  30. package/dist/templates/base/ai-guides/guides/troubleshooting.md +529 -0
  31. package/dist/templates/base/ai-guides/guides/ui-components-reference.md +903 -0
  32. package/dist/templates/base/ai-guides/prompts/adapt-existing-module.md +1026 -0
  33. package/dist/templates/base/ai-guides/prompts/advanced-scenarios.md +852 -0
  34. package/dist/templates/base/ai-guides/prompts/api-client-generation.md +877 -0
  35. package/dist/templates/base/ai-guides/prompts/cli-usage.md +640 -0
  36. package/dist/templates/base/ai-guides/prompts/quick-start-scenarios.md +773 -0
  37. package/dist/templates/base/ai-guides/prompts/simple-modifications.md +987 -0
  38. package/dist/templates/base/src/main.ts +0 -4
  39. package/dist/templates/blades/details/blade.vue +175 -0
  40. package/dist/templates/blades/grid/blade.vue +340 -0
  41. package/dist/templates/composables/details-composable.ts +101 -0
  42. package/dist/templates/composables/grid-composable.ts +244 -0
  43. package/dist/templates/module/components/index.ts +2 -0
  44. package/dist/templates/module/components/widgets/index.ts +2 -0
  45. package/dist/templates/module/composables/index.ts +3 -0
  46. package/dist/templates/module/index.ts +13 -0
  47. package/dist/templates/module/locales/en.json +65 -0
  48. package/dist/templates/module/locales/index.ts +4 -0
  49. package/dist/templates/module/pages/index.ts +3 -0
  50. package/dist/templates/widgets/widget.vue +113 -0
  51. package/dist/utils/form-builder.d.ts +69 -0
  52. package/dist/utils/form-builder.d.ts.map +1 -0
  53. package/dist/utils/format.d.ts +24 -0
  54. package/dist/utils/format.d.ts.map +1 -0
  55. package/dist/utils/naming.d.ts +44 -0
  56. package/dist/utils/naming.d.ts.map +1 -0
  57. package/dist/utils/register-module.d.ts +21 -0
  58. package/dist/utils/register-module.d.ts.map +1 -0
  59. package/dist/workflows/create-app.d.ts +14 -0
  60. package/dist/workflows/create-app.d.ts.map +1 -0
  61. package/package.json +12 -7
  62. package/dist/templates/mocks/sample-data/constants.ts +0 -89
  63. package/dist/templates/mocks/sample-data/index.ts +0 -2
  64. package/dist/templates/mocks/sample-data/methods.ts +0 -65
  65. package/dist/templates/modules/classic-module/composables/index.ts +0 -2
  66. package/dist/templates/modules/classic-module/composables/use{{ModuleNamePascalCase}}Details/index.ts +0 -24
  67. package/dist/templates/modules/classic-module/composables/use{{ModuleNamePascalCase}}List/index.ts +0 -47
  68. package/dist/templates/modules/classic-module/index.ts +0 -8
  69. package/dist/templates/modules/classic-module/locales/en.json +0 -37
  70. package/dist/templates/modules/classic-module/locales/index.ts +0 -2
  71. package/dist/templates/modules/classic-module/pages/details.vue +0 -87
  72. package/dist/templates/modules/classic-module/pages/index.ts +0 -2
  73. package/dist/templates/modules/classic-module/pages/list.vue +0 -257
  74. package/dist/templates/sample/classic-module/composables/index.ts +0 -2
  75. package/dist/templates/sample/classic-module/composables/useDetails/index.ts +0 -54
  76. package/dist/templates/sample/classic-module/composables/useList/index.ts +0 -62
  77. package/dist/templates/sample/classic-module/index.ts +0 -8
  78. package/dist/templates/sample/classic-module/locales/en.json +0 -67
  79. package/dist/templates/sample/classic-module/locales/index.ts +0 -2
  80. package/dist/templates/sample/classic-module/pages/details.vue +0 -238
  81. package/dist/templates/sample/classic-module/pages/index.ts +0 -2
  82. package/dist/templates/sample/classic-module/pages/list.vue +0 -300
  83. package/dist/templates/sample/overrides/main.ts +0 -52
@@ -1,300 +0,0 @@
1
- <template>
2
- <VcBlade
3
- :title="title"
4
- width="50%"
5
- :expanded="expanded"
6
- :closable="closable"
7
- :toolbar-items="bladeToolbar"
8
- @close="$emit('close:blade')"
9
- @expand="$emit('expand:blade')"
10
- @collapse="$emit('collapse:blade')"
11
- >
12
- <!-- Blade contents -->
13
- <!-- @vue-generic {MockedItem} -->
14
- <VcTable
15
- :expanded="expanded"
16
- class="tw-grow tw-basis-0"
17
- multiselect
18
- :loading="loading"
19
- :columns="columns"
20
- :sort="sortExpression"
21
- :pages="pages"
22
- :total-count="totalCount"
23
- :search-value="searchValue"
24
- :current-page="currentPage"
25
- enable-item-actions
26
- :item-action-builder="actionBuilder"
27
- :empty="empty"
28
- :notfound="notfound"
29
- :search-placeholder="$t('SAMPLE_APP.PAGES.LIST.SEARCH.PLACEHOLDER')"
30
- :total-label="$t('SAMPLE_APP.PAGES.LIST.TABLE.TOTALS')"
31
- :selected-item-id="selectedItemId"
32
- state-key="SAMPLE_APP"
33
- :items="data ?? []"
34
- @item-click="onItemClick"
35
- @header-click="onHeaderClick"
36
- @selection-changed="onSelectionChanged"
37
- @search:change="onSearchList"
38
- @pagination-click="onPaginationClick"
39
- >
40
- </VcTable>
41
- </VcBlade>
42
- </template>
43
-
44
- <script lang="ts" setup>
45
- import { computed, ref, markRaw, onMounted, watch } from "vue";
46
- import {
47
- IActionBuilderResult,
48
- IBladeToolbar,
49
- IParentCallArgs,
50
- ITableColumns,
51
- useBladeNavigation,
52
- usePopup,
53
- useTableSort,
54
- useFunctions,
55
- } from "@vc-shell/framework";
56
- import { useI18n } from "vue-i18n";
57
- import { useList } from "./../composables";
58
- import Details from "./details.vue";
59
- import { MockedItem } from "./../composables/useList";
60
-
61
- export interface Props {
62
- expanded?: boolean;
63
- closable?: boolean;
64
- param?: string;
65
- options?: Record<string, unknown>;
66
- }
67
-
68
- export interface Emits {
69
- (event: "parent:call", args: IParentCallArgs): void;
70
- (event: "collapse:blade"): void;
71
- (event: "expand:blade"): void;
72
- (event: "close:blade"): void;
73
- }
74
-
75
- defineOptions({
76
- url: "/sample-list",
77
- name: "SampleList",
78
- isWorkspace: true,
79
- menuItem: {
80
- title: "SAMPLE_APP.MENU.TITLE",
81
- icon: "lucide-file",
82
- priority: 1,
83
- },
84
- });
85
-
86
- const props = withDefaults(defineProps<Props>(), {
87
- expanded: true,
88
- closable: true,
89
- });
90
-
91
- defineEmits<Emits>();
92
-
93
- const { t } = useI18n({ useScope: "global" });
94
- const { openBlade } = useBladeNavigation();
95
- const { showConfirmation } = usePopup();
96
- const { debounce } = useFunctions();
97
-
98
- const { sortExpression, handleSortChange: tableSortHandler } = useTableSort({
99
- initialDirection: "DESC",
100
- initialProperty: "createdDate",
101
- });
102
-
103
- const { getItems, removeItems, data, loading, totalCount, pages, currentPage, searchQuery } = useList({
104
- sort: sortExpression.value,
105
- pageSize: 20,
106
- });
107
-
108
- const searchValue = ref();
109
- const selectedItemId = ref<string>();
110
- const selectedIds = ref<string[]>([]);
111
-
112
- const empty = {
113
- icon: "lucide-file",
114
- text: computed(() => t("SAMPLE_APP.PAGES.LIST.EMPTY.NO_ITEMS")),
115
- action: computed(() => t("SAMPLE_APP.PAGES.LIST.EMPTY.ADD")),
116
- clickHandler: () => {
117
- addItem();
118
- },
119
- };
120
-
121
- const notfound = {
122
- icon: "lucide-file",
123
- text: computed(() => t("SAMPLE_APP.PAGES.LIST.NOT_FOUND.EMPTY")),
124
- action: computed(() => t("SAMPLE_APP.PAGES.LIST.NOT_FOUND.RESET")),
125
- clickHandler: async () => {
126
- searchValue.value = "";
127
- await getItems({
128
- ...searchQuery.value,
129
- keyword: "",
130
- });
131
- },
132
- };
133
-
134
- watch(
135
- () => props.param,
136
- (newVal) => {
137
- selectedItemId.value = newVal;
138
- },
139
- { immediate: true },
140
- );
141
-
142
- onMounted(async () => {
143
- await getItems({
144
- ...searchQuery.value,
145
- sort: sortExpression.value,
146
- });
147
- });
148
-
149
- const onSearchList = debounce(async (keyword: string) => {
150
- searchValue.value = keyword;
151
- await getItems({
152
- ...searchQuery.value,
153
- keyword,
154
- });
155
- }, 1000);
156
-
157
- const addItem = () => {
158
- openBlade({
159
- blade: markRaw(Details),
160
- });
161
- };
162
-
163
- const onPaginationClick = async (page: number) => {
164
- await getItems({
165
- ...searchQuery.value,
166
- skip: (page - 1) * (searchQuery.value.take ?? 20),
167
- });
168
- };
169
-
170
- const bladeToolbar = ref<IBladeToolbar[]>([
171
- {
172
- id: "refresh",
173
- title: computed(() => t("SAMPLE_APP.PAGES.LIST.TOOLBAR.REFRESH")),
174
- icon: "material-refresh",
175
- async clickHandler() {
176
- await reload();
177
- },
178
- },
179
- {
180
- id: "remove",
181
- icon: "material-delete",
182
- title: computed(() => t("SAMPLE_APP.PAGES.LIST.TOOLBAR.REMOVE")),
183
- async clickHandler() {
184
- await remove(selectedIds.value);
185
- },
186
- disabled: computed(() => selectedIds.value.length === 0),
187
- },
188
- ]);
189
-
190
- const columns = ref<ITableColumns[]>([
191
- {
192
- id: "imgSrc",
193
- title: computed(() => t("SAMPLE_APP.PAGES.LIST.TABLE.HEADER.IMAGE")),
194
- type: "image",
195
- width: "70px",
196
- },
197
- {
198
- id: "name",
199
- title: computed(() => t("SAMPLE_APP.PAGES.LIST.TABLE.HEADER.PRODUCT_NAME")),
200
- alwaysVisible: true,
201
- },
202
- {
203
- id: "description",
204
- title: computed(() => t("SAMPLE_APP.PAGES.LIST.TABLE.HEADER.DESCRIPTION")),
205
- },
206
- {
207
- id: "price",
208
- title: computed(() => t("SAMPLE_APP.PAGES.LIST.TABLE.HEADER.PRICE")),
209
- type: "money",
210
- alwaysVisible: true,
211
- },
212
- {
213
- id: "salePrice",
214
- title: computed(() => t("SAMPLE_APP.PAGES.LIST.TABLE.HEADER.SALE_PRICE")),
215
- type: "money",
216
- },
217
- {
218
- id: "currency.name",
219
- title: computed(() => t("SAMPLE_APP.PAGES.LIST.TABLE.HEADER.CURRENCY")),
220
- },
221
- ]);
222
-
223
- const title = computed(() => t("SAMPLE_APP.PAGES.LIST.TITLE"));
224
-
225
- const reload = async () => {
226
- await getItems({
227
- ...searchQuery.value,
228
- skip: (currentPage.value - 1) * (searchQuery.value.take ?? 10),
229
- sort: sortExpression.value,
230
- });
231
- };
232
-
233
- const onItemClick = (item: { id: string }) => {
234
- openBlade({
235
- blade: markRaw(Details),
236
- param: item.id,
237
- onOpen() {
238
- selectedItemId.value = item.id;
239
- },
240
- onClose() {
241
- selectedItemId.value = undefined;
242
- },
243
- });
244
- };
245
-
246
- const onHeaderClick = (item: ITableColumns) => {
247
- tableSortHandler(item.id);
248
- };
249
-
250
- const onSelectionChanged = (items: MockedItem[]) => {
251
- selectedIds.value = items.map((item) => item.id!);
252
- };
253
-
254
- const actionBuilder = (): IActionBuilderResult[] => {
255
- const result: IActionBuilderResult[] = [];
256
- result.push({
257
- icon: "material-delete",
258
- title: computed(() => t("SAMPLE_APP.PAGES.LIST.TABLE.ACTIONS.DELETE")),
259
- type: "danger",
260
- async clickHandler(_item: MockedItem) {
261
- if (_item.id) {
262
- if (!selectedIds.value.includes(_item.id)) {
263
- selectedIds.value.push(_item.id);
264
- }
265
- await remove(selectedIds.value);
266
- selectedIds.value = [];
267
- }
268
- },
269
- });
270
-
271
- return result;
272
- };
273
-
274
- async function remove(ids: string[]) {
275
- if (
276
- await showConfirmation(
277
- t(`SAMPLE_APP.PAGES.ALERTS.DELETE_SELECTED_CONFIRMATION.MESSAGE`, {
278
- count: selectedIds.value.length,
279
- }),
280
- )
281
- ) {
282
- await removeItems({ ids });
283
- await reload();
284
- }
285
- }
286
-
287
- watch(
288
- () => sortExpression.value,
289
- async (newVal) => {
290
- await getItems({
291
- sort: newVal,
292
- });
293
- },
294
- );
295
-
296
- defineExpose({
297
- title,
298
- reload,
299
- });
300
- </script>
@@ -1,52 +0,0 @@
1
- import VirtoShellFramework, { notification, useUser, useLanguages } from "@vc-shell/framework";
2
- import { createApp } from "vue";
3
- import { router } from "./router";
4
- import * as locales from "./locales";
5
- import { RouterView } from "vue-router";
6
- import {{ModuleNamePascalCase}} from "./modules/{{ModuleName}}";
7
- import SampleModule from "./modules/sample";
8
- import { bootstrap } from "./bootstrap";
9
-
10
- // Load required CSS
11
- import "@vc-shell/framework/dist/index.css";
12
-
13
- async function startApp() {
14
- const { loadUser } = useUser();
15
- await loadUser();
16
-
17
- const { currentLocale, setLocale } = useLanguages();
18
-
19
- const app = createApp(RouterView)
20
- .use(VirtoShellFramework, {
21
- router,
22
- i18n: {
23
- locale: import.meta.env.APP_I18N_LOCALE,
24
- fallbackLocale: import.meta.env.APP_I18N_FALLBACK_LOCALE,
25
- },
26
- })
27
- // {{ModuleNamePascalCase}} module initialization
28
- .use({{ModuleNamePascalCase}}, { router })
29
- // Sample module initialization
30
- .use(SampleModule, { router })
31
- .use(router);
32
-
33
- bootstrap(app);
34
-
35
- Object.entries(locales).forEach(([key, message]) => {
36
- app.config.globalProperties.$mergeLocaleMessage(key, message);
37
- });
38
-
39
- setLocale(currentLocale.value);
40
-
41
- app.config.errorHandler = (err) => {
42
- notification.error((err as Error).toString(), {
43
- timeout: 5000,
44
- });
45
- };
46
-
47
- await router.isReady();
48
-
49
- app.mount("#app");
50
- }
51
-
52
- startApp();