Refactor #5667 - For build
parent
ba00f3bc7b
commit
abef162a11
|
@ -179,16 +179,10 @@ const ICON_ALIAS = {
|
||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
const THEME_COMPONENTS = ['accordion','autocomplete','avatar','badge','blockui','breadcrumb','button','buttongroup','card','carousel','cascadeselect','checkbox','chip','colorpicker','confirmdialog','confirmpopup','contextmenu','datatable','dataview','datepicker','dialog','divider','dock','drawer','editor','fieldset','fileupload','floatlabel','galleria','iconfield','image','inlinemessage','inplace','inputchips','inputgroup','inputnumber','inputotp','inputtext','knob','listbox','megamenu','menu','menubar','message','metergroup','multiselect','orderlist','organizationchart','paginator','panel','panelmenu','password','picklist','popover','progressbar','progressspinner','radiobutton','rating','scrollpanel','scrolltop','select','selectbutton','skeleton','slider','speeddial','splitbutton','splitter','steps','stepper','tabmenu','tabs','tabview','tag','terminal','textarea','tieredmenu','timeline','toast','togglebutton','toggleswitch','toolbar','tooltip','tree','treeselect','treetable'];
|
const THEME_COMPONENTS = ['accordion','autocomplete','avatar','badge','blockui','breadcrumb','button','buttongroup','card','carousel','cascadeselect','checkbox','chip','colorpicker','confirmdialog','confirmpopup','contextmenu','datatable','dataview','datepicker','dialog','divider','dock','drawer','editor','fieldset','fileupload','floatlabel','galleria','iconfield','image','inlinemessage','inplace','inputchips','inputgroup','inputnumber','inputotp','inputtext','knob','listbox','megamenu','menu','menubar','message','metergroup','multiselect','orderlist','organizationchart','paginator','panel','panelmenu','password','picklist','popover','progressbar','progressspinner','radiobutton','rating','scrollpanel','scrolltop','select','selectbutton','skeleton','slider','speeddial','splitbutton','splitter','steps','stepper','tabmenu','tabs','tabview','tag','terminal','textarea','tieredmenu','timeline','toast','togglebutton','toggleswitch','toolbar','tooltip','tree','treeselect','treetable'];
|
||||||
|
|
||||||
const createThemeAlias = (design, presets) => {
|
const createThemeAlias = (presets) => {
|
||||||
const baseAlias = THEME_COMPONENTS.reduce((acc, name) => {
|
|
||||||
acc[`primevue/themes/${design}/base/${name}`] = path.resolve(__dirname, `./components/lib/themes/${design}/base/${name}/index.js`);
|
|
||||||
|
|
||||||
return acc;
|
|
||||||
}, {});
|
|
||||||
|
|
||||||
const presetAlias = presets?.reduce((p_acc, p_name) => {
|
const presetAlias = presets?.reduce((p_acc, p_name) => {
|
||||||
const p_alias = THEME_COMPONENTS.reduce((acc, name) => {
|
const p_alias = THEME_COMPONENTS.reduce((acc, name) => {
|
||||||
acc[`primevue/themes/${design}/presets/${p_name}/${name}`] = path.resolve(__dirname, `./components/lib/themes/${design}/presets/${p_name}/${name}/index.js`);
|
acc[`primevue/themes/${p_name}/${name}`] = path.resolve(__dirname, `./components/lib/themes/${p_name}/${name}/index.js`);
|
||||||
|
|
||||||
return acc;
|
return acc;
|
||||||
}, {});
|
}, {});
|
||||||
|
@ -198,23 +192,16 @@ const createThemeAlias = (design, presets) => {
|
||||||
return p_acc;
|
return p_acc;
|
||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
const otherAlias = presets?.reduce((p_acc, p_name) => {
|
const mainAlias = presets?.reduce((p_acc, p_name) => {
|
||||||
p_acc = {
|
p_acc = {
|
||||||
...p_acc,
|
...p_acc,
|
||||||
[`primevue/themes/${design}/presets/${p_name}`]: path.resolve(__dirname, `./components/lib/themes/${design}/presets/${p_name}/index.js`),
|
[`primevue/themes/${p_name}`]: path.resolve(__dirname, `./components/lib/themes/${p_name}/index.js`)
|
||||||
[`primevue/themes/${design}/${p_name}`]: path.resolve(__dirname, `./components/lib/themes/${design}/${p_name}/index.js`)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return p_acc;
|
return p_acc;
|
||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
const coreAlias = {
|
return { ...presetAlias, ...mainAlias };
|
||||||
[`primevue/themes/${design}/base/global`]: path.resolve(__dirname, `./components/lib/themes/${design}/base/global/index.js`),
|
|
||||||
[`primevue/themes/${design}/base`]: path.resolve(__dirname, `./components/lib/themes/${design}/base/index.js`),
|
|
||||||
[`primevue/themes/${design}`]: path.resolve(__dirname, `./components/lib/themes/${design}/index.js`)
|
|
||||||
};
|
|
||||||
|
|
||||||
return { ...baseAlias, ...presetAlias, ...otherAlias, ...coreAlias };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const THEME_ALIAS = {
|
const THEME_ALIAS = {
|
||||||
|
@ -223,7 +210,7 @@ const THEME_ALIAS = {
|
||||||
'primevue/themes/service': path.resolve(__dirname, './components/lib/themes/service/index.js'),
|
'primevue/themes/service': path.resolve(__dirname, './components/lib/themes/service/index.js'),
|
||||||
'primevue/themes/helpers': path.resolve(__dirname, './components/lib/themes/helpers/index.js'),
|
'primevue/themes/helpers': path.resolve(__dirname, './components/lib/themes/helpers/index.js'),
|
||||||
'primevue/themes/actions': path.resolve(__dirname, './components/lib/themes/actions/index.js'),
|
'primevue/themes/actions': path.resolve(__dirname, './components/lib/themes/actions/index.js'),
|
||||||
...createThemeAlias('primeone', ['aura']),
|
...createThemeAlias(['aura']),
|
||||||
'primevue/themes': path.resolve(__dirname, './components/lib/themes/index.js')
|
'primevue/themes': path.resolve(__dirname, './components/lib/themes/index.js')
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -190,16 +190,10 @@ const CORE_STYLE_DEPENDENCIES = {
|
||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
const THEME_COMPONENTS = ['accordion','autocomplete','avatar','badge','blockui','breadcrumb','button','buttongroup','card','carousel','cascadeselect','checkbox','chip','colorpicker','confirmdialog','confirmpopup','contextmenu','datatable','dataview','datepicker','dialog','divider','dock','drawer','editor','fieldset','fileupload','floatlabel','galleria','iconfield','image','inlinemessage','inplace','inputchips','inputgroup','inputnumber','inputotp','toggleswitch','inputtext','knob','listbox','megamenu','menu','menubar','message','metergroup','multiselect','orderlist','organizationchart','overlaypanel','paginator','panel','panelmenu','password','picklist','popover','progressbar','progressspinner','radiobutton','rating','scrollpanel','scrolltop','select','selectbutton','skeleton','slider','speeddial','splitbutton','splitter','steps','stepper','tabmenu', 'tab', 'tabview','tag','terminal','textarea','tieredmenu','timeline','toast','togglebutton','toggleswitch','toolbar','tooltip','tree','treeselect','treetable'];
|
const THEME_COMPONENTS = ['accordion','autocomplete','avatar','badge','blockui','breadcrumb','button','buttongroup','card','carousel','cascadeselect','checkbox','chip','colorpicker','confirmdialog','confirmpopup','contextmenu','datatable','dataview','datepicker','dialog','divider','dock','drawer','editor','fieldset','fileupload','floatlabel','galleria','iconfield','image','inlinemessage','inplace','inputchips','inputgroup','inputnumber','inputotp','toggleswitch','inputtext','knob','listbox','megamenu','menu','menubar','message','metergroup','multiselect','orderlist','organizationchart','overlaypanel','paginator','panel','panelmenu','password','picklist','popover','progressbar','progressspinner','radiobutton','rating','scrollpanel','scrolltop','select','selectbutton','skeleton','slider','speeddial','splitbutton','splitter','steps','stepper','tabmenu', 'tab', 'tabview','tag','terminal','textarea','tieredmenu','timeline','toast','togglebutton','toggleswitch','toolbar','tooltip','tree','treeselect','treetable'];
|
||||||
|
|
||||||
const createThemeDependencies = (design, presets) => {
|
const createThemeDependencies = (presets) => {
|
||||||
const baseDeps = THEME_COMPONENTS.reduce((acc, name) => {
|
|
||||||
acc[`primevue/themes/${design}/base/${name}`] = `primevue.themes.${design}.base.${name}`;
|
|
||||||
|
|
||||||
return acc;
|
|
||||||
}, {});
|
|
||||||
|
|
||||||
const presetDeps = presets?.reduce((p_acc, p_name) => {
|
const presetDeps = presets?.reduce((p_acc, p_name) => {
|
||||||
const p_alias = THEME_COMPONENTS.reduce((acc, name) => {
|
const p_alias = THEME_COMPONENTS.reduce((acc, name) => {
|
||||||
acc[`primevue/themes/${design}/presets/${p_name}/${name}`] = `primevue.themes.${design}.presets.${p_name}.${name}`;
|
acc[`primevue/themes/${p_name}/${name}`] = `primevue.themes.${p_name}.${name}`;
|
||||||
|
|
||||||
return acc;
|
return acc;
|
||||||
}, {});
|
}, {});
|
||||||
|
@ -209,32 +203,25 @@ const createThemeDependencies = (design, presets) => {
|
||||||
return p_acc;
|
return p_acc;
|
||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
const otherDeps = presets?.reduce((p_acc, p_name) => {
|
const mainDeps = presets?.reduce((p_acc, p_name) => {
|
||||||
p_acc = {
|
p_acc = {
|
||||||
...p_acc,
|
...p_acc,
|
||||||
[`primevue/themes/${design}/presets/${p_name}`]: `primevue.themes.${design}.presets.${p_name}`,
|
[`primevue/themes/${p_name}`]: `primevue.themes.${p_name}`
|
||||||
[`primevue/themes/${design}/${p_name}`]: `primevue.themes.${design}.${p_name}`
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return p_acc;
|
return p_acc;
|
||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
const coreDeps = {
|
return { ...presetDeps, ...mainDeps };
|
||||||
[`primevue/themes/${design}/base/global`]: `primevue.themes.${design}.base.global`,
|
|
||||||
[`primevue/themes/${design}/base`]: `primevue.themes.${design}.base`,
|
|
||||||
[`primevue/themes/${design}`]: `primevue.themes.${design}`
|
|
||||||
};
|
|
||||||
|
|
||||||
return { ...baseDeps, ...presetDeps, ...otherDeps, ...coreDeps };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const CORE_THEME_DEPENDENCIES = {
|
const CORE_THEME_DEPENDENCIES = {
|
||||||
...createThemeDependencies('primeone', ['aura']),
|
|
||||||
'primevue/themes/actions': 'primevue.themes.actions',
|
'primevue/themes/actions': 'primevue.themes.actions',
|
||||||
'primevue/themes/config': 'primevue.themes.config',
|
'primevue/themes/config': 'primevue.themes.config',
|
||||||
'primevue/themes/helpers': 'primevue.themes.helpers',
|
'primevue/themes/helpers': 'primevue.themes.helpers',
|
||||||
'primevue/themes/service': 'primevue.themes.service',
|
'primevue/themes/service': 'primevue.themes.service',
|
||||||
'primevue/themes/utils': 'primevue.themes.utils',
|
'primevue/themes/utils': 'primevue.themes.utils',
|
||||||
|
...createThemeDependencies(['aura']),
|
||||||
'primevue/themes': 'primevue.themes'
|
'primevue/themes': 'primevue.themes'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -596,6 +583,9 @@ function addPackageJson() {
|
||||||
"tags": "./vetur-tags.json",
|
"tags": "./vetur-tags.json",
|
||||||
"attributes": "./vetur-attributes.json"
|
"attributes": "./vetur-attributes.json"
|
||||||
},
|
},
|
||||||
|
"sideEffects": [
|
||||||
|
"*.vue"
|
||||||
|
],
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"vue": "^3.0.0"
|
"vue": "^3.0.0"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import { definePreset } from 'primevue/themes';
|
import { definePreset } from 'primevue/themes';
|
||||||
import PrimeOne from 'primevue/themes/primeone';
|
import Aura from 'primevue/themes/aura';
|
||||||
import Aura from 'primevue/themes/primeone/aura';
|
|
||||||
|
|
||||||
const Noir = definePreset(Aura, {
|
const Noir = definePreset(Aura, {
|
||||||
semantic: {
|
semantic: {
|
||||||
|
@ -51,7 +50,6 @@ const Noir = definePreset(Aura, {
|
||||||
});
|
});
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
base: PrimeOne,
|
|
||||||
preset: Noir,
|
preset: Noir,
|
||||||
options: {
|
options: {
|
||||||
darkModeSelector: '.p-dark'
|
darkModeSelector: '.p-dark'
|
||||||
|
|
Loading…
Reference in New Issue