neo.mjs 6.17.0 → 6.17.2

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.
Files changed (37) hide show
  1. package/apps/ServiceWorker.mjs +2 -2
  2. package/apps/portal/view/HeaderToolbar.mjs +44 -27
  3. package/apps/portal/view/Viewport.mjs +12 -1
  4. package/apps/portal/view/home/MainContainer.mjs +28 -60
  5. package/apps/portal/view/home/parts/AfterMath.mjs +58 -0
  6. package/apps/portal/view/home/parts/CoolStuff.mjs +82 -0
  7. package/apps/portal/view/home/parts/Features.mjs +52 -0
  8. package/apps/portal/view/home/parts/HelloWorld.mjs +82 -0
  9. package/apps/portal/view/home/parts/MainNeo.mjs +55 -0
  10. package/apps/portal/view/home/preview/PageCodeContainer.mjs +55 -0
  11. package/apps/portal/view/learn/LivePreview.mjs +16 -14
  12. package/apps/website/data/docs.json +2 -2
  13. package/apps/website/view/blog/List.mjs +28 -30
  14. package/apps/website/view/examples/List.mjs +15 -17
  15. package/buildScripts/webpack/webpack.server.config.mjs +4 -1
  16. package/docs/app/view/classdetails/MembersList.mjs +4 -0
  17. package/examples/ServiceWorker.mjs +2 -2
  18. package/package.json +4 -4
  19. package/resources/images/Neo_Logo_Blue.svg +6 -0
  20. package/resources/images/Neo_Logo_Text.svg +5 -0
  21. package/resources/images/Neo_Logo_White.svg +6 -0
  22. package/resources/scss/src/apps/portal/HeaderToolbar.scss +189 -17
  23. package/resources/scss/src/apps/portal/home/MainContainer.scss +46 -20
  24. package/resources/scss/src/apps/portal/home/parts/Features.scss +3 -0
  25. package/resources/scss/src/apps/portal/home/preview/PageCodeContainer.scss +115 -0
  26. package/resources/scss/src/component/Base.scss +2 -0
  27. package/src/DefaultConfig.mjs +2 -2
  28. package/src/component/Base.mjs +139 -71
  29. package/src/component/wrapper/MonacoEditor.mjs +1 -6
  30. package/src/container/Base.mjs +5 -5
  31. package/src/container/Viewport.mjs +30 -1
  32. package/src/manager/DomEvent.mjs +11 -6
  33. package/src/plugin/Responsive.mjs +175 -0
  34. package/src/util/Logger.mjs +3 -3
  35. package/resources/images/Neo_Vector.svg +0 -3
  36. package/resources/images/logos/Github-logo-black.svg +0 -1
  37. package/resources/images/logos/Slack-logo-black.svg +0 -17
@@ -76,10 +76,9 @@ class DomEvent extends Base {
76
76
  console.error('For using resize domListeners, you must include main.addon.ResizeObserver.', event)
77
77
  }
78
78
 
79
- Neo.main.addon.ResizeObserver.register({
80
- appName: component.appName,
81
- id : component.id
82
- })
79
+ let {id, windowId} = component;
80
+
81
+ Neo.main.addon.ResizeObserver.register({id, windowId})
83
82
  }
84
83
 
85
84
  /**
@@ -117,7 +116,12 @@ class DomEvent extends Base {
117
116
  let result;
118
117
 
119
118
  if (listener && listener.fn) {
120
- delegationTargetId = me.verifyDelegationPath(listener, data.path);
119
+ if (eventName === 'resize') {
120
+ // we do not want delegation for custom main.addon.ResizeObserver events
121
+ delegationTargetId = data.id === component.id ? data.id : false
122
+ } else {
123
+ delegationTargetId = me.verifyDelegationPath(listener, data.path)
124
+ }
121
125
 
122
126
  if (delegationTargetId !== false) {
123
127
  preventFire = false;
@@ -135,6 +139,7 @@ class DomEvent extends Base {
135
139
 
136
140
  // Handler needs to know which actual target matched the delegate
137
141
  data.currentTarget = delegationTargetId;
142
+
138
143
  result = listener.fn.apply(listener.scope || globalThis, [data]);
139
144
 
140
145
  if (!listener.bubble) {
@@ -159,7 +164,7 @@ class DomEvent extends Base {
159
164
  break;
160
165
  }
161
166
 
162
- // Honour the Event cancelBubble property
167
+ // Honor the Event cancelBubble property
163
168
  if (!bubble || data.cancelBubble) {
164
169
  break;
165
170
  }
@@ -0,0 +1,175 @@
1
+ import BasePlugin from './Base.mjs';
2
+
3
+ /**
4
+ * @class Neo.plugin.Responsive
5
+ * @extends Neo.plugin.Base
6
+ */
7
+ class Responsive extends BasePlugin {
8
+ static config = {
9
+ /**
10
+ * @member {String} className='Neo.plugin.Responsive'
11
+ * @protected
12
+ */
13
+ className: 'Neo.plugin.Responsive',
14
+ /**
15
+ * @member {String} ntype='plugin-responsive'
16
+ * @protected
17
+ */
18
+ ntype: 'plugin-responsive',
19
+ /**
20
+ * @member {Map} responsiveConfig: new Map()
21
+ */
22
+ responsiveConfig: new Map(),
23
+ /**
24
+ * @member {Object} defaultResponsiveConfig
25
+ */
26
+ defaultResponsiveConfig: {
27
+ landscape(data) {
28
+ return data.width > data.height
29
+ },
30
+ portrait(data) {
31
+ return data.width < data.height
32
+ }
33
+ }
34
+ }
35
+
36
+ /**
37
+ * @param {Object} config
38
+ */
39
+ construct(config) {
40
+ super.construct(config);
41
+
42
+ let me = this,
43
+ {owner} = me;
44
+
45
+ owner.addCls('neo-responsive');
46
+
47
+ Neo.first('viewport').addDomListeners([
48
+ {resize: me.onResize, scope: me}
49
+ ])
50
+
51
+ Neo.Responsive = Neo.Responsive || {
52
+ responsiveConfig: new Map(),
53
+ apps : {}
54
+ };
55
+
56
+ me.addToResponsiveMap(me.defaultResponsiveConfig, me);
57
+ me.addToResponsiveMap(owner.responsiveConfig || {}, owner);
58
+ me.handleBodyCls()
59
+ }
60
+
61
+ /**
62
+ * @param responsiveObj
63
+ * @param scope
64
+ */
65
+ addToResponsiveMap(responsiveObj, scope) {
66
+ for (const [key, value] of Object.entries(responsiveObj)) {
67
+ let fn;
68
+
69
+ if (Neo.isObject(value)) {
70
+ fn = function (rect) {
71
+ let returnBool = true;
72
+
73
+ for (const [subKey, subValue] of Object.entries(value)) {
74
+ const isMin = subKey.startsWith('min'),
75
+ testConfig = subKey.substring(3).toLowerCase();
76
+
77
+ if (isMin) {
78
+ returnBool = rect[testConfig] >= subValue
79
+ } else {
80
+ returnBool = rect[testConfig] <= subValue
81
+ }
82
+
83
+ if (!returnBool) {
84
+ break
85
+ }
86
+ }
87
+
88
+ return returnBool
89
+ }
90
+ } else {
91
+ fn = value
92
+ }
93
+
94
+ fn = fn.bind(scope);
95
+
96
+ Neo.Responsive.responsiveConfig.set(key, fn)
97
+ }
98
+ }
99
+
100
+ /**
101
+ *
102
+ */
103
+ handleBodyCls() {
104
+ const
105
+ me = this,
106
+ {appName} = me.owner,
107
+ apps = Neo.Responsive.apps;
108
+
109
+ if (!apps[appName]?.activeBodyUpdate) {
110
+ const viewport = Neo.first('viewport'); // todo
111
+
112
+ apps[appName] = {
113
+ appId : viewport.id,
114
+ activeBodyUpdate: true
115
+ };
116
+
117
+ viewport.addDomListeners([
118
+ {resize: me.onResizeBody, scope: me}
119
+ ])
120
+ }
121
+ }
122
+
123
+ /**
124
+ * @param {Object} data
125
+ */
126
+ onResize(data) {
127
+ const
128
+ me = this,
129
+ config = {},
130
+ configTester = Neo.Responsive.responsiveConfig,
131
+ {owner} = me,
132
+ {responsive} = owner;
133
+
134
+ for (const [key, value] of Object.entries(responsive)) {
135
+ const hasKey = configTester.get(key)?.(data.rect);
136
+
137
+ if (hasKey) {
138
+ for (const [configKey, configValue] of Object.entries(value)) {
139
+ if (false && Neo.typeOf(owner[configKey]) === 'NeoInstance') {
140
+ // todo: ntype, module or className must match
141
+ owner[configKey].set(value)
142
+ } else {
143
+ config[configKey] = configValue
144
+ }
145
+ }
146
+ }
147
+ }
148
+
149
+ Object.keys(config).length > 0 && owner.set(config)
150
+ }
151
+
152
+ /**
153
+ * Add either neo-landscape or neo-portrait to the parent viewport component
154
+ */
155
+ onResizeBody(data) {
156
+ const
157
+ me = this,
158
+ newRect = data.contentRect,
159
+ isLandscape = newRect.width >= newRect.height,
160
+ addCls = isLandscape ? 'neo-landscape' : 'neo-portrait',
161
+ removeCls = isLandscape ? 'neo-portrait' : 'neo-landscape';
162
+
163
+ Neo.applyDeltas(me.appName, {
164
+ id : 'document.body',
165
+ cls: {
166
+ add : [addCls],
167
+ remove: [removeCls]
168
+ }
169
+ })
170
+ }
171
+ }
172
+
173
+ Neo.setupClass(Responsive);
174
+
175
+ export default Responsive;
@@ -208,9 +208,9 @@ class Logger extends Base {
208
208
  } else if (Neo.isObject(identifier)) {
209
209
  argsObject = identifier
210
210
  }
211
- } else if (args.length === 2) {
211
+ } else if (args.length > 2) {
212
212
  argsObject.msg = args[0];
213
- argsObject.data = args[1]
213
+ argsObject.data = args.slice(1);
214
214
  }
215
215
 
216
216
  return argsObject
@@ -236,7 +236,7 @@ class Logger extends Base {
236
236
  if (me.beforeSetLevel(level) < me.level) {
237
237
  return
238
238
  }
239
-
239
+ console.log('#', args.msg, level)
240
240
  let logColor = me.logColors[level],
241
241
  logChar = me.logChars[level],
242
242
  bg = `background-color:${logColor}; color: white; font-weight: 900;`,
@@ -1,3 +0,0 @@
1
- <svg width="274" height="178" viewBox="0 0 274 178" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M231.866 178L136.597 82.5858L41.3368 178L0.101562 136.702L136.597 0L273.102 136.702L231.866 178Z" fill="#11F4A1"/>
3
- </svg>
@@ -1 +0,0 @@
1
- <svg width="98" height="96" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z" fill="#24292f"/></svg>
@@ -1,17 +0,0 @@
1
- <svg width="123" height="124" viewBox="0 0 123 124" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <g clip-path="url(#clip0_460_4276)">
3
- <path d="M25.8 78.1988C25.8 85.2988 20 91.0988 12.9 91.0988C5.8 91.0988 0 85.2988 0 78.1988C0 71.0988 5.8 65.2988 12.9 65.2988H25.8V78.1988Z" fill="black"/>
4
- <path d="M32.3008 78.1988C32.3008 71.0988 38.1008 65.2988 45.2008 65.2988C52.3008 65.2988 58.1008 71.0988 58.1008 78.1988V110.499C58.1008 117.599 52.3008 123.399 45.2008 123.399C38.1008 123.399 32.3008 117.599 32.3008 110.499V78.1988Z" fill="black"/>
5
- <path d="M45.2008 26.3996C38.1008 26.3996 32.3008 20.5996 32.3008 13.4996C32.3008 6.39961 38.1008 0.599609 45.2008 0.599609C52.3008 0.599609 58.1008 6.39961 58.1008 13.4996V26.3996H45.2008Z" fill="black"/>
6
- <path d="M45.2 32.9004C52.3 32.9004 58.1 38.7004 58.1 45.8004C58.1 52.9004 52.3 58.7004 45.2 58.7004H12.9C5.8 58.7004 0 52.9004 0 45.8004C0 38.7004 5.8 32.9004 12.9 32.9004H45.2Z" fill="black"/>
7
- <path d="M97 45.8004C97 38.7004 102.8 32.9004 109.9 32.9004C117 32.9004 122.8 38.7004 122.8 45.8004C122.8 52.9004 117 58.7004 109.9 58.7004H97V45.8004Z" fill="black"/>
8
- <path d="M90.4992 45.7996C90.4992 52.8996 84.6992 58.6996 77.5992 58.6996C70.4992 58.6996 64.6992 52.8996 64.6992 45.7996V13.4996C64.6992 6.39961 70.4992 0.599609 77.5992 0.599609C84.6992 0.599609 90.4992 6.39961 90.4992 13.4996V45.7996Z" fill="black"/>
9
- <path d="M77.5992 97.5996C84.6992 97.5996 90.4992 103.4 90.4992 110.5C90.4992 117.6 84.6992 123.4 77.5992 123.4C70.4992 123.4 64.6992 117.6 64.6992 110.5V97.5996H77.5992Z" fill="black"/>
10
- <path d="M77.5992 91.0988C70.4992 91.0988 64.6992 85.2988 64.6992 78.1988C64.6992 71.0988 70.4992 65.2988 77.5992 65.2988H109.899C116.999 65.2988 122.799 71.0988 122.799 78.1988C122.799 85.2988 116.999 91.0988 109.899 91.0988H77.5992Z" fill="black"/>
11
- </g>
12
- <defs>
13
- <clipPath id="clip0_460_4276">
14
- <rect width="123" height="124" fill="white"/>
15
- </clipPath>
16
- </defs>
17
- </svg>