cavalion-vcl 1.1.73 → 1.1.75

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/.md CHANGED
@@ -1,5 +1,19 @@
1
- * [CHANGELOG.md]() - [README.md]() - [package.json]()
2
- * [.workspace](`(devtools/Workspace<${ws.getSpecializer()}>)`) - [.js]() - [src](:/)
1
+ * [CHANGELOG.md]() - [README.md]() -[SNIPPETS.md]()
2
+ * [.js]() - [src](:/) - [package.json]()
3
+
4
+ # `2023/06/22` No dragend event?
5
+
6
+ ![9wFwme](https://raw.githubusercontent.com/relluf/screenshots/master/uPic/9wFwme.png)
7
+
8
+ # `2023/05/12` Gelijk trekken textRenders en rendering
9
+
10
+ * Control vs ListColumn?
11
+
12
+ # `2023/05/11` up() does not find closeable nodes
13
+
14
+ Sigh! The infamous vcl/ui/Node.closeable seems to bite me in the ass.
15
+
16
+ * **Solution**: Use [Node-closeable](src/vcl/ui/:.js) instead
3
17
 
4
18
  # cavalion-vcl / classes
5
19
 
package/CHANGELOG.md CHANGED
@@ -1,3 +1,23 @@
1
+ ### 2023/05/29 - 1.1.74
2
+
3
+ * Node.closeable deprecated
4
+
5
+ * `af4757a` - refactors Node.closeable => Node-closeable updates loading style for Nodes adds SNIPPETS.md
6
+
7
+ * Adding debugging tools
8
+
9
+ * `3d7b43e` - adds Control.tree() - useful for debugging nested structure of controls
10
+ * `9421731` - adds dumpControls snippet removes comments fixes deps global
11
+
12
+ * Working on vcl/prototype
13
+
14
+ * `1720907` - fixes message params situation
15
+ * `fc159df` - fixes ms situation with toasts fixes toast styles
16
+
17
+ * Minor changes
18
+
19
+ * `6e3222b` - updates toast style
20
+
1
21
  ### 2023/03/26 - 1.1.73
2
22
 
3
23
  * Fixes issues with Component.getImplicitBasesByUri
package/SNIPPETS.md ADDED
@@ -0,0 +1,10 @@
1
+ # `2023/05/06` Snippet
2
+
3
+ const dumpControls = (parent) => parent.getControls().reduce((r, c) => {
4
+ r[js.nameOf(c)] = dumpControls(c);
5
+ return r;
6
+ }, Object.create(parent, { hashCode: { value: () => ";-)" } }));
7
+
8
+
9
+ * [Control.js](src/Control.js) - require("vcl/Control").dump
10
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cavalion-vcl",
3
- "version": "1.1.73",
3
+ "version": "1.1.75",
4
4
  "description": "Visual Component Library for vcl-comps",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/Component.js CHANGED
@@ -1522,7 +1522,7 @@ define(function (require) {
1522
1522
  type: Type.EVENT
1523
1523
  },
1524
1524
  "onDispatchChildEvent": {
1525
- type: Type.EVENT
1525
+ type: Type.EVENT // component, name, evt, f, args) {
1526
1526
  },
1527
1527
  "onMessage": {
1528
1528
  type: Type.EVENT
package/src/Control.js CHANGED
@@ -1488,6 +1488,7 @@ this._updateCalls = this._updateCalls || 0; this._updateCalls++;
1488
1488
  ondragcancel: function() {},
1489
1489
  ondragend: function() {
1490
1490
  this.fire("onDragEnd", arguments);
1491
+ delete this._dragger;
1491
1492
  },
1492
1493
  ondragenter: function(evt) {
1493
1494
  this.fire("onDragEnter", arguments);
@@ -1542,9 +1543,6 @@ this._updateCalls = this._updateCalls || 0; this._updateCalls++;
1542
1543
  onmouseout: function() {
1543
1544
  this.fire("onMouseOut", arguments);
1544
1545
  },
1545
- onmouseleave: function() {
1546
- this.fire("onMouseOver", arguments);
1547
- },
1548
1546
  ontap: function() {
1549
1547
  this.fire("onTap", arguments);
1550
1548
  },
@@ -1852,6 +1850,12 @@ this._updateCalls = this._updateCalls || 0; this._updateCalls++;
1852
1850
  updateCallCount: 0,
1853
1851
 
1854
1852
  focused: null,
1853
+
1854
+ tree: (root) => root.getControls().reduce((r, c) => {
1855
+ r[js.nameOf(c)] = Control.tree(c);
1856
+ return r;
1857
+ }, Object.create(root, { hashCode: { value: () => ";-)" } })),
1858
+
1855
1859
 
1856
1860
  findByNode: function(node) {
1857
1861
  while(node !== null && node[EventDispatcher.elementKey] === undefined) {
package/src/Dragger.js CHANGED
@@ -16,9 +16,6 @@ define(function(require) {
16
16
 
17
17
  _cursor: null,
18
18
 
19
- /**
20
- * Constructor
21
- */
22
19
  constructor: function(control, overrides) {
23
20
  this._hook = new DocumentHook(undefined, false);
24
21
  this._control = control;
@@ -32,20 +29,12 @@ define(function(require) {
32
29
  this.override(overrides);
33
30
  }
34
31
  },
35
-
36
- /**
37
- *
38
- */
39
32
  handleEvent: function(evt, type) {
40
33
  var f = this[type];
41
34
  if(f !== undefined) {
42
35
  f.apply(this, arguments);
43
36
  }
44
37
  },
45
-
46
- /**
47
- *
48
- */
49
38
  swapDocCursor: function() {
50
39
  if(this.hasOwnProperty("_cursor")) {
51
40
  var style = document.body.style;
@@ -54,17 +43,9 @@ define(function(require) {
54
43
  this._cursor = cursor;
55
44
  }
56
45
  },
57
-
58
- /**
59
- *
60
- */
61
46
  getCursor: function() {
62
47
  return this._cursor;
63
48
  },
64
-
65
- /**
66
- *
67
- */
68
49
  setCursor: function(value) {
69
50
  if( /* isdragging */ 0) {
70
51
  document.body.style.cursor = value;
@@ -72,10 +53,6 @@ define(function(require) {
72
53
  this._cursor = value;
73
54
  }
74
55
  },
75
-
76
- /**
77
- *
78
- */
79
56
  start: function(evt) {
80
57
  HtmlElement.disableSelection();
81
58
  this.swapDocCursor();
@@ -84,27 +61,16 @@ define(function(require) {
84
61
  this._hook.activate();
85
62
  this.createHandles(evt);
86
63
  },
87
-
88
- /**
89
- *
90
- */
91
64
  end: function(evt) {
65
+ this._control.dispatch("dragend", evt);
92
66
  this.destroyHandles(evt);
93
67
  this._hook.release();
94
68
  this.swapDocCursor();
95
69
  HtmlElement.enableSelection();
96
70
  },
97
-
98
- /**
99
- *
100
- */
101
71
  drop: function(evt) {
102
-
72
+ this._control.dispatch("dragdrop", evt); // ?
103
73
  },
104
-
105
- /**
106
- *
107
- */
108
74
  keyup: function(evt) {
109
75
  if(evt.keyCode === 27) {
110
76
  evt.preventDefault();
@@ -112,40 +78,21 @@ define(function(require) {
112
78
  this.end(evt);
113
79
  }
114
80
  },
115
-
116
- /**
117
- *
118
- */
119
81
  mouseup: function(evt) {
120
82
  if(this._cancelled !== true) {
121
83
  this.drop(evt);
122
84
  this.end(evt);
123
85
  }
124
86
  },
125
-
126
- /**
127
- *
128
- */
129
87
  mousemove: function(evt) {
130
88
  this.updateHandles(evt);
131
89
  },
132
-
133
- /**
134
- *
135
- */
136
- createHandles: function() {
137
- },
138
-
139
- /**
140
- *
141
- */
90
+ createHandles: function() {},
142
91
  destroyHandles: function() {
143
92
  },
144
93
 
145
- /**
146
- * This will just move the control, override to change behaviour
147
- */
148
94
  updateHandles: function(evt) {
95
+ /** This will just move the control, override to change behaviour */
149
96
  var x = this._sx;
150
97
  var y = this._sy;
151
98
 
@@ -157,7 +104,6 @@ define(function(require) {
157
104
  this._sx = evt.clientX;
158
105
  this._sy = evt.clientY;
159
106
  }
160
-
161
107
  }
162
108
  }));
163
109
 
package/src/Factory.js CHANGED
@@ -141,21 +141,17 @@ define(function(require) {
141
141
  },
142
142
  load: function(source, success, failure) {
143
143
  if(source.charAt(0) === "\"" && source.indexOf("\"use strict\";") !== 0) {
144
+ /*- Parse require section */
144
145
  if(source.indexOf("\"use ") === 0) {
145
- // TODO this should be the default
146
- source = "\"" + source.substring(5);
146
+ source = "\"" + source.substring(5); // TODO this should be the default
147
147
  }
148
- /*- Parse require section */
149
148
  var i = source.indexOf("\";");
150
149
  if(i !== -1) {
151
- deps = source.substring(1, i).replace(/\s/g, "");
152
- deps = deps.split(",");
153
-
150
+ var deps = source.substring(1, i).replace(/\s/g, "");
154
151
  /*- require all dependecies */
155
- var me = this;
156
- return this._parentRequire(deps, function() {
157
- me.doLoad(source, success, failure);
158
- }, failure);
152
+ return this._parentRequire(deps.split(","),
153
+ () => this.doLoad(source, success, failure),
154
+ failure);
159
155
  }
160
156
  }
161
157
  return this.doLoad(source, success, failure);
@@ -515,6 +511,12 @@ define(function(require) {
515
511
  DEFAULT_NAMESPACES: {
516
512
  },
517
513
 
514
+ overrides: function(reg, req) {
515
+ for(var k in reg) {
516
+ define(js.sf("vcl/Factory!%s", k), reg[k], new Factory(req || window.require, k))
517
+ }
518
+ },
519
+
518
520
  implicit_sources: {},
519
521
 
520
522
  load: function(name, parentRequire, load, config) {
@@ -527,11 +529,10 @@ define(function(require) {
527
529
  var sourceUri = Factory.makeTextUri(name);
528
530
 
529
531
  function instantiate(source, local) {
530
- var factory = new Factory(parentRequire, name, sourceUri);
532
+ var p = "";//local ? ".skip-fetch.local" : "";
533
+ var factory = new Factory(parentRequire, name + p, sourceUri + p);
531
534
  // console.log("instantiate", name + p);
532
- factory.load(source, function() {
533
- load(factory, source);
534
- });
535
+ factory.load(source, () => load(factory, source));
535
536
  }
536
537
 
537
538
  function fallback() {
@@ -548,6 +549,14 @@ define(function(require) {
548
549
  });
549
550
  }
550
551
 
552
+ if(name.endsWith(".skip-fetch")) {
553
+ // console.log("skip-fetch", name);
554
+ name = name.split(".");
555
+ name.pop();
556
+ name = name.join(".");
557
+ return fallback()
558
+ }
559
+
551
560
  // console.log("fetch", name);
552
561
  this.fetch(name)
553
562
  .then(source => source ? instantiate(source, true) : fallback())
@@ -651,6 +660,5 @@ define(function(require) {
651
660
  },
652
661
  getFactoryUri: getFactoryUri
653
662
  }
654
-
655
663
  }));
656
664
  });
package/src/Reader.js CHANGED
@@ -26,9 +26,6 @@ define(function(require) {
26
26
  _uri: null,
27
27
  _references: null,
28
28
 
29
- /**
30
- *
31
- */
32
29
  constructor: function(factory, root) {
33
30
  this._factory = factory;
34
31
  if(root !== undefined) {
@@ -36,17 +33,17 @@ define(function(require) {
36
33
  }
37
34
  },
38
35
 
39
- /**
40
- * Read the source of a component. Basically instantiates a
41
- * component
42
- *
43
- * @param source
44
- * The actual source
45
- * @param uri
46
- * The uri of the source and thus the resulting root
47
- * component
48
- */
49
36
  read: function(source, uri) {
37
+ /**
38
+ * Read the source of a component. Basically instantiates a
39
+ * component
40
+ *
41
+ * @param source
42
+ * The actual source
43
+ * @param uri
44
+ * The uri of the source and thus the resulting root
45
+ * component
46
+ */
50
47
  var deferred = new Deferred();
51
48
  var thisObj = this;
52
49
 
@@ -81,22 +78,21 @@ define(function(require) {
81
78
 
82
79
  return deferred;
83
80
  },
84
-
85
- /**
86
- * Instantiates a component based upon a definition hold by a node
87
- * which was delivered/parsed by Reader.evaluate. It figures out
88
- * whether the node references a inherited ComponentClass or
89
- * inherited component.
90
- *
91
- * @param node
92
- * The actual node holding information to it's inherited
93
- * prototypes, name, properties, children
94
- * @param success
95
- * To receive the component
96
- * @param failure
97
- * To receive errors
98
- */
99
81
  instantiateComponent: function(node, success, failure) {
82
+ /**
83
+ * Instantiates a component based upon a definition hold by a node
84
+ * which was delivered/parsed by Reader.evaluate. It figures out
85
+ * whether the node references a inherited ComponentClass or
86
+ * inherited component.
87
+ *
88
+ * @param node
89
+ * The actual node holding information to it's inherited
90
+ * prototypes, name, properties, children
91
+ * @param success
92
+ * To receive the component
93
+ * @param failure
94
+ * To receive errors
95
+ */
100
96
  var component, me = this;
101
97
  if(node.inherits instanceof Array) {
102
98
  // inherits (a) ComponentClass-instance(s), require all the
@@ -133,10 +129,6 @@ define(function(require) {
133
129
  success(component);
134
130
  }
135
131
  },
136
-
137
- /**
138
- *
139
- */
140
132
  createRootComponent: function(rootNode, success, failure) {
141
133
  var me = this;
142
134
 
@@ -185,10 +177,6 @@ define(function(require) {
185
177
  f(this._root);
186
178
  }
187
179
  },
188
-
189
- /**
190
- *
191
- */
192
180
  initializeComponent: function(component, node, success, failure) {
193
181
  if(component !== this._root) {
194
182
  // This is an owned/nested component
@@ -220,10 +208,6 @@ define(function(require) {
220
208
  success(component);
221
209
  }
222
210
  },
223
-
224
- /**
225
- *
226
- */
227
211
  createComponents: function(nodes, success, failure) {
228
212
  var count = nodes.length;
229
213
  var result;
@@ -245,16 +229,12 @@ define(function(require) {
245
229
  });
246
230
  }
247
231
  },
248
-
249
- /**
250
- *
251
- */
252
232
  setProperties: function(component, node) {
253
233
  // extend properties
254
234
  component['@properties'] = js.extend(component['@properties'] || {}, node.properties);
255
235
 
256
236
  var properties = component.defineProperties();
257
- for( var k in node.properties) {
237
+ for(var k in node.properties) {
258
238
  var property;
259
239
  if((property = properties[k]) === undefined) {
260
240
  // console.warn(String.format("Property %n.%s does not exist - %n", component.constructor, k,
@@ -265,14 +245,13 @@ define(function(require) {
265
245
  }
266
246
  }
267
247
  },
268
-
269
- /**
270
- *
271
- * @param property
272
- * @param component
273
- * @param value
274
- */
275
248
  setPropertyValue: function(property, component, value) {
249
+ /**
250
+ *
251
+ * @param property
252
+ * @param component
253
+ * @param value
254
+ */
276
255
  if(property.isReference()) {
277
256
  this._references.push({
278
257
  property: property,
package/src/data/Array.js CHANGED
@@ -353,4 +353,4 @@ define(function(require) {
353
353
  }
354
354
  });
355
355
 
356
- });
356
+ });
@@ -123,6 +123,7 @@ keyup:MetaCtrl+192`,
123
123
  [["ui/forms/util/Console"], "console", {
124
124
  align: "bottom",
125
125
  height: 250,
126
+ css: "background-color:rgba(255,255,255,0.5);backdrop-filter:blur(10px);",
126
127
  visible: false,
127
128
  vars: "parent: window;"
128
129
  }]
@@ -4,7 +4,7 @@ var HE = require("util/HtmlElement");
4
4
  HE.addClass(document.body, window.navigator.platform);
5
5
 
6
6
  ["", {}, [
7
- ["#client", {
8
- formUri: "ui/forms/Portal<>"
9
- }]
7
+ // ["#client", {
8
+ // formUri: "ui/forms/Portal<>"
9
+ // }]
10
10
  ]];
@@ -15,7 +15,7 @@
15
15
  var scope = this.getScope();
16
16
  var elem = new Element(this);
17
17
 
18
- var timeout = options.hasOwnProperty("timeout") ? options.timeout : 1500;
18
+ var timeout = options.ms || (options.hasOwnProperty("timeout") ? options.timeout : 1500);
19
19
  var content = options.content || "No toast content";
20
20
  var classes = options.classes || "fade";
21
21
 
@@ -64,9 +64,10 @@
64
64
  },
65
65
  right: "0",
66
66
  left: "0",
67
- bottom: "40px",
67
+ bottom: "20px",
68
68
  "z-index": "20000",
69
69
  "pointer-events": "none",
70
+
70
71
  ".{./Element}": {
71
72
  "pointer-events": "all",
72
73
  "a": {
@@ -95,6 +96,7 @@
95
96
  "&.no-clear": "clear: none;",
96
97
 
97
98
  "&.big": "font-size: 32pt;",
99
+ "&.medium": "font-size: 14pt;",
98
100
  "&.fade": {
99
101
  opacity: "0",
100
102
  transition: "opacity 1s ease",
@@ -117,7 +119,21 @@
117
119
  "&.padding-right-20px": {
118
120
  "padding-right": "20px"
119
121
  },
120
- }
122
+ "&.centered": {
123
+ "text-align": "center",
124
+ // ".{./Element}": {
125
+ "margin-left": "auto",
126
+ "margin-right": "auto",
127
+ "text-align": "left",
128
+ "float": "none"
129
+ // },
130
+ },
131
+ "&.paragraph": {
132
+ 'max-width': "35%"
133
+ }
134
+ },
135
+
136
+
121
137
  }
122
138
  }]
123
139
  ]];
@@ -1,4 +1,4 @@
1
- "vcl/ui/LargeIcon, vcl/ui/Node, vcl/ui/FormContainer, vcl/ui/Node.closeable";
1
+ "vcl/ui/LargeIcon, vcl/ui/Node, vcl/ui/FormContainer, vcl/ui/Node-closeable";
2
2
 
3
3
  var Node = require("vcl/ui/Node");
4
4
  var FormContainer = require("vcl/ui/FormContainer");
@@ -219,7 +219,7 @@ var Handlers = {
219
219
  }
220
220
  };
221
221
 
222
- ["", {
222
+ [(""), {
223
223
  vars: {
224
224
  "App": {
225
225
  getState: function() {
@@ -297,22 +297,16 @@ var Handlers = {
297
297
  }
298
298
  }
299
299
  },
300
- onMessage: function(name, params, sender) {
300
+ onMessage: function(name, message, sender) {
301
301
  var scope = this.getScope();
302
302
 
303
303
  if(name === "openform") {
304
- var Node = require("vcl/ui/Node.closeable");
304
+ var Node = require("vcl/ui/Node-closeable");
305
305
  var FormContainer = require("vcl/ui/FormContainer");
306
306
 
307
307
  // TODO Merge with Portal
308
308
 
309
- var parent = params.parent || scope.tree.getSelection()[0];
310
-
311
- // TODO find the correct parent based upon the sender
312
- // while(parent && parent.getVar("control")._form !== sender._owner) {
313
- // parent = parent._parent;
314
- // }
315
-
309
+ var parent = message.parent || scope.tree.getSelection()[0];
316
310
  var node = new Node(this);
317
311
  node.override({
318
312
  onclick: function(evt) {
@@ -326,21 +320,22 @@ var Handlers = {
326
320
  node.addClass("closeable");
327
321
 
328
322
  var container = new FormContainer(node);
329
- container.setFormUri(params.uri);
330
- if(params.params) {
331
- container.setFormParams(params.params);
332
- node.setVars(params.params);
323
+ container.setFormUri(message.uri);
324
+ if(message.params) {
325
+ container.setFormParams(message.params);
326
+ node.setVars(message.params);
333
327
  }
334
328
 
335
- if(params.path) {
336
- node.print("varring path", params.path);
337
- node.vars("path", params.path);
329
+ if(message.path) {
330
+ node.print("varring path", message.path);
331
+ node.vars("path", message.path);
338
332
  }
339
333
 
340
334
  // @overrides ui/forms/Home<>
341
335
  container.setVisible(false);
342
336
  container.setParent(scope.client);
343
- node.setText(params.text || params.title || "&nbsp;");
337
+
338
+ node.setText(message.text || message.title || "&nbsp;");
344
339
  node.setVar("control", container);
345
340
  node.setParent(parent || scope.tree);
346
341
  node.update(function() {
@@ -354,12 +349,12 @@ var Handlers = {
354
349
  },
355
350
  "formloadstart": function() {
356
351
  node.addClass("loading");
357
- node.setText(params.title || "&nbsp;");
352
+ node.setText(message.title || "&nbsp;");
358
353
  },
359
354
  "formloadend": function() {
360
355
  node.removeClass("loading");
361
- if(params.callback) {
362
- params.callback(this._form);
356
+ if(message.callback) {
357
+ message.callback(this._form);
363
358
  }
364
359
  },
365
360
  "formload": function() {
@@ -370,7 +365,7 @@ var Handlers = {
370
365
  if (text instanceof Array) {
371
366
  node.setText(text.join(""));
372
367
  } else {
373
- node.setText(String.format("%H", text || params.title));
368
+ node.setText(String.format("%H", text || message.title));
374
369
  }
375
370
  }
376
371
  form.on("captionchanged", f);
@@ -382,17 +377,17 @@ var Handlers = {
382
377
  parent.setExpanded(true);
383
378
  }
384
379
 
385
- if(params.activate !== false) {
380
+ if(message.activate !== false) {
386
381
  scope.tree.setSelection([node]);
387
- } else if(params.lazyLoad !== true) {
382
+ } else if(message.lazyLoad !== true) {
388
383
  container.forceLoad();
389
384
  }
390
385
 
391
- parent && parent.setTimeout("update", () => {
392
- // Hmprf, what is going on here?
393
- parent._parent.updateChildren(true, true);
394
- parent._parent.updateChildren(true, true);
395
- }, 500);
386
+ // parent && parent.setTimeout("update", () => {
387
+ // // Hmprf, what is going on here?
388
+ // parent._parent.updateChildren(true, true);
389
+ // parent._parent.updateChildren(true, true);
390
+ // }, 500);
396
391
 
397
392
  return true;
398
393
  }
@@ -407,11 +402,11 @@ var Handlers = {
407
402
  "padding-left": "16px",
408
403
  ".{./Node}": {
409
404
  "&.loading": {
410
- "background-image": "url(/shared/vcl/images/loading.gif)",
411
- "background-repeat": "no-repeat",
412
- "background-position": "-8px 4px",
413
405
  ">.selection": {
414
- "opacity": "0.5"
406
+ "background-image": "url(/shared/vcl/images/loading.gif)",
407
+ "background-repeat": "no-repeat",
408
+ "background-position": "10px 5px",
409
+ // "opacity": "0.5"
415
410
  },
416
411
  "&.selected >.text": {
417
412
  "font-weight": "normal"
package/src/ui/Select.js CHANGED
@@ -79,7 +79,8 @@ define(function(require) {
79
79
  type: Type.EVENT
80
80
  },
81
81
  "options": {
82
- type: Type.ARRAY
82
+ type: Type.ARRAY,
83
+ set: Function
83
84
  },
84
85
  "value": {
85
86
  type: Type.STRING,