@antcde/component-library 0.1.12 → 0.1.14-rc.00a441c
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/README.md +2 -2
- package/dist/index.js +41317 -33581
- package/dist/types/src/components/BaseAntCard.vue.d.ts +30 -0
- package/dist/types/{components → src/components}/BaseAntInput.vue.d.ts +13 -5
- package/dist/types/{components → src/components}/BaseAppCard.vue.d.ts +18 -1
- package/dist/types/{components → src/components}/BaseClickableIcon.vue.d.ts +1 -1
- package/dist/types/{components → src/components}/BaseConfirmDialog.vue.d.ts +16 -7
- package/dist/types/{components → src/components}/BaseDeleteDialog.vue.d.ts +24 -9
- package/dist/types/{components → src/components}/BaseDialog.vue.d.ts +12 -4
- package/dist/types/src/components/BaseLimitedButton.vue.d.ts +45 -0
- package/dist/types/{components → src/components}/BaseResizePanel.vue.d.ts +12 -12
- package/dist/types/src/components/BulkLabelsMenu.vue.d.ts +33 -0
- package/dist/types/src/components/DmsFilePicker/composables/usePickerNavigation.d.ts +196 -0
- package/dist/types/src/components/DmsFilePicker/composables/usePickerUpload.d.ts +22 -0
- package/dist/types/src/components/DmsFilePicker/index.vue.d.ts +28 -0
- package/dist/types/src/components/DmsFilePicker/utils/fileFormatting.d.ts +6 -0
- package/dist/types/src/components/FilePreviewContent/index.vue.d.ts +31 -0
- package/dist/types/src/components/FlowWindowContent/index.vue.d.ts +113 -0
- package/dist/types/src/components/RichTextEditor/index.vue.d.ts +51 -0
- package/dist/types/src/components/StackedLabels/_LabelsMenuCard.vue.d.ts +15 -0
- package/dist/types/src/components/StackedLabels/index.vue.d.ts +26 -0
- package/dist/types/src/components/TasksFlow/components/_FlowBreadcrumb.vue.d.ts +17 -0
- package/dist/types/src/components/TasksFlow/components/_FlowEdgeConditionsDialog.vue.d.ts +10 -0
- package/dist/types/{components/TasksFlow/components/nodes/_triggerNode.vue.d.ts → src/components/TasksFlow/components/_FlowSearch.vue.d.ts} +4 -3
- package/dist/types/src/components/TasksFlow/components/_FlowStats.vue.d.ts +5 -0
- package/dist/types/src/components/TasksFlow/components/_InsertTemplateDialog.vue.d.ts +17 -0
- package/dist/types/src/components/TasksFlow/components/_SubflowPanel.vue.d.ts +125 -0
- package/dist/types/src/components/TasksFlow/components/_VersionDiffView.vue.d.ts +14 -0
- package/dist/types/src/components/TasksFlow/components/_VersionPublishDialog.vue.d.ts +14 -0
- package/dist/types/src/components/TasksFlow/components/_dropzoneBackground.vue.d.ts +17 -0
- package/dist/types/src/components/TasksFlow/components/_flowEditor.vue.d.ts +13 -0
- package/dist/types/src/components/TasksFlow/components/nodes/_DurationEditor.vue.d.ts +33 -0
- package/dist/types/src/components/TasksFlow/components/nodes/_NodeContextMenu.vue.d.ts +35 -0
- package/dist/types/src/components/TasksFlow/components/nodes/_UserPicker.vue.d.ts +32 -0
- package/dist/types/{components → src/components}/TasksFlow/components/nodes/_taskNode.vue.d.ts +2 -2
- package/dist/types/src/components/TasksFlow/components/nodes/_triggerNode.vue.d.ts +10 -0
- package/dist/types/src/components/TasksFlow/composables/useAutoLayout.d.ts +22 -0
- package/dist/types/src/components/TasksFlow/composables/useCriticalPath.d.ts +8 -0
- package/dist/types/src/components/TasksFlow/composables/useFlowCache.d.ts +17 -0
- package/dist/types/src/components/TasksFlow/composables/useFlowCrud.d.ts +21 -0
- package/dist/types/src/components/TasksFlow/composables/useFlowEditor.d.ts +54 -0
- package/dist/types/src/components/TasksFlow/composables/useFlowFetch.d.ts +33 -0
- package/dist/types/src/components/TasksFlow/composables/useFlowKeyboard.d.ts +15 -0
- package/dist/types/src/components/TasksFlow/composables/useFlowNotifications.d.ts +15 -0
- package/dist/types/src/components/TasksFlow/composables/useFlowOperations.d.ts +8 -0
- package/dist/types/src/components/TasksFlow/composables/useFlowRealtime.d.ts +23 -0
- package/dist/types/src/components/TasksFlow/composables/useFlowSearch.d.ts +14 -0
- package/dist/types/src/components/TasksFlow/composables/useFlowSubflows.d.ts +22 -0
- package/dist/types/src/components/TasksFlow/composables/useFlowUsers.d.ts +27 -0
- package/dist/types/src/components/TasksFlow/composables/useFlowViewport.d.ts +28 -0
- package/dist/types/src/components/TasksFlow/composables/useTaskFlow.d.ts +321 -0
- package/dist/types/{components → src/components}/TasksFlow/composables/useTaskFlowDragDrop.d.ts +3 -4
- package/dist/types/src/components/TasksFlow/composables/useTaskFlowEdgeConditions.d.ts +10 -0
- package/dist/types/src/components/TasksFlow/composables/useTaskFlowEdges.d.ts +18 -0
- package/dist/types/src/components/TasksFlow/composables/useTaskFlowMappers.d.ts +4 -0
- package/dist/types/src/components/TasksFlow/composables/useTaskFlowTypes.d.ts +76 -0
- package/dist/types/src/components/TasksFlow/composables/useTemplateVersioning.d.ts +188 -0
- package/dist/types/src/components/TasksFlow/composables/useTemplateVersioningState.d.ts +176 -0
- package/dist/types/src/components/TasksFlow/composables/useTriggerExecution.d.ts +21 -0
- package/dist/types/src/components/TasksFlow/index.vue.d.ts +39 -0
- package/dist/types/src/components/UnifiedWindow/index.vue.d.ts +67 -0
- package/dist/types/src/components/UnifiedWindow/useWindowDrag.d.ts +28 -0
- package/dist/types/src/components/VersionPublishDialog.vue.d.ts +24 -0
- package/dist/types/{index.d.ts → src/index.d.ts} +15 -1
- package/lib/GisViewer/GisViewer.vue +3 -2
- package/lib/build/layer-order.css +33 -0
- package/lib/build/uno.ts +117 -0
- package/lib/build/vite.ts +104 -0
- package/lib/build/vuetify-overrides.css +14 -0
- package/lib/build/vuetify.ts +230 -0
- package/lib/test/TESTING.claude.md +225 -0
- package/lib/test/createMockAppContext.ts +211 -0
- package/lib/test/createTestPinia.ts +31 -0
- package/lib/test/createTestRouter.ts +31 -0
- package/lib/test/index.ts +41 -0
- package/lib/test/mockVueRouter.ts +93 -0
- package/lib/test/mocks/createMockApi.ts +43 -0
- package/lib/test/mocks/createMockContext.ts +109 -0
- package/lib/test/mocks/createMockSignal.ts +30 -0
- package/lib/test/mocks/createMockUser.ts +87 -0
- package/lib/test/mocks/index.ts +11 -0
- package/lib/test/mountApp.ts +47 -0
- package/lib/test/mountWithContext.ts +94 -0
- package/lib/test/setup.ts +151 -0
- package/lib/test/testAppSetup.ts +110 -0
- package/lib/test/vitest.ts +69 -0
- package/package.json +147 -61
- package/dist/component-library.css +0 -1
- package/dist/types/components/BaseAntCard.vue.d.ts +0 -22
- package/dist/types/components/TasksFlow/components/_dropzoneBackground.vue.d.ts +0 -9
- package/dist/types/components/TasksFlow/components/_flowEditor.vue.d.ts +0 -16
- package/dist/types/components/TasksFlow/composables/useTaskFlow.d.ts +0 -103
- package/dist/types/components/TasksFlow/index.vue.d.ts +0 -51
- package/lib/DocumentManager/DocumentDrop.vue +0 -74
- package/lib/DocumentManager/DocumentManager.vue +0 -571
- package/lib/DocumentManager/hooks/useDms.ts +0 -172
- package/lib/DocumentManager/index.ts +0 -3
- package/lib/DocumentManager/lang/translations/de.json +0 -36
- package/lib/DocumentManager/lang/translations/en.json +0 -38
- package/lib/DocumentManager/lang/translations/nl.json +0 -36
- package/lib/DocumentManager/utils.ts +0 -16
- /package/dist/types/{components → src/components}/BaseAntButton.vue.d.ts +0 -0
- /package/dist/types/{components → src/components}/BaseAntCreateCard.vue.d.ts +0 -0
- /package/dist/types/{components → src/components}/BaseAntDatePicker.vue.d.ts +0 -0
- /package/dist/types/{components → src/components}/BaseAntLoading.vue.d.ts +0 -0
- /package/dist/types/{components → src/components}/BaseAppCardSkeleton.vue.d.ts +0 -0
- /package/dist/types/{components → src/components}/GlobalLabelBadge.vue.d.ts +0 -0
- /package/dist/types/{components → src/components}/RBAC/Permissions/PermissionCard.vue.d.ts +0 -0
- /package/dist/types/{components → src/components}/TasksFlow/components/_flowEdge.vue.d.ts +0 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* ANT Platform — CSS Layer Order
|
|
3
|
+
*
|
|
4
|
+
* Registers the layer cascade order BEFORE any Vuetify component CSS loads.
|
|
5
|
+
* CSS layer priority is set by the first declaration of each name. UnoCSS
|
|
6
|
+
* layers are prefixed with `uno-` (via `cssLayerName` in uno.config) to
|
|
7
|
+
* avoid collisions with Vuetify's own layer names.
|
|
8
|
+
*
|
|
9
|
+
* Order rationale:
|
|
10
|
+
* uno-base — UnoCSS preflights / resets (lowest priority)
|
|
11
|
+
* uno-theme — UnoCSS theme utilities
|
|
12
|
+
* vuetify-core — Vuetify resets (button { font: inherit }, etc.)
|
|
13
|
+
* vuetify-components — Vuetify component styles (.v-btn, .v-card, …)
|
|
14
|
+
* vuetify-overrides — Vuetify component overrides
|
|
15
|
+
* vuetify-utilities — Vuetify utility classes
|
|
16
|
+
* uno-shortcuts — UnoCSS shortcuts
|
|
17
|
+
* uno-default — UnoCSS utilities (above Vuetify so `p-4` beats `.v-card` padding)
|
|
18
|
+
* vuetify-final — Vuetify !important overrides (highest priority)
|
|
19
|
+
*
|
|
20
|
+
* This file is imported as a side-effect by:
|
|
21
|
+
* - `src/index.ts` (component library main entry — for apps using AntComponentLibrary plugin)
|
|
22
|
+
* - `lib/build/vuetify.ts` (createAntVuetify factory — for apps using the factory directly)
|
|
23
|
+
*/
|
|
24
|
+
@layer
|
|
25
|
+
uno-base,
|
|
26
|
+
uno-theme,
|
|
27
|
+
vuetify-core,
|
|
28
|
+
vuetify-components,
|
|
29
|
+
vuetify-overrides,
|
|
30
|
+
vuetify-utilities,
|
|
31
|
+
uno-shortcuts,
|
|
32
|
+
uno-default,
|
|
33
|
+
vuetify-final;
|
package/lib/build/uno.ts
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import type { UserConfig } from 'unocss'
|
|
2
|
+
import presetRemToPx from '@unocss/preset-rem-to-px'
|
|
3
|
+
import presetWind4 from '@unocss/preset-wind4'
|
|
4
|
+
import { defineConfig, transformerDirectives, transformerVariantGroup } from 'unocss'
|
|
5
|
+
|
|
6
|
+
const antColors = {
|
|
7
|
+
primary: '#125CFF',
|
|
8
|
+
secondary: '#64748B',
|
|
9
|
+
info: '#2196F3',
|
|
10
|
+
success: '#4CAF50',
|
|
11
|
+
warning: '#FB8C00',
|
|
12
|
+
} as const
|
|
13
|
+
|
|
14
|
+
const vuetifyBreakpoints = {
|
|
15
|
+
xs: '0px',
|
|
16
|
+
sm: '600px',
|
|
17
|
+
md: '960px',
|
|
18
|
+
lg: '1280px',
|
|
19
|
+
xl: '1920px',
|
|
20
|
+
xxl: '2560px',
|
|
21
|
+
} as const
|
|
22
|
+
|
|
23
|
+
// ANT design-system tokens built on Vuetify CSS custom properties. These
|
|
24
|
+
// exist because UnoCSS shortcuts can only expand to UnoCSS-generated
|
|
25
|
+
// utilities — Vuetify's own classes (bg-surface, etc.) are invisible to the
|
|
26
|
+
// shortcut resolver. Text tokens use unprefixed names (text-heading,
|
|
27
|
+
// text-muted) since they have no Vuetify namesake. Background and border
|
|
28
|
+
// tokens use the `ant-` prefix to avoid shadowing Vuetify's own bg-surface.
|
|
29
|
+
const antDesignTokens: NonNullable<UserConfig['rules']> = [
|
|
30
|
+
['bg-ant-surface', { 'background-color': 'rgb(var(--v-theme-surface))' }],
|
|
31
|
+
['bg-ant-panel', { 'background-color': 'rgba(var(--v-theme-on-surface), 0.03)' }],
|
|
32
|
+
['bg-ant-inset', { 'background-color': 'rgba(var(--v-border-color), 0.08)' }],
|
|
33
|
+
['bg-ant-hover', { 'background-color': 'rgba(var(--v-border-color), 0.04)' }],
|
|
34
|
+
['text-heading', { color: 'rgb(var(--v-theme-on-surface))' }],
|
|
35
|
+
['text-body', { color: 'rgba(var(--v-theme-on-surface), 0.7)' }],
|
|
36
|
+
['text-muted', { color: 'rgba(var(--v-theme-on-surface), 0.5)' }],
|
|
37
|
+
['text-disabled', { color: 'rgba(var(--v-theme-on-surface), 0.38)' }],
|
|
38
|
+
['border-ant', { 'border-color': 'rgba(var(--v-border-color), var(--v-border-opacity))' }],
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Normalizes shortcuts from either array or object form to array form.
|
|
43
|
+
*
|
|
44
|
+
* UnoCSS accepts shortcuts as either:
|
|
45
|
+
* - Array: `[['pattern', 'replacement'], ...]`
|
|
46
|
+
* - Object: `{ 'pattern': 'replacement', ... }`
|
|
47
|
+
*
|
|
48
|
+
* This helper ensures both forms are supported in overrides.
|
|
49
|
+
*/
|
|
50
|
+
function normalizeShortcuts(shortcuts: any): [string, string][] {
|
|
51
|
+
if (Array.isArray(shortcuts))
|
|
52
|
+
return shortcuts
|
|
53
|
+
if (shortcuts != null && typeof shortcuts === 'object')
|
|
54
|
+
return Object.entries(shortcuts) as [string, string][]
|
|
55
|
+
return []
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Creates a UnoCSS config pre-configured for the ANT platform with Vuetify 4.
|
|
60
|
+
*
|
|
61
|
+
* Includes:
|
|
62
|
+
* - Correct `outputToCssLayers` with `uno-` prefix (required for Vuetify 4 layer compatibility)
|
|
63
|
+
* - `presetWind4` with Vuetify dark mode selector (`.v-theme--dark`)
|
|
64
|
+
* - `presetRemToPx` for pixel-based design
|
|
65
|
+
* - Vuetify breakpoints matching Vuetify's built-in breakpoints
|
|
66
|
+
* - ANT design tokens (`bg-ant-surface`, `text-muted`, `border-ant`, etc.)
|
|
67
|
+
* - Standard transformers (directives + variant group)
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```ts
|
|
71
|
+
* // uno.config.ts — zero-arg default (most apps)
|
|
72
|
+
* import { createAntUnoConfig } from '@antcde/component-library/build/uno'
|
|
73
|
+
* export default createAntUnoConfig()
|
|
74
|
+
*
|
|
75
|
+
* // With overrides
|
|
76
|
+
* export default createAntUnoConfig({
|
|
77
|
+
* rules: [['my-rule', { color: 'red' }]],
|
|
78
|
+
* theme: { colors: { primary: '#009688' } },
|
|
79
|
+
* })
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
export function createAntUnoConfig(overrides: Partial<UserConfig> = {}): UserConfig {
|
|
83
|
+
const { rules, presets, transformers, theme, shortcuts, preflights, ...rest } = overrides
|
|
84
|
+
// UnoCSS types `theme` as `object` on `UserConfig`, so destructured fields
|
|
85
|
+
// lose their shape. Cast to a loose record to access `colors`/`breakpoints`/`radius`.
|
|
86
|
+
const overrideTheme = theme as Record<string, any> | undefined
|
|
87
|
+
const overrideRules = (rules ?? []) as NonNullable<UserConfig['rules']>
|
|
88
|
+
|
|
89
|
+
return defineConfig({
|
|
90
|
+
outputToCssLayers: {
|
|
91
|
+
cssLayerName: (layer: string) => layer === 'properties' ? null : `uno-${layer}`,
|
|
92
|
+
},
|
|
93
|
+
preflights: preflights ?? [],
|
|
94
|
+
rules: [
|
|
95
|
+
...antDesignTokens,
|
|
96
|
+
...overrideRules,
|
|
97
|
+
],
|
|
98
|
+
theme: {
|
|
99
|
+
...overrideTheme,
|
|
100
|
+
colors: { ...antColors, ...(overrideTheme?.colors ?? {}) },
|
|
101
|
+
breakpoints: { ...vuetifyBreakpoints, ...(overrideTheme?.breakpoints ?? {}) },
|
|
102
|
+
radius: { sm: '2px', xl: '24px', ...(overrideTheme?.radius ?? {}) },
|
|
103
|
+
},
|
|
104
|
+
presets: presets ?? [
|
|
105
|
+
presetRemToPx,
|
|
106
|
+
presetWind4({ dark: { dark: '.v-theme--dark' } }),
|
|
107
|
+
],
|
|
108
|
+
shortcuts: [
|
|
109
|
+
...normalizeShortcuts(shortcuts),
|
|
110
|
+
],
|
|
111
|
+
transformers: transformers ?? [
|
|
112
|
+
transformerDirectives(),
|
|
113
|
+
transformerVariantGroup(),
|
|
114
|
+
],
|
|
115
|
+
...rest,
|
|
116
|
+
})
|
|
117
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import type { UserConfig } from 'vite'
|
|
2
|
+
import { fileURLToPath, URL } from 'node:url'
|
|
3
|
+
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite'
|
|
4
|
+
import vue from '@vitejs/plugin-vue'
|
|
5
|
+
import UnoCSS from 'unocss/vite'
|
|
6
|
+
import AutoImport from 'unplugin-auto-import/rolldown'
|
|
7
|
+
import IconsResolver from 'unplugin-icons/resolver'
|
|
8
|
+
import Icons from 'unplugin-icons/rolldown'
|
|
9
|
+
import Components from 'unplugin-vue-components/rolldown'
|
|
10
|
+
import { defineConfig, mergeConfig } from 'vite'
|
|
11
|
+
import vuetify from 'vite-plugin-vuetify'
|
|
12
|
+
|
|
13
|
+
const RE_DIST = /dist/
|
|
14
|
+
const RE_VUETIFY_PLUGIN = /src\/plugins\/vuetify\.ts$/
|
|
15
|
+
const RE_NODE_MODULES = /\bnode_modules\b/
|
|
16
|
+
|
|
17
|
+
/** Canonical CSS layer order declaration — single source of truth for Vuetify 4 + UnoCSS cascade. */
|
|
18
|
+
export const CSS_LAYER_ORDER = '@layer uno-base, uno-theme, vuetify-core, vuetify-components, vuetify-overrides, vuetify-utilities, uno-shortcuts, uno-default, vuetify-final;'
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Creates a Vite config pre-configured for ANT platform apps.
|
|
22
|
+
*
|
|
23
|
+
* Includes: vue, UnoCSS, Vuetify auto-import, AutoImport, Components,
|
|
24
|
+
* Icons, VueI18nPlugin, and sensible defaults for optimizeDeps, resolve, and build.
|
|
25
|
+
*
|
|
26
|
+
* @param appRoot - Pass `import.meta.url` from your vite.config.ts.
|
|
27
|
+
* Used to resolve relative paths (i18n translations, `@` alias) correctly.
|
|
28
|
+
* @param overrides - Additional Vite config merged via `mergeConfig()`.
|
|
29
|
+
* Plugins are appended, objects are deep-merged.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* // vite.config.ts — zero-override default (most apps)
|
|
34
|
+
* import { createAntViteConfig } from '@antcde/component-library/build/vite'
|
|
35
|
+
* export default createAntViteConfig(import.meta.url)
|
|
36
|
+
*
|
|
37
|
+
* // With overrides
|
|
38
|
+
* export default createAntViteConfig(import.meta.url, {
|
|
39
|
+
* server: { port: 5174 },
|
|
40
|
+
* })
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export function createAntViteConfig(appRoot: string | URL, overrides: UserConfig = {}): UserConfig {
|
|
44
|
+
const resolve = (relative: string) => fileURLToPath(new URL(relative, appRoot))
|
|
45
|
+
|
|
46
|
+
const baseConfig = defineConfig({
|
|
47
|
+
base: '/__APP_URL__/',
|
|
48
|
+
optimizeDeps: { exclude: ['vuetify'] },
|
|
49
|
+
plugins: [
|
|
50
|
+
// Inject CSS layer order into <head> before any JS-loaded CSS.
|
|
51
|
+
// This guarantees the cascade order is set before vite-plugin-vuetify
|
|
52
|
+
// auto-imports component CSS — no manual import ordering required.
|
|
53
|
+
{
|
|
54
|
+
name: 'ant-css-layer-order',
|
|
55
|
+
transformIndexHtml() {
|
|
56
|
+
return [{ tag: 'style', children: CSS_LAYER_ORDER, injectTo: 'head-prepend' }]
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
vue(),
|
|
60
|
+
UnoCSS('uno.config.ts'),
|
|
61
|
+
vuetify({ autoImport: { labs: true } }),
|
|
62
|
+
Icons({ autoInstall: true }),
|
|
63
|
+
AutoImport({
|
|
64
|
+
imports: [
|
|
65
|
+
'vue',
|
|
66
|
+
'@vueuse/core',
|
|
67
|
+
'@vueuse/math',
|
|
68
|
+
{ vuetify: ['useDisplay'] },
|
|
69
|
+
],
|
|
70
|
+
dirs: ['src/composables', 'src/stores', 'src/plugins'],
|
|
71
|
+
dts: true,
|
|
72
|
+
eslintrc: { enabled: true },
|
|
73
|
+
exclude: [RE_DIST, RE_VUETIFY_PLUGIN, RE_NODE_MODULES],
|
|
74
|
+
}),
|
|
75
|
+
Components({
|
|
76
|
+
dirs: ['src/components'],
|
|
77
|
+
extensions: ['vue'],
|
|
78
|
+
globs: [
|
|
79
|
+
'src/components/**/*.vue',
|
|
80
|
+
'!src/components/**/_*/**',
|
|
81
|
+
'!src/components/**/_*.vue',
|
|
82
|
+
'!src/components/**/components/**',
|
|
83
|
+
],
|
|
84
|
+
resolvers: [IconsResolver()],
|
|
85
|
+
}),
|
|
86
|
+
VueI18nPlugin({
|
|
87
|
+
include: resolve('./src/lang/translations/**'),
|
|
88
|
+
strictMessage: false,
|
|
89
|
+
}),
|
|
90
|
+
],
|
|
91
|
+
resolve: {
|
|
92
|
+
dedupe: ['vuetify'],
|
|
93
|
+
extensions: ['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json', '.vue'],
|
|
94
|
+
alias: {
|
|
95
|
+
'@': resolve('./src'),
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
build: {
|
|
99
|
+
cssMinify: 'esbuild',
|
|
100
|
+
},
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
return mergeConfig(baseConfig, overrides)
|
|
104
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* ANT Platform — Vuetify CSS overrides
|
|
3
|
+
*
|
|
4
|
+
* Holds CSS patches for Vuetify quirks that cannot be expressed via
|
|
5
|
+
* `theme.variables`, `theme.colors`, or component `defaults`. New patches drop
|
|
6
|
+
* in below as additional sections inside the `vuetify-overrides` cascade layer.
|
|
7
|
+
*/
|
|
8
|
+
@layer vuetify-overrides {
|
|
9
|
+
/* Outlined VCard: Vuetify uses `currentColor` for the border, ignoring the
|
|
10
|
+
`borderColor` default. Pin to hairline. */
|
|
11
|
+
.v-card--variant-outlined {
|
|
12
|
+
border-color: rgb(var(--v-theme-hairline));
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import type { FunctionalComponent } from 'vue'
|
|
2
|
+
import type { IconProps, VuetifyOptions } from 'vuetify'
|
|
3
|
+
import { Icon } from '@iconify/vue'
|
|
4
|
+
import { h } from 'vue'
|
|
5
|
+
import { createVuetify } from 'vuetify'
|
|
6
|
+
import 'vuetify/styles'
|
|
7
|
+
import 'virtual:uno.css'
|
|
8
|
+
// CSS patches for Vuetify quirks not expressible via theme/defaults.
|
|
9
|
+
import './vuetify-overrides.css'
|
|
10
|
+
|
|
11
|
+
/** ANT platform light theme colors — exported for apps that need to reference them in `themes` overrides (e.g. when adding a dark theme). */
|
|
12
|
+
export const ANT_COLORS = {
|
|
13
|
+
'background': '#FFFFFF',
|
|
14
|
+
'surface': '#FFFFFF',
|
|
15
|
+
'surface-bright': '#FFFFFF',
|
|
16
|
+
'surface-light': '#F5F5F5',
|
|
17
|
+
'surface-variant': '#F1F5F9',
|
|
18
|
+
'on-surface-variant': '#334155',
|
|
19
|
+
'primary': '#125CFF',
|
|
20
|
+
'primary-darken-1': '#0D47A1',
|
|
21
|
+
'secondary': '#64748B',
|
|
22
|
+
'secondary-darken-1': '#475569',
|
|
23
|
+
'error': '#B00020',
|
|
24
|
+
'info': '#2196F3',
|
|
25
|
+
'success': '#4CAF50',
|
|
26
|
+
'warning': '#FB8C00',
|
|
27
|
+
// Hairline border for outlined surfaces — ≈ rgba(0,0,0,0.10) on white.
|
|
28
|
+
// Registered as a theme color so component defaults resolve it per active
|
|
29
|
+
// theme (see `ANT_DARK_COLORS.hairline` for the dark equivalent).
|
|
30
|
+
'hairline': '#E5E7EB',
|
|
31
|
+
} as const
|
|
32
|
+
|
|
33
|
+
/** ANT platform dark theme colors — exported for apps that need custom dark theme overrides. */
|
|
34
|
+
export const ANT_DARK_COLORS = {
|
|
35
|
+
'background': '#121212',
|
|
36
|
+
'surface': '#1E1E1E',
|
|
37
|
+
'surface-bright': '#2C2C2C',
|
|
38
|
+
'surface-light': '#252525',
|
|
39
|
+
'surface-variant': '#1E293B',
|
|
40
|
+
'on-surface-variant': '#CBD5E1',
|
|
41
|
+
'primary': '#5C9AFF',
|
|
42
|
+
'primary-darken-1': '#125CFF',
|
|
43
|
+
'secondary': '#94A3B8',
|
|
44
|
+
'secondary-darken-1': '#64748B',
|
|
45
|
+
'error': '#CF6679',
|
|
46
|
+
'info': '#64B5F6',
|
|
47
|
+
'success': '#81C784',
|
|
48
|
+
'warning': '#FFB74D',
|
|
49
|
+
// ≈ 10% white on dark surface (#1E1E1E) — subtle hairline that does not
|
|
50
|
+
// read as a bright visible line in dark mode.
|
|
51
|
+
'hairline': '#2D2D2D',
|
|
52
|
+
} as const
|
|
53
|
+
|
|
54
|
+
/** Theme variables controlling opacity, borders, and interaction feedback. */
|
|
55
|
+
const ANT_VARIABLES = {
|
|
56
|
+
'border-color': '#000000',
|
|
57
|
+
'border-opacity': 0.12,
|
|
58
|
+
'high-emphasis-opacity': 0.87,
|
|
59
|
+
'medium-emphasis-opacity': 0.60,
|
|
60
|
+
'disabled-opacity': 0.38,
|
|
61
|
+
'idle-opacity': 0.04,
|
|
62
|
+
'hover-opacity': 0.04,
|
|
63
|
+
'focus-opacity': 0.12,
|
|
64
|
+
'selected-opacity': 0.08,
|
|
65
|
+
'activated-opacity': 0.12,
|
|
66
|
+
'pressed-opacity': 0.12,
|
|
67
|
+
'dragged-opacity': 0.08,
|
|
68
|
+
'theme-kbd': '#212529',
|
|
69
|
+
'theme-on-kbd': '#FFFFFF',
|
|
70
|
+
'theme-code': '#F5F5F5',
|
|
71
|
+
'theme-on-code': '#000000',
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** Dark theme variables — borders flip to white-based. */
|
|
75
|
+
const ANT_DARK_VARIABLES = {
|
|
76
|
+
'border-color': '#FFFFFF',
|
|
77
|
+
'border-opacity': 0.12,
|
|
78
|
+
'high-emphasis-opacity': 0.87,
|
|
79
|
+
'medium-emphasis-opacity': 0.60,
|
|
80
|
+
'disabled-opacity': 0.38,
|
|
81
|
+
'idle-opacity': 0.10,
|
|
82
|
+
'hover-opacity': 0.04,
|
|
83
|
+
'focus-opacity': 0.12,
|
|
84
|
+
'selected-opacity': 0.08,
|
|
85
|
+
'activated-opacity': 0.12,
|
|
86
|
+
'pressed-opacity': 0.12,
|
|
87
|
+
'dragged-opacity': 0.08,
|
|
88
|
+
'theme-kbd': '#212529',
|
|
89
|
+
'theme-on-kbd': '#FFFFFF',
|
|
90
|
+
'theme-code': '#2C2C2C',
|
|
91
|
+
'theme-on-code': '#CCCCCC',
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** ANT platform component defaults — exported for reference. */
|
|
95
|
+
export const ANT_DEFAULTS: VuetifyOptions['defaults'] = {
|
|
96
|
+
VAppBar: {
|
|
97
|
+
flat: true,
|
|
98
|
+
},
|
|
99
|
+
VToolbar: {
|
|
100
|
+
flat: true,
|
|
101
|
+
},
|
|
102
|
+
VNavigationDrawer: {
|
|
103
|
+
elevation: 0,
|
|
104
|
+
},
|
|
105
|
+
VCard: {
|
|
106
|
+
rounded: 'xl',
|
|
107
|
+
flat: true,
|
|
108
|
+
},
|
|
109
|
+
VCardTitle: {
|
|
110
|
+
style: 'white-space: break-spaces;',
|
|
111
|
+
},
|
|
112
|
+
VBtn: {
|
|
113
|
+
rounded: 'xl',
|
|
114
|
+
class: 'text-none',
|
|
115
|
+
},
|
|
116
|
+
VBtnToggle: {
|
|
117
|
+
rounded: 'xl',
|
|
118
|
+
},
|
|
119
|
+
VBtnGroup: {
|
|
120
|
+
rounded: 'xl',
|
|
121
|
+
},
|
|
122
|
+
VChip: {
|
|
123
|
+
rounded: 'xl',
|
|
124
|
+
},
|
|
125
|
+
// Form fields use `lg` (8px) — closest Vuetify scale to the 10px target shared
|
|
126
|
+
// with the storefront mockups. `xl` (24px) is reserved for cards/buttons/chips
|
|
127
|
+
// and looks oversized on inputs. Variant intentionally not set: keep whatever
|
|
128
|
+
// each call site declares (outlined / solo / plain / underlined).
|
|
129
|
+
VTextField: {
|
|
130
|
+
rounded: 'lg',
|
|
131
|
+
},
|
|
132
|
+
VSelect: {
|
|
133
|
+
rounded: 'lg',
|
|
134
|
+
},
|
|
135
|
+
VAutocomplete: {
|
|
136
|
+
rounded: 'lg',
|
|
137
|
+
},
|
|
138
|
+
VCombobox: {
|
|
139
|
+
rounded: 'lg',
|
|
140
|
+
},
|
|
141
|
+
VTextarea: {
|
|
142
|
+
rounded: 'lg',
|
|
143
|
+
},
|
|
144
|
+
VFileInput: {
|
|
145
|
+
rounded: 'lg',
|
|
146
|
+
},
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Adapter from Vuetify's `IconProps` ({ icon: IconValue, tag, disabled }) to
|
|
151
|
+
* Iconify's `<Icon>` ({ icon: string }). Vuetify passes the resolved icon
|
|
152
|
+
* string for component-based sets, so we forward it directly. A thin wrapper
|
|
153
|
+
* is used instead of casting `Icon`, so the icon set conforms to Vuetify's
|
|
154
|
+
* `IconComponent` type (= `JSXComponent<IconProps>`) with no type assertions.
|
|
155
|
+
*/
|
|
156
|
+
const IconifyAdapter: FunctionalComponent<IconProps> = (props) => {
|
|
157
|
+
return h(Icon, { icon: typeof props.icon === 'string' ? props.icon : '' })
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const DEFAULT_ICONS: VuetifyOptions['icons'] = {
|
|
161
|
+
defaultSet: 'mdi',
|
|
162
|
+
sets: {
|
|
163
|
+
mdi: {
|
|
164
|
+
component: IconifyAdapter,
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export interface AntVuetifyOverrides {
|
|
170
|
+
/** Merge additional component defaults (shallow merge at component level) */
|
|
171
|
+
defaults?: VuetifyOptions['defaults']
|
|
172
|
+
/** Override individual light theme colors (shallow merge). For dark theme overrides, use `themes` instead. */
|
|
173
|
+
colors?: Record<string, string>
|
|
174
|
+
/** Provide a full themes object (replaces the default light theme entirely) */
|
|
175
|
+
themes?: VuetifyOptions['theme'] extends { themes?: infer T } ? T : never
|
|
176
|
+
/** Default theme name (default: 'light') */
|
|
177
|
+
defaultTheme?: string
|
|
178
|
+
/** Explicit component imports (e.g., lab components like VDateInput) */
|
|
179
|
+
components?: VuetifyOptions['components']
|
|
180
|
+
/** Explicit directive imports */
|
|
181
|
+
directives?: VuetifyOptions['directives']
|
|
182
|
+
/** Override icon configuration */
|
|
183
|
+
icons?: VuetifyOptions['icons']
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Creates a Vuetify instance pre-configured with the ANT platform design system.
|
|
188
|
+
*
|
|
189
|
+
* Importing this module automatically loads `vuetify/styles` and `virtual:uno.css`
|
|
190
|
+
* as side effects. CSS layer ordering is handled by the `transformIndexHtml` plugin
|
|
191
|
+
* in `createAntViteConfig`.
|
|
192
|
+
*
|
|
193
|
+
* @example
|
|
194
|
+
* ```ts
|
|
195
|
+
* // plugins/vuetify.ts — zero-arg default (most apps)
|
|
196
|
+
* import { createAntVuetify } from '@antcde/component-library/build/vuetify'
|
|
197
|
+
* export default createAntVuetify()
|
|
198
|
+
*
|
|
199
|
+
* // With overrides (ant-os)
|
|
200
|
+
* export default createAntVuetify({
|
|
201
|
+
* defaults: {
|
|
202
|
+
* VMenu: { transition: 'menu-ant', openDelay: 0, closeDelay: 0 },
|
|
203
|
+
* },
|
|
204
|
+
* })
|
|
205
|
+
* ```
|
|
206
|
+
*/
|
|
207
|
+
export function createAntVuetify(overrides: AntVuetifyOverrides = {}) {
|
|
208
|
+
const { defaults, colors, themes, defaultTheme, components, directives, icons } = overrides
|
|
209
|
+
|
|
210
|
+
return createVuetify({
|
|
211
|
+
defaults: { ...ANT_DEFAULTS, ...defaults },
|
|
212
|
+
theme: {
|
|
213
|
+
defaultTheme: defaultTheme ?? 'light',
|
|
214
|
+
themes: themes ?? {
|
|
215
|
+
light: {
|
|
216
|
+
colors: { ...ANT_COLORS, ...(colors ?? {}) },
|
|
217
|
+
variables: ANT_VARIABLES,
|
|
218
|
+
},
|
|
219
|
+
dark: {
|
|
220
|
+
dark: true,
|
|
221
|
+
colors: { ...ANT_DARK_COLORS },
|
|
222
|
+
variables: ANT_DARK_VARIABLES,
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
icons: icons ?? DEFAULT_ICONS,
|
|
227
|
+
...(components && { components }),
|
|
228
|
+
...(directives && { directives }),
|
|
229
|
+
})
|
|
230
|
+
}
|