retold 4.0.4 → 4.0.7
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/launch.json +29 -0
- package/.claude/settings.local.json +60 -2
- package/CLAUDE.md +4 -2
- package/README.md +4 -2
- package/Retold-Modules-Manifest.json +576 -0
- package/docs/README.md +7 -1
- package/docs/{cover.md → _cover.md} +1 -1
- package/docs/_sidebar.md +30 -3
- package/docs/architecture/architecture.md +5 -2
- package/docs/architecture/dependencies/_generate-graph.js +186 -0
- package/docs/architecture/dependencies/_generate-svg.js +364 -0
- package/docs/architecture/dependencies/in-ecosystem-dependency-graph-generation.md +97 -0
- package/docs/architecture/dependencies/in-ecosystem-dependency-graph.json +3168 -0
- package/docs/architecture/dependencies/in-ecosystem-dependency-graph.md +221 -0
- package/docs/architecture/dependencies/in-ecosystem-dependency-graph.svg +664 -0
- package/docs/architecture/documentation-style-guide.md +65 -0
- package/docs/architecture/example-app-style-guide.md +154 -0
- package/docs/architecture/modules.md +17 -5
- package/docs/architecture/templating/data-access.md +196 -0
- package/docs/architecture/templating/data-formatting.md +350 -0
- package/docs/architecture/templating/data-generation.md +72 -0
- package/docs/architecture/templating/debugging.md +181 -0
- package/docs/architecture/templating/entity.md +99 -0
- package/docs/architecture/templating/iteration.md +170 -0
- package/docs/architecture/templating/jellyfish-deep-dive.md +271 -0
- package/docs/architecture/templating/jellyfish-templates.md +476 -0
- package/docs/architecture/templating/logic.md +185 -0
- package/docs/architecture/templating/ref-breakpoint.md +38 -0
- package/docs/architecture/templating/ref-data.md +51 -0
- package/docs/architecture/templating/ref-dateonlyformat.md +43 -0
- package/docs/architecture/templating/ref-dateonlyymd.md +39 -0
- package/docs/architecture/templating/ref-datetimeformat.md +59 -0
- package/docs/architecture/templating/ref-datetimeymd.md +44 -0
- package/docs/architecture/templating/ref-dejs.md +42 -0
- package/docs/architecture/templating/ref-digits.md +36 -0
- package/docs/architecture/templating/ref-dj.md +50 -0
- package/docs/architecture/templating/ref-dollars.md +36 -0
- package/docs/architecture/templating/ref-dt.md +38 -0
- package/docs/architecture/templating/ref-dvbk.md +46 -0
- package/docs/architecture/templating/ref-dwaf.md +45 -0
- package/docs/architecture/templating/ref-dwtf.md +45 -0
- package/docs/architecture/templating/ref-entity.md +47 -0
- package/docs/architecture/templating/ref-hce.md +29 -0
- package/docs/architecture/templating/ref-hcs.md +38 -0
- package/docs/architecture/templating/ref-join.md +45 -0
- package/docs/architecture/templating/ref-joinunique.md +34 -0
- package/docs/architecture/templating/ref-ls.md +37 -0
- package/docs/architecture/templating/ref-lv.md +38 -0
- package/docs/architecture/templating/ref-lvt.md +33 -0
- package/docs/architecture/templating/ref-ne.md +40 -0
- package/docs/architecture/templating/ref-pascalcaseidentifier.md +41 -0
- package/docs/architecture/templating/ref-pict.md +42 -0
- package/docs/architecture/templating/ref-pluckjoinunique.md +39 -0
- package/docs/architecture/templating/ref-rn.md +35 -0
- package/docs/architecture/templating/ref-rns.md +35 -0
- package/docs/architecture/templating/ref-sbr.md +36 -0
- package/docs/architecture/templating/ref-solve.md +46 -0
- package/docs/architecture/templating/ref-tbda.md +41 -0
- package/docs/architecture/templating/ref-tbr.md +43 -0
- package/docs/architecture/templating/ref-tbt.md +46 -0
- package/docs/architecture/templating/ref-template.md +40 -0
- package/docs/architecture/templating/ref-tfa.md +32 -0
- package/docs/architecture/templating/ref-tfm.md +43 -0
- package/docs/architecture/templating/ref-tif.md +45 -0
- package/docs/architecture/templating/ref-tifabs.md +41 -0
- package/docs/architecture/templating/ref-ts.md +41 -0
- package/docs/architecture/templating/ref-tsfm.md +42 -0
- package/docs/architecture/templating/ref-tswp.md +45 -0
- package/docs/architecture/templating/ref-tvs.md +48 -0
- package/docs/architecture/templating/ref-view.md +40 -0
- package/docs/architecture/templating/ref-vrs.md +39 -0
- package/docs/architecture/templating/solvers.md +153 -0
- package/docs/architecture/templating/template-composition.md +196 -0
- package/docs/architecture/templating/template-expressions.md +217 -0
- package/docs/architecture/templating/views.md +154 -0
- package/docs/examples/todolist/todo-list.md +1 -1
- package/docs/modules/apps.md +26 -0
- package/docs/modules/pict.md +18 -0
- package/docs/modules/utility.md +23 -1
- package/docs/retold-catalog.json +829 -102
- package/docs/retold-keyword-index.json +195212 -115957
- package/modules/CLAUDE.md +1 -0
- package/modules/Checkout.sh +1 -0
- package/modules/Diff.sh +86 -0
- package/modules/Include-Retold-Module-List.sh +4 -2
- package/modules/Status.sh +1 -0
- package/modules/Update.sh +1 -0
- package/modules/apps/Apps.md +1 -0
- package/modules/utility/Utility.md +1 -0
- package/package.json +9 -11
- package/docs/retold-building-documentation.md +0 -33
- package/modules/Retold-Modules.md +0 -24
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Retold Documentation Style Guide
|
|
2
|
+
|
|
3
|
+
Style conventions for writing documentation within the Retold ecosystem. These apply to markdown files served through pict-docuserve in the `/docs/` directory.
|
|
4
|
+
|
|
5
|
+
## Routing and Links
|
|
6
|
+
|
|
7
|
+
Retold documentation uses **pict-docuserve** with hash-based routing, not standard docsify.
|
|
8
|
+
|
|
9
|
+
- **Local page links:** `#/page/<path>` (e.g., `#/page/architecture/architecture.md`)
|
|
10
|
+
- **Module doc links:** `#/doc/<group>/<module>` (e.g., `#/doc/pict/pict-section-form`)
|
|
11
|
+
- **Links in subdirectory `.md` files** must use absolute paths from the docs root (no relative path resolution for `#/page/` routes)
|
|
12
|
+
- **Anchor fragments** (`#heading-slug`) are not supported in cross-file links — do not use them
|
|
13
|
+
|
|
14
|
+
## Markdown Conventions
|
|
15
|
+
|
|
16
|
+
### Headings
|
|
17
|
+
|
|
18
|
+
- Use `#` for the page title (one per file)
|
|
19
|
+
- Use `##` for major sections
|
|
20
|
+
- Use `###` for subsections
|
|
21
|
+
- Do not skip heading levels
|
|
22
|
+
|
|
23
|
+
### Code Blocks
|
|
24
|
+
|
|
25
|
+
- Always specify the language for syntax highlighting
|
|
26
|
+
- Use `javascript` (not `js`) for JavaScript blocks
|
|
27
|
+
- Use `html` for HTML blocks
|
|
28
|
+
- Use `bash` or `shell` for terminal commands
|
|
29
|
+
|
|
30
|
+
### Module References
|
|
31
|
+
|
|
32
|
+
When referencing a Retold module, link to its documentation:
|
|
33
|
+
|
|
34
|
+
```markdown
|
|
35
|
+
See [pict-section-form](#/doc/pict/pict-section-form) for details.
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Tone
|
|
39
|
+
|
|
40
|
+
- Write in plain, direct language
|
|
41
|
+
- Prefer active voice
|
|
42
|
+
- Keep paragraphs short — aim for 2–4 sentences
|
|
43
|
+
- Lead with the most important information
|
|
44
|
+
|
|
45
|
+
## File Organization
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
docs/
|
|
49
|
+
├── _sidebar.md # Navigation sidebar
|
|
50
|
+
├── _topbar.md # Top navigation bar
|
|
51
|
+
├── README.md # Landing page
|
|
52
|
+
├── architecture/ # Architecture and design docs
|
|
53
|
+
├── modules/ # Module group overview pages
|
|
54
|
+
├── examples/ # Example walkthroughs
|
|
55
|
+
└── css/ # Custom stylesheets
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Navigation
|
|
59
|
+
|
|
60
|
+
The sidebar is defined in `_sidebar.md`. When adding new pages:
|
|
61
|
+
|
|
62
|
+
1. Add the markdown file to the appropriate directory
|
|
63
|
+
2. Add an entry in `_sidebar.md` under the correct section
|
|
64
|
+
3. Use the `.md` extension in sidebar links for local pages
|
|
65
|
+
4. Module links use the `/group/module/` format (no `.md`)
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# Pict Example App Style Guide
|
|
2
|
+
|
|
3
|
+
## Red Rock Mesa Theme
|
|
4
|
+
|
|
5
|
+
All Pict example applications use the **Red Rock Mesa** theme — a southwest-inspired design that makes it immediately obvious you are looking at a Pict example app.
|
|
6
|
+
|
|
7
|
+
The theme is named for the Sedona red rock and Monument Valley landscape: deep sky teal headers, sienna accents, sandstone borders, and pale desert backgrounds.
|
|
8
|
+
|
|
9
|
+
## Color Palette
|
|
10
|
+
|
|
11
|
+
| Role | Color | Hex |
|
|
12
|
+
|------|-------|-----|
|
|
13
|
+
| **Deep Sky Teal** | Header background, table headers, headings | `#264653` |
|
|
14
|
+
| **Red Rock** | Emphasis, alternate accent | `#B33030` |
|
|
15
|
+
| **Sienna** | Primary accent, buttons, top borders, badge | `#E76F51` |
|
|
16
|
+
| **Sienna Hover** | Button hover state | `#C45A3E` |
|
|
17
|
+
| **Sandstone** | Borders, secondary headings | `#D4A373` |
|
|
18
|
+
| **Pale Desert** | Page background, header text | `#FAEDCD` |
|
|
19
|
+
| **Warm White** | Form container backgrounds | `#fff` |
|
|
20
|
+
| **Desert Off-White** | Input backgrounds | `#FFFCF7` |
|
|
21
|
+
| **Input Border** | Default input/textarea borders | `#D4C4A8` |
|
|
22
|
+
| **Table Row Stripe** | Even row background | `#FFF9F0` |
|
|
23
|
+
| **Table Row Border** | Cell bottom border | `#E8D9C0` |
|
|
24
|
+
| **Shadow** | Container box-shadow | `rgba(38,70,83,0.08)` |
|
|
25
|
+
|
|
26
|
+
## Standard Header
|
|
27
|
+
|
|
28
|
+
Every example app includes a header bar with three elements:
|
|
29
|
+
|
|
30
|
+
```html
|
|
31
|
+
<div class="pict-example-header">
|
|
32
|
+
<div class="pict-example-badge">
|
|
33
|
+
<svg viewBox="0 0 16 16"><polygon points="8,1 10,6 16,6 11,9.5 13,15 8,11.5 3,15 5,9.5 0,6 6,6"/></svg>
|
|
34
|
+
Pict Example
|
|
35
|
+
</div>
|
|
36
|
+
<div class="pict-example-app-name">Your App Name</div>
|
|
37
|
+
<div class="pict-example-module">pict-section-form</div>
|
|
38
|
+
</div>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
- **Badge** (left): Sienna background with star icon and "PICT EXAMPLE" text — identifies this as a Pict example
|
|
42
|
+
- **App Name** (center-left): The specific example application name in pale desert text
|
|
43
|
+
- **Module Name** (right): The source module name in sandstone text, pushed to the far right
|
|
44
|
+
|
|
45
|
+
## Page Structure
|
|
46
|
+
|
|
47
|
+
```html
|
|
48
|
+
<body>
|
|
49
|
+
<!-- 1. Header bar -->
|
|
50
|
+
<div class="pict-example-header">...</div>
|
|
51
|
+
|
|
52
|
+
<!-- 2. Content wrapper -->
|
|
53
|
+
<div class="pict-example-content">
|
|
54
|
+
<!-- 3. Optional action bar -->
|
|
55
|
+
<div class="pict-example-actions">
|
|
56
|
+
<button>Action</button>
|
|
57
|
+
</div>
|
|
58
|
+
<!-- 4. Form container (Pict renders into this) -->
|
|
59
|
+
<div id="Pict-Form-Container"></div>
|
|
60
|
+
</div>
|
|
61
|
+
</body>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
The content area has `1.5rem` padding and spans the full browser width — no max-width constraint, so wide tables and grids are usable at any viewport size.
|
|
65
|
+
|
|
66
|
+
## Form Container
|
|
67
|
+
|
|
68
|
+
The main form container has:
|
|
69
|
+
|
|
70
|
+
- White background
|
|
71
|
+
- Sandstone (`#D4A373`) border
|
|
72
|
+
- **4px sienna top border** — the signature accent
|
|
73
|
+
- 6px border radius
|
|
74
|
+
- Subtle box shadow
|
|
75
|
+
|
|
76
|
+
```css
|
|
77
|
+
#Pict-Form-Container {
|
|
78
|
+
background: #fff;
|
|
79
|
+
border: 1px solid #D4A373;
|
|
80
|
+
border-top: 4px solid #E76F51;
|
|
81
|
+
border-radius: 6px;
|
|
82
|
+
padding: 1.25rem;
|
|
83
|
+
box-shadow: 0 2px 8px rgba(38,70,83,0.08);
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Form Elements
|
|
88
|
+
|
|
89
|
+
### Inputs and Selects
|
|
90
|
+
|
|
91
|
+
All text inputs, number inputs, textareas, and selects get:
|
|
92
|
+
|
|
93
|
+
- `1px solid #D4C4A8` border
|
|
94
|
+
- `#FFFCF7` background (warm off-white)
|
|
95
|
+
- `0.45rem 0.6rem` padding
|
|
96
|
+
- `4px` border radius
|
|
97
|
+
- On focus: sienna border with subtle sienna glow (`box-shadow: 0 0 0 2px rgba(231,111,81,0.15)`)
|
|
98
|
+
|
|
99
|
+
### Labels
|
|
100
|
+
|
|
101
|
+
- Deep sky teal (`#264653`)
|
|
102
|
+
- `font-weight: 600`
|
|
103
|
+
- `0.85rem` font size
|
|
104
|
+
|
|
105
|
+
### Buttons
|
|
106
|
+
|
|
107
|
+
Primary buttons use sienna:
|
|
108
|
+
|
|
109
|
+
```css
|
|
110
|
+
background: #E76F51;
|
|
111
|
+
color: #fff;
|
|
112
|
+
border: none;
|
|
113
|
+
padding: 0.5rem 1.25rem;
|
|
114
|
+
border-radius: 4px;
|
|
115
|
+
font-weight: 600;
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Secondary/action buttons use deep sky teal:
|
|
119
|
+
|
|
120
|
+
```css
|
|
121
|
+
background: #264653;
|
|
122
|
+
color: #FAEDCD;
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Tables
|
|
126
|
+
|
|
127
|
+
- Header row: deep sky teal background with pale desert text
|
|
128
|
+
- Cell borders: `1px solid #E8D9C0`
|
|
129
|
+
- Even rows: `#FFF9F0` background (subtle stripe)
|
|
130
|
+
|
|
131
|
+
## Implementation Notes
|
|
132
|
+
|
|
133
|
+
- **All CSS is inline** within `<style>` tags in each HTML file — no external CSS framework dependencies
|
|
134
|
+
- The `<style id="PICT-CSS"></style>` tag must remain present for Pict's dynamic CSS injection
|
|
135
|
+
- Theme CSS should come **after** the PICT-CSS tag so it can override dynamic styles if needed
|
|
136
|
+
- Use the `box-sizing: border-box` reset on all elements
|
|
137
|
+
- Font stack: `-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif`
|
|
138
|
+
|
|
139
|
+
## Adding a New Example
|
|
140
|
+
|
|
141
|
+
When creating a new example application:
|
|
142
|
+
|
|
143
|
+
1. Copy the HTML structure from any existing themed example (e.g., `simple_form`)
|
|
144
|
+
2. Update the `<title>` tag: `Your App Name - Pict Example`
|
|
145
|
+
3. Update the header app name: `<div class="pict-example-app-name">Your App Name</div>`
|
|
146
|
+
4. Update the module name if it differs from `pict-section-form`
|
|
147
|
+
5. Keep all theme CSS intact — the inline styles are self-contained
|
|
148
|
+
6. Add any app-specific CSS **after** the theme block with a comment separator
|
|
149
|
+
|
|
150
|
+
## Exceptions
|
|
151
|
+
|
|
152
|
+
- The **postcard_example** (`Das Postkard`) has its own distinct styling with Pure CSS and a sidebar navigation — it is excluded from the standard theme
|
|
153
|
+
- Apps using third-party component CSS (TUI Grid, JSON Editor, etc.) should load those stylesheets **before** the theme `<style>` block so the theme can override as needed
|
|
154
|
+
- The `complex_table` example preserves custom `.HasFancyHeaders` styles, adapted to use theme-compatible colors
|
|
@@ -41,7 +41,7 @@ An exhaustive list of every repository in the Retold suite, organized by group.
|
|
|
41
41
|
| [tidings](/orator/tidings/) | `tidings` | Extensible reporting system for generating HTML, PDF, and other format reports |
|
|
42
42
|
| [orator-conversion](/orator/orator-conversion/) | `orator-conversion` | File format conversion endpoints for Orator service servers |
|
|
43
43
|
|
|
44
|
-
## Pict — MVC Tools (
|
|
44
|
+
## Pict — MVC Tools (20 modules)
|
|
45
45
|
|
|
46
46
|
| Module | npm | Description |
|
|
47
47
|
|--------|-----|-------------|
|
|
@@ -60,20 +60,31 @@ An exhaustive list of every repository in the Retold suite, organized by group.
|
|
|
60
60
|
| [pict-section-recordset](/pict/pict-section-recordset/) | `pict-section-recordset` | CRUD record management views from Meadow endpoint schemas |
|
|
61
61
|
| [pict-section-content](/pict/pict-section-content/) | `pict-section-content` | Markdown parsing and content rendering with Mermaid diagrams and KaTeX math |
|
|
62
62
|
| [pict-section-form](/pict/pict-section-form/) | `pict-section-form` | Configuration-driven dynamic forms with 13+ input types and data marshaling |
|
|
63
|
+
| [pict-section-objecteditor](/pict/pict-section-objecteditor/) | `pict-section-objecteditor` | Tree-based JSON object editor section for Pict views |
|
|
63
64
|
| [pict-section-tuigrid](/pict/pict-section-tuigrid/) | `pict-section-tuigrid` | Toast UI Grid integration for tabular data display and editing |
|
|
65
|
+
| [pict-section-markdowneditor](/pict/pict-section-markdowneditor/) | `pict-section-markdowneditor` | Segmented markdown editor built on CodeMirror v6 with rich previews |
|
|
64
66
|
| [pict-router](/pict/pict-router/) | `pict-router` | Hash-based URL routing via Navigo with template string route functions |
|
|
65
67
|
| [pict-serviceproviderbase](/pict/pict-serviceproviderbase/) | `pict-serviceproviderbase` | Base classes for Pict services with pre-initialization support |
|
|
66
68
|
| [pict-terminalui](/pict/pict-terminalui/) | `pict-terminalui` | Blessed-based terminal interface for Pict views |
|
|
67
69
|
|
|
68
|
-
## Utility — Build & Documentation Tools (
|
|
70
|
+
## Utility — Build & Documentation Tools (6 modules)
|
|
69
71
|
|
|
70
72
|
| Module | npm | Description |
|
|
71
73
|
|--------|-----|-------------|
|
|
74
|
+
| [cachetrax](/utility/cachetrax/) | `cachetrax` | Hash-indexed object cache with O(1) lookups, time and size based expiration, and custom pruning |
|
|
72
75
|
| [indoctrinate](/utility/indoctrinate/) | `indoctrinate` | Documentation scaffolding with content cataloging, label-based filtering, and multi-format output |
|
|
73
76
|
| [manyfest](/utility/manyfest/) | `manyfest` | JSON manifest for consistent data description, validation, and address-based access across layers |
|
|
77
|
+
| [precedent](/utility/precedent/) | `precedent` | Meta-templating engine with pattern-based start/end markers and word tree matching |
|
|
74
78
|
| [quackage](/utility/quackage/) | `quackage` | Standardized build tool for browser bundles, transpilation, testing, and packaging |
|
|
75
79
|
| [ultravisor](/utility/ultravisor/) | `ultravisor` | Process supervision with scheduled tasks, distributed nodes, and LLM integration |
|
|
76
80
|
|
|
81
|
+
## Apps — Applications (2 modules)
|
|
82
|
+
|
|
83
|
+
| Module | npm | Description |
|
|
84
|
+
|--------|-----|-------------|
|
|
85
|
+
| [retold-content-system](/apps/retold-content-system/) | `retold-content-system` | Content management system built on the Retold ecosystem |
|
|
86
|
+
| [retold-remote](/apps/retold-remote/) | `retold-remote` | Remote access application built on the Retold ecosystem |
|
|
87
|
+
|
|
77
88
|
## Summary
|
|
78
89
|
|
|
79
90
|
| Group | Count | Focus |
|
|
@@ -81,9 +92,10 @@ An exhaustive list of every repository in the Retold suite, organized by group.
|
|
|
81
92
|
| Fable | 6 | Core ecosystem, DI, configuration, logging |
|
|
82
93
|
| Meadow | 12 | Data access, ORM, query DSL, schema, connectors |
|
|
83
94
|
| Orator | 6 | API server, HTTP, static files, proxy, reporting, conversion |
|
|
84
|
-
| Pict |
|
|
85
|
-
| Utility |
|
|
86
|
-
|
|
|
95
|
+
| Pict | 20 | MVC, views, templates, forms, grids, routing, docs, TUI |
|
|
96
|
+
| Utility | 6 | Build tools, caching, templating, manifests, docs, process supervision |
|
|
97
|
+
| Apps | 2 | Full-stack applications built on Retold |
|
|
98
|
+
| **Total** | **52** | |
|
|
87
99
|
|
|
88
100
|
## GitHub Repositories
|
|
89
101
|
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
# Data Access Expressions
|
|
2
|
+
|
|
3
|
+
Data access expressions resolve values from Pict's address space and return them as strings. These are the most frequently used expressions in Jellyfish templates.
|
|
4
|
+
|
|
5
|
+
## Data (D)
|
|
6
|
+
|
|
7
|
+
Resolves a value from the address space and returns it as a string.
|
|
8
|
+
|
|
9
|
+
**Tags:** `{~Data:ADDRESS~}` `{~D:ADDRESS~}`
|
|
10
|
+
|
|
11
|
+
**Parameters:**
|
|
12
|
+
|
|
13
|
+
| Parameter | Description |
|
|
14
|
+
|-----------|-------------|
|
|
15
|
+
| ADDRESS | Dot-notation path to resolve (e.g., `AppData.User.Name`, `Record.Title`) |
|
|
16
|
+
|
|
17
|
+
**Examples:**
|
|
18
|
+
|
|
19
|
+
```html
|
|
20
|
+
<h1>{~D:AppData.PageTitle~}</h1>
|
|
21
|
+
<p>Author: {~D:Record.Author~}</p>
|
|
22
|
+
<span>{~D:Bundle.Config.Version~}</span>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
```javascript
|
|
26
|
+
_Pict.AppData.User = { Name: 'Alice' };
|
|
27
|
+
_Pict.parseTemplate('Hello, {~D:AppData.User.Name~}!');
|
|
28
|
+
// 'Hello, Alice!'
|
|
29
|
+
|
|
30
|
+
_Pict.parseTemplate('{~D:Record.City~}', { City: 'Portland' });
|
|
31
|
+
// 'Portland'
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
If the address resolves to `undefined`, returns an empty string.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## DataWithTemplateFallback (DWTF)
|
|
39
|
+
|
|
40
|
+
Resolves a value from the address space. If the value is falsy or undefined, renders a fallback template by hash instead.
|
|
41
|
+
|
|
42
|
+
**Tags:** `{~DataWithTemplateFallback:DATA_ADDRESS:FALLBACK_TEMPLATE_HASH~}` `{~DWTF:DATA_ADDRESS:FALLBACK_TEMPLATE_HASH~}`
|
|
43
|
+
|
|
44
|
+
**Parameters:**
|
|
45
|
+
|
|
46
|
+
| Parameter | Description |
|
|
47
|
+
|-----------|-------------|
|
|
48
|
+
| DATA_ADDRESS | Dot-notation path to resolve |
|
|
49
|
+
| FALLBACK_TEMPLATE_HASH | Hash of a registered template to render if the value is falsy |
|
|
50
|
+
|
|
51
|
+
**Examples:**
|
|
52
|
+
|
|
53
|
+
```javascript
|
|
54
|
+
_Pict.TemplateProvider.addTemplate('MissingTitle',
|
|
55
|
+
'<span class="empty">No title available</span>');
|
|
56
|
+
|
|
57
|
+
_Pict.TemplateProvider.addTemplate('BookHeading',
|
|
58
|
+
'<h1>{~DWTF:Record.Title:MissingTitle~}</h1>');
|
|
59
|
+
|
|
60
|
+
// With data present
|
|
61
|
+
_Pict.parseTemplateByHash('BookHeading', { Title: 'Dune' });
|
|
62
|
+
// '<h1>Dune</h1>'
|
|
63
|
+
|
|
64
|
+
// Without data
|
|
65
|
+
_Pict.parseTemplateByHash('BookHeading', { Title: undefined });
|
|
66
|
+
// '<h1><span class="empty">No title available</span></h1>'
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## DataWithAbsoluteFallback (DWAF)
|
|
72
|
+
|
|
73
|
+
Resolves a value from the address space. If the value is falsy or undefined, returns a literal fallback string.
|
|
74
|
+
|
|
75
|
+
**Tags:** `{~DataWithAbsoluteFallback:DATA_ADDRESS^LITERAL_FALLBACK~}` `{~DWAF:DATA_ADDRESS^LITERAL_FALLBACK~}`
|
|
76
|
+
|
|
77
|
+
**Parameters:**
|
|
78
|
+
|
|
79
|
+
| Parameter | Description |
|
|
80
|
+
|-----------|-------------|
|
|
81
|
+
| DATA_ADDRESS | Dot-notation path to resolve |
|
|
82
|
+
| LITERAL_FALLBACK | A literal string to return if the value is falsy (separated by `^`) |
|
|
83
|
+
|
|
84
|
+
**Examples:**
|
|
85
|
+
|
|
86
|
+
```html
|
|
87
|
+
<h1>{~DWAF:Record.Title^Untitled Document~}</h1>
|
|
88
|
+
<p>{~DWAF:Record.Author^Unknown Author~}</p>
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
```javascript
|
|
92
|
+
_Pict.parseTemplate('{~DWAF:Record.Title^No Title~}', { Title: 'Dune' });
|
|
93
|
+
// 'Dune'
|
|
94
|
+
|
|
95
|
+
_Pict.parseTemplate('{~DWAF:Record.Title^No Title~}', {});
|
|
96
|
+
// 'No Title'
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
The fallback is a plain string, not a template -- it is not parsed for further expressions.
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## DataValueByKey (DVBK)
|
|
104
|
+
|
|
105
|
+
Accesses an object using a dynamic key resolved from a data address. Useful when the property name to access is itself stored in data.
|
|
106
|
+
|
|
107
|
+
**Tags:** `{~DataValueByKey:OBJECT_ADDRESS^KEY_ADDRESS~}` `{~DVBK:OBJECT_ADDRESS^KEY_ADDRESS~}`
|
|
108
|
+
|
|
109
|
+
**Parameters:**
|
|
110
|
+
|
|
111
|
+
| Parameter | Description |
|
|
112
|
+
|-----------|-------------|
|
|
113
|
+
| OBJECT_ADDRESS | Address of the object to access |
|
|
114
|
+
| KEY_ADDRESS | Address containing the key string to use for the lookup (separated by `^`) |
|
|
115
|
+
|
|
116
|
+
**Examples:**
|
|
117
|
+
|
|
118
|
+
```javascript
|
|
119
|
+
_Pict.AppData.StatusLabels = {
|
|
120
|
+
'active': 'Currently Active',
|
|
121
|
+
'inactive': 'No Longer Active',
|
|
122
|
+
'pending': 'Awaiting Approval'
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
_Pict.parseTemplate(
|
|
126
|
+
'{~DVBK:AppData.StatusLabels^Record.Status~}',
|
|
127
|
+
{ Status: 'pending' });
|
|
128
|
+
// 'Awaiting Approval'
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
This is valuable for lookup tables and maps where the key comes from another data field.
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## DataJson (DJ)
|
|
136
|
+
|
|
137
|
+
Returns the resolved value serialized as a JSON string via `JSON.stringify()`. If the address is empty, serializes the entire Record.
|
|
138
|
+
|
|
139
|
+
**Tags:** `{~DataJson:ADDRESS~}` `{~DJ:ADDRESS~}` or `{~DJ:~}` (for entire Record)
|
|
140
|
+
|
|
141
|
+
**Parameters:**
|
|
142
|
+
|
|
143
|
+
| Parameter | Description |
|
|
144
|
+
|-----------|-------------|
|
|
145
|
+
| ADDRESS | Dot-notation path to resolve (optional; empty address returns the full Record) |
|
|
146
|
+
|
|
147
|
+
**Examples:**
|
|
148
|
+
|
|
149
|
+
```html
|
|
150
|
+
<script>
|
|
151
|
+
var appConfig = {~DJ:AppData.Config~};
|
|
152
|
+
var currentRecord = {~DJ:~};
|
|
153
|
+
</script>
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
```javascript
|
|
157
|
+
_Pict.AppData.Config = { theme: 'dark', language: 'en' };
|
|
158
|
+
_Pict.parseTemplate('{~DJ:AppData.Config~}');
|
|
159
|
+
// '{"theme":"dark","language":"en"}'
|
|
160
|
+
|
|
161
|
+
_Pict.parseTemplate('{~DJ:~}', { id: 1, name: 'Test' });
|
|
162
|
+
// '{"id":1,"name":"Test"}'
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Useful for passing data from templates into JavaScript contexts, data attributes, or API payloads.
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## DataEncodeJavascriptString (DEJS)
|
|
170
|
+
|
|
171
|
+
Resolves a value and escapes it for safe use inside a JavaScript string literal. Escapes quotes, backslashes, and other characters that would break a JS string.
|
|
172
|
+
|
|
173
|
+
**Tags:** `{~DataEncodeJavascriptString:ADDRESS~}` `{~DEJS:ADDRESS~}`
|
|
174
|
+
|
|
175
|
+
**Parameters:**
|
|
176
|
+
|
|
177
|
+
| Parameter | Description |
|
|
178
|
+
|-----------|-------------|
|
|
179
|
+
| ADDRESS | Dot-notation path to resolve |
|
|
180
|
+
|
|
181
|
+
**Examples:**
|
|
182
|
+
|
|
183
|
+
```html
|
|
184
|
+
<script>
|
|
185
|
+
var userName = "{~DEJS:AppData.User.Name~}";
|
|
186
|
+
var description = "{~DEJS:Record.Description~}";
|
|
187
|
+
</script>
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
```javascript
|
|
191
|
+
_Pict.parseTemplate('"{~DEJS:Record.Quote~}"',
|
|
192
|
+
{ Quote: 'She said "hello" and left.' });
|
|
193
|
+
// '"She said \"hello\" and left."'
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Always use DEJS when embedding data values inside JavaScript string literals in templates. Using plain `{~D:...~}` inside a quoted string risks injection if the data contains quotes or special characters.
|