neo.mjs 9.7.1 → 9.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ServiceWorker.mjs +2 -2
- package/apps/portal/index.html +1 -1
- package/apps/portal/resources/data/examples_dist_esm.json +136 -0
- package/apps/portal/view/examples/TabContainer.mjs +11 -2
- package/apps/portal/view/examples/TabContainerController.mjs +1 -1
- package/apps/portal/view/home/FooterContainer.mjs +1 -1
- package/buildScripts/buildESModules.mjs +63 -57
- package/package.json +1 -1
- package/src/DefaultConfig.mjs +2 -2
- package/src/main/DomAccess.mjs +1 -1
- package/src/main/addon/ServiceWorker.mjs +6 -1
package/ServiceWorker.mjs
CHANGED
package/apps/portal/index.html
CHANGED
@@ -0,0 +1,136 @@
|
|
1
|
+
[{
|
2
|
+
"id" : 21,
|
3
|
+
"environments": ["Desktop", "Mobile"],
|
4
|
+
"image" : "devmode/bigData.png",
|
5
|
+
"name" : "Buffered Data Grid with 5M cells",
|
6
|
+
"sourceUrl" : "examples/grid/bigData",
|
7
|
+
"url" : "dist/esm/examples/grid/bigData/index.html"
|
8
|
+
}, {
|
9
|
+
"id" : 20,
|
10
|
+
"image" : "devmode/sharedcovid.png",
|
11
|
+
"name" : "Multi Window Covid App",
|
12
|
+
"sharedWorkers": true,
|
13
|
+
"sourceUrl" : "apps/sharedcovid",
|
14
|
+
"url" : "dist/esm/apps/sharedcovid/index.html#mainview=table"
|
15
|
+
}, {
|
16
|
+
"id" : 19,
|
17
|
+
"image" : "devmode/calendar-preview.png",
|
18
|
+
"name" : "Calendar",
|
19
|
+
"sourceUrl": "src/calendar",
|
20
|
+
"url" : "dist/esm/examples/calendar/basic/index.html"
|
21
|
+
}, {
|
22
|
+
"id" : 18,
|
23
|
+
"image" : "devmode/helix.png",
|
24
|
+
"name" : "component.Helix",
|
25
|
+
"sourceUrl": "examples/component/helix",
|
26
|
+
"url" : "dist/esm/examples/component/helix/index.html"
|
27
|
+
}, {
|
28
|
+
"id" : 17,
|
29
|
+
"image" : "devmode/mwCoronaGallery.png",
|
30
|
+
"name" : "Multi Window Covid Gallery",
|
31
|
+
"sharedWorkers": true,
|
32
|
+
"sourceUrl" : "examples/component/multiWindowCoronaGallery",
|
33
|
+
"url" : "dist/esm/examples/component/multiWindowCoronaGallery/index.html"
|
34
|
+
}, {
|
35
|
+
"id" : 16,
|
36
|
+
"image" : "devmode/multi_window_dd.png",
|
37
|
+
"name" : "Multi-Window Drag&Drop",
|
38
|
+
"sharedWorkers": true,
|
39
|
+
"sourceUrl" : "apps/shareddialog",
|
40
|
+
"url" : "dist/esm/apps/shareddialog/index.html"
|
41
|
+
}, {
|
42
|
+
"id" : 15,
|
43
|
+
"image" : "devmode/tabContainer.png",
|
44
|
+
"name" : "tab.Container",
|
45
|
+
"sourceUrl": "examples/tab/container",
|
46
|
+
"url" : "dist/esm/examples/tab/container/index.html"
|
47
|
+
}, {
|
48
|
+
"id" : 14,
|
49
|
+
"image" : "devmode/model-component-example.png",
|
50
|
+
"name" : "State Provider Example",
|
51
|
+
"sourceUrl": "examples/stateProvider/advanced",
|
52
|
+
"url" : "dist/esm/examples/stateProvider/advanced/index.html"
|
53
|
+
}, {
|
54
|
+
"id" : 13,
|
55
|
+
"image" : "devmode/dragdrop.png",
|
56
|
+
"name" : "Dialog drag&drop",
|
57
|
+
"sourceUrl": "examples/dialog",
|
58
|
+
"url" : "dist/esm/examples/dialog/"
|
59
|
+
}, {
|
60
|
+
"id" : 12,
|
61
|
+
"image" : "dist_prod/colorsApp.png",
|
62
|
+
"name" : "Colors Dashboard",
|
63
|
+
"sharedWorkers": true,
|
64
|
+
"sourceUrl" : "apps/colors",
|
65
|
+
"url" : "dist/esm/apps/colors/index.html"
|
66
|
+
}, {
|
67
|
+
"id" : 11,
|
68
|
+
"image" : "devmode/covidDashboard.png",
|
69
|
+
"name" : "Covid Dashboard",
|
70
|
+
"sourceUrl": "apps/covid",
|
71
|
+
"url" : "dist/esm/apps/covid/index.html#mainview=table"
|
72
|
+
}, {
|
73
|
+
"id" : 10,
|
74
|
+
"image" : "devmode/coronaHelix.png",
|
75
|
+
"name" : "COVID-19 Helix",
|
76
|
+
"sourceUrl": "examples/component/coronaHelix",
|
77
|
+
"url" : "dist/esm/examples/component/coronaHelix/index.html"
|
78
|
+
}, {
|
79
|
+
"id" : 9,
|
80
|
+
"image" : "devmode/coronaGallery.png",
|
81
|
+
"name" : "COVID-19 Gallery",
|
82
|
+
"sourceUrl": "examples/component/coronaGallery",
|
83
|
+
"url" : "dist/esm/examples/component/coronaGallery/index.html"
|
84
|
+
}, {
|
85
|
+
"id" : 8,
|
86
|
+
"image" : "devmode/gallery.png",
|
87
|
+
"name" : "component.Gallery",
|
88
|
+
"sourceUrl": "examples/component/gallery",
|
89
|
+
"url" : "dist/esm/examples/component/gallery/index.html"
|
90
|
+
}, {
|
91
|
+
"id" : 7,
|
92
|
+
"image" : "devmode/tableFiltering.png",
|
93
|
+
"name" : "Table Filtering",
|
94
|
+
"sourceUrl": "examples/tableFiltering",
|
95
|
+
"url" : "dist/esm/examples/tableFiltering/"
|
96
|
+
}, {
|
97
|
+
"id" : 6,
|
98
|
+
"image" : "devmode/dateSelector.png",
|
99
|
+
"name" : "component.DateSelector",
|
100
|
+
"sourceUrl": "examples/component/dateSelector",
|
101
|
+
"url" : "dist/esm/examples/component/dateSelector/index.html"
|
102
|
+
}, {
|
103
|
+
"id" : 5,
|
104
|
+
"image" : "devmode/dateField.png",
|
105
|
+
"name" : "form.field.Date",
|
106
|
+
"sourceUrl": "examples/form/field/date",
|
107
|
+
"url" : "dist/esm/examples/form/field/date/index.html"
|
108
|
+
}, {
|
109
|
+
"id" : 4,
|
110
|
+
"image" : "devmode/selectField.png",
|
111
|
+
"name" : "form.field.ComboBox",
|
112
|
+
"sourceUrl": "examples/form/field/combobox",
|
113
|
+
"url" : "dist/esm/examples/form/field/combobox/index.html"
|
114
|
+
}, {
|
115
|
+
"id" : 3,
|
116
|
+
"environments" : ["Desktop", "Mobile"],
|
117
|
+
"image" : "dist_prod/portalApp.png",
|
118
|
+
"name" : "Portal App",
|
119
|
+
"sharedWorkers": true,
|
120
|
+
"sourceUrl" : "apps/portal",
|
121
|
+
"url" : "dist/esm/apps/portal/index.html"
|
122
|
+
}, {
|
123
|
+
"hidden" : true,
|
124
|
+
"id" : 2,
|
125
|
+
"image" : "devmode/realworldApp.png",
|
126
|
+
"name" : "RealWorld App",
|
127
|
+
"sourceUrl": "apps/realworld",
|
128
|
+
"url" : "dist/esm/apps/realworld/index.html"
|
129
|
+
}, {
|
130
|
+
"hidden" : true,
|
131
|
+
"id" : 1,
|
132
|
+
"image" : "devmode/realworldApp2.png",
|
133
|
+
"name" : "RealWorld App v2</br>(in progress)",
|
134
|
+
"sourceUrl": "apps/realworld2",
|
135
|
+
"url" : "dist/esm/apps/realworld2/index.html#/gallery"
|
136
|
+
}]
|
@@ -47,17 +47,26 @@ class TabContainer extends Container {
|
|
47
47
|
header : {
|
48
48
|
iconCls: 'fa fa-chess-knight',
|
49
49
|
route : '/examples/devmode',
|
50
|
-
text : '
|
50
|
+
text : 'Dev Mode'
|
51
51
|
}
|
52
52
|
}, {
|
53
53
|
environment: 'dist/development',
|
54
54
|
reference : 'examples-dist-dev-list',
|
55
55
|
store : {module: ExampleStore, url: '../../apps/portal/resources/data/examples_dist_dev.json'},
|
56
56
|
header : {
|
57
|
-
iconCls: 'fa fa-chess-
|
57
|
+
iconCls: 'fa fa-chess-bishop',
|
58
58
|
route : '/examples/dist_dev',
|
59
59
|
text : 'dist/dev'
|
60
60
|
}
|
61
|
+
}, {
|
62
|
+
environment: 'dist/production',
|
63
|
+
reference : 'examples-dist-esm-list',
|
64
|
+
store : {module: ExampleStore, url: '../../apps/portal/resources/data/examples_dist_esm.json'},
|
65
|
+
header : {
|
66
|
+
iconCls: 'fa fa-chess-queen',
|
67
|
+
route : '/examples/dist_esm',
|
68
|
+
text : 'dist/esm'
|
69
|
+
}
|
61
70
|
}, {
|
62
71
|
environment: 'dist/production',
|
63
72
|
reference : 'examples-dist-prod-list',
|
@@ -25,7 +25,7 @@ class TabContainerController extends Component {
|
|
25
25
|
* We need to store the current positions, since drag&drop resorting of tabs is enabled
|
26
26
|
* @member {String[]} tabItems
|
27
27
|
*/
|
28
|
-
tabItems = ['devmode', 'dist_dev', 'dist_prod']
|
28
|
+
tabItems = ['devmode', 'dist_dev', 'dist_esm', 'dist_prod']
|
29
29
|
|
30
30
|
/**
|
31
31
|
*
|
@@ -27,60 +27,7 @@ async function minifyDirectory(inputDir, outputDir) {
|
|
27
27
|
outputPath = path.join(outputDir, relativePath),
|
28
28
|
content = fs.readFileSync(inputPath, 'utf8');
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
try {
|
33
|
-
// Minify JSON files
|
34
|
-
if (dirent.name.endsWith('.json')) {
|
35
|
-
const jsonContent = JSON.parse(content);
|
36
|
-
|
37
|
-
if (dirent.name === 'neo-config.json') {
|
38
|
-
Object.assign(jsonContent, {
|
39
|
-
basePath : '../../' + jsonContent.basePath,
|
40
|
-
environment : 'dist/esm',
|
41
|
-
workerBasePath: jsonContent.basePath + 'src/worker/'
|
42
|
-
})
|
43
|
-
}
|
44
|
-
|
45
|
-
fs.writeFileSync(outputPath, JSON.stringify(jsonContent));
|
46
|
-
console.log(`Minified JSON: ${inputPath} -> ${outputPath}`);
|
47
|
-
}
|
48
|
-
// Minify HTML files
|
49
|
-
else if (dirent.name.endsWith('.html')) {
|
50
|
-
const minifiedContent = await minifyHtml(content);
|
51
|
-
|
52
|
-
fs.writeFileSync(outputPath, minifiedContent);
|
53
|
-
console.log(`Minified HTML: ${inputPath} -> ${outputPath}`);
|
54
|
-
}
|
55
|
-
// Minify JS files
|
56
|
-
else if (dirent.name.endsWith('.mjs')) {
|
57
|
-
let adjustedContent = content.replace(regexImport, (match, p1, p2, p3) => {
|
58
|
-
// p1 will be "import {marked} from " (or similar, including the 'import' keyword and everything up to the first quote)
|
59
|
-
// p2 will be the quote character (', ", or `)
|
60
|
-
// p3 will be the original path string (e.g., '../../../../node_modules/marked/lib/marked.esm.js')
|
61
|
-
|
62
|
-
const newPath = '../../' + p3; // Prepend 2 levels up
|
63
|
-
|
64
|
-
// Reconstruct the import statement with the new path
|
65
|
-
return p1 + p2 + newPath + p2;
|
66
|
-
});
|
67
|
-
|
68
|
-
const result = await minifyJs(adjustedContent, {
|
69
|
-
module: true,
|
70
|
-
compress: {
|
71
|
-
dead_code: true
|
72
|
-
},
|
73
|
-
mangle: {
|
74
|
-
toplevel: true
|
75
|
-
}
|
76
|
-
});
|
77
|
-
|
78
|
-
fs.writeFileSync(outputPath, result.code);
|
79
|
-
console.log(`Minified JS: ${inputPath} -> ${outputPath}`);
|
80
|
-
}
|
81
|
-
} catch (e) {
|
82
|
-
console.error(`Error minifying ${inputPath}:`, e);
|
83
|
-
}
|
30
|
+
await minifyFile(content, outputPath);
|
84
31
|
}
|
85
32
|
// Copy resources folders
|
86
33
|
else if (dirent.name === 'resources') {
|
@@ -112,19 +59,78 @@ async function minifyDirectory(inputDir, outputDir) {
|
|
112
59
|
}
|
113
60
|
}
|
114
61
|
|
115
|
-
|
62
|
+
async function minifyFile(content, outputPath) {
|
63
|
+
fs.mkdirSync(path.dirname(outputPath), {recursive: true});
|
64
|
+
|
65
|
+
try {
|
66
|
+
// Minify JSON files
|
67
|
+
if (outputPath.endsWith('.json')) {
|
68
|
+
const jsonContent = JSON.parse(content);
|
69
|
+
|
70
|
+
if (outputPath.endsWith('neo-config.json')) {
|
71
|
+
Object.assign(jsonContent, {
|
72
|
+
basePath : '../../' + jsonContent.basePath,
|
73
|
+
environment : 'dist/esm',
|
74
|
+
workerBasePath: jsonContent.basePath + 'src/worker/'
|
75
|
+
})
|
76
|
+
}
|
77
|
+
|
78
|
+
fs.writeFileSync(outputPath, JSON.stringify(jsonContent));
|
79
|
+
console.log(`Minified JSON: ${outputPath}`);
|
80
|
+
}
|
81
|
+
// Minify HTML files
|
82
|
+
else if (outputPath.endsWith('.html')) {
|
83
|
+
const minifiedContent = await minifyHtml(content);
|
84
|
+
|
85
|
+
fs.writeFileSync(outputPath, minifiedContent);
|
86
|
+
console.log(`Minified HTML: ${outputPath}`);
|
87
|
+
}
|
88
|
+
// Minify JS files
|
89
|
+
else if (outputPath.endsWith('.mjs')) {
|
90
|
+
let adjustedContent = content.replace(regexImport, (match, p1, p2, p3) => {
|
91
|
+
// p1 will be "import {marked} from " (or similar, including the 'import' keyword and everything up to the first quote)
|
92
|
+
// p2 will be the quote character (', ", or `)
|
93
|
+
// p3 will be the original path string (e.g., '../../../../node_modules/marked/lib/marked.esm.js')
|
94
|
+
|
95
|
+
const newPath = '../../' + p3; // Prepend 2 levels up
|
96
|
+
|
97
|
+
// Reconstruct the import statement with the new path
|
98
|
+
return p1 + p2 + newPath + p2;
|
99
|
+
});
|
100
|
+
|
101
|
+
const result = await minifyJs(adjustedContent, {
|
102
|
+
module: true,
|
103
|
+
compress: {
|
104
|
+
dead_code: true
|
105
|
+
},
|
106
|
+
mangle: {
|
107
|
+
toplevel: true
|
108
|
+
}
|
109
|
+
});
|
110
|
+
|
111
|
+
fs.writeFileSync(outputPath, result.code);
|
112
|
+
console.log(`Minified JS: ${outputPath}`);
|
113
|
+
}
|
114
|
+
} catch (e) {
|
115
|
+
console.error(`Error minifying ${outputPath}:`, e);
|
116
|
+
}
|
117
|
+
}
|
118
|
+
|
119
|
+
const
|
120
|
+
swContent = fs.readFileSync(path.resolve(__dirname, '../ServiceWorker.mjs'), 'utf8'),
|
121
|
+
promises = [minifyFile(swContent, path.resolve(__dirname, outputBasePath, 'ServiceWorker.mjs'))];
|
116
122
|
|
117
123
|
// Execute the minification
|
118
124
|
inputDirectories.forEach(folder => {
|
119
125
|
promises.push(minifyDirectory(path.resolve(__dirname, '../' + folder), path.resolve(__dirname, outputBasePath, folder))
|
120
126
|
.catch(err => {
|
121
|
-
console.error('Minification failed:', err);
|
127
|
+
console.error('dist/esm Minification failed:', err);
|
122
128
|
process.exit(1) // Exit with error code
|
123
129
|
})
|
124
130
|
);
|
125
131
|
});
|
126
132
|
|
127
133
|
Promise.all(promises).then(() => {
|
128
|
-
console.log('Minification complete.');
|
134
|
+
console.log('dist/esm Minification complete.');
|
129
135
|
process.exit()
|
130
136
|
});
|
package/package.json
CHANGED
package/src/DefaultConfig.mjs
CHANGED
@@ -264,12 +264,12 @@ const DefaultConfig = {
|
|
264
264
|
useVdomWorker: true,
|
265
265
|
/**
|
266
266
|
* buildScripts/injectPackageVersion.mjs will update this value
|
267
|
-
* @default '9.
|
267
|
+
* @default '9.9.0'
|
268
268
|
* @memberOf! module:Neo
|
269
269
|
* @name config.version
|
270
270
|
* @type String
|
271
271
|
*/
|
272
|
-
version: '9.
|
272
|
+
version: '9.9.0'
|
273
273
|
};
|
274
274
|
|
275
275
|
Object.assign(DefaultConfig, {
|
package/src/main/DomAccess.mjs
CHANGED
@@ -1130,7 +1130,7 @@ class DomAccess extends Base {
|
|
1130
1130
|
topFocusTrap = subject.$topFocusTrap = document.createElement('div');
|
1131
1131
|
bottomFocusTrap = subject.$bottomFocusTrap = document.createElement('div');
|
1132
1132
|
|
1133
|
-
// The two focus
|
1133
|
+
// The two focus trapping elements must be invisible but tabbable.
|
1134
1134
|
topFocusTrap.className = bottomFocusTrap.className = 'neo-focus-trap';
|
1135
1135
|
topFocusTrap.setAttribute('tabIndex', 0);
|
1136
1136
|
bottomFocusTrap.setAttribute('tabIndex', 0);
|
@@ -32,13 +32,18 @@ class ServiceWorker extends Base {
|
|
32
32
|
{config} = Neo,
|
33
33
|
{environment} = config,
|
34
34
|
devMode = environment === 'development',
|
35
|
-
|
35
|
+
distEsm = environment === 'dist/esm',
|
36
|
+
hasJsModules = devMode || distEsm,
|
36
37
|
fileName = hasJsModules ? 'ServiceWorker.mjs' : 'serviceworker.js',
|
37
38
|
opts = hasJsModules ? {type: 'module'} : {},
|
38
39
|
path = (hasJsModules ? config.basePath : config.workerBasePath) + fileName,
|
39
40
|
{serviceWorker} = navigator,
|
40
41
|
registration;
|
41
42
|
|
43
|
+
if (distEsm) {
|
44
|
+
path = path.substring(6)
|
45
|
+
}
|
46
|
+
|
42
47
|
registration = await serviceWorker.register(path, opts);
|
43
48
|
|
44
49
|
window.addEventListener('beforeunload', me.onBeforeUnload.bind(me));
|