@go-go-golems/pbui-core 0.1.0
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/README.md +73 -0
- package/builder.d.ts +74 -0
- package/builder.js +191 -0
- package/command.d.ts +91 -0
- package/command.js +64 -0
- package/docline.d.ts +5 -0
- package/docline.js +43 -0
- package/engine.d.ts +177 -0
- package/engine.js +790 -0
- package/index.d.ts +10 -0
- package/index.js +10 -0
- package/invocation.d.ts +34 -0
- package/invocation.js +71 -0
- package/package.json +25 -0
- package/ptype.d.ts +40 -0
- package/ptype.js +103 -0
- package/registry.d.ts +40 -0
- package/registry.js +143 -0
- package/transcript-text.d.ts +3 -0
- package/transcript-text.js +31 -0
- package/transcript.d.ts +16 -0
- package/transcript.js +49 -0
- package/types.d.ts +83 -0
- package/types.js +29 -0
package/types.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/* Shared core types for the PBUI engine.
|
|
2
|
+
*
|
|
3
|
+
* Presentations hold ObjectRefs (never live objects) and are resolved
|
|
4
|
+
* through a Resolver at gesture/execution time, so stale presentations
|
|
5
|
+
* degrade gracefully (design decision D5).
|
|
6
|
+
*/
|
|
7
|
+
export function valueRef(value) {
|
|
8
|
+
return { kind: "value", value };
|
|
9
|
+
}
|
|
10
|
+
export function refEquals(a, b) {
|
|
11
|
+
if ("value" in a && "value" in b)
|
|
12
|
+
return a.value === b.value;
|
|
13
|
+
if ("id" in a && "id" in b)
|
|
14
|
+
return a.kind === b.kind && a.id === b.id;
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
export function toPart(p) {
|
|
18
|
+
return typeof p === "string" ? { t: "text", s: p } : p;
|
|
19
|
+
}
|
|
20
|
+
/* part constructors, named after the scheduler's S/B/TASKREF algebra */
|
|
21
|
+
export const S = (s) => ({ t: "text", s });
|
|
22
|
+
export const B = (s) => ({ t: "bold", s });
|
|
23
|
+
export const E = (s) => ({ t: "err", s });
|
|
24
|
+
export const P = (type, ref, label) => ({
|
|
25
|
+
t: "pres",
|
|
26
|
+
type,
|
|
27
|
+
ref,
|
|
28
|
+
label,
|
|
29
|
+
});
|