-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
263 lines (237 loc) · 10.4 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
<?php
/*
* Entry point for the ClimbUI application
*/
namespace Tokenmapper;
use Approach\Render\HTML;
// disable errors
error_reporting(0);
global $body, $webpage;
require_once __DIR__ . '/support/lib/vendor/autoload.php';
$webpage = new HTML(tag: 'html');
$webpage->before = '<!DOCTYPE html>' . PHP_EOL;
$head = new HTML(tag: 'head');
$head[] = $pageTitle = new HTML(tag: 'title', content: 'ClimbUI');
$head[] = new HTML(tag: 'meta', attributes: [
'charset' => 'utf-8',
], selfContained: true);
$head[] = new HTML(tag: 'meta', attributes: [
'http-equiv' => 'X-UA-Compatible',
'content' => 'IE=edge',
], selfContained: true);
$head[] = new HTML(tag: 'meta', attributes: [
'name' => 'viewport',
'content' => 'width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0',
], selfContained: true);
$head[] = new HTML(tag: 'meta', attributes: [
'name' => 'author',
'content' => 'Ishan Joshi',
], selfContained: true);
// We will be using Bootstrap for the layout
$head[] = new HTML(tag: 'link', attributes: [
'rel' => 'stylesheet',
'href' => '//cdn.jsdelivr.net/npm/bootstrap-icons@1.8.1/font/bootstrap-icons.css',
], selfContained: true);
// Rest are some custom styles and scripts
$head[] = new HTML(tag: 'link', attributes: [
'rel' => 'stylesheet',
'type' => 'text/css',
'href' => '/static/css/layout.css',
], selfContained: true);
$head[] = new HTML(tag: 'link', attributes: [
'rel' => 'stylesheet',
'type' => 'text/css',
'href' => '/static/css/style.css',
], selfContained: true);
$head[] = new HTML(tag: 'link', attributes: [
'rel' => 'stylesheet',
'type' => 'text/css',
'href' => '/static/css/reset.css',
], selfContained: true);
/*$head[] = new HTML(tag: 'link', attributes: [*/
/* 'rel' => 'stylesheet',*/
/* 'type' => 'text/css',*/
/* 'href' => '/static/css/menu.css',*/
/*], selfContained: true);*/
$head[] = $pageTitle;
$head[] = new HTML(tag: 'link', attributes: [
'href' => 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css',
'rel' => 'stylesheet',
], selfContained: true);
$head[] = new HTML(tag: 'link', attributes: [
'href' => 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css',
'rel' => 'stylesheet',
], selfContained: true);
// JQuery baby!!
$head[] = new HTML(tag: 'script', attributes: [
'src' => '//ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js',
]);
// The actual approach library
$head[] = new HTML(tag: 'script', attributes: [
'type' => 'text/javascript',
'src' => '/static/js/approach/approach.interface.js',
]);
$head[] = new HTML(tag: 'script', attributes: [
'type' => 'text/javascript',
'src' => '/static/js/approach/approach.utility.js',
]);
$head[] = new HTML(tag: 'script', attributes: [
'type' => 'text/javascript',
'src' => '/static/js/approach/levenshtein.min.js',
]);
$head[] = new HTML(tag: 'script', attributes: [
'src' => '/static/js/main.js',
'type' => 'module',
]);
$body = new HTML(tag: 'body', classes: ['Interface', ' InterfaceContent', ' TokenmapperUI']);
$body->content = <<<HTML
<section id="Backdrop" class="Screen"></section>
<section id="Main" class="Screen controls">
<div id="test_area"></div>
<!-- Left Panel -->
<section id="LeftPanel" class="panel-content" data-api="/server.php" data-api-method="POST" >
<div style="display: flex; margin-right: 1rem;">
<label for="source">source</label>
<select name="source" style="height: 30px; margin-left: 10px">
<option value="jd">Component::ActionBox</option>
</select>
<button class="control" data-role="trigger" data-action="auto-match.mapper" style="margin-left: 70px;">auto match</button>
<button class="control" data-role="trigger" data-action="bound-toggle.mapper" style="margin-left: 70px;">hide bound</button>
</div>
<div class="Oyster">
<div class="header control"
data-intent='{ "REFRESH": { "Menu" : "Base" } }'
data-context='{ "_response_target": "#LeftPanel > .Oyster" }'>
<span>Load Menu</span>
</div>
</div>
</section>
<!-- Right Panel -->
<form id="RightPanel" class="Autoform panel-content" data-action="Menu">
<div style="display: flex;">
<label for="target">target</label>
<input type="text" name="target" placeholder="Component::ActionBox" style="margin-left: 5px;" />
<label for="tag">tag</label>
<input type="text" name="tag" placeholder="settings" style="margin-left: 5px;" />
<button style="margin-left: 50px;">load tag</button>
<button type="button" class="control" data-role="autoform" data-intent='{ "REFRESH" : { "Menu" : "Save" } }' data-api-method="POST" data-context='{ "_response_target" : "#test_area" }' style="margin-left: 50px;">save</button>
<button style="margin-left: 50px;">empty only</button>
</div>
<div class="Oyster">
<div class="header">
<h2>Target Component: ActionBox</h2>
</div>
<ul class="Toolbar">
</ul>
<div class="component-section prop-type-container">
<label for="name">Name</label>
<input type="text" name="addProp" class="addProp" placeholder="name" />
<label for="prop_type">prop type</label>
<select name="prop_type">
<option value="Suite_TextInput">Suite_TextInput</option>
<option value="Suite_LinkInput">Suite_LinkInput</option>
</select>
<button type="button" class="control" data-role="trigger" data-action="new-setting.mapper">Add</button>
</div>
</div>
</form>
</section>
<section id="Overlay" class="Screen">
<div id="IconPicker" class="controls">
<ul>
<li class="control" data-role="trigger" data-action="toolbar-append.mapper"><i class="icon bi bi-gear"></i>
<span class="label">Gear</span>
</li>
<li class="control" data-role="trigger" data-action="toolbar-append.mapper"><i class="icon bi bi-lightbulb"></i>
<span class="label">LightBulb</span>
</li>
<li class="control" data-role="trigger" data-action="toolbar-append.mapper"><i class="icon bi bi-boombox"></i>
<span class="label">BoomBox</span></li>
<li class="control" data-role="trigger" data-action="toolbar-append.mapper"><i class="icon bi bi-chat"></i>
<span class="label">Chat</span>
</li>
<li class="control" data-role="trigger" data-action="toolbar-append.mapper"><i class="icon bi bi-egg"></i>
<span class="label">Egg</span>
</li>
<li class="control" data-role="trigger" data-action="toolbar-append.mapper"><i class="icon bi bi-laptop"></i>
<span class="label">Laptop</span>
</li>
<li class="control" data-role="trigger" data-action="toolbar-append.mapper"><i class="icon bi bi-hdd"></i>
<span class="label">Database</span></li>
<li class="control" data-role="trigger" data-action="toolbar-append.mapper"><i class="icon bi bi-cloud"></i>
<span class="label">Cloud</span>
</li>
</ul>
</div>
</section>
<section id="Offscreen" class="Screen">
<li class="mapper-pearl" data-pearl="">
<div class="control visual">
<i class="fa"></i>
<label onclick="toggleDiv(event)">Mapper</label>
<i class="fa fa-arrow-right"></i>
</div>
<ul></ul>
</li>
<div class="mappable-body">
<div><label> default <input class="mapper-input"></label></div>
<div><label> transformer <input class="mapper-input"></label></div>
</div>
<div class="mapper-field">
<div class="visual control">
<i class="fa"></i>
<label>TextInput</label>
<span class="control" data-role="trigger" data-action="composed-up.mapper">
<i class="fa fa-arrow-up"></i>
</span>
<span class="control" data-role="trigger" data-action="composed-down.mapper">
<i class="fa fa-arrow-down"></i>
</span>
<span class="control" data-role="trigger" data-action="new-setting.mapper">
<i class="fa fa-times"></i>
</span>
</div>
</div>
<div class="toolbar-icon">
<span class="visual control">
<span class="control" data-role="trigger" data-action="toolbar-up.mapper">
<i class="fa fa-arrow-up"></i>
</span>
<span class="control" data-role="trigger" data-action="toolbar-down.mapper">
<i class="fa fa-arrow-down"></i>
</span>
<span class="control" data-role="trigger" data-action="toolbar-delete.mapper">
<i class="fa fa-times"></i>
</span>
</span>
</div>
</section>
<script>
function changeMenu(info){
// Remove the active class from current selector
//\$(info.selector).removeClass('active');
let strippedSelector = info.selector.substring(0, info.selector.lastIndexOf('>'));
let sel = strippedSelector.trim();
\$(sel).removeClass('active');
//// Add the active class to the new selector
//\$(info.selector + " > .components").find("div").addClass("active");
return sel
}
function copyOffscreenControl(name) {
return \$("#Offscreen ." + name).first().prop("outerHTML");
};
//function toggleDiv(e) {
// console.log("Hello World");
// let ele = \$(e.target).closest(".mapper-pearl").find(".mappable-body").first();
// console.log(ele);
// if(ele.css("display") == "none"){
// ele.css("display", "block");
// } else {
// ele.css("display", "none");
// }
//}
</script>
HTML;
$webpage[] = $head;
$webpage[] = $body;
echo $webpage->render();