@jossuealcala/madre 1.0.4 → 1.0.5
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.en.md +106 -1
- package/CHANGELOG.md +106 -1
- package/NOTICE +30 -0
- package/README.en.md +59 -156
- package/README.md +60 -161
- package/TRADEMARKS.md +18 -0
- package/bin/madre.mjs +2 -2
- package/docs/REFERENCE.md +1 -1
- package/docs/SDK.md +25 -4
- package/docs/en/REFERENCE.md +1 -1
- package/docs/en/SDK.md +22 -2
- package/docs/madre-banner.png +0 -0
- package/package.json +1 -1
- package/public/app.js +1078 -239
- package/public/assets/manual/madre-manual-en.pdf +0 -0
- package/public/assets/manual/madre-manual-es.pdf +0 -0
- package/public/assets/manual/shots/en-agents.webp +0 -0
- package/public/assets/manual/shots/en-code.webp +0 -0
- package/public/assets/manual/shots/en-composer.webp +0 -0
- package/public/assets/manual/shots/en-connectors.webp +0 -0
- package/public/assets/manual/shots/en-continuity.webp +0 -0
- package/public/assets/manual/shots/en-coordinator.webp +0 -0
- package/public/assets/manual/shots/en-copilot.webp +0 -0
- package/public/assets/manual/shots/en-diagnostics.webp +0 -0
- package/public/assets/manual/shots/en-home.webp +0 -0
- package/public/assets/manual/shots/en-local.webp +0 -0
- package/public/assets/manual/shots/en-memory.webp +0 -0
- package/public/assets/manual/shots/en-modes.webp +0 -0
- package/public/assets/manual/shots/en-modules.webp +0 -0
- package/public/assets/manual/shots/en-notes.webp +0 -0
- package/public/assets/manual/shots/en-settings.webp +0 -0
- package/public/assets/manual/shots/en-windows.webp +0 -0
- package/public/assets/manual/shots/es-agents.webp +0 -0
- package/public/assets/manual/shots/es-code.webp +0 -0
- package/public/assets/manual/shots/es-composer.webp +0 -0
- package/public/assets/manual/shots/es-connectors.webp +0 -0
- package/public/assets/manual/shots/es-continuity.webp +0 -0
- package/public/assets/manual/shots/es-coordinator.webp +0 -0
- package/public/assets/manual/shots/es-copilot.webp +0 -0
- package/public/assets/manual/shots/es-diagnostics.webp +0 -0
- package/public/assets/manual/shots/es-home.webp +0 -0
- package/public/assets/manual/shots/es-local.webp +0 -0
- package/public/assets/manual/shots/es-memory.webp +0 -0
- package/public/assets/manual/shots/es-modes.webp +0 -0
- package/public/assets/manual/shots/es-modules.webp +0 -0
- package/public/assets/manual/shots/es-notes.webp +0 -0
- package/public/assets/manual/shots/es-settings.webp +0 -0
- package/public/assets/manual/shots/es-windows.webp +0 -0
- package/public/en.js +74 -0
- package/public/es.js +493 -136
- package/public/i18n.js +45 -7
- package/public/index.html +2 -3
- package/public/manual-content.js +657 -0
- package/public/manual-shots.js +43 -0
- package/public/manual.css +228 -0
- package/public/manual.html +15 -0
- package/public/manual.js +398 -0
- package/public/market-art.js +56 -0
- package/public/market-view.js +140 -22
- package/public/market.js +25 -14
- package/public/mcp-catalog.js +62 -0
- package/public/resay.js +1 -0
- package/public/salas-mac.css +178 -30
- package/public/salas-mac.html +5 -5
- package/public/salas-mac.js +432 -67
- package/public/styles.css +300 -42
- package/public/tour-chapters.js +98 -90
- package/public/tour.js +63 -21
- package/public/troubleshooting.js +145 -10
- package/src/adapters/cursor.mjs +56 -7
- package/src/adapters/gemini.mjs +12 -1
- package/src/adapters/madre.mjs +27 -6
- package/src/adapters/process.mjs +5 -2
- package/src/auth-probe.mjs +22 -3
- package/src/bridge/policy.mjs +1 -1
- package/src/bridge/server.mjs +1 -1
- package/src/capabilities.mjs +3 -3
- package/src/credentials.mjs +24 -2
- package/src/history.mjs +76 -0
- package/src/i18n.mjs +23 -1
- package/src/local-ai.mjs +10 -2
- package/src/looks.mjs +17 -5
- package/src/market-license.mjs +104 -0
- package/src/market-remote.mjs +17 -1
- package/src/mcp/notes-server.mjs +120 -0
- package/src/mcp/proxy.mjs +14 -3
- package/src/models.mjs +82 -9
- package/src/modules/index.mjs +3 -1
- package/src/modules/local-models.mjs +28 -0
- package/src/modules/notes.mjs +142 -0
- package/src/modules/ollama.mjs +39 -10
- package/src/modules/playwright.mjs +14 -3
- package/src/modules/reminders.mjs +345 -0
- package/src/modules/sdk.mjs +21 -5
- package/src/mother.mjs +11 -1
- package/src/ollama.mjs +2 -2
- package/src/opencode-health.mjs +63 -0
- package/src/outbound.mjs +25 -1
- package/src/reminder-time.mjs +127 -0
- package/src/room.mjs +19 -7
- package/src/runtime-detection.mjs +6 -2
- package/src/sentinel-errors.mjs +4 -3
- package/src/server.mjs +302 -70
- package/src/tour.mjs +24 -5
package/public/manual.js
ADDED
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
|
+
// MADRE · © 2026 Jossue Alcalá · GNU AGPL v3 with additional terms (Section 7): ADDITIONAL-TERMS.md
|
|
3
|
+
// The user manual's page (/manual, 1.0.5): the text of public/manual-content.js drawn with MADRE's
|
|
4
|
+
// look, in the room's language or the one asked for (?lang=es|en). Each section shows MADRE itself
|
|
5
|
+
// (public/manual-shots.js, scripts/manual-shots.mjs) with a numbered mark on what each step presses;
|
|
6
|
+
// a step and its mark light up together. The same page is printed to the PDF (scripts/manual-pdf.mjs,
|
|
7
|
+
// ?print=1): light, as the brand asks of long documents, with a cover. It reads nothing but its own
|
|
8
|
+
// files, so it opens without a network.
|
|
9
|
+
|
|
10
|
+
import { hostWords, keyWords } from './i18n.js';
|
|
11
|
+
import { MANUAL } from './manual-content.js';
|
|
12
|
+
import { GESTURES } from './tour-chapters.js';
|
|
13
|
+
import { SHOTS } from './manual-shots.js';
|
|
14
|
+
|
|
15
|
+
const asked = new URLSearchParams(location.search);
|
|
16
|
+
const printing = asked.get('print') === '1';
|
|
17
|
+
const pick = (value) => (value === 'en' || value === 'es' ? value : null);
|
|
18
|
+
const browser = String(navigator.languages?.[0] ?? navigator.language ?? '').toLowerCase().startsWith('es') ? 'es' : 'en';
|
|
19
|
+
|
|
20
|
+
const ICONS = {
|
|
21
|
+
home: '<path d="M3.8 9.2L10 4l6.2 5.2M5.6 8v7.5h8.8V8"/>',
|
|
22
|
+
chat: '<path d="M4 5.5h12v7.5H9l-3.4 2.6V13H4z"/>',
|
|
23
|
+
shield: '<path d="M10 3.2l5.6 2v4.2c0 3.4-2.4 5.9-5.6 7.2-3.2-1.3-5.6-3.8-5.6-7.2V5.2z"/><path d="M7.6 10l1.7 1.7 3.1-3.3"/>',
|
|
24
|
+
robot: '<rect x="4.5" y="7" width="11" height="8" rx="2.4"/><path d="M10 4v3M8 11h.01M12 11h.01"/>',
|
|
25
|
+
code: '<path d="M7.4 6.5L4 10l3.4 3.5M12.6 6.5L16 10l-3.4 3.5M11 5l-2 10"/>',
|
|
26
|
+
note: '<path d="M5 4.5h10v7.5l-3.5 3.5H5z"/><path d="M11.5 15.5V12H15M7.5 8h5M7.5 10.5h3"/>',
|
|
27
|
+
grid: '<rect x="4" y="4" width="5" height="5" rx="1.2"/><rect x="11" y="4" width="5" height="5" rx="1.2"/><rect x="4" y="11" width="5" height="5" rx="1.2"/><rect x="11" y="11" width="5" height="5" rx="1.2"/>',
|
|
28
|
+
plug: '<path d="M7.5 3.5v3.3M12.5 3.5v3.3M5.5 6.8h9v2.6a4.5 4.5 0 0 1-9 0zM10 13.9v2.6"/>',
|
|
29
|
+
chip: '<rect x="5.5" y="5.5" width="9" height="9" rx="1.8"/><path d="M8 3v2.5M12 3v2.5M8 14.5V17M12 14.5V17M3 8h2.5M3 12h2.5M14.5 8H17M14.5 12H17"/>',
|
|
30
|
+
orbit: '<circle cx="10" cy="10" r="2.2"/><ellipse cx="10" cy="10" rx="7" ry="3.2"/><circle cx="16.4" cy="11.4" r=".9"/>',
|
|
31
|
+
windows: '<rect x="3.5" y="5" width="9" height="7.5" rx="1.6"/><rect x="7.5" y="8" width="9" height="7.5" rx="1.6"/>',
|
|
32
|
+
gear: '<circle cx="10" cy="10" r="2.4"/><path d="M10 3.2v2M10 14.8v2M3.2 10h2M14.8 10h2M5.2 5.2l1.4 1.4M13.4 13.4l1.4 1.4M5.2 14.8l1.4-1.4M13.4 6.6l1.4-1.4"/>',
|
|
33
|
+
download: '<path d="M10 3.5v9M6.5 9l3.5 3.5L13.5 9M4.5 15.5h11"/>',
|
|
34
|
+
agents: '<circle cx="7.5" cy="8" r="2.4"/><circle cx="13.5" cy="8.6" r="1.9"/><path d="M3.5 15.5c.5-2.4 2.1-3.6 4-3.6s3.5 1.2 4 3.6M12.3 12.3c1.9-.3 3.6.8 4.2 3.2"/>',
|
|
35
|
+
stars: '<path d="M7.5 4l1 2.3 2.4.3-1.8 1.6.5 2.4-2.1-1.2-2.1 1.2.5-2.4-1.8-1.6 2.4-.3zM14 11l.6 1.4 1.5.2-1.1 1 .3 1.5-1.3-.8-1.3.8.3-1.5-1.1-1 1.5-.2zM5 14.5h.01M15.5 5h.01"/>',
|
|
36
|
+
loop: '<path d="M14.5 7.5A5 5 0 0 0 5.4 6.2M5.5 12.5a5 5 0 0 0 9.1 1.3M5 3.5v3h3M15 16.5v-3h-3"/>',
|
|
37
|
+
warning: '<path d="M10 3.5l7 12.5H3z"/><path d="M10 8.5v3.5M10 14.3h.01"/>',
|
|
38
|
+
keys: '<rect x="3" y="5.5" width="14" height="9" rx="2"/><path d="M6 8.5h.01M8.7 8.5h.01M11.3 8.5h.01M14 8.5h.01M7 11.5h6"/>',
|
|
39
|
+
help: '<circle cx="10" cy="10" r="6.5"/><path d="M8.2 8.2a1.9 1.9 0 1 1 2.6 1.8c-.5.2-.8.6-.8 1.1v.6M10 13.8h.01"/>',
|
|
40
|
+
};
|
|
41
|
+
const icon = (name) => `<svg viewBox="0 0 20 20" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">${ICONS[name] ?? ICONS.help}</svg>`;
|
|
42
|
+
|
|
43
|
+
const el = (tag, className = null, text = null) => {
|
|
44
|
+
const node = document.createElement(tag);
|
|
45
|
+
if (className) node.className = className;
|
|
46
|
+
if (text !== null) node.textContent = text;
|
|
47
|
+
return node;
|
|
48
|
+
};
|
|
49
|
+
// Said of the computer and the keyboard in front of the person (i18n.js).
|
|
50
|
+
const plain = (text) => hostWords(keyWords(String(text ?? '')));
|
|
51
|
+
const keyChip = (how) => el('kbd', null, plain(how));
|
|
52
|
+
// A line of the manual with its keys as keys (⌘ P, ⌥ ↵) and what to type to an agent (“…”) as it
|
|
53
|
+
// looks in the chat, a green bubble.
|
|
54
|
+
const KEYS = /([⌘⌥⇧⌃]\s?(?:[A-Z]|[,./↵])|↵)/;
|
|
55
|
+
function rich(text) {
|
|
56
|
+
const line = el('span');
|
|
57
|
+
for (const part of plain(text).split(/(“[^”]+”|`[^`]+`)/)) {
|
|
58
|
+
if (!part) continue;
|
|
59
|
+
if (part.startsWith('“')) { line.append(el('q', 'manual-say', part.slice(1, -1))); continue; }
|
|
60
|
+
if (part.startsWith('`')) { line.append(el('code', null, part.slice(1, -1))); continue; }
|
|
61
|
+
for (const bit of part.split(KEYS)) {
|
|
62
|
+
if (!bit) continue;
|
|
63
|
+
line.append(KEYS.test(bit) && bit.length <= 3 ? el('kbd', null, bit) : document.createTextNode(bit));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return line;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// MADRE, photographed, with a numbered mark on what each step presses. The marks come in one after
|
|
70
|
+
// the other the first time the picture is in sight; on paper they are simply there.
|
|
71
|
+
function shot(id, lang, title) {
|
|
72
|
+
const known = SHOTS[lang]?.[id] ?? SHOTS.es?.[id];
|
|
73
|
+
if (!known) return null;
|
|
74
|
+
// A tall one (a panel of Settings) narrower, so it does not fill a whole screen.
|
|
75
|
+
const picture = el('figure', `manual-shot${known.height > known.width ? ' tall' : ''}`);
|
|
76
|
+
const frame = el('div', 'manual-shot-frame');
|
|
77
|
+
frame.style.aspectRatio = `${known.width} / ${known.height}`;
|
|
78
|
+
frame.style.setProperty('--ratio', String(known.width / known.height));
|
|
79
|
+
const image = el('img');
|
|
80
|
+
image.src = `/assets/manual/shots/${SHOTS[lang]?.[id] ? lang : 'es'}-${id}.webp`;
|
|
81
|
+
image.alt = title;
|
|
82
|
+
image.width = known.width;
|
|
83
|
+
image.height = known.height;
|
|
84
|
+
image.decoding = 'async';
|
|
85
|
+
if (!printing) image.loading = 'lazy';
|
|
86
|
+
frame.append(image);
|
|
87
|
+
known.marks.forEach((box, at) => {
|
|
88
|
+
if (!box) return;
|
|
89
|
+
const [left, top, width, height, place = top < 5 ? 'below' : null] = box;
|
|
90
|
+
// Its number over its middle; under it at the picture's top edge, or where the picture said,
|
|
91
|
+
// when marks stand close together.
|
|
92
|
+
const mark = el('span', `manual-pin${place ? ` ${place}` : ''}`);
|
|
93
|
+
mark.dataset.step = String(at + 1);
|
|
94
|
+
mark.style.cssText = `left:${left}%;top:${top}%;width:${width}%;height:${height}%;--at:${at}`;
|
|
95
|
+
mark.append(el('b', null, String(at + 1)));
|
|
96
|
+
frame.append(mark);
|
|
97
|
+
});
|
|
98
|
+
picture.append(frame);
|
|
99
|
+
return picture;
|
|
100
|
+
}
|
|
101
|
+
// A step and its mark, lit together while the pointer is on either.
|
|
102
|
+
function pairUp(part) {
|
|
103
|
+
const light = (step, on) => {
|
|
104
|
+
part.classList.toggle('pointing', on);
|
|
105
|
+
for (const one of part.querySelectorAll(`[data-step="${step}"]`)) one.classList.toggle('lit', on);
|
|
106
|
+
};
|
|
107
|
+
for (const one of part.querySelectorAll('[data-step]')) {
|
|
108
|
+
one.addEventListener('pointerenter', () => light(one.dataset.step, true));
|
|
109
|
+
one.addEventListener('pointerleave', () => light(one.dataset.step, false));
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
// Each number goes where there is room for it (2026-10-21): outside its mark — above, to the left,
|
|
113
|
+
// to the right or below, in that order unless the picture asked for one first (`place`) — inside
|
|
114
|
+
// the picture and clear of the numbers already placed; the mark's corner only when nothing else
|
|
115
|
+
// fits. Placed once the picture has its size, and again when the page changes width.
|
|
116
|
+
const SIDES = ['above', 'left', 'right', 'below', 'corner'];
|
|
117
|
+
export function placeNumbers(frame) {
|
|
118
|
+
const width = frame.clientWidth;
|
|
119
|
+
const height = frame.clientHeight;
|
|
120
|
+
if (!width || !height) return;
|
|
121
|
+
const taken = [];
|
|
122
|
+
// Every mark's own box: a number never sits on another step's mark.
|
|
123
|
+
const marks = [...frame.querySelectorAll('.manual-pin')].map((one) => ({ pin: one, x: one.offsetLeft, y: one.offsetTop, w: one.offsetWidth, h: one.offsetHeight }));
|
|
124
|
+
for (const pin of frame.querySelectorAll('.manual-pin')) {
|
|
125
|
+
const badge = pin.querySelector('b');
|
|
126
|
+
if (!badge) continue;
|
|
127
|
+
// The number grows with the picture: on a phone the marks are about 20 px tall and a full-size
|
|
128
|
+
// number would sit on the next one.
|
|
129
|
+
const size = Math.round(Math.min(26, Math.max(18, width * 0.045)));
|
|
130
|
+
Object.assign(badge.style, { width: `${size}px`, height: `${size}px`, fontSize: `${Math.max(10, Math.round(size * 0.5))}px` });
|
|
131
|
+
const gap = 5;
|
|
132
|
+
const box = { x: pin.offsetLeft, y: pin.offsetTop, w: pin.offsetWidth, h: pin.offsetHeight };
|
|
133
|
+
const spot = {
|
|
134
|
+
above: [box.x + box.w / 2 - size / 2, box.y - size - gap],
|
|
135
|
+
left: [box.x - size - gap, box.y + box.h / 2 - size / 2],
|
|
136
|
+
right: [box.x + box.w + gap, box.y + box.h / 2 - size / 2],
|
|
137
|
+
below: [box.x + box.w / 2 - size / 2, box.y + box.h + gap],
|
|
138
|
+
corner: [box.x - size / 3, box.y - size / 3],
|
|
139
|
+
// When the four sides are taken: the ends of a side, the outer corners, and last the mark's
|
|
140
|
+
// own corner from inside, if it is big enough to keep part of the mark in view.
|
|
141
|
+
aboveStart: [box.x, box.y - size - gap],
|
|
142
|
+
aboveEnd: [box.x + box.w - size, box.y - size - gap],
|
|
143
|
+
belowStart: [box.x, box.y + box.h + gap],
|
|
144
|
+
belowEnd: [box.x + box.w - size, box.y + box.h + gap],
|
|
145
|
+
outsideTopLeft: [box.x - size - gap, box.y - size - gap],
|
|
146
|
+
outsideTopRight: [box.x + box.w + gap, box.y - size - gap],
|
|
147
|
+
outsideBottomLeft: [box.x - size - gap, box.y + box.h + gap],
|
|
148
|
+
outsideBottomRight: [box.x + box.w + gap, box.y + box.h + gap],
|
|
149
|
+
...(box.w >= size * 2 && box.h >= size * 1.6 ? {
|
|
150
|
+
insideTopLeft: [box.x + 4, box.y + 4],
|
|
151
|
+
insideTopRight: [box.x + box.w - size - 4, box.y + 4],
|
|
152
|
+
insideBottomLeft: [box.x + 4, box.y + box.h - size - 4],
|
|
153
|
+
insideBottomRight: [box.x + box.w - size - 4, box.y + box.h - size - 4],
|
|
154
|
+
} : {}),
|
|
155
|
+
};
|
|
156
|
+
const more = Object.keys(spot).filter((one) => !SIDES.includes(one));
|
|
157
|
+
const asked = SIDES.find((side) => pin.classList.contains(side));
|
|
158
|
+
const order = [...(asked ? [asked, ...SIDES.filter((side) => side !== asked && side !== 'corner')] : SIDES.slice(0, -1)), ...more, 'corner'];
|
|
159
|
+
const fits = ([x, y]) => x >= 2 && y >= 2 && x + size <= width - 2 && y + size <= height - 2;
|
|
160
|
+
const clear = ([x, y]) => taken.every(([tx, ty]) => Math.abs(tx - x) > size + 3 || Math.abs(ty - y) > size + 3);
|
|
161
|
+
// A mark that holds this one (a switch inside its card) is not in the way: its number is bound to sit on it.
|
|
162
|
+
const holds = (one) => one.x <= box.x && one.y <= box.y && one.x + one.w >= box.x + box.w && one.y + one.h >= box.y + box.h;
|
|
163
|
+
// How much of the other marks a number at (x, y) would cover; two pixels of edge do not count.
|
|
164
|
+
const covers = ([x, y]) => marks.reduce((sum, one) => (one.pin === pin || holds(one) ? sum
|
|
165
|
+
: sum + Math.max(0, Math.min(x + size, one.x + one.w) - Math.max(x, one.x) - 2) * Math.max(0, Math.min(y + size, one.y + one.h) - Math.max(y, one.y) - 2)), 0);
|
|
166
|
+
const offMarks = (at) => covers(at) === 0;
|
|
167
|
+
// Nowhere free: the place that covers the least of the other marks.
|
|
168
|
+
const least = order.filter((one) => fits(spot[one]) && clear(spot[one])).sort((a, b) => covers(spot[a]) - covers(spot[b]))[0];
|
|
169
|
+
const side = order.find((one) => fits(spot[one]) && clear(spot[one]) && offMarks(spot[one])) ?? least ?? order.find((one) => fits(spot[one])) ?? 'corner';
|
|
170
|
+
const [x, y] = spot[side];
|
|
171
|
+
const left = Math.min(Math.max(x, 2), width - size - 2);
|
|
172
|
+
const top = Math.min(Math.max(y, 2), height - size - 2);
|
|
173
|
+
taken.push([left, top]);
|
|
174
|
+
Object.assign(badge.style, { left: `${left - box.x}px`, top: `${top - box.y}px`, translate: 'none' });
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
// Every picture's numbers, once its image has its size: what printing waits for.
|
|
178
|
+
async function placeAll(root) {
|
|
179
|
+
// The frame keeps the picture's shape before it loads, so they can be placed at once; each one
|
|
180
|
+
// is placed again when its image is in (a lazy image far down comes in later).
|
|
181
|
+
const frames = [...root.querySelectorAll('.manual-shot-frame')];
|
|
182
|
+
frames.forEach(placeNumbers);
|
|
183
|
+
await Promise.all(frames.map((frame) => Promise.resolve(frame.querySelector('img')?.decode?.()).catch(() => null).then(() => placeNumbers(frame))));
|
|
184
|
+
}
|
|
185
|
+
function watchShots(root) {
|
|
186
|
+
if (!('IntersectionObserver' in window)) { for (const one of root.querySelectorAll('.manual-shot')) one.classList.add('shown'); return; }
|
|
187
|
+
const seen = new IntersectionObserver((entries) => {
|
|
188
|
+
for (const entry of entries) {
|
|
189
|
+
if (!entry.isIntersecting) continue;
|
|
190
|
+
entry.target.classList.add('shown');
|
|
191
|
+
seen.unobserve(entry.target);
|
|
192
|
+
}
|
|
193
|
+
}, { threshold: 0.45 });
|
|
194
|
+
for (const one of root.querySelectorAll('.manual-shot')) seen.observe(one);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
async function roomLanguage() {
|
|
198
|
+
try {
|
|
199
|
+
const answer = await fetch('/api/state', { cache: 'no-store' }).then((response) => (response.ok ? response.json() : null));
|
|
200
|
+
return pick(answer?.language);
|
|
201
|
+
} catch { return null; }
|
|
202
|
+
}
|
|
203
|
+
async function version() {
|
|
204
|
+
try {
|
|
205
|
+
const answer = await fetch('/api/version', { cache: 'no-store' }).then((response) => (response.ok ? response.json() : null));
|
|
206
|
+
return answer?.current ?? null;
|
|
207
|
+
} catch { return null; }
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function draw(lang, madre) {
|
|
211
|
+
const copy = MANUAL[lang];
|
|
212
|
+
const other = lang === 'es' ? 'en' : 'es';
|
|
213
|
+
document.documentElement.lang = lang;
|
|
214
|
+
document.title = `MADRE · ${copy.title}`;
|
|
215
|
+
const root = document.getElementById('manual');
|
|
216
|
+
root.replaceChildren();
|
|
217
|
+
|
|
218
|
+
// Over the page, on screen only: the other language and the PDF.
|
|
219
|
+
if (!printing) {
|
|
220
|
+
const bar = el('nav', 'manual-bar');
|
|
221
|
+
const brand = el('span', 'manual-brand');
|
|
222
|
+
brand.innerHTML = '<img src="/assets/brand/madre-app.svg" alt="" width="22" height="22">'; // trusted: our own markup
|
|
223
|
+
brand.append(el('b', null, 'MADRE'));
|
|
224
|
+
const keys = el('div', 'manual-keys');
|
|
225
|
+
const swap = el('a', 'manual-key', copy.language);
|
|
226
|
+
swap.href = `?lang=${other}`;
|
|
227
|
+
const pdf = el('a', 'manual-key primary', copy.pdf);
|
|
228
|
+
pdf.href = `/assets/manual/madre-manual-${lang}.pdf`;
|
|
229
|
+
pdf.setAttribute('download', '');
|
|
230
|
+
keys.append(swap, pdf);
|
|
231
|
+
bar.append(brand, keys);
|
|
232
|
+
root.append(bar);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// The cover.
|
|
236
|
+
const cover = el('header', 'manual-cover');
|
|
237
|
+
const mark = el('img', 'manual-mark');
|
|
238
|
+
mark.src = '/assets/brand/madre-app.svg';
|
|
239
|
+
mark.alt = '';
|
|
240
|
+
cover.append(mark, el('h1', null, copy.title), el('p', 'manual-subtitle', copy.subtitle));
|
|
241
|
+
if (madre) cover.append(el('p', 'manual-version', `MADRE ${madre}`));
|
|
242
|
+
const intro = el('div', 'manual-intro');
|
|
243
|
+
for (const line of copy.intro) intro.append(el('p', null, plain(line)));
|
|
244
|
+
cover.append(intro);
|
|
245
|
+
root.append(cover);
|
|
246
|
+
|
|
247
|
+
// The four words the rest is said with.
|
|
248
|
+
const words = el('section', 'manual-words');
|
|
249
|
+
words.append(el('h2', null, copy.words.title));
|
|
250
|
+
const grid = el('dl');
|
|
251
|
+
for (const [term, what] of copy.words.list) {
|
|
252
|
+
const one = el('div');
|
|
253
|
+
one.append(el('dt', null, term), el('dd', null, plain(what)));
|
|
254
|
+
grid.append(one);
|
|
255
|
+
}
|
|
256
|
+
words.append(grid);
|
|
257
|
+
root.append(words);
|
|
258
|
+
|
|
259
|
+
// The contents, each a link to its section.
|
|
260
|
+
const contents = el('nav', 'manual-contents');
|
|
261
|
+
contents.append(el('h2', null, copy.contents));
|
|
262
|
+
// In four parts, in the order someone new needs them: getting started, working, more, help.
|
|
263
|
+
const entry = (href, iconName, title) => {
|
|
264
|
+
const item = el('li');
|
|
265
|
+
const link = el('a');
|
|
266
|
+
link.href = href;
|
|
267
|
+
const badge = el('span', 'manual-icon');
|
|
268
|
+
badge.innerHTML = icon(iconName); // trusted: our own SVG
|
|
269
|
+
link.append(badge, el('span', null, title));
|
|
270
|
+
item.append(link);
|
|
271
|
+
return item;
|
|
272
|
+
};
|
|
273
|
+
for (const [part, name] of Object.entries(copy.parts)) {
|
|
274
|
+
const group = el('div', 'manual-part');
|
|
275
|
+
group.append(el('h3', null, name));
|
|
276
|
+
const list = el('ol');
|
|
277
|
+
for (const section of copy.sections.filter((one) => one.part === part)) list.append(entry(`#${section.id}`, section.icon, section.title));
|
|
278
|
+
if (part === 'help') list.append(entry('#atajos', 'keys', copy.shortcuts));
|
|
279
|
+
group.append(list);
|
|
280
|
+
contents.append(group);
|
|
281
|
+
}
|
|
282
|
+
root.append(contents);
|
|
283
|
+
|
|
284
|
+
copy.sections.forEach((section, index) => {
|
|
285
|
+
const part = el('section', 'manual-section');
|
|
286
|
+
part.id = section.id;
|
|
287
|
+
const head = el('header', 'manual-section-head');
|
|
288
|
+
const badge = el('span', 'manual-icon');
|
|
289
|
+
badge.innerHTML = icon(section.icon); // trusted: our own SVG
|
|
290
|
+
const words = el('div');
|
|
291
|
+
words.append(el('span', 'manual-number', String(index + 1).padStart(2, '0')), el('h2', null, section.title));
|
|
292
|
+
head.append(badge, words);
|
|
293
|
+
part.append(head, el('p', 'manual-lead', plain(section.lead)));
|
|
294
|
+
// What it looks like, its steps numbered as the marks on it, then one thing to try and what is
|
|
295
|
+
// worth knowing once the basics are there.
|
|
296
|
+
const body = el('div', 'manual-body');
|
|
297
|
+
const picture = section.shot ? shot(section.shot, lang, section.title) : null;
|
|
298
|
+
if (picture) body.append(picture);
|
|
299
|
+
// What to paste in the Terminal, with its key to copy it.
|
|
300
|
+
if (section.code?.length) {
|
|
301
|
+
const terminal = el('div', 'manual-terminal');
|
|
302
|
+
terminal.append(el('span', 'manual-terminal-dots'));
|
|
303
|
+
for (const line of section.code) {
|
|
304
|
+
const row = el('div', 'manual-terminal-line');
|
|
305
|
+
row.append(el('span', 'manual-terminal-prompt', '$'), el('code', null, line));
|
|
306
|
+
if (!printing) {
|
|
307
|
+
const take = el('button', 'manual-copy', copy.copy);
|
|
308
|
+
take.type = 'button';
|
|
309
|
+
take.addEventListener('click', async () => {
|
|
310
|
+
try { await navigator.clipboard.writeText(line); take.textContent = copy.copied; setTimeout(() => { take.textContent = copy.copy; }, 1600); } catch { /* the line stays selectable */ }
|
|
311
|
+
});
|
|
312
|
+
row.append(take);
|
|
313
|
+
}
|
|
314
|
+
terminal.append(row);
|
|
315
|
+
}
|
|
316
|
+
body.append(terminal);
|
|
317
|
+
}
|
|
318
|
+
// What goes wrong most often: what the person sees, and what to do.
|
|
319
|
+
if (section.problems?.length) {
|
|
320
|
+
const table = el('div', 'manual-problems');
|
|
321
|
+
const head = el('div', 'manual-problem head');
|
|
322
|
+
head.append(el('span', 'manual-label', copy.problem[0]), el('span', 'manual-label', copy.problem[1]));
|
|
323
|
+
table.append(head);
|
|
324
|
+
for (const [seen, fix] of section.problems) {
|
|
325
|
+
const row = el('div', 'manual-problem');
|
|
326
|
+
row.append(el('b', null, plain(seen)), rich(fix));
|
|
327
|
+
table.append(row);
|
|
328
|
+
}
|
|
329
|
+
body.append(table);
|
|
330
|
+
}
|
|
331
|
+
const side = el('div', 'manual-side');
|
|
332
|
+
const steps = el('ol', 'manual-steps');
|
|
333
|
+
(section.steps ?? []).forEach((step, at) => {
|
|
334
|
+
const item = el('li');
|
|
335
|
+
item.dataset.step = String(at + 1);
|
|
336
|
+
item.append(el('b', null, String(at + 1)), rich(step));
|
|
337
|
+
steps.append(item);
|
|
338
|
+
});
|
|
339
|
+
if (section.steps?.length) side.append(steps);
|
|
340
|
+
if (section.tryIt) {
|
|
341
|
+
const tryIt = el('aside', 'manual-try');
|
|
342
|
+
tryIt.append(el('span', 'manual-label', copy.tryIt), rich(section.tryIt));
|
|
343
|
+
side.append(tryIt);
|
|
344
|
+
}
|
|
345
|
+
if (side.childElementCount) body.append(side);
|
|
346
|
+
part.append(body);
|
|
347
|
+
const expert = el('aside', 'manual-expert');
|
|
348
|
+
expert.append(el('span', 'manual-label', copy.expert), rich(section.expert));
|
|
349
|
+
part.append(expert);
|
|
350
|
+
if (!printing) pairUp(part);
|
|
351
|
+
root.append(part);
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
// Every shortcut, as the sheet `?` opens.
|
|
355
|
+
const keysPart = el('section', 'manual-section manual-shortcuts');
|
|
356
|
+
keysPart.id = 'atajos';
|
|
357
|
+
const keysHead = el('header', 'manual-section-head');
|
|
358
|
+
const keysBadge = el('span', 'manual-icon');
|
|
359
|
+
keysBadge.innerHTML = icon('keys'); // trusted: our own SVG
|
|
360
|
+
const keysWords = el('div');
|
|
361
|
+
keysWords.append(el('span', 'manual-number', String(copy.sections.length + 1).padStart(2, '0')), el('h2', null, copy.shortcuts));
|
|
362
|
+
keysHead.append(keysBadge, keysWords);
|
|
363
|
+
keysPart.append(keysHead);
|
|
364
|
+
const groups = el('div', 'manual-shortcut-groups');
|
|
365
|
+
for (const [group, rows] of GESTURES) {
|
|
366
|
+
const box = el('div', 'manual-shortcut-group');
|
|
367
|
+
box.append(el('h3', null, group[lang] ?? group.es));
|
|
368
|
+
const table = el('dl', 'manual-keys-table');
|
|
369
|
+
for (const [what, how] of rows) {
|
|
370
|
+
const dd = el('dd');
|
|
371
|
+
dd.append(keyChip(typeof how === 'string' ? how : how[lang] ?? how.es));
|
|
372
|
+
table.append(el('dt', null, what[lang] ?? what.es), dd);
|
|
373
|
+
}
|
|
374
|
+
box.append(table);
|
|
375
|
+
groups.append(box);
|
|
376
|
+
}
|
|
377
|
+
keysPart.append(groups);
|
|
378
|
+
root.append(keysPart);
|
|
379
|
+
|
|
380
|
+
const foot = el('footer', 'manual-foot');
|
|
381
|
+
foot.append(el('p', null, copy.closing), el('p', 'manual-copy', `MADRE${madre ? ` ${madre}` : ''} · © 2026 Jossue Alcalá`));
|
|
382
|
+
root.append(foot);
|
|
383
|
+
if (printing) for (const one of root.querySelectorAll('.manual-shot')) one.classList.add('shown');
|
|
384
|
+
else watchShots(root);
|
|
385
|
+
// The numbers once the pictures have their size, and again when the page changes width.
|
|
386
|
+
// On paper the page is ready once every number is placed; on screen at once (a lazy picture far
|
|
387
|
+
// down loads only when it is near).
|
|
388
|
+
const placed = placeAll(root);
|
|
389
|
+
if (printing) void placed.then(() => { document.documentElement.dataset.ready = '1'; });
|
|
390
|
+
else document.documentElement.dataset.ready = '1';
|
|
391
|
+
let resized = 0;
|
|
392
|
+
window.addEventListener('resize', () => { clearTimeout(resized); resized = setTimeout(() => root.querySelectorAll('.manual-shot-frame').forEach(placeNumbers), 120); });
|
|
393
|
+
if (location.hash) document.getElementById(location.hash.slice(1))?.scrollIntoView();
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
if (printing) document.documentElement.classList.add('printing');
|
|
397
|
+
const [room, madre] = await Promise.all([roomLanguage(), version()]);
|
|
398
|
+
draw(pick(asked.get('lang')) ?? room ?? browser, asked.get('version') ?? madre);
|
package/public/market-art.js
CHANGED
|
@@ -155,7 +155,63 @@ function poster(item) {
|
|
|
155
155
|
<circle cx="420" cy="110" r="6" fill="#ffffff" fill-opacity=".7"/><circle cx="140" cy="300" r="5" fill="#ffffff" fill-opacity=".6"/>`);
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
+
// THE MODULE AT WORK (1.0.5): a project as a person sees it — the conversation, the bar with the
|
|
159
|
+
// module's key lit, and its window open beside, switched on. Drawn from the module's own icon.
|
|
160
|
+
function roomScene(item) {
|
|
161
|
+
const id = `mka${++drawn}`;
|
|
162
|
+
const face = moduleFace(item);
|
|
163
|
+
return svg(`<defs>${shadow(`${id}s`)}</defs>
|
|
164
|
+
<g filter="url(#${id}s)">
|
|
165
|
+
<rect x="40" y="40" width="480" height="320" rx="20" fill="#ffffff" fill-opacity=".94"/>
|
|
166
|
+
<rect x="58" y="56" width="444" height="34" rx="12" fill="#eef2f1"/>
|
|
167
|
+
${bar(72, 69, 56, 8, '#0f172a', .55)}
|
|
168
|
+
<circle cx="300" cy="73" r="10" fill="#e2e8f0"/><circle cx="326" cy="73" r="10" fill="#e2e8f0"/>
|
|
169
|
+
<rect x="342" y="61" width="24" height="24" rx="8" fill="#0f172a" fill-opacity=".86"/>
|
|
170
|
+
<g transform="translate(346 65) scale(.8)" color="#ffffff">${face.icon}</g>
|
|
171
|
+
<circle cx="384" cy="73" r="10" fill="#e2e8f0"/><circle cx="476" cy="73" r="10" fill="#e2e8f0"/>
|
|
172
|
+
<rect x="72" y="112" width="190" height="44" rx="16" fill="#f1f5f9"/>${bar(88, 126, 130, 7, '#64748b', .55)}${bar(88, 140, 96, 7, '#64748b', .4)}
|
|
173
|
+
<rect x="132" y="170" width="140" height="34" rx="14" fill="#16a34a" fill-opacity=".85"/>${bar(148, 184, 96, 7, '#ffffff', .9)}
|
|
174
|
+
<rect x="72" y="218" width="200" height="58" rx="16" fill="#f1f5f9"/>${bar(88, 234, 150, 7, '#64748b', .55)}${bar(88, 248, 168, 7, '#64748b', .45)}${bar(88, 262, 90, 7, '#64748b', .35)}
|
|
175
|
+
<rect x="72" y="300" width="200" height="38" rx="14" fill="#ffffff" stroke="#e2e8f0"/>${bar(88, 316, 110, 6, '#94a3b8', .5)}
|
|
176
|
+
</g>
|
|
177
|
+
<g filter="url(#${id}s)">
|
|
178
|
+
<rect x="296" y="112" width="206" height="226" rx="18" fill="#ffffff"/>
|
|
179
|
+
<rect x="314" y="130" width="40" height="40" rx="12" fill="#0f172a" fill-opacity=".86"/>
|
|
180
|
+
<g transform="translate(320 136) scale(1.4)" color="#ffffff">${face.icon}</g>
|
|
181
|
+
${bar(366, 140, 86, 9, '#0f172a', .65)}${bar(366, 156, 62, 6, '#94a3b8', .55)}
|
|
182
|
+
<rect x="314" y="190" width="170" height="40" rx="12" fill="#f1f5f9"/>${bar(328, 207, 70, 7, '#475569', .55)}
|
|
183
|
+
<rect x="440" y="200" width="34" height="20" rx="10" fill="#16a34a"/><circle cx="464" cy="210" r="7" fill="#ffffff"/>
|
|
184
|
+
${bar(314, 248, 160, 7, '#94a3b8', .5)}${bar(314, 264, 140, 7, '#94a3b8', .4)}${bar(314, 280, 118, 7, '#94a3b8', .35)}
|
|
185
|
+
<rect x="314" y="300" width="80" height="24" rx="12" fill="#0f172a" fill-opacity=".08"/>
|
|
186
|
+
</g>`);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// THREE STEPS (1.0.5): find it in the Market, switch it on, and it is working. No words: a basket,
|
|
190
|
+
// a switch and the module's own icon with a check, joined by the way they follow each other.
|
|
191
|
+
function stepsScene(item) {
|
|
192
|
+
const id = `mka${++drawn}`;
|
|
193
|
+
const face = moduleFace(item);
|
|
194
|
+
const card = (x) => `<rect x="${x}" y="130" width="140" height="150" rx="22" fill="#ffffff" fill-opacity=".94"/>`;
|
|
195
|
+
const arrow = (x) => `<path d="M${x} 205h26m-8-8 8 8-8 8" fill="none" stroke="#ffffff" stroke-width="5" stroke-linecap="round" stroke-linejoin="round" opacity=".85"/>`;
|
|
196
|
+
const basket = '<g fill="none" stroke="#0f172a" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><rect x="4.4" y="5.2" width="3.4" height="3.4" rx="1"/><circle cx="10" cy="5.3" r="1.8"/><rect x="12.2" y="5.2" width="3.4" height="3.4" rx="1"/><path d="M2.8 10.4h14.4l-1.5 5.4a1.6 1.6 0 0 1-1.6 1.2H5.9a1.6 1.6 0 0 1-1.6-1.2z"/></g>';
|
|
197
|
+
return svg(`<defs>${shadow(`${id}s`)}</defs>
|
|
198
|
+
<g filter="url(#${id}s)">${card(46)}${card(210)}${card(374)}</g>
|
|
199
|
+
<g transform="translate(86 165) scale(3)">${basket}</g>${bar(86, 246, 60, 7, '#94a3b8', .55)}
|
|
200
|
+
<rect x="244" y="184" width="72" height="40" rx="20" fill="#16a34a"/><circle cx="296" cy="204" r="15" fill="#ffffff"/>${bar(250, 246, 60, 7, '#94a3b8', .55)}
|
|
201
|
+
<rect x="404" y="160" width="80" height="80" rx="22" fill="#0f172a" fill-opacity=".88"/>
|
|
202
|
+
<g transform="translate(420 176) scale(2.4)" color="#ffffff">${face.icon}</g>
|
|
203
|
+
<circle cx="478" cy="166" r="15" fill="#16a34a" stroke="#ffffff" stroke-width="3"/><path d="M471 166l5 5 9-10" fill="none" stroke="#ffffff" stroke-width="3.2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
204
|
+
${bar(414, 256, 60, 7, '#94a3b8', .55)}
|
|
205
|
+
${arrow(190)}${arrow(354)}`);
|
|
206
|
+
}
|
|
207
|
+
|
|
158
208
|
// The picture of a module: its own scene when it has one — drawn here, or sent with the catalog
|
|
159
209
|
// (kept to the shapes a drawing needs, market.js) — and its poster otherwise.
|
|
160
210
|
export const marketArt = (item) => (SCENES[item?.id] ? SCENES[item.id]() : cleanSvg(remoteEntry(item?.id)?.art) ?? poster(item));
|
|
161
211
|
export const hasScene = (item) => Boolean(SCENES[item?.id] || remoteEntry(item?.id)?.art);
|
|
212
|
+
// Its gallery (1.0.5): its picture, then two more — the ones its catalog entry sends (`shots`,
|
|
213
|
+
// drawings kept to their shapes), or the module at work and its three steps.
|
|
214
|
+
export function marketGallery(item) {
|
|
215
|
+
const sent = (remoteEntry(item?.id)?.shots ?? []).map((one) => cleanSvg(one)).filter(Boolean).slice(0, 2);
|
|
216
|
+
return [marketArt(item), sent[0] ?? roomScene(item), sent[1] ?? stepsScene(item)];
|
|
217
|
+
}
|