jsgui3-server 0.0.119 → 0.0.121

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 (75) hide show
  1. package/examples/boxes/square_boxes.js +3 -0
  2. package/examples/boxes/square_boxes_client.js +5 -1
  3. package/examples/controls/11) window, mirrored text fields/client.js +31 -273
  4. package/examples/controls/11b) window, shared Data_Object model mirrored text fields/client.js +331 -0
  5. package/examples/controls/{11b) window, shared model mirrored text fields → 11c) window, shared Data_Value model mirrored text fields}/client.js +17 -7
  6. package/examples/controls/11c) window, shared Data_Value model mirrored text fields/server.js +118 -0
  7. package/examples/controls/11d) window, shared model mirrored integer text fields/both.js +17 -0
  8. package/examples/controls/11d) window, shared model mirrored integer text fields/client.js +280 -0
  9. package/examples/controls/11d) window, shared model mirrored integer text fields/server.js +23 -0
  10. package/examples/controls/12) window, Select_Options control/client.js +17 -0
  11. package/examples/controls/13) window, shared model mirrored lat_long/client.js +933 -0
  12. package/examples/controls/13) window, shared model mirrored lat_long/server.js +50 -0
  13. package/examples/controls/14) window, control compositional model/client.js +328 -0
  14. package/examples/controls/14) window, control compositional model/server.js +118 -0
  15. package/examples/controls/14a) window, control spec has compositional model/client.js +440 -0
  16. package/examples/controls/14a) window, control spec has compositional model/server.js +118 -0
  17. package/examples/controls/15) window, text field/client.js +256 -0
  18. package/examples/controls/15) window, text field/server.js +39 -0
  19. package/examples/controls/16) Window([Text_Input])/client.js +266 -0
  20. package/examples/controls/16) Window([Text_Input])/server.js +109 -0
  21. package/examples/controls/16a) Window([Text_Input]) Integer data.model.data_type/client.js +494 -0
  22. package/examples/controls/16a) Window([Text_Input]) Integer data.model.data_type/isomorphic.js +24 -0
  23. package/examples/controls/16a) Window([Text_Input]) Integer data.model.data_type/server.js +73 -0
  24. package/examples/controls/2b) two window, context menus/client.js +193 -0
  25. package/examples/controls/2b) two window, context menus/server.js +114 -0
  26. package/examples/controls/3) five windows/server.js +0 -1
  27. package/examples/controls/4) window, tabbed panel/client.js +15 -2
  28. package/examples/controls/4a) window, tabbed panel with various controls inside/client.js +233 -0
  29. package/examples/controls/4a) window, tabbed panel with various controls inside/server.js +118 -0
  30. package/examples/controls/5) window, grid/client.js +289 -9
  31. package/examples/controls/5) window, grid/server.js +2 -0
  32. package/examples/controls/8) window, checkbox/client.js +63 -101
  33. package/package.json +11 -11
  34. package/publishers/http-webpage-publisher.js +4 -5
  35. package/resources/jsbuilder/Abstract_Single_Declaration.js +1 -1
  36. package/resources/jsbuilder/Abstract_Single_Declaration_Sequence.js +1 -1
  37. package/resources/jsbuilder/JS_AST/JS_AST_Node.js +1 -1
  38. package/resources/jsbuilder/JS_AST/JS_AST_Node_0-Core.js +1 -1
  39. package/resources/jsbuilder/JS_AST/JS_AST_Node_1-Babel.js +1 -1
  40. package/resources/jsbuilder/JS_AST/JS_AST_Node_3.6-Basics_Callmap.js +1 -1
  41. package/resources/jsbuilder/JS_AST/JS_AST_Node_4.1-Index.js +1 -1
  42. package/resources/jsbuilder/JS_AST/JS_AST_Node_8-Features.js +1 -1
  43. package/resources/jsbuilder/JS_AST/JS_AST_Node_Feature/JS_AST_Node_Feature_Declaration.js +1 -1
  44. package/resources/jsbuilder/JS_AST/JS_AST_Node_Feature/JS_AST_Node_Feature_Declarator.js +1 -1
  45. package/resources/jsbuilder/JS_AST/JS_AST_Node_Feature/JS_AST_Root_Node_Feature/JS_AST_Root_Node_Feature_Exported.js +1 -1
  46. package/resources/jsbuilder/JS_AST/JS_AST_Node_Feature/JS_AST_Root_Node_Feature/JS_AST_Root_Node_Interpreted.js +1 -1
  47. package/resources/jsbuilder/JS_AST/JS_AST_Relationship_Node_To_Group.js +1 -1
  48. package/resources/jsbuilder/JS_AST/query/enable_array_as_queryable.js +1 -1
  49. package/resources/jsbuilder/JS_AST/query/find_object_keys.js +1 -1
  50. package/resources/jsbuilder/JS_AST_Node_Extended/JS_AST_Node_Declaration.js +1 -1
  51. package/resources/jsbuilder/JS_Builder.js +1 -1
  52. package/resources/jsbuilder/JS_File/JS_File_0-Core.js +1 -1
  53. package/resources/jsbuilder/JS_File/JS_File_2-Babel.js +1 -1
  54. package/resources/jsbuilder/JS_File/JS_File_4-Query.js +1 -1
  55. package/resources/jsbuilder/JS_File/JS_File_4.1-Query_Features.js +1 -1
  56. package/resources/jsbuilder/JS_File/JS_File_5-Planning.js +1 -1
  57. package/resources/jsbuilder/JS_File/JS_File_6-Changing.js +1 -1
  58. package/resources/jsbuilder/JS_File/JS_Files.js +1 -1
  59. package/resources/jsbuilder/Platform.js +1 -1
  60. package/resources/jsbuilder/Platforms.js +1 -1
  61. package/resources/jsbuilder/Project.js +1 -1
  62. package/resources/jsbuilder/Scope.js +1 -1
  63. package/resources/jsbuilder/_JS_File.js +1 -1
  64. package/resources/jsbuilder/babel/babel_node_tools.js +1 -1
  65. package/resources/jsbuilder/babel/deep_iterate/deep_iterate_babel.js +6 -2
  66. package/resources/jsbuilder/test/test_ast_node.js +1 -1
  67. package/resources/jsbuilder/test/test_js_file.js +2 -2
  68. package/resources/jsbuilder/test/test_project.js +1 -1
  69. package/resources/process-js.js +1 -1
  70. package/resources/processors/bundlers/js/esbuild/Advanced_JS_Bundler_Using_ESBuild.js +9 -6
  71. package/resources/processors/bundlers/js/esbuild/Core_JS_Single_File_Minifying_Bundler_Using_ESBuild.js +2 -1
  72. package/resources/processors/bundlers/test_ast.js +1 -1
  73. package/resources/processors/extractors/Extractor.js +3 -1
  74. package/resources/processors/extractors/js/css_and_js/AST_Node/CSS_And_JS_From_JS_String_Using_AST_Node_Extractor.js +19 -4
  75. /package/examples/controls/{11b) window, shared model mirrored text fields → 11b) window, shared Data_Object model mirrored text fields}/server.js +0 -0
@@ -3,6 +3,9 @@ const jsgui = require('./square_boxes_client');
3
3
  const {Demo_UI, Square_Box} = jsgui.controls;
4
4
  const Server = require('./../../server');
5
5
 
6
+
7
+
8
+
6
9
  // Want to exclude this from the client bundle.
7
10
  // Some kind of marking to say that it's server-side only?
8
11
 
@@ -3,6 +3,8 @@ const {controls, Control, mixins} = jsgui;
3
3
  const {dragable} = mixins;
4
4
 
5
5
 
6
+ const Active_HTML_Document = require('../../controls/Active_HTML_Document');
7
+
6
8
  class Square_Box extends Control {
7
9
  constructor(spec) {
8
10
  spec.__type_name = spec.__type_name || 'square_box';
@@ -40,7 +42,9 @@ Square_Box.css = `
40
42
 
41
43
  // Relies on extracting CSS from JS files.
42
44
 
43
- class Demo_UI extends Control {
45
+ // Active_HTML_Document
46
+
47
+ class Demo_UI extends Active_HTML_Document {
44
48
  constructor(spec = {}) {
45
49
  spec.__type_name = spec.__type_name || 'demo_ui';
46
50
  super(spec);
@@ -2,118 +2,22 @@ const jsgui = require('jsgui3-client');
2
2
  const {controls, Control, mixins} = jsgui;
3
3
  const {dragable} = mixins;
4
4
 
5
-
6
- const {Checkbox, Date_Picker, Text_Input, Text_Field} = controls;
7
-
8
- const Active_HTML_Document = require('../../../controls/Active_HTML_Document');
9
-
10
- // Will make Date_Picker use progressive enhancement.
11
- // On activation would create a new element? Create a new sibling?
12
- // May want code that checks for .el being changed.
13
-
14
-
15
- /*
16
- Though this works through simple principles, it may be much better to do data binding with a shared ctrl.data.model.
17
- Want the top-level code to be really simple and intuitive when specifying data flows, and when not specifying them
18
- using sensible defaults.
19
-
20
- The granularity between data.model and view.model should help a lot.
21
-
22
- // Also data.model.value being a possible default.
23
- // Data models will become more advanced and capable of holding multiple values.
24
- // For the moment, although the Control_Data and Control_View classes exist, will continue with a POJO.
25
- // Then could later work on getter / setters for when a data.model or a view.model gets changed.
26
-
27
-
28
-
29
- Also should work on functional constraints or / and class based constraints for fields / text fields.
30
- // Both for data in the system, as well as in the UI.
31
- // Could integrate a bit more with data types / class data types.
32
-
33
- // Typed_Data_Value perhaps.
34
-
35
- // Anyway, want to set things up better with the .view.model and .data.model system.
36
-
37
- // Then later support more complex (and / or app-defined) data and view models.
38
-
39
- // Defining what the underlying data of the app is could help (a lot).
40
- // Some data may be for editing, some not.
41
-
42
- // A data model could have a bunch of news articles, and be set up so that they can be viewed nicely.
43
- // Would not be so important to edit the articles themselves, though maybe the user may want to tag them
44
- // and comment on them.
45
-
46
- // Mid-level complexity handling a fair bit of what needs to happen with multiple models, how updates get sequenced
47
- // but then at a high level code must be really simple.
48
- // Could distinguish between view and data models at high level - may help a lot in some cases.
49
- // However, will generally assume a shared data model between controls, not a shared view model, and the data model
50
- // will be updated with at least some small / sensible hesitation.
51
- // Maybe even define the update hesitations / update hesitation mode.
52
- // Data Model Update Hesitation Mode???
53
-
54
- // View Model To Data Model Syncing Update Hesitation Mode???
55
- // really explicit names on the more complex mid level will help the code and system to make sense.
56
-
57
- // syncing.view_to_data.hesitation = 'leave-control' ????
58
- // And could have that one as the default.
59
- // Or could hesitate / debounce 250ms for example.
60
- // Very very explicit on the more complex mid / lower level, so that it's really simple on the higher level,
61
- // and can (quickly?) get into more explicit details when needed.
62
-
63
- // Data model syncing seems best in general.
64
- // Then sync data model changes immediately to view models.
65
- // Then only sync view model changes to data model after necessary hesitation / event / confirmation.
66
- // Also be able to cancel view model changes (load values back from data model possibly, some contexts makes a lot more sense)
67
-
68
-
69
- // The view model is essentially internal to the control - though maybe it would integrate with a whole Page_Context view
70
- // model that's for all the controls...?
71
-
72
- // Internal and separate view models for the controls seems best for the moment.
73
- // Could always use refs to some place else.
74
-
75
- // Have the controls automatically create their view model.
76
-
77
- // Some controls should not determine the data model at application (or larger control) start.
78
- // Maybe some should?
79
-
80
- // Or better to change it so that the Data_Model gets set first, then all the controls given access to it at start (on server)
81
- // and get rendered on the server with the correct data, then on the client it only sets the view_model at the start.
82
- // Or does it???
83
- // Want different sensible options for getting that Data_Model to the client. Maybe getting the View_Model to the client????
84
-
85
- // Make it simple and easy to code on the top level API.
86
-
87
-
88
-
89
-
90
-
91
-
5
+ // Compositional model could / would help here too....
6
+ // Integrating compositional and data models seems more useful overall....
92
7
 
93
8
 
94
9
 
10
+ // And some kind of data.view / data.representation
11
+ // data.representation as a format / different type.
95
12
 
96
13
 
97
14
 
98
15
 
99
16
 
100
17
 
18
+ const {Checkbox, Date_Picker, Text_Input, Text_Field} = controls;
101
19
 
102
-
103
-
104
-
105
-
106
-
107
-
108
-
109
-
110
-
111
-
112
- */
113
-
114
-
115
-
116
-
20
+ const Active_HTML_Document = require('../../../controls/Active_HTML_Document');
117
21
 
118
22
  class Demo_UI extends Active_HTML_Document {
119
23
  constructor(spec = {}) {
@@ -164,21 +68,6 @@ class Demo_UI extends Active_HTML_Document {
164
68
 
165
69
  window.size = [480, 160];
166
70
 
167
- // Without specifying the data model.
168
- // Should be able to use and refer to data and view models even when not specified.
169
- // Want this complexity on the lower level to enable simple (but not overly simple/simplstic) higher level programming.
170
-
171
-
172
-
173
- // Should set up its data model automatically if not specified here.
174
- // An independent data model, specifically for that text field.
175
-
176
- // Or in the data.model.label_text perhaps?
177
-
178
- // Want to make it easy to make and use somewhat more complex and expressive structures.
179
-
180
- // The text label makes more sense being in the view.data.model???
181
-
182
71
  const ti1 = new Text_Field({
183
72
  context,
184
73
  text: 'A'
@@ -214,37 +103,10 @@ class Demo_UI extends Active_HTML_Document {
214
103
  compose();
215
104
  this.add_change_listeners();
216
105
  }
217
-
218
-
219
- // Can respond to / deal with changes to the data models here, not only when activated.
220
- // The data.model and view.model system seems to offer some higher level improved programming by putting
221
- // more in the constructor. Maybe the activated code ('.activate') would not be needed on higher level controls,
222
- // because the lower level ones will connect it all up the the dom <> view <> data models / system.
223
-
224
- // It even has a 'dom model' too, of sorts ????
225
- // Though currently it's not named that or considered that throughout the code there.
226
- // Could be worth moding to dom.model
227
- // then view.model
228
- // then data.model
229
-
230
- // Could be a structure that better supports non-dom models.
231
- // Though in this case, it would no yet have the refs to all the child things????
232
-
233
- // Getting that back in the 'compose' or 'recompose' stage could help.
234
- // Though it's currently auto-recompose pre activate.
235
-
236
- // Maybe want code to run either when activated, or post-compose.
237
- // add_change_listeners.
238
-
239
- // Would be run server-side after compose (or when composing it like that on the client)
240
- // but when it gets recomosed on the client-side would need to run then instead.
241
-
242
106
 
243
-
244
-
245
-
246
-
247
-
107
+ // Should have the listeners all the time????
108
+ // ie in the constructor, called both on client and server....?
109
+ //this.add_change_listeners();
248
110
 
249
111
 
250
112
 
@@ -253,24 +115,36 @@ class Demo_UI extends Active_HTML_Document {
253
115
  add_change_listeners() {
254
116
  const {ti1, ti2} = this;
255
117
 
256
- // Need to fix the text_field data model and view model system.
118
+ // Looks like when the view data model updates, it's still not updating the UI.
119
+
120
+
121
+
257
122
 
258
- //console.log('add_change_listeners');
259
123
  ti1.data.model.on('change', e => {
260
- //console.log('ti1 e', e);
124
+ console.log('ti1 e', e);
261
125
  if (e.name === 'value') {
262
- if (e.value !== e.old) {
126
+
127
+
128
+ //if (e.value !== e.old) {
129
+ console.log('pre set ti2.data.model.value = e.value', e.value);
263
130
  ti2.data.model.value = e.value;
264
- }
131
+
132
+ console.log('ti2.data.model.value', ti2.data.model.value);
133
+ console.log('ti2.view.data.model.value', ti2.view.data.model.value);
134
+ //}
265
135
  }
266
136
  });
267
137
 
268
138
  ti2.data.model.on('change', e => {
269
- //console.log('ti2 e', e);
139
+ console.log('ti2 e', e);
270
140
  if (e.name === 'value') {
271
- if (e.value !== e.old) {
141
+ //if (e.value !== e.old) {
142
+ console.log('pre set ti1.data.model.value = e.value', e.value);
272
143
  ti1.data.model.value = e.value;
273
- }
144
+
145
+ console.log('ti1.data.model.value', ti1.data.model.value);
146
+ console.log('ti1.view.data.model.value', ti1.view.data.model.value);
147
+ //}
274
148
  }
275
149
  });
276
150
 
@@ -282,130 +156,14 @@ class Demo_UI extends Active_HTML_Document {
282
156
  super.activate();
283
157
  const {context, ti1, ti2} = this;
284
158
 
285
- this.add_change_listeners();
159
+
286
160
 
287
161
 
288
162
  console.log('activate Demo_UI');
289
- // and events dealing with changes to those tis.
290
-
291
- // ti1, ti2.
292
-
293
- // Some kind of tracking of what the event initiator could help?
294
- // Automatically avoiding feedback somehow???
295
- // If it gets changed to its current value it does not push the change...?
296
-
297
-
298
- // a non-dom change???
299
- // or basically .view.model.change even????
300
-
301
- // ti1.view.model.on('change') could be much clearer, disambiguating it from a dom change event.
302
- // assign .view.model events ....?
303
- // doing this on a lower level would help.
304
-
305
- // Just creating .view and .view.model objects (getters and setters specified) in jsgui3-html will help
306
- // when referring to them.
307
-
308
-
309
-
310
-
311
- // ti1.value.on('change') ????
312
- // where the value is an Evented_Class or even Data_Object????
313
- // and where we can also get the value out of it easily / do so automatically, maybe within other useful functions.
314
-
315
-
316
- // ti1.model.on('change') ????
317
- // or .view.model to be most specific for the moment...?
318
- // and raise those events within the controls on those .view.model objects.
319
-
320
- // Maybe just try it on Text_Field for the moment.
321
-
322
-
323
-
324
- // Need to work on having it update the dom with value changes....
325
-
326
- // .data.model change instead.
327
- // referring to a .data.model does seem like a more explicit way to do it.
328
- // definitely looks like a good way to avoid confusion, at a small cost of more code to write.
329
-
330
- /*
331
-
332
- ti1.data.model.on('change', e => {
333
- console.log('ti1.data.model change e', e);
334
-
335
-
336
-
337
-
338
- if (e.name === 'value') {
339
- if (e.value !== e.old) {
340
- ti2.data.model.value = e.value;
341
- }
342
- }
343
-
344
- // setting ti2.view.model.value even????
345
-
346
-
347
-
348
-
349
- })
350
- ti2.data.model.on('change', e => {
351
- console.log('ti2.data.model change e', e);
352
-
353
- //
354
-
355
- if (e.name === 'value') {
356
- if (e.value !== e.old) {
357
- ti1.data.model.value = e.value;
358
- }
359
- }
360
-
361
-
362
-
363
-
364
- })
365
- */
366
-
367
- // listen for change events.
368
- // would be nice to know which change events originated from the user interacting with that specific HTML element (or ctrl???)
369
-
370
- // e.from_user === true test.
371
-
372
- // e.user_initiated_on_this ????
373
-
374
-
375
-
376
-
377
- //console.log('activate Demo_UI');
378
- // listen for the context events regarding frames, changes, resizing.
379
163
 
164
+ this.add_change_listeners();
380
165
  context.on('window-resize', e_resize => {
381
166
 
382
- // Could see about having some window contents bound through CSS to the size of the window.
383
- // Though having a framework of adjusting CSS from the JS on-the-fly could work too.
384
-
385
- // May be done with the 'bind' mixin, or will make more specific mixins to do things like bind
386
- // a control to the space within another control, space within a specific part of that control.
387
-
388
- // Or bind to parent size. That should be possible with CSS though.
389
- // May make some controls make more use of CSS by default
390
- // Or having an absolutely positioned box model used extensively could avoid some ambiguity, though
391
- // making use of and supporting generally respected CSS features will help too.
392
-
393
- //console.log('window-resize', e_resize);
394
-
395
- // Make all internal controls go absolute in terms of position
396
- // Remove them from their containers too?
397
- // Ie their containing divs?
398
-
399
- // Would be nice to do this really simple with a fn call or very simple piece of code.
400
- // Like get absolute position, set position to be absolute, move to that position.
401
- // Maybe something within jsgui3-client helps with this, this is more about what needs to be done on the client.
402
- // Though recognising perf implications, it's (more) OK to include client-side functionality in jsgui3-html.
403
-
404
-
405
-
406
-
407
-
408
-
409
167
  });
410
168
 
411
169
  }