Skip to content

Commit 0aebd47

Browse files
committed
#6873 replaced all pre tags inside the learning content
1 parent 1ca08b7 commit 0aebd47

27 files changed

Lines changed: 209 additions & 209 deletions

learn/UsingTheseTopics.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ You can also launch the preview in a window by going to the Preview tab, then cl
4141
icon on the right <span class="far fa-xs fa-window-maximize"></span>. This web site is a Neo.mjs application,
4242
and the ability to launch browser windows &mdash; all integrated within a single app &mdash; is a unique feature of Neo.mjs!
4343

44-
<pre data-code-livepreview>
44+
```javascript live-preview
4545
import Button from '../button/Base.mjs';
4646
import Container from '../container/Base.mjs';
4747

@@ -57,7 +57,7 @@ class MainView extends Container {
5757
}
5858

5959
MainView = Neo.setupClass(MainView);
60-
</pre>
60+
```
6161

6262
---
6363

learn/benefits/ConfigSystem.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ and nested approach to their configuration, a gap that a class config system aim
1010
## A bad example
1111
I recently found this Angular code snippet (new public API draft) on LinkedIn:
1212

13-
<pre data-code-readonly>
13+
```javascript readonly
1414
// MyComponent with an attribute
1515
<MyComponent myAttribute="someValue" />
1616

@@ -25,7 +25,7 @@ I recently found this Angular code snippet (new public API draft) on LinkedIn:
2525

2626
// Scoped inputs for MyDirective
2727
<MyComponent @MyDirective(input1="someString" [input2]="mySignal()") />
28-
</pre>
28+
```
2929

3030
Now you might wonder why I think that this is not a good way to create apps.
3131

learn/benefits/FormsEngine.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
You do not need to define a state tree on your own.
44
It is sufficient to just use namespaces inside the `name` attribute of each field.
55

6-
<pre data-code-livepreview>
6+
```javascript live-preview
77
import Button from '../button/Base.mjs';
88
import FormContainer from '../form/Container.mjs';
99
import TextField from '../form/field/Text.mjs';
@@ -38,7 +38,7 @@ class MainView extends FormContainer {
3838
}
3939
}
4040
MainView = Neo.setupClass(MainView);
41-
</pre>
41+
```
4242

4343
## Forms can get validated without being mounted
4444

@@ -49,7 +49,7 @@ Getting the field values still works like before.
4949
Use case: In case you have a form split into multiple pages and only one of them is mounted to keep
5050
the DOM minimal, you can still get all field values.
5151

52-
<pre data-code-livepreview>
52+
```javascript live-preview
5353
import Button from '../button/Base.mjs';
5454
import Container from '../container/Base.mjs';
5555
import FormContainer from '../form/Container.mjs';
@@ -89,7 +89,7 @@ class MainView extends Container {
8989
}
9090
}
9191
MainView = Neo.setupClass(MainView);
92-
</pre>
92+
```
9393

9494
## Nested Forms
9595

@@ -104,28 +104,28 @@ Inside the example preview, clear the user lastname via hitting the x-button.
104104
Afterwards, click on the 3 buttons at the bottom and inspect the output inside the main window console carefully.
105105

106106
The main form will log:
107-
<pre data-code-readonly>
107+
```javascript readonly
108108
{
109109
account: 'My Account',
110110
product: {brand: 'Tesla', name: 'Car'},
111111
user : {firstname: 'John', lastname: null}
112112
}
113113
'isValid: false'
114-
</pre>
114+
```
115115

116116
The user form will log:
117-
<pre data-code-readonly>
117+
```javascript readonly
118118
{user: {firstname: 'John', lastname: null}}
119119
'isValid: false'
120-
</pre>
120+
```
121121

122122
The product form will log:
123-
<pre data-code-readonly>
123+
```javascript readonly
124124
{product: {brand: 'Tesla', name: 'Car'}}
125125
'isValid: true'
126-
</pre>
126+
```
127127

128-
<pre data-code-livepreview>
128+
```javascript live-preview
129129
import Button from '../button/Base.mjs';
130130
import Container from '../container/Base.mjs';
131131
import FormContainer from '../form/Container.mjs';
@@ -223,7 +223,7 @@ class MainView extends FormContainer {
223223
}
224224
}
225225
MainView = Neo.setupClass(MainView);
226-
</pre>
226+
```
227227

228228
Bonus: Inspect the DOM Inside the `TabContainer`.
229229
You will notice that only the active Tab is mounted inside the DOM.
@@ -244,12 +244,12 @@ since it does rely on defining child modules inside their own class files
244244
and dynamically importing them.
245245

246246
In a nutshell:
247-
<pre data-code-readonly>
247+
```javascript readonly
248248
{
249249
module: TabContainer,
250250
items : [
251251
{module: () => import('./MyChildForm1.mjs')},
252252
{module: () => import('./MyChildForm2.mjs')}
253253
]
254254
}
255-
</pre>
255+
```

learn/benefits/MultiWindow.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ running the code. Even though it's running in a new window, it's still part of t
1414
(In this case, the app is the web site you're looking at now.) That means both the code in both windows
1515
seamlessly share events, data, etc. &mdash; the code doesn't care that some code is running in a
1616
separate window.
17-
<pre data-code-livepreview>
17+
```javascript live-preview
1818
import Button from '../button/Base.mjs';
1919
import Container from '../container/Base.mjs';
2020

@@ -31,6 +31,6 @@ class MainView extends Container {
3131
}
3232

3333
MainView = Neo.setupClass(MainView);
34-
</pre>
34+
```
3535

3636
</details>

learn/benefits/OffTheMainThread.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,13 @@ The worst case that could happen now is that your app worker will slow down and
8989
this will not affect your UI (rendering thread → main).
9090
Probably the best solution for single page apps (SPAs) as well as multi-window apps (MWAs) looks like this:
9191

92-
<pre data-neo-component>
92+
```json neo-component
9393
{
9494
"cls" : "neo-worker-setup",
9595
"tag" : "element-loader",
9696
"vdom": {"src": "./resources/images/workers-focus.svg"}
9797
}
98-
</pre>
98+
```
9999

100100
To prevent the app worker from handling too much logic, we can optionally spawn more workers.
101101
Each thread has its fixed scope. Let us take a quick look into each of them.

learn/benefits/Speed.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Click on Preview, then use your mouse or trackpad to pan and zoom &mdash; the he
2020
If you move quickly, you might reach 20,000 or 30,000 delta updates per second. We've seen some examples that go over 40,000 updates per
2121
second &mdash; but we've never actually hit the limit.
2222

23-
<pre data-code-livepreview>
23+
```javascript live-preview
2424
import Container from '../container/Base.mjs';
2525
import Helix from '../component/Helix.mjs';
2626

@@ -43,7 +43,7 @@ class MainView extends Container {
4343
}
4444
}
4545
MainView = Neo.setupClass(MainView);
46-
</pre>
46+
```
4747

4848

4949
If you're interested, there's <a href="../../examples/component/helix/index.html" target="_blank">a more full-featured helix example</a> that includes showing delta updates,

learn/gettingstarted/ComponentModels.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Neo has a feature that allows shared, bindable, data.
33
A _state provider_ &mdash; `Neo.state.Provider` &mdash; instance holds properties that
44
can be bound to component properties.
55

6-
<pre data-code-livepreview>
6+
```javascript live-preview
77
import Container from '../container/Base.mjs';
88
import Label from '../component/Label.mjs';
99
import TextField from '../form/field/Text.mjs';
@@ -35,7 +35,7 @@ class MainView extends Container {
3535
}
3636
}
3737
MainView = Neo.setupClass(MainView);
38-
</pre>
38+
```
3939

4040
View model properties are visible down the containment hierarchy:
4141
Properties introduced in a parent container will be available to any child component, and properties
@@ -55,7 +55,7 @@ usually coded as separate classes.)
5555

5656
Below is another example.
5757

58-
<pre data-code-livepreview>
58+
```javascript live-preview
5959
import Container from '../container/Base.mjs';
6060
import Label from '../component/Label.mjs';
6161
import Panel from '../container/Panel.mjs';
@@ -107,7 +107,7 @@ class MainView extends Container {
107107
}
108108
}
109109
MainView = Neo.setupClass(MainView);
110-
</pre>
110+
```
111111

112112
In this case, the main view has three child items of type `MyPanel`, each containing a label.
113113
The main view has a state provider with a `foo` property, and the third child has its own state provider with a `foo` property.

learn/gettingstarted/Config.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Here's an example of a new component class `Simple` with three config properties
1717
The `Simple` class introduces syntax. It doesn't have any content, so if you run the code you won't
1818
see anything. We'll change that in the next example.
1919

20-
<pre data-code-livepreview>
20+
```javascript live-preview
2121
import Component from '../component/Base.mjs';
2222
import Container from '../container/Base.mjs';
2323

@@ -48,7 +48,7 @@ class MainView extends Container {
4848
}
4949
}
5050
MainView = Neo.setupClass(MainView);
51-
</pre>
51+
```
5252

5353
## Detecting when a value changes
5454

@@ -57,7 +57,7 @@ a _lifecyle property_. A lifecycle property provides methods that are run as the
5757
updated or accessed. You're free to implment these methods to provide business rules, normalize
5858
values, or have side-effects, such as updating a view or firing an event.
5959

60-
<pre data-code-livepreview>
60+
```javascript live-preview
6161
import Component from '../component/Base.mjs';
6262
import Container from '../container/Base.mjs';
6363

@@ -98,7 +98,7 @@ class MainView extends Container {
9898
}
9999
}
100100
MainView = Neo.setupClass(MainView);
101-
</pre>
101+
```
102102

103103
This time if you run the code you'll see "hi there" in the view. That's because the Simple instance is
104104
configured with `bar: 'hi there'`, and since that's a lifecycle property the `afterSetBar()` method
@@ -110,7 +110,7 @@ Typically, the _afterSet_ method is used to update a view or to fire an event.
110110

111111
Look at this code: `afterSetBar()` fires an event, and the config in the `items[]` is listening to it.
112112

113-
<pre data-code-livepreview>
113+
```javascript live-preview
114114
import Component from '../component/Base.mjs';
115115
import Container from '../container/Base.mjs';
116116

@@ -149,5 +149,5 @@ class MainView extends Container {
149149
}
150150
}
151151
MainView = Neo.setupClass(MainView);
152-
</pre>
152+
```
153153

learn/gettingstarted/DescribingTheUI.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use to describe the component you're creating> You can also access or set the pr
1010

1111
## A view with one component
1212

13-
<pre data-code-livepreview>
13+
```javascript live-preview
1414
import Button from '../button/Base.mjs';
1515
import Container from '../container/Base.mjs';
1616

@@ -27,7 +27,7 @@ class MainView extends Container {
2727
}
2828

2929
MainView = Neo.setupClass(MainView);
30-
</pre>
30+
```
3131

3232

3333
The button config is just an object describing the button being created. In the example, it has three
@@ -46,7 +46,7 @@ Let's put a second button in the container.
4646

4747
## A view with two components
4848

49-
<pre data-code-livepreview>
49+
```javascript live-preview
5050
import Button from '../button/Base.mjs';
5151
import Container from '../container/Base.mjs';
5252

@@ -67,7 +67,7 @@ class MainView extends Container {
6767
}
6868

6969
MainView = Neo.setupClass(MainView);
70-
</pre>
70+
```
7171

7272
If you run the example you'll see two buttons, arranged according to the `layout`. If you'd like,
7373
modify the code to specify `ntype:'hbox'` and run it again.

learn/gettingstarted/Events.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pairs as you need.
1313
The code below shows two text fields, with `listeners` for `change` and `focusEnter`.
1414
(The events for any component are documented in the API docs.)
1515

16-
<pre data-code-livepreview>
16+
```javascript live-preview
1717
import Container from '../container/Base.mjs';
1818
import TextField from '../form/field/Text.mjs';
1919

@@ -38,7 +38,7 @@ class MainView extends Container {
3838
}
3939
}
4040
MainView = Neo.setupClass(MainView);
41-
</pre>
41+
```
4242

4343
If you run the example, and open the browser's debugger, you'll see the console being logged as you type or give
4444
focus to either field.
@@ -52,7 +52,7 @@ that with a _component controller_.
5252
A `Neo.controller.Component` is a simple class associated with a component class. As a view is created, an
5353
instance of its associated controller is automatically created.
5454

55-
<pre data-code-livepreview>
55+
```javascript live-preview
5656
import Base from '../controller/Component.mjs';
5757

5858
class MainViewController extends Base {
@@ -86,7 +86,7 @@ class MainView extends Container {
8686
}
8787
}
8888
MainView = Neo.setupClass(MainView);
89-
</pre>
89+
```
9090

9191

9292

@@ -116,7 +116,7 @@ automatically get lifecycle methods run before the value is assigned, after the
116116
before the value is accessed. We're using the _after_ method to fire a `change` event.
117117

118118

119-
<pre data-code-livepreview>
119+
```javascript live-preview
120120
import Button from '../button/Base.mjs';
121121
import Container from '../container/Base.mjs';
122122

@@ -154,4 +154,4 @@ class MainView extends Container {
154154
}
155155
}
156156
MainView = Neo.setupClass(MainView);
157-
</pre>
157+
```

0 commit comments

Comments
 (0)