aetherx-dt-ui 0.1.6 → 0.1.8
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.
package/dist/cli/index.mjs
CHANGED
|
@@ -106,6 +106,12 @@ function getStylesContent() {
|
|
|
106
106
|
const registryDir = getRegistryDir();
|
|
107
107
|
return fs.readFileSync(path.join(registryDir, "styles", "base.css"), "utf-8");
|
|
108
108
|
}
|
|
109
|
+
function getTableCellsContent() {
|
|
110
|
+
const registryDir = getRegistryDir();
|
|
111
|
+
const filePath = path.join(registryDir, "styles", "table-cells.css");
|
|
112
|
+
if (!fs.existsSync(filePath)) return "";
|
|
113
|
+
return fs.readFileSync(filePath, "utf-8");
|
|
114
|
+
}
|
|
109
115
|
function getLibContent() {
|
|
110
116
|
const registryDir = getRegistryDir();
|
|
111
117
|
return fs.readFileSync(path.join(registryDir, "lib", "utils.ts"), "utf-8");
|
|
@@ -222,10 +228,6 @@ async function initCommand() {
|
|
|
222
228
|
message: "Where should lib utils go?",
|
|
223
229
|
initialValue: "src/lib",
|
|
224
230
|
placeholder: "src/lib"
|
|
225
|
-
}),
|
|
226
|
-
agent: () => p.confirm({
|
|
227
|
-
message: "Include AI agent documentation (AGENT.md)?",
|
|
228
|
-
initialValue: true
|
|
229
231
|
})
|
|
230
232
|
},
|
|
231
233
|
{
|
|
@@ -242,7 +244,7 @@ async function initCommand() {
|
|
|
242
244
|
libDir: answers.libDir,
|
|
243
245
|
stylesDir,
|
|
244
246
|
installedComponents: [],
|
|
245
|
-
agent:
|
|
247
|
+
agent: true
|
|
246
248
|
};
|
|
247
249
|
const s = p.spinner();
|
|
248
250
|
writeConfig(config);
|
|
@@ -255,6 +257,16 @@ async function initCommand() {
|
|
|
255
257
|
"utf-8"
|
|
256
258
|
);
|
|
257
259
|
s.stop("base.css copied");
|
|
260
|
+
const tableCellsContent = getTableCellsContent();
|
|
261
|
+
if (tableCellsContent) {
|
|
262
|
+
s.start("Copying table-cells.css...");
|
|
263
|
+
fs.writeFileSync(
|
|
264
|
+
path.join(stylesPath, "table-cells.css"),
|
|
265
|
+
tableCellsContent,
|
|
266
|
+
"utf-8"
|
|
267
|
+
);
|
|
268
|
+
s.stop("table-cells.css copied");
|
|
269
|
+
}
|
|
258
270
|
s.start("Copying lib/utils.ts...");
|
|
259
271
|
const libPath = path.resolve(process.cwd(), answers.libDir);
|
|
260
272
|
fs.mkdirSync(libPath, { recursive: true });
|
|
@@ -264,11 +276,9 @@ async function initCommand() {
|
|
|
264
276
|
"utf-8"
|
|
265
277
|
);
|
|
266
278
|
s.stop("lib/utils.ts copied");
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
s.stop("AGENT.md created");
|
|
271
|
-
}
|
|
279
|
+
s.start("Creating AGENT.md...");
|
|
280
|
+
createAgentMd();
|
|
281
|
+
s.stop("AGENT.md created");
|
|
272
282
|
p.note(
|
|
273
283
|
[
|
|
274
284
|
`${pc.bold("Next steps:")}`,
|
|
@@ -454,6 +464,16 @@ async function updateCommand() {
|
|
|
454
464
|
"utf-8"
|
|
455
465
|
);
|
|
456
466
|
s.stop("base.css updated");
|
|
467
|
+
const tableCellsContent = getTableCellsContent();
|
|
468
|
+
if (tableCellsContent) {
|
|
469
|
+
s.start("Updating table-cells.css...");
|
|
470
|
+
fs.writeFileSync(
|
|
471
|
+
path.join(stylesPath, "table-cells.css"),
|
|
472
|
+
tableCellsContent,
|
|
473
|
+
"utf-8"
|
|
474
|
+
);
|
|
475
|
+
s.stop("table-cells.css updated");
|
|
476
|
+
}
|
|
457
477
|
s.start("Updating lib/utils.ts...");
|
|
458
478
|
const libPath = path.resolve(process.cwd(), config.libDir);
|
|
459
479
|
fs.mkdirSync(libPath, { recursive: true });
|
|
@@ -492,17 +512,15 @@ async function updateCommand() {
|
|
|
492
512
|
}
|
|
493
513
|
}
|
|
494
514
|
}
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
s.stop("AGENT.md rebuilt");
|
|
499
|
-
}
|
|
515
|
+
s.start("Rebuilding AGENT.md...");
|
|
516
|
+
rebuildAgentMd(config);
|
|
517
|
+
s.stop("AGENT.md rebuilt");
|
|
500
518
|
p.note(
|
|
501
519
|
[
|
|
502
520
|
`${pc.green("\u2713")} base.css \u2014 latest design tokens`,
|
|
503
521
|
`${pc.green("\u2713")} lib/utils.ts \u2014 latest helpers`,
|
|
504
|
-
|
|
505
|
-
].
|
|
522
|
+
`${pc.green("\u2713")} AGENT.md \u2014 rebuilt with current components`
|
|
523
|
+
].join("\n"),
|
|
506
524
|
"Updated files"
|
|
507
525
|
);
|
|
508
526
|
p.outro(pc.green("dt-ui updated successfully!"));
|
package/package.json
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import { computed,
|
|
2
|
+
import { computed, onMounted } from 'vue'
|
|
3
3
|
|
|
4
4
|
const props = withDefaults(defineProps<{
|
|
5
5
|
badge?: string
|
|
6
6
|
profileName?: string
|
|
7
7
|
profileAvatar?: string
|
|
8
|
+
activeModule?: string
|
|
9
|
+
envMode?: 'dev' | 'preprod' | 'prod'
|
|
8
10
|
showModulesButton?: boolean
|
|
9
11
|
}>(), {
|
|
12
|
+
activeModule: 'cabinet',
|
|
13
|
+
envMode: 'dev',
|
|
10
14
|
showModulesButton: true,
|
|
11
15
|
})
|
|
12
16
|
|
|
13
17
|
defineEmits<{
|
|
14
18
|
'toggle-profile': []
|
|
15
|
-
'open-modules': []
|
|
16
19
|
}>()
|
|
17
20
|
|
|
18
21
|
const profileInitials = computed(() => {
|
|
@@ -20,6 +23,21 @@ const profileInitials = computed(() => {
|
|
|
20
23
|
const parts = props.profileName.trim().split(/\s+/)
|
|
21
24
|
return parts.map((p) => p[0]).join('').toUpperCase().slice(0, 2)
|
|
22
25
|
})
|
|
26
|
+
|
|
27
|
+
const openModules = () => {
|
|
28
|
+
if ((window as any).$showModulesModal) {
|
|
29
|
+
;(window as any).$showModulesModal()
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
onMounted(() => {
|
|
34
|
+
if ((window as any).$loadDtModulesModal) {
|
|
35
|
+
;(window as any).$loadDtModulesModal({
|
|
36
|
+
mode: props.envMode,
|
|
37
|
+
activeModule: props.activeModule,
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
})
|
|
23
41
|
</script>
|
|
24
42
|
|
|
25
43
|
<template>
|
|
@@ -35,13 +53,18 @@ const profileInitials = computed(() => {
|
|
|
35
53
|
<button
|
|
36
54
|
v-if="showModulesButton"
|
|
37
55
|
class="dt-header__circle-btn"
|
|
38
|
-
@click="
|
|
56
|
+
@click="openModules"
|
|
39
57
|
>
|
|
40
58
|
<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
|
|
41
|
-
<
|
|
42
|
-
<
|
|
43
|
-
<
|
|
44
|
-
<
|
|
59
|
+
<path d="M17 18C17 18.5523 17.4477 19 18 19C18.5523 19 19 18.5523 19 18C19 17.4477 18.5523 17 18 17C17.4477 17 17 17.4477 17 18Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
60
|
+
<path d="M11 18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18C13 17.4477 12.5523 17 12 17C11.4477 17 11 17.4477 11 18Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
61
|
+
<path d="M5 18C5 18.5523 5.44772 19 6 19C6.55228 19 7 18.5523 7 18C7 17.4477 6.55228 17 6 17C5.44772 17 5 17.4477 5 18Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
62
|
+
<path d="M17 12C17 12.5523 17.4477 13 18 13C18.5523 13 19 12.5523 19 12C19 11.4477 18.5523 11 18 11C17.4477 11 17 11.4477 17 12Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
63
|
+
<path d="M11 12C11 12.5523 11.4477 13 12 13C12.5523 13 13 12.5523 13 12C13 11.4477 12.5523 11 12 11C11.4477 11 11 11.4477 11 12Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
64
|
+
<path d="M5 12C5 12.5523 5.44772 13 6 13C6.55228 13 7 12.5523 7 12C7 11.4477 6.55228 11 6 11C5.44772 11 5 11.4477 5 12Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
65
|
+
<path d="M17 6C17 6.55228 17.4477 7 18 7C18.5523 7 19 6.55228 19 6C19 5.44772 18.5523 5 18 5C17.4477 5 17 5.44772 17 6Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
66
|
+
<path d="M11 6C11 6.55228 11.4477 7 12 7C12.5523 7 13 6.55228 13 6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
67
|
+
<path d="M5 6C5 6.55228 5.44772 7 6 7C6.55228 7 7 6.55228 7 6C7 5.44772 6.55228 5 6 5C5.44772 5 5 5.44772 5 6Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
45
68
|
</svg>
|
|
46
69
|
</button>
|
|
47
70
|
|
|
@@ -23,6 +23,7 @@ type Locale = 'uz' | 'ru' | 'en'
|
|
|
23
23
|
// Built-in i18n — shared across all 23 modules
|
|
24
24
|
const i18n: Record<Locale, Record<string, string>> = {
|
|
25
25
|
ru: {
|
|
26
|
+
profile: 'Профиль',
|
|
26
27
|
appearance: 'Внешний вид',
|
|
27
28
|
language: 'Язык',
|
|
28
29
|
logout: 'Выйти',
|
|
@@ -31,6 +32,7 @@ const i18n: Record<Locale, Record<string, string>> = {
|
|
|
31
32
|
systemTheme: 'Системная',
|
|
32
33
|
},
|
|
33
34
|
uz: {
|
|
35
|
+
profile: 'Profil',
|
|
34
36
|
appearance: 'Tashqi ko\'rinish',
|
|
35
37
|
language: 'Til',
|
|
36
38
|
logout: 'Chiqish',
|
|
@@ -39,6 +41,7 @@ const i18n: Record<Locale, Record<string, string>> = {
|
|
|
39
41
|
systemTheme: 'Tizim',
|
|
40
42
|
},
|
|
41
43
|
en: {
|
|
44
|
+
profile: 'Profile',
|
|
42
45
|
appearance: 'Appearance',
|
|
43
46
|
language: 'Language',
|
|
44
47
|
logout: 'Logout',
|
|
@@ -149,6 +152,11 @@ onUnmounted(() => {
|
|
|
149
152
|
document.removeEventListener('keydown', onKeydown)
|
|
150
153
|
})
|
|
151
154
|
|
|
155
|
+
const openProfile = () => {
|
|
156
|
+
if (props.profileUrl) window.open(props.profileUrl, '_blank')
|
|
157
|
+
close()
|
|
158
|
+
}
|
|
159
|
+
|
|
152
160
|
const onMenuItemClick = (item: DtProfileMenuItem) => {
|
|
153
161
|
if (item.href) {
|
|
154
162
|
window.open(item.href, '_blank')
|
|
@@ -186,12 +194,12 @@ const onMenuItemClick = (item: DtProfileMenuItem) => {
|
|
|
186
194
|
<div class="dt-profile-modal__menu">
|
|
187
195
|
<!-- Profile link -->
|
|
188
196
|
<ul class="dt-profile-modal__list">
|
|
189
|
-
<li v-if="profileUrl" class="dt-profile-modal__item" @click="
|
|
197
|
+
<li v-if="profileUrl" class="dt-profile-modal__item" @click="openProfile">
|
|
190
198
|
<svg class="dt-profile-modal__icon" width="22" height="22" viewBox="0 0 22 22" fill="none">
|
|
191
199
|
<circle cx="11" cy="8" r="3.5" stroke="currentColor" stroke-width="1.5"/>
|
|
192
200
|
<path d="M4.5 18.5C4.5 15 7.36 13 11 13C14.64 13 17.5 15 17.5 18.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
193
201
|
</svg>
|
|
194
|
-
<span>{{ t('profile')
|
|
202
|
+
<span>{{ t('profile') }}</span>
|
|
195
203
|
</li>
|
|
196
204
|
</ul>
|
|
197
205
|
|
|
@@ -38,8 +38,8 @@ type BadgeSize = 'sm' | 'default'
|
|
|
38
38
|
|
|
39
39
|
| Size | Padding | Font Size |
|
|
40
40
|
|------|---------|-----------|
|
|
41
|
-
| `sm` | 0.125rem 0.
|
|
42
|
-
| `default` | 0.25rem 0.
|
|
41
|
+
| `sm` | 0.125rem 0.375rem | `--dt-text-xs` |
|
|
42
|
+
| `default` | 0.25rem 0.5rem | `--dt-text-xs` |
|
|
43
43
|
|
|
44
44
|
## Slots
|
|
45
45
|
|
|
@@ -45,6 +45,8 @@ Pre-styled header with logo area, badge, module switcher button, and profile ava
|
|
|
45
45
|
| `badge` | `string` | `undefined` | Badge text displayed next to the logo (e.g., "Specialist", "Cabinet"). |
|
|
46
46
|
| `profileName` | `string` | `undefined` | Used to generate avatar initials when no image is provided. |
|
|
47
47
|
| `profileAvatar` | `string` | `undefined` | URL for the profile avatar image. Falls back to initials. |
|
|
48
|
+
| `activeModule` | `string` | `'cabinet'` | The current module's identifier. Passed to the DT modules modal to highlight the active module. |
|
|
49
|
+
| `envMode` | `'dev' \| 'preprod' \| 'prod'` | `'dev'` | Environment mode. Determines which CDN domain the modules modal uses. |
|
|
48
50
|
| `showModulesButton` | `boolean` | `true` | Whether to show the grid modules button. |
|
|
49
51
|
|
|
50
52
|
#### Events
|
|
@@ -52,7 +54,17 @@ Pre-styled header with logo area, badge, module switcher button, and profile ava
|
|
|
52
54
|
| Event | Payload | Description |
|
|
53
55
|
|-------|---------|-------------|
|
|
54
56
|
| `toggle-profile` | — | Emitted when the profile avatar button is clicked. |
|
|
55
|
-
|
|
57
|
+
|
|
58
|
+
#### Modules Modal (Built-in)
|
|
59
|
+
|
|
60
|
+
The header automatically initializes the DT modules modal on mount using the external `dt-header.js` script. You must include it in your `index.html`:
|
|
61
|
+
|
|
62
|
+
```html
|
|
63
|
+
<script src="https://cdn.dthub.uz/dt-header/dist/dt-header.js"></script>
|
|
64
|
+
<link rel="stylesheet" href="https://cdn.dthub.uz/dt-header/dist/style.css">
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
The `activeModule` prop highlights the current module in the grid. The `envMode` prop controls which API environment the modal uses (dev → `.dthub.uz`, preprod → `.predt.uz`, prod → `.dt.uz`).
|
|
56
68
|
|
|
57
69
|
#### Slots
|
|
58
70
|
|
|
@@ -123,6 +135,7 @@ Fully self-contained profile dropdown with user info, theme switcher, language p
|
|
|
123
135
|
| `menuItems` | `DtProfileMenuItem[]` | `[]` | Optional extra menu items specific to the module. |
|
|
124
136
|
| `isOrganization` | `boolean` | `false` | If true, displays `user.organization_name` instead of personal name. |
|
|
125
137
|
| `profileUrl` | `string` | `undefined` | URL for the "Profile" link (opens in new tab). If not set, profile link is hidden. |
|
|
138
|
+
| `resourceUrl` | `string` | `undefined` | Base URL for file resources (e.g., `https://resource.dthub.uz/api/file/view-image`). Prepended to `user.logo_url` to build the full avatar URL. |
|
|
126
139
|
|
|
127
140
|
#### DtUser Interface
|
|
128
141
|
|
|
@@ -242,6 +255,8 @@ const navItems: DtNavItem[] = [
|
|
|
242
255
|
badge="Specialist"
|
|
243
256
|
:profile-name="store.user?.first_name + ' ' + store.user?.last_name"
|
|
244
257
|
:profile-avatar="store.user?.logo_url"
|
|
258
|
+
active-module="cabinet"
|
|
259
|
+
:env-mode="import.meta.env.DEV ? 'dev' : 'prod'"
|
|
245
260
|
@toggle-profile="showProfile = !showProfile"
|
|
246
261
|
>
|
|
247
262
|
<template #logo>
|
|
@@ -255,6 +270,7 @@ const navItems: DtNavItem[] = [
|
|
|
255
270
|
:theme="theme"
|
|
256
271
|
:is-organization="store.isOrganization"
|
|
257
272
|
profile-url="https://id.dthub.uz/cabinet"
|
|
273
|
+
resource-url="https://resource.dthub.uz/api/file/view-image"
|
|
258
274
|
@theme-change="setTheme"
|
|
259
275
|
@locale-change="setLang"
|
|
260
276
|
@logout="store.logout()"
|