@tannerbroberts/about-time-core 0.2.0 → 0.2.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/dist/templates/deleteTemplate.js +1 -1
- package/dist/templates/deleteTemplate.js.map +1 -1
- package/dist/templates/getVocabulary.d.ts.map +1 -1
- package/dist/templates/getVocabulary.js +1 -1
- package/dist/templates/getVocabulary.js.map +1 -1
- package/package.json +7 -2
- package/README.md +0 -141
- package/dist/types/library.d.ts +0 -7
- package/dist/types/library.d.ts.map +0 -1
- package/dist/types/library.js +0 -2
- package/dist/types/library.js.map +0 -1
|
@@ -26,7 +26,7 @@ export function deleteTemplate(id, templates) {
|
|
|
26
26
|
// 2. Remove this template from its parents' segments
|
|
27
27
|
for (const ref of existing.references) {
|
|
28
28
|
const parent = templates[ref.parentId];
|
|
29
|
-
if (parent
|
|
29
|
+
if (parent?.templateType === 'lane') {
|
|
30
30
|
parent.segments = parent.segments.filter(s => !(s.templateId === id && s.relationshipId === ref.relationshipId));
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deleteTemplate.js","sourceRoot":"","sources":["../../src/templates/deleteTemplate.ts"],"names":[],"mappings":"AAMA;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAC5B,EAAc,EACd,SAAsB;IAEtB,MAAM,QAAQ,GAAG,SAAS,CAAC,EAAE,CAAC,CAAC;IAE/B,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,oBAAoB,EAAE,YAAY;SAC1C,CAAC;IACJ,CAAC;IAED,kEAAkE;IAClE,IAAI,QAAQ,CAAC,YAAY,KAAK,MAAM,EAAE,CAAC;QACrC,KAAK,MAAM,OAAO,IAAI,QAAQ,CAAC,QAAQ,EAAE,CAAC;YACxC,MAAM,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,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IACH,CAAC;IAED,qDAAqD;IACrD,KAAK,MAAM,GAAG,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC;QACtC,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACvC,IAAI,MAAM,EAAE,YAAY,KAAK,MAAM,EAAE,CAAC;YACpC,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CACtC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,KAAK,EAAE,IAAI,CAAC,CAAC,cAAc,KAAK,GAAG,CAAC,cAAc,CAAC,CACvE,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC,EAAE,CAAC,CAAC;IAErB,OAAO;QACL,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,QAAQ;KAClB,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getVocabulary.d.ts","sourceRoot":"","sources":["../../src/templates/getVocabulary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"getVocabulary.d.ts","sourceRoot":"","sources":["../../src/templates/getVocabulary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEnE;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,WAAW,GAAG,YAAY,EAAE,CAgBpE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getVocabulary.js","sourceRoot":"","sources":["../../src/templates/getVocabulary.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,SAAsB;IAClD,MAAM,SAAS,GAAG,IAAI,GAAG,EAAgB,CAAC;IAE1C,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC;QAChD,IAAI,QAAQ,CAAC,YAAY,KAAK,MAAM,EAAE,CAAC;YACrC,MAAM,IAAI,GAAG,
|
|
1
|
+
{"version":3,"file":"getVocabulary.js","sourceRoot":"","sources":["../../src/templates/getVocabulary.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,SAAsB;IAClD,MAAM,SAAS,GAAG,IAAI,GAAG,EAAgB,CAAC;IAE1C,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC;QAChD,IAAI,QAAQ,CAAC,YAAY,KAAK,MAAM,EAAE,CAAC;YACrC,MAAM,IAAI,GAAG,QAAQ,CAAC;YACtB,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;gBACpD,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YACzB,CAAC;YACD,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;gBACpD,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YACzB,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;AAClE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tannerbroberts/about-time-core",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Core template operations and validation for about-time",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/tannerbroberts/about-time-core.git"
|
|
8
8
|
},
|
|
9
9
|
"author": "Tanner Roberts",
|
|
10
|
-
"keywords": [
|
|
10
|
+
"keywords": [
|
|
11
|
+
"time",
|
|
12
|
+
"templates",
|
|
13
|
+
"scheduling",
|
|
14
|
+
"validation"
|
|
15
|
+
],
|
|
11
16
|
"type": "module",
|
|
12
17
|
"main": "./dist/index.js",
|
|
13
18
|
"types": "./dist/index.d.ts",
|
package/README.md
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
# @tannerbroberts/about-time-core
|
|
2
|
-
|
|
3
|
-
Core template operations and validation for about-time.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install @tannerbroberts/about-time-core
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Core Concepts
|
|
12
|
-
|
|
13
|
-
Templates represent scheduled activities. There are two types:
|
|
14
|
-
|
|
15
|
-
- **BusyTemplate**: An atomic task with a duration (e.g., "Boil water for 5 minutes")
|
|
16
|
-
- **LaneTemplate**: A container that holds other templates at specific time offsets
|
|
17
|
-
|
|
18
|
-
### Visual Representation
|
|
19
|
-
|
|
20
|
-
> ⚠️ **Note**: The `visualizeLane` function is a **debugging/development utility only**. It's useful for understanding lane structures during development, but production applications should use a proper frontend UI for visualization.
|
|
21
|
-
|
|
22
|
-
Templates can be visualized using ASCII art where each character represents 1 second:
|
|
23
|
-
|
|
24
|
-
```
|
|
25
|
-
█░██ ← grandchild busy templates
|
|
26
|
-
░______░░░░ ← child lane segment
|
|
27
|
-
____________ ← root lane (12 seconds)
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
Legend:
|
|
31
|
-
- `█` = busy template (active work)
|
|
32
|
-
- `_` = lane template (container)
|
|
33
|
-
- `░` = empty space (gap within a lane)
|
|
34
|
-
- ` ` = outside the lane's span
|
|
35
|
-
|
|
36
|
-
## Usage
|
|
37
|
-
|
|
38
|
-
```typescript
|
|
39
|
-
import {
|
|
40
|
-
createBusyTemplate,
|
|
41
|
-
createLaneTemplate,
|
|
42
|
-
visualizeLane,
|
|
43
|
-
TemplateMap,
|
|
44
|
-
} from '@tannerbroberts/about-time-core';
|
|
45
|
-
|
|
46
|
-
const templates: TemplateMap = {};
|
|
47
|
-
|
|
48
|
-
// Create busy templates
|
|
49
|
-
const prep = createBusyTemplate({
|
|
50
|
-
intent: 'Prep ingredients',
|
|
51
|
-
estimatedDuration: 2000, // 2 seconds
|
|
52
|
-
}, templates, crypto.randomUUID);
|
|
53
|
-
|
|
54
|
-
const cook = createBusyTemplate({
|
|
55
|
-
intent: 'Cook',
|
|
56
|
-
estimatedDuration: 3000, // 3 seconds
|
|
57
|
-
}, templates, crypto.randomUUID);
|
|
58
|
-
|
|
59
|
-
// Create a lane to organize the tasks
|
|
60
|
-
const recipe = createLaneTemplate({
|
|
61
|
-
intent: 'Make dinner',
|
|
62
|
-
estimatedDuration: 8000, // 8 seconds
|
|
63
|
-
segments: [
|
|
64
|
-
{ templateId: prep.id, relationshipId: 'r1', offset: 0 },
|
|
65
|
-
{ templateId: cook.id, relationshipId: 'r2', offset: 3000 },
|
|
66
|
-
],
|
|
67
|
-
}, templates, crypto.randomUUID);
|
|
68
|
-
|
|
69
|
-
// Visualize the lane
|
|
70
|
-
console.log(visualizeLane(recipe.id, templates));
|
|
71
|
-
// Output:
|
|
72
|
-
// ██░███░░
|
|
73
|
-
// ________
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
### Nested Lanes
|
|
77
|
-
|
|
78
|
-
Lanes can contain other lanes, enabling complex scheduling hierarchies:
|
|
79
|
-
|
|
80
|
-
```typescript
|
|
81
|
-
const task = createBusyTemplate({
|
|
82
|
-
intent: 'Task',
|
|
83
|
-
estimatedDuration: 1000,
|
|
84
|
-
}, templates, crypto.randomUUID);
|
|
85
|
-
|
|
86
|
-
const innerLane = createLaneTemplate({
|
|
87
|
-
intent: 'Inner',
|
|
88
|
-
estimatedDuration: 2000,
|
|
89
|
-
segments: [{ templateId: task.id, relationshipId: 'r1', offset: 0 }],
|
|
90
|
-
}, templates, crypto.randomUUID);
|
|
91
|
-
|
|
92
|
-
const middleLane = createLaneTemplate({
|
|
93
|
-
intent: 'Middle',
|
|
94
|
-
estimatedDuration: 4000,
|
|
95
|
-
segments: [{ templateId: innerLane.id, relationshipId: 'r2', offset: 1000 }],
|
|
96
|
-
}, templates, crypto.randomUUID);
|
|
97
|
-
|
|
98
|
-
const rootLane = createLaneTemplate({
|
|
99
|
-
intent: 'Root',
|
|
100
|
-
estimatedDuration: 6000,
|
|
101
|
-
segments: [{ templateId: middleLane.id, relationshipId: 'r3', offset: 1000 }],
|
|
102
|
-
}, templates, crypto.randomUUID);
|
|
103
|
-
|
|
104
|
-
console.log(visualizeLane(rootLane.id, templates));
|
|
105
|
-
// Output:
|
|
106
|
-
// █░ ← task (deepest)
|
|
107
|
-
// ░__░ ← inner lane
|
|
108
|
-
// ░____░ ← middle lane
|
|
109
|
-
// ______ ← root lane
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
### Resource Management
|
|
113
|
-
|
|
114
|
-
Templates can track resource consumption and production:
|
|
115
|
-
|
|
116
|
-
```typescript
|
|
117
|
-
const boilWater = createBusyTemplate({
|
|
118
|
-
intent: 'Boil water',
|
|
119
|
-
estimatedDuration: 5000,
|
|
120
|
-
willConsume: { water_cups: 2, clean_pot: 1 },
|
|
121
|
-
willProduce: { boiling_water_cups: 2 },
|
|
122
|
-
}, templates, crypto.randomUUID);
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
## Exports
|
|
126
|
-
|
|
127
|
-
| Path | Description |
|
|
128
|
-
|------|-------------|
|
|
129
|
-
| `@tannerbroberts/about-time-core` | Everything |
|
|
130
|
-
| `@tannerbroberts/about-time-core/types` | Type definitions only |
|
|
131
|
-
| `@tannerbroberts/about-time-core/templates` | Template CRUD + layout operations |
|
|
132
|
-
| `@tannerbroberts/about-time-core/layout` | Layout utilities only (visualizeLane, packSegments, etc.) |
|
|
133
|
-
| `@tannerbroberts/about-time-core/validation` | Validation functions |
|
|
134
|
-
|
|
135
|
-
## Documentation
|
|
136
|
-
|
|
137
|
-
See [spec.md](./spec.md) for complete API documentation.
|
|
138
|
-
|
|
139
|
-
## License
|
|
140
|
-
|
|
141
|
-
MIT
|
package/dist/types/library.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"library.d.ts","sourceRoot":"","sources":["../../src/types/library.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,qCAAqC;AACrC,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,QAAQ,EAAE,CAAC;CACvB"}
|
package/dist/types/library.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"library.js","sourceRoot":"","sources":["../../src/types/library.ts"],"names":[],"mappings":""}
|