resin 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +2 -0
- data/amber/bin/nodecompile.js +3 -3
- data/amber/css/amber.css +47 -23
- data/amber/images/off.amber.png +0 -0
- data/amber/images/offHover.amber.png +0 -0
- data/amber/images/sprite.amber.png +0 -0
- data/amber/images/tinylogo.amber.png +0 -0
- data/amber/js/Benchfib.deploy.js +34 -34
- data/amber/js/Benchfib.js +49 -49
- data/amber/js/Canvas.deploy.js +937 -937
- data/amber/js/Canvas.js +1622 -1622
- data/amber/js/Compiler-Tests.deploy.js +97 -0
- data/amber/js/Compiler-Tests.js +137 -0
- data/amber/js/Compiler.deploy.js +1030 -924
- data/amber/js/Compiler.js +1613 -1467
- data/amber/js/Documentation.deploy.js +417 -417
- data/amber/js/Documentation.js +728 -728
- data/amber/js/Examples.deploy.js +24 -13
- data/amber/js/Examples.js +36 -19
- data/amber/js/IDE.deploy.js +1583 -1527
- data/amber/js/IDE.js +2586 -2510
- data/amber/js/Kernel-Announcements.deploy.js +19 -19
- data/amber/js/Kernel-Announcements.js +28 -28
- data/amber/js/Kernel-Classes.deploy.js +332 -229
- data/amber/js/Kernel-Classes.js +532 -384
- data/amber/js/Kernel-Collections.deploy.js +1516 -1712
- data/amber/js/Kernel-Collections.js +2436 -2712
- data/amber/js/Kernel-Exceptions.deploy.js +85 -62
- data/amber/js/Kernel-Exceptions.js +131 -98
- data/amber/js/Kernel-Methods.deploy.js +326 -378
- data/amber/js/Kernel-Methods.js +473 -525
- data/amber/js/Kernel-Objects.deploy.js +1777 -2428
- data/amber/js/Kernel-Objects.js +2599 -3426
- data/amber/js/Kernel-Tests.deploy.js +871 -772
- data/amber/js/Kernel-Tests.js +1207 -1083
- data/amber/js/Kernel-Transcript.deploy.js +57 -57
- data/amber/js/Kernel-Transcript.js +94 -94
- data/amber/js/SUnit.deploy.js +116 -116
- data/amber/js/SUnit.js +211 -211
- data/amber/js/amber.js +10 -11
- data/amber/js/boot.js +132 -156
- data/amber/js/init.js +2 -2
- data/amber/js/parser.js +2095 -3014
- data/amber/js/parser.pegjs +1 -1
- data/amber/st/Benchfib.st +22 -22
- data/amber/st/Canvas.st +471 -471
- data/amber/st/Compiler-Tests.st +471 -0
- data/amber/st/Compiler.st +858 -794
- data/amber/st/Examples.st +22 -5
- data/amber/st/IDE.st +1326 -1291
- data/amber/st/Kernel-Announcements.st +2 -2
- data/amber/st/Kernel-Classes.st +148 -90
- data/amber/st/Kernel-Collections.st +950 -1061
- data/amber/st/Kernel-Exceptions.st +33 -25
- data/amber/st/Kernel-Methods.st +151 -151
- data/amber/st/Kernel-Objects.st +891 -1036
- data/amber/st/Kernel-Tests.st +622 -544
- data/amber/st/Kernel-Transcript.st +38 -38
- data/amber/st/SUnit.st +53 -53
- metadata +27 -20
data/amber/js/parser.pegjs
CHANGED
@@ -28,7 +28,7 @@ literalArray = "#(" ws lits:(lit:literal ws {return lit._value()})* ws ")" {
|
|
28
28
|
return smalltalk.ValueNode._new()
|
29
29
|
._value_(lits)
|
30
30
|
}
|
31
|
-
dynamicArray = "{" ws expressions:expressions? ws "}" {
|
31
|
+
dynamicArray = "{" ws expressions:expressions? ws "."? "}" {
|
32
32
|
return smalltalk.DynamicArrayNode._new()
|
33
33
|
._nodes_(expressions)
|
34
34
|
}
|
data/amber/st/Benchfib.st
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Smalltalk current createPackage: 'Benchfib' properties: #{}!
|
2
2
|
Object subclass: #Benchfib
|
3
3
|
instanceVariableNames: ''
|
4
|
-
|
4
|
+
package: 'Benchfib'!
|
5
5
|
|
6
6
|
!Benchfib class methodsFor: 'not yet classified'!
|
7
7
|
|
@@ -49,27 +49,6 @@ benchmark
|
|
49
49
|
^ count
|
50
50
|
!
|
51
51
|
|
52
|
-
tinyBenchmarks
|
53
|
-
"Report the results of running the two tiny Squeak benchmarks.
|
54
|
-
ar 9/10/1999: Adjusted to run at least 1 sec to get more stable results"
|
55
|
-
"0 tinyBenchmarks"
|
56
|
-
"On a 292 MHz G3 Mac: 22727272 bytecodes/sec; 984169 sends/sec"
|
57
|
-
"On a 400 MHz PII/Win98: 18028169 bytecodes/sec; 1081272 sends/sec"
|
58
|
-
| t1 t2 r n1 n2 |
|
59
|
-
n1 := 1.
|
60
|
-
[t1 := Date millisecondsToRun: [n1 benchmark].
|
61
|
-
t1 < 1000] whileTrue:[n1 := n1 * 2]. "Note: #benchmark's runtime is about O(n)"
|
62
|
-
|
63
|
-
n2 := 16.
|
64
|
-
[t2 := Date millisecondsToRun: [r := n2 benchFib].
|
65
|
-
t2 < 1000] whileTrue:[n2 := n2 + 1].
|
66
|
-
"Note: #benchFib's runtime is about O(k^n),
|
67
|
-
where k is the golden number = (1 + 5 sqrt) / 2 = 1.618...."
|
68
|
-
|
69
|
-
^ ((n1 * 500000 * 1000) / t1) printString, ' bytecodes/sec; ',
|
70
|
-
((r * 1000) / t2) printString, ' sends/sec'
|
71
|
-
!
|
72
|
-
|
73
52
|
jsbenchFib
|
74
53
|
|
75
54
|
<if (this < 2) {
|
@@ -118,6 +97,27 @@ jstinyBenchmarks
|
|
118
97
|
"Note: #jsbenchFib's runtime is about O(k^n),
|
119
98
|
where k is the golden number = (1 + 5 sqrt) / 2 = 1.618...."
|
120
99
|
|
100
|
+
^ ((n1 * 500000 * 1000) / t1) printString, ' bytecodes/sec; ',
|
101
|
+
((r * 1000) / t2) printString, ' sends/sec'
|
102
|
+
!
|
103
|
+
|
104
|
+
tinyBenchmarks
|
105
|
+
"Report the results of running the two tiny Squeak benchmarks.
|
106
|
+
ar 9/10/1999: Adjusted to run at least 1 sec to get more stable results"
|
107
|
+
"0 tinyBenchmarks"
|
108
|
+
"On a 292 MHz G3 Mac: 22727272 bytecodes/sec; 984169 sends/sec"
|
109
|
+
"On a 400 MHz PII/Win98: 18028169 bytecodes/sec; 1081272 sends/sec"
|
110
|
+
| t1 t2 r n1 n2 |
|
111
|
+
n1 := 1.
|
112
|
+
[t1 := Date millisecondsToRun: [n1 benchmark].
|
113
|
+
t1 < 1000] whileTrue:[n1 := n1 * 2]. "Note: #benchmark's runtime is about O(n)"
|
114
|
+
|
115
|
+
n2 := 16.
|
116
|
+
[t2 := Date millisecondsToRun: [r := n2 benchFib].
|
117
|
+
t2 < 1000] whileTrue:[n2 := n2 + 1].
|
118
|
+
"Note: #benchFib's runtime is about O(k^n),
|
119
|
+
where k is the golden number = (1 + 5 sqrt) / 2 = 1.618...."
|
120
|
+
|
121
121
|
^ ((n1 * 500000 * 1000) / t1) printString, ' bytecodes/sec; ',
|
122
122
|
((r * 1000) / t2) printString, ' sends/sec'
|
123
123
|
! !
|
data/amber/st/Canvas.st
CHANGED
@@ -1,832 +1,812 @@
|
|
1
1
|
Smalltalk current createPackage: 'Canvas' properties: #{}!
|
2
|
-
Object subclass: #
|
3
|
-
instanceVariableNames: ''
|
4
|
-
|
2
|
+
Object subclass: #HTMLCanvas
|
3
|
+
instanceVariableNames: 'root'
|
4
|
+
package: 'Canvas'!
|
5
5
|
|
6
|
-
!
|
6
|
+
!HTMLCanvas methodsFor: 'accessing'!
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
root
|
9
|
+
^root
|
10
10
|
!
|
11
11
|
|
12
|
-
|
13
|
-
|
12
|
+
root: aTagBrush
|
13
|
+
root := aTagBrush
|
14
14
|
! !
|
15
15
|
|
16
|
-
!
|
16
|
+
!HTMLCanvas methodsFor: 'adding'!
|
17
17
|
|
18
|
-
|
19
|
-
self
|
18
|
+
with: anObject
|
19
|
+
^self root with: anObject
|
20
20
|
! !
|
21
21
|
|
22
|
-
|
23
|
-
instanceVariableNames: 'canvas element'
|
24
|
-
category: 'Canvas'!
|
22
|
+
!HTMLCanvas methodsFor: 'initialization'!
|
25
23
|
|
26
|
-
|
24
|
+
initialize
|
25
|
+
super initialize.
|
26
|
+
root ifNil: [root := TagBrush fromString: 'div' canvas: self]
|
27
|
+
!
|
27
28
|
|
28
|
-
|
29
|
-
|
29
|
+
initializeFromJQuery: aJQuery
|
30
|
+
root := TagBrush fromJQuery: aJQuery canvas: self
|
30
31
|
! !
|
31
32
|
|
32
|
-
!
|
33
|
+
!HTMLCanvas methodsFor: 'tags'!
|
33
34
|
|
34
|
-
|
35
|
-
self
|
36
|
-
empty;
|
37
|
-
append: anObject
|
35
|
+
a
|
36
|
+
^self tag: 'a'
|
38
37
|
!
|
39
38
|
|
40
|
-
|
41
|
-
|
42
|
-
^aTagBrush
|
39
|
+
abbr
|
40
|
+
^self tag: 'abbr'
|
43
41
|
!
|
44
42
|
|
45
|
-
|
46
|
-
|
43
|
+
address
|
44
|
+
^self tag: 'address'
|
47
45
|
!
|
48
46
|
|
49
|
-
|
50
|
-
|
47
|
+
area
|
48
|
+
^self tag: 'area'
|
51
49
|
!
|
52
50
|
|
53
|
-
|
54
|
-
|
51
|
+
article
|
52
|
+
^self tag: 'article'
|
55
53
|
!
|
56
54
|
|
57
|
-
|
58
|
-
|
59
|
-
root := canvas root.
|
60
|
-
canvas root: self.
|
61
|
-
aBlock value: canvas.
|
62
|
-
canvas root: root
|
55
|
+
aside
|
56
|
+
^self tag: 'aside'
|
63
57
|
!
|
64
58
|
|
65
|
-
|
66
|
-
|
67
|
-
<var element=self['@element'];
|
68
|
-
if (null == element.canHaveChildren || element.canHaveChildren) {
|
69
|
-
element.appendChild(anElement);
|
70
|
-
} else {
|
71
|
-
element.text = String(element.text) + anElement.innerHTML;
|
72
|
-
} >
|
59
|
+
audio
|
60
|
+
^self tag: 'audio'
|
73
61
|
!
|
74
62
|
|
75
|
-
|
76
|
-
|
63
|
+
base
|
64
|
+
^self tag: 'base'
|
77
65
|
!
|
78
66
|
|
79
|
-
|
80
|
-
self
|
81
|
-
! !
|
82
|
-
|
83
|
-
!TagBrush methodsFor: 'attributes'!
|
84
|
-
|
85
|
-
at: aString put: aValue
|
86
|
-
<self['@element'].setAttribute(aString, aValue)>
|
67
|
+
blockquote
|
68
|
+
^self tag: 'blockquote'
|
87
69
|
!
|
88
70
|
|
89
|
-
|
90
|
-
|
71
|
+
body
|
72
|
+
^self tag: 'body'
|
91
73
|
!
|
92
74
|
|
93
|
-
|
94
|
-
|
75
|
+
br
|
76
|
+
^self tag: 'br'
|
95
77
|
!
|
96
78
|
|
97
|
-
|
98
|
-
self
|
79
|
+
button
|
80
|
+
^self tag: 'button'
|
99
81
|
!
|
100
82
|
|
101
|
-
|
102
|
-
|
83
|
+
canvas
|
84
|
+
^self tag: 'canvas'
|
103
85
|
!
|
104
86
|
|
105
|
-
|
106
|
-
|
87
|
+
caption
|
88
|
+
^self tag: 'caption'
|
107
89
|
!
|
108
90
|
|
109
|
-
|
110
|
-
|
91
|
+
cite
|
92
|
+
^self tag: 'cite'
|
111
93
|
!
|
112
94
|
|
113
|
-
|
114
|
-
self
|
95
|
+
code
|
96
|
+
^self tag: 'code'
|
115
97
|
!
|
116
98
|
|
117
|
-
|
118
|
-
|
99
|
+
col
|
100
|
+
^self tag: 'col'
|
119
101
|
!
|
120
102
|
|
121
|
-
|
122
|
-
|
103
|
+
colgroup
|
104
|
+
^self tag: 'colgroup'
|
123
105
|
!
|
124
106
|
|
125
|
-
|
126
|
-
|
107
|
+
command
|
108
|
+
^self tag: 'command'
|
127
109
|
!
|
128
110
|
|
129
|
-
|
130
|
-
|
111
|
+
datalist
|
112
|
+
^self tag: 'datalist'
|
131
113
|
!
|
132
114
|
|
133
|
-
|
134
|
-
|
115
|
+
dd
|
116
|
+
^self tag: 'dd'
|
135
117
|
!
|
136
118
|
|
137
|
-
|
138
|
-
|
119
|
+
del
|
120
|
+
^self tag: 'del'
|
139
121
|
!
|
140
122
|
|
141
|
-
|
142
|
-
self
|
123
|
+
details
|
124
|
+
^self tag: 'details'
|
143
125
|
!
|
144
126
|
|
145
|
-
|
146
|
-
|
127
|
+
div
|
128
|
+
^self tag: 'div'
|
147
129
|
!
|
148
130
|
|
149
|
-
|
150
|
-
|
131
|
+
div: aBlock
|
132
|
+
^self div with: aBlock
|
151
133
|
!
|
152
134
|
|
153
|
-
|
154
|
-
self
|
135
|
+
dl
|
136
|
+
^self tag: 'dl'
|
155
137
|
!
|
156
138
|
|
157
|
-
|
158
|
-
self
|
139
|
+
dt
|
140
|
+
^self tag: 'dt'
|
159
141
|
!
|
160
142
|
|
161
|
-
|
162
|
-
self
|
143
|
+
em
|
144
|
+
^self tag: 'em'
|
163
145
|
!
|
164
146
|
|
165
|
-
|
166
|
-
self
|
147
|
+
embed
|
148
|
+
^self tag: 'embed'
|
167
149
|
!
|
168
150
|
|
169
|
-
|
170
|
-
|
151
|
+
fieldset
|
152
|
+
^self tag: 'fieldset'
|
171
153
|
!
|
172
154
|
|
173
|
-
|
174
|
-
self
|
155
|
+
figcaption
|
156
|
+
^self tag: 'figcaption'
|
175
157
|
!
|
176
158
|
|
177
|
-
|
178
|
-
self
|
159
|
+
figure
|
160
|
+
^self tag: 'figure'
|
179
161
|
!
|
180
162
|
|
181
|
-
|
182
|
-
|
163
|
+
footer
|
164
|
+
^self tag: 'footer'
|
183
165
|
!
|
184
166
|
|
185
|
-
|
186
|
-
|
167
|
+
form
|
168
|
+
^self tag: 'form'
|
187
169
|
!
|
188
170
|
|
189
|
-
|
190
|
-
|
171
|
+
h1
|
172
|
+
^self tag: 'h1'
|
191
173
|
!
|
192
174
|
|
193
|
-
|
194
|
-
|
175
|
+
h1: anObject
|
176
|
+
^self h1 with: anObject
|
195
177
|
!
|
196
178
|
|
197
|
-
|
198
|
-
|
179
|
+
h2
|
180
|
+
^self tag: 'h2'
|
199
181
|
!
|
200
182
|
|
201
|
-
|
202
|
-
|
183
|
+
h2: anObject
|
184
|
+
^ self h2 with: anObject
|
203
185
|
!
|
204
186
|
|
205
|
-
|
206
|
-
|
207
|
-
! !
|
208
|
-
|
209
|
-
!TagBrush methodsFor: 'converting'!
|
210
|
-
|
211
|
-
asJQuery
|
212
|
-
^window jQuery: self element
|
213
|
-
! !
|
214
|
-
|
215
|
-
!TagBrush methodsFor: 'events'!
|
216
|
-
|
217
|
-
onKeyDown: aBlock
|
218
|
-
self asJQuery bind: 'keydown' do: aBlock
|
187
|
+
h3
|
188
|
+
^self tag: 'h3'
|
219
189
|
!
|
220
190
|
|
221
|
-
|
222
|
-
self
|
191
|
+
h3: anObject
|
192
|
+
^self h3 with: anObject
|
223
193
|
!
|
224
194
|
|
225
|
-
|
226
|
-
self
|
195
|
+
h4
|
196
|
+
^self tag: 'h4'
|
227
197
|
!
|
228
198
|
|
229
|
-
|
230
|
-
self
|
199
|
+
h4: anObject
|
200
|
+
^self h4 with: anObject
|
231
201
|
!
|
232
202
|
|
233
|
-
|
234
|
-
self
|
203
|
+
h5
|
204
|
+
^self tag: 'h5'
|
235
205
|
!
|
236
206
|
|
237
|
-
|
238
|
-
self
|
207
|
+
h5: anObject
|
208
|
+
^self h5 with: anObject
|
239
209
|
!
|
240
210
|
|
241
|
-
|
242
|
-
self
|
211
|
+
h6
|
212
|
+
^self tag: 'h6'
|
243
213
|
!
|
244
214
|
|
245
|
-
|
246
|
-
|
215
|
+
h6: anObject
|
216
|
+
^self h6 with: anObject
|
247
217
|
!
|
248
218
|
|
249
|
-
|
250
|
-
self
|
219
|
+
head
|
220
|
+
^self tag: 'head'
|
251
221
|
!
|
252
222
|
|
253
|
-
|
254
|
-
|
223
|
+
header
|
224
|
+
^self tag: 'header'
|
255
225
|
!
|
256
226
|
|
257
|
-
|
258
|
-
self
|
227
|
+
hgroup
|
228
|
+
^self tag: 'hgroup'
|
259
229
|
!
|
260
230
|
|
261
|
-
|
262
|
-
|
231
|
+
hr
|
232
|
+
^self tag: 'hr'
|
263
233
|
!
|
264
234
|
|
265
|
-
|
266
|
-
self
|
235
|
+
html
|
236
|
+
^self tag: 'html'
|
267
237
|
!
|
268
238
|
|
269
|
-
|
270
|
-
|
239
|
+
iframe
|
240
|
+
^self tag: 'iframe'
|
271
241
|
!
|
272
242
|
|
273
|
-
|
274
|
-
|
243
|
+
iframe: aString
|
244
|
+
^self iframe src: aString
|
275
245
|
!
|
276
246
|
|
277
|
-
|
278
|
-
|
247
|
+
img
|
248
|
+
^self tag: 'img'
|
279
249
|
!
|
280
250
|
|
281
|
-
|
282
|
-
|
251
|
+
img: aString
|
252
|
+
^self img src: aString
|
283
253
|
!
|
284
254
|
|
285
|
-
|
286
|
-
|
255
|
+
input
|
256
|
+
^self tag: 'input'
|
287
257
|
!
|
288
258
|
|
289
|
-
|
290
|
-
self
|
259
|
+
label
|
260
|
+
^self tag: 'label'
|
291
261
|
!
|
292
262
|
|
293
|
-
|
294
|
-
self
|
263
|
+
legend
|
264
|
+
^self tag: 'legend'
|
295
265
|
!
|
296
266
|
|
297
|
-
|
298
|
-
|
299
|
-
! !
|
300
|
-
|
301
|
-
!TagBrush methodsFor: 'initialization'!
|
302
|
-
|
303
|
-
initializeFromString: aString canvas: aCanvas
|
304
|
-
element := self createElementFor: aString.
|
305
|
-
canvas := aCanvas
|
267
|
+
li
|
268
|
+
^self tag: 'li'
|
306
269
|
!
|
307
270
|
|
308
|
-
|
309
|
-
|
310
|
-
canvas := aCanvas
|
311
|
-
! !
|
312
|
-
|
313
|
-
!TagBrush methodsFor: 'private'!
|
314
|
-
|
315
|
-
createElementFor: aString
|
316
|
-
<return document.createElement(String(aString))>
|
271
|
+
li: anObject
|
272
|
+
^self li with: anObject
|
317
273
|
!
|
318
274
|
|
319
|
-
|
320
|
-
|
321
|
-
!
|
322
|
-
|
323
|
-
!TagBrush class methodsFor: 'instance creation'!
|
275
|
+
link
|
276
|
+
^self tag: 'link'
|
277
|
+
!
|
324
278
|
|
325
|
-
|
326
|
-
|
327
|
-
initializeFromString: aString canvas: aCanvas;
|
328
|
-
yourself
|
279
|
+
map
|
280
|
+
^self tag: 'map'
|
329
281
|
!
|
330
282
|
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
yourself
|
335
|
-
! !
|
283
|
+
mark
|
284
|
+
^self tag: 'mark'
|
285
|
+
!
|
336
286
|
|
337
|
-
|
338
|
-
|
339
|
-
|
287
|
+
menu
|
288
|
+
^self tag: 'menu'
|
289
|
+
!
|
340
290
|
|
341
|
-
|
291
|
+
meta
|
292
|
+
^self tag: 'meta'
|
293
|
+
!
|
342
294
|
|
343
|
-
|
344
|
-
|
295
|
+
nav
|
296
|
+
^self tag: 'nav'
|
345
297
|
!
|
346
298
|
|
347
|
-
|
348
|
-
^
|
349
|
-
!
|
299
|
+
newTag: aString
|
300
|
+
^TagBrush fromString: aString canvas: self
|
301
|
+
!
|
350
302
|
|
351
|
-
|
303
|
+
noscript
|
304
|
+
^self tag: 'noscript'
|
305
|
+
!
|
352
306
|
|
353
|
-
|
354
|
-
|
355
|
-
!
|
307
|
+
object
|
308
|
+
^self tag: 'object'
|
309
|
+
!
|
356
310
|
|
357
|
-
|
311
|
+
ol
|
312
|
+
^self tag: 'ol'
|
313
|
+
!
|
358
314
|
|
359
|
-
|
360
|
-
|
361
|
-
root ifNil: [root := TagBrush fromString: 'div' canvas: self]
|
315
|
+
ol: anObject
|
316
|
+
^self ol with: anObject
|
362
317
|
!
|
363
318
|
|
364
|
-
|
365
|
-
|
366
|
-
!
|
319
|
+
optgroup
|
320
|
+
^self tag: 'optgroup'
|
321
|
+
!
|
367
322
|
|
368
|
-
|
323
|
+
option
|
324
|
+
^self tag: 'option'
|
325
|
+
!
|
369
326
|
|
370
|
-
|
371
|
-
|
327
|
+
output
|
328
|
+
^self tag: 'output'
|
372
329
|
!
|
373
330
|
|
374
|
-
|
375
|
-
^
|
331
|
+
p
|
332
|
+
^self tag: 'p'
|
376
333
|
!
|
377
334
|
|
378
|
-
|
379
|
-
^self
|
335
|
+
p: anObject
|
336
|
+
^self p with: anObject
|
380
337
|
!
|
381
338
|
|
382
|
-
|
383
|
-
|
339
|
+
param
|
340
|
+
^self tag: 'param'
|
384
341
|
!
|
385
342
|
|
386
|
-
|
387
|
-
^self tag: '
|
343
|
+
pre
|
344
|
+
^self tag: 'pre'
|
388
345
|
!
|
389
346
|
|
390
|
-
|
391
|
-
|
347
|
+
progress
|
348
|
+
^self tag: 'progress'
|
392
349
|
!
|
393
350
|
|
394
|
-
|
395
|
-
^self tag: '
|
351
|
+
script
|
352
|
+
^self tag: 'script'
|
396
353
|
!
|
397
354
|
|
398
|
-
|
399
|
-
^self tag: '
|
355
|
+
section
|
356
|
+
^self tag: 'section'
|
357
|
+
!
|
358
|
+
|
359
|
+
select
|
360
|
+
^self tag: 'select'
|
400
361
|
!
|
401
362
|
|
402
|
-
|
403
|
-
|
363
|
+
small
|
364
|
+
^self tag: 'small'
|
404
365
|
!
|
405
366
|
|
406
|
-
|
407
|
-
|
367
|
+
source
|
368
|
+
^self tag: 'source'
|
408
369
|
!
|
409
370
|
|
410
371
|
span
|
411
372
|
^self tag: 'span'
|
412
373
|
!
|
413
374
|
|
414
|
-
|
415
|
-
^self
|
416
|
-
!
|
417
|
-
|
418
|
-
ul
|
419
|
-
^self tag: 'ul'
|
375
|
+
span: anObject
|
376
|
+
^self span with: anObject
|
420
377
|
!
|
421
378
|
|
422
|
-
|
423
|
-
|
379
|
+
strong
|
380
|
+
^self tag: 'strong'
|
424
381
|
!
|
425
382
|
|
426
|
-
|
427
|
-
|
383
|
+
strong: anObject
|
384
|
+
^self strong with: anObject
|
428
385
|
!
|
429
386
|
|
430
|
-
|
431
|
-
|
387
|
+
style
|
388
|
+
^ root addBrush: (StyleTag canvas: self)
|
432
389
|
!
|
433
390
|
|
434
|
-
|
435
|
-
|
391
|
+
style: aString
|
392
|
+
^ self style with: aString; yourself
|
436
393
|
!
|
437
394
|
|
438
|
-
|
439
|
-
|
395
|
+
sub
|
396
|
+
^self tag: 'sub'
|
440
397
|
!
|
441
398
|
|
442
|
-
|
443
|
-
|
399
|
+
summary
|
400
|
+
^self tag: 'summary'
|
444
401
|
!
|
445
402
|
|
446
|
-
|
447
|
-
|
403
|
+
sup
|
404
|
+
^self tag: 'sup'
|
448
405
|
!
|
449
406
|
|
450
|
-
|
451
|
-
^self tag: '
|
407
|
+
table
|
408
|
+
^self tag: 'table'
|
452
409
|
!
|
453
410
|
|
454
|
-
|
455
|
-
^self
|
411
|
+
tag: aString
|
412
|
+
^root addBrush: (self newTag: aString)
|
456
413
|
!
|
457
414
|
|
458
|
-
|
459
|
-
^self tag: '
|
415
|
+
tbody
|
416
|
+
^self tag: 'tbody'
|
460
417
|
!
|
461
418
|
|
462
|
-
|
463
|
-
^self tag: '
|
419
|
+
td
|
420
|
+
^self tag: 'td'
|
464
421
|
!
|
465
422
|
|
466
423
|
textarea
|
467
424
|
^self tag: 'textarea'
|
468
425
|
!
|
469
426
|
|
470
|
-
|
471
|
-
^self tag: '
|
472
|
-
!
|
473
|
-
|
474
|
-
canvas
|
475
|
-
^self tag: 'canvas'
|
427
|
+
tfoot
|
428
|
+
^self tag: 'tfoot'
|
476
429
|
!
|
477
430
|
|
478
|
-
|
479
|
-
^self tag: '
|
431
|
+
th
|
432
|
+
^self tag: 'th'
|
480
433
|
!
|
481
434
|
|
482
|
-
|
483
|
-
^self tag: '
|
435
|
+
thead
|
436
|
+
^self tag: 'thead'
|
484
437
|
!
|
485
438
|
|
486
|
-
|
487
|
-
|
439
|
+
time
|
440
|
+
^self tag: 'time'
|
488
441
|
!
|
489
442
|
|
490
|
-
|
491
|
-
|
443
|
+
title
|
444
|
+
^self tag: 'title'
|
492
445
|
!
|
493
446
|
|
494
|
-
|
495
|
-
^self tag: '
|
447
|
+
tr
|
448
|
+
^self tag: 'tr'
|
496
449
|
!
|
497
450
|
|
498
|
-
|
499
|
-
|
451
|
+
ul
|
452
|
+
^self tag: 'ul'
|
500
453
|
!
|
501
454
|
|
502
|
-
|
503
|
-
^self
|
455
|
+
ul: anObject
|
456
|
+
^self ul with: anObject
|
504
457
|
!
|
505
458
|
|
506
|
-
|
507
|
-
^self
|
508
|
-
!
|
459
|
+
video
|
460
|
+
^self tag: 'video'
|
461
|
+
! !
|
509
462
|
|
510
|
-
|
511
|
-
^self tag: 'iframe'
|
512
|
-
!
|
463
|
+
!HTMLCanvas class methodsFor: 'instance creation'!
|
513
464
|
|
514
|
-
|
515
|
-
|
465
|
+
browserVersion
|
466
|
+
^(jQuery at: #browser) version
|
516
467
|
!
|
517
468
|
|
518
|
-
|
519
|
-
|
469
|
+
isMSIE
|
470
|
+
^((jQuery at: #browser) at: #msie) notNil
|
520
471
|
!
|
521
472
|
|
522
|
-
|
523
|
-
|
473
|
+
isMozilla
|
474
|
+
^((jQuery at: #browser) at: #mozilla) notNil
|
524
475
|
!
|
525
476
|
|
526
|
-
|
527
|
-
|
477
|
+
isOpera
|
478
|
+
^((jQuery at: #browser) at: #opera) notNil
|
528
479
|
!
|
529
480
|
|
530
|
-
|
531
|
-
|
481
|
+
isWebkit
|
482
|
+
^((jQuery at: #browser) at: #webkit) notNil
|
532
483
|
!
|
533
484
|
|
534
|
-
|
535
|
-
|
536
|
-
|
485
|
+
onJQuery: aJQuery
|
486
|
+
^self basicNew
|
487
|
+
initializeFromJQuery: aJQuery;
|
488
|
+
initialize;
|
489
|
+
yourself
|
490
|
+
! !
|
537
491
|
|
538
|
-
|
539
|
-
|
540
|
-
!
|
492
|
+
Object subclass: #TagBrush
|
493
|
+
instanceVariableNames: 'canvas element'
|
494
|
+
package: 'Canvas'!
|
541
495
|
|
542
|
-
|
543
|
-
^self ol with: anObject
|
544
|
-
!
|
496
|
+
!TagBrush methodsFor: 'accessing'!
|
545
497
|
|
546
|
-
|
547
|
-
^
|
548
|
-
!
|
498
|
+
element
|
499
|
+
^element
|
500
|
+
! !
|
549
501
|
|
550
|
-
|
551
|
-
^self ul with: anObject
|
552
|
-
!
|
502
|
+
!TagBrush methodsFor: 'adding'!
|
553
503
|
|
554
|
-
|
555
|
-
|
504
|
+
addBrush: aTagBrush
|
505
|
+
self appendChild: aTagBrush element.
|
506
|
+
^aTagBrush
|
556
507
|
!
|
557
508
|
|
558
|
-
|
559
|
-
|
509
|
+
append: anObject
|
510
|
+
anObject appendToBrush: self
|
560
511
|
!
|
561
512
|
|
562
|
-
|
563
|
-
|
513
|
+
appendBlock: aBlock
|
514
|
+
| root |
|
515
|
+
root := canvas root.
|
516
|
+
canvas root: self.
|
517
|
+
aBlock value: canvas.
|
518
|
+
canvas root: root
|
564
519
|
!
|
565
520
|
|
566
|
-
|
567
|
-
|
521
|
+
appendChild: anElement
|
522
|
+
"In IE7 and IE8 appendChild fails on several node types. So we need to check"
|
523
|
+
<var element=self['@element'];
|
524
|
+
if (null == element.canHaveChildren || element.canHaveChildren) {
|
525
|
+
element.appendChild(anElement);
|
526
|
+
} else {
|
527
|
+
element.text = String(element.text) + anElement.innerHTML;
|
528
|
+
} >
|
568
529
|
!
|
569
530
|
|
570
|
-
|
571
|
-
|
531
|
+
appendString: aString
|
532
|
+
self appendChild: (self createTextNodeFor: aString)
|
572
533
|
!
|
573
534
|
|
574
|
-
|
575
|
-
|
535
|
+
appendToBrush: aTagBrush
|
536
|
+
aTagBrush addBrush: self
|
576
537
|
!
|
577
538
|
|
578
|
-
|
579
|
-
|
539
|
+
contents: anObject
|
540
|
+
self
|
541
|
+
empty;
|
542
|
+
append: anObject
|
580
543
|
!
|
581
544
|
|
582
|
-
|
583
|
-
|
545
|
+
empty
|
546
|
+
self asJQuery empty
|
584
547
|
!
|
585
548
|
|
586
|
-
|
587
|
-
|
588
|
-
!
|
549
|
+
with: anObject
|
550
|
+
self append: anObject
|
551
|
+
! !
|
589
552
|
|
590
|
-
|
591
|
-
^self tag: 'tfoot'
|
592
|
-
!
|
553
|
+
!TagBrush methodsFor: 'attributes'!
|
593
554
|
|
594
|
-
|
595
|
-
|
555
|
+
accesskey: aString
|
556
|
+
self at: 'accesskey' put: aString
|
596
557
|
!
|
597
558
|
|
598
|
-
|
599
|
-
|
559
|
+
action: aString
|
560
|
+
self at: 'action' put: aString
|
600
561
|
!
|
601
562
|
|
602
|
-
|
603
|
-
|
563
|
+
align: aString
|
564
|
+
self at: 'align' put: aString
|
604
565
|
!
|
605
566
|
|
606
|
-
|
607
|
-
|
567
|
+
alt: aString
|
568
|
+
self at: 'alt' put: aString
|
608
569
|
!
|
609
570
|
|
610
|
-
|
611
|
-
|
571
|
+
at: aString put: aValue
|
572
|
+
<self['@element'].setAttribute(aString, aValue)>
|
612
573
|
!
|
613
574
|
|
614
|
-
|
615
|
-
|
575
|
+
class: aString
|
576
|
+
<self['@element'].className = aString>
|
616
577
|
!
|
617
578
|
|
618
|
-
|
619
|
-
|
579
|
+
cols: aString
|
580
|
+
self at: 'cols' put: aString
|
620
581
|
!
|
621
582
|
|
622
|
-
|
623
|
-
|
583
|
+
contenteditable: aString
|
584
|
+
self at: 'contenteditable' put: aString
|
624
585
|
!
|
625
586
|
|
626
|
-
|
627
|
-
|
587
|
+
contextmenu: aString
|
588
|
+
self at: 'contextmenu' put: aString
|
628
589
|
!
|
629
590
|
|
630
|
-
|
631
|
-
|
591
|
+
draggable: aString
|
592
|
+
self at: 'draggable' put: aString
|
632
593
|
!
|
633
594
|
|
634
|
-
|
635
|
-
|
595
|
+
for: aString
|
596
|
+
self at: 'for' put: aString
|
636
597
|
!
|
637
598
|
|
638
|
-
|
639
|
-
|
599
|
+
height: aString
|
600
|
+
self at: 'height' put: aString
|
640
601
|
!
|
641
602
|
|
642
|
-
|
643
|
-
|
603
|
+
hidden
|
604
|
+
self at: 'hidden' put: 'hidden'
|
644
605
|
!
|
645
606
|
|
646
|
-
|
647
|
-
|
607
|
+
href: aString
|
608
|
+
self at: 'href' put: aString
|
648
609
|
!
|
649
610
|
|
650
|
-
|
651
|
-
|
611
|
+
id: aString
|
612
|
+
self at: 'id' put: aString
|
652
613
|
!
|
653
614
|
|
654
|
-
|
655
|
-
|
615
|
+
media: aString
|
616
|
+
self at: 'media' put: aString
|
656
617
|
!
|
657
618
|
|
658
|
-
|
659
|
-
|
619
|
+
method: aString
|
620
|
+
self at: 'method' put: aString
|
660
621
|
!
|
661
622
|
|
662
|
-
|
663
|
-
|
623
|
+
name: aString
|
624
|
+
self at: 'name' put: aString
|
664
625
|
!
|
665
626
|
|
666
|
-
|
667
|
-
|
627
|
+
placeholder: aString
|
628
|
+
self at: 'placeholder' put: aString
|
668
629
|
!
|
669
630
|
|
670
|
-
|
671
|
-
|
631
|
+
rel: aString
|
632
|
+
self at: 'rel' put: aString
|
672
633
|
!
|
673
634
|
|
674
|
-
|
675
|
-
|
635
|
+
removeAt: aString
|
636
|
+
<self['@element'].removeAttribute(aString)>
|
676
637
|
!
|
677
638
|
|
678
|
-
|
679
|
-
|
639
|
+
rows: aString
|
640
|
+
self at: 'rows' put: aString
|
680
641
|
!
|
681
642
|
|
682
|
-
|
683
|
-
|
643
|
+
src: aString
|
644
|
+
self at: 'src' put: aString
|
684
645
|
!
|
685
646
|
|
686
|
-
|
687
|
-
|
647
|
+
style: aString
|
648
|
+
self at: 'style' put: aString
|
688
649
|
!
|
689
650
|
|
690
|
-
|
691
|
-
|
651
|
+
tabindex: aNumber
|
652
|
+
self at: 'tabindex' put: aNumber
|
692
653
|
!
|
693
654
|
|
694
|
-
|
695
|
-
|
655
|
+
target: aString
|
656
|
+
self at: 'target' put: aString
|
696
657
|
!
|
697
658
|
|
698
|
-
|
699
|
-
|
659
|
+
title: aString
|
660
|
+
self at: 'title' put: aString
|
700
661
|
!
|
701
662
|
|
702
|
-
|
703
|
-
|
663
|
+
type: aString
|
664
|
+
self at: 'type' put: aString
|
704
665
|
!
|
705
666
|
|
706
|
-
|
707
|
-
|
667
|
+
valign: aString
|
668
|
+
self at: 'valign' put: aString
|
708
669
|
!
|
709
670
|
|
710
|
-
|
711
|
-
|
671
|
+
value: aString
|
672
|
+
self at: 'value' put: aString
|
712
673
|
!
|
713
674
|
|
714
|
-
|
715
|
-
|
675
|
+
width: aString
|
676
|
+
self at: 'width' put: aString
|
677
|
+
! !
|
678
|
+
|
679
|
+
!TagBrush methodsFor: 'converting'!
|
680
|
+
|
681
|
+
asJQuery
|
682
|
+
^window jQuery: self element
|
683
|
+
! !
|
684
|
+
|
685
|
+
!TagBrush methodsFor: 'events'!
|
686
|
+
|
687
|
+
onBlur: aBlock
|
688
|
+
self asJQuery bind: 'blur' do: aBlock
|
716
689
|
!
|
717
690
|
|
718
|
-
|
719
|
-
|
691
|
+
onChange: aBlock
|
692
|
+
self asJQuery bind: 'change' do: aBlock
|
720
693
|
!
|
721
694
|
|
722
|
-
|
723
|
-
|
695
|
+
onClick: aBlock
|
696
|
+
self asJQuery bind: 'click' do: aBlock
|
724
697
|
!
|
725
698
|
|
726
|
-
|
727
|
-
|
699
|
+
onDblClick: aBlock
|
700
|
+
self asJQuery bind: 'dblclick' do: aBlock
|
728
701
|
!
|
729
702
|
|
730
|
-
|
731
|
-
|
703
|
+
onFocus: aBlock
|
704
|
+
self asJQuery bind: 'focus' do: aBlock
|
732
705
|
!
|
733
706
|
|
734
|
-
|
735
|
-
|
707
|
+
onFocusIn: aBlock
|
708
|
+
self asJQuery bind: 'focusin' do: aBlock
|
736
709
|
!
|
737
710
|
|
738
|
-
|
739
|
-
|
711
|
+
onFocusOut: aBlock
|
712
|
+
self asJQuery bind: 'focusout' do: aBlock
|
740
713
|
!
|
741
714
|
|
742
|
-
|
743
|
-
|
715
|
+
onHover: aBlock
|
716
|
+
self asJQuery bind: 'hover' do: aBlock
|
744
717
|
!
|
745
718
|
|
746
|
-
|
747
|
-
|
719
|
+
onKeyDown: aBlock
|
720
|
+
self asJQuery bind: 'keydown' do: aBlock
|
748
721
|
!
|
749
722
|
|
750
|
-
|
751
|
-
|
723
|
+
onKeyPress: aBlock
|
724
|
+
self asJQuery bind: 'keypress' do: aBlock
|
752
725
|
!
|
753
726
|
|
754
|
-
|
755
|
-
|
727
|
+
onKeyUp: aBlock
|
728
|
+
self asJQuery bind: 'keyup' do: aBlock
|
756
729
|
!
|
757
730
|
|
758
|
-
|
759
|
-
|
731
|
+
onMouseDown: aBlock
|
732
|
+
self asJQuery bind: 'mousedown' do: aBlock
|
760
733
|
!
|
761
734
|
|
762
|
-
|
763
|
-
|
735
|
+
onMouseEnter: aBlock
|
736
|
+
self asJQuery bind: 'mouseenter' do: aBlock
|
764
737
|
!
|
765
738
|
|
766
|
-
|
767
|
-
|
739
|
+
onMouseLeave: aBlock
|
740
|
+
self asJQuery bind: 'mouseleave' do: aBlock
|
768
741
|
!
|
769
742
|
|
770
|
-
|
771
|
-
|
743
|
+
onMouseMove: aBlock
|
744
|
+
self asJQuery bind: 'mousemove' do: aBlock
|
772
745
|
!
|
773
746
|
|
774
|
-
|
775
|
-
|
747
|
+
onMouseOut: aBlock
|
748
|
+
self asJQuery bind: 'mouseout' do: aBlock
|
776
749
|
!
|
777
750
|
|
778
|
-
|
779
|
-
|
751
|
+
onMouseOver: aBlock
|
752
|
+
self asJQuery bind: 'mouseover' do: aBlock
|
780
753
|
!
|
781
754
|
|
782
|
-
|
783
|
-
|
755
|
+
onMouseUp: aBlock
|
756
|
+
self asJQuery bind: 'mouseup' do: aBlock
|
784
757
|
!
|
785
758
|
|
786
|
-
|
787
|
-
|
759
|
+
onSelect: aBlock
|
760
|
+
self asJQuery bind: 'select' do: aBlock
|
788
761
|
!
|
789
762
|
|
790
|
-
|
791
|
-
|
763
|
+
onSubmit: aBlock
|
764
|
+
self asJQuery bind: 'submit' do: aBlock
|
792
765
|
!
|
793
766
|
|
794
|
-
|
795
|
-
|
767
|
+
onUnload: aBlock
|
768
|
+
self asJQuery bind: 'unload' do: aBlock
|
796
769
|
! !
|
797
770
|
|
798
|
-
!
|
771
|
+
!TagBrush methodsFor: 'initialization'!
|
799
772
|
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
initialize;
|
804
|
-
yourself
|
773
|
+
initializeFromJQuery: aJQuery canvas: aCanvas
|
774
|
+
element := aJQuery get: 0.
|
775
|
+
canvas := aCanvas
|
805
776
|
!
|
806
777
|
|
807
|
-
|
808
|
-
|
809
|
-
|
778
|
+
initializeFromString: aString canvas: aCanvas
|
779
|
+
element := self createElementFor: aString.
|
780
|
+
canvas := aCanvas
|
781
|
+
! !
|
810
782
|
|
811
|
-
|
812
|
-
^((jQuery at: #browser) at: #opera) notNil
|
813
|
-
!
|
783
|
+
!TagBrush methodsFor: 'private'!
|
814
784
|
|
815
|
-
|
816
|
-
|
785
|
+
createElementFor: aString
|
786
|
+
<return document.createElement(String(aString))>
|
817
787
|
!
|
818
788
|
|
819
|
-
|
820
|
-
|
789
|
+
createTextNodeFor: aString
|
790
|
+
<return document.createTextNode(String(aString))>
|
791
|
+
! !
|
792
|
+
|
793
|
+
!TagBrush class methodsFor: 'instance creation'!
|
794
|
+
|
795
|
+
fromJQuery: aJQuery canvas: aCanvas
|
796
|
+
^self new
|
797
|
+
initializeFromJQuery: aJQuery canvas: aCanvas;
|
798
|
+
yourself
|
821
799
|
!
|
822
800
|
|
823
|
-
|
824
|
-
|
801
|
+
fromString: aString canvas: aCanvas
|
802
|
+
^self new
|
803
|
+
initializeFromString: aString canvas: aCanvas;
|
804
|
+
yourself
|
825
805
|
! !
|
826
806
|
|
827
807
|
TagBrush subclass: #StyleTag
|
828
808
|
instanceVariableNames: 'canvas element'
|
829
|
-
|
809
|
+
package: 'Canvas'!
|
830
810
|
!StyleTag commentStamp!
|
831
811
|
I'm a <style> tag use to inline CSS or load a stylesheet.
|
832
812
|
|
@@ -848,37 +828,57 @@ canvas: aCanvas
|
|
848
828
|
yourself
|
849
829
|
! !
|
850
830
|
|
851
|
-
|
831
|
+
Object subclass: #Widget
|
832
|
+
instanceVariableNames: ''
|
833
|
+
package: 'Canvas'!
|
852
834
|
|
853
|
-
|
854
|
-
|
835
|
+
!Widget methodsFor: 'adding'!
|
836
|
+
|
837
|
+
appendToBrush: aTagBrush
|
838
|
+
self appendToJQuery: aTagBrush asJQuery
|
855
839
|
!
|
856
840
|
|
841
|
+
appendToJQuery: aJQuery
|
842
|
+
self renderOn: (HTMLCanvas onJQuery: aJQuery)
|
843
|
+
! !
|
844
|
+
|
845
|
+
!Widget methodsFor: 'rendering'!
|
846
|
+
|
847
|
+
renderOn: html
|
848
|
+
self
|
849
|
+
! !
|
850
|
+
|
851
|
+
!Object methodsFor: '*Canvas'!
|
852
|
+
|
857
853
|
appendToBrush: aTagBrush
|
858
854
|
aTagBrush append: self asString
|
855
|
+
!
|
856
|
+
|
857
|
+
appendToJQuery: aJQuery
|
858
|
+
aJQuery append: self asString
|
859
859
|
! !
|
860
860
|
|
861
861
|
!BlockClosure methodsFor: '*Canvas'!
|
862
862
|
|
863
|
-
appendToJQuery: aJQuery
|
864
|
-
self value: (HTMLCanvas onJQuery: aJQuery)
|
865
|
-
!
|
866
|
-
|
867
863
|
appendToBrush: aTagBrush
|
868
864
|
aTagBrush appendBlock: self
|
865
|
+
!
|
866
|
+
|
867
|
+
appendToJQuery: aJQuery
|
868
|
+
self value: (HTMLCanvas onJQuery: aJQuery)
|
869
869
|
! !
|
870
870
|
|
871
871
|
!String methodsFor: '*Canvas'!
|
872
872
|
|
873
|
-
|
874
|
-
|
873
|
+
appendToBrush: aTagBrush
|
874
|
+
aTagBrush appendString: self
|
875
875
|
!
|
876
876
|
|
877
877
|
appendToJQuery: aJQuery
|
878
878
|
aJQuery append: self
|
879
879
|
!
|
880
880
|
|
881
|
-
|
882
|
-
|
881
|
+
asJQuery
|
882
|
+
<return jQuery(String(self))>
|
883
883
|
! !
|
884
884
|
|