@skillstech/thunderlang 1.4.2 → 1.4.3
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/CHANGELOG.md +13 -0
- package/dist/core.cjs +10 -5
- package/dist/index.cjs +1 -1
- package/dist/learn.cjs +1 -1
- package/package.json +1 -1
- package/src/core.d.ts +1 -1
- package/src/emit.mjs +1 -1
- package/src/react/reading.css +6 -3
- package/src/react/reading.d.mts +1 -1
- package/src/react/reading.mjs +13 -1
- package/src/reading-layout.d.mts +4 -2
- package/src/reading-layout.mjs +12 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
# 1.4.3
|
|
2
|
+
|
|
3
|
+
**Upgrade note.** No command, flag, exit code, or JSON shape changed. `readingLayout` can now end with a new
|
|
4
|
+
`actions` section (`id: 'actions'`); apps that switch on section ids should draw it or skip it.
|
|
5
|
+
|
|
6
|
+
- **The drawing kit: a file of plain functions is no longer an empty Big Picture.** With no focus, or a file in focus,
|
|
7
|
+
`readingLayout` now ends with an "Actions and rules" section (`id: 'actions'`, `READING_LABELS.actions`): every
|
|
8
|
+
action or rule that belongs to no Thing, with its symbol and doc, and `BigPicture` draws each as a door to open
|
|
9
|
+
(`onOpen`). A Thing's own abilities stay on its card. Before, a file with only functions drew nothing.
|
|
10
|
+
- **Fix: the kit on phones and in panels.** The Yes / No / Otherwise tags in Flow and Details no longer break inside
|
|
11
|
+
a word on a narrow screen, and the Data cards size their columns from the space they are given instead of the
|
|
12
|
+
window's width, so they are no longer cramped inside a side panel.
|
|
13
|
+
|
|
1
14
|
# 1.4.2
|
|
2
15
|
|
|
3
16
|
**Upgrade note.** No command, flag, exit code, or JSON shape changed. New in `@skillstech/thunderlang/react`:
|
package/dist/core.cjs
CHANGED
|
@@ -19407,7 +19407,7 @@ function notesSummary(ast) {
|
|
|
19407
19407
|
byLens
|
|
19408
19408
|
};
|
|
19409
19409
|
}
|
|
19410
|
-
var COMPILER_VERSION = "1.4.
|
|
19410
|
+
var COMPILER_VERSION = "1.4.3";
|
|
19411
19411
|
var PROOF_SCHEMA_VERSION = "0.1.0";
|
|
19412
19412
|
var SOURCE_PRODUCT = "skillstech-compiler";
|
|
19413
19413
|
function buildContractGraph(ast, generatedAt) {
|
|
@@ -46221,6 +46221,7 @@ var READING_LABELS = Object.freeze({
|
|
|
46221
46221
|
getsNothing: "Nothing it hands back",
|
|
46222
46222
|
partOf: (label) => `Part of ${label}`,
|
|
46223
46223
|
io: "What goes in and out",
|
|
46224
|
+
actions: "Actions and rules",
|
|
46224
46225
|
// Flow: the words on each kind of edge. An edge label not listed here is shown as the compiler wrote it.
|
|
46225
46226
|
edges: Object.freeze({ yes: "Yes", no: "No", each: "For each", done: "Done", error: "If it fails", nested: "Runs on its own", case: "When" }),
|
|
46226
46227
|
openLine: (line) => `line ${line}`,
|
|
@@ -46342,17 +46343,21 @@ function detailsLayout(view2) {
|
|
|
46342
46343
|
source: view2.source ?? null
|
|
46343
46344
|
};
|
|
46344
46345
|
}
|
|
46345
|
-
var
|
|
46346
|
+
var memberEntry = (m) => ({ kind: "member", id: m.id, label: `${m.label}${m.yesNo ? "?" : ""}`, symbol: memberSymbolId(m), doc: m.doc ?? null });
|
|
46347
|
+
var sectionsFor = (model, things, loose = []) => {
|
|
46346
46348
|
const cards = things.filter((t) => t.kind === "thing").map((t) => thingCard(model, t));
|
|
46347
46349
|
const data = [...things.filter((t) => t.kind === "record"), ...things.filter((t) => t.kind === "choices")].map(dataCard);
|
|
46350
|
+
const actions = loose.map(memberEntry);
|
|
46348
46351
|
return [
|
|
46349
46352
|
...cards.length ? [{ id: "things", heading: READING_LABELS.things, cards }] : [],
|
|
46350
|
-
...data.length ? [{ id: "data", heading: READING_LABELS.data, cards: data }] : []
|
|
46353
|
+
...data.length ? [{ id: "data", heading: READING_LABELS.data, cards: data }] : [],
|
|
46354
|
+
...actions.length ? [{ id: "actions", heading: READING_LABELS.actions, cards: actions }] : []
|
|
46351
46355
|
];
|
|
46352
46356
|
};
|
|
46357
|
+
var ownerless = (model, file) => model.members.filter((m) => !m.owner && (file == null || m.file === file));
|
|
46353
46358
|
function readingLayout(model, { focus = null } = {}) {
|
|
46354
46359
|
const base2 = { schema: READING_LAYOUT_SCHEMA };
|
|
46355
|
-
if (focus == null) return { ...base2, focus: { kind: "app", id: null }, sections: sectionsFor(model, model.things) };
|
|
46360
|
+
if (focus == null) return { ...base2, focus: { kind: "app", id: null }, sections: sectionsFor(model, model.things, ownerless(model)) };
|
|
46356
46361
|
const member = model.members.find((m) => m.id === focus);
|
|
46357
46362
|
if (member) return { ...base2, focus: { kind: "member", id: focus }, sections: [{ id: "io", heading: READING_LABELS.io, cards: [ioBoxes(model, member)] }] };
|
|
46358
46363
|
const thing = model.things.find((t) => t.id === focus);
|
|
@@ -46360,7 +46365,7 @@ function readingLayout(model, { focus = null } = {}) {
|
|
|
46360
46365
|
const rest2 = model.things.filter((t) => t !== thing && t.file === thing.file && t.kind !== "thing");
|
|
46361
46366
|
return { ...base2, focus: { kind: "thing", id: focus }, sections: sectionsFor(model, [thing, ...rest2]) };
|
|
46362
46367
|
}
|
|
46363
|
-
if (model.files.some((f) => f.path === focus)) return { ...base2, focus: { kind: "file", id: focus }, sections: sectionsFor(model, model.things.filter((t) => t.file === focus)) };
|
|
46368
|
+
if (model.files.some((f) => f.path === focus)) return { ...base2, focus: { kind: "file", id: focus }, sections: sectionsFor(model, model.things.filter((t) => t.file === focus), ownerless(model, focus)) };
|
|
46364
46369
|
return { ...base2, focus: { kind: "unknown", id: focus }, sections: [] };
|
|
46365
46370
|
}
|
|
46366
46371
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/index.cjs
CHANGED
|
@@ -2585,7 +2585,7 @@ function notesSummary(ast) {
|
|
|
2585
2585
|
byLens
|
|
2586
2586
|
};
|
|
2587
2587
|
}
|
|
2588
|
-
var COMPILER_VERSION = "1.4.
|
|
2588
|
+
var COMPILER_VERSION = "1.4.3";
|
|
2589
2589
|
var PROOF_SCHEMA_VERSION = "0.1.0";
|
|
2590
2590
|
var SOURCE_PRODUCT = "skillstech-compiler";
|
|
2591
2591
|
function buildContractGraph(ast, generatedAt) {
|
package/dist/learn.cjs
CHANGED
|
@@ -17250,7 +17250,7 @@ var SEMANTIC_TYPES = Object.keys(SEMANTIC);
|
|
|
17250
17250
|
var PRIMITIVE_TYPES = Object.keys(PRIMITIVE);
|
|
17251
17251
|
|
|
17252
17252
|
// src/emit.mjs
|
|
17253
|
-
var COMPILER_VERSION = "1.4.
|
|
17253
|
+
var COMPILER_VERSION = "1.4.3";
|
|
17254
17254
|
|
|
17255
17255
|
// src/lift.mjs
|
|
17256
17256
|
var IR_SCHEMA_VERSION = "0.1.0";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skillstech/thunderlang",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.3",
|
|
4
4
|
"description": "Thunder™, the human programming language: the deterministic ThunderLang™ compiler, CLI, and Language Server. No AI required. Reads code in seventeen languages into Thunder, changes TypeScript, JavaScript, Python, and Go code from Thunder with a proof, compiles rules to six languages, and executes them: run decisions, simulate lifecycles, and check outcome contracts. Interops with DMN, BPMN, JSON Schema, and OpenAPI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.mjs",
|
package/src/core.d.ts
CHANGED
|
@@ -203,4 +203,4 @@ export function writeAcrossEvidence(result: WriteAcrossResult | { ok: false }):
|
|
|
203
203
|
|
|
204
204
|
// What a reading shows and in what order (src/reading-layout.mjs).
|
|
205
205
|
export { READING_LAYOUT_SCHEMA, READING_LABELS, readingLayout, thingCard, dataCard, ioBoxes, detailsLayout, flowEdgeLabel, memberSymbolId } from './reading-layout.mjs';
|
|
206
|
-
export type { ReadingLayout, ThingCardLayout, DataCardLayout, IOBoxesLayout, DetailsLayout, When, KnowsLine, ThunderSymbolId } from './reading-layout.d.mts';
|
|
206
|
+
export type { ReadingLayout, ThingCardLayout, DataCardLayout, IOBoxesLayout, MemberEntryLayout, DetailsLayout, When, KnowsLine, ThunderSymbolId } from './reading-layout.d.mts';
|
package/src/emit.mjs
CHANGED
|
@@ -30,7 +30,7 @@ export function notesSummary(ast) {
|
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
export const COMPILER_VERSION = '1.4.
|
|
33
|
+
export const COMPILER_VERSION = '1.4.3';
|
|
34
34
|
export const PROOF_SCHEMA_VERSION = '0.1.0';
|
|
35
35
|
// Identifies which ecosystem product emitted this proof. Consumed by SkillsTech
|
|
36
36
|
// Certified to key cert proofs to the compiler. Stable slug per the coordination bus.
|
package/src/react/reading.css
CHANGED
|
@@ -109,8 +109,11 @@
|
|
|
109
109
|
/* The Big Picture */
|
|
110
110
|
.tl-big-picture { display: grid; gap: 24px; }
|
|
111
111
|
.tl-bp-things { display: grid; gap: 20px; }
|
|
112
|
-
.tl-bp-data { display: grid; gap: 16px; grid-template-columns: 1fr; }
|
|
113
|
-
|
|
112
|
+
.tl-bp-data { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
|
|
113
|
+
.tl-bp-heading { margin: 0 0 8px !important; }
|
|
114
|
+
.tl-door-text { display: grid; gap: 2px; min-width: 0; }
|
|
115
|
+
.tl-door-doc { font-size: 13px; color: var(--tl-text-muted); }
|
|
116
|
+
.tl-ability.tl-selected { border-color: var(--tl-accent); }
|
|
114
117
|
@media (max-width: 420px) {
|
|
115
118
|
.tl-thing { padding: 18px; }
|
|
116
119
|
.tl-card { padding: 16px; }
|
|
@@ -199,7 +202,7 @@
|
|
|
199
202
|
.tl-cond { display: inline-flex; align-items: center; gap: 6px; }
|
|
200
203
|
.tl-cond-q { color: var(--tl-text-body); }
|
|
201
204
|
.tl-cond-and { color: var(--tl-text-quiet); margin-left: 2px; }
|
|
202
|
-
.tl-ans { display: inline-block; padding: 1px 7px; border-radius: 6px; font-size: 12px; font-weight: 700; }
|
|
205
|
+
.tl-ans { display: inline-block; flex: none; white-space: nowrap; padding: 1px 7px; border-radius: 6px; font-size: 12px; font-weight: 700; }
|
|
203
206
|
.tl-ans-yes { color: var(--tl-c-question); background: color-mix(in srgb, var(--tl-c-question) 12%, transparent); }
|
|
204
207
|
.tl-ans-no { color: var(--tl-text-muted); background: color-mix(in srgb, var(--tl-c-unread) 14%, transparent); }
|
|
205
208
|
.tl-ans-each { color: var(--tl-c-structure); background: color-mix(in srgb, var(--tl-c-structure) 12%, transparent); }
|
package/src/react/reading.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ReactElement, ReactNode } from 'react';
|
|
2
2
|
import type { ThunderModel, Thing, Member } from '../model.d.mts';
|
|
3
|
-
import type { ReadingLayout, ThingCardLayout, DataCardLayout, IOBoxesLayout, DetailsLayout, ThunderSymbolId } from '../reading-layout.d.mts';
|
|
3
|
+
import type { ReadingLayout, ThingCardLayout, DataCardLayout, IOBoxesLayout, MemberEntryLayout, DetailsLayout, ThunderSymbolId } from '../reading-layout.d.mts';
|
|
4
4
|
|
|
5
5
|
export { readingLayout, thingCard, dataCard, ioBoxes, detailsLayout, flowEdgeLabel, READING_LABELS } from '../reading-layout.mjs';
|
|
6
6
|
export type { ReadingLayout, ThingCardLayout, DataCardLayout, IOBoxesLayout, DetailsLayout, When, ThunderSymbolId } from '../reading-layout.d.mts';
|
package/src/react/reading.mjs
CHANGED
|
@@ -108,6 +108,16 @@ export function IOBoxes({ card, model, member, onLine, onThing, headingLevel = 3
|
|
|
108
108
|
: h('p', { className: 'tl-part-of' }, h(ThunderSymbol, { id: 'thing', size: 18 }), c.partOf.text)) : null);
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
+
/** One action or rule on its own: its symbol, name, and doc; a button when the app can open it. */
|
|
112
|
+
function MemberDoor({ m, onOpen, selected }) {
|
|
113
|
+
const inner = h(Fragment, null,
|
|
114
|
+
h(ThunderSymbol, { id: m.symbol, size: 24 }),
|
|
115
|
+
h('span', { className: 'tl-door-text' }, h('span', { className: 'tl-ability-label' }, m.label), m.doc ? h('span', { className: 'tl-door-doc' }, m.doc) : null),
|
|
116
|
+
onOpen ? h('span', { className: 'tl-ability-go', 'aria-hidden': true }, '→') : null);
|
|
117
|
+
const cls = `tl-ability${selected ? ' tl-selected' : ''}`;
|
|
118
|
+
return onOpen ? h('button', { type: 'button', className: `${cls} tl-ability-button`, onClick: () => onOpen(m.id) }, inner) : h('div', { className: cls }, inner);
|
|
119
|
+
}
|
|
120
|
+
|
|
111
121
|
/**
|
|
112
122
|
* The Big Picture, zoomed by `focus` (see readingLayout): Things and Data, or, for an action or rule, its IO boxes.
|
|
113
123
|
*/
|
|
@@ -116,7 +126,9 @@ export function BigPicture({ model, layout, focus = null, onOpen, onLine, onThin
|
|
|
116
126
|
return h('div', { className: 'tl-reading tl-big-picture' }, l.sections.map((s) => h('section', { key: s.id, className: `tl-bp-section tl-bp-${s.id}`, 'aria-label': s.heading },
|
|
117
127
|
s.id === 'io'
|
|
118
128
|
? s.cards.map((c) => h(IOBoxes, { key: c.id, card: c, onLine, onThing, headingLevel: headingLevel + 1 }, children))
|
|
119
|
-
:
|
|
129
|
+
: s.id === 'actions'
|
|
130
|
+
? h(Fragment, null, h(`h${headingLevel}`, { className: 'tl-section-label tl-bp-heading' }, s.heading), h('ul', { className: 'tl-abilities tl-bp-actions-list' }, s.cards.map((m) => h('li', { key: m.id }, h(MemberDoor, { m, onOpen, selected: m.id === selectedId })))))
|
|
131
|
+
: h('div', { className: s.id === 'things' ? 'tl-bp-things' : 'tl-bp-data' }, s.cards.map((c) => (c.kind === 'thing'
|
|
120
132
|
? h(ThingCard, { key: c.id, card: c, onOpen, selected: c.id === selectedId, headingLevel })
|
|
121
133
|
: h(DataCard, { key: c.id, card: c, headingLevel: headingLevel + 1 })))))));
|
|
122
134
|
}
|
package/src/reading-layout.d.mts
CHANGED
|
@@ -4,7 +4,7 @@ export const READING_LAYOUT_SCHEMA: 'thunder-reading-layout-v1';
|
|
|
4
4
|
export const READING_LABELS: Readonly<{
|
|
5
5
|
thing: string; knows: string; can: string; starts: (label: string) => string; startsWithKnows: (label: string) => string;
|
|
6
6
|
record: string; choices: string; recordSymbol: string; choicesSymbol: string; things: string; data: string;
|
|
7
|
-
give: string; getBack: string; stops: string; givesNothing: string; getsNothing: string; partOf: (label: string) => string; io: string;
|
|
7
|
+
give: string; getBack: string; stops: string; givesNothing: string; getsNothing: string; partOf: (label: string) => string; io: string; actions: string;
|
|
8
8
|
edges: Readonly<Record<'yes' | 'no' | 'each' | 'done' | 'error' | 'nested' | 'case', string>>;
|
|
9
9
|
openLine: (line: number) => string; openRule: string;
|
|
10
10
|
details: Readonly<{
|
|
@@ -35,10 +35,12 @@ export interface IOBoxesLayout {
|
|
|
35
35
|
/** The Thing it belongs to, to link back to its card. */
|
|
36
36
|
partOf: { id: string; text: string } | null;
|
|
37
37
|
}
|
|
38
|
+
/** An action or rule that belongs to no Thing (a plain function), listed in the Big Picture as a door to open. */
|
|
39
|
+
export interface MemberEntryLayout { kind: 'member'; id: string; label: string; symbol: ThunderSymbolId; doc: string | null }
|
|
38
40
|
export interface ReadingLayout {
|
|
39
41
|
schema: 'thunder-reading-layout-v1';
|
|
40
42
|
focus: { kind: 'app' | 'file' | 'thing' | 'member' | 'unknown'; id: string | null };
|
|
41
|
-
sections: Array<{ id: 'things'; heading: string; cards: ThingCardLayout[] } | { id: 'data'; heading: string; cards: DataCardLayout[] } | { id: 'io'; heading: string; cards: IOBoxesLayout[] }>;
|
|
43
|
+
sections: Array<{ id: 'things'; heading: string; cards: ThingCardLayout[] } | { id: 'data'; heading: string; cards: DataCardLayout[] } | { id: 'io'; heading: string; cards: IOBoxesLayout[] } | { id: 'actions'; heading: string; cards: MemberEntryLayout[] }>;
|
|
42
44
|
}
|
|
43
45
|
export interface When { question: string; answer: string }
|
|
44
46
|
export interface DetailsLayout {
|
package/src/reading-layout.mjs
CHANGED
|
@@ -25,6 +25,7 @@ export const READING_LABELS = Object.freeze({
|
|
|
25
25
|
getsNothing: 'Nothing it hands back',
|
|
26
26
|
partOf: (label) => `Part of ${label}`,
|
|
27
27
|
io: 'What goes in and out',
|
|
28
|
+
actions: 'Actions and rules',
|
|
28
29
|
// Flow: the words on each kind of edge. An edge label not listed here is shown as the compiler wrote it.
|
|
29
30
|
edges: Object.freeze({ yes: 'Yes', no: 'No', each: 'For each', done: 'Done', error: 'If it fails', nested: 'Runs on its own', case: 'When' }),
|
|
30
31
|
openLine: (line) => `line ${line}`,
|
|
@@ -149,18 +150,25 @@ export function detailsLayout(view) {
|
|
|
149
150
|
};
|
|
150
151
|
}
|
|
151
152
|
|
|
152
|
-
|
|
153
|
+
/** An action or rule that belongs to no Thing (a plain function): a door to open, with its symbol and doc. */
|
|
154
|
+
const memberEntry = (m) => ({ kind: 'member', id: m.id, label: `${m.label}${m.yesNo ? '?' : ''}`, symbol: memberSymbolId(m), doc: m.doc ?? null });
|
|
155
|
+
|
|
156
|
+
const sectionsFor = (model, things, loose = []) => {
|
|
153
157
|
const cards = things.filter((t) => t.kind === 'thing').map((t) => thingCard(model, t));
|
|
154
158
|
const data = [...things.filter((t) => t.kind === 'record'), ...things.filter((t) => t.kind === 'choices')].map(dataCard);
|
|
159
|
+
const actions = loose.map(memberEntry);
|
|
155
160
|
return [
|
|
156
161
|
...(cards.length ? [{ id: 'things', heading: READING_LABELS.things, cards }] : []),
|
|
157
162
|
...(data.length ? [{ id: 'data', heading: READING_LABELS.data, cards: data }] : []),
|
|
163
|
+
...(actions.length ? [{ id: 'actions', heading: READING_LABELS.actions, cards: actions }] : []),
|
|
158
164
|
];
|
|
159
165
|
};
|
|
166
|
+
const ownerless = (model, file) => model.members.filter((m) => !m.owner && (file == null || m.file === file));
|
|
160
167
|
|
|
161
168
|
/**
|
|
162
169
|
* The Big Picture, which zooms with what is in focus (the tabs stay Big Picture / Flow / Details / Text / Original):
|
|
163
|
-
* no focus: every Thing, then every record, then every set of choices
|
|
170
|
+
* no focus: every Thing, then every record, then every set of choices, then the actions and rules that
|
|
171
|
+
* belong to no Thing (plain functions), each a door to open
|
|
164
172
|
* a file's path: the same, for that file
|
|
165
173
|
* a Thing's id: its card, then the Data in its file
|
|
166
174
|
* an action or rule: its "You give it / You get back / It can stop with" boxes, with "Part of <Thing>"
|
|
@@ -169,7 +177,7 @@ const sectionsFor = (model, things) => {
|
|
|
169
177
|
*/
|
|
170
178
|
export function readingLayout(model, { focus = null } = {}) {
|
|
171
179
|
const base = { schema: READING_LAYOUT_SCHEMA };
|
|
172
|
-
if (focus == null) return { ...base, focus: { kind: 'app', id: null }, sections: sectionsFor(model, model.things) };
|
|
180
|
+
if (focus == null) return { ...base, focus: { kind: 'app', id: null }, sections: sectionsFor(model, model.things, ownerless(model)) };
|
|
173
181
|
const member = model.members.find((m) => m.id === focus);
|
|
174
182
|
if (member) return { ...base, focus: { kind: 'member', id: focus }, sections: [{ id: 'io', heading: READING_LABELS.io, cards: [ioBoxes(model, member)] }] };
|
|
175
183
|
const thing = model.things.find((t) => t.id === focus);
|
|
@@ -177,6 +185,6 @@ export function readingLayout(model, { focus = null } = {}) {
|
|
|
177
185
|
const rest = model.things.filter((t) => t !== thing && t.file === thing.file && t.kind !== 'thing');
|
|
178
186
|
return { ...base, focus: { kind: 'thing', id: focus }, sections: sectionsFor(model, [thing, ...rest]) };
|
|
179
187
|
}
|
|
180
|
-
if (model.files.some((f) => f.path === focus)) return { ...base, focus: { kind: 'file', id: focus }, sections: sectionsFor(model, model.things.filter((t) => t.file === focus)) };
|
|
188
|
+
if (model.files.some((f) => f.path === focus)) return { ...base, focus: { kind: 'file', id: focus }, sections: sectionsFor(model, model.things.filter((t) => t.file === focus), ownerless(model, focus)) };
|
|
181
189
|
return { ...base, focus: { kind: 'unknown', id: focus }, sections: [] };
|
|
182
190
|
}
|