@wildwinter/app-shell 0.39.0 → 0.40.1
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 +7 -0
- package/dist/about.css +5 -5
- package/dist/about.css.map +1 -1
- package/dist/anchored.css +5 -5
- package/dist/anchored.css.map +1 -1
- package/dist/chunk-4OAORWEM.js +56 -0
- package/dist/chunk-4OAORWEM.js.map +1 -0
- package/dist/{chunk-K2AOLQW4.js → chunk-EHR2KBZC.js} +3 -3
- package/dist/{chunk-K2AOLQW4.js.map → chunk-EHR2KBZC.js.map} +1 -1
- package/dist/{chunk-KGAMP5LW.js → chunk-G2JT3HZH.js} +16 -3
- package/dist/chunk-G2JT3HZH.js.map +1 -0
- package/dist/{chunk-S4KWQLYN.js → chunk-OPZPFOPS.js} +4 -4
- package/dist/{chunk-S4KWQLYN.js.map → chunk-OPZPFOPS.js.map} +1 -1
- package/dist/{chunk-L5HOBEKL.js → chunk-R3NXPHRZ.js} +3 -3
- package/dist/{chunk-L5HOBEKL.js.map → chunk-R3NXPHRZ.js.map} +1 -1
- package/dist/{chunk-C6UVQYKI.js → chunk-SEWJLUOD.js} +3 -3
- package/dist/{chunk-C6UVQYKI.js.map → chunk-SEWJLUOD.js.map} +1 -1
- package/dist/{chunk-XZYZXY7I.js → chunk-UG2P777F.js} +36 -3
- package/dist/chunk-UG2P777F.js.map +1 -0
- package/dist/{chunk-2NMVIM54.js → chunk-YRFJLJUH.js} +3 -3
- package/dist/{chunk-2NMVIM54.js.map → chunk-YRFJLJUH.js.map} +1 -1
- package/dist/chunk-YWMSQFXX.js +146 -0
- package/dist/chunk-YWMSQFXX.js.map +1 -0
- package/dist/comments.css +11 -11
- package/dist/comments.css.map +1 -1
- package/dist/confirm.css +2 -2
- package/dist/confirm.css.map +1 -1
- package/dist/context-menu.cjs.map +1 -1
- package/dist/context-menu.css +1 -1
- package/dist/context-menu.css.map +1 -1
- package/dist/context-menu.js +2 -2
- package/dist/controls.css +70 -11
- package/dist/controls.css.map +1 -1
- package/dist/dialog.cjs.map +1 -1
- package/dist/dialog.css +3 -2
- package/dist/dialog.css.map +1 -1
- package/dist/dialog.js +2 -2
- package/dist/identity.css +2 -2
- package/dist/identity.css.map +1 -1
- package/dist/index.cjs +270 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +39 -6
- package/dist/index.d.ts +39 -6
- package/dist/index.js +17 -13
- package/dist/index.js.map +1 -1
- package/dist/job.css +1 -1
- package/dist/job.css.map +1 -1
- package/dist/keys.cjs +155 -0
- package/dist/keys.cjs.map +1 -0
- package/dist/keys.css +41 -0
- package/dist/keys.css.map +1 -0
- package/dist/keys.d.cts +57 -0
- package/dist/keys.d.ts +57 -0
- package/dist/keys.js +3 -0
- package/dist/keys.js.map +1 -0
- package/dist/link-status.cjs +13 -0
- package/dist/link-status.cjs.map +1 -1
- package/dist/link-status.css +8 -8
- package/dist/link-status.css.map +1 -1
- package/dist/link-status.js +2 -2
- package/dist/notes-editor.css +7 -7
- package/dist/notes-editor.css.map +1 -1
- package/dist/pane-shell.css +7 -2
- package/dist/pane-shell.css.map +1 -1
- package/dist/problems.cjs +61 -0
- package/dist/problems.cjs.map +1 -0
- package/dist/problems.d.cts +57 -0
- package/dist/problems.d.ts +57 -0
- package/dist/problems.js +3 -0
- package/dist/problems.js.map +1 -0
- package/dist/property-list.cjs.map +1 -1
- package/dist/property-list.js +2 -2
- package/dist/save.css +1 -1
- package/dist/save.css.map +1 -1
- package/dist/settings.css +13 -13
- package/dist/settings.css.map +1 -1
- package/dist/stale.css +1 -1
- package/dist/stale.css.map +1 -1
- package/dist/stepper.css +14 -4
- package/dist/stepper.css.map +1 -1
- package/dist/toast.css +5 -5
- package/dist/toast.css.map +1 -1
- package/dist/tokens.css +2 -1
- package/dist/tokens.css.map +1 -1
- package/dist/tool-window.css +3 -2
- package/dist/tool-window.css.map +1 -1
- package/dist/tooltip.css +3 -3
- package/dist/tooltip.css.map +1 -1
- package/dist/updater-view.cjs.map +1 -1
- package/dist/updater-view.js +3 -3
- package/dist/updater.css +5 -5
- package/dist/updater.css.map +1 -1
- package/dist/vc.css +1 -1
- package/dist/vc.css.map +1 -1
- package/dist/welcome.cjs.map +1 -1
- package/dist/welcome.css +21 -21
- package/dist/welcome.css.map +1 -1
- package/dist/welcome.js +2 -2
- package/package.json +15 -1
- package/dist/chunk-KGAMP5LW.js.map +0 -1
- package/dist/chunk-XZYZXY7I.js.map +0 -1
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/problems.ts
|
|
4
|
+
function problemName(p, dangling = false) {
|
|
5
|
+
if (p.title) return `\u201C${p.title}\u201D`;
|
|
6
|
+
if (dangling && p.where) return `(id ${p.where})`;
|
|
7
|
+
return "This";
|
|
8
|
+
}
|
|
9
|
+
function describeProblem(problem, table = {}) {
|
|
10
|
+
const entry = problem.code ? table[problem.code] : void 0;
|
|
11
|
+
if (entry) {
|
|
12
|
+
const copy = entry(problem);
|
|
13
|
+
const text = copy.dangling && !problem.title && problem.where && !copy.text.includes(`(id ${problem.where})`) ? `${copy.text} (id ${problem.where})` : copy.text;
|
|
14
|
+
return copy.next ? { text, next: copy.next } : { text };
|
|
15
|
+
}
|
|
16
|
+
const message = problem.message.replace(/\s*\[[^\]]*\]\s*$/, "").trim();
|
|
17
|
+
return { text: problem.title ? `${problem.title}: ${message}` : message };
|
|
18
|
+
}
|
|
19
|
+
function problemLine(problem, table) {
|
|
20
|
+
const { text, next } = describeProblem(problem, table);
|
|
21
|
+
return next ? `${text} ${next}` : text;
|
|
22
|
+
}
|
|
23
|
+
var defaultProblemCopy = {
|
|
24
|
+
"duplicate-gameid": (p) => ({
|
|
25
|
+
text: `The Game ID on ${problemName(p)} is already used elsewhere.`,
|
|
26
|
+
next: "Each one must be unique; change one of them."
|
|
27
|
+
}),
|
|
28
|
+
"invalid-gameid": (p) => ({
|
|
29
|
+
text: `The Game ID on ${problemName(p)} isn't valid.`,
|
|
30
|
+
next: "Use lowercase letters, digits and hyphens."
|
|
31
|
+
}),
|
|
32
|
+
"dangling-reference": (p) => ({
|
|
33
|
+
text: `${problemName(p, true)} points at something that no longer exists.`,
|
|
34
|
+
next: "Choose where it goes.",
|
|
35
|
+
dangling: true
|
|
36
|
+
}),
|
|
37
|
+
"unknown-property": (p) => ({
|
|
38
|
+
text: `${problemName(p)} uses a property that isn't set up yet.`,
|
|
39
|
+
next: "Declare it in the project settings, or fix the name."
|
|
40
|
+
}),
|
|
41
|
+
"missing-name": (p) => ({ text: `${problemName(p)} needs a name.` }),
|
|
42
|
+
"empty": (p) => ({
|
|
43
|
+
text: `${problemName(p)} is empty.`,
|
|
44
|
+
next: "Add something inside it, or remove it."
|
|
45
|
+
}),
|
|
46
|
+
"stale-build": (p) => ({
|
|
47
|
+
text: `Your playable build${p.path ? ` (${p.path})` : ""} is out of date.`,
|
|
48
|
+
next: "It refreshes the next time you publish."
|
|
49
|
+
}),
|
|
50
|
+
"merge-conflict": (p) => ({
|
|
51
|
+
text: `${p.path ?? "This file"} still has an unresolved merge conflict in it.`,
|
|
52
|
+
next: "Resolve it in your version control tool, then reopen the project."
|
|
53
|
+
})
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
exports.defaultProblemCopy = defaultProblemCopy;
|
|
57
|
+
exports.describeProblem = describeProblem;
|
|
58
|
+
exports.problemLine = problemLine;
|
|
59
|
+
exports.problemName = problemName;
|
|
60
|
+
//# sourceMappingURL=problems.cjs.map
|
|
61
|
+
//# sourceMappingURL=problems.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/problems.ts"],"names":[],"mappings":";;;AA+CO,SAAS,WAAA,CAAY,CAAA,EAAgB,QAAA,GAAW,KAAA,EAAe;AACpE,EAAA,IAAI,CAAA,CAAE,KAAA,EAAO,OAAO,CAAA,MAAA,EAAI,EAAE,KAAK,CAAA,MAAA,CAAA;AAC/B,EAAA,IAAI,YAAY,CAA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A,GACR,CAAA;AAAA,EACA,gBAAA,EAAkB,CAAC,CAAA,MAAO;AAAA,IACxB,IAAA,EAAM,CAAA,EAAG,CAAA,CAAE,IAAA,IAAQ,WAAW,CAAA,8CAAA,CAAA;AAAA,IAC9B,IAAA,EAAM;AAAA,GACR;AACF","file":"problems.cjs","sourcesContent":["// ---------------------------------------------------------------------------\n// Problem copy: a validator's diagnostic rewritten for the person at the\n// keyboard, through a table the app fills.\n//\n// Patterpad's `humanizeProblem` (its renderer.ts) proved the shape: a dozen\n// validator categories each mapped to a plain sentence with a next step, naming\n// things by their title, and a fallback that softens the technical residue.\n// Storyletter showed the raw compiler string and labelled it `path [where]`\n// (ui-review-2026-09, finding 17), the bracketed id that \"Diagnostics name what\n// the author can see\" (design-language.md) rules out for anything but a\n// DANGLING reference. This module is the translator; the tables are the\n// apps', because the codes are theirs. `defaultProblemCopy` covers the handful\n// of codes both validators raise in some form, as a floor an app spreads into\n// its own table.\n// ---------------------------------------------------------------------------\n\n/** What a translator needs to know about a problem. `code` is the app's own\n * category (Patterpad's `detail`, or a code Storyletter derives from its\n * compiler message); `title` is the author-facing name of the thing the\n * problem is about, when the app can resolve one; `where` is the raw\n * reference (an id) for when it cannot. */\nexport interface ProblemLike {\n code?: string;\n message: string;\n path?: string;\n where?: string;\n title?: string;\n}\n\nexport interface ProblemCopy {\n /** The sentence: what is wrong, in the author's words. */\n text: string;\n /** What to do about it, when there is one thing to do. */\n next?: string;\n /** The reference this problem is about no longer has a name to give, so the\n * raw id may be shown, written `(id ...)` so it cannot be mistaken for a\n * name. Set by the table entry; the translator never guesses it. */\n dangling?: boolean;\n}\n\nexport type ProblemCopyEntry = (problem: ProblemLike) => ProblemCopy;\nexport type ProblemCopyTable = Record<string, ProblemCopyEntry>;\n\n/** The name to call the thing a problem is about: its title in curly quotes,\n * \"(id ...)\" only when the reference dangles and there is nothing else,\n * and \"This\" otherwise, because the bar's \"go to\" shows the reader what\n * \"this\" is and an id is not something they can look for. */\nexport function problemName(p: ProblemLike, dangling = false): string {\n if (p.title) return `“${p.title}”`;\n if (dangling && p.where) return `(id ${p.where})`;\n return \"This\";\n}\n\n/**\n * Translate `problem` through `table`. A matching entry decides the copy; with\n * no entry the raw message is kept and prefixed by the title when there is one\n * (\"Burner Rig: duplicate id\"). Nothing here ever writes `[where]`; an id\n * appears only as `(id ...)`, only when the entry says the reference dangles,\n * and only when there is no title to say instead.\n */\nexport function describeProblem(problem: ProblemLike, table: ProblemCopyTable = {}): ProblemCopy {\n const entry = problem.code ? table[problem.code] : undefined;\n if (entry) {\n const copy = entry(problem);\n const text = copy.dangling && !problem.title && problem.where && !copy.text.includes(`(id ${problem.where})`)\n ? `${copy.text} (id ${problem.where})`\n : copy.text;\n return copy.next ? { text, next: copy.next } : { text };\n }\n const message = problem.message.replace(/\\s*\\[[^\\]]*\\]\\s*$/, \"\").trim();\n return { text: problem.title ? `${problem.title}: ${message}` : message };\n}\n\n/** `describeProblem` as one line for a bar that has room for one: the sentence,\n * then the next step after a space. */\nexport function problemLine(problem: ProblemLike, table?: ProblemCopyTable): string {\n const { text, next } = describeProblem(problem, table);\n return next ? `${text} ${next}` : text;\n}\n\n/**\n * The codes both validators raise in some form, in the family's voice. An app\n * spreads this into its own table and adds its own codes over it; a code an\n * app does not raise costs nothing.\n *\n * duplicate-gameid two things share one Game ID\n * invalid-gameid a Game ID that breaks the address rule\n * dangling-reference a jump / tag / property points at something gone\n * unknown-property a condition or effect names an undeclared property\n * missing-name a thing that needs a name has none\n * empty a container with nothing in it\n * stale-build the playable build is older than the source\n * merge-conflict a file still carries conflict markers\n */\nexport const defaultProblemCopy: ProblemCopyTable = {\n \"duplicate-gameid\": (p) => ({\n text: `The Game ID on ${problemName(p)} is already used elsewhere.`,\n next: \"Each one must be unique; change one of them.\",\n }),\n \"invalid-gameid\": (p) => ({\n text: `The Game ID on ${problemName(p)} isn't valid.`,\n next: \"Use lowercase letters, digits and hyphens.\",\n }),\n \"dangling-reference\": (p) => ({\n text: `${problemName(p, true)} points at something that no longer exists.`,\n next: \"Choose where it goes.\",\n dangling: true,\n }),\n \"unknown-property\": (p) => ({\n text: `${problemName(p)} uses a property that isn't set up yet.`,\n next: \"Declare it in the project settings, or fix the name.\",\n }),\n \"missing-name\": (p) => ({ text: `${problemName(p)} needs a name.` }),\n \"empty\": (p) => ({\n text: `${problemName(p)} is empty.`,\n next: \"Add something inside it, or remove it.\",\n }),\n \"stale-build\": (p) => ({\n text: `Your playable build${p.path ? ` (${p.path})` : \"\"} is out of date.`,\n next: \"It refreshes the next time you publish.\",\n }),\n \"merge-conflict\": (p) => ({\n text: `${p.path ?? \"This file\"} still has an unresolved merge conflict in it.`,\n next: \"Resolve it in your version control tool, then reopen the project.\",\n }),\n};\n"]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/** What a translator needs to know about a problem. `code` is the app's own
|
|
2
|
+
* category (Patterpad's `detail`, or a code Storyletter derives from its
|
|
3
|
+
* compiler message); `title` is the author-facing name of the thing the
|
|
4
|
+
* problem is about, when the app can resolve one; `where` is the raw
|
|
5
|
+
* reference (an id) for when it cannot. */
|
|
6
|
+
interface ProblemLike {
|
|
7
|
+
code?: string;
|
|
8
|
+
message: string;
|
|
9
|
+
path?: string;
|
|
10
|
+
where?: string;
|
|
11
|
+
title?: string;
|
|
12
|
+
}
|
|
13
|
+
interface ProblemCopy {
|
|
14
|
+
/** The sentence: what is wrong, in the author's words. */
|
|
15
|
+
text: string;
|
|
16
|
+
/** What to do about it, when there is one thing to do. */
|
|
17
|
+
next?: string;
|
|
18
|
+
/** The reference this problem is about no longer has a name to give, so the
|
|
19
|
+
* raw id may be shown, written `(id ...)` so it cannot be mistaken for a
|
|
20
|
+
* name. Set by the table entry; the translator never guesses it. */
|
|
21
|
+
dangling?: boolean;
|
|
22
|
+
}
|
|
23
|
+
type ProblemCopyEntry = (problem: ProblemLike) => ProblemCopy;
|
|
24
|
+
type ProblemCopyTable = Record<string, ProblemCopyEntry>;
|
|
25
|
+
/** The name to call the thing a problem is about: its title in curly quotes,
|
|
26
|
+
* "(id ...)" only when the reference dangles and there is nothing else,
|
|
27
|
+
* and "This" otherwise, because the bar's "go to" shows the reader what
|
|
28
|
+
* "this" is and an id is not something they can look for. */
|
|
29
|
+
declare function problemName(p: ProblemLike, dangling?: boolean): string;
|
|
30
|
+
/**
|
|
31
|
+
* Translate `problem` through `table`. A matching entry decides the copy; with
|
|
32
|
+
* no entry the raw message is kept and prefixed by the title when there is one
|
|
33
|
+
* ("Burner Rig: duplicate id"). Nothing here ever writes `[where]`; an id
|
|
34
|
+
* appears only as `(id ...)`, only when the entry says the reference dangles,
|
|
35
|
+
* and only when there is no title to say instead.
|
|
36
|
+
*/
|
|
37
|
+
declare function describeProblem(problem: ProblemLike, table?: ProblemCopyTable): ProblemCopy;
|
|
38
|
+
/** `describeProblem` as one line for a bar that has room for one: the sentence,
|
|
39
|
+
* then the next step after a space. */
|
|
40
|
+
declare function problemLine(problem: ProblemLike, table?: ProblemCopyTable): string;
|
|
41
|
+
/**
|
|
42
|
+
* The codes both validators raise in some form, in the family's voice. An app
|
|
43
|
+
* spreads this into its own table and adds its own codes over it; a code an
|
|
44
|
+
* app does not raise costs nothing.
|
|
45
|
+
*
|
|
46
|
+
* duplicate-gameid two things share one Game ID
|
|
47
|
+
* invalid-gameid a Game ID that breaks the address rule
|
|
48
|
+
* dangling-reference a jump / tag / property points at something gone
|
|
49
|
+
* unknown-property a condition or effect names an undeclared property
|
|
50
|
+
* missing-name a thing that needs a name has none
|
|
51
|
+
* empty a container with nothing in it
|
|
52
|
+
* stale-build the playable build is older than the source
|
|
53
|
+
* merge-conflict a file still carries conflict markers
|
|
54
|
+
*/
|
|
55
|
+
declare const defaultProblemCopy: ProblemCopyTable;
|
|
56
|
+
|
|
57
|
+
export { type ProblemCopy, type ProblemCopyEntry, type ProblemCopyTable, type ProblemLike, defaultProblemCopy, describeProblem, problemLine, problemName };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/** What a translator needs to know about a problem. `code` is the app's own
|
|
2
|
+
* category (Patterpad's `detail`, or a code Storyletter derives from its
|
|
3
|
+
* compiler message); `title` is the author-facing name of the thing the
|
|
4
|
+
* problem is about, when the app can resolve one; `where` is the raw
|
|
5
|
+
* reference (an id) for when it cannot. */
|
|
6
|
+
interface ProblemLike {
|
|
7
|
+
code?: string;
|
|
8
|
+
message: string;
|
|
9
|
+
path?: string;
|
|
10
|
+
where?: string;
|
|
11
|
+
title?: string;
|
|
12
|
+
}
|
|
13
|
+
interface ProblemCopy {
|
|
14
|
+
/** The sentence: what is wrong, in the author's words. */
|
|
15
|
+
text: string;
|
|
16
|
+
/** What to do about it, when there is one thing to do. */
|
|
17
|
+
next?: string;
|
|
18
|
+
/** The reference this problem is about no longer has a name to give, so the
|
|
19
|
+
* raw id may be shown, written `(id ...)` so it cannot be mistaken for a
|
|
20
|
+
* name. Set by the table entry; the translator never guesses it. */
|
|
21
|
+
dangling?: boolean;
|
|
22
|
+
}
|
|
23
|
+
type ProblemCopyEntry = (problem: ProblemLike) => ProblemCopy;
|
|
24
|
+
type ProblemCopyTable = Record<string, ProblemCopyEntry>;
|
|
25
|
+
/** The name to call the thing a problem is about: its title in curly quotes,
|
|
26
|
+
* "(id ...)" only when the reference dangles and there is nothing else,
|
|
27
|
+
* and "This" otherwise, because the bar's "go to" shows the reader what
|
|
28
|
+
* "this" is and an id is not something they can look for. */
|
|
29
|
+
declare function problemName(p: ProblemLike, dangling?: boolean): string;
|
|
30
|
+
/**
|
|
31
|
+
* Translate `problem` through `table`. A matching entry decides the copy; with
|
|
32
|
+
* no entry the raw message is kept and prefixed by the title when there is one
|
|
33
|
+
* ("Burner Rig: duplicate id"). Nothing here ever writes `[where]`; an id
|
|
34
|
+
* appears only as `(id ...)`, only when the entry says the reference dangles,
|
|
35
|
+
* and only when there is no title to say instead.
|
|
36
|
+
*/
|
|
37
|
+
declare function describeProblem(problem: ProblemLike, table?: ProblemCopyTable): ProblemCopy;
|
|
38
|
+
/** `describeProblem` as one line for a bar that has room for one: the sentence,
|
|
39
|
+
* then the next step after a space. */
|
|
40
|
+
declare function problemLine(problem: ProblemLike, table?: ProblemCopyTable): string;
|
|
41
|
+
/**
|
|
42
|
+
* The codes both validators raise in some form, in the family's voice. An app
|
|
43
|
+
* spreads this into its own table and adds its own codes over it; a code an
|
|
44
|
+
* app does not raise costs nothing.
|
|
45
|
+
*
|
|
46
|
+
* duplicate-gameid two things share one Game ID
|
|
47
|
+
* invalid-gameid a Game ID that breaks the address rule
|
|
48
|
+
* dangling-reference a jump / tag / property points at something gone
|
|
49
|
+
* unknown-property a condition or effect names an undeclared property
|
|
50
|
+
* missing-name a thing that needs a name has none
|
|
51
|
+
* empty a container with nothing in it
|
|
52
|
+
* stale-build the playable build is older than the source
|
|
53
|
+
* merge-conflict a file still carries conflict markers
|
|
54
|
+
*/
|
|
55
|
+
declare const defaultProblemCopy: ProblemCopyTable;
|
|
56
|
+
|
|
57
|
+
export { type ProblemCopy, type ProblemCopyEntry, type ProblemCopyTable, type ProblemLike, defaultProblemCopy, describeProblem, problemLine, problemName };
|
package/dist/problems.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"problems.js"}
|