WebST: Framework & Tools for Test-Driven Development of Web Components with Smalltalk
nourybouraqadi
129 views
60 slides
Jul 11, 2024
Slide 1 of 60
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
About This Presentation
Web Components are standard web technologies that support the definition of reusable custom HTML elements. This talk introduces WebST (https://github.com/bouraqadi/WebST) a solution to seamlessly implement and test web components using the powerful Pharo Smalltalk IDE (https://pharo.org). By delvin...
Web Components are standard web technologies that support the definition of reusable custom HTML elements. This talk introduces WebST (https://github.com/bouraqadi/WebST) a solution to seamlessly implement and test web components using the powerful Pharo Smalltalk IDE (https://pharo.org). By delving into practical examples, we demonstrate how WebST facilitates the implementation and reuse of web components. Moreover, for production purposes, WebST generates web clients with standalone HTML and JavaScript code.
Size: 3.44 MB
Language: en
Added: Jul 11, 2024
Slides: 60 pages
Slide Content
1
WebST
30th ESUG Conference
European Smalltalk Users Group
Lille, France, 8 - 11 July 2024
2
I want to
make this
web page
3
Updates
every
second
4
Different
View States
5
But, I am
Lazy!
6Web Components
you reuse must
\
7
Noury
Bouraqadi
8PLC3000.com
Noury
Bouraqadi
9
Web Components
&
Smalltalk
●Custom HTML tags
●HTML + CSS + JS
●Encapsulation = No collisions
10
Web Components = W3C Standard
webcomponents.org
initModel
super initModel.
model -@ #countPort => [ :newCount |
self displayCount: newCount ].
self updateDisplay
updateDisplay
display textContent: model count asString
30
Component Links Model to View
Update View When
Model Changes
initModel
super initModel.
model -@ #countPort => [ :newCount |
self displayCount: newCount ].
self updateDisplay
updateDisplay
display textContent: model count asString
31
View Observes the Model
Subscribe to count changes
initView
| incrementButton decrementButton resetButton |
super initView.
display := view querySelector: '.display'.
incrementButton := view querySelector: '.increment'.
self onClickElement: incrementButton do: [ model increment ].
decrementButton := …
32
Component Links View to Model
Clicks on View
Increment Model
initView
| incrementButton decrementButton resetButton |
super initView.
display := view querySelector: '.display'.
incrementButton := view querySelector: '.increment'.
self onClickElement: incrementButton do: [ model increment ].
decrementButton := …
33
Navigating the DOM
JavaScript
API !
?
12
34
❤The
force
you must use
Develop
100% Pharo
Run 100%
JavaScript
35●Generate JavaScript from Smalltalk
●Link JavaScript Third Party Libraries
●Test JavaScript + Web Clients
Develop 100% Pharo
Run 100% JavaScript
36
HTML
JavaScript
Smalltalk
37
HTML ✅
JavaScript ✅
CSS❓
38HTML ✅
JavaScript ✅
CSS❓
Reuse
you must!
The JavaScript
force you must use!
39
Reuse
Candidate
A View can Link Resources
40
WsCounterView
WsCounterComponent
WsCounterModel
Bootstrap
CSS
Bootstrap
JS
41
to Render CSS Resources
renderTagOn: html
^ html link
beStylesheet;
url: self url;
yourself
42
to Render JavaScript Resources
renderTagOn: html
^ html script
defer;
type: 'text/javascript';
url: self url;
yourself
43
HTML
JavaScript
Smalltalk CSS
44
Smalltalk
Web
Components
Framework
+ Tools
45
Smalltalk
Web
Components
WebST
46
Smalltalk
WebST
Standalone
Web
Clients
JSHTML
47How to Make
Complex
Components?
21
Player B
18
Player A
Game Score
48How to make
complex
components?
21
Player B
18
Player A
Game Score
Composite Design
Pattern
You must use!
49
21
Player B
18
Player A
Game Score
Editable Text
Component
Counter
Component