neo.mjs 7.1.0 → 7.3.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/apps/ServiceWorker.mjs +2 -2
- package/apps/portal/index.html +1 -1
- package/apps/portal/model/Example.mjs +56 -0
- package/apps/portal/resources/data/examples_devmode.json +114 -0
- package/apps/portal/resources/data/examples_dist_dev.json +108 -0
- package/apps/portal/resources/data/examples_dist_prod.json +108 -0
- package/apps/portal/store/Examples.mjs +26 -0
- package/apps/portal/view/HeaderToolbar.mjs +3 -0
- package/apps/portal/view/Viewport.mjs +3 -2
- package/apps/portal/view/ViewportController.mjs +32 -14
- package/apps/portal/view/about/Container.mjs +2 -2
- package/apps/portal/view/blog/List.mjs +3 -3
- package/apps/portal/view/examples/List.mjs +156 -0
- package/apps/portal/view/examples/TabContainer.mjs +81 -0
- package/apps/portal/view/examples/TabContainerController.mjs +41 -0
- package/apps/portal/view/home/FooterContainer.mjs +1 -1
- package/apps/realworld/api/Article.mjs +7 -1
- package/apps/realworld/api/Favorite.mjs +7 -1
- package/apps/realworld/api/Profile.mjs +7 -1
- package/apps/realworld/api/Tag.mjs +7 -1
- package/apps/realworld/api/User.mjs +7 -1
- package/apps/realworld2/api/Article.mjs +7 -1
- package/apps/realworld2/api/Favorite.mjs +7 -1
- package/apps/realworld2/api/Profile.mjs +7 -1
- package/apps/realworld2/api/Tag.mjs +7 -1
- package/apps/realworld2/api/User.mjs +7 -1
- package/apps/shareddialog/view/MainContainerController.mjs +37 -30
- package/examples/ServiceWorker.mjs +2 -2
- package/examples/todoList/version2/TodoListModel.mjs +1 -1
- package/package.json +2 -2
- package/resources/scss/src/apps/portal/about/MemberContainer.scss +5 -4
- package/resources/scss/src/apps/portal/blog/Container.scss +2 -0
- package/resources/scss/src/apps/portal/examples/List.scss +158 -0
- package/resources/scss/src/apps/portal/examples/TabContainer.scss +36 -0
- package/resources/scss/src/button/Base.scss +4 -0
- package/resources/scss/src/calendar/view/calendars/ColorsList.scss +4 -0
- package/resources/scss/src/calendar/view/calendars/List.scss +2 -1
- package/resources/scss/src/dialog/Base.scss +2 -2
- package/resources/scss/src/list/Base.scss +3 -3
- package/resources/scss/theme-neo-light/button/Base.scss +3 -3
- package/src/DefaultConfig.mjs +2 -2
- package/src/calendar/view/MainContainer.mjs +13 -10
- package/src/calendar/view/calendars/EditContainer.mjs +3 -2
- package/src/calendar/view/calendars/List.mjs +1 -0
- package/src/calendar/view/week/Component.mjs +5 -3
- package/src/calendar/view/week/plugin/DragDrop.mjs +4 -3
- package/src/layout/Cube.mjs +44 -38
@@ -0,0 +1,156 @@
|
|
1
|
+
import BaseList from '../../../../src/list/Base.mjs';
|
2
|
+
import Examples from '../../store/Examples.mjs';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* @class Portal.view.examples.List
|
6
|
+
* @extends Neo.list.Base
|
7
|
+
*/
|
8
|
+
class List extends BaseList {
|
9
|
+
/**
|
10
|
+
* A regex to enforce a maxLength (word break)
|
11
|
+
* @member {RegExp} nameRegEx
|
12
|
+
* @protected
|
13
|
+
* @static
|
14
|
+
*/
|
15
|
+
static nameRegEx = /^(.{65}[^\s]*).*/
|
16
|
+
|
17
|
+
static config = {
|
18
|
+
/**
|
19
|
+
* @member {String} className='Portal.view.examples.List'
|
20
|
+
* @protected
|
21
|
+
*/
|
22
|
+
className: 'Portal.view.examples.List',
|
23
|
+
/**
|
24
|
+
* @member {String[]} baseCls=['portal-examples-list','neo-list']
|
25
|
+
*/
|
26
|
+
baseCls: ['portal-examples-list', 'neo-list'],
|
27
|
+
/**
|
28
|
+
* @member {String} baseUrl='https://neomjs.com/'
|
29
|
+
*/
|
30
|
+
baseUrl: 'https://neomjs.com/',
|
31
|
+
/**
|
32
|
+
* The env of the example links.
|
33
|
+
* Valid values are 'development', 'dist/development', 'dist/production'
|
34
|
+
* @member {String} environment='development'
|
35
|
+
*/
|
36
|
+
environment: 'development',
|
37
|
+
/**
|
38
|
+
* @member {Neo.data.Store} store=Examples
|
39
|
+
*/
|
40
|
+
store: Examples,
|
41
|
+
/**
|
42
|
+
* @member {String|null} storeUrl_=null
|
43
|
+
*/
|
44
|
+
storeUrl_: null,
|
45
|
+
/**
|
46
|
+
* @member {String} sourceBaseUrl='https://github.com/neo.mjs/neo/tree/dev/'
|
47
|
+
*/
|
48
|
+
sourceBaseUrl: 'https://github.com/neo.mjs/neo/tree/dev/',
|
49
|
+
/**
|
50
|
+
* @member {Boolean} useWrapperNode=true
|
51
|
+
*/
|
52
|
+
useWrapperNode: true,
|
53
|
+
/**
|
54
|
+
* @member {Object} _vdom
|
55
|
+
*/
|
56
|
+
_vdom:
|
57
|
+
{cn: [
|
58
|
+
{tag: 'ul', cn: []}
|
59
|
+
]}
|
60
|
+
}
|
61
|
+
|
62
|
+
/**
|
63
|
+
* Triggered before the store config gets changed.
|
64
|
+
* @param {Object|Neo.data.Store} value
|
65
|
+
* @param {Object|Neo.data.Store} oldValue
|
66
|
+
* @returns {Neo.data.Store}
|
67
|
+
* @protected
|
68
|
+
*/
|
69
|
+
beforeSetStore(value, oldValue) {
|
70
|
+
if (value) {
|
71
|
+
if (value.isClass) {
|
72
|
+
value = {
|
73
|
+
module: value,
|
74
|
+
url : this.storeUrl
|
75
|
+
};
|
76
|
+
} else if (Neo.isObject(value)) {
|
77
|
+
value.url = this.storeUrl;
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
return super.beforeSetStore(value, oldValue);
|
82
|
+
}
|
83
|
+
|
84
|
+
/**
|
85
|
+
* @param {Object} record
|
86
|
+
*/
|
87
|
+
createItemContent(record) {
|
88
|
+
let basePath;
|
89
|
+
|
90
|
+
if (Neo.config.isGitHubPages) {
|
91
|
+
basePath = '../../../../resources_pub/website/examples';
|
92
|
+
|
93
|
+
if (Neo.config.environment !== 'development') {
|
94
|
+
basePath = '../../' + basePath
|
95
|
+
}
|
96
|
+
} else {
|
97
|
+
basePath = 'https://raw.githubusercontent.com/neomjs/pages/main/resources_pub/website/examples'
|
98
|
+
}
|
99
|
+
|
100
|
+
return [
|
101
|
+
{cls: ['content', 'neo-relative'], removeDom: record.hidden, cn: [
|
102
|
+
{cls: ['neo-full-size', 'preview-image'], style: {
|
103
|
+
backgroundImage: `url('${basePath}/${record.image}'), linear-gradient(#777, #333)`}
|
104
|
+
},
|
105
|
+
{cls: ['neo-absolute', 'neo-item-bottom-position'], cn: [
|
106
|
+
{...this.createLink(record)},
|
107
|
+
{cls: ['neo-top-20'], cn: [
|
108
|
+
{tag: 'a', cls: ['fab fa-github', 'neo-github-image'], href: this.sourceBaseUrl + record.sourceUrl, target: '_blank'},
|
109
|
+
{cls: ['neo-inner-content'], cn: [
|
110
|
+
{cls: ['neo-inner-details'], html: record.browsers.join(', ')},
|
111
|
+
{cls: ['neo-inner-details'], html: record.environments.join(', ')}
|
112
|
+
]}
|
113
|
+
]}
|
114
|
+
]}
|
115
|
+
]}
|
116
|
+
]
|
117
|
+
}
|
118
|
+
|
119
|
+
/**
|
120
|
+
*
|
121
|
+
* @param {Object} record
|
122
|
+
* @returns {Object}
|
123
|
+
*/
|
124
|
+
createLink(record) {
|
125
|
+
let vdom = {
|
126
|
+
tag : 'a',
|
127
|
+
cls : ['neo-title'],
|
128
|
+
cn : [{html: record.name.replace(List.nameRegEx, "$1")}],
|
129
|
+
href: this.baseUrl + record.url
|
130
|
+
};
|
131
|
+
|
132
|
+
// Do not open multi-window examples inside a new browser window, in case the environment is the same.
|
133
|
+
// E.g. opening the multi-window covid app & the portal app inside the same app worker is problematic.
|
134
|
+
if (!record.sharedWorkers || this.environment !== Neo.config.environment) {
|
135
|
+
vdom.target = '_blank'
|
136
|
+
}
|
137
|
+
|
138
|
+
return vdom
|
139
|
+
}
|
140
|
+
|
141
|
+
/**
|
142
|
+
* @returns {Object}
|
143
|
+
*/
|
144
|
+
getVdomRoot() {
|
145
|
+
return this.vdom.cn[0]
|
146
|
+
}
|
147
|
+
|
148
|
+
/**
|
149
|
+
* @returns {Object}
|
150
|
+
*/
|
151
|
+
getVnodeRoot() {
|
152
|
+
return this.vnode.childNodes[0]
|
153
|
+
}
|
154
|
+
}
|
155
|
+
|
156
|
+
export default Neo.setupClass(List);
|
@@ -0,0 +1,81 @@
|
|
1
|
+
import Container from '../../../../src/tab/Container.mjs';
|
2
|
+
import List from './List.mjs';
|
3
|
+
import TabContainerController from './TabContainerController.mjs';
|
4
|
+
|
5
|
+
/**
|
6
|
+
* @class Portal.view.examples.TabContainer
|
7
|
+
* @extends Neo.tab.Container
|
8
|
+
*/
|
9
|
+
class TabContainer extends Container {
|
10
|
+
static config = {
|
11
|
+
/**
|
12
|
+
* @member {String} className='Portal.view.examples.TabContainer'
|
13
|
+
* @protected
|
14
|
+
*/
|
15
|
+
className: 'Portal.view.examples.TabContainer',
|
16
|
+
/**
|
17
|
+
* @member {Number|null} activeIndex=null
|
18
|
+
*/
|
19
|
+
activeIndex: null,
|
20
|
+
/**
|
21
|
+
* @member {String[]} baseCls=['portal-examples-tab-container','neo-tab-container']
|
22
|
+
*/
|
23
|
+
baseCls: ['portal-examples-tab-container', 'neo-tab-container'],
|
24
|
+
/**
|
25
|
+
* @member {Neo.controller.Component} controller=TabContainerController
|
26
|
+
*/
|
27
|
+
controller: TabContainerController,
|
28
|
+
/**
|
29
|
+
* @member {Object} headerToolbarDefaults
|
30
|
+
*/
|
31
|
+
headerToolbarDefaults: {
|
32
|
+
cls: ['portal-examples-tab-header-toolbar']
|
33
|
+
},
|
34
|
+
/**
|
35
|
+
* @member {Object} itemDefaults
|
36
|
+
*/
|
37
|
+
itemDefaults: {
|
38
|
+
module: List
|
39
|
+
},
|
40
|
+
/**
|
41
|
+
* @member {Object[]} items
|
42
|
+
*/
|
43
|
+
items: [{
|
44
|
+
reference : 'examples-devmode-list',
|
45
|
+
storeUrl : '../../apps/portal/resources/data/examples_devmode.json',
|
46
|
+
tabButtonConfig: {
|
47
|
+
iconCls: 'fa fa-chess-knight',
|
48
|
+
route : '/examples/devmode',
|
49
|
+
text : 'DevMode'
|
50
|
+
}
|
51
|
+
}, {
|
52
|
+
environment : 'dist/development',
|
53
|
+
reference : 'examples-dist-dev-list',
|
54
|
+
storeUrl : '../../apps/portal/resources/data/examples_dist_dev.json',
|
55
|
+
tabButtonConfig: {
|
56
|
+
iconCls: 'fa fa-chess-queen',
|
57
|
+
route : '/examples/dist_dev',
|
58
|
+
text : 'dist/dev'
|
59
|
+
}
|
60
|
+
}, {
|
61
|
+
environment : 'dist/production',
|
62
|
+
reference : 'examples-dist-prod-list',
|
63
|
+
storeUrl : '../../apps/portal/resources/data/examples_dist_prod.json',
|
64
|
+
tabButtonConfig: {
|
65
|
+
iconCls: 'fa fa-chess-king',
|
66
|
+
route : '/examples/dist_prod',
|
67
|
+
text : 'dist/prod'
|
68
|
+
}
|
69
|
+
}],
|
70
|
+
/**
|
71
|
+
* @member {Boolean} sortable=true
|
72
|
+
*/
|
73
|
+
sortable: true,
|
74
|
+
/**
|
75
|
+
* @member {String} tabBarPosition='left'
|
76
|
+
*/
|
77
|
+
tabBarPosition: 'left',
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
export default Neo.setupClass(TabContainer);
|
@@ -0,0 +1,41 @@
|
|
1
|
+
import Component from '../../../../src/controller/Component.mjs';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* @class Portal.view.examples.TabContainerController
|
5
|
+
* @extends Neo.controller.Component
|
6
|
+
*/
|
7
|
+
class TabContainerController extends Component {
|
8
|
+
static config = {
|
9
|
+
/**
|
10
|
+
* @member {String} className='Portal.view.examples.TabContainerController'
|
11
|
+
* @protected
|
12
|
+
*/
|
13
|
+
className: 'Portal.view.examples.TabContainerController',
|
14
|
+
/**
|
15
|
+
* @member {Object} routes
|
16
|
+
*/
|
17
|
+
routes: {
|
18
|
+
'/examples' : 'onExamplesRoute',
|
19
|
+
'/examples/{itemId}': 'onExamplesRoute'
|
20
|
+
}
|
21
|
+
}
|
22
|
+
|
23
|
+
/**
|
24
|
+
* @param {Object} params
|
25
|
+
* @param {Object} value
|
26
|
+
* @param {Object} oldValue
|
27
|
+
*/
|
28
|
+
onExamplesRoute(params, value, oldValue) {
|
29
|
+
let me = this,
|
30
|
+
itemId = params?.itemId || 'dist_prod',
|
31
|
+
store = me.getReference(`examples-${itemId.replace('_', '-')}-list`).store;
|
32
|
+
|
33
|
+
if (store?.getCount() < 1) {
|
34
|
+
store.load()
|
35
|
+
}
|
36
|
+
|
37
|
+
me.component.activeIndex = itemId === 'dist_prod' ? 2 : itemId === 'dist_dev' ? 1 : 0
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
export default Neo.setupClass(TabContainerController);
|
@@ -3,6 +3,7 @@ import Base from './Base.mjs';
|
|
3
3
|
/**
|
4
4
|
* @class RealWorld.api.Article
|
5
5
|
* @extends RealWorld.api.Base
|
6
|
+
* @singleton
|
6
7
|
*/
|
7
8
|
class Article extends Base {
|
8
9
|
static config = {
|
@@ -14,7 +15,12 @@ class Article extends Base {
|
|
14
15
|
/**
|
15
16
|
* @member {String} resource='/articles'
|
16
17
|
*/
|
17
|
-
resource: '/articles'
|
18
|
+
resource: '/articles',
|
19
|
+
/**
|
20
|
+
* @member {Boolean} singleton=true
|
21
|
+
* @protected
|
22
|
+
*/
|
23
|
+
singleton: true
|
18
24
|
}
|
19
25
|
|
20
26
|
/**
|
@@ -3,6 +3,7 @@ import Base from './Base.mjs';
|
|
3
3
|
/**
|
4
4
|
* @class RealWorld.api.Favorite
|
5
5
|
* @extends RealWorld.api.Base
|
6
|
+
* @singleton
|
6
7
|
*/
|
7
8
|
class Favorite extends Base {
|
8
9
|
static config = {
|
@@ -10,7 +11,12 @@ class Favorite extends Base {
|
|
10
11
|
* @member {String} className='RealWorld.api.Favorite'
|
11
12
|
* @protected
|
12
13
|
*/
|
13
|
-
className: 'RealWorld.api.Favorite'
|
14
|
+
className: 'RealWorld.api.Favorite',
|
15
|
+
/**
|
16
|
+
* @member {Boolean} singleton=true
|
17
|
+
* @protected
|
18
|
+
*/
|
19
|
+
singleton: true
|
14
20
|
}
|
15
21
|
|
16
22
|
/**
|
@@ -3,6 +3,7 @@ import Base from './Base.mjs';
|
|
3
3
|
/**
|
4
4
|
* @class RealWorld.api.Profile
|
5
5
|
* @extends RealWorld.api.Base
|
6
|
+
* @singleton
|
6
7
|
*/
|
7
8
|
class Profile extends Base {
|
8
9
|
static config = {
|
@@ -14,7 +15,12 @@ class Profile extends Base {
|
|
14
15
|
/**
|
15
16
|
* @member {String} resource='/profiles'
|
16
17
|
*/
|
17
|
-
resource: '/profiles'
|
18
|
+
resource: '/profiles',
|
19
|
+
/**
|
20
|
+
* @member {Boolean} singleton=true
|
21
|
+
* @protected
|
22
|
+
*/
|
23
|
+
singleton: true
|
18
24
|
}
|
19
25
|
|
20
26
|
/**
|
@@ -3,6 +3,7 @@ import Base from './Base.mjs';
|
|
3
3
|
/**
|
4
4
|
* @class RealWorld.api.Tag
|
5
5
|
* @extends RealWorld.api.Base
|
6
|
+
* @singleton
|
6
7
|
*/
|
7
8
|
class Tag extends Base {
|
8
9
|
static config = {
|
@@ -14,7 +15,12 @@ class Tag extends Base {
|
|
14
15
|
/**
|
15
16
|
* @member {String} resource='/tags'
|
16
17
|
*/
|
17
|
-
resource: '/tags'
|
18
|
+
resource: '/tags',
|
19
|
+
/**
|
20
|
+
* @member {Boolean} singleton=true
|
21
|
+
* @protected
|
22
|
+
*/
|
23
|
+
singleton: true
|
18
24
|
}
|
19
25
|
}
|
20
26
|
|
@@ -3,6 +3,7 @@ import Base from './Base.mjs';
|
|
3
3
|
/**
|
4
4
|
* @class RealWorld.api.User
|
5
5
|
* @extends RealWorld.api.Base
|
6
|
+
* @singleton
|
6
7
|
*/
|
7
8
|
class User extends Base {
|
8
9
|
static config = {
|
@@ -14,7 +15,12 @@ class User extends Base {
|
|
14
15
|
/**
|
15
16
|
* @member {String} resource='/tags'
|
16
17
|
*/
|
17
|
-
resource: '/users'
|
18
|
+
resource: '/users',
|
19
|
+
/**
|
20
|
+
* @member {Boolean} singleton=true
|
21
|
+
* @protected
|
22
|
+
*/
|
23
|
+
singleton: true
|
18
24
|
}
|
19
25
|
}
|
20
26
|
|
@@ -3,6 +3,7 @@ import Base from './Base.mjs';
|
|
3
3
|
/**
|
4
4
|
* @class RealWorld2.api.Article
|
5
5
|
* @extends RealWorld2.api.Base
|
6
|
+
* @singleton
|
6
7
|
*/
|
7
8
|
class Article extends Base {
|
8
9
|
static config = {
|
@@ -14,7 +15,12 @@ class Article extends Base {
|
|
14
15
|
/**
|
15
16
|
* @member {String} resource='/articles'
|
16
17
|
*/
|
17
|
-
resource: '/articles'
|
18
|
+
resource: '/articles',
|
19
|
+
/**
|
20
|
+
* @member {Boolean} singleton=true
|
21
|
+
* @protected
|
22
|
+
*/
|
23
|
+
singleton: true
|
18
24
|
}
|
19
25
|
|
20
26
|
/**
|
@@ -3,6 +3,7 @@ import Base from './Base.mjs';
|
|
3
3
|
/**
|
4
4
|
* @class RealWorld2.api.Favorite
|
5
5
|
* @extends RealWorld2.api.Base
|
6
|
+
* @singleton
|
6
7
|
*/
|
7
8
|
class Favorite extends Base {
|
8
9
|
static config = {
|
@@ -10,7 +11,12 @@ class Favorite extends Base {
|
|
10
11
|
* @member {String} className='RealWorld2.api.Favorite'
|
11
12
|
* @protected
|
12
13
|
*/
|
13
|
-
className: 'RealWorld2.api.Favorite'
|
14
|
+
className: 'RealWorld2.api.Favorite',
|
15
|
+
/**
|
16
|
+
* @member {Boolean} singleton=true
|
17
|
+
* @protected
|
18
|
+
*/
|
19
|
+
singleton: true
|
14
20
|
}
|
15
21
|
|
16
22
|
/**
|
@@ -3,6 +3,7 @@ import Base from './Base.mjs';
|
|
3
3
|
/**
|
4
4
|
* @class RealWorld2.api.Profile
|
5
5
|
* @extends RealWorld2.api.Base
|
6
|
+
* @singleton
|
6
7
|
*/
|
7
8
|
class Profile extends Base {
|
8
9
|
static config = {
|
@@ -14,7 +15,12 @@ class Profile extends Base {
|
|
14
15
|
/**
|
15
16
|
* @member {String} resource='/profiles'
|
16
17
|
*/
|
17
|
-
resource: '/profiles'
|
18
|
+
resource: '/profiles',
|
19
|
+
/**
|
20
|
+
* @member {Boolean} singleton=true
|
21
|
+
* @protected
|
22
|
+
*/
|
23
|
+
singleton: true
|
18
24
|
}
|
19
25
|
|
20
26
|
/**
|
@@ -3,6 +3,7 @@ import Base from './Base.mjs';
|
|
3
3
|
/**
|
4
4
|
* @class RealWorld2.api.Tag
|
5
5
|
* @extends RealWorld2.api.Base
|
6
|
+
* @singleton
|
6
7
|
*/
|
7
8
|
class Tag extends Base {
|
8
9
|
static config = {
|
@@ -14,7 +15,12 @@ class Tag extends Base {
|
|
14
15
|
/**
|
15
16
|
* @member {String} resource='/tags'
|
16
17
|
*/
|
17
|
-
resource: '/tags'
|
18
|
+
resource: '/tags',
|
19
|
+
/**
|
20
|
+
* @member {Boolean} singleton=true
|
21
|
+
* @protected
|
22
|
+
*/
|
23
|
+
singleton: true
|
18
24
|
}
|
19
25
|
}
|
20
26
|
|
@@ -3,6 +3,7 @@ import Base from './Base.mjs';
|
|
3
3
|
/**
|
4
4
|
* @class RealWorld2.api.User
|
5
5
|
* @extends RealWorld2.api.Base
|
6
|
+
* @singleton
|
6
7
|
*/
|
7
8
|
class User extends Base {
|
8
9
|
static config = {
|
@@ -14,7 +15,12 @@ class User extends Base {
|
|
14
15
|
/**
|
15
16
|
* @member {String} resource='/tags'
|
16
17
|
*/
|
17
|
-
resource: '/users'
|
18
|
+
resource: '/users',
|
19
|
+
/**
|
20
|
+
* @member {Boolean} singleton=true
|
21
|
+
* @protected
|
22
|
+
*/
|
23
|
+
singleton: true
|
18
24
|
}
|
19
25
|
}
|
20
26
|
|