Skip to content

Commit 66cf79b

Browse files
committed
Trim SDK section in README
1 parent ed7ba84 commit 66cf79b

File tree

1 file changed

+9
-161
lines changed

1 file changed

+9
-161
lines changed

README.md

Lines changed: 9 additions & 161 deletions
Original file line numberDiff line numberDiff line change
@@ -18,172 +18,20 @@ TPS bridges this gap: it is human-readable markdown that any text editor can ope
1818

1919
## SDK
2020

21-
TPS now includes a `ManagedCode.Tps` SDK workspace for parsing, validation, compilation, and playback.
21+
TPS includes the `ManagedCode.Tps` SDK workspace for parsing, validation, compilation, and playback.
2222

2323
- **SDK catalog page:** [tps.managed-code.com/sdk](https://tps.managed-code.com/sdk/)
24-
- **SDK glossary:** [docs/Glossary.md](https://github.com/managedcode/TPS/blob/main/docs/Glossary.md)
25-
26-
### Runtime Catalog
27-
28-
| Runtime | Status | Workspace | Notes |
29-
|---------|--------|-----------|-------|
30-
| **TypeScript** | Active | [SDK/ts](https://github.com/managedcode/TPS/tree/main/SDK/ts) | Canonical typed TPS implementation |
31-
| **JavaScript** | Active | [SDK/js](https://github.com/managedcode/TPS/tree/main/SDK/js) | Built consumer runtime generated from TypeScript |
32-
| **.NET / C#** | Active | [SDK/dotnet](https://github.com/managedcode/TPS/tree/main/SDK/dotnet) | `ManagedCode.Tps` runtime and xUnit suite |
33-
| **Flutter** | Active | [SDK/flutter](https://github.com/managedcode/TPS/tree/main/SDK/flutter) | Dart runtime for Flutter hosts |
34-
| **Swift** | Active | [SDK/swift](https://github.com/managedcode/TPS/tree/main/SDK/swift) | Native Swift package for Apple-platform apps |
35-
| **Java** | Active | [SDK/java](https://github.com/managedcode/TPS/tree/main/SDK/java) | Standalone Java runtime under `com.managedcode.tps` |
36-
37-
Each active SDK exposes the same core contract:
38-
39-
- **Constants catalog** — TPS keywords, tags, metadata keys, emotions, and diagnostics
40-
- **Validation API** — actionable TPS format diagnostics
41-
- **Parser API** — TPS document model generation
42-
- **Compiler API** — JSON-friendly timed state machine generation with a stable wire contract
43-
- **Player API** — deterministic state resolution plus stand-alone playback control for embeddable hosts
44-
45-
All six active runtimes participate in repo-wide build/test CI and now have separate `90%+` coverage gates.
46-
47-
The active SDKs now split playback into three layers:
48-
49-
- **`TpsPlayer`** — pure resolver for `GetState(elapsed)` / sampling
50-
- **`TpsPlaybackSession`** — timer-driven runtime controller with `play`, `pause`, `seek`, `advanceBy`, `nextWord`, `previousWord`, `nextBlock`, `previousBlock`, and speed correction
51-
- **`TpsStandalonePlayer`** — compile-and-play wrapper that starts from raw TPS source and exposes bindable runtime snapshots, commands, and transport events
52-
53-
Language-specific SDK documentation:
54-
5524
- **Workspace overview:** [SDK/README.md](https://github.com/managedcode/TPS/blob/main/SDK/README.md)
56-
- **TypeScript docs:** [SDK/ts/README.md](https://github.com/managedcode/TPS/blob/main/SDK/ts/README.md)
57-
- **JavaScript docs:** [SDK/js/README.md](https://github.com/managedcode/TPS/blob/main/SDK/js/README.md)
58-
- **.NET docs:** [SDK/dotnet/README.md](https://github.com/managedcode/TPS/blob/main/SDK/dotnet/README.md)
59-
- **Flutter docs:** [SDK/flutter/README.md](https://github.com/managedcode/TPS/blob/main/SDK/flutter/README.md)
60-
- **Swift docs:** [SDK/swift/README.md](https://github.com/managedcode/TPS/blob/main/SDK/swift/README.md)
61-
- **Java docs:** [SDK/java/README.md](https://github.com/managedcode/TPS/blob/main/SDK/java/README.md)
62-
63-
### Embedding In UI Apps
64-
65-
The SDKs are designed to be embedded into other applications without owning the UI layer themselves.
66-
67-
Recommended host pattern:
68-
69-
1. Compile TPS source with `TpsStandalonePlayer` when your host starts from raw `.tps` text.
70-
2. Use `TpsPlaybackSession` when your host already has the compiled state machine.
71-
3. Restore precompiled JSON into the standalone player when your host downloads or caches a compiled TPS state machine.
72-
4. Bind UI buttons directly to runtime commands:
73-
`play`, `pause`, `stop`, `seek`, `advanceBy`, `nextWord`, `previousWord`, `nextBlock`, `previousBlock`, `increaseSpeed`, `decreaseSpeed`, `setSpeedOffsetWpm`.
74-
5. Render from runtime snapshots, not from ad hoc host state.
75-
76-
Each snapshot is intended to be a UI view-model and includes:
77-
78-
- playback status and current progress
79-
- current segment, block, phrase, and focused word
80-
- visible words with `read`, `active`, and `upcoming` state
81-
- effective tempo information: base WPM, global offset, effective WPM, playback rate
82-
- control availability for transport and speed buttons
83-
84-
For convenient host wiring, the active SDKs expose snapshot observation helpers:
85-
86-
- TypeScript / JavaScript: `observeSnapshot(listener, emitCurrent = true)`
87-
- C#: `ObserveSnapshot(Action<TpsPlaybackSnapshot> observer, bool emitCurrent = true)`
88-
89-
This lets a UI receive the current runtime model immediately and then keep rendering on every playback update.
90-
91-
On .NET, `ObserveSnapshot(...)` and runtime events can be dispatched through `TpsPlaybackSessionOptions.EventSynchronizationContext`, and callback failures are surfaced through `ListenerException` instead of being silently swallowed.
92-
93-
```csharp
94-
using var player = TpsStandalonePlayer.Compile(tpsSource);
95-
using var subscription = player.ObserveSnapshot(snapshot =>
96-
{
97-
Render(snapshot);
98-
});
99-
100-
playButton.Click += (_, _) => player.Play();
101-
pauseButton.Click += (_, _) => player.Pause();
102-
nextWordButton.Click += (_, _) => player.NextWord();
103-
slowerButton.Click += (_, _) => player.DecreaseSpeed();
104-
```
105-
106-
```ts
107-
const player = TpsStandalonePlayer.compile(tpsSource);
108-
const dispose = player.observeSnapshot((snapshot) => {
109-
render(snapshot);
110-
});
111-
112-
playButton.onclick = () => player.play();
113-
pauseButton.onclick = () => player.pause();
114-
nextWordButton.onclick = () => player.nextWord();
115-
slowerButton.onclick = () => player.decreaseSpeed();
116-
```
25+
- **Glossary:** [docs/Glossary.md](https://github.com/managedcode/TPS/blob/main/docs/Glossary.md)
11726

118-
### Compile Once, Play Anywhere
27+
### Runtime Links
11928

120-
The compiled TPS state machine is meant to be portable across runtimes and hosts:
121-
122-
- property names are camelCase by default
123-
- `severity` and playback `status` serialize as lowercase strings
124-
- the compiled graph is safe to store as JSON and restore later into a player
125-
126-
Minimal .NET roundtrip:
127-
128-
```csharp
129-
using System.Text.Json;
130-
using ManagedCode.Tps;
131-
132-
var compiled = TpsRuntime.Compile(source).Script;
133-
var json = JsonSerializer.Serialize(compiled);
134-
135-
using var player = TpsStandalonePlayer.FromCompiledJson(json);
136-
using var subscription = player.ObserveSnapshot(Render);
137-
138-
player.Play();
139-
```
140-
141-
When a .NET standalone player starts from compiled JSON instead of raw TPS source, `HasSourceCompilation` is `false` and `Document` is a projected structural view of the compiled graph. That projected document is suitable for host UI labels and navigation, but it does not recreate original authoring text content.
142-
143-
## UI Integration Contract
144-
145-
TPS SDKs are intentionally renderer-agnostic. They do not own your HTML, Razor, MAUI, WPF, WinUI, React, or canvas UI. Instead, the embeddable playback layer exposes a host-facing contract:
146-
147-
- **Commands**: `play`, `pause`, `stop`, `seek`, `advanceBy`, `nextWord`, `previousWord`, `nextBlock`, `previousBlock`, `increaseSpeed`, `decreaseSpeed`, `setSpeedOffsetWpm`
148-
- **Transport state**: current elapsed time, progress, completion, current segment/block/phrase/word
149-
- **Snapshot view-model**: visible words, focused word, read/upcoming state, timing, emotion, speaker, highlight/emphasis/volume/delivery metadata
150-
- **Control gating**: `canPlay`, `canPause`, `canStop`, `canNextWord`, `canPreviousWord`, `canNextBlock`, `canPreviousBlock`, `canIncreaseSpeed`, `canDecreaseSpeed`
151-
- **Events**: runtime state change events plus `snapshotChanged` for UI rerender
152-
153-
Recommended host flow:
154-
155-
1. Compile TPS into a state machine.
156-
2. Bind your buttons and shortcuts to the playback commands.
157-
3. Render the current screen from the snapshot object, not from ad-hoc derived state.
158-
4. Use `controls.*` to enable or disable UI affordances consistently across platforms.
159-
160-
On .NET hosts with a UI thread, configure `TpsPlaybackSessionOptions.EventSynchronizationContext` or create the player on the target UI thread so `SnapshotChanged` arrives on the correct dispatcher. For deterministic tests or host-controlled time, use `TpsPlaybackSessionOptions.TimeProvider`.
161-
162-
Minimal .NET host:
163-
164-
```csharp
165-
using ManagedCode.Tps;
166-
167-
using var player = TpsStandalonePlayer.Compile(source);
168-
player.SnapshotChanged += (_, args) => Render(args.Snapshot);
169-
170-
player.Play();
171-
player.NextWord();
172-
player.DecreaseSpeed();
173-
```
174-
175-
Minimal TypeScript host:
176-
177-
```ts
178-
import { TpsStandalonePlayer } from "managedcode.tps";
179-
180-
const player = TpsStandalonePlayer.compile(source);
181-
const unsubscribe = player.onSnapshotChanged((snapshot) => render(snapshot));
182-
183-
player.play();
184-
player.nextBlock();
185-
player.increaseSpeed();
186-
```
29+
- **TypeScript:** [SDK/ts](https://github.com/managedcode/TPS/tree/main/SDK/ts)
30+
- **JavaScript:** [SDK/js](https://github.com/managedcode/TPS/tree/main/SDK/js)
31+
- **.NET / C#:** [SDK/dotnet](https://github.com/managedcode/TPS/tree/main/SDK/dotnet)
32+
- **Flutter:** [SDK/flutter](https://github.com/managedcode/TPS/tree/main/SDK/flutter)
33+
- **Swift:** [SDK/swift](https://github.com/managedcode/TPS/tree/main/SDK/swift)
34+
- **Java:** [SDK/java](https://github.com/managedcode/TPS/tree/main/SDK/java)
18735

18836
## Reference Coverage
18937

0 commit comments

Comments
 (0)