neo.mjs 5.18.0 → 6.0.1
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/apps/ServiceWorker.mjs +2 -2
- package/buildScripts/buildThemes.mjs +89 -192
- package/buildScripts/createClass.mjs +13 -11
- package/buildScripts/watchThemes.mjs +41 -83
- package/examples/ServiceWorker.mjs +2 -2
- package/examples/fieldWithPrefix/MainContainer.mjs +151 -0
- package/examples/fieldWithPrefix/app.mjs +6 -0
- package/examples/fieldWithPrefix/index.html +11 -0
- package/examples/fieldWithPrefix/neo-config.json +7 -0
- package/examples/form/field/fileupload/MainContainer.mjs +1 -1
- package/examples/form/field/fileupload/server.mjs +2 -2
- package/package.json +2 -2
- package/resources/scss/src/Global.scss +7 -7
- package/resources/scss/src/apps/covid/HeaderContainer.scss +25 -25
- package/resources/scss/src/apps/covid/country/Gallery.scss +6 -6
- package/resources/scss/src/apps/covid/country/Helix.scss +8 -8
- package/resources/scss/src/apps/covid/country/LineChartComponent.scss +2 -2
- package/resources/scss/src/apps/docs/ContentTabContainer.scss +3 -3
- package/resources/scss/src/apps/docs/HeaderContainer.scss +8 -8
- package/resources/scss/src/apps/docs/MainContainer.scss +1 -1
- package/resources/scss/src/apps/docs/classdetails/HeaderComponent.scss +1 -1
- package/resources/scss/src/apps/docs/classdetails/MembersList.scss +16 -16
- package/resources/scss/src/apps/docs/classdetails/TutorialComponent.scss +3 -3
- package/resources/scss/src/apps/website/HeaderContainer.scss +9 -9
- package/resources/scss/src/apps/website/MainContainer.scss +3 -3
- package/resources/scss/src/apps/website/blog/Container.scss +3 -3
- package/resources/scss/src/apps/website/blog/List.scss +8 -8
- package/resources/scss/src/apps/website/examples/List.scss +7 -7
- package/resources/scss/src/apps/website/home/TabContainer.scss +5 -5
- package/resources/scss/src/button/Base.scss +101 -101
- package/resources/scss/src/button/Split.scss +3 -3
- package/resources/scss/src/calendar/view/EditEventContainer.scss +4 -4
- package/resources/scss/src/calendar/view/MainContainer.scss +46 -46
- package/resources/scss/src/calendar/view/SettingsContainer.scss +3 -3
- package/resources/scss/src/calendar/view/YearComponent.scss +13 -13
- package/resources/scss/src/calendar/view/calendars/EditContainer.scss +4 -4
- package/resources/scss/src/calendar/view/calendars/List.scss +7 -7
- package/resources/scss/src/calendar/view/month/Component.scss +15 -13
- package/resources/scss/src/calendar/view/week/Component.scss +12 -12
- package/resources/scss/src/calendar/view/week/TimeAxisComponent.scss +4 -4
- package/resources/scss/src/component/BoxLabel.scss +5 -5
- package/resources/scss/src/component/Chip.scss +13 -13
- package/resources/scss/src/component/Circle.scss +2 -2
- package/resources/scss/src/component/DateSelector.scss +28 -28
- package/resources/scss/src/component/Helix.scss +1 -1
- package/resources/scss/src/component/Process.scss +17 -17
- package/resources/scss/src/component/Progress.scss +2 -2
- package/resources/scss/src/component/Splitter.scss +6 -6
- package/resources/scss/src/component/StatusBadge.scss +21 -21
- package/resources/scss/src/component/Timer.scss +9 -9
- package/resources/scss/src/component/Toast.scss +10 -10
- package/resources/scss/src/component/Video.scss +5 -5
- package/resources/scss/src/container/Accordion.scss +3 -3
- package/resources/scss/src/container/AccordionItem.scss +15 -15
- package/resources/scss/src/container/Base.scss +3 -3
- package/resources/scss/src/container/Panel.scss +4 -4
- package/resources/scss/src/container/Viewport.scss +2 -2
- package/resources/scss/src/dialog/Base.scss +8 -8
- package/resources/scss/src/draggable/list/DragZone.scss +2 -2
- package/resources/scss/src/examples/ConfigurationPanel.scss +3 -3
- package/resources/scss/src/examples/calendar/basic/MainContainer.scss +2 -2
- package/resources/scss/src/examples/fieldWithPrefix/MainContainer.scss +25 -0
- package/resources/scss/src/examples/treeSelectionModel/MainContainer.scss +6 -6
- package/resources/scss/src/form/Fieldset.scss +4 -4
- package/resources/scss/src/form/field/CheckBox.scss +10 -10
- package/resources/scss/src/form/field/FileUpload.scss +25 -12
- package/resources/scss/src/form/field/Number.scss +5 -5
- package/resources/scss/src/form/field/Picker.scss +3 -3
- package/resources/scss/src/form/field/Range.scss +5 -5
- package/resources/scss/src/form/field/Search.scss +1 -1
- package/resources/scss/src/form/field/Select.scss +8 -8
- package/resources/scss/src/form/field/Switch.scss +6 -6
- package/resources/scss/src/form/field/Text.scss +78 -78
- package/resources/scss/src/form/field/TextArea.scss +1 -1
- package/resources/scss/src/form/field/trigger/Base.scss +6 -6
- package/resources/scss/src/form/field/trigger/Clear.scss +2 -2
- package/resources/scss/src/form/field/trigger/CopyToClipboard.scss +3 -3
- package/resources/scss/src/form/field/trigger/Time.scss +5 -5
- package/resources/scss/src/grid/Container.scss +6 -6
- package/resources/scss/src/grid/View.scss +11 -11
- package/resources/scss/src/grid/header/Button.scss +5 -5
- package/resources/scss/src/grid/header/Toolbar.scss +2 -2
- package/resources/scss/src/list/Base.scss +11 -11
- package/resources/scss/src/list/Chip.scss +3 -3
- package/resources/scss/src/list/Circle.scss +2 -2
- package/resources/scss/src/menu/List.scss +21 -21
- package/resources/scss/src/menu/Panel.scss +1 -1
- package/resources/scss/src/plugin/PrefixField.scss +5 -0
- package/resources/scss/src/sitemap/Component.scss +2 -2
- package/resources/scss/src/tab/Container.scss +1 -1
- package/resources/scss/src/tab/Strip.scss +7 -7
- package/resources/scss/src/tab/header/Button.scss +26 -26
- package/resources/scss/src/tab/header/Toolbar.scss +18 -18
- package/resources/scss/src/table/Container.scss +16 -16
- package/resources/scss/src/table/View.scss +11 -11
- package/resources/scss/src/table/header/Button.scss +5 -5
- package/resources/scss/src/toolbar/Base.scss +20 -20
- package/resources/scss/src/toolbar/Breadcrumb.scss +1 -1
- package/resources/scss/src/tree/List.scss +5 -5
- package/resources/scss/theme-dark/Global.scss +7 -17
- package/resources/scss/theme-dark/apps/covid/HeaderContainer.scss +10 -23
- package/resources/scss/theme-dark/apps/covid/country/Gallery.scss +7 -17
- package/resources/scss/theme-dark/apps/covid/country/Helix.scss +8 -19
- package/resources/scss/theme-dark/apps/covid/country/LineChartComponent.scss +3 -9
- package/resources/scss/theme-dark/apps/docs/ContentTabContainer.scss +4 -11
- package/resources/scss/theme-dark/apps/docs/HeaderContainer.scss +10 -23
- package/resources/scss/theme-dark/apps/docs/MainContainer.scss +3 -9
- package/resources/scss/theme-dark/apps/docs/classdetails/HeaderComponent.scss +4 -11
- package/resources/scss/theme-dark/apps/docs/classdetails/MembersList.scss +17 -37
- package/resources/scss/theme-dark/apps/docs/classdetails/TutorialComponent.scss +4 -11
- package/resources/scss/theme-dark/apps/website/HeaderContainer.scss +5 -13
- package/resources/scss/theme-dark/apps/website/MainContainer.scss +4 -11
- package/resources/scss/theme-dark/apps/website/blog/Container.scss +3 -9
- package/resources/scss/theme-dark/apps/website/home/TabContainer.scss +4 -11
- package/resources/scss/theme-dark/button/Base.scss +108 -219
- package/resources/scss/theme-dark/calendar/view/EditEventContainer.scss +4 -12
- package/resources/scss/theme-dark/calendar/view/MainContainer.scss +22 -48
- package/resources/scss/theme-dark/calendar/view/SettingsContainer.scss +4 -11
- package/resources/scss/theme-dark/calendar/view/YearComponent.scss +10 -23
- package/resources/scss/theme-dark/calendar/view/calendars/EditContainer.scss +4 -12
- package/resources/scss/theme-dark/calendar/view/calendars/List.scss +2 -8
- package/resources/scss/theme-dark/calendar/view/month/Component.scss +9 -22
- package/resources/scss/theme-dark/calendar/view/week/Component.scss +12 -28
- package/resources/scss/theme-dark/component/BoxLabel.scss +5 -13
- package/resources/scss/theme-dark/component/Chip.scss +14 -31
- package/resources/scss/theme-dark/component/DateSelector.scss +24 -52
- package/resources/scss/theme-dark/component/Process.scss +9 -21
- package/resources/scss/theme-dark/component/Progress.scss +3 -9
- package/resources/scss/theme-dark/component/Splitter.scss +4 -12
- package/resources/scss/theme-dark/component/StatusBadge.scss +19 -41
- package/resources/scss/theme-dark/component/Timer.scss +4 -13
- package/resources/scss/theme-dark/component/Toast.scss +8 -20
- package/resources/scss/theme-dark/component/Video.scss +3 -10
- package/resources/scss/theme-dark/container/Accordion.scss +5 -13
- package/resources/scss/theme-dark/container/AccordionItem.scss +10 -23
- package/resources/scss/theme-dark/container/Base.scss +4 -11
- package/resources/scss/theme-dark/container/Panel.scss +5 -13
- package/resources/scss/theme-dark/container/Viewport.scss +3 -9
- package/resources/scss/theme-dark/dialog/Base.scss +5 -13
- package/resources/scss/theme-dark/examples/ConfigurationPanel.scss +3 -9
- package/resources/scss/theme-dark/examples/calendar/basic/MainContainer.scss +3 -10
- package/resources/scss/theme-dark/form/Fieldset.scss +5 -14
- package/resources/scss/theme-dark/form/field/CheckBox.scss +7 -18
- package/resources/scss/theme-dark/form/field/FileUpload.scss +11 -26
- package/resources/scss/theme-dark/form/field/Picker.scss +5 -13
- package/resources/scss/theme-dark/form/field/Range.scss +4 -11
- package/resources/scss/theme-dark/form/field/Search.scss +3 -9
- package/resources/scss/theme-dark/form/field/Select.scss +8 -20
- package/resources/scss/theme-dark/form/field/Switch.scss +6 -16
- package/resources/scss/theme-dark/form/field/Text.scss +31 -66
- package/resources/scss/theme-dark/form/field/trigger/Base.scss +5 -14
- package/resources/scss/theme-dark/form/field/trigger/Time.scss +3 -10
- package/resources/scss/theme-dark/grid/Container.scss +6 -16
- package/resources/scss/theme-dark/grid/View.scss +12 -28
- package/resources/scss/theme-dark/grid/header/Button.scss +5 -14
- package/resources/scss/theme-dark/list/Base.scss +11 -26
- package/resources/scss/theme-dark/menu/List.scss +20 -44
- package/resources/scss/theme-dark/menu/Panel.scss +2 -8
- package/resources/scss/theme-dark/tab/Container.scss +3 -9
- package/resources/scss/theme-dark/tab/Strip.scss +5 -13
- package/resources/scss/theme-dark/tab/header/Button.scss +29 -62
- package/resources/scss/theme-dark/table/Container.scss +9 -22
- package/resources/scss/theme-dark/table/View.scss +13 -29
- package/resources/scss/theme-dark/table/header/Button.scss +6 -16
- package/resources/scss/theme-dark/toolbar/Base.scss +4 -11
- package/resources/scss/theme-dark/tree/List.scss +4 -11
- package/resources/scss/theme-light/Global.scss +7 -17
- package/resources/scss/theme-light/apps/covid/HeaderContainer.scss +10 -23
- package/resources/scss/theme-light/apps/covid/country/Gallery.scss +7 -17
- package/resources/scss/theme-light/apps/covid/country/Helix.scss +8 -19
- package/resources/scss/theme-light/apps/covid/country/LineChartComponent.scss +3 -9
- package/resources/scss/theme-light/apps/docs/ContentTabContainer.scss +4 -11
- package/resources/scss/theme-light/apps/docs/HeaderContainer.scss +10 -23
- package/resources/scss/theme-light/apps/docs/MainContainer.scss +3 -9
- package/resources/scss/theme-light/apps/docs/classdetails/HeaderComponent.scss +4 -11
- package/resources/scss/theme-light/apps/docs/classdetails/MembersList.scss +17 -37
- package/resources/scss/theme-light/apps/docs/classdetails/TutorialComponent.scss +4 -11
- package/resources/scss/theme-light/apps/website/HeaderContainer.scss +5 -13
- package/resources/scss/theme-light/apps/website/MainContainer.scss +4 -11
- package/resources/scss/theme-light/apps/website/blog/Container.scss +3 -9
- package/resources/scss/theme-light/apps/website/home/TabContainer.scss +4 -11
- package/resources/scss/theme-light/button/Base.scss +107 -218
- package/resources/scss/theme-light/calendar/view/EditEventContainer.scss +4 -12
- package/resources/scss/theme-light/calendar/view/MainContainer.scss +22 -48
- package/resources/scss/theme-light/calendar/view/SettingsContainer.scss +3 -11
- package/resources/scss/theme-light/calendar/view/YearComponent.scss +10 -23
- package/resources/scss/theme-light/calendar/view/calendars/EditContainer.scss +4 -12
- package/resources/scss/theme-light/calendar/view/calendars/List.scss +2 -8
- package/resources/scss/theme-light/calendar/view/month/Component.scss +10 -23
- package/resources/scss/theme-light/calendar/view/week/Component.scss +12 -28
- package/resources/scss/theme-light/component/BoxLabel.scss +5 -13
- package/resources/scss/theme-light/component/Chip.scss +14 -31
- package/resources/scss/theme-light/component/DateSelector.scss +24 -52
- package/resources/scss/theme-light/component/Process.scss +9 -21
- package/resources/scss/theme-light/component/Progress.scss +3 -9
- package/resources/scss/theme-light/component/Splitter.scss +4 -12
- package/resources/scss/theme-light/component/StatusBadge.scss +19 -41
- package/resources/scss/theme-light/component/Timer.scss +5 -14
- package/resources/scss/theme-light/component/Toast.scss +8 -20
- package/resources/scss/theme-light/component/Video.scss +3 -10
- package/resources/scss/theme-light/container/Accordion.scss +5 -13
- package/resources/scss/theme-light/container/AccordionItem.scss +10 -23
- package/resources/scss/theme-light/container/Base.scss +4 -11
- package/resources/scss/theme-light/container/Panel.scss +5 -13
- package/resources/scss/theme-light/container/Viewport.scss +3 -9
- package/resources/scss/theme-light/dialog/Base.scss +5 -13
- package/resources/scss/theme-light/examples/ConfigurationPanel.scss +3 -9
- package/resources/scss/theme-light/examples/calendar/basic/MainContainer.scss +3 -10
- package/resources/scss/theme-light/form/Fieldset.scss +5 -14
- package/resources/scss/theme-light/form/field/CheckBox.scss +7 -18
- package/resources/scss/theme-light/form/field/FileUpload.scss +11 -26
- package/resources/scss/theme-light/form/field/Picker.scss +5 -13
- package/resources/scss/theme-light/form/field/Range.scss +4 -11
- package/resources/scss/theme-light/form/field/Search.scss +3 -9
- package/resources/scss/theme-light/form/field/Select.scss +9 -21
- package/resources/scss/theme-light/form/field/Switch.scss +6 -16
- package/resources/scss/theme-light/form/field/Text.scss +31 -66
- package/resources/scss/theme-light/form/field/trigger/Base.scss +5 -14
- package/resources/scss/theme-light/form/field/trigger/Time.scss +3 -10
- package/resources/scss/theme-light/grid/Container.scss +6 -16
- package/resources/scss/theme-light/grid/View.scss +12 -28
- package/resources/scss/theme-light/grid/header/Button.scss +5 -14
- package/resources/scss/theme-light/list/Base.scss +12 -27
- package/resources/scss/theme-light/menu/List.scss +20 -44
- package/resources/scss/theme-light/menu/Panel.scss +2 -8
- package/resources/scss/theme-light/tab/Container.scss +3 -9
- package/resources/scss/theme-light/tab/Strip.scss +5 -13
- package/resources/scss/theme-light/tab/header/Button.scss +29 -62
- package/resources/scss/theme-light/table/Container.scss +9 -22
- package/resources/scss/theme-light/table/View.scss +13 -29
- package/resources/scss/theme-light/table/header/Button.scss +6 -16
- package/resources/scss/theme-light/toolbar/Base.scss +4 -11
- package/resources/scss/theme-light/tree/List.scss +4 -11
- package/src/DefaultConfig.mjs +2 -2
- package/src/component/Splitter.mjs +0 -1
- package/src/draggable/tab/header/toolbar/SortZone.mjs +3 -3
- package/src/form/field/FileUpload.mjs +32 -5
- package/src/form/field/Text.mjs +1 -1
- package/src/main/DomAccess.mjs +2 -2
- package/src/main/DomEvents.mjs +50 -12
- package/src/manager/DomEvent.mjs +1 -0
- package/src/plugin/PrefixField.mjs +304 -0
- package/src/tab/header/Toolbar.mjs +8 -8
- package/resources/scss/mixins/_all.scss +0 -31
- package/resources/scss/theme-dark/_all.scss +0 -15
- package/resources/scss/theme-dark/apps/_all.scss +0 -3
- package/resources/scss/theme-dark/apps/covid/_all.scss +0 -4
- package/resources/scss/theme-dark/apps/docs/ExamplesTreeList.scss +0 -0
- package/resources/scss/theme-dark/apps/docs/TutorialsTreeList.scss +0 -0
- package/resources/scss/theme-dark/apps/docs/_all.scss +0 -6
- package/resources/scss/theme-dark/apps/docs/classdetails/HierarchyTreeList.scss +0 -0
- package/resources/scss/theme-dark/apps/docs/classdetails/MainContainer.scss +0 -0
- package/resources/scss/theme-dark/apps/docs/classdetails/_all.scss +0 -5
- package/resources/scss/theme-dark/apps/website/_all.scss +0 -4
- package/resources/scss/theme-dark/button/_all.scss +0 -1
- package/resources/scss/theme-dark/calendar/_all.scss +0 -8
- package/resources/scss/theme-dark/component/Circle.scss +0 -0
- package/resources/scss/theme-dark/component/_all.scss +0 -5
- package/resources/scss/theme-dark/container/_all.scss +0 -3
- package/resources/scss/theme-dark/dialog/_all.scss +0 -1
- package/resources/scss/theme-dark/examples/_all.scss +0 -2
- package/resources/scss/theme-dark/form/_all.scss +0 -9
- package/resources/scss/theme-dark/form/field/trigger/Clear.scss +0 -0
- package/resources/scss/theme-dark/form/field/trigger/_all.scss +0 -3
- package/resources/scss/theme-dark/grid/_all.scss +0 -3
- package/resources/scss/theme-dark/grid/header/Toolbar.scss +0 -0
- package/resources/scss/theme-dark/grid/header/_all.scss +0 -2
- package/resources/scss/theme-dark/list/_all.scss +0 -1
- package/resources/scss/theme-dark/menu/_all.scss +0 -2
- package/resources/scss/theme-dark/tab/_all.scss +0 -3
- package/resources/scss/theme-dark/table/_all.scss +0 -3
- package/resources/scss/theme-dark/table/header/Toolbar.scss +0 -0
- package/resources/scss/theme-dark/table/header/_all.scss +0 -2
- package/resources/scss/theme-dark/tree/_all.scss +0 -1
- package/resources/scss/theme-light/_all.scss +0 -15
- package/resources/scss/theme-light/apps/_all.scss +0 -3
- package/resources/scss/theme-light/apps/covid/_all.scss +0 -4
- package/resources/scss/theme-light/apps/docs/ExamplesTreeList.scss +0 -0
- package/resources/scss/theme-light/apps/docs/TutorialsTreeList.scss +0 -0
- package/resources/scss/theme-light/apps/docs/_all.scss +0 -6
- package/resources/scss/theme-light/apps/docs/classdetails/HierarchyTreeList.scss +0 -0
- package/resources/scss/theme-light/apps/docs/classdetails/MainContainer.scss +0 -0
- package/resources/scss/theme-light/apps/docs/classdetails/_all.scss +0 -5
- package/resources/scss/theme-light/apps/website/_all.scss +0 -4
- package/resources/scss/theme-light/button/_all.scss +0 -1
- package/resources/scss/theme-light/calendar/_all.scss +0 -8
- package/resources/scss/theme-light/component/Circle.scss +0 -0
- package/resources/scss/theme-light/component/_all.scss +0 -5
- package/resources/scss/theme-light/container/_all.scss +0 -3
- package/resources/scss/theme-light/dialog/_all.scss +0 -1
- package/resources/scss/theme-light/examples/_all.scss +0 -2
- package/resources/scss/theme-light/form/_all.scss +0 -9
- package/resources/scss/theme-light/form/field/trigger/Clear.scss +0 -0
- package/resources/scss/theme-light/form/field/trigger/_all.scss +0 -3
- package/resources/scss/theme-light/grid/_all.scss +0 -3
- package/resources/scss/theme-light/grid/header/Toolbar.scss +0 -0
- package/resources/scss/theme-light/grid/header/_all.scss +0 -2
- package/resources/scss/theme-light/list/_all.scss +0 -1
- package/resources/scss/theme-light/menu/_all.scss +0 -2
- package/resources/scss/theme-light/tab/_all.scss +0 -3
- package/resources/scss/theme-light/table/_all.scss +0 -3
- package/resources/scss/theme-light/table/header/Toolbar.scss +0 -0
- package/resources/scss/theme-light/table/header/_all.scss +0 -2
- package/resources/scss/theme-light/tree/_all.scss +0 -1
package/apps/ServiceWorker.mjs
CHANGED
@@ -9,23 +9,20 @@ import path from 'path';
|
|
9
9
|
import postcss from 'postcss';
|
10
10
|
import * as sass from 'sass';
|
11
11
|
|
12
|
-
const
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
themeMapFileNoVars = 'resources/theme-map-no-vars.json',
|
27
|
-
themeFolders = [],
|
28
|
-
questions = [];
|
12
|
+
const
|
13
|
+
__dirname = path.resolve(),
|
14
|
+
cwd = process.cwd(),
|
15
|
+
requireJson = path => JSON.parse(fs.readFileSync((path))),
|
16
|
+
packageJson = requireJson(path.resolve(cwd, 'package.json')),
|
17
|
+
insideNeo = packageJson.name === 'neo.mjs',
|
18
|
+
neoPath = path.resolve(insideNeo ? './' : './node_modules/neo.mjs/'),
|
19
|
+
programName = `${packageJson.name} buildThemes`,
|
20
|
+
program = new Command(),
|
21
|
+
scssPath = 'resources/scss/',
|
22
|
+
scssFolders = fs.readdirSync(path.resolve(scssPath)),
|
23
|
+
themeMapFile = 'resources/theme-map.json',
|
24
|
+
themeFolders = [],
|
25
|
+
questions = [];
|
29
26
|
|
30
27
|
scssFolders.forEach(folder => {
|
31
28
|
if (folder.includes('theme')) {
|
@@ -37,7 +34,6 @@ program
|
|
37
34
|
.name(programName)
|
38
35
|
.version(packageJson.version)
|
39
36
|
.option('-i, --info', 'print environment debug info')
|
40
|
-
.option('-c, --cssVars <value>', '"all", "true", "false"')
|
41
37
|
.option('-e, --env <value>', '"all", "dev", "prod"')
|
42
38
|
.option('-f, --framework')
|
43
39
|
.option('-n, --noquestions')
|
@@ -91,42 +87,29 @@ if (programOpts.info) {
|
|
91
87
|
default: 'all'
|
92
88
|
});
|
93
89
|
}
|
94
|
-
|
95
|
-
if (!programOpts.cssVars) {
|
96
|
-
questions.push({
|
97
|
-
type : 'list',
|
98
|
-
name : 'cssVars',
|
99
|
-
message: 'Build using CSS variables?',
|
100
|
-
choices: ['all', 'yes', 'no'],
|
101
|
-
default: 'yes'
|
102
|
-
});
|
103
|
-
}
|
104
90
|
}
|
105
91
|
|
106
92
|
inquirer.prompt(questions).then(answers => {
|
107
|
-
const
|
108
|
-
env = answers.env || programOpts.env || 'all',
|
93
|
+
const env = answers.env || programOpts.env || 'all',
|
109
94
|
themes = answers.themes || programOpts.themes || 'all',
|
110
95
|
insideNeo = programOpts.framework || false,
|
111
96
|
startDate = new Date(),
|
112
|
-
fileCount = {development:
|
113
|
-
totalFiles = {development:
|
114
|
-
sassThemes = [];
|
97
|
+
fileCount = {development: 0, production: 0},
|
98
|
+
totalFiles = {development: 0, production: 0};
|
115
99
|
|
116
|
-
let themeMap
|
100
|
+
let themeMap;
|
117
101
|
|
118
102
|
/**
|
119
103
|
* @param {Object} file
|
120
104
|
* @param {String} target
|
121
|
-
* @param {Boolean} useCssVars
|
122
105
|
*/
|
123
|
-
function addItemToThemeMap(file, target
|
106
|
+
function addItemToThemeMap(file, target) {
|
124
107
|
let classPath = file.className.split('.'),
|
125
108
|
fileName = classPath.pop(),
|
126
109
|
namespace;
|
127
110
|
|
128
111
|
classPath = classPath.join('.');
|
129
|
-
namespace = ns(classPath, true,
|
112
|
+
namespace = ns(classPath, true, themeMap);
|
130
113
|
|
131
114
|
if (!namespace[fileName]) {
|
132
115
|
namespace[fileName] = [target];
|
@@ -142,23 +125,13 @@ if (programOpts.info) {
|
|
142
125
|
* @param {String} mode development or production
|
143
126
|
*/
|
144
127
|
function buildEnv(p, mode) {
|
145
|
-
|
146
|
-
parseScssFiles(getAllScssFiles(path.join(p, 'src')), mode, 'src', true);
|
128
|
+
parseScssFiles(getAllScssFiles(path.join(p, 'src')), mode, 'src');
|
147
129
|
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
}
|
154
|
-
|
155
|
-
if (cssVars !== 'yes') {
|
156
|
-
themeFolders.forEach(themeFolder => {
|
157
|
-
if (themes === 'all' || themes === themeFolder) {
|
158
|
-
parseScssFiles(getAllScssFiles(path.join(p, 'src')), mode, themeFolder, false);
|
159
|
-
}
|
160
|
-
});
|
161
|
-
}
|
130
|
+
themeFolders.forEach(themeFolder => {
|
131
|
+
if (themes === 'all' || themes === themeFolder) {
|
132
|
+
parseScssFiles(getAllScssFiles(path.join(p, themeFolder)), mode, themeFolder);
|
133
|
+
}
|
134
|
+
});
|
162
135
|
}
|
163
136
|
|
164
137
|
/**
|
@@ -273,171 +246,95 @@ if (programOpts.info) {
|
|
273
246
|
* @param {Object[]} files
|
274
247
|
* @param {String} mode development or production
|
275
248
|
* @param {String} target src or a theme
|
276
|
-
* @param {Boolean} useCssVars
|
277
249
|
*/
|
278
|
-
function parseScssFiles(files, mode, target
|
279
|
-
let
|
280
|
-
|
281
|
-
mixinPath = path.resolve(neoPath, 'resources/scss/mixins/_all.scss'),
|
282
|
-
suffix = useCssVars ? '' : '-no-vars',
|
283
|
-
themeBuffer = '',
|
284
|
-
varsFlag = useCssVars ? 'vars' : 'noVars',
|
285
|
-
dirName, map, neoThemePath, themePath, workspaceThemePath;
|
286
|
-
|
287
|
-
totalFiles[mode][varsFlag] += files.length;
|
288
|
-
|
289
|
-
if (path.sep === '\\') {
|
290
|
-
mixinPath = mixinPath.replace(/\\/g, '/');
|
291
|
-
}
|
292
|
-
|
293
|
-
if (target.includes('theme')) {
|
294
|
-
themePath = `resources/scss/${target}/_all.scss`;
|
295
|
-
neoThemePath = path.resolve(neoPath, themePath);
|
296
|
-
|
297
|
-
if (!sassThemes[target]) {
|
298
|
-
dirName = path.dirname(neoThemePath);
|
299
|
-
|
300
|
-
if (fs.existsSync(dirName)) {
|
301
|
-
themeBuffer += scssCombine(fs.readFileSync(neoThemePath).toString(), dirName);
|
302
|
-
}
|
250
|
+
function parseScssFiles(files, mode, target) {
|
251
|
+
let devMode = mode === 'development',
|
252
|
+
map;
|
303
253
|
|
304
|
-
|
305
|
-
workspaceThemePath = path.resolve(cwd, themePath);
|
306
|
-
themeBuffer += scssCombine(fs.readFileSync(workspaceThemePath).toString(), path.dirname(workspaceThemePath));
|
307
|
-
}
|
308
|
-
|
309
|
-
themeBuffer = themeBuffer.replace(regexComments, '');
|
310
|
-
themeBuffer = themeBuffer.replace(regexLineBreak, '');
|
311
|
-
|
312
|
-
sassThemes[target] = themeBuffer;
|
313
|
-
}
|
314
|
-
|
315
|
-
data = [
|
316
|
-
`@use "sass:map";`,
|
317
|
-
`@use "sass:math";`,
|
318
|
-
`$neoMap: ();`,
|
319
|
-
`$useCssVars: ${useCssVars};`,
|
320
|
-
`@import "${mixinPath}";`,
|
321
|
-
`$useCssVars: false;`,
|
322
|
-
`${sassThemes[target]}`,
|
323
|
-
`$useCssVars: ${useCssVars};`
|
324
|
-
].join('');
|
325
|
-
} else {
|
326
|
-
data = [
|
327
|
-
`@use "sass:map";`,
|
328
|
-
`@use "sass:math";`,
|
329
|
-
`$neoMap: ();`,
|
330
|
-
`$useCssVars: ${useCssVars};`,
|
331
|
-
`@import "${mixinPath}";`
|
332
|
-
].join('');
|
333
|
-
}
|
254
|
+
totalFiles[mode] += files.length;
|
334
255
|
|
335
256
|
files.forEach(file => {
|
336
|
-
addItemToThemeMap(file, target
|
257
|
+
addItemToThemeMap(file, target);
|
337
258
|
|
338
|
-
let folderPath = path.resolve(cwd, `dist/${mode}/css
|
259
|
+
let folderPath = path.resolve(cwd, `dist/${mode}/css/${target}/${file.relativePath}`),
|
339
260
|
destPath = path.resolve(folderPath, `${file.name}.css`);
|
340
261
|
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
sourceMapEmbed: false
|
347
|
-
});
|
348
|
-
|
349
|
-
const plugins = [autoprefixer];
|
262
|
+
let result = sass.compile(file.path, {
|
263
|
+
outFile : destPath,
|
264
|
+
sourceMap : devMode,
|
265
|
+
sourceMapIncludeSources: true
|
266
|
+
});
|
350
267
|
|
351
|
-
|
352
|
-
plugins.push(cssnano);
|
353
|
-
}
|
268
|
+
const plugins = [autoprefixer];
|
354
269
|
|
355
|
-
|
270
|
+
if (mode === 'production') {
|
271
|
+
plugins.push(cssnano);
|
272
|
+
}
|
356
273
|
|
357
|
-
|
358
|
-
// https://github.com/neomjs/neo/issues/1970
|
359
|
-
map = JSON.parse(map);
|
360
|
-
let len = file.relativePath.split('/').length,
|
361
|
-
src = `${target}${file.relativePath}/${file.name}.scss`,
|
362
|
-
i = 0;
|
363
|
-
|
364
|
-
for (; i < len; i++) {
|
365
|
-
src = '../' + src;
|
366
|
-
}
|
274
|
+
map = result.sourceMap;
|
367
275
|
|
368
|
-
|
276
|
+
postcss(plugins).process(result.css, {
|
277
|
+
from: file.path,
|
278
|
+
to : destPath,
|
279
|
+
map : !devMode ? null : {
|
280
|
+
inline: false,
|
281
|
+
prev : map && JSON.stringify(map)
|
369
282
|
}
|
283
|
+
}).then(postcssResult => {
|
284
|
+
fs.mkdirpSync(folderPath);
|
285
|
+
fileCount[mode]++;
|
370
286
|
|
371
|
-
|
372
|
-
|
373
|
-
to : destPath,
|
374
|
-
map : !devMode ? null : {
|
375
|
-
prev: map && JSON.stringify(map)
|
376
|
-
}
|
377
|
-
}).then(result => {
|
378
|
-
fs.mkdirpSync(folderPath);
|
379
|
-
fileCount[mode][varsFlag]++;
|
380
|
-
|
381
|
-
const processTime = (Math.round((new Date - startDate) * 100) / 100000).toFixed(2);
|
382
|
-
console.log('Writing file:', (fileCount[mode].vars + fileCount[mode].noVars), chalk.blue(`${processTime}s`), destPath);
|
383
|
-
fs.writeFileSync(destPath, result.css, () => true);
|
287
|
+
let map = postcssResult.map,
|
288
|
+
processTime = (Math.round((new Date - startDate) * 100) / 100000).toFixed(2);
|
384
289
|
|
385
|
-
|
386
|
-
fs.writeFileSync(result.opts.to + '.map', result.map.toString());
|
387
|
-
}
|
290
|
+
console.log('Writing file:', (fileCount[mode] + fileCount[mode]), chalk.blue(`${processTime}s`), destPath);
|
388
291
|
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
292
|
+
fs.writeFileSync(
|
293
|
+
destPath,
|
294
|
+
map ?
|
295
|
+
`${postcssResult.css}\n\n/*# sourceMappingURL=${path.relative(path.dirname(destPath), postcssResult.opts.to + '.map')} */` :
|
296
|
+
postcssResult.css,
|
297
|
+
() => true
|
298
|
+
);
|
394
299
|
|
395
|
-
|
396
|
-
|
397
|
-
|
300
|
+
if (map) {
|
301
|
+
let mapString = map.toString(),
|
302
|
+
jsonMap = JSON.parse(mapString),
|
303
|
+
sources = jsonMap.sources;
|
304
|
+
|
305
|
+
// Somehow files contain both: a relative & an absolute file url
|
306
|
+
// We only want to keep the relative ones.
|
307
|
+
[...sources].forEach((item, index) => {
|
308
|
+
if (!item.startsWith('../')) {
|
309
|
+
sources.splice(index, 1);
|
310
|
+
}
|
311
|
+
});
|
398
312
|
|
399
|
-
|
400
|
-
path.join(cwd, '/dist/', mode, useCssVars ? themeMapFile : themeMapFileNoVars),
|
401
|
-
JSON.stringify(useCssVars ? themeMap : themeMapNoVars, null, 0)
|
402
|
-
);
|
403
|
-
}
|
404
|
-
});
|
405
|
-
});
|
406
|
-
});
|
407
|
-
}
|
313
|
+
map = JSON.stringify(jsonMap);
|
408
314
|
|
409
|
-
|
410
|
-
* @param {String} content
|
411
|
-
* @param {String} baseDir
|
412
|
-
* @returns {String}
|
413
|
-
*/
|
414
|
-
function scssCombine (content, baseDir) {
|
415
|
-
if (regexSassImport.test(content)) {
|
416
|
-
content = content.replace(regexSassImport, (m, capture) => {
|
417
|
-
if (!insideNeo && capture.startsWith('../')) {
|
418
|
-
capture = '../../' + capture;
|
315
|
+
fs.writeFileSync(postcssResult.opts.to + '.map', map);
|
419
316
|
}
|
420
317
|
|
421
|
-
|
422
|
-
|
318
|
+
if (fileCount[mode] === totalFiles[mode]) {
|
319
|
+
fs.writeFileSync(
|
320
|
+
path.resolve(cwd, themeMapFile),
|
321
|
+
JSON.stringify(themeMap, null, 0)
|
322
|
+
);
|
423
323
|
|
424
|
-
|
425
|
-
|
324
|
+
fs.mkdirpSync(path.join(cwd, '/dist/', mode, '/resources'), {
|
325
|
+
recursive: true
|
326
|
+
});
|
426
327
|
|
427
|
-
|
428
|
-
|
429
|
-
|
328
|
+
fs.writeFileSync(
|
329
|
+
path.join(cwd, '/dist/', mode, themeMapFile),
|
330
|
+
JSON.stringify(themeMap, null, 0)
|
331
|
+
);
|
430
332
|
}
|
431
|
-
|
432
|
-
return scssCombine(fs.readFileSync(file).toString(), path.dirname(file));
|
433
333
|
});
|
434
|
-
}
|
435
|
-
|
436
|
-
return content;
|
334
|
+
});
|
437
335
|
}
|
438
336
|
|
439
|
-
|
440
|
-
if (cssVars !== 'yes') {themeMapNoVars = getThemeMap(themeMapFileNoVars);}
|
337
|
+
themeMap = getThemeMap(themeMapFile);
|
441
338
|
|
442
339
|
// dist/development
|
443
340
|
if (env === 'all' || env === 'dev') {
|
@@ -676,20 +676,22 @@ if (programOpts.info) {
|
|
676
676
|
classContent.push(
|
677
677
|
" }",
|
678
678
|
"}",
|
679
|
-
"",
|
680
|
-
`Neo.applyClassConfig(${file});`,
|
681
679
|
""
|
682
680
|
);
|
683
681
|
|
684
|
-
isSingleton
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
682
|
+
if (isSingleton) {
|
683
|
+
classContent.push(
|
684
|
+
`let instance = Neo.applyClassConfig(${file});`,
|
685
|
+
"",
|
686
|
+
"export default instance;"
|
687
|
+
);
|
688
|
+
} else {
|
689
|
+
classContent.push(
|
690
|
+
`Neo.applyClassConfig(${file});`,
|
691
|
+
"",
|
692
|
+
`export default ${file};`
|
693
|
+
);
|
694
|
+
}
|
693
695
|
|
694
696
|
classContent.push(
|
695
697
|
""
|
@@ -5,13 +5,12 @@ import path from 'path';
|
|
5
5
|
import postcss from 'postcss';
|
6
6
|
import * as sass from 'sass';
|
7
7
|
|
8
|
-
let cwd
|
9
|
-
requireJson
|
10
|
-
packageJson
|
11
|
-
neoPath
|
12
|
-
mixinPath
|
13
|
-
|
14
|
-
scssPath = path.resolve(cwd, 'resources/scss');
|
8
|
+
let cwd = process.cwd(),
|
9
|
+
requireJson = path => JSON.parse(fs.readFileSync((path))),
|
10
|
+
packageJson = requireJson(path.resolve(cwd, 'package.json')),
|
11
|
+
neoPath = packageJson.name === 'neo.mjs' ? './' : './node_modules/neo.mjs/',
|
12
|
+
mixinPath = path.resolve(neoPath, 'resources/scss/mixins/_all.scss'),
|
13
|
+
scssPath = path.resolve(cwd, 'resources/scss');
|
15
14
|
|
16
15
|
if (path.sep === '\\') {
|
17
16
|
mixinPath = mixinPath.replace(/\\/g, '/');
|
@@ -35,93 +34,52 @@ function buildFile(filename) {
|
|
35
34
|
let filePath = path.join(scssPath, filename),
|
36
35
|
destPath = path.join(cwd, 'dist/development/css', filename.replace('.scss', '.css')),
|
37
36
|
startDate = new Date(),
|
38
|
-
|
37
|
+
map;
|
39
38
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
].join('');
|
47
|
-
|
48
|
-
fs.readFile(filePath).then(content => {
|
49
|
-
try {
|
50
|
-
let result = sass.renderSync({
|
51
|
-
data : data + scssCombine(content.toString(), path.parse(filePath).dir),
|
52
|
-
outFile : destPath,
|
53
|
-
sourceMap : true,
|
54
|
-
sourceMapEmbed: false
|
55
|
-
});
|
56
|
-
|
57
|
-
map = result.map?.toString();
|
58
|
-
|
59
|
-
if (map) {
|
60
|
-
// https://github.com/neomjs/neo/issues/1970
|
61
|
-
map = JSON.parse(map);
|
62
|
-
|
63
|
-
let filenameSlash = filename;
|
64
|
-
|
65
|
-
if (path.sep === '\\') {
|
66
|
-
filenameSlash = filenameSlash.replace(/\\/g, '/');
|
67
|
-
}
|
68
|
-
|
69
|
-
let len = filenameSlash.split('/').length,
|
70
|
-
src = `/scss/${filenameSlash}`,
|
71
|
-
i = 0;
|
39
|
+
try {
|
40
|
+
let result = sass.compile(filePath, {
|
41
|
+
outFile : destPath,
|
42
|
+
sourceMap : true,
|
43
|
+
sourceMapIncludeSources: true
|
44
|
+
});
|
72
45
|
|
73
|
-
|
74
|
-
src = '../' + src;
|
75
|
-
}
|
46
|
+
map = result.sourceMap;
|
76
47
|
|
77
|
-
|
48
|
+
postcss([autoprefixer]).process(result.css, {
|
49
|
+
from: filePath,
|
50
|
+
to : destPath,
|
51
|
+
map : {
|
52
|
+
inline: false,
|
53
|
+
prev : map && JSON.stringify(map)
|
78
54
|
}
|
55
|
+
}).then(postcssResult => {
|
56
|
+
map = postcssResult.map;
|
79
57
|
|
80
|
-
|
81
|
-
from: filePath,
|
82
|
-
to : destPath,
|
83
|
-
map : {
|
84
|
-
prev: map && JSON.stringify(map)
|
85
|
-
}
|
86
|
-
}).then(result => {
|
87
|
-
fs.writeFileSync(destPath, result.css, () => true);
|
88
|
-
|
89
|
-
if (result.map) {
|
90
|
-
fs.writeFileSync(result.opts.to + '.map', result.map.toString());
|
91
|
-
}
|
58
|
+
fs.writeFileSync(destPath, postcssResult.css, () => true);
|
92
59
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
console.log('SCSS build failed for', chalk.red(filename));
|
98
|
-
console.log(error);
|
99
|
-
}
|
100
|
-
});
|
101
|
-
}
|
60
|
+
if (map) {
|
61
|
+
let mapString = map.toString(),
|
62
|
+
jsonMap = JSON.parse(mapString),
|
63
|
+
sources = jsonMap.sources;
|
102
64
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
content = content.replace(regexSassImport, (m, capture) => {
|
111
|
-
let parse = path.parse(path.resolve(baseDir, capture)),
|
112
|
-
file = path.resolve(`${parse.dir}/${parse.name}.scss`);
|
65
|
+
// Somehow files contain both: a relative & an absolute file url
|
66
|
+
// We only want to keep the relative ones.
|
67
|
+
[...sources].forEach((item, index) => {
|
68
|
+
if (!item.startsWith('../')) {
|
69
|
+
sources.splice(index, 1);
|
70
|
+
}
|
71
|
+
});
|
113
72
|
|
114
|
-
|
115
|
-
file = path.resolve(`${parse.dir}/_${parse.name}.scss`);
|
73
|
+
map = JSON.stringify(jsonMap);
|
116
74
|
|
117
|
-
|
118
|
-
return '';
|
119
|
-
}
|
75
|
+
fs.writeFileSync(postcssResult.opts.to + '.map', map);
|
120
76
|
}
|
121
77
|
|
122
|
-
|
78
|
+
const processTime = (Math.round((new Date - startDate) * 100) / 100000).toFixed(2);
|
79
|
+
console.log('Updated file:', (chalk.blue(`${processTime}s`)), destPath);
|
123
80
|
});
|
81
|
+
} catch(error) {
|
82
|
+
console.log('SCSS build failed for', chalk.red(filename));
|
83
|
+
console.log(error);
|
124
84
|
}
|
125
|
-
|
126
|
-
return content;
|
127
85
|
}
|