neo.mjs 10.2.1 → 10.3.1
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/.github/CONCEPT.md +2 -4
- package/.github/GETTING_STARTED.md +72 -51
- package/.github/RELEASE_NOTES/v10.3.0.md +71 -0
- package/.github/RELEASE_NOTES/v10.3.1.md +14 -0
- package/.github/epic-string-based-templates.md +690 -0
- package/ServiceWorker.mjs +2 -2
- package/apps/covid/view/MainContainer.mjs +1 -1
- package/apps/covid/view/country/Table.mjs +1 -1
- package/apps/portal/index.html +1 -1
- package/apps/portal/view/home/FooterContainer.mjs +1 -1
- package/apps/portal/view/learn/ContentComponent.mjs +1 -1
- package/apps/realworld/api/Base.mjs +2 -2
- package/apps/sharedcovid/view/MainContainer.mjs +1 -1
- package/apps/sharedcovid/view/MainContainerController.mjs +1 -1
- package/buildScripts/buildAll.mjs +4 -0
- package/buildScripts/buildESModules.mjs +23 -75
- package/buildScripts/bundleParse5.mjs +27 -0
- package/buildScripts/util/astTemplateProcessor.mjs +210 -0
- package/buildScripts/util/templateBuildProcessor.mjs +331 -0
- package/buildScripts/webpack/development/webpack.config.appworker.mjs +11 -0
- package/buildScripts/webpack/loader/template-loader.mjs +21 -0
- package/buildScripts/webpack/production/webpack.config.appworker.mjs +11 -0
- package/examples/README.md +1 -1
- package/examples/component/wrapper/googleMaps/MarkerDialog.mjs +2 -2
- package/examples/form/field/email/MainContainer.mjs +0 -1
- package/examples/form/field/number/MainContainer.mjs +0 -1
- package/examples/form/field/picker/MainContainer.mjs +0 -1
- package/examples/form/field/time/MainContainer.mjs +0 -1
- package/examples/form/field/trigger/copyToClipboard/MainContainer.mjs +0 -1
- package/examples/form/field/url/MainContainer.mjs +0 -1
- package/examples/functional/nestedTemplateComponent/Component.mjs +100 -0
- package/examples/functional/nestedTemplateComponent/MainContainer.mjs +48 -0
- package/examples/functional/nestedTemplateComponent/app.mjs +6 -0
- package/examples/functional/nestedTemplateComponent/index.html +11 -0
- package/examples/functional/nestedTemplateComponent/neo-config.json +6 -0
- package/examples/functional/templateComponent/Component.mjs +61 -0
- package/examples/functional/templateComponent/MainContainer.mjs +48 -0
- package/examples/functional/templateComponent/app.mjs +6 -0
- package/examples/functional/templateComponent/index.html +11 -0
- package/examples/functional/templateComponent/neo-config.json +6 -0
- package/learn/gettingstarted/Setup.md +29 -12
- package/learn/guides/fundamentals/ApplicationBootstrap.md +2 -2
- package/learn/guides/fundamentals/InstanceLifecycle.md +5 -5
- package/learn/guides/uibuildingblocks/HtmlTemplates.md +191 -0
- package/learn/guides/uibuildingblocks/HtmlTemplatesUnderTheHood.md +156 -0
- package/learn/guides/uibuildingblocks/WorkingWithVDom.md +1 -1
- package/learn/tree.json +2 -0
- package/package.json +61 -56
- package/src/DefaultConfig.mjs +3 -3
- package/src/calendar/view/calendars/List.mjs +1 -1
- package/src/calendar/view/month/Component.mjs +1 -1
- package/src/calendar/view/week/Component.mjs +1 -1
- package/src/component/Abstract.mjs +1 -1
- package/src/component/Base.mjs +33 -27
- package/src/container/Base.mjs +5 -5
- package/src/controller/Application.mjs +5 -5
- package/src/dialog/Base.mjs +6 -6
- package/src/draggable/DragProxyComponent.mjs +4 -4
- package/src/form/field/ComboBox.mjs +1 -1
- package/src/functional/_export.mjs +2 -1
- package/src/functional/component/Base.mjs +142 -93
- package/src/functional/util/HtmlTemplateProcessor.mjs +243 -0
- package/src/functional/util/html.mjs +24 -67
- package/src/list/Base.mjs +2 -2
- package/src/manager/Toast.mjs +1 -1
- package/src/menu/List.mjs +1 -1
- package/src/mixin/VdomLifecycle.mjs +87 -90
- package/src/tab/Container.mjs +2 -2
- package/src/tooltip/Base.mjs +1 -1
- package/src/tree/Accordion.mjs +2 -2
- package/src/worker/App.mjs +7 -7
- package/test/components/files/component/Base.mjs +1 -1
- package/test/siesta/siesta.js +2 -0
- package/test/siesta/tests/classic/Button.mjs +5 -5
- package/test/siesta/tests/functional/Button.mjs +6 -6
- package/test/siesta/tests/functional/HtmlTemplateComponent.mjs +193 -33
- package/test/siesta/tests/functional/Parse5Processor.mjs +82 -0
- package/test/siesta/tests/vdom/VdomRealWorldUpdates.mjs +5 -5
- package/.github/epic-functional-components.md +0 -498
- package/.github/ticket-asymmetric-vdom-updates.md +0 -122
package/.github/CONCEPT.md
CHANGED
@@ -178,13 +178,11 @@ Pros:
|
|
178
178
|
(no source-maps needed, no webpack interferences etc.)
|
179
179
|
2. Browsers can cache JS modules and native packaging is in development
|
180
180
|
3. Your code base is modular
|
181
|
+
4. The development mode runs in all major browsers (Chrome, Edge, Firefox, Safari)
|
181
182
|
|
182
183
|
Cons:
|
183
184
|
1. neo.mjs is not using TypeScript (you could do it for your own app code, in case you want to use a build process)
|
184
|
-
2.
|
185
|
-
as well as Safari. Mozilla is actively working on it.
|
186
|
-
Of course the dist (dev&prod) versions do run fine in Firefox as well.
|
187
|
-
3. Several npm dependencies can not easily get used, since they do not use a correct ES6 import syntax (e.g. missing file names)
|
185
|
+
2. Several npm dependencies can not easily get used, since they do not use a correct ES6 import syntax (e.g. missing file names)
|
188
186
|
|
189
187
|
## No string based pseudo XML templates
|
190
188
|
One example from the <a href="https://reactjs.org/">React Website</a>:
|
@@ -1,55 +1,76 @@
|
|
1
1
|
# neo.mjs: Getting Started Guide
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
##
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
3.
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
2
|
+
|
3
|
+
This guide covers two main paths for working with neo.mjs:
|
4
|
+
1. **Creating your own application**: The recommended approach for all developers building apps with the framework.
|
5
|
+
2. **Contributing to the framework**: For those who want to contribute code directly to the neo.mjs core.
|
6
|
+
|
7
|
+
---
|
8
|
+
|
9
|
+
## 1. Creating your own application (Recommended)
|
10
|
+
For most use cases, creating a dedicated workspace with `npx neo-app` is the best way to start. This script scaffolds a new project, automatically installs dependencies, runs the initial build, and can even start the development server for you.
|
11
|
+
|
12
|
+
A workspace provides the same structure as the main neo.mjs repository, but includes the framework as an NPM dependency, making it easier to manage.
|
13
|
+
|
14
|
+
### Create a Workspace
|
15
|
+
1. Open your terminal and navigate to the directory where you want to create your project.
|
16
|
+
2. Run the following command:
|
17
|
+
```sh
|
18
|
+
npx neo-app@latest
|
19
|
+
```
|
20
|
+
3. Follow the interactive prompts. The script will guide you through setting up your workspace and creating your first application.
|
21
|
+
|
22
|
+
This single command handles the entire setup process, allowing you to start developing immediately.
|
23
|
+
|
24
|
+
---
|
25
|
+
|
26
|
+
## 2. Contributing to the framework or running examples
|
27
|
+
If you want to contribute to the development of neo.mjs itself, or if you want to run the many demo applications and examples included in the main repository, you will need to set up the core repository locally. The examples are not included in workspaces created with `npx neo-app`.
|
28
|
+
|
29
|
+
### Fork and Clone the Repository
|
30
|
+
1. **Fork the repository**: First, create a fork of the `neomjs/neo` repository on GitHub to your own account.
|
31
|
+
2. **Clone your fork**: Clone your forked repository to your local machine.
|
32
|
+
```sh
|
33
|
+
git clone https://github.com/YOUR_USERNAME/neo.git
|
34
|
+
```
|
35
|
+
|
36
|
+
### Local Setup
|
37
|
+
1. Navigate into the cloned repository folder:
|
38
|
+
```sh
|
39
|
+
cd neo
|
40
|
+
```
|
41
|
+
2. Install the required node modules:
|
42
|
+
```sh
|
43
|
+
npm install
|
44
|
+
```
|
45
|
+
3. Run all relevant build scripts at once:
|
46
|
+
```sh
|
47
|
+
npm run build-all
|
48
|
+
```
|
49
|
+
(See the <a href="https://github.com/neomjs/neo/blob/dev/buildScripts/README.md">Command-Line Interface</a> for further details.)
|
50
|
+
|
51
|
+
### Running the Examples
|
52
|
+
1. **Start the web server**:
|
53
|
+
```sh
|
54
|
+
npm run server-start
|
55
|
+
```
|
56
|
+
A browser tab will open automatically. You can also manually access it at `http://localhost:8080/`. A local web server is required because modern browser security policies prevent JavaScript modules from loading directly from the local file system.
|
57
|
+
|
58
|
+
2. **Explore the apps**:
|
59
|
+
* **Development Mode**: You can run the docs and examples apps **without** any JS build directly in all major browsers (Chrome, Edge, Firefox, Safari).
|
60
|
+
> http://localhost:8080/neo/docs/
|
61
|
+
>
|
62
|
+
> http://localhost:8080/neo/examples/
|
63
|
+
* **Distribution Versions**: These versions also work in all major browsers and represent the built state of the examples.
|
64
|
+
> http://localhost:8080/neo/dist/development/examples/
|
65
|
+
>
|
66
|
+
> http://localhost:8080/neo/dist/production/examples/
|
67
|
+
|
68
|
+
---
|
69
|
+
|
70
|
+
## Dive Deeper with Learning Resources
|
71
|
+
Once you have your environment set up, you can dive deeper into the concepts and architecture of the framework. The learning resources provide a structured path to mastering neo.mjs.
|
72
|
+
|
73
|
+
**[Explore the Learning Resources](../learn/README.md)**
|
53
74
|
|
54
75
|
<br><br>
|
55
76
|
Copyright (c) 2015 - today, <a href="https://www.linkedin.com/in/tobiasuhlig/">Tobias Uhlig</a>
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# Neo.mjs v10.3.0: Introducing HTML Templates
|
2
|
+
|
3
|
+
This release marks a major milestone in the evolution of Neo.mjs, introducing an intuitive, HTML-like syntax for building component VDOMs. This has been a significant undertaking, designed to lower the barrier to entry for new developers while holding true to the framework's core principles of performance and adherence to web standards.
|
4
|
+
|
5
|
+
This feature is the culmination of the work tracked in our public epic: [#7130](https://github.com/neomjs/neo/issues/7130).
|
6
|
+
|
7
|
+
## Key Feature: HTML Templates
|
8
|
+
|
9
|
+
You can now define a component's VDOM using familiar HTML-like syntax, powered by standard JavaScript Tagged Template Literals. This provides an alternative to the traditional JSON-based VDOM structure, making UI development more approachable.
|
10
|
+
|
11
|
+
```javascript
|
12
|
+
import { html } from '../../src/functional/util/html.mjs';
|
13
|
+
import Button from '../../src/button/Base.mjs';
|
14
|
+
|
15
|
+
// Inside a component's render() method:
|
16
|
+
return html`
|
17
|
+
<div class="my-container">
|
18
|
+
<p>${this.myText}</p>
|
19
|
+
<${Button} text="Click Me" onClick="${this.onButtonClick}" />
|
20
|
+
</div>
|
21
|
+
`;
|
22
|
+
```
|
23
|
+
|
24
|
+
### The Philosophy: Why Not JSX?
|
25
|
+
|
26
|
+
This new feature is built on a core Neo.mjs principle: **a commitment to a zero-builds development experience.**
|
27
|
+
|
28
|
+
- **Standard JavaScript:** Unlike JSX, which requires a compiler, `html` templates are a standard JavaScript feature. Your code runs directly in the browser without a mandatory build step, providing an instant feedback loop.
|
29
|
+
- **No Hidden Magic:** Logic is handled with plain JavaScript (`if/else`, `.map()`), not special template directives. What you write is what you get.
|
30
|
+
|
31
|
+
### The Dual-Mode Architecture
|
32
|
+
|
33
|
+
To achieve both developer convenience and production performance, the framework uses a sophisticated dual-mode approach:
|
34
|
+
|
35
|
+
1. **Development Mode:** Templates are parsed live in the browser using `parse5`. This parser is **only loaded if templates are actually used**, ensuring zero overhead for applications that stick to the JSON VDOM.
|
36
|
+
2. **Production Mode:** For `dist/esm`, `dist/dev`, and `dist/prod` builds, a powerful **build-time AST transformation** converts templates directly into optimized VDOM objects. This eliminates the `parse5` dependency from production builds entirely, resulting in **zero runtime parsing overhead** and maximum performance. The `enableHtmlTemplates` flag is also automatically set to `false` in production environments, ensuring that the runtime parser is never accidentally used.
|
37
|
+
|
38
|
+
As a developer convenience, if you name your template-generating method `render()`, the build process will automatically rename it to `createVdom()` for you, aligning with the framework's lifecycle methods while providing a familiar entry point.
|
39
|
+
|
40
|
+
## Foundational Enhancements
|
41
|
+
|
42
|
+
The introduction of HTML templates was made possible by a series of significant enhancements to the framework's core and build scripts:
|
43
|
+
|
44
|
+
- **Component Lifecycle Integration (`src/functional/component/Base.mjs`):** The functional component base class was updated to recognize and process the new `HtmlTemplate` return type from `render()`, seamlessly integrating the parsing process into the component lifecycle.
|
45
|
+
- **Runtime Parsing (`src/functional/util/HtmlTemplateProcessor.mjs`):** A new runtime processor that intelligently flattens nested templates, handles dynamic values, and uses `parse5` to convert the HTML string into a VDOM structure.
|
46
|
+
- **Build-Time AST Processing (`buildScripts/util/astTemplateProcessor.mjs`):** A new, robust build-time processor that uses `acorn` to parse source code into an Abstract Syntax Tree (AST), replaces template literals with their VDOM object counterparts, and generates new, optimized code with `astring`.
|
47
|
+
- **Webpack Integration (`buildScripts/webpack/loader/template-loader.mjs`):** A new Webpack loader that hooks the AST processor into the `dist/dev` and `dist/prod` build pipelines, applied only to the app worker where components live.
|
48
|
+
|
49
|
+
## New Documentation
|
50
|
+
|
51
|
+
To support this major new feature, we have added two comprehensive guides:
|
52
|
+
|
53
|
+
- [Using HTML Templates](../learn/guides/uibuildingblocks/HtmlTemplates.md): A guide focused on the syntax, features, and best practices for using the new template system.
|
54
|
+
- [Under the Hood: HTML Templates](../learn/guides/uibuildingblocks/HtmlTemplatesUnderTheHood.md): A deep dive into the philosophy and the dual-mode architecture, explaining how templates work in both development and production environments.
|
55
|
+
|
56
|
+
All changes combined into 1 commit: https://github.com/neomjs/neo/commit/0841e7e1a715c7afe67d07eebb8229e54828eedd
|
57
|
+
|
58
|
+
We are incredibly excited about this release and believe it makes Neo.mjs more powerful and accessible than ever. Please explore the new feature, read the documentation, and share your feedback!
|
59
|
+
|
60
|
+
Try it out by yourself:</br>
|
61
|
+
https://neomjs.com/examples/functional/nestedTemplateComponent/
|
62
|
+
|
63
|
+
<img width="1603" height="1292" alt="Screenshot 2025-08-02 at 17 01 25" src="https://github.com/user-attachments/assets/79cb4aad-b791-4b03-bf25-7147bbeeed39" />
|
64
|
+
|
65
|
+
https://neomjs.com/dist/esm/examples/functional/nestedTemplateComponent/
|
66
|
+
|
67
|
+
<img width="1606" height="1062" alt="Screenshot 2025-08-02 at 17 00 12" src="https://github.com/user-attachments/assets/7a21638f-cb68-4f28-ba04-6ebaccb3b3f3" />
|
68
|
+
|
69
|
+
https://neomjs.com/dist/development/examples/functional/nestedTemplateComponent/
|
70
|
+
|
71
|
+
<img width="1602" height="1179" alt="Screenshot 2025-08-02 at 17 06 24" src="https://github.com/user-attachments/assets/2c1d3ef7-2008-41a1-9025-2859d907ce2d" />
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Neo.mjs v10.3.1: Build Process Reliability
|
2
|
+
|
3
|
+
This is a patch release focused on improving the stability and reliability of the core build process.
|
4
|
+
|
5
|
+
## Key Fix: Build Process Dependency Order
|
6
|
+
|
7
|
+
### The Problem
|
8
|
+
The main `buildAll.mjs` script could fail on a clean repository checkout. The build steps that process HTML templates (e.g., `buildESModules`) have a dependency on the `dist/parse5.mjs` bundle. However, the script did not guarantee that this bundle was created before it was needed, leading to a potential crash.
|
9
|
+
|
10
|
+
### The Solution
|
11
|
+
We have updated `buildAll.mjs` to explicitly run the `bundleParse5.mjs` script as one of its first actions, immediately after the optional `npm install`.
|
12
|
+
|
13
|
+
### The Impact
|
14
|
+
This change ensures the `parse5` dependency is always available for subsequent build tasks. It makes the build process more robust and predictable, particularly for developers setting up the project for the first time.
|