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.
- package/examples/boxes/square_boxes.js +3 -0
- package/examples/boxes/square_boxes_client.js +5 -1
- package/examples/controls/11) window, mirrored text fields/client.js +31 -273
- package/examples/controls/11b) window, shared Data_Object model mirrored text fields/client.js +331 -0
- package/examples/controls/{11b) window, shared model mirrored text fields → 11c) window, shared Data_Value model mirrored text fields}/client.js +17 -7
- package/examples/controls/11c) window, shared Data_Value model mirrored text fields/server.js +118 -0
- package/examples/controls/11d) window, shared model mirrored integer text fields/both.js +17 -0
- package/examples/controls/11d) window, shared model mirrored integer text fields/client.js +280 -0
- package/examples/controls/11d) window, shared model mirrored integer text fields/server.js +23 -0
- package/examples/controls/12) window, Select_Options control/client.js +17 -0
- package/examples/controls/13) window, shared model mirrored lat_long/client.js +933 -0
- package/examples/controls/13) window, shared model mirrored lat_long/server.js +50 -0
- package/examples/controls/14) window, control compositional model/client.js +328 -0
- package/examples/controls/14) window, control compositional model/server.js +118 -0
- package/examples/controls/14a) window, control spec has compositional model/client.js +440 -0
- package/examples/controls/14a) window, control spec has compositional model/server.js +118 -0
- package/examples/controls/15) window, text field/client.js +256 -0
- package/examples/controls/15) window, text field/server.js +39 -0
- package/examples/controls/16) Window([Text_Input])/client.js +266 -0
- package/examples/controls/16) Window([Text_Input])/server.js +109 -0
- package/examples/controls/16a) Window([Text_Input]) Integer data.model.data_type/client.js +494 -0
- package/examples/controls/16a) Window([Text_Input]) Integer data.model.data_type/isomorphic.js +24 -0
- package/examples/controls/16a) Window([Text_Input]) Integer data.model.data_type/server.js +73 -0
- package/examples/controls/2b) two window, context menus/client.js +193 -0
- package/examples/controls/2b) two window, context menus/server.js +114 -0
- package/examples/controls/3) five windows/server.js +0 -1
- package/examples/controls/4) window, tabbed panel/client.js +15 -2
- package/examples/controls/4a) window, tabbed panel with various controls inside/client.js +233 -0
- package/examples/controls/4a) window, tabbed panel with various controls inside/server.js +118 -0
- package/examples/controls/5) window, grid/client.js +289 -9
- package/examples/controls/5) window, grid/server.js +2 -0
- package/examples/controls/8) window, checkbox/client.js +63 -101
- package/package.json +11 -11
- package/publishers/http-webpage-publisher.js +4 -5
- package/resources/jsbuilder/Abstract_Single_Declaration.js +1 -1
- package/resources/jsbuilder/Abstract_Single_Declaration_Sequence.js +1 -1
- package/resources/jsbuilder/JS_AST/JS_AST_Node.js +1 -1
- package/resources/jsbuilder/JS_AST/JS_AST_Node_0-Core.js +1 -1
- package/resources/jsbuilder/JS_AST/JS_AST_Node_1-Babel.js +1 -1
- package/resources/jsbuilder/JS_AST/JS_AST_Node_3.6-Basics_Callmap.js +1 -1
- package/resources/jsbuilder/JS_AST/JS_AST_Node_4.1-Index.js +1 -1
- package/resources/jsbuilder/JS_AST/JS_AST_Node_8-Features.js +1 -1
- package/resources/jsbuilder/JS_AST/JS_AST_Node_Feature/JS_AST_Node_Feature_Declaration.js +1 -1
- package/resources/jsbuilder/JS_AST/JS_AST_Node_Feature/JS_AST_Node_Feature_Declarator.js +1 -1
- package/resources/jsbuilder/JS_AST/JS_AST_Node_Feature/JS_AST_Root_Node_Feature/JS_AST_Root_Node_Feature_Exported.js +1 -1
- package/resources/jsbuilder/JS_AST/JS_AST_Node_Feature/JS_AST_Root_Node_Feature/JS_AST_Root_Node_Interpreted.js +1 -1
- package/resources/jsbuilder/JS_AST/JS_AST_Relationship_Node_To_Group.js +1 -1
- package/resources/jsbuilder/JS_AST/query/enable_array_as_queryable.js +1 -1
- package/resources/jsbuilder/JS_AST/query/find_object_keys.js +1 -1
- package/resources/jsbuilder/JS_AST_Node_Extended/JS_AST_Node_Declaration.js +1 -1
- package/resources/jsbuilder/JS_Builder.js +1 -1
- package/resources/jsbuilder/JS_File/JS_File_0-Core.js +1 -1
- package/resources/jsbuilder/JS_File/JS_File_2-Babel.js +1 -1
- package/resources/jsbuilder/JS_File/JS_File_4-Query.js +1 -1
- package/resources/jsbuilder/JS_File/JS_File_4.1-Query_Features.js +1 -1
- package/resources/jsbuilder/JS_File/JS_File_5-Planning.js +1 -1
- package/resources/jsbuilder/JS_File/JS_File_6-Changing.js +1 -1
- package/resources/jsbuilder/JS_File/JS_Files.js +1 -1
- package/resources/jsbuilder/Platform.js +1 -1
- package/resources/jsbuilder/Platforms.js +1 -1
- package/resources/jsbuilder/Project.js +1 -1
- package/resources/jsbuilder/Scope.js +1 -1
- package/resources/jsbuilder/_JS_File.js +1 -1
- package/resources/jsbuilder/babel/babel_node_tools.js +1 -1
- package/resources/jsbuilder/babel/deep_iterate/deep_iterate_babel.js +6 -2
- package/resources/jsbuilder/test/test_ast_node.js +1 -1
- package/resources/jsbuilder/test/test_js_file.js +2 -2
- package/resources/jsbuilder/test/test_project.js +1 -1
- package/resources/process-js.js +1 -1
- package/resources/processors/bundlers/js/esbuild/Advanced_JS_Bundler_Using_ESBuild.js +9 -6
- package/resources/processors/bundlers/js/esbuild/Core_JS_Single_File_Minifying_Bundler_Using_ESBuild.js +2 -1
- package/resources/processors/bundlers/test_ast.js +1 -1
- package/resources/processors/extractors/Extractor.js +3 -1
- package/resources/processors/extractors/js/css_and_js/AST_Node/CSS_And_JS_From_JS_String_Using_AST_Node_Extractor.js +19 -4
- /package/examples/controls/{11b) window, shared model mirrored text fields → 11b) window, shared Data_Object model mirrored text fields}/server.js +0 -0
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
const jsgui = require('jsgui3-client');
|
|
2
|
+
const {controls, Control, mixins, Data_Value, Functional_Data_Type} = jsgui;
|
|
3
|
+
const {dragable} = mixins;
|
|
4
|
+
|
|
5
|
+
const {Checkbox, Date_Picker, Text_Input, Text_Field} = controls;
|
|
6
|
+
|
|
7
|
+
const Active_HTML_Document = require('../../../controls/Active_HTML_Document');
|
|
8
|
+
|
|
9
|
+
const {create_demo_ui_data_model} = require('./both');
|
|
10
|
+
|
|
11
|
+
// Could do with further low / mid level fixes.
|
|
12
|
+
// Easy integration of validation status indicators would help too.
|
|
13
|
+
|
|
14
|
+
// What gets validated, according to what???
|
|
15
|
+
// Will need to look again at what happens when set ((.)value) and .attempt_set is called.
|
|
16
|
+
|
|
17
|
+
// Need to go further into the underlying framework to make sure everything works correctly.
|
|
18
|
+
|
|
19
|
+
// Clarity about what gets validated according to what.
|
|
20
|
+
// Transferrance / syncing of data between different layers.
|
|
21
|
+
|
|
22
|
+
const demo_ui_data_model = create_demo_ui_data_model();
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class Demo_UI extends Active_HTML_Document {
|
|
26
|
+
|
|
27
|
+
constructor(spec = {}) {
|
|
28
|
+
spec.__type_name = spec.__type_name || 'demo_ui';
|
|
29
|
+
super(spec);
|
|
30
|
+
const {context} = this;
|
|
31
|
+
|
|
32
|
+
if (!demo_ui_data_model.context) {
|
|
33
|
+
demo_ui_data_model.context = context;
|
|
34
|
+
|
|
35
|
+
// And register the control / data_model within the context...?
|
|
36
|
+
|
|
37
|
+
//context.register_data_model(demo_ui_data_model);
|
|
38
|
+
// and then reconstitute / recombine / recohere on the client-side.
|
|
39
|
+
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
context.register_data_model(demo_ui_data_model);
|
|
43
|
+
|
|
44
|
+
console.log('demo_ui_data_model.__id', demo_ui_data_model.__id);
|
|
45
|
+
//
|
|
46
|
+
|
|
47
|
+
console.log('client.js Demo_UI constructor context.map_data_models', context.map_data_models);
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
// At this point have access to the context, in terms of easily adding code.
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
// Some kind of possible client-side and maybe server-side connecting with the context?
|
|
54
|
+
|
|
55
|
+
if (typeof this.body.add_class === 'function') {
|
|
56
|
+
this.body.add_class('demo-ui');
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
//console.log('this.body', this.body);
|
|
60
|
+
//console.log('this.body.add_class', this.body.add_class);
|
|
61
|
+
|
|
62
|
+
// Making it deal with cohering the data models as they get made on the server and sent to the client.
|
|
63
|
+
// So needs to render data model references.
|
|
64
|
+
// Where possible / appropriate.
|
|
65
|
+
|
|
66
|
+
// And when a control's data.model is set, when rendering it render the data-jsgui-data-model-id or data-jsgui-data-model
|
|
67
|
+
// attributes.
|
|
68
|
+
|
|
69
|
+
// Rendering data-model references in the HTML will be helpful.
|
|
70
|
+
// Would need to have them created in the context uniformly / isomorplically.
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
// .has_own_data_model???
|
|
75
|
+
// rather than creating one when getting .data
|
|
76
|
+
// .has_own_data perhaps?
|
|
77
|
+
|
|
78
|
+
// during the rendering part it could automatically render it's data-model-id??
|
|
79
|
+
// and a separate view data model id????
|
|
80
|
+
|
|
81
|
+
// No, don't persist the view data model ids / references to the client (yet).
|
|
82
|
+
|
|
83
|
+
//
|
|
84
|
+
|
|
85
|
+
// Get into the ctrl rendering then....
|
|
86
|
+
|
|
87
|
+
const compose = () => {
|
|
88
|
+
// Composition model would make it more concise here.
|
|
89
|
+
// Then have some kind of data model coherence when a compositional model is being used???
|
|
90
|
+
|
|
91
|
+
// However, don't only want to support data things in that way.
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
const window = new controls.Window({
|
|
95
|
+
context: context,
|
|
96
|
+
title: 'jsgui3-html Shared data.model integer Mirrored Text_Input controls',
|
|
97
|
+
pos: [5, 5]
|
|
98
|
+
});
|
|
99
|
+
window.size = [480, 160];
|
|
100
|
+
|
|
101
|
+
const ti1 = new Text_Field({
|
|
102
|
+
context,
|
|
103
|
+
|
|
104
|
+
text: 'A',
|
|
105
|
+
data: {
|
|
106
|
+
model: demo_ui_data_model
|
|
107
|
+
|
|
108
|
+
// model: [this.data.model, 'value'] // this seems better
|
|
109
|
+
|
|
110
|
+
// model_property: 'value'
|
|
111
|
+
// model_property: 'value2' // for example
|
|
112
|
+
}
|
|
113
|
+
//label: {
|
|
114
|
+
// text: 'A checkbox'
|
|
115
|
+
//}
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
window.inner.add(ti1);
|
|
119
|
+
|
|
120
|
+
console.log('ti1.data.model.__id', ti1.data.model.__id);
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
const ti2 = new Text_Field({
|
|
124
|
+
context,
|
|
125
|
+
|
|
126
|
+
text: 'B',
|
|
127
|
+
data: {
|
|
128
|
+
model: demo_ui_data_model
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
//label: {
|
|
133
|
+
// text: 'A checkbox'
|
|
134
|
+
//}
|
|
135
|
+
})
|
|
136
|
+
|
|
137
|
+
window.inner.add(ti2);
|
|
138
|
+
|
|
139
|
+
console.log('ti2.data.model.__id', ti2.data.model.__id);
|
|
140
|
+
|
|
141
|
+
this.body.add(window);
|
|
142
|
+
|
|
143
|
+
this._ctrl_fields = this._ctrl_fields || {};
|
|
144
|
+
this._ctrl_fields.ti1 = ti1;
|
|
145
|
+
this._ctrl_fields.ti2 = ti2;
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
}
|
|
149
|
+
if (!spec.el) {
|
|
150
|
+
compose();
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
activate() {
|
|
154
|
+
if (!this.__active) {
|
|
155
|
+
super.activate();
|
|
156
|
+
|
|
157
|
+
// What previous activation / recohesion of data should take place before here?
|
|
158
|
+
// Want 'activate' to be fairly high level, with some things already set up as they should be by default automatically.
|
|
159
|
+
|
|
160
|
+
// Have the context activate put some things together, or the context pre-activate.
|
|
161
|
+
|
|
162
|
+
// Need activation to be as simple as possible to code at a higher level.
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
const {context, ti1, ti2} = this;
|
|
167
|
+
|
|
168
|
+
console.log('activate Demo_UI');
|
|
169
|
+
|
|
170
|
+
// See about improving low / mid level data model coherence.
|
|
171
|
+
// Isomorphic of the (empty) app data model?
|
|
172
|
+
// Or in its default / root state?
|
|
173
|
+
|
|
174
|
+
// Persistance and recoherence of data model on the client could help.
|
|
175
|
+
// Keeping them within the context, and having them link with it?
|
|
176
|
+
|
|
177
|
+
// Though to start with, want to define them in an isomorphic way, out of context.
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
const activate_demo_ui_data_model = () => {
|
|
182
|
+
console.log('ti1.data.model === ti2.data.model', ti1.data.model === ti2.data.model);
|
|
183
|
+
|
|
184
|
+
if (ti1.data.model === ti2.data.model) {
|
|
185
|
+
// With this working, seems more like a problem with Data_Value itself when it's not syncing properly.
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
console.log('Nice! The data models are already shared.')
|
|
189
|
+
} else {
|
|
190
|
+
|
|
191
|
+
// Should not need this code.
|
|
192
|
+
// Want decent low/mid level code to send the info to the client so the client can automatically reconstruct it.
|
|
193
|
+
/// Maybe a different function as standard to assign isomorphic things.
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
//const dm = new Data_Value({context,
|
|
199
|
+
// data_type: Functional_Data_Type.integer});
|
|
200
|
+
|
|
201
|
+
// Should be enough here....
|
|
202
|
+
|
|
203
|
+
//field(dm, 'value');
|
|
204
|
+
console.log('demo_ui_data_model', demo_ui_data_model);
|
|
205
|
+
|
|
206
|
+
ti2.data.model = ti1.data.model = demo_ui_data_model;
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
activate_demo_ui_data_model();
|
|
213
|
+
|
|
214
|
+
context.on('window-resize', e_resize => {
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
Demo_UI.css = `
|
|
224
|
+
|
|
225
|
+
* {
|
|
226
|
+
margin: 0;
|
|
227
|
+
padding: 0;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
body {
|
|
231
|
+
overflow-x: hidden;
|
|
232
|
+
overflow-y: hidden;
|
|
233
|
+
background-color: #E0E0E0;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.demo-ui {
|
|
237
|
+
|
|
238
|
+
/*
|
|
239
|
+
|
|
240
|
+
display: flex;
|
|
241
|
+
flex-wrap: wrap;
|
|
242
|
+
|
|
243
|
+
flex-direction: column;
|
|
244
|
+
justify-content: center;
|
|
245
|
+
align-items: center;
|
|
246
|
+
text-align: center;
|
|
247
|
+
min-height: 100vh;
|
|
248
|
+
*/
|
|
249
|
+
|
|
250
|
+
}
|
|
251
|
+
`;
|
|
252
|
+
|
|
253
|
+
// But may want to remove them from that flex upon picking up / dropping them.
|
|
254
|
+
// Maybe best upon drop.
|
|
255
|
+
|
|
256
|
+
// Maybe want other examples that use absolute positioning to position the items at the start?
|
|
257
|
+
//
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
//controls.Square_Box = Square_Box;
|
|
262
|
+
// could export jsgui with the updated controls....
|
|
263
|
+
// so that they are in the correct Page Context.?
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
controls.Demo_UI = Demo_UI;
|
|
267
|
+
|
|
268
|
+
module.exports = jsgui;
|
|
269
|
+
|
|
270
|
+
/*
|
|
271
|
+
module.exports = {
|
|
272
|
+
Square_Box: Square_Box,
|
|
273
|
+
Demo_UI: Demo_UI
|
|
274
|
+
}
|
|
275
|
+
*/
|
|
276
|
+
|
|
277
|
+
// Then if window...?
|
|
278
|
+
|
|
279
|
+
// Need to add the Square_Box control to the context or original map of controls...
|
|
280
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const jsgui = require('./client');
|
|
2
|
+
|
|
3
|
+
const {Demo_UI} = jsgui.controls;
|
|
4
|
+
const Server = require('../../../server');
|
|
5
|
+
|
|
6
|
+
if (require.main === module) {
|
|
7
|
+
const server = new Server({
|
|
8
|
+
Ctrl: Demo_UI,
|
|
9
|
+
//debug: true,
|
|
10
|
+
'src_path_client_js': require.resolve('./client.js')
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
server.one('ready', () => {
|
|
14
|
+
|
|
15
|
+
server.start(8080, function (err, cb_start) {
|
|
16
|
+
if (err) {
|
|
17
|
+
throw err;
|
|
18
|
+
} else {
|
|
19
|
+
console.log('server started');
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
}
|
|
@@ -103,6 +103,23 @@ const Active_HTML_Document = require('../../../controls/Active_HTML_Document');
|
|
|
103
103
|
|
|
104
104
|
|
|
105
105
|
|
|
106
|
+
|
|
107
|
+
Will be nice to allow for progressive enhancement compositional models.
|
|
108
|
+
// An enhanced compositional model could work well.
|
|
109
|
+
// Also sync it with the hidden original composition.
|
|
110
|
+
// So it would need to add extra controls, but sync with the existing one(s).
|
|
111
|
+
|
|
112
|
+
// .progressive_enhance()
|
|
113
|
+
// could be a decent syntax for the moment.
|
|
114
|
+
// maybe just would change the compositional model.
|
|
115
|
+
// or add the enhanced section to it....
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
106
123
|
|
|
107
124
|
|
|
108
125
|
|