Skip to content

Commit ae32e28

Browse files
committed
Improving Include, homepage
1 parent 47bb7cc commit ae32e28

File tree

7 files changed

+88
-92
lines changed

7 files changed

+88
-92
lines changed

src/devlog/2024-12.html

Lines changed: 22 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@
55

66

77
I'm happy to announce the release of Alpha 0.0.73, which brings quite a few new
8-
handy features, while still keeping it all under 2000 lines of code.
9-
10-
Finally, I'm happy to announce that after extensive "dog-fooding", Modulo is
11-
getting ready for prime time -- or at least "prime-ish" time!). To communicate
12-
it's feature stability, the project is ready to transition to a "beta" phase.
13-
More info on the release plans contained below.
8+
handy features, while still keeping it all under 2000 lines of code. This
9+
release marks the first that starts the process toward a more stable `0.1.0` or
10+
"beta" release (likely around the `~0.0.75` or `~0.0.80` releases). More info
11+
on the release plans contained below.
1412

1513

1614
## Alpha 73
@@ -60,13 +58,17 @@
6058
The simplest way to use `Include` is as a global definition. It will "include"
6159
it's contents in the head of the document as soon as Modulo loads. Note that
6260
it will NEVER include the same thing twice (it uses hashes to identify
63-
resources).
61+
resources). This mode is great for following tutorials for integrating JS
62+
projects.
6463

65-
This mode is great for following tutorials for integrating JS projects. You can
66-
often simply copy and paste whatever you are given into the `Include`, as such:
64+
For example, to include Quill JS, it's as easy as just pasting in the head
65+
content they give you:
6766

6867
```
69-
<Include></Include>
68+
<Include>
69+
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/quill.snow.css" rel="stylesheet" />
70+
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/quill.js">/script>
71+
</Include>
7072
```
7173

7274

@@ -77,31 +79,18 @@
7779

7880
```
7981
<Include>
80-
<meta name="charset" charset="utf8" />
81-
<meta name="content-type" http-equiv="Content-Type" content="text/html; charset=utf-8" />
82+
<meta name="description" content="A great Modulo website" />
8283
<meta name="viewport" content="width=device-width, initial-scale=1" />
84+
<meta name="charset" charset="utf8" />
8385
</Include>
8486
```
8587

86-
### Example 3: For NPM dependencies
87-
88-
One of the most powerful features of _Include_ is the ability to bring in
89-
packages from NPM (or equivalent), given their package name and a CDN server.
90-
See below:
91-
92-
```
93-
<Component>
94-
<Include
95-
-server="unpkg.com"
96-
cke="1.3.4"
97-
></Include>
98-
<Template>
99-
<textare></textarea>
100-
</Template>
101-
</Component>
102-
```
88+
### Additional features
10389

104-
Also, note that you can use `-load-mode="lazy"` to make it skip
90+
Also, note that you can use `-load-mode="lazy"` to make it skip the bundle, and
91+
only get inserted as-is on page load. This is great for fixing bugs with
92+
integrating other JS packages, while supporting advanced features like
93+
JavaScript modules and `import` statements.
10594

10695

10796
### Alpha 73 Deprecation FAQ
@@ -144,8 +133,9 @@
144133

145134
This means I am trying my best to avoid having to add or remove any major
146135
features from "beta" to "1.0". The goal of the subseuqent beta releases (e.g.,
147-
`0.2.x`, `0.3.x`), in preparation for a highly-stable, semi-final 1.0 release, are
148-
to polish
136+
`0.2.x`, `0.3.x`), in preparation for a highly-stable, semi-final 1.0 release,
137+
are to polish, stabilize, and provide crystal-clear documentation and
138+
best-practices.
149139

150140
In the mean time, check out the following early work in progress "teasers" of
151141
what's in store:

src/docs/core/component.html

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@
66
# Component
77

88
> **Low-level interface** - Component developers will typically
9-
only need to use the `name="..."` attribute on *Component*,
10-
and sometimes `mode="vanish-into-document"` for page-level
11-
components. Similarly, none of the `renderObj.component` properties
12-
are typically useful for component developers. Instead, they are used
13-
internally by CParts (notably *Template*) in order to move along the
14-
rendering cycle.
9+
only need to use the `name="..."` attribute on *Component*. Similarly, none of
10+
the `renderObj.component` properties are typically useful for component
11+
developers. Instead, they are used internally by CParts (notably *Template*) in
12+
order to move along the rendering cycle.
1513

1614
The *Component* definition is the most central to Modulo. It's how we register
1715
components to be mounted on the page, and define the CParts that go inside
@@ -138,12 +136,13 @@ <h3>To Do example:</h3>
138136
render mode of this component. This changes what is considered to be the root
139137
of the element, and thus where the content of the Template goes during
140138
reconciliation. In "regular" and "vanish", it's the custom component itself
141-
(which will be removed after rendering with "vanish"), in "shadow", it uses an
142-
attached shadow DOM as the root, and with "vanish-into-document" it replaces
143-
the entire page. This allows you to isolate outside CSS from your component
144-
using "shadow", do one-time renders only with "vanish", or make your component
145-
replace the entire document with "vanish-into-document". A detailed discussion
146-
of valid options are below:
139+
(which will be removed after rendering with "vanish"), and in "shadow", it uses an
140+
attached shadow DOM as the root. This allows you to isolate outside CSS from
141+
your component using "shadow" or do one-time renders only with "vanish".
142+
143+
144+
A detailed discussion of valid options are below:
145+
147146
* `mode="regular"` - The default behavior, where the content generated by this
148147
the element will be attached to the regular DOM, as the element itself. This
149148
means that CSS stylesheets attached the normal way (e.g. with a "link" tag)
@@ -181,21 +180,6 @@ <h3>To Do example:</h3>
181180
generators, when you just want to generate plain HTML, with no Modulo JS or
182181
behavior in the end.
183182

184-
* `mode="vanish-into-document"` - This setting is useful in one situation: When
185-
you want to create a "page" level component that changes tags that belong in
186-
the document head, such as `&lt;title&gt;`. Like with `mode="vanish"`
187-
described above, setting this will cause the component to remove itself after
188-
the first time it renders. However, with vanish-into-document, it will
189-
instead replace the entire page. It will also attempt to correctly insert
190-
all tags that belong in the document head (meta, title, link, script to be
191-
specific), causing link and script tags alike (e.g. `&lt;script
192-
src=".."&gt;&lt;/script&gt;`) to load. Finally, the document will be wiped,
193-
and anything else it finds will be put directly into the document's body, for
194-
a clean DOM structure that removes itself entirely during this "one-time
195-
render".
196-
* *DEPRECATION NOTICE* - `vanish-into-document` may be removed, and
197-
simply `vanish` will also support insertion to head
198-
199183
* `mode="custom-root"` - This is rarely useful, but allows for setting some
200184
other DOM element as the new root element for the component to target for
201185
rendering it's content. This is done by assigning a value to
@@ -225,12 +209,10 @@ <h3>To Do example:</h3>
225209
`{this.props.children}`.) For more on the slot interface, see Mozilla's
226210
[The Web Component Slot element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/slot)
227211

228-
Note that Modulo uses this interface for both `mode="shadow"` (e.g. using
229-
`shadowRoot` as the root element for reconciliation) and all the other DOM
230-
rendering modes (e.g. `mode="regular"`, `mode="vanish-into-document"`). For
231-
Shadow DOM, it will fall-back on Browser behavior. For everything else, it will
232-
detach any nodes it finds and reattach the nodes just before the beginning of
233-
the reconciliation process (it's DOM load-directive).
212+
Note that Modulo components can even use this without using shadow rendering
213+
(e.g. `mode="shadow"`). Modulo will attempt to simulate the Shadow DOM
214+
Behavior: it will detach any nodes it finds and reattach the nodes just before
215+
the beginning of the reconciliation process (it's DOM load-directive).
234216

235217
### Defaults
236218

@@ -298,3 +280,20 @@ <h1><slot name="topTitle">Picture</slot></h1>
298280
</x-PhotoFrame>
299281
```
300282

283+
### Deprecated features
284+
285+
286+
* *Alpha 73 - Deprecated, do not use in new projects:*
287+
`mode="vanish-into-document"` - This setting is useful in one situation: When
288+
you want to create a "page" level component that changes tags that belong in
289+
the document head, such as `&lt;title&gt;`. Like with `mode="vanish"`
290+
described above, setting this will cause the component to remove itself after
291+
the first time it renders. However, with vanish-into-document, it will
292+
instead replace the entire page. It will also attempt to correctly insert
293+
all tags that belong in the document head (meta, title, link, script to be
294+
specific), causing link and script tags alike (e.g. `&lt;script
295+
src=".."&gt;&lt;/script&gt;`) to load. Finally, the document will be wiped,
296+
and anything else it finds will be put directly into the document's body, for
297+
a clean DOM structure that removes itself entirely during this "one-time
298+
render".
299+

src/docs/core/index.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@
3333
definitions, along with a summary of each:
3434

3535

36-
1. [Configuration](configuration.html) - *(Extending or configuring Modulo and
37-
including third-party JavaScript libraries)*
36+
1. [Configuration](configuration.html) _and_ [Include](configuration.html) -
37+
*(Extending or configuring Modulo and including third-party JavaScript
38+
libraries)*
3839
2. [Library](library.html) - *(Importing component libraries with
3940
non-conflicting namespaces or aliases)*
4041
3. [Artifact](artifact.html) - *(Customizing build behavior or specifying

src/static/components/layout/HomeSplash/HomeSplash.html

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,23 @@ <h2 style="color: var(--color-fg-semidark)">The Declarative HTML Web Component F
1818
</ul>
1919

2020
<x-TabPane hadjust="true">
21-
<x tab-title="HelloCount">
21+
<x tab-title="Hello">
22+
<!-- TODO: Remove "preview=..." -->
2223
<x-DemoEditor
23-
src="/static/demos/eg/HelloCount.html"
24-
preview="<button style='font-size: 13.3px; font-weight: 400'>Hello 42</button>"
25-
></x-DemoEditor>
24+
src="/static/demos/eg/HelloModulo.html"
25+
preview='<div style="border: 2px dotted Indigo; padding: 10px;">
26+
<p>Building <tt style="color: Indigo">Modulo</tt>
27+
HTML web components is <em>fun</em>!</p>
28+
</div>'></x-DemoEditor>
2629
</x>
2730
<x tab-title="SimpleStyle">
2831
<x-DemoEditor src="/static/demos/eg/SimpleStyle.html"></x-DemoEditor>
2932
</x>
33+
<x tab-title="Count">
34+
<x-DemoEditor
35+
src="/static/demos/eg/HelloCount.html"
36+
></x-DemoEditor>
37+
</x>
3038
<x tab-title="JSON">
3139
<x-DemoEditor src="/static/demos/eg/JSON.html"></x-DemoEditor>
3240
</x>

src/static/components/layout/Page/Page.html

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -117,21 +117,18 @@
117117
<em>YOU!</em></p>
118118
<h3><span alt="Lower case Greek alpha">α</span></h3>
119119

120-
<iframe
121-
src="https://ghbtns.com/github-btn.html?user=modulojs&repo=modulo&type=star&count=true&size=large"
122-
frameborder="0" scrolling="0" width="160" height="30"
123-
title="GitHub"></iframe>
124-
125120
<p style="font-size: 0.9rem; margin:0; padding:0">The Modulo
126121
project needs you (the user), 1) to be aware that it is
127122
"alpha", released for early feedback, and thus you might
128123
encounter <a style="font-size: 0.9rem;"
129124
href="https://github.com/modulojs/modulo/issues">some annoying
130125
bugs</a>, 2) use it to make cool stuff anyway, 3) to star it
131-
and/or follow development on GitHub, which boosts the
132-
framework's visibility, and 4) finally, and most importantly,
133-
to share your cool Modulo creations, both with the world, and
134-
with us, so we know which features to best support.</p>
126+
and/or follow development on <a
127+
href="https://github.com/modulojs/modulo/">GitHub</a>, which
128+
boosts the framework's visibility, and 4) finally, and most
129+
importantly, to share your cool Modulo creations, both with the
130+
world, and with us, so we know which features to best
131+
support.</p>
135132
</div>
136133
</aside>
137134
<nav slot="right">

src/static/data/links/documentation.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,12 @@
141141
'shadow', 'vanish', 'vanish-into-document',
142142
'component.event', 'component.slot', 'component.dataProp'],
143143
},
144+
{
145+
label: 'Include',
146+
filename: 'include.html',
147+
keywords: ['head', 'integrating scripts', 'integrating link tags',
148+
'meta tags', 'lazy loading', 'component includes' ],
149+
},
144150
{
145151
label: 'Library',
146152
filename: 'library.html',
Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
1-
<!-- The simplest re-usable component: Template only -->
1+
<!-- The simplest component: HTML Template only -->
22
<Template>
3-
<!-- <Template> support almost any HTML, including
4-
embedding CSS with inline style attributes -->
5-
<div style="
6-
border: 2px dotted DarkGreen;
7-
padding: 10px;
8-
">
9-
<p>Building <tt style="color: Green">Modulo</tt>
10-
HTML web components is <em>fun</em>!</p>
3+
<div style="border: 2px dotted Indigo; padding: 10px;">
4+
<p>Building <tt style="color: Indigo">Modulo</tt>
5+
HTML web components is <em>fun</em>!</p>
116
</div>
12-
<!-- HINT: First time with Moduolo?
13-
1. Make a change and click RUN to see result
14-
2. Hover over RUN button for more options -->
157
</Template>
8+
<!-- HINT: First time with Modulo?
9+
1. Make a change and click RUN to see result
10+
2. Hover over RUN button for more options -->

0 commit comments

Comments
 (0)