@gramlot/gramlot-examples 0.2.11 → 0.2.12
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/README.md +3 -3
- package/package.json +3 -3
- package/src/gramlot_examples/catalog.json +23 -5
- package/src/gramlot_examples/gallery/dist/frame.js +1473 -5
- package/src/gramlot_examples/gallery/dist/gallery.js +3822 -17162
- package/src/gramlot_examples/gallery/dist/notices.json +2 -22
- package/src/gramlot_examples/gallery/dist/theme-styles.js +2 -0
- package/src/gramlot_examples/gallery/gallery-page.js +38 -67
- package/src/gramlot_examples/gallery/gallery.css +22 -94
- package/src/gramlot_examples/index.js +2 -1
- package/src/gramlot_examples/pages/README.md +83 -1
- package/src/gramlot_examples/pages/binding/01_pointers.js +9 -0
- package/src/gramlot_examples/pages/binding/01_pointers.md +56 -9
- package/src/gramlot_examples/pages/binding/02_variable_datapath.md +50 -4
- package/src/gramlot_examples/pages/binding/03_setters_and_defaults.md +45 -6
- package/src/gramlot_examples/pages/binding/04_native_editing.md +48 -6
- package/src/gramlot_examples/pages/binding/05_checkbox_radio.md +44 -4
- package/src/gramlot_examples/pages/binding/06_style_and_visibility.md +40 -6
- package/src/gramlot_examples/pages/binding/07_bound_svg.md +48 -3
- package/src/gramlot_examples/pages/binding/08_freeze.js +1 -1
- package/src/gramlot_examples/pages/binding/08_freeze.md +44 -6
- package/src/gramlot_examples/pages/binding/09_forms.js +2 -1
- package/src/gramlot_examples/pages/binding/09_forms.md +53 -7
- package/src/gramlot_examples/pages/binding/10_svg_shapes.md +50 -5
- package/src/gramlot_examples/pages/binding/11_complete_page.md +53 -7
- package/src/gramlot_examples/pages/binding/README.md +34 -0
- package/src/gramlot_examples/pages/controllers/01_formula.md +48 -7
- package/src/gramlot_examples/pages/controllers/02_controller.js +24 -2
- package/src/gramlot_examples/pages/controllers/02_controller.md +61 -6
- package/src/gramlot_examples/pages/controllers/03_named_logic.md +63 -7
- package/src/gramlot_examples/pages/controllers/04_inline_expressions.md +50 -7
- package/src/gramlot_examples/pages/controllers/05_node_methods.md +41 -7
- package/src/gramlot_examples/pages/controllers/06_button_controller.md +49 -6
- package/src/gramlot_examples/pages/controllers/07_events.md +45 -6
- package/src/gramlot_examples/pages/controllers/08_end_to_end.js +26 -1
- package/src/gramlot_examples/pages/controllers/08_end_to_end.md +138 -9
- package/src/gramlot_examples/pages/controllers/09_endpoint.md +47 -7
- package/src/gramlot_examples/pages/controllers/10_call_on_change.md +48 -8
- package/src/gramlot_examples/pages/controllers/11_call_on_click.js +6 -0
- package/src/gramlot_examples/pages/controllers/11_call_on_click.md +58 -6
- package/src/gramlot_examples/pages/controllers/12_remote.md +55 -8
- package/src/gramlot_examples/pages/controllers/13_cached_remote.js +2 -2
- package/src/gramlot_examples/pages/controllers/13_cached_remote.md +62 -7
- package/src/gramlot_examples/pages/controllers/14_data_remote.js +10 -2
- package/src/gramlot_examples/pages/controllers/14_data_remote.md +65 -6
- package/src/gramlot_examples/pages/controllers/15_lifecycle.js +51 -0
- package/src/gramlot_examples/pages/controllers/15_lifecycle.md +59 -0
- package/src/gramlot_examples/pages/controllers/16_attribute_projection.js +25 -0
- package/src/gramlot_examples/pages/controllers/16_attribute_projection.md +58 -0
- package/src/gramlot_examples/pages/controllers/17_data_exchange.js +51 -0
- package/src/gramlot_examples/pages/controllers/17_data_exchange.md +61 -0
- package/src/gramlot_examples/pages/controllers/README.md +55 -1
- package/src/gramlot_examples/pages/html_svg/01_hello_world.md +48 -4
- package/src/gramlot_examples/pages/html_svg/02_text_and_links.md +42 -4
- package/src/gramlot_examples/pages/html_svg/03_lists.md +45 -4
- package/src/gramlot_examples/pages/html_svg/04_semantic_page.md +44 -4
- package/src/gramlot_examples/pages/html_svg/05_tables.md +46 -4
- package/src/gramlot_examples/pages/html_svg/06_forms.md +48 -4
- package/src/gramlot_examples/pages/html_svg/07_native_disclosure.md +41 -4
- package/src/gramlot_examples/pages/html_svg/08_svg_shapes.md +45 -4
- package/src/gramlot_examples/pages/html_svg/09_svg_composition.md +44 -4
- package/src/gramlot_examples/pages/html_svg/10_cards_with_icons.md +42 -15
- package/src/gramlot_examples/pages/html_svg/11_static_report.md +37 -4
- package/src/gramlot_examples/pages/html_svg/12_complete_page.md +41 -4
- package/src/gramlot_examples/pages/html_svg/13_live_source.md +47 -16
- package/src/gramlot_examples/pages/html_svg/README.md +36 -0
|
@@ -1,9 +1,50 @@
|
|
|
1
1
|
# 03 · Lists
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Bullet lists, numbered lists and terms with descriptions. You learn how a loop builds several elements from a set of values when the page is created.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**Uses:** Source and native HTML/SVG — core 0.1.x. No Data binding.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
<details>
|
|
8
|
+
<summary>More detail</summary>
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
|
|
11
|
+
**Release stage:** Source foundation (core 0.1.x); maintained syntax is used here.
|
|
12
|
+
|
|
13
|
+
**Goal:** Distinguish a Python build-time loop from reactive Data.
|
|
14
|
+
|
|
15
|
+
**Before this lesson:** [e01 · Hello World](https://github.com/gramlot-org/gramlot-examples/blob/main/src/gramlot_examples/pages/html_svg/01_hello_world.md), [e02 · Text and links](https://github.com/gramlot-org/gramlot-examples/blob/main/src/gramlot_examples/pages/html_svg/02_text_and_links.md). These prerequisites support the release sequence; later comparisons are explicitly labelled below.
|
|
16
|
+
|
|
17
|
+
**Open and edit:** select **e03 · Lists** in your environment’s gallery. For source changes, copy/edit the matching page in your own project using the [setup guide](https://github.com/gramlot-org/gramlot/blob/main/docs/public/025-try.md); the gallery is a source viewer. Save, then reload/reopen as that guide explains. The snippets below are excerpts/edits within that Page, not standalone launch commands.
|
|
18
|
+
|
|
19
|
+
## Read the page
|
|
20
|
+
|
|
21
|
+
`STEPS` drives an ordered list, `TERMS` drives paired `dt`/`dd` nodes, and a nested `ul` is a child of one `li`.
|
|
22
|
+
|
|
23
|
+
```python
|
|
24
|
+
ordered = page.ol()
|
|
25
|
+
for step in STEPS:
|
|
26
|
+
ordered.li(step)
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The loop runs when the host builds Source; the list on screen is its result.
|
|
30
|
+
|
|
31
|
+
Python builds Source on the server; its JavaScript counterpart builds it on Node/Bun or in a standalone Worker. Bindings, actions and any Logic execute in the browser; Python strings containing JavaScript are not executed by Python.
|
|
32
|
+
|
|
33
|
+
## Try it and predict the result
|
|
34
|
+
|
|
35
|
+
1. Count three ordered steps, two definition pairs and a nested list.
|
|
36
|
+
2. Reload: the same constants produce the same nodes; no timer or subscription appends rows.
|
|
37
|
+
|
|
38
|
+
## Change it and check yourself
|
|
39
|
+
|
|
40
|
+
Append `"Explain the result"` to `STEPS` and `("DOM", "The browser representation.")` to `TERMS`.
|
|
41
|
+
|
|
42
|
+
**Answer:** after reload there are four ordered items and three definition pairs. Existing nested items are unaffected because their loop uses another collection.
|
|
43
|
+
|
|
44
|
+
## Limits and next step
|
|
45
|
+
|
|
46
|
+
A Python list constant is not a Data Bag subscription. Later changing a Data value does not rerun this Python loop.
|
|
47
|
+
|
|
48
|
+
Continue with [e04 · Semantic page](https://github.com/gramlot-org/gramlot-examples/blob/main/src/gramlot_examples/pages/html_svg/04_semantic_page.md). The [authoring reference](https://github.com/gramlot-org/gramlot/blob/main/docs/public/095-writing-pages.md) explains the full contract.
|
|
49
|
+
|
|
50
|
+
</details>
|
|
@@ -1,9 +1,49 @@
|
|
|
1
1
|
# 04 · A semantic page
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A page with a header, navigation, main content and footer. You learn how HTML gives each part a role and how links lead to sections within the page.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**Uses:** Source and native HTML/SVG — core 0.1.x. No Data binding.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
<details>
|
|
8
|
+
<summary>More detail</summary>
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
|
|
11
|
+
**Release stage:** Source foundation (core 0.1.x); maintained syntax is used here.
|
|
12
|
+
|
|
13
|
+
**Goal:** Build semantic regions and connect navigation to their IDs.
|
|
14
|
+
|
|
15
|
+
**Before this lesson:** [e02 · Text and links](https://github.com/gramlot-org/gramlot-examples/blob/main/src/gramlot_examples/pages/html_svg/02_text_and_links.md), [e03 · Lists](https://github.com/gramlot-org/gramlot-examples/blob/main/src/gramlot_examples/pages/html_svg/03_lists.md). These prerequisites support the release sequence; later comparisons are explicitly labelled below.
|
|
16
|
+
|
|
17
|
+
**Open and edit:** select **e04 · Semantic page** in your environment’s gallery. For source changes, copy/edit the matching page in your own project using the [setup guide](https://github.com/gramlot-org/gramlot/blob/main/docs/public/025-try.md); the gallery is a source viewer. Save, then reload/reopen as that guide explains. The snippets below are excerpts/edits within that Page, not standalone launch commands.
|
|
18
|
+
|
|
19
|
+
## Read the page
|
|
20
|
+
|
|
21
|
+
The Source declares `header`, `nav`, a main landmark, an `article`, an `aside` and `footer`. `aria_label` names the navigation. The Story and Notes links target `id="story"` and `id="notes"`.
|
|
22
|
+
|
|
23
|
+
```python
|
|
24
|
+
nav.a("Story", href="#story")
|
|
25
|
+
article = main.article(id="story", class_="stack")
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Here `main` is an element variable, distinct from the Page method `main(root)`.
|
|
29
|
+
|
|
30
|
+
Python builds Source on the server; its JavaScript counterpart builds it on Node/Bun or in a standalone Worker. Bindings, actions and any Logic execute in the browser; Python strings containing JavaScript are not executed by Python.
|
|
31
|
+
|
|
32
|
+
## Try it and predict the result
|
|
33
|
+
|
|
34
|
+
1. Activate Notes, then Story. Each link targets its section inside the preview.
|
|
35
|
+
2. Inspect the Source: visual cards and semantic landmarks are declarations, not a separate HTML template.
|
|
36
|
+
|
|
37
|
+
## Change it and check yourself
|
|
38
|
+
|
|
39
|
+
Add `main.article(id="references").h2("References")` and a navigation link with `href="#references"`.
|
|
40
|
+
|
|
41
|
+
**Answer:** a third destination appears; the browser handles the jump. Adding a link alone would not create an article.
|
|
42
|
+
|
|
43
|
+
## Limits and next step
|
|
44
|
+
|
|
45
|
+
Landmark markup does not by itself prove accessibility of an entire application. This lesson has no client router or database.
|
|
46
|
+
|
|
47
|
+
Continue with [e05 · Tables](https://github.com/gramlot-org/gramlot-examples/blob/main/src/gramlot_examples/pages/html_svg/05_tables.md). The [authoring reference](https://github.com/gramlot-org/gramlot/blob/main/docs/public/095-writing-pages.md) explains the full contract.
|
|
48
|
+
|
|
49
|
+
</details>
|
|
@@ -1,9 +1,51 @@
|
|
|
1
1
|
# 05 · Tables
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
A table with headings, rows and a total. You learn how to turn a small dataset into a readable table without repeating the row declarations.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**Uses:** Source and native HTML/SVG — core 0.1.x. No Data binding.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
<details>
|
|
8
|
+
<summary>More detail</summary>
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
|
|
11
|
+
**Release stage:** Source foundation (core 0.1.x); maintained syntax is used here.
|
|
12
|
+
|
|
13
|
+
**Goal:** Derive rows and totals from one fixed dataset.
|
|
14
|
+
|
|
15
|
+
**Before this lesson:** [e03 · Lists](https://github.com/gramlot-org/gramlot-examples/blob/main/src/gramlot_examples/pages/html_svg/03_lists.md). These prerequisites support the release sequence; later comparisons are explicitly labelled below.
|
|
16
|
+
|
|
17
|
+
**Open and edit:** select **e05 · Tables** in your environment’s gallery. For source changes, copy/edit the matching page in your own project using the [setup guide](https://github.com/gramlot-org/gramlot/blob/main/docs/public/025-try.md); the gallery is a source viewer. Save, then reload/reopen as that guide explains. The snippets below are excerpts/edits within that Page, not standalone launch commands.
|
|
18
|
+
|
|
19
|
+
## Read the page
|
|
20
|
+
|
|
21
|
+
`ROWS` contains North (12, 8), South (9, 11) and West (15, 6). `thead`, `tbody` and `tfoot` give the table structure; `scope` identifies row/column headings. Python computes `q1 + q2` before writing each cell.
|
|
22
|
+
|
|
23
|
+
```python
|
|
24
|
+
for value in (q1, q2, q1 + q2):
|
|
25
|
+
row.td(str(value))
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Python builds Source on the server; its JavaScript counterpart builds it on Node/Bun or in a standalone Worker. Bindings, actions and any Logic execute in the browser; Python strings containing JavaScript are not executed by Python.
|
|
29
|
+
|
|
30
|
+
## Try it and predict the result
|
|
31
|
+
|
|
32
|
+
1. Check row totals: 20, 20 and 21.
|
|
33
|
+
2. Check the footer: Q1 = 36, Q2 = 25, total = 61. Explain why both totals use the same tuples.
|
|
34
|
+
|
|
35
|
+
## Change it and check yourself
|
|
36
|
+
|
|
37
|
+
Add `("East", 2, 3)` to `ROWS` and reload.
|
|
38
|
+
|
|
39
|
+
**Answer:** the new row totals 5; the footer becomes 38, 28 and 66. No cell-specific arithmetic needs editing, because the loop and sums read the enlarged dataset.
|
|
40
|
+
|
|
41
|
+
## The same example across stages
|
|
42
|
+
|
|
43
|
+
In the later 0.2.0 c01 lesson, the same idea of a computed total becomes `dataFormula`: inputs change Data and the framework schedules recomputation. The old static calculation remains valid for a fixed report.
|
|
44
|
+
|
|
45
|
+
## Limits and next step
|
|
46
|
+
|
|
47
|
+
The totals are fixed in the built Source. Editing a constant requires a rebuild/reload; it does not establish live formulas.
|
|
48
|
+
|
|
49
|
+
Continue with [e06 · Forms](https://github.com/gramlot-org/gramlot-examples/blob/main/src/gramlot_examples/pages/html_svg/06_forms.md). The [authoring reference](https://github.com/gramlot-org/gramlot/blob/main/docs/public/095-writing-pages.md) explains the full contract.
|
|
50
|
+
|
|
51
|
+
</details>
|
|
@@ -1,9 +1,53 @@
|
|
|
1
1
|
# 06 · Native forms
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A form with text fields, choices and a Reset button. Change the values and reset them to see what native HTML controls already do on their own. Later, **Forms with binding** revisits this form and connects its fields to shared Data.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**Uses:** Source and native HTML controls — core 0.1.x. No Data binding or controllers.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
<details>
|
|
8
|
+
<summary>More detail</summary>
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
|
|
11
|
+
**Release stage:** Source foundation (core 0.1.x); maintained syntax is used here.
|
|
12
|
+
|
|
13
|
+
**Goal:** Understand native editing and Reset before adding Data binding.
|
|
14
|
+
|
|
15
|
+
**Before this lesson:** [e04 · Semantic page](https://github.com/gramlot-org/gramlot-examples/blob/main/src/gramlot_examples/pages/html_svg/04_semantic_page.md). These prerequisites support the release sequence; later comparisons are explicitly labelled below.
|
|
16
|
+
|
|
17
|
+
**Open and edit:** select **e06 · Forms** in your environment’s gallery. For source changes, copy/edit the matching page in your own project using the [setup guide](https://github.com/gramlot-org/gramlot/blob/main/docs/public/025-try.md); the gallery is a source viewer. Save, then reload/reopen as that guide explains. The snippets below are excerpts/edits within that Page, not standalone launch commands.
|
|
18
|
+
|
|
19
|
+
## Read the page
|
|
20
|
+
|
|
21
|
+
The `field` helper declares a label and input. `html_label` selects the HTML element without confusing it with the Source node’s label. Initial values belong to HTML attributes/content in this stage.
|
|
22
|
+
|
|
23
|
+
```python
|
|
24
|
+
self.field(identity, "Name", "name", "text", value="Ada Lovelace", required=True)
|
|
25
|
+
options.input(type="checkbox", id="updates", name="updates", checked=True)
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
The select marks its initial option with `selected`; the textarea has literal content.
|
|
29
|
+
|
|
30
|
+
Python builds Source on the server; its JavaScript counterpart builds it on Node/Bun or in a standalone Worker. Bindings, actions and any Logic execute in the browser; Python strings containing JavaScript are not executed by Python.
|
|
31
|
+
|
|
32
|
+
## Try it and predict the result
|
|
33
|
+
|
|
34
|
+
1. Change Name and uncheck Receive updates. The controls change natively; there is no Data record display.
|
|
35
|
+
2. Click Reset values: Name returns to Ada Lovelace and Receive updates is checked. Submit stays disabled.
|
|
36
|
+
|
|
37
|
+
## Change it and check yourself
|
|
38
|
+
|
|
39
|
+
Change the Name default to `"Grace Hopper"`, reload, type another name, then Reset.
|
|
40
|
+
|
|
41
|
+
**Answer:** Reset now restores Grace Hopper, because that is the new native default. It does not call an endpoint or restore a Gramlot Data Bag.
|
|
42
|
+
|
|
43
|
+
## The same example across stages
|
|
44
|
+
|
|
45
|
+
Return in **core 0.2.0** at [b09 · Forms with binding](https://github.com/gramlot-org/gramlot-examples/blob/main/src/gramlot_examples/pages/binding/09_forms.md). The same fieldsets move their defaults into one Data record and replace literal values/checked/selected flags with pointers. The control and the record display share that state; no separate display-update handler is authored. The bound version adds a capability, so the whole file is not claimed to be shorter. Keep this native Reset example as the earlier stage.
|
|
46
|
+
|
|
47
|
+
## Limits and next step
|
|
48
|
+
|
|
49
|
+
File selection remains native. No persistence, upload, save endpoint or record/form framework is provided. Reset is safe here because there are no Data bindings.
|
|
50
|
+
|
|
51
|
+
Continue with [e07 · Native disclosure](https://github.com/gramlot-org/gramlot-examples/blob/main/src/gramlot_examples/pages/html_svg/07_native_disclosure.md). The [authoring reference](https://github.com/gramlot-org/gramlot/blob/main/docs/public/095-writing-pages.md) explains the full contract.
|
|
52
|
+
|
|
53
|
+
</details>
|
|
@@ -1,9 +1,46 @@
|
|
|
1
1
|
# 07 · Disclosure and measures
|
|
2
2
|
|
|
3
|
-
Expandable
|
|
3
|
+
Expandable details, a progress bar and a meter. You learn how to declare controls whose basic behavior is already supplied by the browser.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**Uses:** Source and native HTML/SVG — core 0.1.x. No Data binding.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
<details>
|
|
8
|
+
<summary>More detail</summary>
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
|
|
11
|
+
**Release stage:** Source foundation (core 0.1.x); maintained syntax is used here.
|
|
12
|
+
|
|
13
|
+
**Goal:** Recognize behavior supplied by native HTML rather than application code.
|
|
14
|
+
|
|
15
|
+
**Before this lesson:** [e03 · Lists](https://github.com/gramlot-org/gramlot-examples/blob/main/src/gramlot_examples/pages/html_svg/03_lists.md), [e04 · Semantic page](https://github.com/gramlot-org/gramlot-examples/blob/main/src/gramlot_examples/pages/html_svg/04_semantic_page.md). These prerequisites support the release sequence; later comparisons are explicitly labelled below.
|
|
16
|
+
|
|
17
|
+
**Open and edit:** select **e07 · Native disclosure** in your environment’s gallery. For source changes, copy/edit the matching page in your own project using the [setup guide](https://github.com/gramlot-org/gramlot/blob/main/docs/public/025-try.md); the gallery is a source viewer. Save, then reload/reopen as that guide explains. The snippets below are excerpts/edits within that Page, not standalone launch commands.
|
|
18
|
+
|
|
19
|
+
## Read the page
|
|
20
|
+
|
|
21
|
+
Each `details` contains a `summary` and answer paragraph. The browser toggles the disclosure. `progress(value=70, max=100)` and `meter(value=8, max=10)` are fixed measurements, with explicit labels.
|
|
22
|
+
|
|
23
|
+
Python builds Source on the server; its JavaScript counterpart builds it on Node/Bun or in a standalone Worker. Bindings, actions and any Logic execute in the browser; Python strings containing JavaScript are not executed by Python.
|
|
24
|
+
|
|
25
|
+
## Try it and predict the result
|
|
26
|
+
|
|
27
|
+
1. Open and close “What is Source?”. The answer changes visibility without an authored controller.
|
|
28
|
+
2. Wait: Preparation remains 70% and Quality remains 8 of 10.
|
|
29
|
+
|
|
30
|
+
## Change it and check yourself
|
|
31
|
+
|
|
32
|
+
Add another question/answer to the tuple and change the progress value to 80 **and** its label to “Preparation: 80%”.
|
|
33
|
+
|
|
34
|
+
**Answer:** another disclosure and an 80% bar appear after reload. Updating only the bar would leave a misleading label; this stage has no binding to keep them synchronized.
|
|
35
|
+
|
|
36
|
+
## The same example across stages
|
|
37
|
+
|
|
38
|
+
Later b11 revisits the FAQ with `open="^.faq_open"`: one bound checkbox controls both disclosures. The framework projects that one value to each declaration; no list of manual open/close operations is needed.
|
|
39
|
+
|
|
40
|
+
## Limits and next step
|
|
41
|
+
|
|
42
|
+
No live task or background progress is being measured. Native disclosure is not Data binding.
|
|
43
|
+
|
|
44
|
+
Continue with [e08 · SVG shapes](https://github.com/gramlot-org/gramlot-examples/blob/main/src/gramlot_examples/pages/html_svg/08_svg_shapes.md). The [authoring reference](https://github.com/gramlot-org/gramlot/blob/main/docs/public/095-writing-pages.md) explains the full contract.
|
|
45
|
+
|
|
46
|
+
</details>
|
|
@@ -1,9 +1,50 @@
|
|
|
1
1
|
# 08 · SVG shapes
|
|
2
2
|
|
|
3
|
-
Six SVG
|
|
3
|
+
Six SVG shapes with different sizes, fills and strokes. You learn how to describe a drawing alongside HTML. Later, **SVG shapes with binding** makes these shapes respond to controls.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**Uses:** Source and native HTML/SVG — core 0.1.x. No Data binding.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
<details>
|
|
8
|
+
<summary>More detail</summary>
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
|
|
11
|
+
**Release stage:** Source foundation (core 0.1.x); maintained syntax is used here.
|
|
12
|
+
|
|
13
|
+
**Goal:** Read SVG geometry and distinguish Source attributes from CSS.
|
|
14
|
+
|
|
15
|
+
**Before this lesson:** [e01 · Hello World](https://github.com/gramlot-org/gramlot-examples/blob/main/src/gramlot_examples/pages/html_svg/01_hello_world.md). These prerequisites support the release sequence; later comparisons are explicitly labelled below.
|
|
16
|
+
|
|
17
|
+
**Open and edit:** select **e08 · SVG shapes** in your environment’s gallery. For source changes, copy/edit the matching page in your own project using the [setup guide](https://github.com/gramlot-org/gramlot/blob/main/docs/public/025-try.md); the gallery is a source viewer. Save, then reload/reopen as that guide explains. The snippets below are excerpts/edits within that Page, not standalone launch commands.
|
|
18
|
+
|
|
19
|
+
## Read the page
|
|
20
|
+
|
|
21
|
+
An HTML `figure` contains one SVG viewport (`viewBox="0 0 480 200"`), six shapes and a label. The SVG title supplies the accessible name. `cx`, `cy` and `r` describe the circle in viewBox coordinates.
|
|
22
|
+
|
|
23
|
+
```python
|
|
24
|
+
art.circle(cx=172, cy=58, r=38, fill="var(--gramlot-warning)")
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Python builds Source on the server; its JavaScript counterpart builds it on Node/Bun or in a standalone Worker. Bindings, actions and any Logic execute in the browser; Python strings containing JavaScript are not executed by Python.
|
|
28
|
+
|
|
29
|
+
## Try it and predict the result
|
|
30
|
+
|
|
31
|
+
1. Locate the circle between the rectangle and ellipse.
|
|
32
|
+
2. Compare its radius 38 with the ellipse’s separate `rx=26` and `ry=38`: a circle has one radius, an ellipse has two.
|
|
33
|
+
|
|
34
|
+
## Change it and check yourself
|
|
35
|
+
|
|
36
|
+
Change only the circle’s `cx` from 172 to 182 and reload.
|
|
37
|
+
|
|
38
|
+
**Answer:** its center moves ten viewBox units right; its radius and fill do not change. This is a new Source build, not animation.
|
|
39
|
+
|
|
40
|
+
## The same example across stages
|
|
41
|
+
|
|
42
|
+
In **0.2.0**, [b10 · SVG shapes with binding](https://github.com/gramlot-org/gramlot-examples/blob/main/src/gramlot_examples/pages/binding/10_svg_shapes.md) returns to these six shapes. `r=38` becomes `r="^.radius"`; a range and the circle share `.radius`. A pointer replaces explicit Source-attribute updates for each edit. The initial drawing is comparable, but interaction is new.
|
|
43
|
+
|
|
44
|
+
## Limits and next step
|
|
45
|
+
|
|
46
|
+
Coordinates and SVG presentation attributes are not HTML style shortcuts. This stage has no controls or animation.
|
|
47
|
+
|
|
48
|
+
Continue with [e09 · SVG composition](https://github.com/gramlot-org/gramlot-examples/blob/main/src/gramlot_examples/pages/html_svg/09_svg_composition.md). The [authoring reference](https://github.com/gramlot-org/gramlot/blob/main/docs/public/095-writing-pages.md) explains the full contract.
|
|
49
|
+
|
|
50
|
+
</details>
|
|
@@ -1,9 +1,49 @@
|
|
|
1
1
|
# 09 · SVG composition
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
An SVG scene assembled from smaller parts. You learn how groups and reusable page-building methods keep a larger drawing easy to follow.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**Uses:** Source and native HTML/SVG — core 0.1.x. No Data binding.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
<details>
|
|
8
|
+
<summary>More detail</summary>
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
|
|
11
|
+
**Release stage:** Source foundation (core 0.1.x); maintained syntax is used here.
|
|
12
|
+
|
|
13
|
+
**Goal:** Reuse Source-building methods to compose a scene.
|
|
14
|
+
|
|
15
|
+
**Before this lesson:** [e03 · Lists](https://github.com/gramlot-org/gramlot-examples/blob/main/src/gramlot_examples/pages/html_svg/03_lists.md), [e08 · SVG shapes](https://github.com/gramlot-org/gramlot-examples/blob/main/src/gramlot_examples/pages/html_svg/08_svg_shapes.md). These prerequisites support the release sequence; later comparisons are explicitly labelled below.
|
|
16
|
+
|
|
17
|
+
**Open and edit:** select **e09 · SVG composition** in your environment’s gallery. For source changes, copy/edit the matching page in your own project using the [setup guide](https://github.com/gramlot-org/gramlot/blob/main/docs/public/025-try.md); the gallery is a source viewer. Save, then reload/reopen as that guide explains. The snippets below are excerpts/edits within that Page, not standalone launch commands.
|
|
18
|
+
|
|
19
|
+
## Read the page
|
|
20
|
+
|
|
21
|
+
`house`, `tree` and `flower` populate a group in the same SVG. A transform moves the whole group, so its child coordinates stay local.
|
|
22
|
+
|
|
23
|
+
```python
|
|
24
|
+
for x in (115, 330):
|
|
25
|
+
self.house(drawing, x)
|
|
26
|
+
# Inside house:
|
|
27
|
+
group = drawing.g(transform=f"translate({x} 0)")
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Python builds Source on the server; its JavaScript counterpart builds it on Node/Bun or in a standalone Worker. Bindings, actions and any Logic execute in the browser; Python strings containing JavaScript are not executed by Python.
|
|
31
|
+
|
|
32
|
+
## Try it and predict the result
|
|
33
|
+
|
|
34
|
+
1. Count two houses, three trees and three flowers.
|
|
35
|
+
2. Compare the two houses: their child declarations are shared; only the group translation differs.
|
|
36
|
+
|
|
37
|
+
## Change it and check yourself
|
|
38
|
+
|
|
39
|
+
Change the house positions to `(115, 330, 210)` and reload.
|
|
40
|
+
|
|
41
|
+
**Answer:** three houses are built. The added one can overlap existing scenery: a loop reuses declarations but does not automatically solve layout. Try a wider viewBox or deliberate repositioning.
|
|
42
|
+
|
|
43
|
+
## Limits and next step
|
|
44
|
+
|
|
45
|
+
These are ordinary Page helper methods building Source, not a recipe registry or component API. The scene is static.
|
|
46
|
+
|
|
47
|
+
Continue with [e10 · Cards with icons](https://github.com/gramlot-org/gramlot-examples/blob/main/src/gramlot_examples/pages/html_svg/10_cards_with_icons.md). The [authoring reference](https://github.com/gramlot-org/gramlot/blob/main/docs/public/095-writing-pages.md) explains the full contract.
|
|
48
|
+
|
|
49
|
+
</details>
|
|
@@ -1,21 +1,48 @@
|
|
|
1
1
|
# 10 · Cards with icons and live Source
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
without reloading the page.
|
|
3
|
+
Three cards, each with an SVG icon. You learn how to combine text and drawings. The × buttons add a later step: removing a card from Source also removes it from the screen. Return to the buttons after **Events**.
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
The button's short JavaScript action finds `main.page.cards` in the browser
|
|
8
|
-
Builder's Source and calls `popNode` with the card label. Gramlot observes the
|
|
9
|
-
Source deletion and removes the corresponding DOM branch, including its SVG.
|
|
10
|
-
The action never removes a DOM element directly.
|
|
5
|
+
**Uses:** Source, HTML and SVG (0.1.x); removal uses browser actions (0.2.0) and the `src` name from 0.2.10.
|
|
11
6
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
offline.
|
|
7
|
+
<details>
|
|
8
|
+
<summary>More detail</summary>
|
|
15
9
|
|
|
16
|
-
**Try it:** Remove the middle card, then the others. Reload to restore all three.
|
|
17
|
-
Add a fourth card to the local dataset and give it a matching icon branch.
|
|
18
10
|
|
|
19
|
-
**
|
|
20
|
-
|
|
21
|
-
|
|
11
|
+
**Release stage:** Source foundation (core 0.1.x); maintained syntax is used here. The interactive controls are a later 0.2.0 layer; return to them after c07. The src proxy spelling is from 0.2.10.
|
|
12
|
+
|
|
13
|
+
**Goal:** Remove a Source branch and let Gramlot remove the corresponding DOM.
|
|
14
|
+
|
|
15
|
+
**Before this lesson:** [e09 · SVG composition](https://github.com/gramlot-org/gramlot-examples/blob/main/src/gramlot_examples/pages/html_svg/09_svg_composition.md), [c07 · Events](https://github.com/gramlot-org/gramlot-examples/blob/main/src/gramlot_examples/pages/controllers/07_events.md). These prerequisites support the release sequence; later comparisons are explicitly labelled below.
|
|
16
|
+
|
|
17
|
+
**Open and edit:** select **e10 · Cards with icons** in your environment’s gallery. For source changes, copy/edit the matching page in your own project using the [setup guide](https://github.com/gramlot-org/gramlot/blob/main/docs/public/025-try.md); the gallery is a source viewer. Save, then reload/reopen as that guide explains. The snippets below are excerpts/edits within that Page, not standalone launch commands. This lesson executes authored inline JavaScript and needs the gallery’s permissive CSP profile; a strict named-Logic starter needs the corresponding named form.
|
|
18
|
+
|
|
19
|
+
## Read the page
|
|
20
|
+
|
|
21
|
+
Three cards use Source `node_label` values `structure`, `drawing` and `reading`. The inline click declaration finds the Source container `main.page.cards` and calls `popNode` with the selected card label. Its SVG disappears with the card.
|
|
22
|
+
|
|
23
|
+
`node_label` is a Bag path segment, `node_id` is a Source lookup identity, and HTML `id` identifies a DOM element; they are not interchangeable. `main` here is a **Source** path, not a Data prefix.
|
|
24
|
+
|
|
25
|
+
Python builds Source on the server; its JavaScript counterpart builds it on Node/Bun or in a standalone Worker. Bindings, actions and any Logic execute in the browser; Python strings containing JavaScript are not executed by Python.
|
|
26
|
+
|
|
27
|
+
## Try it and predict the result
|
|
28
|
+
|
|
29
|
+
1. Click × on Drawing. Exactly that card disappears and the two others remain.
|
|
30
|
+
2. Remove the others, then reload: all three return because the host builds the initial Source again.
|
|
31
|
+
|
|
32
|
+
## Change it and check yourself
|
|
33
|
+
|
|
34
|
+
Add a fourth tuple to `CARDS` and a matching branch in `icon`. Give the tuple a new Source label, then reload and remove it.
|
|
35
|
+
|
|
36
|
+
**Answer:** four cards appear and removal still targets one label. Reusing another card’s label would not give it an independent stable identity.
|
|
37
|
+
|
|
38
|
+
## The same example across stages
|
|
39
|
+
|
|
40
|
+
At the later binding stage, b08 and c08 wrap related Source operations in named Logic and combine them with Data. For values that merely change geometry/text, b07 replaces repeated Source writes with pointers; removing structure still uses Source operations.
|
|
41
|
+
|
|
42
|
+
## Limits and next step
|
|
43
|
+
|
|
44
|
+
Changes are local, not persisted or synchronized to a server. The cards are Source-only; the button declaration is a later inline-behavior layer. The installed companion Logic is empty here.
|
|
45
|
+
|
|
46
|
+
Continue with [e11 · Static report](https://github.com/gramlot-org/gramlot-examples/blob/main/src/gramlot_examples/pages/html_svg/11_static_report.md). The [authoring reference](https://github.com/gramlot-org/gramlot/blob/main/docs/public/095-writing-pages.md) explains the full contract.
|
|
47
|
+
|
|
48
|
+
</details>
|
|
@@ -1,9 +1,42 @@
|
|
|
1
1
|
# 11 · Static report
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
A report with a summary, chart and table, all built from the same data. You learn how to reuse those values to create consistent views.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**Uses:** Source and native HTML/SVG — core 0.1.x. No Data binding.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
<details>
|
|
8
|
+
<summary>More detail</summary>
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
|
|
11
|
+
**Release stage:** Source foundation (core 0.1.x); maintained syntax is used here.
|
|
12
|
+
|
|
13
|
+
**Goal:** Keep a summary, chart and table consistent with one dataset.
|
|
14
|
+
|
|
15
|
+
**Before this lesson:** [e05 · Tables](https://github.com/gramlot-org/gramlot-examples/blob/main/src/gramlot_examples/pages/html_svg/05_tables.md), [e08 · SVG shapes](https://github.com/gramlot-org/gramlot-examples/blob/main/src/gramlot_examples/pages/html_svg/08_svg_shapes.md), [e09 · SVG composition](https://github.com/gramlot-org/gramlot-examples/blob/main/src/gramlot_examples/pages/html_svg/09_svg_composition.md). These prerequisites support the release sequence; later comparisons are explicitly labelled below.
|
|
16
|
+
|
|
17
|
+
**Open and edit:** select **e11 · Static report** in your environment’s gallery. For source changes, copy/edit the matching page in your own project using the [setup guide](https://github.com/gramlot-org/gramlot/blob/main/docs/public/025-try.md); the gallery is a source viewer. Save, then reload/reopen as that guide explains. The snippets below are excerpts/edits within that Page, not standalone launch commands.
|
|
18
|
+
|
|
19
|
+
## Read the page
|
|
20
|
+
|
|
21
|
+
`REGIONS` drives the summary, SVG bars, legend and table. Initially North = 12, South = 9 and West = 15, total 36. Each bar width is `value * 23`; the label’s position also uses that value. The SVG title is separate literal text.
|
|
22
|
+
|
|
23
|
+
Python builds Source on the server; its JavaScript counterpart builds it on Node/Bun or in a standalone Worker. Bindings, actions and any Logic execute in the browser; Python strings containing JavaScript are not executed by Python.
|
|
24
|
+
|
|
25
|
+
## Try it and predict the result
|
|
26
|
+
|
|
27
|
+
1. Check the total 36 and region count 3.
|
|
28
|
+
2. Compare the longest bar with the table: West has 15, so its bar is 345 viewBox units wide.
|
|
29
|
+
|
|
30
|
+
## Change it and check yourself
|
|
31
|
+
|
|
32
|
+
Change North from 12 to 14. Update the literal SVG title from “North 12” to “North 14”, then reload.
|
|
33
|
+
|
|
34
|
+
**Answer:** total 38, still three regions, and North’s bar width 322. The visible table/chart recompute from the tuple; the accessible title needed an explicit edit because it is literal.
|
|
35
|
+
|
|
36
|
+
## Limits and next step
|
|
37
|
+
|
|
38
|
+
This is a static report. Do not call it a live data service, and do not leave the accessible description stale when changing its dataset.
|
|
39
|
+
|
|
40
|
+
Continue with [e12 · Complete page](https://github.com/gramlot-org/gramlot-examples/blob/main/src/gramlot_examples/pages/html_svg/12_complete_page.md). The [authoring reference](https://github.com/gramlot-org/gramlot/blob/main/docs/public/095-writing-pages.md) explains the full contract.
|
|
41
|
+
|
|
42
|
+
</details>
|
|
@@ -1,9 +1,46 @@
|
|
|
1
1
|
# 12 · A complete page
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A complete event page that combines the HTML and SVG pieces from this section. You learn how to organize a larger page into small building methods. Later, **Complete page with binding** makes the same page follow shared Data.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**Uses:** Source and native HTML/SVG — core 0.1.x. No Data binding.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
<details>
|
|
8
|
+
<summary>More detail</summary>
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
|
|
11
|
+
**Release stage:** Source foundation (core 0.1.x); maintained syntax is used here.
|
|
12
|
+
|
|
13
|
+
**Goal:** Assemble a complete static page from already understood Source sections.
|
|
14
|
+
|
|
15
|
+
**Before this lesson:** [e04 · Semantic page](https://github.com/gramlot-org/gramlot-examples/blob/main/src/gramlot_examples/pages/html_svg/04_semantic_page.md), [e07 · Native disclosure](https://github.com/gramlot-org/gramlot-examples/blob/main/src/gramlot_examples/pages/html_svg/07_native_disclosure.md), [e09 · SVG composition](https://github.com/gramlot-org/gramlot-examples/blob/main/src/gramlot_examples/pages/html_svg/09_svg_composition.md), [e11 · Static report](https://github.com/gramlot-org/gramlot-examples/blob/main/src/gramlot_examples/pages/html_svg/11_static_report.md). These prerequisites support the release sequence; later comparisons are explicitly labelled below.
|
|
16
|
+
|
|
17
|
+
**Open and edit:** select **e12 · Complete page** in your environment’s gallery. For source changes, copy/edit the matching page in your own project using the [setup guide](https://github.com/gramlot-org/gramlot/blob/main/docs/public/025-try.md); the gallery is a source viewer. Save, then reload/reopen as that guide explains. The snippets below are excerpts/edits within that Page, not standalone launch commands.
|
|
18
|
+
|
|
19
|
+
## Read the page
|
|
20
|
+
|
|
21
|
+
`main` calls helpers for header, hero, highlights, schedule, speakers, map and FAQ. The schedule and speaker cards read local tuples. Native anchor links connect the navigation to section IDs; the map is an SVG illustration.
|
|
22
|
+
|
|
23
|
+
Python builds Source on the server; its JavaScript counterpart builds it on Node/Bun or in a standalone Worker. Bindings, actions and any Logic execute in the browser; Python strings containing JavaScript are not executed by Python.
|
|
24
|
+
|
|
25
|
+
## Try it and predict the result
|
|
26
|
+
|
|
27
|
+
1. Follow Schedule and count three sessions; Speakers shows Mira and Theo.
|
|
28
|
+
2. Open the FAQ about the map: it says the map is not interactive. There is no booking action.
|
|
29
|
+
|
|
30
|
+
## Change it and check yourself
|
|
31
|
+
|
|
32
|
+
Add a fourth session tuple, then change the table caption from “Three short sessions” to “Four short sessions”.
|
|
33
|
+
|
|
34
|
+
**Answer:** four rows appear after reload; the caption requires its own edit because it is literal. Adding a speaker to a session does not automatically add a speaker card: `SPEAKERS` is a separate dataset.
|
|
35
|
+
|
|
36
|
+
## The same example across stages
|
|
37
|
+
|
|
38
|
+
Keep this page as the earlier stage. In **0.2.0**, [b11 · Complete page with binding](https://github.com/gramlot-org/gramlot-examples/blob/main/src/gramlot_examples/pages/binding/11_complete_page.md) revisits the event page: one Data title drives multiple texts, one speaker flag controls both row and card, and one FAQ flag controls every answer. These shared pointers eliminate separate update code for each destination; the new controls make the later page richer rather than universally shorter.
|
|
39
|
+
|
|
40
|
+
## Limits and next step
|
|
41
|
+
|
|
42
|
+
“Complete” means a composed example of the features at this stage, not a booking application or coverage of all Gramlot APIs.
|
|
43
|
+
|
|
44
|
+
Continue with [e13 · Live Source playground](https://github.com/gramlot-org/gramlot-examples/blob/main/src/gramlot_examples/pages/html_svg/13_live_source.md). The [authoring reference](https://github.com/gramlot-org/gramlot/blob/main/docs/public/095-writing-pages.md) explains the full contract.
|
|
45
|
+
|
|
46
|
+
</details>
|
|
@@ -1,18 +1,49 @@
|
|
|
1
1
|
# 13 · Live Source playground
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
3
|
+
A playground for adding, removing and changing parts of a running page, including a small SVG animation. You learn how Source changes affect the screen and why a timer must stop when its page is removed. Try this after **Events** and **Lifecycle**.
|
|
4
|
+
|
|
5
|
+
**Uses:** Live Source and browser actions (0.2.0), with the `src` name from 0.2.10. No Data binding.
|
|
6
|
+
|
|
7
|
+
<details>
|
|
8
|
+
<summary>More detail</summary>
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
**Release stage:** Source foundation (core 0.1.x); maintained syntax is used here. The interactive controls are a later 0.2.0 layer; return to them after c07. The src proxy spelling is from 0.2.10.
|
|
12
|
+
|
|
13
|
+
**Goal:** Separate live Source changes from Data reactivity and release an owned timer.
|
|
14
|
+
|
|
15
|
+
**Before this lesson:** [e10 · Cards with icons](https://github.com/gramlot-org/gramlot-examples/blob/main/src/gramlot_examples/pages/html_svg/10_cards_with_icons.md), [c07 · Events](https://github.com/gramlot-org/gramlot-examples/blob/main/src/gramlot_examples/pages/controllers/07_events.md). These prerequisites support the release sequence; later comparisons are explicitly labelled below.
|
|
16
|
+
|
|
17
|
+
**Open and edit:** select **e13 · Live Source playground** in your environment’s gallery. For source changes, copy/edit the matching page in your own project using the [setup guide](https://github.com/gramlot-org/gramlot/blob/main/docs/public/025-try.md); the gallery is a source viewer. Save, then reload/reopen as that guide explains. The snippets below are excerpts/edits within that Page, not standalone launch commands. This lesson executes authored inline JavaScript and needs the gallery’s permissive CSP profile; a strict named-Logic starter needs the corresponding named form.
|
|
18
|
+
|
|
19
|
+
## Read the page
|
|
20
|
+
|
|
21
|
+
Buttons declare browser actions on Source: `wrapSource(...).li(...)` adds an item; `popNode`/`clear` remove children; `setValue` changes text; `setAttr` changes the circle. They never build application DOM directly.
|
|
22
|
+
|
|
23
|
+
The authored script schedules a 50 ms interval updating the Source `cx`. `renderer.onDispose(motion, ...)` clears it when its section is removed. The script is browser JavaScript, including when declared by Python; the Logic class in the module is empty.
|
|
24
|
+
|
|
25
|
+
Python builds Source on the server; its JavaScript counterpart builds it on Node/Bun or in a standalone Worker. Bindings, actions and any Logic execute in the browser; Python strings containing JavaScript are not executed by Python.
|
|
26
|
+
|
|
27
|
+
## Try it and predict the result
|
|
28
|
+
|
|
29
|
+
1. Begin with two list items. Add one: expect three. Remove last: expect two. Clear list: expect none.
|
|
30
|
+
2. Change heading: it becomes “Source is alive!”. Change ball color while it moves.
|
|
31
|
+
3. Remove animation: the entire motion section disappears and its disposal callback clears the interval. Reload restores the original list and animation.
|
|
32
|
+
|
|
33
|
+
## Change it and check yourself
|
|
34
|
+
|
|
35
|
+
Change the interval delay from 50 to 100 ms in the authored script. Keep the same `onDispose` cleanup.
|
|
36
|
+
|
|
37
|
+
**Answer:** updates occur about half as often; the position still depends on elapsed time, so the motion becomes less smooth, not half-speed. Removing the section must still release the interval.
|
|
38
|
+
|
|
39
|
+
## The same example across stages
|
|
40
|
+
|
|
41
|
+
In **0.2.0**, [b07 · Bound SVG](https://github.com/gramlot-org/gramlot-examples/blob/main/src/gramlot_examples/pages/binding/07_bound_svg.md) makes geometry follow Data (`r="^.radius"`), while c02 supplies declarative timing for a controller. A repeated task can then use `_timing` with lifecycle managed by its provider. That reduces timer/setup/cleanup code for that task; it does not mean the existing Source animation has secretly become a binding.
|
|
42
|
+
|
|
43
|
+
## Limits and next step
|
|
44
|
+
|
|
45
|
+
This advanced bridge uses a Source script and inline actions, so it is not a pure 0.1.x executable snapshot. No Data persistence or server synchronization is present. Do not copy the timer without its cleanup.
|
|
46
|
+
|
|
47
|
+
Continue with [b01 · Pointers](https://github.com/gramlot-org/gramlot-examples/blob/main/src/gramlot_examples/pages/binding/01_pointers.md). The [authoring reference](https://github.com/gramlot-org/gramlot/blob/main/docs/public/095-writing-pages.md) explains the full contract.
|
|
48
|
+
|
|
49
|
+
</details>
|