Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/learning/0.2.0/ui.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion integrations/READINESS.md

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions integrations/catalog.json
Original file line number Diff line number Diff line change
Expand Up @@ -526,18 +526,18 @@
"https://atomicdata.dev/properties/shortname": "learning",
"https://atomicdata.dev/integrations/properties/experimental": true,
"https://atomicdata.dev/integrations/properties/enabled": false,
"https://atomicdata.dev/properties/name": "Leerboom",
"https://atomicdata.dev/properties/name": "Atomic Education",
"https://atomicdata.dev/properties/emoji": "🌳",
"https://atomicdata.dev/properties/description": "A drive app that shows a learning tree: skills with the skills they need, the lessons for each, and what to learn next, worked out from what you say you master.",
"https://atomicdata.dev/integrations/properties/capabilities": "Shows any table of the shared Skill class (skill-v1) as a layered dependency graph. A skill is mastered, available or not yet due; the last is only advice, and every skill can be opened. Per skill it lists lessons (the shared Lesson class, lesson-v1) with an icon per format, offers \"I master this\", which writes a Mastery row (mastery-v1) to a table the app keeps in your drive, and \"Path to this goal\", which highlights the unmastered skills on the way and suggests the next logical steps. \"Load starter tree\" adds about 30 skills of mathematics and physics (Dutch) to the table, with placeholder lessons. Trees from different tables or drives can be linked by marking skills as equivalent. No account, network or provider.",
"https://atomicdata.dev/properties/description": "Atomic Education is a drive app that shows a learning tree: skills with the skills they need, the lessons for each, and what to learn next, worked out from what you say you master.",
"https://atomicdata.dev/integrations/properties/capabilities": "Shows any table of the shared Skill class (skill-v1) as a layered dependency graph. A skill is mastered, available or not yet due; the last is only advice, and every skill can be opened. Per skill it lists lessons (the shared Lesson class, lesson-v1) with an icon per format (an interactive lesson has a Start button that opens the mini app it is linked to, and a field to link one), offers \"I master this\", which writes a Mastery row (mastery-v1) to a table the app keeps in your drive, and \"Path to this goal\", which highlights the unmastered skills on the way and suggests the next logical steps. \"Load starter tree\" adds about 30 skills of mathematics and physics (Dutch) to the table, with placeholder lessons. Trees from different tables or drives can be linked by marking skills as equivalent. No account, network or provider.",
"https://atomicdata.dev/integrations/properties/events": "Add it as a view to a Skill table, or open it and load the starter tree. Mastery is written when you press \"I master this\". Nothing runs while the app is closed.",
"https://atomicdata.dev/integrations/properties/limitation": "Declared, not verified: unit-tested against a fake host store only, with no host E2E run yet. Mastery is self-reported; there are no assessments, attempts, credentials or attested results. The starter lessons name no material yet (every content link is a TODO). Mastery rows inherit the rights of the App in your drive, so install it in a drive that is yours. On a Skill table the app did not make, loading the starter tree needs the host's Allow editing. Waits for the stable ontology domain.",
"https://atomicdata.dev/integrations/properties/keywords": "learning tree leerboom skills lessons mastery curriculum education mathematics physics drive app",
"https://atomicdata.dev/integrations/properties/version": "0.1.0",
"https://atomicdata.dev/integrations/properties/keywords": "atomic education learning tree leerboom skills lessons mastery curriculum education mathematics physics drive app",
"https://atomicdata.dev/integrations/properties/version": "0.2.0",
"https://atomicdata.dev/integrations/properties/app-row-name": "Skill",
"https://atomicdata.dev/integrations/properties/app-row-name-plural": "Skills",
"https://atomicdata.dev/integrations/properties/app-module": "https://ontola.github.io/atomic-plugins/apps/learning/0.1.0/ui.js",
"https://atomicdata.dev/integrations/properties/app-module-integrity": "sha384-hshL47qBYLNL6M0RWOs+paY+RpJ//1Sxo0AkHWpl2h71DQ8rQkjk05cUeX/dGZXw"
"https://atomicdata.dev/integrations/properties/app-module": "https://ontola.github.io/atomic-plugins/apps/learning/0.2.0/ui.js",
"https://atomicdata.dev/integrations/properties/app-module-integrity": "sha384-WviiYacUlx7W7BjUZDf8XcJiE+cJzYYefLJte2J3STxiBhdL+/DNrXietPb0ZlN0"
},
{
"https://atomicdata.dev/properties/localId": "google-keep-view",
Expand Down
2 changes: 1 addition & 1 deletion integrations/lanes.json
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@
"platforms": [],
"tiers": ["typecheck", "unit", "e2e"],
"paths": ["ontology/**", "ontology-kit/**"],
"note": "The Leerboom (learning tree) drive app (integrations/learning/app/) over a dependency-free core (integrations/learning/core/: graph with cross-tree equivalence, cycle reporting, mastered/available/locked as advice, next steps, path, outer fringe). It renders any table of the shared skill-v1 class, offers a starter tree of mathematics and physics (data/wiskunde-natuurkunde.json) and writes mastery-v1 rows to a table it owns. No provider, proxy or network of its own. paths: it bundles ontology-kit/terms.mjs and resolver.mjs and uses the published GitHub Pages subjects of skill-v1, lesson-v1 and mastery-v1, so an ontology change runs this lane too and the e2e needs network access to ontola.github.io. The e2e spec is written but, in the session that added the lane, was not run (no atomic-server build).",
"note": "The Atomic Education (learning tree) drive app (integrations/learning/app/) over a dependency-free core (integrations/learning/core/: graph with cross-tree equivalence, cycle reporting, mastered/available/locked as advice, next steps, path, outer fringe). It renders any table of the shared skill-v1 class, offers a starter tree of mathematics and physics (data/wiskunde-natuurkunde.json) and writes mastery-v1 rows to a table it owns. No provider, proxy or network of its own. paths: it bundles ontology-kit/terms.mjs and resolver.mjs and uses the published GitHub Pages subjects of skill-v1, lesson-v1 and mastery-v1, so an ontology change runs this lane too and the e2e needs network access to ontola.github.io. The e2e spec is written but, in the session that added the lane, was not run (no atomic-server build).",
"e2e": ["integrations/learning/e2e/learning.spec.ts"]
},
{
Expand Down
2 changes: 1 addition & 1 deletion integrations/learning/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Leerboom (learning tree)
# Atomic Education (learning tree)

A learning tree as an Atomic drive app: a graph of skills with the skills they
need, the lessons for each, and a per-learner answer to "what next?", worked
Expand Down
11 changes: 11 additions & 0 deletions integrations/learning/app/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,17 @@ export async function readLessons(
}));
}

/** Points a lesson at a resource or URL, as `lesson-content`. */
export async function linkLesson(
store: PluginStore,
lesson: string,
target: string,
): Promise<void> {
const row = await store.getResource(lesson);
row.set(P.content, target);
await row.save();
}

/** The learner's mastery rows, as the core's `MasterySource`, and the write side. */
export function masteryStore(
store: PluginStore,
Expand Down
2 changes: 1 addition & 1 deletion integrations/learning/app/build.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @wc-ignore-file
/**
* Builds the Learning (Leerboom) drive app to one ES module, `dist/ui.js`: the string an
* Builds the Atomic Education (learning) drive app to one ES module, `dist/ui.js`: the string an
* install flow stores as the App's `plugin-source`.
*
* node integrations/learning/app/build.mjs [--outfile path]
Expand Down
4 changes: 2 additions & 2 deletions integrations/learning/app/build.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ describe('learning drive-app bundle', async () => {
);
expect(Object.keys(mod)).toEqual(['view']);
expect(typeof mod.view).toBe('function');
// Measured 44,256 bytes minified on 2026-10-27; limit is that plus ~10%.
expect(bytes).toBeLessThan(48_700);
// Measured 51,026 bytes minified on 2026-10-28; limit is that plus ~10%.
expect(bytes).toBeLessThan(56_100);
});

it('carries the shared skill, lesson and mastery subjects and the starter tree', () => {
Expand Down
20 changes: 19 additions & 1 deletion integrations/learning/app/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { starter } from './starter.js';
import {
adopt,
loadStarter,
linkLesson,
masteryStore,
readLessons,
skillSource,
Expand All @@ -37,7 +38,7 @@ export type State =
goal?: string;
/** What the app is doing, or what just happened, for a status line. */
busy?: 'starter' | 'mastery';
notice?: 'denied' | 'failed' | { loaded: number };
notice?: 'denied' | 'failed' | 'badLink' | { loaded: number };
};

export function createController(
Expand Down Expand Up @@ -124,6 +125,23 @@ export function createController(
}
},

/** Links an interactive lesson to a resource (did:) or an https URL. */
async linkLesson(lesson: string, target: string): Promise<void> {
const to = target.trim();

if (!/^(did:\S+|https?:\/\/\S+)$/.test(to))
return patch({ notice: 'badLink' });

try {
await linkLesson(store, lesson, to);
await load();
patch({ notice: undefined });
} catch {
await load();
patch({ notice: 'failed' });
}
},

async loadStarter(): Promise<void> {
const s = ready();
if (!s) return;
Expand Down
63 changes: 61 additions & 2 deletions integrations/learning/app/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ import { stringsFor } from './strings.js';
import type { ViewArgs } from './store.js';
import { page, type Actions } from './view.js';

/** Root padding and tree card padding in styles.css, in px. */
const PAD = 16;
const CARD_PAD = 9;

export async function view({ root, store }: ViewArgs): Promise<void> {
const doc = root.ownerDocument;
const ui = stringsFor(doc.defaultView?.navigator?.language);
Expand All @@ -32,13 +36,57 @@ export async function view({ root, store }: ViewArgs): Promise<void> {
scheme(store.getTheme?.());
store.onThemeChange?.(scheme);

let seen: string | undefined;

const render = () => {
const tree = root.querySelector<HTMLElement>('.lb-tree');
const [left, top] = [tree?.scrollLeft ?? 0, tree?.scrollTop ?? 0];
const focused = (doc.activeElement as HTMLElement | null)?.dataset?.id;
root.replaceChildren(...page(doc, controller.state(), ui, actions));
// The tree card sits inside the root's padding and its own.
const width = Math.max(0, root.clientWidth - 2 * PAD - 2 * CARD_PAD);
// A ping redraws everything: keep what was typed in a link field.
const typed = [...root.querySelectorAll<HTMLInputElement>('.lb-input')].map(
i =>
[
i.getAttribute('aria-label'),
i.value,
i === doc.activeElement,
] as const,
);
root.replaceChildren(...page(doc, controller.state(), ui, actions, width));

for (const [label, value, active] of typed)
for (const i of root.querySelectorAll<HTMLInputElement>('.lb-input'))
if (i.getAttribute('aria-label') === label) {
i.value = value;
if (active) i.focus({ preventScroll: true });
}

const again = root.querySelector<HTMLElement>('.lb-tree');
if (again) [again.scrollLeft, again.scrollTop] = [left, top];

if (again) {
[again.scrollLeft, again.scrollTop] = [left, top];
const overflows = again.scrollWidth > again.clientWidth + 1;
again.parentElement?.toggleAttribute('data-scroll', overflows);
const s = controller.state();
const at = s.kind === 'ready' ? s.selected : undefined;

// A skill picked from a chip may sit off screen: bring it into view.
if (at && at !== seen && overflows) {
const n = again.querySelector<HTMLElement>(
`.lb-node[data-id="${CSS.escape(at)}"]`,
);
const [r, t] = [
n?.getBoundingClientRect(),
again.getBoundingClientRect(),
];
if (r && (r.left < t.left || r.right > t.right))
again.scrollLeft += r.left - t.left - (t.width - r.width) / 2;
}

seen = at;
}

if (focused)
root
.querySelector<HTMLElement>(
Expand All @@ -61,8 +109,19 @@ export async function view({ root, store }: ViewArgs): Promise<void> {
else if (/^https?:\/\//.test(target)) void store.openExternal?.(target);
},
openRow: id => void store.openResource?.(id),
link: (lesson, target) => void controller.linkLesson(lesson, target),
};

// The tree fits the width it is given, so draw again when the frame resizes.
let frame = 0;
let last = root.clientWidth;
doc.defaultView?.addEventListener('resize', () => {
if (root.clientWidth === last) return;
last = root.clientWidth;
cancelAnimationFrame(frame);
frame = requestAnimationFrame(render);
});

render();
await controller.load();

Expand Down
4 changes: 2 additions & 2 deletions integrations/learning/app/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@atomic-integrations/learning-app",
"private": true,
"version": "0.1.0",
"version": "0.2.0",
"type": "module",
"description": "Leerboom drive app: a learning tree view over tables of the shared skill-v1 class. Bundles ../core and ../data into app/dist/ui.js. Not a certified sandbox package (no atomicCertification); it lives in app/ so certify.mjs does not treat learning as one."
"description": "Atomic Education drive app: a learning tree view over tables of the shared skill-v1 class. Bundles ../core and ../data into app/dist/ui.js. Not a certified sandbox package (no atomicCertification); it lives in app/ so certify.mjs does not treat learning as one."
}
39 changes: 29 additions & 10 deletions integrations/learning/app/strings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,29 @@
/** UI strings, Dutch and English. The language is the browser's; English by default. */

const nl = {
title: 'Leerboom',
title: 'Atomic Education',
starter: 'Laad startboom',
starterBusy: 'Startboom laden...',
empty:
'Deze boom is nog leeg. Laad de startboom voor wiskunde en natuurkunde, of voeg zelf vaardigheden toe aan de tabel.',
'Een leerboom toont vaardigheden, wat je ervoor nodig hebt en de lessen erbij. Laad de startboom voor wiskunde en natuurkunde, of voeg zelf vaardigheden toe aan de tabel.',
unusable:
'Deze tabel bevat geen vaardigheden (klasse skill-v1). Voeg deze app toe aan een tabel van die klasse.',
error: 'Kon de leerboom niet laden',
error: 'Kon Atomic Education niet laden',
retry: 'Opnieuw proberen',
next: 'Volgende logische stappen',
nextForGoal: 'Volgende stappen richting je doel',
nothingNext: 'Niets meer te adviseren: alles is beheerst.',
legend:
'Beheerst, beschikbaar, of nog niet aan de beurt. Alles blijft te openen.',
emptyTitle: 'Nog geen vaardigheden',
progress: (n: number, total: number) => `${n} van ${total} beheerst`,
level: (n: number) => `Niveau ${n}`,
scrollHint: 'Veeg opzij voor de rest van de boom.',
start: 'Start',
openLesson: 'Open',
notLinked: 'nog niet gekoppeld',
link: 'Koppel',
linkLabel: 'Koppel een resource of link',
linkPlaceholder: 'Plak een resource of link',
badLink: 'Dat is geen resource (did:) of link (https://).',
mastered: 'Beheerst',
available: 'Beschikbaar',
locked: 'Nog niet aan de beurt',
Expand Down Expand Up @@ -53,19 +62,29 @@ const nl = {
};

const en: typeof nl = {
title: 'Learning tree',
title: 'Atomic Education',
starter: 'Load starter tree',
starterBusy: 'Loading starter tree...',
empty:
'This tree is empty. Load the mathematics and physics starter tree, or add skills to the table yourself.',
'A learning tree shows skills, what each one needs and the lessons for it. Load the mathematics and physics starter tree, or add skills to the table yourself.',
unusable:
'This table holds no skills (class skill-v1). Add this app to a table of that class.',
error: 'Could not load the learning tree',
error: 'Could not load Atomic Education',
retry: 'Try again',
next: 'Next logical steps',
nextForGoal: 'Next steps toward your goal',
nothingNext: 'Nothing left to advise: everything is mastered.',
legend: 'Mastered, available, or not yet due. Everything stays open.',
emptyTitle: 'No skills yet',
progress: (n: number, total: number) => `${n} of ${total} mastered`,
level: (n: number) => `Level ${n}`,
scrollHint: 'Swipe sideways for the rest of the tree.',
start: 'Start',
openLesson: 'Open',
notLinked: 'not linked yet',
link: 'Link',
linkLabel: 'Link a resource or URL',
linkPlaceholder: 'Paste a resource or link',
badLink: 'That is not a resource (did:) or a link (https://).',
mastered: 'Mastered',
available: 'Available',
locked: 'Not yet due',
Expand Down Expand Up @@ -109,7 +128,7 @@ export const stringsFor = (language: string | undefined): Strings =>
export const FORMAT_ICON: Record<string, string> = {
video: '\u{1F3AC}',
text: '\u{1F4C4}',
interactive: '\u{1F9E9}',
interactive: '\u25B6\uFE0E',
exercise: '\u{270F}\u{FE0F}',
live: '\u{1F465}',
tour: '\u{1F9ED}',
Expand Down
Loading
Loading