gramlot-examples 0.2.2__py3-none-any.whl

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.
Files changed (99) hide show
  1. gramlot_examples/__init__.py +86 -0
  2. gramlot_examples/catalog.json +253 -0
  3. gramlot_examples/gallery/dist/LICENSE +176 -0
  4. gramlot_examples/gallery/dist/NOTICE +8 -0
  5. gramlot_examples/gallery/dist/frame.js +28 -0
  6. gramlot_examples/gallery/dist/gallery.js +21239 -0
  7. gramlot_examples/gallery/dist/notices.json +38 -0
  8. gramlot_examples/gallery/gallery.css +110 -0
  9. gramlot_examples/gallery/page.py +106 -0
  10. gramlot_examples/pages/README.md +21 -0
  11. gramlot_examples/pages/binding/01_pointers.md +14 -0
  12. gramlot_examples/pages/binding/01_pointers.py +34 -0
  13. gramlot_examples/pages/binding/02_variable_datapath.md +9 -0
  14. gramlot_examples/pages/binding/02_variable_datapath.py +31 -0
  15. gramlot_examples/pages/binding/03_setters_and_defaults.md +10 -0
  16. gramlot_examples/pages/binding/03_setters_and_defaults.py +40 -0
  17. gramlot_examples/pages/binding/04_native_editing.md +11 -0
  18. gramlot_examples/pages/binding/04_native_editing.py +51 -0
  19. gramlot_examples/pages/binding/05_checkbox_radio.md +9 -0
  20. gramlot_examples/pages/binding/05_checkbox_radio.py +37 -0
  21. gramlot_examples/pages/binding/06_style_and_visibility.md +11 -0
  22. gramlot_examples/pages/binding/06_style_and_visibility.py +48 -0
  23. gramlot_examples/pages/binding/07_bound_svg.md +7 -0
  24. gramlot_examples/pages/binding/07_bound_svg.py +32 -0
  25. gramlot_examples/pages/binding/08_freeze.css +1 -0
  26. gramlot_examples/pages/binding/08_freeze.md +11 -0
  27. gramlot_examples/pages/binding/08_freeze.py +25 -0
  28. gramlot_examples/pages/binding/08_freeze_aux.js +26 -0
  29. gramlot_examples/pages/binding/09_forms.css +8 -0
  30. gramlot_examples/pages/binding/09_forms.md +12 -0
  31. gramlot_examples/pages/binding/09_forms.py +77 -0
  32. gramlot_examples/pages/binding/10_svg_shapes.md +9 -0
  33. gramlot_examples/pages/binding/10_svg_shapes.py +40 -0
  34. gramlot_examples/pages/binding/11_complete_page.css +5 -0
  35. gramlot_examples/pages/binding/11_complete_page.md +12 -0
  36. gramlot_examples/pages/binding/11_complete_page.py +115 -0
  37. gramlot_examples/pages/binding/README.md +9 -0
  38. gramlot_examples/pages/controllers/01_formula.md +12 -0
  39. gramlot_examples/pages/controllers/01_formula.py +31 -0
  40. gramlot_examples/pages/controllers/02_controller.md +10 -0
  41. gramlot_examples/pages/controllers/02_controller.py +44 -0
  42. gramlot_examples/pages/controllers/03_named_logic.md +12 -0
  43. gramlot_examples/pages/controllers/03_named_logic.py +26 -0
  44. gramlot_examples/pages/controllers/03_named_logic_aux.js +19 -0
  45. gramlot_examples/pages/controllers/04_inline_expressions.md +12 -0
  46. gramlot_examples/pages/controllers/04_inline_expressions.py +36 -0
  47. gramlot_examples/pages/controllers/05_node_methods.css +1 -0
  48. gramlot_examples/pages/controllers/05_node_methods.md +11 -0
  49. gramlot_examples/pages/controllers/05_node_methods.py +38 -0
  50. gramlot_examples/pages/controllers/06_button_controller.md +11 -0
  51. gramlot_examples/pages/controllers/06_button_controller.py +34 -0
  52. gramlot_examples/pages/controllers/07_events.md +10 -0
  53. gramlot_examples/pages/controllers/07_events.py +37 -0
  54. gramlot_examples/pages/controllers/08_remote_source.md +10 -0
  55. gramlot_examples/pages/controllers/08_remote_source.py +34 -0
  56. gramlot_examples/pages/controllers/08_remote_source_aux.js +8 -0
  57. gramlot_examples/pages/controllers/09_end_to_end.css +1 -0
  58. gramlot_examples/pages/controllers/09_end_to_end.md +14 -0
  59. gramlot_examples/pages/controllers/09_end_to_end.py +65 -0
  60. gramlot_examples/pages/controllers/09_end_to_end_aux.js +35 -0
  61. gramlot_examples/pages/controllers/README.md +11 -0
  62. gramlot_examples/pages/html_svg/01_hello_world.md +9 -0
  63. gramlot_examples/pages/html_svg/01_hello_world.py +11 -0
  64. gramlot_examples/pages/html_svg/02_text_and_links.md +9 -0
  65. gramlot_examples/pages/html_svg/02_text_and_links.py +27 -0
  66. gramlot_examples/pages/html_svg/03_lists.md +9 -0
  67. gramlot_examples/pages/html_svg/03_lists.py +30 -0
  68. gramlot_examples/pages/html_svg/04_semantic_page.md +9 -0
  69. gramlot_examples/pages/html_svg/04_semantic_page.py +24 -0
  70. gramlot_examples/pages/html_svg/05_tables.md +9 -0
  71. gramlot_examples/pages/html_svg/05_tables.py +29 -0
  72. gramlot_examples/pages/html_svg/06_forms.css +5 -0
  73. gramlot_examples/pages/html_svg/06_forms.md +9 -0
  74. gramlot_examples/pages/html_svg/06_forms.py +62 -0
  75. gramlot_examples/pages/html_svg/07_native_disclosure.md +9 -0
  76. gramlot_examples/pages/html_svg/07_native_disclosure.py +25 -0
  77. gramlot_examples/pages/html_svg/08_svg_shapes.md +9 -0
  78. gramlot_examples/pages/html_svg/08_svg_shapes.py +22 -0
  79. gramlot_examples/pages/html_svg/09_svg_composition.md +9 -0
  80. gramlot_examples/pages/html_svg/09_svg_composition.py +44 -0
  81. gramlot_examples/pages/html_svg/10_cards_with_icons.css +6 -0
  82. gramlot_examples/pages/html_svg/10_cards_with_icons.md +20 -0
  83. gramlot_examples/pages/html_svg/10_cards_with_icons.py +38 -0
  84. gramlot_examples/pages/html_svg/11_static_report.css +3 -0
  85. gramlot_examples/pages/html_svg/11_static_report.md +9 -0
  86. gramlot_examples/pages/html_svg/11_static_report.py +61 -0
  87. gramlot_examples/pages/html_svg/12_complete_page.css +5 -0
  88. gramlot_examples/pages/html_svg/12_complete_page.md +9 -0
  89. gramlot_examples/pages/html_svg/12_complete_page.py +109 -0
  90. gramlot_examples/pages/html_svg/13_live_source.css +3 -0
  91. gramlot_examples/pages/html_svg/13_live_source.md +18 -0
  92. gramlot_examples/pages/html_svg/13_live_source.py +62 -0
  93. gramlot_examples/pages/html_svg/README.md +10 -0
  94. gramlot_examples/py.typed +0 -0
  95. gramlot_examples-0.2.2.dist-info/METADATA +63 -0
  96. gramlot_examples-0.2.2.dist-info/RECORD +99 -0
  97. gramlot_examples-0.2.2.dist-info/WHEEL +4 -0
  98. gramlot_examples-0.2.2.dist-info/licenses/LICENSE +176 -0
  99. gramlot_examples-0.2.2.dist-info/licenses/NOTICE +8 -0
@@ -0,0 +1,86 @@
1
+ """Gramlot example pages, the gallery page and its catalogue."""
2
+
3
+ import json
4
+ import re
5
+ from importlib.resources import files
6
+ from pathlib import Path
7
+
8
+ PACKAGE = Path(__file__).resolve().parent
9
+ MEDIA_TYPES = {".css": "text/css", ".svg": "image/svg+xml", ".json": "application/json"}
10
+ SUFFIXES = (".py", ".js", ".css", ".md", "_aux.js")
11
+ DIST = ("gallery.js", "frame.js", "notices.json", "LICENSE", "NOTICE")
12
+
13
+
14
+ def media_type(path, script=False):
15
+ """Media type of a gallery asset; only the built gallery scripts are served as JavaScript."""
16
+ if script:
17
+ return "application/javascript"
18
+ return MEDIA_TYPES.get(path.suffix, "text/plain")
19
+
20
+
21
+ def read_catalog(catalog, pages, common):
22
+ """Load one ``catalog.json`` and check its ``environment`` against the key rule."""
23
+ data = json.loads(Path(catalog).read_text())
24
+ environment = data.get("environment")
25
+ if common and environment is not None:
26
+ raise ValueError(f"The common catalogue declares an environment: {catalog}")
27
+ if not common and not environment:
28
+ raise ValueError(f"An environment catalogue has no environment: {catalog}")
29
+ pattern = None if common else re.compile(rf"{re.escape(environment)}-\d{{2}}")
30
+ families = []
31
+ for family in data["families"]:
32
+ for example in family["examples"]:
33
+ if pattern is not None and not pattern.fullmatch(example["key"]):
34
+ raise ValueError(f"Example key {example['key']!r} does not match {environment}-NN: {catalog}")
35
+ families.append({**family, "path": Path(pages) / family["key"]})
36
+ return families
37
+
38
+
39
+ def build_gallery(catalogs=()):
40
+ """Return the families, routes and static assets of the common gallery plus ``catalogs``.
41
+
42
+ Each item of ``catalogs`` is a pair ``(catalog.json, pages folder)`` of one environment.
43
+ ``routes`` maps each key to its Python page and same-name companions; ``assets`` maps
44
+ each URL to its file and media type. Nothing is written or served here.
45
+ """
46
+ families = read_catalog(PACKAGE / "catalog.json", PACKAGE / "pages", common=True)
47
+ for catalog, pages in catalogs:
48
+ families.extend(read_catalog(catalog, pages, common=False))
49
+ keys = ["index"] + [key for family in families
50
+ for key in (family["key"], *(example["key"] for example in family["examples"]))]
51
+ duplicates = sorted({key for key in keys if keys.count(key) > 1})
52
+ if duplicates:
53
+ raise ValueError(f"Duplicate gallery keys: {', '.join(duplicates)}")
54
+
55
+ gallery = PACKAGE / "gallery"
56
+ resources = Path(files("gramlot")) / "resources"
57
+ routes = {"index": {"page": gallery / "page.py", "stylesheet": None, "logic": None}}
58
+ files_by_url = [
59
+ ("/themes/gramlot-base/theme.css", resources / "themes" / "gramlot-base" / "theme.css"),
60
+ ("/assets/branding/gramlot-logo-dark.svg", resources / "assets" / "branding" / "gramlot-logo-dark.svg"),
61
+ ("/gallery/gallery.css", gallery / "gallery.css"),
62
+ *((f"/gallery/{name}", gallery / name) for name in ("page.py", "page.js") if (gallery / name).is_file()),
63
+ ]
64
+ assets = {url: {"file": path, "type": media_type(path)} for url, path in files_by_url}
65
+ for name in DIST:
66
+ path = gallery / "dist" / name
67
+ assets[f"/gallery/dist/{name}"] = {"file": path, "type": media_type(path, path.suffix == ".js")}
68
+ for family in families:
69
+ folder = family["path"]
70
+ for example in family["examples"]:
71
+ page = folder / f"{example['folder']}.py"
72
+ if not page.is_file():
73
+ raise FileNotFoundError(f"Missing page: {page}")
74
+ stylesheet = folder / f"{example['folder']}.css"
75
+ logic = folder / f"{example['folder']}_aux.js"
76
+ routes[example["key"]] = {"page": page,
77
+ "stylesheet": stylesheet if stylesheet.is_file() else None,
78
+ "logic": logic if logic.is_file() else None}
79
+ for suffix in SUFFIXES:
80
+ source = folder / f"{example['folder']}{suffix}"
81
+ if source.is_file():
82
+ assets[f"/pages/{family['key']}/{source.name}"] = {"file": source, "type": media_type(source)}
83
+ return {"families": families, "routes": routes, "assets": assets}
84
+
85
+
86
+ __all__ = ["build_gallery"]
@@ -0,0 +1,253 @@
1
+ {
2
+ "families": [
3
+ {
4
+ "key": "html_svg",
5
+ "title": "HTML / SVG",
6
+ "examples": [
7
+ {
8
+ "key": "e01",
9
+ "title": "Hello World",
10
+ "folder": "01_hello_world",
11
+ "description": "A heading and a paragraph: the smallest Gramlot page.",
12
+ "explanation": "The Page class defines main(root). Each builder call adds a typed Source node; the integration hosts the page and Gramlot renders it."
13
+ },
14
+ {
15
+ "key": "e02",
16
+ "title": "Text and links",
17
+ "folder": "02_text_and_links",
18
+ "description": "Headings, inline text, quotations, code and links.",
19
+ "explanation": "Follow the nested builder calls to see how text and child elements coexist. The example includes an internal anchor and literal text that is escaped rather than interpreted as markup."
20
+ },
21
+ {
22
+ "key": "e03",
23
+ "title": "Lists",
24
+ "folder": "03_lists",
25
+ "description": "Ordered, unordered and nested lists, plus a glossary.",
26
+ "explanation": "Local sequences supply the content. Loops create the repeated list items, while nesting expresses the document hierarchy."
27
+ },
28
+ {
29
+ "key": "e04",
30
+ "title": "Semantic page",
31
+ "folder": "04_semantic_page",
32
+ "description": "A page composed from meaningful HTML landmarks.",
33
+ "explanation": "Header, navigation, article, aside and footer give the content structure. Ordinary page methods divide construction into readable sections."
34
+ },
35
+ {
36
+ "key": "e05",
37
+ "title": "Tables",
38
+ "folder": "05_tables",
39
+ "description": "A catalogue with headings, rows and totals.",
40
+ "explanation": "A row helper and a loop build the table from fixed data. Caption and scoped headings describe its structure; the footer presents the calculated total."
41
+ },
42
+ {
43
+ "key": "e06",
44
+ "title": "Forms",
45
+ "folder": "06_forms",
46
+ "description": "Native fields, choices, buttons and a slider.",
47
+ "explanation": "Try typing, selecting options and moving the slider. Reset restores defaults. The submit button is disabled: this example has no save endpoint or application event handlers."
48
+ },
49
+ {
50
+ "key": "e07",
51
+ "title": "Native disclosure",
52
+ "folder": "07_native_disclosure",
53
+ "description": "Expandable questions and native progress indicators.",
54
+ "explanation": "The browser supplies details/summary interaction. Progress and meter values are static; the example introduces no bindings or controllers."
55
+ },
56
+ {
57
+ "key": "e08",
58
+ "title": "SVG shapes",
59
+ "folder": "08_svg_shapes",
60
+ "description": "The basic SVG vocabulary inside an HTML page.",
61
+ "explanation": "The SVG builder creates shapes within a viewBox. Coordinates determine geometry, while the shared theme supplies colors through semantic CSS variables."
62
+ },
63
+ {
64
+ "key": "e09",
65
+ "title": "SVG composition",
66
+ "folder": "09_svg_composition",
67
+ "description": "A scene assembled with groups, paths and repeated objects.",
68
+ "explanation": "Helper methods build houses, trees and flowers. Loops place repeated elements, and group transformations position their local coordinates."
69
+ },
70
+ {
71
+ "key": "e10",
72
+ "title": "Cards with icons",
73
+ "folder": "10_cards_with_icons",
74
+ "description": "HTML cards with SVG icons and live Source removal.",
75
+ "explanation": "Helpers and loops build the cards. Each × button removes its labelled Source node through the browser Builder; Gramlot updates the DOM without reloading. Reload restores the initial cards. No Data binding or server synchronization is involved."
76
+ },
77
+ {
78
+ "key": "e11",
79
+ "title": "Static report",
80
+ "folder": "11_static_report",
81
+ "description": "A summary, chart, legend and table from the same data.",
82
+ "explanation": "Separate methods build each section. SVG bar lengths and table cells use one local dataset, making the connection between values and geometry explicit."
83
+ },
84
+ {
85
+ "key": "e12",
86
+ "title": "Complete page",
87
+ "folder": "12_complete_page",
88
+ "description": "An event page with a programme, speakers, map and FAQ.",
89
+ "explanation": "The main method assembles named sections. Helpers and nested loops compose the schedule, speaker cards and SVG map from fixed local data."
90
+ },
91
+ {
92
+ "key": "e13",
93
+ "title": "Live Source playground",
94
+ "folder": "13_live_source",
95
+ "description": "Create, update and remove Source nodes, with a small SVG animation.",
96
+ "explanation": "Builder calls create list items. Source mutations update text, color and structure. A setInterval animates an SVG attribute; removing its section disposes the timer. Works in hosted profiles and the standalone directory."
97
+ }
98
+ ]
99
+ },
100
+ {
101
+ "key": "binding",
102
+ "title": "Binding",
103
+ "examples": [
104
+ {
105
+ "key": "b01",
106
+ "title": "Pointers",
107
+ "folder": "01_pointers",
108
+ "description": "Read Data with ^, =, relative, symbolic and ?attr pointers.",
109
+ "explanation": "Each ^ pointer subscribes its attribute or text to a Data path; = reads once. A datapath makes .paths relative, #node_id reaches the context of a named node, and ?attr reads an attribute of a Data node."
110
+ },
111
+ {
112
+ "key": "b02",
113
+ "title": "Variable datapath",
114
+ "folder": "02_variable_datapath",
115
+ "description": "One card follows the record chosen in a select.",
116
+ "explanation": "The card's datapath is itself a pointer. Choosing another record changes the context of every relative pointer below it; the DOM follows without rebuilding the page."
117
+ },
118
+ {
119
+ "key": "b03",
120
+ "title": "Setters and defaults",
121
+ "folder": "03_setters_and_defaults",
122
+ "description": "dataSetter values and control defaults, all in place at the first render.",
123
+ "explanation": "dataSetter nodes sit after the controls and in a later branch, yet the first DOM already shows their values. Controls fill an empty path with default or default_value; attr_ writes an attribute on the Data node."
124
+ },
125
+ {
126
+ "key": "b04",
127
+ "title": "Native editing",
128
+ "folder": "04_native_editing",
129
+ "description": "Text, number, range, select, date and color fields bound both ways.",
130
+ "explanation": "Each control's value is a ^ pointer. Editing writes the Data at change, or at every input when live is true; here live itself follows a checkbox."
131
+ },
132
+ {
133
+ "key": "b05",
134
+ "title": "Checkbox and radio",
135
+ "folder": "05_checkbox_radio",
136
+ "description": "Booleans in the Data, one per checkbox and radio button.",
137
+ "explanation": "A checkbox writes true or false. Radio buttons of one group each own a boolean: choosing one writes true there and false in the others."
138
+ },
139
+ {
140
+ "key": "b06",
141
+ "title": "Style and visibility",
142
+ "folder": "06_style_and_visibility",
143
+ "description": "visible, class, style and reactive style shortcuts.",
144
+ "explanation": "Attributes such as color, background_color, font_size and rounded compose one style attribute and follow the Data. visible hides an element and keeps its space; hidden removes it from the layout."
145
+ },
146
+ {
147
+ "key": "b07",
148
+ "title": "Bound SVG",
149
+ "folder": "07_bound_svg",
150
+ "description": "SVG geometry and paint follow range and color fields.",
151
+ "explanation": "SVG presentation attributes take ^ pointers like HTML attributes. The circle's radius, the bar's width and both fills are Data values edited by native controls."
152
+ },
153
+ {
154
+ "key": "b08",
155
+ "title": "Freeze",
156
+ "folder": "08_freeze",
157
+ "description": "Freeze a branch, change its Data and Source, then thaw once.",
158
+ "explanation": "A frozen branch keeps reacting to Data but defers structural DOM work. Removing a child under freeze takes effect at the thaw, which builds the current Source once."
159
+ },
160
+ {
161
+ "key": "b09",
162
+ "title": "Forms with binding",
163
+ "folder": "09_forms",
164
+ "description": "The native form of example 06, bound to a record.",
165
+ "explanation": "The same fieldsets as HTML / SVG example 06, with every value bound to one Data record. The summary beside the form shows the record while you type."
166
+ },
167
+ {
168
+ "key": "b10",
169
+ "title": "SVG shapes with binding",
170
+ "folder": "10_svg_shapes",
171
+ "description": "The six shapes of example 08, resized and recolored by controls.",
172
+ "explanation": "The shapes of HTML / SVG example 08 read their size and color from the Data; sliders and a color field change them."
173
+ },
174
+ {
175
+ "key": "b11",
176
+ "title": "Complete page with binding",
177
+ "folder": "11_complete_page",
178
+ "description": "The event page of example 12, with a bound heading, filter and map.",
179
+ "explanation": "The event page of HTML / SVG example 12 reads its heading from settings, filters the schedule by speaker through visible, and highlights the chosen map stop."
180
+ }
181
+ ]
182
+ },
183
+ {
184
+ "key": "controllers",
185
+ "title": "Controllers",
186
+ "examples": [
187
+ {
188
+ "key": "c01",
189
+ "title": "Formula",
190
+ "folder": "01_formula",
191
+ "description": "dataFormula computes a result path from its parameters.",
192
+ "explanation": "The formula runs when a ^ parameter changes and writes its result; a = parameter is read without triggering. _if and _else choose between two results."
193
+ },
194
+ {
195
+ "key": "c02",
196
+ "title": "Controller",
197
+ "folder": "02_controller",
198
+ "description": "dataController reacts to Data, to a fired path and to time.",
199
+ "explanation": "A controller runs code for its effects: here it validates a value, counts fired requests, debounces with _delay and ticks a clock with _timing."
200
+ },
201
+ {
202
+ "key": "c03",
203
+ "title": "Named logic",
204
+ "folder": "03_named_logic",
205
+ "description": "Formula and controller bodies in the companion 03_named_logic_aux.js.",
206
+ "explanation": "The companion exports class Logic. func names one of its methods; the method receives the resolved parameters, and a controller also its node. Named logic runs under a strict CSP."
207
+ },
208
+ {
209
+ "key": "c04",
210
+ "title": "Inline expressions",
211
+ "folder": "04_inline_expressions",
212
+ "description": "== expressions in text and attributes, and inline scripts.",
213
+ "explanation": "An attribute starting with == is an expression over the other attributes of its node. It follows the pointers it reads, like a formula without a result path."
214
+ },
215
+ {
216
+ "key": "c05",
217
+ "title": "Node methods",
218
+ "folder": "05_node_methods",
219
+ "description": "SET, GET, PUT, FIRE and FIRE_AFTER from button actions.",
220
+ "explanation": "Each button action calls a method of its Source node. SET notifies observers, PUT writes silently, FIRE fires also with an equal value, FIRE_AFTER fires after a delay."
221
+ },
222
+ {
223
+ "key": "c06",
224
+ "title": "Button controller",
225
+ "folder": "06_button_controller",
226
+ "description": "A button with a nested controller, click counter, modifiers and fire.",
227
+ "explanation": "A dataController nested in a button runs once per click, with button_counter and the modifier keys. fire and fire_<name> write a Data path instead of running code."
228
+ },
229
+ {
230
+ "key": "c07",
231
+ "title": "Events",
232
+ "folder": "07_events",
233
+ "description": "connect_on<event> attributes for click, input, key and pointer events.",
234
+ "explanation": "connect_onclick, connect_oninput, connect_onkeydown and connect_onmouseover add one listener each. The handler runs with this set to the declaring node."
235
+ },
236
+ {
237
+ "key": "c08",
238
+ "title": "Remote Source",
239
+ "folder": "08_remote_source",
240
+ "description": "remoteSource replaces a branch with Source built on the server.",
241
+ "explanation": "The Page declares a Source method. A named controller asks for it; the new branch brings its own dataSetter values, visible at its first render."
242
+ },
243
+ {
244
+ "key": "c09",
245
+ "title": "End-to-end story",
246
+ "folder": "09_end_to_end",
247
+ "description": "Title, input, radios, checkbox, formula, SVG, button and remote Source together.",
248
+ "explanation": "The acceptance page of the 0.2.0 plan: setters after the controls, live editing, a radio pair, a formula and controller driving text and SVG, a counting button, a remote branch and freeze."
249
+ }
250
+ ]
251
+ }
252
+ ]
253
+ }
@@ -0,0 +1,176 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to the Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
@@ -0,0 +1,8 @@
1
+ Gramlot examples
2
+ Copyright 2025-2026 Softwell S.r.l.
3
+
4
+ This product includes software developed at Softwell S.r.l.
5
+ (https://www.softwell.it/), originally in Genro Pages and Genro DOM JS.
6
+ The original Genro DOM JS notice states: Copyright 2025 Softwell S.r.l.
7
+
8
+ Licensed under the Apache License, Version 2.0.
@@ -0,0 +1,28 @@
1
+ (() => {
2
+ // src/gramlot_examples/gallery/browser/theme-messages.js
3
+ var THEME_READY = "gallery:theme-ready";
4
+ var THEME_SET = "gallery:theme-set";
5
+ var THEMES = /* @__PURE__ */ new Set(["light", "dark"]);
6
+
7
+ // src/gramlot_examples/gallery/browser/frame-theme.js
8
+ function mountFrameTheme(renderer, node) {
9
+ const window2 = renderer.destination.ownerDocument.defaultView;
10
+ if (window2.parent === window2) return;
11
+ const message = (event) => {
12
+ if (event.source !== window2.parent || event.data?.type !== THEME_SET || !THEMES.has(event.data.theme)) return;
13
+ window2.document.documentElement.setAttribute("data-theme", event.data.theme);
14
+ };
15
+ window2.addEventListener("message", message);
16
+ renderer.onDispose(node, () => window2.removeEventListener("message", message));
17
+ window2.parent.postMessage({ type: THEME_READY }, "*");
18
+ }
19
+
20
+ // src/gramlot_examples/gallery/browser/frame-entry.js
21
+ var script = document.currentScript;
22
+ queueMicrotask(() => {
23
+ const renderer = window.gramlot.renderer;
24
+ const record = renderer.elements.get(script);
25
+ if (!record || renderer.disposed || renderer.records.get(record.node) !== record) return;
26
+ mountFrameTheme(renderer, record.node);
27
+ });
28
+ })();