neo.mjs 8.31.1 → 8.32.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.
Files changed (46) hide show
  1. package/.github/LLM_PROMPTS.md +463 -0
  2. package/README.md +138 -55
  3. package/apps/ServiceWorker.mjs +2 -2
  4. package/apps/portal/index.html +1 -1
  5. package/apps/portal/view/home/FooterContainer.mjs +1 -1
  6. package/apps/portal/view/home/MainContainer.mjs +1 -1
  7. package/apps/portal/view/home/parts/Colors.mjs +4 -8
  8. package/apps/portal/view/home/parts/Helix.mjs +5 -1
  9. package/buildScripts/buildAll.mjs +1 -1
  10. package/buildScripts/buildThemes.mjs +1 -1
  11. package/buildScripts/createApp.mjs +1 -1
  12. package/buildScripts/createAppMinimal.mjs +1 -1
  13. package/buildScripts/docs/jsdocx.mjs +1 -1
  14. package/buildScripts/injectPackageVersion.mjs +1 -1
  15. package/buildScripts/watchThemes.mjs +1 -1
  16. package/buildScripts/webpack/buildThreads.mjs +1 -1
  17. package/buildScripts/webpack/development/webpack.config.appworker.mjs +1 -1
  18. package/buildScripts/webpack/development/webpack.config.main.mjs +1 -1
  19. package/buildScripts/webpack/development/webpack.config.worker.mjs +1 -1
  20. package/buildScripts/webpack/production/webpack.config.appworker.mjs +1 -1
  21. package/buildScripts/webpack/production/webpack.config.main.mjs +1 -1
  22. package/buildScripts/webpack/production/webpack.config.worker.mjs +1 -1
  23. package/examples/README.md +5 -14
  24. package/examples/ServiceWorker.mjs +2 -2
  25. package/package.json +3 -3
  26. package/resources/scss/src/grid/plugin/AnimateRows.scss +10 -0
  27. package/src/DefaultConfig.mjs +2 -2
  28. package/src/calendar/view/SettingsContainer.mjs +3 -5
  29. package/src/calendar/view/week/Component.mjs +3 -5
  30. package/src/component/Base.mjs +3 -6
  31. package/src/component/Helix.mjs +2 -3
  32. package/src/controller/Component.mjs +3 -5
  33. package/src/data/Store.mjs +1 -1
  34. package/src/dialog/Base.mjs +3 -4
  35. package/src/grid/Container.mjs +5 -6
  36. package/src/grid/View.mjs +1 -3
  37. package/src/grid/column/AnimatedChange.mjs +8 -5
  38. package/src/grid/plugin/AnimateRows.mjs +9 -31
  39. package/src/list/Base.mjs +1 -3
  40. package/src/list/plugin/Animate.mjs +3 -3
  41. package/src/manager/Component.mjs +1 -1
  42. package/src/plugin/Base.mjs +23 -3
  43. package/src/selection/HelixModel.mjs +3 -6
  44. package/src/tab/Container.mjs +3 -4
  45. package/src/table/Container.mjs +6 -7
  46. package/src/util/Css.mjs +6 -6
@@ -2662,8 +2662,7 @@ class Component extends Base {
2662
2662
  */
2663
2663
  updateVdom(resolve, reject) {
2664
2664
  let me = this,
2665
- {app, mounted, parentId, vnode} = me,
2666
- listenerId;
2665
+ {app, mounted, parentId, vnode} = me;
2667
2666
 
2668
2667
  if (me.isVdomUpdating || me.silentVdomUpdate) {
2669
2668
  resolve && me.resolveUpdateCache.push(resolve);
@@ -2672,13 +2671,11 @@ class Component extends Base {
2672
2671
  if (!mounted && me.isConstructed && !me.hasRenderingListener && app?.rendering === true) {
2673
2672
  me.hasRenderingListener = true;
2674
2673
 
2675
- listenerId = app.on('mounted', () => {
2676
- app.un('mounted', listenerId);
2677
-
2674
+ app.on('mounted', () => {
2678
2675
  me.timeout(50).then(() => {
2679
2676
  me.vnode && me.updateVdom(resolve, reject)
2680
2677
  })
2681
- })
2678
+ }, me, {once: true})
2682
2679
  } else {
2683
2680
  if (resolve && (!mounted || !vnode)) {
2684
2681
  me.resolveUpdateCache.push(resolve)
@@ -546,12 +546,11 @@ class Helix extends Component {
546
546
  angle, item, matrixItems, transformStyle, vdomItem, c, s, x, y, z;
547
547
 
548
548
  if (!me.mounted) {
549
- const listenerId = me.on('mounted', () => {
550
- me.un('mounted', listenerId);
549
+ me.on('mounted', () => {
551
550
  me.timeout(100).then(() => {
552
551
  me.createItems(startIndex)
553
552
  })
554
- })
553
+ }, me, {once: true})
555
554
  } else {
556
555
  for (; i < len; i++) {
557
556
  item = me.store.items[i];
@@ -45,18 +45,16 @@ class Component extends Base {
45
45
  super.construct(config);
46
46
 
47
47
  let me = this,
48
- {component} = me,
49
- listenerId;
48
+ {component} = me;
50
49
 
51
50
  me.references = {};
52
51
 
53
52
  if (component.isConstructed) {
54
53
  me.onComponentConstructed()
55
54
  } else {
56
- listenerId = component.on('constructed', () => {
57
- component.un('constructed', listenerId);
55
+ component.on('constructed', () => {
58
56
  me.onComponentConstructed()
59
- })
57
+ }, me, {once: true})
60
58
  }
61
59
  }
62
60
 
@@ -430,7 +430,7 @@ class Store extends Base {
430
430
 
431
431
  // Being constructed does not mean that related afterSetStore() methods got executed
432
432
  // => break the sync flow to ensure potential listeners got applied
433
- Promise.resolve().then(() => {
433
+ me.timeout(1).then(() => {
434
434
  if (me.getCount() > 0) {
435
435
  me.fire('load', me.items)
436
436
  } else if (me.autoLoad) {
@@ -286,15 +286,14 @@ class Dialog extends Panel {
286
286
  afterSetResizable(value, oldValue) {
287
287
  if (value && !this.getPlugin('resizable')) {
288
288
  import('../plugin/Resizable.mjs').then(module => {
289
- let me = this,
290
- {appName, windowId} = me,
291
- plugins = me.plugins || [];
289
+ let me = this,
290
+ {appName} = me,
291
+ plugins = me.plugins || [];
292
292
 
293
293
  plugins.push({
294
294
  module : module.default,
295
295
  appName,
296
296
  delegationCls: 'neo-dialog',
297
- windowId,
298
297
  ...me.resizablePluginConfig
299
298
  });
300
299
 
@@ -232,14 +232,13 @@ class GridContainer extends BaseContainer {
232
232
  afterSetCellEditing(value, oldValue) {
233
233
  if (value) {
234
234
  import('./plugin/CellEditing.mjs').then(module => {
235
- let me = this,
236
- {appName, windowId} = me,
237
- plugins = me.plugins || [];
235
+ let me = this,
236
+ {appName} = me,
237
+ plugins = me.plugins || [];
238
238
 
239
239
  plugins.push({
240
- module : module.default,
241
- appName,
242
- windowId
240
+ module: module.default,
241
+ appName
243
242
  });
244
243
 
245
244
  me.plugins = plugins
package/src/grid/View.mjs CHANGED
@@ -226,9 +226,7 @@ class GridView extends Component {
226
226
  plugins = me.plugins || [];
227
227
 
228
228
  plugins.push({
229
- module : module.default,
230
- appName : me.appName,
231
- windowId: me.windowId,
229
+ module: module.default,
232
230
  ...me.pluginAnimateRowsConfig
233
231
  });
234
232
 
@@ -66,12 +66,15 @@ class AnimatedChange extends Column {
66
66
  cellId = view.getCellId(record, me.dataField);
67
67
  node = VdomUtil.find(view.vdom, cellId)?.vdom;
68
68
 
69
- NeoArray.add(node.cls, me.getAnimationCls(record));
69
+ if (node) {
70
+ NeoArray.add(node.cls, me.getAnimationCls(record));
71
+
72
+ // This will trigger a 2nd view update, after grid.View: onStoreRecordChange()
73
+ // It is crucial to restart the keyframe based animation
74
+ // => The previous update call will remove the last animationCls
75
+ view.update()
76
+ }
70
77
 
71
- // This will trigger a 2nd view update, after grid.View: onStoreRecordChange()
72
- // It is crucial to restart the keyframe based animation
73
- // => The previous update call will remove the last animationCls
74
- view.update();
75
78
  break
76
79
  }
77
80
  }
@@ -27,7 +27,7 @@ class AnimateRows extends Base {
27
27
  */
28
28
  ntype: 'plugin-grid-animate-rows',
29
29
  /**
30
- * Time in ms. Please ensure to match the CSS based value, in case you change the default.
30
+ * Time in ms for the background-color, opacity & transform transitions
31
31
  * @member {Number} transitionDuration_=500
32
32
  */
33
33
  transitionDuration_: 500,
@@ -65,7 +65,7 @@ class AnimateRows extends Base {
65
65
  // Add the re-bound listeners
66
66
  owner.store = store;
67
67
 
68
- me.updateTransitionDetails()
68
+ owner.addCls('neo-animate-rows')
69
69
  }
70
70
 
71
71
  /**
@@ -75,7 +75,7 @@ class AnimateRows extends Base {
75
75
  * @protected
76
76
  */
77
77
  afterSetTransitionDuration(value, oldValue) {
78
- this.isConstructed && this.updateTransitionDetails(Neo.isNumber(oldValue))
78
+ this.owner.addStyle({'--neo-duration': value + 'ms'})
79
79
  }
80
80
 
81
81
  /**
@@ -85,7 +85,7 @@ class AnimateRows extends Base {
85
85
  * @protected
86
86
  */
87
87
  afterSetTransitionEasing(value, oldValue) {
88
- this.isConstructed && this.updateTransitionDetails(!!oldValue)
88
+ this.owner.addStyle({'--neo-easing': value})
89
89
  }
90
90
 
91
91
  /**
@@ -102,7 +102,11 @@ class AnimateRows extends Base {
102
102
  * @param {Object} args
103
103
  */
104
104
  destroy(...args) {
105
- CssUtil.deleteRules(this.appName, `#${this.owner.id} .neo-grid-row`);
105
+ this.owner.addStyle({
106
+ '--neo-duration': null,
107
+ '--neo-easing' : null
108
+ });
109
+
106
110
  super.destroy(...args)
107
111
  }
108
112
 
@@ -125,32 +129,6 @@ class AnimateRows extends Base {
125
129
  this.updateView()
126
130
  }
127
131
 
128
- /**
129
- * We do not want to apply the style to each list item itself,
130
- * so we are using Neo.util.Css
131
- * @param {Boolean} deleteRule=false
132
- * @protected
133
- */
134
- async updateTransitionDetails(deleteRule=false) {
135
- let me = this,
136
- duration = me.transitionDuration,
137
- easing = me.transitionEasing,
138
- {id} = me.owner;
139
-
140
- if (deleteRule) {
141
- await CssUtil.deleteRules(me.appName, `#${id} .neo-grid-row`)
142
- }
143
-
144
- CssUtil.insertRules(me.appName, [
145
- `#${id} .neo-grid-row {`,
146
- 'transition:',
147
- `background-color ${duration}ms ${easing},`,
148
- `opacity ${duration}ms ${easing},`,
149
- `transform ${duration}ms ${easing}`,
150
- '}'
151
- ].join(''))
152
- }
153
-
154
132
  /**
155
133
  *
156
134
  */
package/src/list/Base.mjs CHANGED
@@ -206,9 +206,7 @@ class List extends Component {
206
206
  plugins = me.plugins || [];
207
207
 
208
208
  plugins.push({
209
- module : module.default,
210
- appName : me.appName,
211
- windowId: me.windowId,
209
+ module: module.default,
212
210
  ...me.pluginAnimateConfig
213
211
  });
214
212
 
@@ -156,7 +156,7 @@ class Animate extends Base {
156
156
  * @param {Object} args
157
157
  */
158
158
  destroy(...args) {
159
- CssUtil.deleteRules(this.appName, `#${this.owner.id} .neo-list-item`);
159
+ CssUtil.deleteRules(this.windowId, `#${this.owner.id} .neo-list-item`);
160
160
  super.destroy(...args)
161
161
  }
162
162
 
@@ -431,10 +431,10 @@ class Animate extends Base {
431
431
  {id} = me.owner;
432
432
 
433
433
  if (deleteRule) {
434
- await CssUtil.deleteRules(me.appName, `#${id} .neo-list-item`)
434
+ await CssUtil.deleteRules(me.windowId, `#${id} .neo-list-item`)
435
435
  }
436
436
 
437
- CssUtil.insertRules(me.appName, [
437
+ CssUtil.insertRules(me.windowId, [
438
438
  `#${id} .neo-list-item {`,
439
439
  `transition: opacity ${duration}ms ${easing}, transform ${duration}ms ${easing}`,
440
440
  '}'
@@ -445,7 +445,7 @@ class Component extends Manager {
445
445
  component = this.get(item.componentId);
446
446
 
447
447
  // keep references in case there is no vnode (cmp not mounted)
448
- if (component.vnode) {
448
+ if (component?.vnode) {
449
449
  item = component.vnode
450
450
  }
451
451
  }
@@ -37,12 +37,21 @@ class Plugin extends Base {
37
37
  construct(config) {
38
38
  super.construct(config);
39
39
 
40
- let me = this;
40
+ let me = this,
41
+ {owner} = me;
41
42
 
42
- if (me.owner.mounted) {
43
+ if (owner.isConstructed) {
44
+ me.onOwnerConstructed()
45
+ } else {
46
+ owner.on('constructed', () => {
47
+ me.onOwnerConstructed()
48
+ }, me, {once: true})
49
+ }
50
+
51
+ if (owner.mounted) {
43
52
  me.onOwnerMounted();
44
53
  } else {
45
- me.owner.on('mounted', me.onOwnerMounted, me);
54
+ owner.on('mounted', me.onOwnerMounted, me);
46
55
  }
47
56
  }
48
57
 
@@ -56,6 +65,17 @@ class Plugin extends Base {
56
65
  value && Neo.currentWorker.insertThemeFiles(value, this.__proto__)
57
66
  }
58
67
 
68
+ /**
69
+ * Override this method to apply changes to the owner Component when it is constructed
70
+ */
71
+ onOwnerConstructed() {
72
+ let {owner} = this;
73
+
74
+ if (owner.windowId) {
75
+ this.windowId = owner.windowId
76
+ }
77
+ }
78
+
59
79
  /**
60
80
  * Override this method to apply changes to the owner Component when it does get mounted
61
81
  */
@@ -223,8 +223,7 @@ class HelixModel extends Model {
223
223
  isSelected = toggleSelection === false ? false : me.items.includes(itemId),
224
224
  items = me.items,
225
225
  oldItems = [...items],
226
- deltas = [],
227
- listenerId;
226
+ deltas = [];
228
227
 
229
228
  // a select() call can happen before the view is registered
230
229
  if (!view) {
@@ -232,13 +231,11 @@ class HelixModel extends Model {
232
231
  }
233
232
 
234
233
  if (!view.mounted) {
235
- listenerId = view.on('mounted', () => {
236
- view.un('mounted', listenerId);
237
-
234
+ view.on('mounted', () => {
238
235
  me.timeout(300).then(() => {
239
236
  me.select(itemId, toggleSelection)
240
237
  })
241
- })
238
+ }, me, {once: true})
242
239
  }
243
240
 
244
241
  if (me.singleSelect) {
@@ -524,7 +524,7 @@ class Container extends BaseContainer {
524
524
  i = 0,
525
525
  len = tabBar.items.length,
526
526
  index = -1,
527
- card, listenerId;
527
+ card;
528
528
 
529
529
  for (; i < len; i++) {
530
530
  if (tabBar.items[i].id === buttonId) {
@@ -537,10 +537,9 @@ class Container extends BaseContainer {
537
537
  card = cardContainer.items[index];
538
538
 
539
539
  if (me.vnode && !card.mounted) {
540
- listenerId = card.on('mounted', () => {
541
- card.un('mounted', listenerId);
540
+ card.on('mounted', () => {
542
541
  me.activeIndex = index
543
- })
542
+ }, me, {once: true})
544
543
  } else {
545
544
  me.activeIndex = index
546
545
  }
@@ -161,14 +161,13 @@ class Container extends BaseContainer {
161
161
  afterSetCellEditing(value, oldValue) {
162
162
  if (value) {
163
163
  import('./plugin/CellEditing.mjs').then(module => {
164
- let me = this,
165
- {appName, windowId} = me,
166
- plugins = me.plugins || [];
164
+ let me = this,
165
+ {appName} = me,
166
+ plugins = me.plugins || [];
167
167
 
168
168
  plugins.push({
169
- module : module.default,
170
- appName,
171
- windowId
169
+ module: module.default,
170
+ appName
172
171
  });
173
172
 
174
173
  me.plugins = plugins
@@ -262,7 +261,7 @@ class Container extends BaseContainer {
262
261
  }
263
262
 
264
263
  if (cssRules.length > 0) {
265
- CssUtil.insertRules(me.appName, cssRules)
264
+ CssUtil.insertRules(me.windowId, cssRules)
266
265
  }
267
266
 
268
267
  me.scrollbarsCssApplied = true
package/src/util/Css.mjs CHANGED
@@ -15,27 +15,27 @@ class Css extends Base {
15
15
 
16
16
  /**
17
17
  * Pass the selectorText of the rules which you want to remove
18
- * @param {String} appName
18
+ * @param {Number} windowId
19
19
  * @param {String[]|String} rules
20
20
  */
21
- static deleteRules(appName, rules) {
21
+ static deleteRules(windowId, rules) {
22
22
  if (!Array.isArray(rules)) {
23
23
  rules = [rules]
24
24
  }
25
25
 
26
- Neo.main.addon.Stylesheet.deleteCssRules({appName, rules})
26
+ Neo.main.addon.Stylesheet.deleteCssRules({rules, windowId})
27
27
  }
28
28
 
29
29
  /**
30
- * @param {String} appName
30
+ * @param {Number} windowId
31
31
  * @param {String[]|String} rules
32
32
  */
33
- static insertRules(appName, rules) {
33
+ static insertRules(windowId, rules) {
34
34
  if (!Array.isArray(rules)) {
35
35
  rules = [rules]
36
36
  }
37
37
 
38
- Neo.main.addon.Stylesheet.insertCssRules({appName, rules})
38
+ Neo.main.addon.Stylesheet.insertCssRules({rules, windowId})
39
39
  }
40
40
  }
41
41