retold 1.0.6 → 4.0.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/.claude/settings.local.json +58 -0
- package/CLAUDE.md +52 -0
- package/docs/.nojekyll +0 -0
- package/docs/README.md +161 -0
- package/docs/_sidebar.md +65 -0
- package/docs/_topbar.md +6 -0
- package/docs/architecture.md +312 -0
- package/docs/cover.md +15 -0
- package/docs/css/docuserve.css +73 -0
- package/docs/fable.md +198 -0
- package/docs/getting-started.md +272 -0
- package/docs/index.html +39 -0
- package/docs/js/pict.min.js +12 -0
- package/docs/js/pict.min.js.map +1 -0
- package/docs/meadow.md +211 -0
- package/docs/modules.md +96 -0
- package/docs/orator.md +164 -0
- package/docs/pict-docuserve.min.js +58 -0
- package/docs/pict-docuserve.min.js.map +1 -0
- package/docs/pict.md +213 -0
- package/docs/retold-building-documentation.md +33 -0
- package/docs/retold-catalog.json +2826 -0
- package/docs/retold-keyword-index.json +161289 -0
- package/docs/utility.md +63 -0
- package/examples/quickstart/README.md +47 -0
- package/examples/quickstart/layer1/README.md +21 -0
- package/examples/quickstart/layer1/index.js +49 -0
- package/examples/quickstart/layer1/package-lock.json +344 -0
- package/examples/quickstart/layer1/package.json +12 -0
- package/examples/quickstart/layer2/README.md +34 -0
- package/examples/quickstart/layer2/index.js +251 -0
- package/examples/quickstart/layer2/package-lock.json +4468 -0
- package/examples/quickstart/layer2/package.json +17 -0
- package/examples/quickstart/layer2/setup-database.js +61 -0
- package/examples/quickstart/layer3/README.md +39 -0
- package/examples/quickstart/layer3/index.js +91 -0
- package/examples/quickstart/layer3/package-lock.json +1936 -0
- package/examples/quickstart/layer3/package.json +14 -0
- package/examples/quickstart/layer4/README.md +47 -0
- package/examples/quickstart/layer4/generate-build-config.js +18 -0
- package/examples/quickstart/layer4/html/index.html +17 -0
- package/examples/quickstart/layer4/package-lock.json +13206 -0
- package/examples/quickstart/layer4/package.json +38 -0
- package/examples/quickstart/layer4/server.js +28 -0
- package/examples/quickstart/layer4/source/BookStore-Application-Config.json +15 -0
- package/examples/quickstart/layer4/source/BookStore-Application.js +54 -0
- package/examples/quickstart/layer4/source/providers/Router-Config.json +18 -0
- package/examples/quickstart/layer4/source/views/View-About.js +38 -0
- package/examples/quickstart/layer4/source/views/View-Home.js +50 -0
- package/examples/quickstart/layer4/source/views/View-Layout.js +60 -0
- package/examples/quickstart/layer5/README.md +26 -0
- package/examples/quickstart/layer5/index.js +121 -0
- package/examples/quickstart/layer5/package-lock.json +345 -0
- package/examples/quickstart/layer5/package.json +13 -0
- package/modules/.claude/settings.local.json +52 -0
- package/modules/CLAUDE.md +60 -0
- package/modules/Checkout.sh +42 -0
- package/modules/Include-Retold-Module-List.sh +15 -0
- package/modules/Retold-Modules.md +24 -0
- package/modules/Status.sh +59 -0
- package/modules/Update.sh +45 -0
- package/modules/fable/Fable.md +2 -0
- package/modules/meadow/Meadow.md +1 -0
- package/modules/orator/Orator.md +1 -0
- package/modules/pict/Pict.md +1 -0
- package/package.json +30 -35
- package/source/Retold.cjs +2 -0
- package/test/Retold_tests.js +23 -41
- package/.travis.yml +0 -13
- package/source/Retold-Meadow-Macros.js +0 -269
- package/source/Retold.js +0 -48
package/docs/pict.md
ADDED
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
# Pict — MVC Tools
|
|
2
|
+
|
|
3
|
+
Pict provides a non-opinionated set of Model-View-Controller tools for building user interfaces. Its core insight: UI is text. Whether you are rendering to a browser DOM, a terminal, or generating strings for another system, Pict treats the output as rendered text and gives you a consistent set of tools for managing views, templates, data, and application lifecycle.
|
|
4
|
+
|
|
5
|
+
## Design Philosophy
|
|
6
|
+
|
|
7
|
+
Pict does not impose opinions about what MVC means. It provides discrete tools — Views, Templates, Providers, and an Application class — that you can use individually or compose together.
|
|
8
|
+
|
|
9
|
+
- **Views** manage lifecycle (initialize, render, marshal data) and render templates into target containers
|
|
10
|
+
- **Templates** are text with expressions that resolve against application state
|
|
11
|
+
- **Providers** fetch and manage data for views
|
|
12
|
+
- **The Application class** coordinates view lifecycle and shared state
|
|
13
|
+
|
|
14
|
+
```mermaid
|
|
15
|
+
graph TB
|
|
16
|
+
subgraph PictApp["Pict Application"]
|
|
17
|
+
appdata["Application State (AppData)"]
|
|
18
|
+
appdata --> viewA["View A"]
|
|
19
|
+
appdata --> viewB["View B"]
|
|
20
|
+
appdata --> viewC["View C"]
|
|
21
|
+
viewA <--> viewB <--> viewC
|
|
22
|
+
viewA --> tplA["Templates"] --> outA["Rendered Output"]
|
|
23
|
+
viewB --> tplB["Templates"] --> outB["Rendered Output"]
|
|
24
|
+
viewC --> tplC["Templates"] --> outC["Rendered Output"]
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
style PictApp fill:#f3e5f5,stroke:#ab47bc,color:#333
|
|
28
|
+
style appdata fill:#e1bee7,stroke:#ab47bc,color:#333
|
|
29
|
+
style viewA fill:#fff,stroke:#ce93d8,color:#333
|
|
30
|
+
style viewB fill:#fff,stroke:#ce93d8,color:#333
|
|
31
|
+
style viewC fill:#fff,stroke:#ce93d8,color:#333
|
|
32
|
+
style tplA fill:#f5f5f5,stroke:#bdbdbd,color:#666
|
|
33
|
+
style tplB fill:#f5f5f5,stroke:#bdbdbd,color:#666
|
|
34
|
+
style tplC fill:#f5f5f5,stroke:#bdbdbd,color:#666
|
|
35
|
+
style outA fill:#e8f5e9,stroke:#66bb6a,color:#666
|
|
36
|
+
style outB fill:#e8f5e9,stroke:#66bb6a,color:#666
|
|
37
|
+
style outC fill:#e8f5e9,stroke:#66bb6a,color:#666
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Core Modules
|
|
41
|
+
|
|
42
|
+
### [Pict](/pict/pict/)
|
|
43
|
+
|
|
44
|
+
The main module. Creates the application context, manages template and view registries, provides the template expression engine, and coordinates rendering.
|
|
45
|
+
|
|
46
|
+
```javascript
|
|
47
|
+
const libPict = require('pict');
|
|
48
|
+
|
|
49
|
+
let _Pict = new libPict({
|
|
50
|
+
Product: 'MyApp',
|
|
51
|
+
DefaultRenderable: true
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// Register a template
|
|
55
|
+
_Pict.TemplateProvider.addTemplate('HelloTemplate',
|
|
56
|
+
'<h1>Hello {~Data:Record.Name~}!</h1>');
|
|
57
|
+
|
|
58
|
+
// Set some data
|
|
59
|
+
_Pict.AppData.Record = { Name: 'World' };
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**Template expressions** use the `{~ ~}` syntax to resolve data, call templates, invoke providers, and perform logic:
|
|
63
|
+
|
|
64
|
+
| Expression | Purpose | Example |
|
|
65
|
+
|-----------|---------|---------|
|
|
66
|
+
| `{~Data:Path~}` | Resolve data from AppData | `{~Data:Record.Name~}` |
|
|
67
|
+
| `{~Template:Name~}` | Render another template | `{~Template:Header~}` |
|
|
68
|
+
| `{~Each:Array:Template~}` | Iterate and render | `{~Each:Records:RowTemplate~}` |
|
|
69
|
+
| `{~If:Condition~}` | Conditional rendering | `{~If:Record.Active~}` |
|
|
70
|
+
|
|
71
|
+
**npm:** `pict` · **Version:** 1.0.x
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
### [Pict-View](/pict/pict-view/)
|
|
76
|
+
|
|
77
|
+
The View base class. Views manage a complete lifecycle — initialization, rendering, data marshaling (two-way binding), CSS injection, and teardown.
|
|
78
|
+
|
|
79
|
+
```javascript
|
|
80
|
+
const libPictView = require('pict-view');
|
|
81
|
+
|
|
82
|
+
class MyView extends libPictView
|
|
83
|
+
{
|
|
84
|
+
constructor(pFable, pOptions, pServiceHash)
|
|
85
|
+
{
|
|
86
|
+
super(pFable, pOptions, pServiceHash);
|
|
87
|
+
this.serviceType = 'MyView';
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
onBeforeRender()
|
|
91
|
+
{
|
|
92
|
+
this.log.info('About to render');
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
onAfterMarshalFromView()
|
|
96
|
+
{
|
|
97
|
+
// Data has been pulled from the DOM back into AppData
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**View lifecycle:** Initialize → Render → Solve → Marshal From View → Marshal To View
|
|
103
|
+
|
|
104
|
+
**npm:** `pict-view` · **Version:** 1.0.x
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
### [Pict-Template](/pict/pict-template/)
|
|
109
|
+
|
|
110
|
+
Base class for custom template handlers. Extend this to add new template expression types beyond the built-in set.
|
|
111
|
+
|
|
112
|
+
**npm:** `pict-template` · **Version:** 1.0.x
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
### [Pict-Provider](/pict/pict-provider/)
|
|
117
|
+
|
|
118
|
+
Base class for data providers. Providers fetch, transform, and deliver data to views.
|
|
119
|
+
|
|
120
|
+
**npm:** `pict-provider` · **Version:** 1.0.x
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
### [Pict-Application](/pict/pict-application/)
|
|
125
|
+
|
|
126
|
+
Application base class that coordinates multiple views, manages shared state, and provides structured lifecycle management for complete applications.
|
|
127
|
+
|
|
128
|
+
```javascript
|
|
129
|
+
const libPictApplication = require('pict-application');
|
|
130
|
+
|
|
131
|
+
class MyApp extends libPictApplication
|
|
132
|
+
{
|
|
133
|
+
constructor(pFable, pOptions, pServiceHash)
|
|
134
|
+
{
|
|
135
|
+
super(pFable, pOptions, pServiceHash);
|
|
136
|
+
this.serviceType = 'MyApp';
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
onAfterInitialize()
|
|
140
|
+
{
|
|
141
|
+
// Register views, load data, start rendering
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
**npm:** `pict-application` · **Version:** 1.0.x
|
|
147
|
+
|
|
148
|
+
## Section Modules
|
|
149
|
+
|
|
150
|
+
Sections are pre-built view patterns for common UI needs.
|
|
151
|
+
|
|
152
|
+
### [Pict-Section-Form](/pict/pict-section-form/)
|
|
153
|
+
|
|
154
|
+
Configuration-driven dynamic forms. Define form layout, fields, validation, and data binding in JSON — the section handles rendering, data marshaling, and mathematical solving.
|
|
155
|
+
|
|
156
|
+
Supports 13+ input types with custom providers for each. Used extensively for building data entry interfaces without writing HTML by hand.
|
|
157
|
+
|
|
158
|
+
**npm:** `pict-section-form` · **Version:** 1.0.x
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
### [Pict-Section-Recordset](/pict/pict-section-recordset/)
|
|
163
|
+
|
|
164
|
+
CRUD views (Create, Read, Update, Delete) based on Meadow endpoint schemas. Provides list views, detail views, and record management with data provider integration.
|
|
165
|
+
|
|
166
|
+
**npm:** `pict-section-recordset` · **Version:** 1.0.x
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
### [Pict-Section-TUIGrid](/pict/pict-section-tuigrid/)
|
|
171
|
+
|
|
172
|
+
Toast UI Grid integration for tabular data display. Provides spreadsheet-like data grids with sorting, filtering, and editing.
|
|
173
|
+
|
|
174
|
+
**npm:** `pict-section-tuigrid` · **Version:** 1.0.x
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
### [Pict-Section-Content](/pict/pict-section-content/)
|
|
179
|
+
|
|
180
|
+
Content display sections for rendering static or dynamic content blocks.
|
|
181
|
+
|
|
182
|
+
**npm:** `pict-section-content`
|
|
183
|
+
|
|
184
|
+
## Supporting Modules
|
|
185
|
+
|
|
186
|
+
| Module | Purpose | npm |
|
|
187
|
+
|--------|---------|-----|
|
|
188
|
+
| [pict-router](/pict/pict-router/) | Hash-based URL routing via Navigo with template string route functions | `pict-router` |
|
|
189
|
+
| [pict-panel](/pict/pict-panel/) | Control panel component, hot-loadable from CDN | `pict-panel` |
|
|
190
|
+
| [informary](/pict/informary/) | Dependency-free browser form marshaling with undo/redo and field-level deltas | `informary` |
|
|
191
|
+
| [cryptbrau](/pict/cryptbrau/) | Simple in-browser symmetric encryption | `cryptbrau` |
|
|
192
|
+
| [pict-serviceproviderbase](/pict/pict-serviceproviderbase/) | Base classes for Pict services with pre-initialization support | `pict-serviceproviderbase` |
|
|
193
|
+
| [pict-service-commandlineutility](/pict/pict-service-commandlineutility/) | CLI utility tools built on Commander | `pict-service-commandlineutility` |
|
|
194
|
+
|
|
195
|
+
## All Pict Modules
|
|
196
|
+
|
|
197
|
+
| Module | Description |
|
|
198
|
+
|--------|-------------|
|
|
199
|
+
| [pict](/pict/pict/) | Core MVC module with template engine |
|
|
200
|
+
| [pict-view](/pict/pict-view/) | View base class with full lifecycle |
|
|
201
|
+
| [pict-template](/pict/pict-template/) | Custom template handler base class |
|
|
202
|
+
| [pict-provider](/pict/pict-provider/) | Data provider base class |
|
|
203
|
+
| [pict-application](/pict/pict-application/) | Application lifecycle management |
|
|
204
|
+
| [pict-section-form](/pict/pict-section-form/) | Configuration-driven dynamic forms |
|
|
205
|
+
| [pict-section-recordset](/pict/pict-section-recordset/) | CRUD record management views |
|
|
206
|
+
| [pict-section-tuigrid](/pict/pict-section-tuigrid/) | Toast UI Grid tabular data |
|
|
207
|
+
| [pict-section-content](/pict/pict-section-content/) | Content display sections |
|
|
208
|
+
| [pict-panel](/pict/pict-panel/) | Hot-loadable control panel |
|
|
209
|
+
| [pict-router](/pict/pict-router/) | Hash-based URL routing |
|
|
210
|
+
| [informary](/pict/informary/) | Browser form marshaling with undo/redo |
|
|
211
|
+
| [cryptbrau](/pict/cryptbrau/) | In-browser symmetric encryption |
|
|
212
|
+
| [pict-serviceproviderbase](/pict/pict-serviceproviderbase/) | Pict service base classes |
|
|
213
|
+
| [pict-service-commandlineutility](/pict/pict-service-commandlineutility/) | CLI utility tools |
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Building and Maintaining the Retold Documentation
|
|
2
|
+
|
|
3
|
+
The Retold documentation is powered by [pict-docuserve](https://github.com/stevenvelozo/pict-docuserve), a single-page documentation viewer built on the Pict MVC framework. The catalog and keyword search index are generated by [indoctrinate](https://github.com/stevenvelozo/indoctrinate).
|
|
4
|
+
|
|
5
|
+
## Serving Locally
|
|
6
|
+
|
|
7
|
+
```shell
|
|
8
|
+
npm run serve-docs
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
This starts a local HTTP server at `http://127.0.0.1:3333`.
|
|
12
|
+
|
|
13
|
+
## Rebuilding the Catalog and Search Index
|
|
14
|
+
|
|
15
|
+
When the module structure changes (a new module is added, a sidebar is reorganized, etc.):
|
|
16
|
+
|
|
17
|
+
```shell
|
|
18
|
+
npm run build-docs
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
This runs `npx quack prepare-docs ./docs -d ./modules` which:
|
|
22
|
+
|
|
23
|
+
1. Generates `retold-catalog.json` from the module directory tree
|
|
24
|
+
2. Generates `retold-keyword-index.json` with a Lunr full-text search index
|
|
25
|
+
3. Injects pict-docuserve assets (index.html, JS bundle, CSS) into `docs/`
|
|
26
|
+
|
|
27
|
+
Commit the updated files to the repository.
|
|
28
|
+
|
|
29
|
+
## Individual Package Content has Changed
|
|
30
|
+
|
|
31
|
+
When the content of an individual package changes (a markdown file is edited, a new doc is added, etc.) there is nothing to do for the live site. Module documentation is fetched from `raw.githubusercontent.com` as the user navigates.
|
|
32
|
+
|
|
33
|
+
To update the search index to include new content, re-run `npm run build-docs`.
|