retold 4.0.1 → 4.0.2
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 +27 -1
- package/docs/README.md +7 -6
- package/docs/_sidebar.md +34 -21
- package/docs/_topbar.md +2 -2
- package/docs/architecture/module-architecture.md +234 -0
- package/docs/{modules.md → architecture/modules.md} +25 -22
- package/docs/cover.md +2 -2
- package/docs/css/docuserve.css +6 -6
- package/docs/examples/examples.md +71 -0
- package/docs/examples/todolist/todo-list-cli-client.md +178 -0
- package/docs/examples/todolist/todo-list-console-client.md +152 -0
- package/docs/examples/todolist/todo-list-model.md +114 -0
- package/docs/examples/todolist/todo-list-server.md +128 -0
- package/docs/examples/todolist/todo-list-web-client.md +177 -0
- package/docs/examples/todolist/todo-list.md +162 -0
- package/docs/getting-started.md +8 -7
- package/docs/index.html +4 -4
- package/docs/{meadow.md → modules/meadow.md} +4 -6
- package/docs/{orator.md → modules/orator.md} +1 -0
- package/docs/{pict.md → modules/pict.md} +30 -8
- package/docs/{utility.md → modules/utility.md} +0 -9
- package/docs/retold-catalog.json +896 -2317
- package/docs/retold-keyword-index.json +162327 -120227
- package/examples/todo-list/Dockerfile +45 -0
- package/examples/todo-list/README.md +394 -0
- package/examples/todo-list/cli-client/package-lock.json +418 -0
- package/examples/todo-list/cli-client/package.json +19 -0
- package/examples/todo-list/cli-client/source/TodoCLI-CLIProgram.js +30 -0
- package/examples/todo-list/cli-client/source/TodoCLI-Run.js +3 -0
- package/examples/todo-list/cli-client/source/commands/add/TodoCLI-Command-Add.js +74 -0
- package/examples/todo-list/cli-client/source/commands/complete/TodoCLI-Command-Complete.js +84 -0
- package/examples/todo-list/cli-client/source/commands/list/TodoCLI-Command-List.js +110 -0
- package/examples/todo-list/cli-client/source/commands/remove/TodoCLI-Command-Remove.js +49 -0
- package/examples/todo-list/cli-client/source/services/TodoCLI-Service-API.js +92 -0
- package/examples/todo-list/console-client/console-client.cjs +913 -0
- package/examples/todo-list/console-client/package-lock.json +426 -0
- package/examples/todo-list/console-client/package.json +19 -0
- package/examples/todo-list/console-client/views/PictView-TUI-Header.cjs +43 -0
- package/examples/todo-list/console-client/views/PictView-TUI-Layout.cjs +58 -0
- package/examples/todo-list/console-client/views/PictView-TUI-StatusBar.cjs +41 -0
- package/examples/todo-list/console-client/views/PictView-TUI-TaskList.cjs +104 -0
- package/examples/todo-list/docker-motd.sh +36 -0
- package/examples/todo-list/docker-run.sh +2 -0
- package/examples/todo-list/docker-shell.sh +2 -0
- package/examples/todo-list/model/MeadowSchema-Task.json +152 -0
- package/examples/todo-list/model/Task-Compiled.json +25 -0
- package/examples/todo-list/model/Task.mddl +15 -0
- package/examples/todo-list/model/data/seeded_todo_events.csv +1001 -0
- package/examples/todo-list/server/database-initialization-service.cjs +273 -0
- package/examples/todo-list/server/package-lock.json +6113 -0
- package/examples/todo-list/server/package.json +19 -0
- package/examples/todo-list/server/server.cjs +138 -0
- package/examples/todo-list/web-client/css/todolist-theme.css +235 -0
- package/examples/todo-list/web-client/generate-build-config.cjs +18 -0
- package/examples/todo-list/web-client/html/index.html +18 -0
- package/examples/todo-list/web-client/package-lock.json +12030 -0
- package/examples/todo-list/web-client/package.json +43 -0
- package/examples/todo-list/web-client/source/TodoList-Application-Config.json +12 -0
- package/examples/todo-list/web-client/source/TodoList-Application.cjs +383 -0
- package/examples/todo-list/web-client/source/providers/Provider-TaskData.cjs +243 -0
- package/examples/todo-list/web-client/source/providers/Router-Config.json +32 -0
- package/examples/todo-list/web-client/source/views/View-Layout.cjs +75 -0
- package/examples/todo-list/web-client/source/views/View-TaskForm.cjs +87 -0
- package/examples/todo-list/web-client/source/views/View-TaskList.cjs +127 -0
- package/examples/todo-list/web-client/source/views/calendar/View-MonthView.cjs +293 -0
- package/examples/todo-list/web-client/source/views/calendar/View-WeekView.cjs +149 -0
- package/examples/todo-list/web-client/source/views/calendar/View-YearView.cjs +226 -0
- package/modules/Include-Retold-Module-List.sh +2 -2
- package/package.json +5 -5
- package/docs/js/pict.min.js +0 -12
- package/docs/js/pict.min.js.map +0 -1
- package/docs/pict-docuserve.min.js +0 -58
- package/docs/pict-docuserve.min.js.map +0 -1
- /package/docs/{architecture.md → architecture/architecture.md} +0 -0
- /package/docs/{fable.md → modules/fable.md} +0 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
const libPictView = require('pict-view');
|
|
2
|
+
|
|
3
|
+
const _ViewConfiguration =
|
|
4
|
+
{
|
|
5
|
+
ViewIdentifier: 'TUI-TaskList',
|
|
6
|
+
|
|
7
|
+
DefaultRenderable: 'TUI-TaskList-Content',
|
|
8
|
+
DefaultDestinationAddress: '#TUI-Content',
|
|
9
|
+
DefaultTemplateRecordAddress: 'AppData.TodoList',
|
|
10
|
+
|
|
11
|
+
AutoRender: false,
|
|
12
|
+
|
|
13
|
+
Templates:
|
|
14
|
+
[
|
|
15
|
+
{
|
|
16
|
+
Hash: 'TUI-TaskList-Template',
|
|
17
|
+
Template: '{~D:Record.TaskListDisplay~}'
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
|
|
21
|
+
Renderables:
|
|
22
|
+
[
|
|
23
|
+
{
|
|
24
|
+
RenderableHash: 'TUI-TaskList-Content',
|
|
25
|
+
TemplateHash: 'TUI-TaskList-Template',
|
|
26
|
+
ContentDestinationAddress: '#TUI-Content',
|
|
27
|
+
RenderMethod: 'replace'
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
class TUITaskListView extends libPictView
|
|
33
|
+
{
|
|
34
|
+
constructor(pFable, pOptions, pServiceHash)
|
|
35
|
+
{
|
|
36
|
+
super(pFable, pOptions, pServiceHash);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
onBeforeRender()
|
|
40
|
+
{
|
|
41
|
+
// Build a formatted text display of tasks for the blessed widget
|
|
42
|
+
let tmpTasks = this.pict.AppData.TodoList.Tasks;
|
|
43
|
+
let tmpSelectedIndex = this.pict.AppData.TodoList.SelectedIndex;
|
|
44
|
+
let tmpLines = [];
|
|
45
|
+
|
|
46
|
+
if (!tmpTasks || tmpTasks.length === 0)
|
|
47
|
+
{
|
|
48
|
+
tmpLines.push('');
|
|
49
|
+
tmpLines.push(' No tasks found. Press [A] to add one.');
|
|
50
|
+
this.pict.AppData.TodoList.TaskListDisplay = tmpLines.join('\n');
|
|
51
|
+
return super.onBeforeRender();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Column header
|
|
55
|
+
let tmpHeader = ' ' + _padRight('#', 4) + _padRight('Name', 30) + _padRight('Due Date', 14) + _padRight('Hours', 8) + _padRight('Status', 14);
|
|
56
|
+
tmpLines.push('{bold}' + tmpHeader + '{/bold}');
|
|
57
|
+
tmpLines.push(' ' + '-'.repeat(68));
|
|
58
|
+
|
|
59
|
+
for (let i = 0; i < tmpTasks.length; i++)
|
|
60
|
+
{
|
|
61
|
+
let tmpTask = tmpTasks[i];
|
|
62
|
+
let tmpDueDate = tmpTask.DueDate || '-';
|
|
63
|
+
// Truncate date to just the date part if it has a time component
|
|
64
|
+
if (tmpDueDate.length > 10)
|
|
65
|
+
{
|
|
66
|
+
tmpDueDate = tmpDueDate.substring(0, 10);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
let tmpLine = ' ' +
|
|
70
|
+
_padRight(String(tmpTask.IDTask), 4) +
|
|
71
|
+
_padRight((tmpTask.Name || '').substring(0, 28), 30) +
|
|
72
|
+
_padRight(tmpDueDate, 14) +
|
|
73
|
+
_padRight(String(tmpTask.LengthInHours || 0), 8) +
|
|
74
|
+
_padRight(tmpTask.Status || '-', 14);
|
|
75
|
+
|
|
76
|
+
if (i === tmpSelectedIndex)
|
|
77
|
+
{
|
|
78
|
+
tmpLine = '{inverse}' + tmpLine + '{/inverse}';
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
tmpLines.push(tmpLine);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
this.pict.AppData.TodoList.TaskListDisplay = tmpLines.join('\n');
|
|
85
|
+
|
|
86
|
+
return super.onBeforeRender();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Pad a string to a fixed width (right-padded with spaces).
|
|
92
|
+
*/
|
|
93
|
+
function _padRight(pString, pWidth)
|
|
94
|
+
{
|
|
95
|
+
let tmpStr = String(pString || '');
|
|
96
|
+
if (tmpStr.length >= pWidth)
|
|
97
|
+
{
|
|
98
|
+
return tmpStr.substring(0, pWidth);
|
|
99
|
+
}
|
|
100
|
+
return tmpStr + ' '.repeat(pWidth - tmpStr.length);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
module.exports = TUITaskListView;
|
|
104
|
+
module.exports.default_configuration = _ViewConfiguration;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
cat <<'BANNER'
|
|
3
|
+
|
|
4
|
+
╔══════════════════════════════════════════════════════════════╗
|
|
5
|
+
║ Retold Todo List Example ║
|
|
6
|
+
╚══════════════════════════════════════════════════════════════╝
|
|
7
|
+
|
|
8
|
+
COMMANDS
|
|
9
|
+
────────────────────────────────────────────────────────────────
|
|
10
|
+
Start the API server (also serves the web client):
|
|
11
|
+
node server/server.cjs
|
|
12
|
+
|
|
13
|
+
Once the server is running (in the background or another shell):
|
|
14
|
+
|
|
15
|
+
CLI client:
|
|
16
|
+
cd /app/cli-client && npx todo list List all tasks
|
|
17
|
+
cd /app/cli-client && npx todo list --search gym Search tasks
|
|
18
|
+
cd /app/cli-client && npx todo add "New task" Add a task
|
|
19
|
+
cd /app/cli-client && npx todo complete 42 Complete a task
|
|
20
|
+
cd /app/cli-client && npx todo remove 42 Remove a task
|
|
21
|
+
cd /app/cli-client && npx todo --help Full CLI help
|
|
22
|
+
|
|
23
|
+
Console TUI (interactive terminal UI):
|
|
24
|
+
node console-client/console-client.cjs
|
|
25
|
+
|
|
26
|
+
Web client:
|
|
27
|
+
Open http://localhost:8086 in your browser
|
|
28
|
+
|
|
29
|
+
TIPS
|
|
30
|
+
────────────────────────────────────────────────────────────────
|
|
31
|
+
Start the server in the background:
|
|
32
|
+
node server/server.cjs &
|
|
33
|
+
|
|
34
|
+
Then use the CLI or console client from this same shell.
|
|
35
|
+
|
|
36
|
+
BANNER
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Scope": "Task",
|
|
3
|
+
"DefaultIdentifier": "IDTask",
|
|
4
|
+
"Domain": "Default",
|
|
5
|
+
"Schema":
|
|
6
|
+
[
|
|
7
|
+
{
|
|
8
|
+
"Column": "IDTask",
|
|
9
|
+
"Type": "AutoIdentity"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"Column": "GUIDTask",
|
|
13
|
+
"Type": "AutoGUID"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"Column": "CreateDate",
|
|
17
|
+
"Type": "CreateDate"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"Column": "CreatingIDUser",
|
|
21
|
+
"Type": "CreateIDUser"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"Column": "UpdateDate",
|
|
25
|
+
"Type": "UpdateDate"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"Column": "UpdatingIDUser",
|
|
29
|
+
"Type": "UpdateIDUser"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"Column": "Deleted",
|
|
33
|
+
"Type": "Deleted"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"Column": "DeleteDate",
|
|
37
|
+
"Type": "DeleteDate"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"Column": "DeletingIDUser",
|
|
41
|
+
"Type": "DeleteIDUser"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"Column": "Name",
|
|
45
|
+
"Type": "String",
|
|
46
|
+
"Size": "200"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"Column": "Description",
|
|
50
|
+
"Type": "Text"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"Column": "DueDate",
|
|
54
|
+
"Type": "DateTime"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"Column": "LengthInHours",
|
|
58
|
+
"Type": "Decimal",
|
|
59
|
+
"Size": "10,2"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"Column": "Status",
|
|
63
|
+
"Type": "String",
|
|
64
|
+
"Size": "32"
|
|
65
|
+
}
|
|
66
|
+
],
|
|
67
|
+
"DefaultObject":
|
|
68
|
+
{
|
|
69
|
+
"IDTask": 0,
|
|
70
|
+
"GUIDTask": "00000000-0000-0000-0000-000000000000",
|
|
71
|
+
"CreateDate": null,
|
|
72
|
+
"CreatingIDUser": 0,
|
|
73
|
+
"UpdateDate": null,
|
|
74
|
+
"UpdatingIDUser": 0,
|
|
75
|
+
"Deleted": 0,
|
|
76
|
+
"DeleteDate": null,
|
|
77
|
+
"DeletingIDUser": 0,
|
|
78
|
+
"Name": "",
|
|
79
|
+
"Description": "",
|
|
80
|
+
"DueDate": null,
|
|
81
|
+
"LengthInHours": 0,
|
|
82
|
+
"Status": "Pending"
|
|
83
|
+
},
|
|
84
|
+
"JsonSchema":
|
|
85
|
+
{
|
|
86
|
+
"title": "Task",
|
|
87
|
+
"type": "object",
|
|
88
|
+
"properties":
|
|
89
|
+
{
|
|
90
|
+
"IDTask":
|
|
91
|
+
{
|
|
92
|
+
"type": "integer"
|
|
93
|
+
},
|
|
94
|
+
"GUIDTask":
|
|
95
|
+
{
|
|
96
|
+
"type": "string"
|
|
97
|
+
},
|
|
98
|
+
"CreateDate":
|
|
99
|
+
{
|
|
100
|
+
"type": "string"
|
|
101
|
+
},
|
|
102
|
+
"CreatingIDUser":
|
|
103
|
+
{
|
|
104
|
+
"type": "integer"
|
|
105
|
+
},
|
|
106
|
+
"UpdateDate":
|
|
107
|
+
{
|
|
108
|
+
"type": "string"
|
|
109
|
+
},
|
|
110
|
+
"UpdatingIDUser":
|
|
111
|
+
{
|
|
112
|
+
"type": "integer"
|
|
113
|
+
},
|
|
114
|
+
"Deleted":
|
|
115
|
+
{
|
|
116
|
+
"type": "boolean"
|
|
117
|
+
},
|
|
118
|
+
"DeleteDate":
|
|
119
|
+
{
|
|
120
|
+
"type": "string"
|
|
121
|
+
},
|
|
122
|
+
"DeletingIDUser":
|
|
123
|
+
{
|
|
124
|
+
"type": "integer"
|
|
125
|
+
},
|
|
126
|
+
"Name":
|
|
127
|
+
{
|
|
128
|
+
"type": "string"
|
|
129
|
+
},
|
|
130
|
+
"Description":
|
|
131
|
+
{
|
|
132
|
+
"type": "string"
|
|
133
|
+
},
|
|
134
|
+
"DueDate":
|
|
135
|
+
{
|
|
136
|
+
"type": "string"
|
|
137
|
+
},
|
|
138
|
+
"LengthInHours":
|
|
139
|
+
{
|
|
140
|
+
"type": "number"
|
|
141
|
+
},
|
|
142
|
+
"Status":
|
|
143
|
+
{
|
|
144
|
+
"type": "string"
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
"required":
|
|
148
|
+
[
|
|
149
|
+
"IDTask"
|
|
150
|
+
]
|
|
151
|
+
}
|
|
152
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Tables":
|
|
3
|
+
[
|
|
4
|
+
{
|
|
5
|
+
"TableName": "Task",
|
|
6
|
+
"Columns":
|
|
7
|
+
[
|
|
8
|
+
{ "Column": "IDTask", "DataType": "ID" },
|
|
9
|
+
{ "Column": "GUIDTask", "DataType": "GUID" },
|
|
10
|
+
{ "Column": "Name", "DataType": "String", "Size": "200" },
|
|
11
|
+
{ "Column": "Description", "DataType": "Text" },
|
|
12
|
+
{ "Column": "DueDate", "DataType": "DateTime" },
|
|
13
|
+
{ "Column": "LengthInHours", "DataType": "Decimal", "Size": "10,2" },
|
|
14
|
+
{ "Column": "Status", "DataType": "String", "Size": "32" },
|
|
15
|
+
{ "Column": "CreateDate", "DataType": "DateTime" },
|
|
16
|
+
{ "Column": "CreatingIDUser", "DataType": "ForeignKey" },
|
|
17
|
+
{ "Column": "UpdateDate", "DataType": "DateTime" },
|
|
18
|
+
{ "Column": "UpdatingIDUser", "DataType": "ForeignKey" },
|
|
19
|
+
{ "Column": "Deleted", "DataType": "Boolean" },
|
|
20
|
+
{ "Column": "DeleteDate", "DataType": "DateTime" },
|
|
21
|
+
{ "Column": "DeletingIDUser", "DataType": "ForeignKey" }
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
}
|