jsgui3-server 0.0.122 → 0.0.124
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/box/1) square box/server.js +2 -2
- package/examples/box/2) twenty square boxes/css flex wrap/client.js +2 -138
- package/examples/box/2) twenty square boxes/css flex wrap/server.js +1 -74
- package/examples/box/3) twenty selectable square boxes/css flex wrap/client.js +104 -0
- package/examples/box/3) twenty selectable square boxes/css flex wrap/server.js +39 -0
- package/examples/box/4) twenty composition selectable square boxes/css flex wrap/client.js +151 -0
- package/examples/box/4) twenty composition selectable square boxes/css flex wrap/server.js +39 -0
- package/examples/box/5) square box compositional dragable/client.js +204 -0
- package/examples/box/5) square box compositional dragable/server.js +113 -0
- package/examples/boxes/square_boxes.js +1 -1
- package/examples/color_palette.js +1 -1
- package/examples/controls/1) window/server.js +1 -1
- package/examples/controls/10) window, mirrored text inputs/client.js +0 -202
- package/examples/controls/10) window, mirrored text inputs/server.js +2 -82
- package/examples/controls/11) window, mirrored text fields/server.js +1 -1
- package/examples/controls/11b) window, shared Data_Object model mirrored text fields/server.js +1 -1
- package/examples/controls/11c) window, shared Data_Value model mirrored text fields/server.js +1 -1
- package/examples/controls/11d) window, shared model mirrored integer text fields/server.js +1 -1
- package/examples/controls/12) window, Select_Options control/client.js +1 -370
- package/examples/controls/12) window, Select_Options control/server.js +1 -99
- package/examples/controls/13) window, Dropdown_Menu control/client.js +66 -0
- package/examples/controls/13) window, Dropdown_Menu control/server.js +21 -0
- package/examples/controls/2) two windows/server.js +1 -1
- package/examples/controls/3) five windows/server.js +1 -1
- package/examples/controls/5) window, grid/server.js +1 -1
- package/examples/controls/6) window, color_palette/client.js +2 -138
- package/examples/controls/6) window, color_palette/server.js +1 -1
- package/examples/controls/7) window, month_view/client.js +19 -12
- package/examples/controls/8) window, checkbox/client.js +25 -239
- package/examples/controls/8) window, checkbox/server.js +1 -1
- package/examples/controls/9) window, date picker/client.js +2 -229
- package/examples/controls/9) window, date picker/server.js +1 -1
- package/examples/controls/9b) window, shared data.model mirrored date pickers/README.md +51 -0
- package/examples/controls/9b) window, shared data.model mirrored date pickers/client.js +64 -379
- package/examples/controls/9b) window, shared data.model mirrored date pickers/server.js +1 -1
- package/examples/grids/grid_1.js +1 -1
- package/examples/introducing jsgui3/server.js +1 -1
- package/examples/mx_display/mx_display_1.js +1 -1
- package/package.json +8 -8
- package/page-context.js +1 -0
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
const jsgui = require('jsgui3-client');
|
|
2
|
+
const {controls, Control, mixins} = jsgui;
|
|
3
|
+
const {dragable} = mixins;
|
|
4
|
+
|
|
5
|
+
const Active_HTML_Document = require('../../../controls/Active_HTML_Document');
|
|
6
|
+
|
|
7
|
+
// Maybe better to include it within an Active_HTML_Document.
|
|
8
|
+
|
|
9
|
+
// Is currently a decent demo of a small active control running from the server, activated on the client.
|
|
10
|
+
// This square box is really simple, and it demonstrates the principle of the code for the draggable square box not being all that complex
|
|
11
|
+
// compared to a description of it.
|
|
12
|
+
|
|
13
|
+
// A container with reorderable internal draggable items could help.
|
|
14
|
+
|
|
15
|
+
// would be nice to be able to have all code in 1 file...???
|
|
16
|
+
// Though the sever code should be separate.
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
// Relies on extracting CSS from JS files.
|
|
24
|
+
|
|
25
|
+
class Demo_UI extends Active_HTML_Document {
|
|
26
|
+
constructor(spec = {}) {
|
|
27
|
+
spec.__type_name = spec.__type_name || 'demo_ui';
|
|
28
|
+
super(spec);
|
|
29
|
+
const {context} = this;
|
|
30
|
+
|
|
31
|
+
// Make sure it requires the correct CSS.
|
|
32
|
+
// Though making that 'effortless' on the server may help more.
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
// Maybe can't do this here???
|
|
36
|
+
|
|
37
|
+
// Does not have .body (yet) on the client.
|
|
38
|
+
// simple way to get the client to attach the body of the Active_HTML_Document?
|
|
39
|
+
// maybe with jsgui-data-controls?
|
|
40
|
+
// Though automatically having the .body property available on the client without sending extra HTTP
|
|
41
|
+
// plumbing will help.
|
|
42
|
+
|
|
43
|
+
// .body will not be available before activation.
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
// .body should not be a normal function....?
|
|
47
|
+
// a getter function would be better.
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
if (typeof this.body.add_class === 'function') {
|
|
52
|
+
this.body.add_class('demo-ui');
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
//console.log('this.body', this.body);
|
|
56
|
+
//console.log('this.body.add_class', this.body.add_class);
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
const compose = () => {
|
|
60
|
+
const box = new Square_Box({
|
|
61
|
+
context: context
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
dragable(box);
|
|
66
|
+
box.dragable = true;
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
this.body.add(box);
|
|
70
|
+
}
|
|
71
|
+
if (!spec.el) {
|
|
72
|
+
compose();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
activate() {
|
|
76
|
+
if (!this.__active) {
|
|
77
|
+
super.activate();
|
|
78
|
+
const {context} = this;
|
|
79
|
+
|
|
80
|
+
//console.log('activate Demo_UI');
|
|
81
|
+
// listen for the context events regarding frames, changes, resizing.
|
|
82
|
+
|
|
83
|
+
context.on('window-resize', e_resize => {
|
|
84
|
+
//console.log('window-resize', e_resize);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Include this in bundling.
|
|
92
|
+
// Want CSS bundling so that styles are read out from the JS document and compiled to a stylesheet.
|
|
93
|
+
|
|
94
|
+
//controls.Demo_UI = Demo_UI;
|
|
95
|
+
|
|
96
|
+
// A css file may be an easier way to get started...?
|
|
97
|
+
// Want to support but not require css in js.
|
|
98
|
+
|
|
99
|
+
// But need to set up the serving of the CSS both on the server, and on the client.
|
|
100
|
+
// Ofc setting it up on the server first is important - then can that stage set it up in the doc sent to the client?
|
|
101
|
+
|
|
102
|
+
// Including the CSS from the JS like before.
|
|
103
|
+
// Needs to extract the CSS and serve it as a separate CSS file.
|
|
104
|
+
// Should also have end-to-end regression tests so this does not break again in the future.
|
|
105
|
+
// The code was kind of clunky and got refactored away.
|
|
106
|
+
//
|
|
107
|
+
|
|
108
|
+
// Would need to parse the JS files to extract the CSS.
|
|
109
|
+
// Maybe could do it an easier way???
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
Demo_UI.css = `
|
|
120
|
+
.demo-ui {
|
|
121
|
+
display: flex;
|
|
122
|
+
flex-direction: column;
|
|
123
|
+
justify-content: center;
|
|
124
|
+
align-items: center;
|
|
125
|
+
text-align: center;
|
|
126
|
+
min-height: 100vh;
|
|
127
|
+
}
|
|
128
|
+
`;
|
|
129
|
+
|
|
130
|
+
class Square_Box extends Control {
|
|
131
|
+
constructor(spec) {
|
|
132
|
+
spec.__type_name = spec.__type_name || 'square_box';
|
|
133
|
+
super(spec);
|
|
134
|
+
this.add_class('square-box');
|
|
135
|
+
}
|
|
136
|
+
activate() {
|
|
137
|
+
if (!this.__active) {
|
|
138
|
+
super.activate();
|
|
139
|
+
console.log('Activate square box');
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
// Seems like drag mode translate is necessary for the moment.
|
|
143
|
+
// Will want to persist the mixin options when rendering on the server to use on the client.
|
|
144
|
+
|
|
145
|
+
const activation_apply_mx = () => {
|
|
146
|
+
dragable(this, {
|
|
147
|
+
drag_mode: 'translate'
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
console.log('dragable mixin applied to square box on activation');
|
|
151
|
+
this.dragable = true;
|
|
152
|
+
//console.log('this.dragable = true;');
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
this.on('dragend', e => {
|
|
158
|
+
console.log('square box dragend e', e);
|
|
159
|
+
//this.background.color = '#FF4444';
|
|
160
|
+
//this.color = '#FF4444';
|
|
161
|
+
this.dom.el.style.backgroundColor = '#FF4444';
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
// this.background.color perhaps?
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
Square_Box.css = `
|
|
173
|
+
.square-box {
|
|
174
|
+
background-color: #BB3333;
|
|
175
|
+
width: 220px;
|
|
176
|
+
height: 220px;
|
|
177
|
+
}
|
|
178
|
+
`;
|
|
179
|
+
|
|
180
|
+
// then if running on the client...?
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
//controls.Square_Box = Square_Box;
|
|
185
|
+
// could export jsgui with the updated controls....
|
|
186
|
+
// so that they are in the correct Page Context.?
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
controls.Demo_UI = Demo_UI;
|
|
190
|
+
controls.Square_Box = Square_Box;
|
|
191
|
+
|
|
192
|
+
module.exports = jsgui;
|
|
193
|
+
|
|
194
|
+
/*
|
|
195
|
+
module.exports = {
|
|
196
|
+
Square_Box: Square_Box,
|
|
197
|
+
Demo_UI: Demo_UI
|
|
198
|
+
}
|
|
199
|
+
*/
|
|
200
|
+
|
|
201
|
+
// Then if window...?
|
|
202
|
+
|
|
203
|
+
// Need to add the Square_Box control to the context or original map of controls...
|
|
204
|
+
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
const jsgui = require('./client');
|
|
2
|
+
|
|
3
|
+
const {Demo_UI, Square_Box} = jsgui.controls;
|
|
4
|
+
const Server = require('../../../server');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
// what would be the (best?) way to include the whole thing in one JS file?
|
|
8
|
+
// Maybe don't try that right now.
|
|
9
|
+
// maybe standardise on the dir, then client.js and server.js inside.
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
// Want to exclude this from the client bundle.
|
|
14
|
+
// Some kind of marking to say that it's server-side only?
|
|
15
|
+
|
|
16
|
+
// Need to include JSGUI3 js within the client document.
|
|
17
|
+
// Seems like an earlier code simplification removed this functionality?
|
|
18
|
+
// Just specifying a Ctrl for the server - and giving it the 'disk_path_client_js'.
|
|
19
|
+
// May as well fix that....
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
if (require.main === module) {
|
|
26
|
+
|
|
27
|
+
// By default should include the JS and the CSS.
|
|
28
|
+
// By reference, serving them from their respective paths.
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
// This API is not working right now.
|
|
32
|
+
|
|
33
|
+
// A very simple syntax for running a single control would be great.
|
|
34
|
+
|
|
35
|
+
// Need to in the default (server) configuration build and serve the client-side app.
|
|
36
|
+
// Want to be able to make interactive apps quickly with minimal server side code that needs to be written as boilerplate to
|
|
37
|
+
// get the app running.
|
|
38
|
+
|
|
39
|
+
// Though maybe defining a webpage, that serves the client js, and renders the control on the server, and activates it on the client,
|
|
40
|
+
// would be the right approach.
|
|
41
|
+
|
|
42
|
+
// Want to make the code really explicit, in a simple way.
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
// eg { '/': Demo_UI }
|
|
46
|
+
// eg { '*': Demo_UI }
|
|
47
|
+
// as at least it explicitly assigns it to the '/' route
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
// But worth keeping the '/' Ctrl property?
|
|
51
|
+
// Could change it to explicitly setting the route(s).
|
|
52
|
+
|
|
53
|
+
// Do want it to build the client js on start.
|
|
54
|
+
|
|
55
|
+
// Could extract the CSS from the file itself, or maybe better reading it from the classes and objects that are loaded / referenced.
|
|
56
|
+
// All kinds of complex server program structures exist already, so could use Publishers if needed for some things.
|
|
57
|
+
// But need to keep the surface-level API really simple.
|
|
58
|
+
|
|
59
|
+
// Maybe define a Webpage and maybe use / define an HTML_Webpage_Publisher for example too.
|
|
60
|
+
// The clearest code would be really explicit about what it does, but in terms of almost English idioms
|
|
61
|
+
// and on the surface-level not spelling out in great detail what it's doing, but referencing objects and
|
|
62
|
+
// instructions with clear purposes, though details could be obscure at the top level. Eg it's the publisher's responsibility
|
|
63
|
+
// to include the CSS and JS that's needed to get it to run. A publisher is referenced and used, and it does its thing.
|
|
64
|
+
|
|
65
|
+
// The Server could automatically involk the use of a Publisher.
|
|
66
|
+
// May be better to either require or recommend more explicit code, have them in the examples,
|
|
67
|
+
// but also to document some shortcuts, defaults, and abbreviations (though they may omit some essential info, so not recommended for beginners)
|
|
68
|
+
|
|
69
|
+
// Could have a tabbed view for examples for 'explicit' and 'short' notations when there are multiple.
|
|
70
|
+
|
|
71
|
+
// jsgui3-html-suite may be of use, for some more extended controls that are built on top of jsgui3-html, but not specifically
|
|
72
|
+
// client or server.
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
const server = new Server({
|
|
80
|
+
Ctrl: Demo_UI,
|
|
81
|
+
// Giving it the Ctrl and disk path client js should enable to server to get the JS-bundled CSS from the file(s).
|
|
82
|
+
// Putting the JS files through proper parsing and into a syntax tree would be best.
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
//'js_mode': 'debug',
|
|
86
|
+
'src_path_client_js': require.resolve('./client.js')
|
|
87
|
+
//js_client: require.resolve('./square_box.js')
|
|
88
|
+
});
|
|
89
|
+
// A callback or event for when the bundling has been completed
|
|
90
|
+
// a 'ready' event.
|
|
91
|
+
|
|
92
|
+
// then start the server....
|
|
93
|
+
// be able to choose the port / ports?
|
|
94
|
+
console.log('waiting for server ready event');
|
|
95
|
+
server.on('ready', () => {
|
|
96
|
+
console.log('server ready');
|
|
97
|
+
|
|
98
|
+
// server start will change to observable?
|
|
99
|
+
|
|
100
|
+
server.start(52000, function (err, cb_start) {
|
|
101
|
+
if (err) {
|
|
102
|
+
throw err;
|
|
103
|
+
} else {
|
|
104
|
+
// Should have build it by now...
|
|
105
|
+
|
|
106
|
+
console.log('server started');
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
}
|
|
@@ -7,55 +7,17 @@ const {Checkbox, Date_Picker, Text_Input} = controls;
|
|
|
7
7
|
|
|
8
8
|
const Active_HTML_Document = require('../../../controls/Active_HTML_Document');
|
|
9
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
|
-
// Should not need to refer to the .data.model? view.data.model?
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
10
|
class Demo_UI extends Active_HTML_Document {
|
|
20
11
|
constructor(spec = {}) {
|
|
21
12
|
spec.__type_name = spec.__type_name || 'demo_ui';
|
|
22
13
|
super(spec);
|
|
23
14
|
const {context} = this;
|
|
24
15
|
|
|
25
|
-
// Make sure it requires the correct CSS.
|
|
26
|
-
// Though making that 'effortless' on the server may help more.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
// Maybe can't do this here???
|
|
30
|
-
|
|
31
|
-
// Does not have .body (yet) on the client.
|
|
32
|
-
// simple way to get the client to attach the body of the Active_HTML_Document?
|
|
33
|
-
// maybe with jsgui-data-controls?
|
|
34
|
-
// Though automatically having the .body property available on the client without sending extra HTTP
|
|
35
|
-
// plumbing will help.
|
|
36
|
-
|
|
37
|
-
// .body will not be available before activation.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
// .body should not be a normal function....?
|
|
41
|
-
// a getter function would be better.
|
|
42
|
-
|
|
43
|
-
|
|
44
16
|
if (typeof this.body.add_class === 'function') {
|
|
45
17
|
this.body.add_class('demo-ui');
|
|
46
18
|
}
|
|
47
19
|
|
|
48
|
-
//console.log('this.body', this.body);
|
|
49
|
-
//console.log('this.body.add_class', this.body.add_class);
|
|
50
|
-
|
|
51
|
-
|
|
52
20
|
const compose = () => {
|
|
53
|
-
// put 20 of them in place.
|
|
54
|
-
|
|
55
|
-
// Then how to arrange them...?
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
21
|
|
|
60
22
|
const window = new controls.Window({
|
|
61
23
|
context: context,
|
|
@@ -65,46 +27,6 @@ class Demo_UI extends Active_HTML_Document {
|
|
|
65
27
|
|
|
66
28
|
window.size = [480, 160];
|
|
67
29
|
|
|
68
|
-
// Have Tab_Page items inside???
|
|
69
|
-
|
|
70
|
-
// Setting a 'selectable' property at the composition stage could be very helpful in some cases,
|
|
71
|
-
// May want composition-level mixins?
|
|
72
|
-
// Maybe those mixins would also have code that runs on activation.
|
|
73
|
-
// 'compositional mixins' ???
|
|
74
|
-
|
|
75
|
-
// Need mixins to be very flexible to avoid the probles React had with them.
|
|
76
|
-
// Choose what functionality the mixin provides in some cases.
|
|
77
|
-
// Need to keep tight control over the coupling of mixins.
|
|
78
|
-
// Each mixin may need to be somewhat complex to avoid hiccups - and to consistently act in the set modes.
|
|
79
|
-
// If a mixin is to do something different to before that functionality should be called differently.
|
|
80
|
-
|
|
81
|
-
// mixin.enabled_feature_sets = [feature_set_1_name, feature_set_2_name] ....
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
// Will work on more options & perfection for month_view.
|
|
86
|
-
|
|
87
|
-
/*
|
|
88
|
-
|
|
89
|
-
new Checkbox({
|
|
90
|
-
context,
|
|
91
|
-
label: {
|
|
92
|
-
text: 'A checkbox'
|
|
93
|
-
}
|
|
94
|
-
})
|
|
95
|
-
|
|
96
|
-
*/
|
|
97
|
-
|
|
98
|
-
// Sensible properties like this will help.
|
|
99
|
-
|
|
100
|
-
// A progressively enhancing control could help a lot.
|
|
101
|
-
// Something that when it's in the doc will even replace its own element.
|
|
102
|
-
// Lower level code to enable really simple to express progressive enhancement could help, maybe would not be needed.
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
30
|
const ti1 = new Text_Input({
|
|
109
31
|
context,
|
|
110
32
|
//label: {
|
|
@@ -124,15 +46,11 @@ class Demo_UI extends Active_HTML_Document {
|
|
|
124
46
|
window.inner.add(ti2);
|
|
125
47
|
|
|
126
48
|
this.body.add(window);
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
49
|
|
|
131
50
|
this._ctrl_fields = this._ctrl_fields || {};
|
|
132
51
|
this._ctrl_fields.ti1 = ti1;
|
|
133
52
|
this._ctrl_fields.ti2 = ti2;
|
|
134
53
|
|
|
135
|
-
|
|
136
54
|
}
|
|
137
55
|
if (!spec.el) {
|
|
138
56
|
compose();
|
|
@@ -143,34 +61,6 @@ class Demo_UI extends Active_HTML_Document {
|
|
|
143
61
|
super.activate();
|
|
144
62
|
const {context, ti1, ti2} = this;
|
|
145
63
|
|
|
146
|
-
|
|
147
|
-
// and events dealing with changes to those tis.
|
|
148
|
-
|
|
149
|
-
// ti1, ti2.
|
|
150
|
-
|
|
151
|
-
// Some kind of tracking of what the event initiator could help?
|
|
152
|
-
// Automatically avoiding feedback somehow???
|
|
153
|
-
// If it gets changed to its current value it does not push the change...?
|
|
154
|
-
|
|
155
|
-
// on the data model change instead....
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
// Code has got more complex supporting things by data model changes for the moment.
|
|
159
|
-
// May help a lot when making it more explicit.
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
// But could make 'on' (normally?) refer to the .data.model???
|
|
164
|
-
// For the moment, keep the more explicit notations, as well as backwards compatibility.
|
|
165
|
-
|
|
166
|
-
// ctrl.dom.on may help, be a nicer and more concise syntax, just as explicit (considering the 'on' abbreviatrion)
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
// does seem convenient having .on refer to dom events if it's an appropriate event name for that.
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
64
|
ti1.data.model.on('change', e => {
|
|
175
65
|
//console.log('ti1 change e', e);
|
|
176
66
|
|
|
@@ -178,8 +68,6 @@ class Demo_UI extends Active_HTML_Document {
|
|
|
178
68
|
ti2.data.model.value = e.value;
|
|
179
69
|
}
|
|
180
70
|
|
|
181
|
-
|
|
182
|
-
|
|
183
71
|
});
|
|
184
72
|
ti2.data.model.on('change', e => {
|
|
185
73
|
//console.log('ti2 change e', e);
|
|
@@ -187,51 +75,8 @@ class Demo_UI extends Active_HTML_Document {
|
|
|
187
75
|
if (e.value !== e.old) {
|
|
188
76
|
ti1.data.model.value = e.value;
|
|
189
77
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
78
|
});
|
|
193
|
-
|
|
194
|
-
// listen for change events.
|
|
195
|
-
// would be nice to know which change events originated from the user interacting with that specific HTML element (or ctrl???)
|
|
196
|
-
|
|
197
|
-
// e.from_user === true test.
|
|
198
|
-
|
|
199
|
-
// e.user_initiated_on_this ????
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
//console.log('activate Demo_UI');
|
|
205
|
-
// listen for the context events regarding frames, changes, resizing.
|
|
206
|
-
|
|
207
79
|
context.on('window-resize', e_resize => {
|
|
208
|
-
|
|
209
|
-
// Could see about having some window contents bound through CSS to the size of the window.
|
|
210
|
-
// Though having a framework of adjusting CSS from the JS on-the-fly could work too.
|
|
211
|
-
|
|
212
|
-
// May be done with the 'bind' mixin, or will make more specific mixins to do things like bind
|
|
213
|
-
// a control to the space within another control, space within a specific part of that control.
|
|
214
|
-
|
|
215
|
-
// Or bind to parent size. That should be possible with CSS though.
|
|
216
|
-
// May make some controls make more use of CSS by default
|
|
217
|
-
// Or having an absolutely positioned box model used extensively could avoid some ambiguity, though
|
|
218
|
-
// making use of and supporting generally respected CSS features will help too.
|
|
219
|
-
|
|
220
|
-
//console.log('window-resize', e_resize);
|
|
221
|
-
|
|
222
|
-
// Make all internal controls go absolute in terms of position
|
|
223
|
-
// Remove them from their containers too?
|
|
224
|
-
// Ie their containing divs?
|
|
225
|
-
|
|
226
|
-
// Would be nice to do this really simple with a fn call or very simple piece of code.
|
|
227
|
-
// Like get absolute position, set position to be absolute, move to that position.
|
|
228
|
-
// Maybe something within jsgui3-client helps with this, this is more about what needs to be done on the client.
|
|
229
|
-
// Though recognising perf implications, it's (more) OK to include client-side functionality in jsgui3-html.
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
80
|
|
|
236
81
|
});
|
|
237
82
|
|
|
@@ -239,27 +84,6 @@ class Demo_UI extends Active_HTML_Document {
|
|
|
239
84
|
}
|
|
240
85
|
}
|
|
241
86
|
|
|
242
|
-
// Include this in bundling.
|
|
243
|
-
// Want CSS bundling so that styles are read out from the JS document and compiled to a stylesheet.
|
|
244
|
-
|
|
245
|
-
//controls.Demo_UI = Demo_UI;
|
|
246
|
-
|
|
247
|
-
// A css file may be an easier way to get started...?
|
|
248
|
-
// Want to support but not require css in js.
|
|
249
|
-
|
|
250
|
-
// But need to set up the serving of the CSS both on the server, and on the client.
|
|
251
|
-
// Ofc setting it up on the server first is important - then can that stage set it up in the doc sent to the client?
|
|
252
|
-
|
|
253
|
-
// Including the CSS from the JS like before.
|
|
254
|
-
// Needs to extract the CSS and serve it as a separate CSS file.
|
|
255
|
-
// Should also have end-to-end regression tests so this does not break again in the future.
|
|
256
|
-
// The code was kind of clunky and got refactored away.
|
|
257
|
-
//
|
|
258
|
-
|
|
259
|
-
// Would need to parse the JS files to extract the CSS.
|
|
260
|
-
// Maybe could do it an easier way??? Now that it's easy, want a faster way.
|
|
261
|
-
|
|
262
|
-
|
|
263
87
|
Demo_UI.css = `
|
|
264
88
|
|
|
265
89
|
* {
|
|
@@ -290,31 +114,5 @@ body {
|
|
|
290
114
|
}
|
|
291
115
|
`;
|
|
292
116
|
|
|
293
|
-
// But may want to remove them from that flex upon picking up / dropping them.
|
|
294
|
-
// Maybe best upon drop.
|
|
295
|
-
|
|
296
|
-
// Maybe want other examples that use absolute positioning to position the items at the start?
|
|
297
|
-
//
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
//controls.Square_Box = Square_Box;
|
|
302
|
-
// could export jsgui with the updated controls....
|
|
303
|
-
// so that they are in the correct Page Context.?
|
|
304
|
-
|
|
305
|
-
|
|
306
117
|
controls.Demo_UI = Demo_UI;
|
|
307
|
-
|
|
308
118
|
module.exports = jsgui;
|
|
309
|
-
|
|
310
|
-
/*
|
|
311
|
-
module.exports = {
|
|
312
|
-
Square_Box: Square_Box,
|
|
313
|
-
Demo_UI: Demo_UI
|
|
314
|
-
}
|
|
315
|
-
*/
|
|
316
|
-
|
|
317
|
-
// Then if window...?
|
|
318
|
-
|
|
319
|
-
// Need to add the Square_Box control to the context or original map of controls...
|
|
320
|
-
|