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,38 @@
|
|
|
1
|
+
# Reference: HtmlCommentStart (HCS)
|
|
2
|
+
|
|
3
|
+
Conditionally outputs `<!-- ` to start an HTML comment based on a value's truthiness.
|
|
4
|
+
|
|
5
|
+
**Tags:** `{~HtmlCommentStart:ADDRESS~}` `{~HCS:ADDRESS~}` or `{~HCS:ADDRESS:POLARITY~}`
|
|
6
|
+
|
|
7
|
+
**Source:** `pict/source/templates/data/Pict-Template-HtmlCommentStart.js`
|
|
8
|
+
|
|
9
|
+
## Syntax
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
{~HCS:ADDRESS~}
|
|
13
|
+
{~HCS:ADDRESS:POLARITY~}
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Parameters
|
|
17
|
+
|
|
18
|
+
| Parameter | Required | Description |
|
|
19
|
+
|-----------|----------|-------------|
|
|
20
|
+
| ADDRESS | Yes | Path to a value to check |
|
|
21
|
+
| POLARITY | No | Default: comment when **falsy**. Set to `1`/`true`/`t` to comment when **truthy**. |
|
|
22
|
+
|
|
23
|
+
## Examples
|
|
24
|
+
|
|
25
|
+
```javascript
|
|
26
|
+
// Default: comments out when value is falsy
|
|
27
|
+
_Pict.parseTemplate('{~HCS:Record.Show~}<p>Content</p>{~HCE:Record.Show~}',
|
|
28
|
+
{ Show: true });
|
|
29
|
+
// '<p>Content</p>'
|
|
30
|
+
|
|
31
|
+
_Pict.parseTemplate('{~HCS:Record.Show~}<p>Content</p>{~HCE:Record.Show~}',
|
|
32
|
+
{ Show: false });
|
|
33
|
+
// '<!-- <p>Content</p> -->'
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Related
|
|
37
|
+
|
|
38
|
+
- [HCE](architecture/templating/ref-hce.md) -- Matching comment end tag
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Reference: Join (J)
|
|
2
|
+
|
|
3
|
+
Joins resolved values from multiple addresses with a separator. Skips empty values and flattens arrays.
|
|
4
|
+
|
|
5
|
+
**Tags:** `{~Join:SEPARATOR^ADDR1^ADDR2^...~}` `{~J:SEPARATOR^ADDR1^ADDR2^...~}`
|
|
6
|
+
|
|
7
|
+
**Source:** `pict/source/templates/data/Pict-Template-Join.js`
|
|
8
|
+
|
|
9
|
+
## Syntax
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
{~J:SEPARATOR^ADDRESS1^ADDRESS2^ADDRESS3~}
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
| Parameter | Required | Description |
|
|
18
|
+
|-----------|----------|-------------|
|
|
19
|
+
| SEPARATOR | Yes | String placed between joined values |
|
|
20
|
+
| ADDRESS1..N | Yes | Addresses to resolve and join (separated by `^`) |
|
|
21
|
+
|
|
22
|
+
## Behavior
|
|
23
|
+
|
|
24
|
+
- Resolves each address
|
|
25
|
+
- Skips empty or falsy values
|
|
26
|
+
- Flattens any arrays encountered
|
|
27
|
+
- Joins remaining values with the separator
|
|
28
|
+
|
|
29
|
+
## Examples
|
|
30
|
+
|
|
31
|
+
```javascript
|
|
32
|
+
_Pict.parseTemplate('{~J:, ^Record.City^Record.State^Record.Country~}',
|
|
33
|
+
{ City: 'Portland', State: 'Oregon', Country: 'US' });
|
|
34
|
+
// 'Portland, Oregon, US'
|
|
35
|
+
|
|
36
|
+
// Empty values skipped
|
|
37
|
+
_Pict.parseTemplate('{~J:, ^Record.City^Record.State~}',
|
|
38
|
+
{ City: 'Portland', State: '' });
|
|
39
|
+
// 'Portland'
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Related
|
|
43
|
+
|
|
44
|
+
- [JU](architecture/templating/ref-joinunique.md) -- Join with deduplication
|
|
45
|
+
- [PJU](architecture/templating/ref-pluckjoinunique.md) -- Pluck a property from array items, deduplicate, join
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Reference: JoinUnique (JU)
|
|
2
|
+
|
|
3
|
+
Joins resolved values, deduplicating before joining.
|
|
4
|
+
|
|
5
|
+
**Tags:** `{~JoinUnique:SEPARATOR^ADDR1^ADDR2^...~}` `{~JU:SEPARATOR^ADDR1^ADDR2^...~}`
|
|
6
|
+
|
|
7
|
+
**Source:** `pict/source/templates/data/Pict-Template-JoinUnique.js`
|
|
8
|
+
|
|
9
|
+
## Syntax
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
{~JU:SEPARATOR^ADDRESS1^ADDRESS2^ADDRESS3~}
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
| Parameter | Required | Description |
|
|
18
|
+
|-----------|----------|-------------|
|
|
19
|
+
| SEPARATOR | Yes | String placed between joined values |
|
|
20
|
+
| ADDRESS1..N | Yes | Addresses to resolve, deduplicate, and join (separated by `^`) |
|
|
21
|
+
|
|
22
|
+
## Examples
|
|
23
|
+
|
|
24
|
+
```javascript
|
|
25
|
+
_Pict.AppData = { Tag1: 'js', Tag2: 'node', Tag3: 'js' };
|
|
26
|
+
|
|
27
|
+
_Pict.parseTemplate('{~JU:, ^AppData.Tag1^AppData.Tag2^AppData.Tag3~}');
|
|
28
|
+
// 'js, node'
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Related
|
|
32
|
+
|
|
33
|
+
- [J](architecture/templating/ref-join.md) -- Join without deduplication
|
|
34
|
+
- [PJU](architecture/templating/ref-pluckjoinunique.md) -- Pluck from array, deduplicate, join
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Reference: LogStatement (LS)
|
|
2
|
+
|
|
3
|
+
Logs a literal message to the trace log. Returns empty string.
|
|
4
|
+
|
|
5
|
+
**Tags:** `{~LogStatement:MESSAGE~}` `{~LS:MESSAGE~}`
|
|
6
|
+
|
|
7
|
+
**Source:** `pict/source/templates/debugging/Pict-Template-LogStatement.js`
|
|
8
|
+
|
|
9
|
+
## Syntax
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
{~LS:MESSAGE~}
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
| Parameter | Required | Description |
|
|
18
|
+
|-----------|----------|-------------|
|
|
19
|
+
| MESSAGE | Yes | Literal string to log |
|
|
20
|
+
|
|
21
|
+
## Behavior
|
|
22
|
+
|
|
23
|
+
- Logs the message at trace level
|
|
24
|
+
- Returns empty string
|
|
25
|
+
|
|
26
|
+
## Examples
|
|
27
|
+
|
|
28
|
+
```html
|
|
29
|
+
{~LS:Starting render~}
|
|
30
|
+
{~TS:Row:AppData.Items~}
|
|
31
|
+
{~LS:Render complete~}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Related
|
|
35
|
+
|
|
36
|
+
- [LV](architecture/templating/ref-lv.md) -- Log a resolved value
|
|
37
|
+
- [LVT](architecture/templating/ref-lvt.md) -- Log an object tree
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Reference: LogValue (LV)
|
|
2
|
+
|
|
3
|
+
Resolves a value and logs it with type information. Returns empty string.
|
|
4
|
+
|
|
5
|
+
**Tags:** `{~LogValue:ADDRESS~}` `{~LV:ADDRESS~}`
|
|
6
|
+
|
|
7
|
+
**Source:** `pict/source/templates/debugging/Pict-Template-LogValue.js`
|
|
8
|
+
|
|
9
|
+
## Syntax
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
{~LV:ADDRESS~}
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
| Parameter | Required | Description |
|
|
18
|
+
|-----------|----------|-------------|
|
|
19
|
+
| ADDRESS | Yes | Path to the value to log |
|
|
20
|
+
|
|
21
|
+
## Behavior
|
|
22
|
+
|
|
23
|
+
- Resolves the address
|
|
24
|
+
- Logs the type (`typeof`) and value at trace level
|
|
25
|
+
- Returns empty string
|
|
26
|
+
|
|
27
|
+
## Examples
|
|
28
|
+
|
|
29
|
+
```html
|
|
30
|
+
{~LV:AppData.CurrentUser~}
|
|
31
|
+
{~LV:Record.OrderTotal~}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Related
|
|
35
|
+
|
|
36
|
+
- [LS](architecture/templating/ref-ls.md) -- Log a literal message
|
|
37
|
+
- [LVT](architecture/templating/ref-lvt.md) -- Log an object tree
|
|
38
|
+
- [DT](architecture/templating/ref-dt.md) -- Render an object as HTML
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Reference: LogValueTree (LVT)
|
|
2
|
+
|
|
3
|
+
Recursively logs an object's keys and values to the trace log. Returns empty string.
|
|
4
|
+
|
|
5
|
+
**Tags:** `{~LogValueTree:ADDRESS~}` `{~LVT:ADDRESS~}` or `{~LVT:ADDRESS^DEPTH~}`
|
|
6
|
+
|
|
7
|
+
**Source:** `pict/source/templates/debugging/Pict-Template-LogValueTree.js`
|
|
8
|
+
|
|
9
|
+
## Syntax
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
{~LVT:ADDRESS~}
|
|
13
|
+
{~LVT:ADDRESS^DEPTH~}
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Parameters
|
|
17
|
+
|
|
18
|
+
| Parameter | Required | Description |
|
|
19
|
+
|-----------|----------|-------------|
|
|
20
|
+
| ADDRESS | Yes | Path to the object to log |
|
|
21
|
+
| DEPTH | No | Maximum traversal depth (default: 1, separated by `^`) |
|
|
22
|
+
|
|
23
|
+
## Examples
|
|
24
|
+
|
|
25
|
+
```html
|
|
26
|
+
{~LVT:AppData.Config~}
|
|
27
|
+
{~LVT:AppData.User^3~}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Related
|
|
31
|
+
|
|
32
|
+
- [LV](architecture/templating/ref-lv.md) -- Log a single value
|
|
33
|
+
- [DT](architecture/templating/ref-dt.md) -- Render as HTML instead of logging
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Reference: NotEmpty (NE)
|
|
2
|
+
|
|
3
|
+
Outputs a literal string if a value is truthy. Otherwise outputs nothing.
|
|
4
|
+
|
|
5
|
+
**Tags:** `{~NotEmpty:ADDRESS^OUTPUT~}` `{~NE:ADDRESS^OUTPUT~}`
|
|
6
|
+
|
|
7
|
+
**Source:** `pict/source/templates/logic/Pict-Template-NotEmpty.js`
|
|
8
|
+
|
|
9
|
+
## Syntax
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
{~NE:ADDRESS^LITERAL_OUTPUT~}
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
| Parameter | Required | Description |
|
|
18
|
+
|-----------|----------|-------------|
|
|
19
|
+
| ADDRESS | Yes | Path to a value to check for truthiness |
|
|
20
|
+
| LITERAL_OUTPUT | Yes | String to output if truthy (separated by `^`) |
|
|
21
|
+
|
|
22
|
+
## Examples
|
|
23
|
+
|
|
24
|
+
```javascript
|
|
25
|
+
_Pict.parseTemplate('{~NE:Record.Name^has name~}', { Name: 'Alice' });
|
|
26
|
+
// 'has name'
|
|
27
|
+
|
|
28
|
+
_Pict.parseTemplate('{~NE:Record.Name^has name~}', {});
|
|
29
|
+
// ''
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
```html
|
|
33
|
+
<div class="item{~NE:Record.IsActive^ active~}">
|
|
34
|
+
{~D:Record.AddressLine2~}{~NE:Record.AddressLine2^<br/>~}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Related
|
|
38
|
+
|
|
39
|
+
- [TIfAbs](architecture/templating/ref-tifabs.md) -- Full conditional with template rendering
|
|
40
|
+
- [HCS](architecture/templating/ref-hcs.md) / [HCE](architecture/templating/ref-hce.md) -- HTML comment toggling
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Reference: PascalCaseIdentifier
|
|
2
|
+
|
|
3
|
+
Converts a string to PascalCase.
|
|
4
|
+
|
|
5
|
+
**Tags:** `{~PascalCaseIdentifier:ADDRESS~}`
|
|
6
|
+
|
|
7
|
+
**Source:** `pict/source/templates/data/Pict-Template-PascalCaseIdentifier.js`
|
|
8
|
+
|
|
9
|
+
## Syntax
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
{~PascalCaseIdentifier:ADDRESS~}
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
| Parameter | Required | Description |
|
|
18
|
+
|-----------|----------|-------------|
|
|
19
|
+
| ADDRESS | Yes | Path to a string value |
|
|
20
|
+
|
|
21
|
+
## Behavior
|
|
22
|
+
|
|
23
|
+
- Capitalizes the first letter of each word
|
|
24
|
+
- Removes non-alphanumeric separators (hyphens, underscores, spaces)
|
|
25
|
+
- Returns the PascalCase result
|
|
26
|
+
|
|
27
|
+
## Examples
|
|
28
|
+
|
|
29
|
+
```javascript
|
|
30
|
+
_Pict.parseTemplate('{~PascalCaseIdentifier:Record.Name~}',
|
|
31
|
+
{ Name: 'meadow-endpoints' });
|
|
32
|
+
// 'MeadowEndpoints'
|
|
33
|
+
|
|
34
|
+
_Pict.parseTemplate('{~PascalCaseIdentifier:Record.Name~}',
|
|
35
|
+
{ Name: 'hello world' });
|
|
36
|
+
// 'HelloWorld'
|
|
37
|
+
|
|
38
|
+
_Pict.parseTemplate('{~PascalCaseIdentifier:Record.Name~}',
|
|
39
|
+
{ Name: 'some_variable_name' });
|
|
40
|
+
// 'SomeVariableName'
|
|
41
|
+
```
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Reference: Pict / Self-Reference (P)
|
|
2
|
+
|
|
3
|
+
Returns the browser-side JavaScript reference to the Pict instance.
|
|
4
|
+
|
|
5
|
+
**Tags:** `{~Pict~}` `{~P~}`
|
|
6
|
+
|
|
7
|
+
**Source:** `pict/source/templates/Pict-Template-Self.js`
|
|
8
|
+
|
|
9
|
+
## Syntax
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
{~P~}
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
None.
|
|
18
|
+
|
|
19
|
+
## Behavior
|
|
20
|
+
|
|
21
|
+
- Returns `pict.browserAddress` (default: `window._Pict`)
|
|
22
|
+
- Used to wire event handlers in rendered HTML
|
|
23
|
+
|
|
24
|
+
## Examples
|
|
25
|
+
|
|
26
|
+
```html
|
|
27
|
+
<button onclick="{~P~}.views['Cart'].add({~D:Record.ID~})">Add</button>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
```javascript
|
|
31
|
+
_Pict.parseTemplate('{~P~}');
|
|
32
|
+
// 'window._Pict'
|
|
33
|
+
|
|
34
|
+
_Pict.browserAddress = 'window._Pict.children[0]';
|
|
35
|
+
_Pict.parseTemplate('{~P~}');
|
|
36
|
+
// 'window._Pict.children[0]'
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Related
|
|
40
|
+
|
|
41
|
+
- [V](architecture/templating/ref-view.md) -- Render a view inline
|
|
42
|
+
- [DEJS](architecture/templating/ref-dejs.md) -- Escape data for JS strings in handlers
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Reference: PluckJoinUnique (PJU)
|
|
2
|
+
|
|
3
|
+
Plucks a property from each object in an array, deduplicates, and joins with a separator.
|
|
4
|
+
|
|
5
|
+
**Tags:** `{~PluckJoinUnique:SEPARATOR^PROPERTY^ARRAY_ADDRESS~}` `{~PJU:SEPARATOR^PROPERTY^ARRAY_ADDRESS~}`
|
|
6
|
+
|
|
7
|
+
**Source:** `pict/source/templates/data/Pict-Template-PluckJoinUnique.js`
|
|
8
|
+
|
|
9
|
+
## Syntax
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
{~PJU:SEPARATOR^PROPERTY^ARRAY_ADDRESS~}
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
| Parameter | Required | Description |
|
|
18
|
+
|-----------|----------|-------------|
|
|
19
|
+
| SEPARATOR | Yes | String placed between joined values |
|
|
20
|
+
| PROPERTY | Yes | Property name to extract from each array item |
|
|
21
|
+
| ARRAY_ADDRESS | Yes | Address of the array (separated by `^`) |
|
|
22
|
+
|
|
23
|
+
## Examples
|
|
24
|
+
|
|
25
|
+
```javascript
|
|
26
|
+
_Pict.AppData.Files = [
|
|
27
|
+
{ name: 'photo.jpg', type: 'image' },
|
|
28
|
+
{ name: 'doc.pdf', type: 'document' },
|
|
29
|
+
{ name: 'logo.png', type: 'image' }
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
_Pict.parseTemplate('{~PJU:, ^type^AppData.Files~}');
|
|
33
|
+
// 'image, document'
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Related
|
|
37
|
+
|
|
38
|
+
- [J](architecture/templating/ref-join.md) -- Join values from addresses
|
|
39
|
+
- [JU](architecture/templating/ref-joinunique.md) -- Join unique values from addresses
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Reference: RandomNumber (RN)
|
|
2
|
+
|
|
3
|
+
Generates a random integer between a minimum and maximum value.
|
|
4
|
+
|
|
5
|
+
**Tags:** `{~RandomNumber:MIN,MAX~}` `{~RN:MIN,MAX~}` or `{~RN:~}`
|
|
6
|
+
|
|
7
|
+
**Source:** `pict/source/templates/data-generation/Pict-Template-RandomNumber.js`
|
|
8
|
+
|
|
9
|
+
## Syntax
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
{~RN:MIN,MAX~}
|
|
13
|
+
{~RN:~}
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Parameters
|
|
17
|
+
|
|
18
|
+
| Parameter | Required | Description |
|
|
19
|
+
|-----------|----------|-------------|
|
|
20
|
+
| MIN | No | Minimum value (default: 0) |
|
|
21
|
+
| MAX | No | Maximum value (default: 9999999, separated from MIN by `,`) |
|
|
22
|
+
|
|
23
|
+
## Examples
|
|
24
|
+
|
|
25
|
+
```javascript
|
|
26
|
+
_Pict.parseTemplate('{~RN:1,100~}');
|
|
27
|
+
// Random integer 1-100
|
|
28
|
+
|
|
29
|
+
_Pict.parseTemplate('{~RN:~}');
|
|
30
|
+
// Random integer 0-9999999
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Related
|
|
34
|
+
|
|
35
|
+
- [RNS](architecture/templating/ref-rns.md) -- Zero-padded random number string
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Reference: RandomNumberString (RNS)
|
|
2
|
+
|
|
3
|
+
Generates a zero-padded random numeric string of a specified length.
|
|
4
|
+
|
|
5
|
+
**Tags:** `{~RandomNumberString:LENGTH~}` `{~RNS:LENGTH~}` or `{~RNS:LENGTH,MAX~}`
|
|
6
|
+
|
|
7
|
+
**Source:** `pict/source/templates/data-generation/Pict-Template-RandomNumberString.js`
|
|
8
|
+
|
|
9
|
+
## Syntax
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
{~RNS:LENGTH~}
|
|
13
|
+
{~RNS:LENGTH,MAX~}
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Parameters
|
|
17
|
+
|
|
18
|
+
| Parameter | Required | Description |
|
|
19
|
+
|-----------|----------|-------------|
|
|
20
|
+
| LENGTH | No | Output string length (default: 4) |
|
|
21
|
+
| MAX | No | Maximum numeric value (default: 10^LENGTH - 1, separated by `,`) |
|
|
22
|
+
|
|
23
|
+
## Examples
|
|
24
|
+
|
|
25
|
+
```javascript
|
|
26
|
+
_Pict.parseTemplate('{~RNS:6~}');
|
|
27
|
+
// e.g., '003847' (always 6 characters)
|
|
28
|
+
|
|
29
|
+
_Pict.parseTemplate('{~RNS:4~}');
|
|
30
|
+
// e.g., '0042' (always 4 characters)
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Related
|
|
34
|
+
|
|
35
|
+
- [RN](architecture/templating/ref-rn.md) -- Random number (not padded)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Reference: SolveByReference (SBR)
|
|
2
|
+
|
|
3
|
+
Resolves an equation string from data and evaluates it.
|
|
4
|
+
|
|
5
|
+
**Tags:** `{~SolveByReference:EQUATION_ADDR~}` `{~SBR:EQUATION_ADDR~}` or `{~SBR:EQUATION_ADDR:DATA_ADDR:MANIFEST_ADDR~}`
|
|
6
|
+
|
|
7
|
+
**Source:** `pict/source/templates/Pict-Template-SolveByReference.js`
|
|
8
|
+
|
|
9
|
+
## Syntax
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
{~SBR:EQUATION_ADDRESS~}
|
|
13
|
+
{~SBR:EQUATION_ADDRESS:DATA_ADDRESS:MANIFEST_ADDRESS~}
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Parameters
|
|
17
|
+
|
|
18
|
+
| Parameter | Required | Description |
|
|
19
|
+
|-----------|----------|-------------|
|
|
20
|
+
| EQUATION_ADDRESS | Yes | Address containing the equation string |
|
|
21
|
+
| DATA_ADDRESS | No | Address of data object for variable resolution |
|
|
22
|
+
| MANIFEST_ADDRESS | No | Address of a Manyfest instance for variable mapping |
|
|
23
|
+
|
|
24
|
+
## Examples
|
|
25
|
+
|
|
26
|
+
```javascript
|
|
27
|
+
_Pict.AppData.Formula = 'Width * Height';
|
|
28
|
+
_Pict.AppData.Dims = { Width: 100, Height: 50 };
|
|
29
|
+
|
|
30
|
+
_Pict.parseTemplate('{~SBR:AppData.Formula:AppData.Dims~}');
|
|
31
|
+
// '5000'
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Related
|
|
35
|
+
|
|
36
|
+
- [S](architecture/templating/ref-solve.md) -- Inline expression evaluation
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Reference: Solve (S)
|
|
2
|
+
|
|
3
|
+
Evaluates a mathematical expression with optional variable resolution from data.
|
|
4
|
+
|
|
5
|
+
**Tags:** `{~Solve:EXPR~}` `{~S:EXPR~}` or `{~S:EXPR:DATA_ADDRESS~}`
|
|
6
|
+
|
|
7
|
+
**Source:** `pict/source/templates/Pict-Template-Solve.js`
|
|
8
|
+
|
|
9
|
+
## Syntax
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
{~S:EXPRESSION~}
|
|
13
|
+
{~S:EXPRESSION:DATA_ADDRESS~}
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Parameters
|
|
17
|
+
|
|
18
|
+
| Parameter | Required | Description |
|
|
19
|
+
|-----------|----------|-------------|
|
|
20
|
+
| EXPRESSION | Yes | Math expression string |
|
|
21
|
+
| DATA_ADDRESS | No | Address of object whose properties become variables |
|
|
22
|
+
|
|
23
|
+
## Built-in Functions
|
|
24
|
+
|
|
25
|
+
| Function | Description |
|
|
26
|
+
|----------|-------------|
|
|
27
|
+
| `ROUND(value, decimals)` | Round to N decimal places |
|
|
28
|
+
| `PI()` | The constant pi |
|
|
29
|
+
| `CONCAT(a, b, ...)` | String concatenation |
|
|
30
|
+
|
|
31
|
+
## Examples
|
|
32
|
+
|
|
33
|
+
```javascript
|
|
34
|
+
_Pict.parseTemplate('{~S:100+55~}');
|
|
35
|
+
// '155'
|
|
36
|
+
|
|
37
|
+
_Pict.AppData.Order = { Qty: 3, Price: 24.99 };
|
|
38
|
+
_Pict.parseTemplate('{~S:Qty*Price:AppData.Order~}');
|
|
39
|
+
// '74.97'
|
|
40
|
+
|
|
41
|
+
_Pict.parseTemplate('{~S:ROUND(PI()*R*R,2):AppData~}');
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Related
|
|
45
|
+
|
|
46
|
+
- [SBR](architecture/templating/ref-sbr.md) -- Equation from data
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Reference: TemplateByDataAddress (TBDA)
|
|
2
|
+
|
|
3
|
+
Reads a template string from a data address and parses it inline.
|
|
4
|
+
|
|
5
|
+
**Tags:** `{~TemplateByDataAddress:ADDRESS~}` `{~TBDA:ADDRESS~}`
|
|
6
|
+
|
|
7
|
+
**Source:** `pict/source/templates/Pict-Template-TemplateByDataAddress.js`
|
|
8
|
+
|
|
9
|
+
## Syntax
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
{~TBDA:ADDRESS~}
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
| Parameter | Required | Description |
|
|
18
|
+
|-----------|----------|-------------|
|
|
19
|
+
| ADDRESS | Yes | Path to a string containing template content |
|
|
20
|
+
|
|
21
|
+
## Behavior
|
|
22
|
+
|
|
23
|
+
- Resolves a template string (the actual markup) from data
|
|
24
|
+
- Fully parses the resolved string for Jellyfish expressions
|
|
25
|
+
- Useful when template content is stored in configuration or database records
|
|
26
|
+
|
|
27
|
+
## Examples
|
|
28
|
+
|
|
29
|
+
```javascript
|
|
30
|
+
_Pict.AppData.CustomBanner = '<h1>{~D:AppData.SiteName~}</h1>';
|
|
31
|
+
_Pict.AppData.SiteName = 'My Store';
|
|
32
|
+
|
|
33
|
+
_Pict.parseTemplate('{~TBDA:AppData.CustomBanner~}');
|
|
34
|
+
// '<h1>My Store</h1>'
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Related
|
|
38
|
+
|
|
39
|
+
- [T](architecture/templating/ref-template.md) -- Render by hash (pre-registered)
|
|
40
|
+
- [TBR](architecture/templating/ref-tbr.md) -- Resolve hash name from data, then render
|
|
41
|
+
- [TFA](architecture/templating/ref-tfa.md) -- Identical to TBDA
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Reference: TemplateByReference (TBR)
|
|
2
|
+
|
|
3
|
+
Reads a template hash (name) from a data address, then renders that registered template.
|
|
4
|
+
|
|
5
|
+
**Tags:** `{~TemplateByReference:ADDRESS~}` `{~TBR:ADDRESS~}`
|
|
6
|
+
|
|
7
|
+
**Source:** `pict/source/templates/Pict-Template-TemplateByReference.js`
|
|
8
|
+
|
|
9
|
+
## Syntax
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
{~TBR:ADDRESS~}
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
| Parameter | Required | Description |
|
|
18
|
+
|-----------|----------|-------------|
|
|
19
|
+
| ADDRESS | Yes | Path to a string containing a registered template hash |
|
|
20
|
+
|
|
21
|
+
## Behavior
|
|
22
|
+
|
|
23
|
+
- Resolves the address to get a template hash string
|
|
24
|
+
- Looks up that hash in the TemplateProvider
|
|
25
|
+
- Renders the registered template
|
|
26
|
+
|
|
27
|
+
## Examples
|
|
28
|
+
|
|
29
|
+
```javascript
|
|
30
|
+
_Pict.TemplateProvider.addTemplate('CardLayout',
|
|
31
|
+
'<div class="card">{~D:Record.Content~}</div>');
|
|
32
|
+
_Pict.TemplateProvider.addTemplate('ListLayout',
|
|
33
|
+
'<li>{~D:Record.Content~}</li>');
|
|
34
|
+
|
|
35
|
+
_Pict.parseTemplate('{~TBR:Record.Layout~}',
|
|
36
|
+
{ Layout: 'CardLayout', Content: 'Hello' });
|
|
37
|
+
// '<div class="card">Hello</div>'
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Related
|
|
41
|
+
|
|
42
|
+
- [T](architecture/templating/ref-template.md) -- Render by a known hash
|
|
43
|
+
- [TBDA](architecture/templating/ref-tbda.md) -- Resolve template content (not hash) from data
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Reference: TemplateByType (TBT)
|
|
2
|
+
|
|
3
|
+
Checks a value's JavaScript type and renders a template if the type matches.
|
|
4
|
+
|
|
5
|
+
**Tags:** `{~TemplateByType:ADDR:TYPE:HASH~}` `{~TBT:ADDR:TYPE:HASH~}` or `{~TBT:ADDR:TYPE:HASH:FALLBACK_ADDR:FALLBACK_HASH~}`
|
|
6
|
+
|
|
7
|
+
**Source:** `pict/source/templates/Pict-Template-TemplateByTypes.js`
|
|
8
|
+
|
|
9
|
+
## Syntax
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
{~TBT:DATA_ADDRESS:TYPE:TEMPLATE_HASH~}
|
|
13
|
+
{~TBT:DATA_ADDRESS:TYPE:TEMPLATE_HASH:FALLBACK_DATA:FALLBACK_TEMPLATE~}
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Parameters
|
|
17
|
+
|
|
18
|
+
| Parameter | Required | Description |
|
|
19
|
+
|-----------|----------|-------------|
|
|
20
|
+
| DATA_ADDRESS | Yes | Address of the value to type-check |
|
|
21
|
+
| TYPE | Yes | Expected JavaScript type (`string`, `number`, `object`, `boolean`, `undefined`) |
|
|
22
|
+
| TEMPLATE_HASH | Yes | Template to render if the type matches |
|
|
23
|
+
| FALLBACK_DATA | No | Data address for fallback rendering |
|
|
24
|
+
| FALLBACK_TEMPLATE | No | Template to render if the type does not match |
|
|
25
|
+
|
|
26
|
+
## Examples
|
|
27
|
+
|
|
28
|
+
```javascript
|
|
29
|
+
_Pict.TemplateProvider.addTemplate('ShowText', '<p>{~D:Record.Value~}</p>');
|
|
30
|
+
_Pict.TemplateProvider.addTemplate('ShowNum', '<p>{~Digits:Record.Value~}</p>');
|
|
31
|
+
|
|
32
|
+
_Pict.AppData.Item = { Value: 'Hello' };
|
|
33
|
+
_Pict.parseTemplate('{~TBT:AppData.Item.Value:string:ShowText~}');
|
|
34
|
+
// '<p>Hello</p>'
|
|
35
|
+
|
|
36
|
+
// With fallback
|
|
37
|
+
_Pict.AppData.Item = { Value: 42 };
|
|
38
|
+
_Pict.parseTemplate(
|
|
39
|
+
'{~TBT:AppData.Item.Value:string:ShowText:AppData.Item:ShowNum~}');
|
|
40
|
+
// '<p>42.00</p>'
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Related
|
|
44
|
+
|
|
45
|
+
- [TIf](architecture/templating/ref-tif.md) -- Conditional by value comparison
|
|
46
|
+
- [TIfAbs](architecture/templating/ref-tifabs.md) -- Conditional by literal comparison
|