@loadbare/app 0.7.4 → 0.8.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.
Files changed (48) hide show
  1. package/dist/build/skills-cli.d.ts +12 -0
  2. package/dist/build/skills-cli.d.ts.map +1 -0
  3. package/dist/build/skills-cli.js +81 -0
  4. package/dist/build/skills-cli.js.map +1 -0
  5. package/dist/build/skills.d.ts +47 -0
  6. package/dist/build/skills.d.ts.map +1 -0
  7. package/dist/build/skills.js +124 -0
  8. package/dist/build/skills.js.map +1 -0
  9. package/dist/core/lb-constants.d.ts +1 -2
  10. package/dist/core/lb-constants.d.ts.map +1 -1
  11. package/dist/core/lb-constants.js +13 -12
  12. package/dist/core/lb-constants.js.map +1 -1
  13. package/dist/core/lb-types.d.ts +4 -10
  14. package/dist/core/lb-types.d.ts.map +1 -1
  15. package/dist/core/lb-types.js.map +1 -1
  16. package/dist/hub/lb-hub.browser.d.ts.map +1 -1
  17. package/dist/hub/lb-hub.browser.js +47 -24
  18. package/dist/hub/lb-hub.browser.js.map +1 -1
  19. package/dist/server/lb-express.d.ts.map +1 -1
  20. package/dist/server/lb-express.js +2 -7
  21. package/dist/server/lb-express.js.map +1 -1
  22. package/dist/server/lb-server.d.ts +8 -15
  23. package/dist/server/lb-server.d.ts.map +1 -1
  24. package/dist/server/lb-server.js +0 -3
  25. package/dist/server/lb-server.js.map +1 -1
  26. package/docs/TECHREF-1.0.md +21 -13
  27. package/docs/analysis-closed-set.md +16 -9
  28. package/docs/comparison.md +7 -6
  29. package/docs/reference/custom-elements.md +11 -6
  30. package/docs/reference/data-binding.md +36 -12
  31. package/docs/reference/page-files.md +13 -9
  32. package/docs/reference/widgets.md +4 -4
  33. package/docs/roadmap.md +1 -1
  34. package/docs/testing.md +5 -1
  35. package/docs/theory.md +1 -1
  36. package/docs/tutorials/080-widget-requests.md +9 -28
  37. package/package.json +8 -4
  38. package/skills/loadbare-app/SKILL.md +258 -0
  39. package/skills/loadbare-app/references/TECHREF-1.0.md +1189 -0
  40. package/skills/loadbare-app/references/builder.md +134 -0
  41. package/skills/loadbare-app/references/chrome.md +158 -0
  42. package/skills/loadbare-app/references/css.md +44 -0
  43. package/skills/loadbare-app/references/custom-elements.md +397 -0
  44. package/skills/loadbare-app/references/data-binding.md +457 -0
  45. package/skills/loadbare-app/references/overview.md +38 -0
  46. package/skills/loadbare-app/references/page-files.md +194 -0
  47. package/skills/loadbare-app/references/server.md +142 -0
  48. package/skills/loadbare-app/references/widgets.md +174 -0
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * loadbare-app — commands that are not the build.
4
+ *
5
+ * loadbare-app skills install [--copy] [--dir <path>]
6
+ *
7
+ * Installs the agent skills that ship in this package into `.agents/skills`
8
+ * and `.claude/skills`, or into `--dir` alone — see build/skills.ts. Nothing
9
+ * goes to stdout; every line is progress, on stderr.
10
+ */
11
+ export {};
12
+ //# sourceMappingURL=skills-cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skills-cli.d.ts","sourceRoot":"","sources":["../../build/skills-cli.ts"],"names":[],"mappings":";AACA;;;;;;;;GAQG"}
@@ -0,0 +1,81 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * loadbare-app — commands that are not the build.
4
+ *
5
+ * loadbare-app skills install [--copy] [--dir <path>]
6
+ *
7
+ * Installs the agent skills that ship in this package into `.agents/skills`
8
+ * and `.claude/skills`, or into `--dir` alone — see build/skills.ts. Nothing
9
+ * goes to stdout; every line is progress, on stderr.
10
+ */
11
+ import { parseArgs } from "node:util";
12
+ import path from "node:path";
13
+ import { fileURLToPath } from "node:url";
14
+ import { findPackageRoot } from "./package-root.js";
15
+ import { installSkills, SKILL_DESTINATIONS } from "./skills.js";
16
+ const USAGE = "usage: loadbare-app skills install [--copy] [--dir <path>]";
17
+ async function main() {
18
+ let parsed;
19
+ try {
20
+ parsed = parseArgs({
21
+ allowPositionals: true,
22
+ options: {
23
+ copy: { type: "boolean", default: false },
24
+ dir: { type: "string" },
25
+ },
26
+ });
27
+ }
28
+ catch (err) {
29
+ console.error(`loadbare-app: ${err.message}`);
30
+ console.error(USAGE);
31
+ return 1;
32
+ }
33
+ const { values, positionals } = parsed;
34
+ if (positionals.join(" ") !== "skills install") {
35
+ console.error(USAGE);
36
+ return 1;
37
+ }
38
+ // Source and compiled output sit at different depths, so the package is
39
+ // found by walking up rather than by counting.
40
+ const packageRoot = await findPackageRoot(path.dirname(fileURLToPath(import.meta.url)));
41
+ const source = path.join(packageRoot, "skills");
42
+ const destinations = values.dir ? [values.dir] : SKILL_DESTINATIONS;
43
+ const result = installSkills({
44
+ source,
45
+ destinations,
46
+ copy: values.copy,
47
+ cwd: process.cwd(),
48
+ log: (line) => console.error(line),
49
+ });
50
+ // An install with no skills in it is a packaging fault, not a user error,
51
+ // and saying where it looked is what makes that diagnosable.
52
+ if (result.names.length === 0) {
53
+ console.error(`loadbare-app: this install of @loadbare/app carries no skills (looked in ${source})`);
54
+ return 1;
55
+ }
56
+ console.error("");
57
+ if (result.copiedInstead) {
58
+ console.error("Some links could not be created and those skills were copied instead.");
59
+ console.error("A copy does not follow the package when it is upgraded — rerun this");
60
+ console.error("command after an upgrade, or use --copy everywhere and commit the result.");
61
+ console.error("");
62
+ }
63
+ if (values.copy) {
64
+ console.error("These are copies. Commit them, and rerun this command after upgrading");
65
+ console.error("@loadbare/app so the skill matches the framework.");
66
+ }
67
+ else {
68
+ console.error("These are links into node_modules. To keep them out of git:");
69
+ console.error("");
70
+ for (const destination of destinations) {
71
+ for (const name of result.names) {
72
+ console.error(` ${path.join(destination, name)}`);
73
+ }
74
+ }
75
+ }
76
+ console.error("");
77
+ console.error("Start your agent from this directory and it will find them.");
78
+ return result.refused > 0 ? 1 : 0;
79
+ }
80
+ process.exitCode = await main();
81
+ //# sourceMappingURL=skills-cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skills-cli.js","sourceRoot":"","sources":["../../build/skills-cli.ts"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KAAK,EAAE,CAAC;gBAChC,OAAO,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;YACvD,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAClB,OAAO,CAAC,KAAK,CAAC,6DAA6D,CAAC,CAAC;IAE7E,OAAO,MAAM,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACpC,CAAC;AAED,OAAO,CAAC,QAAQ,GAAG,MAAM,IAAI,EAAE,CAAC","sourcesContent":["#!/usr/bin/env node\n/**\n * loadbare-app — commands that are not the build.\n *\n * loadbare-app skills install [--copy] [--dir <path>]\n *\n * Installs the agent skills that ship in this package into `.agents/skills`\n * and `.claude/skills`, or into `--dir` alone — see build/skills.ts. Nothing\n * goes to stdout; every line is progress, on stderr.\n */\n\nimport { parseArgs } from \"node:util\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { findPackageRoot } from \"./package-root.js\";\nimport { installSkills, SKILL_DESTINATIONS } from \"./skills.js\";\n\nconst USAGE = \"usage: loadbare-app skills install [--copy] [--dir <path>]\";\n\nasync function main(): Promise<number> {\n let parsed;\n try {\n parsed = parseArgs({\n allowPositionals: true,\n options: {\n copy: { type: \"boolean\", default: false },\n dir: { type: \"string\" },\n },\n });\n } catch (err) {\n console.error(`loadbare-app: ${(err as Error).message}`);\n console.error(USAGE);\n return 1;\n }\n\n const { values, positionals } = parsed;\n if (positionals.join(\" \") !== \"skills install\") {\n console.error(USAGE);\n return 1;\n }\n\n // Source and compiled output sit at different depths, so the package is\n // found by walking up rather than by counting.\n const packageRoot = await findPackageRoot(\n path.dirname(fileURLToPath(import.meta.url)),\n );\n const source = path.join(packageRoot, \"skills\");\n const destinations = values.dir ? [values.dir] : SKILL_DESTINATIONS;\n\n const result = installSkills({\n source,\n destinations,\n copy: values.copy!,\n cwd: process.cwd(),\n log: (line) => console.error(line),\n });\n\n // An install with no skills in it is a packaging fault, not a user error,\n // and saying where it looked is what makes that diagnosable.\n if (result.names.length === 0) {\n console.error(\n `loadbare-app: this install of @loadbare/app carries no skills (looked in ${source})`,\n );\n return 1;\n }\n\n console.error(\"\");\n if (result.copiedInstead) {\n console.error(\n \"Some links could not be created and those skills were copied instead.\",\n );\n console.error(\n \"A copy does not follow the package when it is upgraded — rerun this\",\n );\n console.error(\n \"command after an upgrade, or use --copy everywhere and commit the result.\",\n );\n console.error(\"\");\n }\n\n if (values.copy) {\n console.error(\n \"These are copies. Commit them, and rerun this command after upgrading\",\n );\n console.error(\"@loadbare/app so the skill matches the framework.\");\n } else {\n console.error(\n \"These are links into node_modules. To keep them out of git:\",\n );\n console.error(\"\");\n for (const destination of destinations) {\n for (const name of result.names) {\n console.error(` ${path.join(destination, name)}`);\n }\n }\n }\n\n console.error(\"\");\n console.error(\"Start your agent from this directory and it will find them.\");\n\n return result.refused > 0 ? 1 : 0;\n}\n\nprocess.exitCode = await main();\n"]}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Put the agent skills that ship in this package where a coding agent will
3
+ * find them.
4
+ *
5
+ * The same command as `loadbare-db skills install`, and deliberately a copy
6
+ * of it rather than a shared module: `@loadbare/db` shares no code with this
7
+ * package, and this package imports nothing from the repository.
8
+ *
9
+ * A symlink by default, because the point is that the skill tracks the
10
+ * dependency: `npm install @loadbare/app@next` and the skill moves with it.
11
+ * `copy` is for a team that would rather commit the text than have every
12
+ * clone depend on `node_modules` being populated.
13
+ *
14
+ * Nothing is done to `.gitignore`. Whether these paths are committed is a
15
+ * decision about the project, and the command that installs a file is not the
16
+ * one to make it.
17
+ */
18
+ /**
19
+ * Where a coding agent looks for skills.
20
+ *
21
+ * `.agents/skills` is the vendor-neutral location, read by Codex, Cursor and
22
+ * Copilot; `.claude/skills` is Claude Code's, and Cursor reads it too. Both
23
+ * are written rather than guessing from what happens to be configured.
24
+ */
25
+ export declare const SKILL_DESTINATIONS: string[];
26
+ export interface InstallOptions {
27
+ /** The directory holding one subdirectory per skill. */
28
+ source: string;
29
+ /** The directories to install into. */
30
+ destinations: string[];
31
+ /** Copy rather than link. */
32
+ copy: boolean;
33
+ /** The project root; a link to a package inside it is relative. */
34
+ cwd: string;
35
+ /** Where progress goes, one line at a time. */
36
+ log: (line: string) => void;
37
+ }
38
+ export interface InstallResult {
39
+ names: string[];
40
+ refused: number;
41
+ /** A link was refused by the platform and a copy made in its place. */
42
+ copiedInstead: boolean;
43
+ }
44
+ /** The skills under `source`: each directory holding a `SKILL.md`. */
45
+ export declare function shippedSkills(source: string): string[];
46
+ export declare function installSkills(options: InstallOptions): InstallResult;
47
+ //# sourceMappingURL=skills.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../../build/skills.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAcH;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,UAAuC,CAAC;AAEvE,MAAM,WAAW,cAAc;IAC7B,wDAAwD;IACxD,MAAM,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,6BAA6B;IAC7B,IAAI,EAAE,OAAO,CAAC;IACd,mEAAmE;IACnE,GAAG,EAAE,MAAM,CAAC;IACZ,+CAA+C;IAC/C,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7B;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,uEAAuE;IACvE,aAAa,EAAE,OAAO,CAAC;CACxB;AAwCD,sEAAsE;AACtE,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAUtD;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,aAAa,CAsDpE"}
@@ -0,0 +1,124 @@
1
+ /**
2
+ * Put the agent skills that ship in this package where a coding agent will
3
+ * find them.
4
+ *
5
+ * The same command as `loadbare-db skills install`, and deliberately a copy
6
+ * of it rather than a shared module: `@loadbare/db` shares no code with this
7
+ * package, and this package imports nothing from the repository.
8
+ *
9
+ * A symlink by default, because the point is that the skill tracks the
10
+ * dependency: `npm install @loadbare/app@next` and the skill moves with it.
11
+ * `copy` is for a team that would rather commit the text than have every
12
+ * clone depend on `node_modules` being populated.
13
+ *
14
+ * Nothing is done to `.gitignore`. Whether these paths are committed is a
15
+ * decision about the project, and the command that installs a file is not the
16
+ * one to make it.
17
+ */
18
+ import { cpSync, existsSync, lstatSync, mkdirSync, readdirSync, readFileSync, rmSync, symlinkSync, } from "node:fs";
19
+ import path from "node:path";
20
+ /**
21
+ * Where a coding agent looks for skills.
22
+ *
23
+ * `.agents/skills` is the vendor-neutral location, read by Codex, Cursor and
24
+ * Copilot; `.claude/skills` is Claude Code's, and Cursor reads it too. Both
25
+ * are written rather than guessing from what happens to be configured.
26
+ */
27
+ export const SKILL_DESTINATIONS = [".agents/skills", ".claude/skills"];
28
+ /** `absent` covers a dangling symlink, which `existsSync` reports as missing. */
29
+ function entryKind(p) {
30
+ let stat;
31
+ try {
32
+ stat = lstatSync(p);
33
+ }
34
+ catch {
35
+ return "absent";
36
+ }
37
+ if (stat.isSymbolicLink())
38
+ return "symlink";
39
+ if (stat.isDirectory())
40
+ return "directory";
41
+ return "other";
42
+ }
43
+ /** The `name:` a skill directory declares, or null if there is no skill there. */
44
+ function declaredSkillName(dir) {
45
+ try {
46
+ const match = /^name:\s*(\S+)\s*$/m.exec(readFileSync(path.join(dir, "SKILL.md"), "utf-8"));
47
+ return match?.[1] ?? null;
48
+ }
49
+ catch {
50
+ return null;
51
+ }
52
+ }
53
+ /**
54
+ * A link into `node_modules` is relative, so the project stays movable and the
55
+ * link means the same thing to everyone who checks it out. A globally
56
+ * installed package gets an absolute path, since a relative one breaks the
57
+ * moment the project moves.
58
+ */
59
+ function linkTarget(from, to, cwd) {
60
+ const inside = path.resolve(from).startsWith(path.resolve(cwd) + path.sep);
61
+ return inside
62
+ ? path.relative(path.dirname(path.resolve(cwd, to)), path.resolve(from))
63
+ : path.resolve(from);
64
+ }
65
+ /** The skills under `source`: each directory holding a `SKILL.md`. */
66
+ export function shippedSkills(source) {
67
+ if (!existsSync(source))
68
+ return [];
69
+ return readdirSync(source, { withFileTypes: true })
70
+ .filter((entry) => entry.isDirectory() &&
71
+ existsSync(path.join(source, entry.name, "SKILL.md")))
72
+ .map((entry) => entry.name)
73
+ .sort();
74
+ }
75
+ export function installSkills(options) {
76
+ const { source, destinations, copy, cwd, log } = options;
77
+ const names = shippedSkills(source);
78
+ let refused = 0;
79
+ let copiedInstead = false;
80
+ for (const destination of destinations) {
81
+ for (const name of names) {
82
+ const from = path.join(source, name);
83
+ const to = path.join(destination, name);
84
+ const at = path.resolve(cwd, to);
85
+ const kind = entryKind(at);
86
+ // A directory this command wrote says so on its own front matter, and
87
+ // is replaced. Anything else at that path belongs to someone, and a
88
+ // skill install is not permitted to be the thing that lost it.
89
+ if (kind === "directory" && declaredSkillName(at) !== name) {
90
+ log(` refused ${to} — a directory is already there and is not the ${name} skill`);
91
+ refused++;
92
+ continue;
93
+ }
94
+ if (kind === "other") {
95
+ log(` refused ${to} — a file is already there`);
96
+ refused++;
97
+ continue;
98
+ }
99
+ mkdirSync(path.resolve(cwd, destination), { recursive: true });
100
+ rmSync(at, { recursive: true, force: true });
101
+ if (copy) {
102
+ cpSync(from, at, { recursive: true });
103
+ log(` copied ${to}`);
104
+ continue;
105
+ }
106
+ try {
107
+ symlinkSync(linkTarget(from, to, cwd), at, "dir");
108
+ log(` linked ${to}`);
109
+ }
110
+ catch (error) {
111
+ // Windows refuses a symlink to an unprivileged process unless
112
+ // developer mode is on. A copy is the same skill, so the install
113
+ // succeeds and the difference is reported rather than raised.
114
+ if (error.code !== "EPERM")
115
+ throw error;
116
+ cpSync(from, at, { recursive: true });
117
+ copiedInstead = true;
118
+ log(` copied ${to}`);
119
+ }
120
+ }
121
+ }
122
+ return { names, refused, copiedInstead };
123
+ }
124
+ //# sourceMappingURL=skills.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skills.js","sourceRoot":"","sources":["../../build/skills.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,MAAM,EACN,UAAU,EACV,SAAS,EACT,SAAS,EACT,WAAW,EACX,YAAY,EACZ,MAAM,EACN,WAAW,GACZ,MAAM,SAAS,CAAC;AACjB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,CAAC;AAsBvE,iFAAiF;AACjF,SAAS,SAAS,CAAC,CAAS;IAC1B,IAAI,IAAI,CAAC;IACT,IAAI,CAAC;QACH,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;IACtB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,IAAI,IAAI,CAAC,cAAc,EAAE;QAAE,OAAO,SAAS,CAAC;IAC5C,IAAI,IAAI,CAAC,WAAW,EAAE;QAAE,OAAO,WAAW,CAAC;IAC3C,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,kFAAkF;AAClF,SAAS,iBAAiB,CAAC,GAAW;IACpC,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,qBAAqB,CAAC,IAAI,CACtC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,UAAU,CAAC,EAAE,OAAO,CAAC,CAClD,CAAC;QACF,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;IAC5B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,SAAS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C,CAAC;gBAClD,GAAG,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;YACzB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,8DAA8D;gBAC9D,kEAAkE;gBAClE,8DAA8D;gBAC9D,IAAK,KAA+B,CAAC,IAAI,KAAK,OAAO;oBAAE,MAAM,KAAK,CAAC;gBACnE,MAAM,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;gBACtC,aAAa,GAAG,IAAI,CAAC;gBACrB,GAAG,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;YACzB,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC;AAC3C,CAAC","sourcesContent":["/**\n * Put the agent skills that ship in this package where a coding agent will\n * find them.\n *\n * The same command as `loadbare-db skills install`, and deliberately a copy\n * of it rather than a shared module: `@loadbare/db` shares no code with this\n * package, and this package imports nothing from the repository.\n *\n * A symlink by default, because the point is that the skill tracks the\n * dependency: `npm install @loadbare/app@next` and the skill moves with it.\n * `copy` is for a team that would rather commit the text than have every\n * clone depend on `node_modules` being populated.\n *\n * Nothing is done to `.gitignore`. Whether these paths are committed is a\n * decision about the project, and the command that installs a file is not the\n * one to make it.\n */\n\nimport {\n cpSync,\n existsSync,\n lstatSync,\n mkdirSync,\n readdirSync,\n readFileSync,\n rmSync,\n symlinkSync,\n} from \"node:fs\";\nimport path from \"node:path\";\n\n/**\n * Where a coding agent looks for skills.\n *\n * `.agents/skills` is the vendor-neutral location, read by Codex, Cursor and\n * Copilot; `.claude/skills` is Claude Code's, and Cursor reads it too. Both\n * are written rather than guessing from what happens to be configured.\n */\nexport const SKILL_DESTINATIONS = [\".agents/skills\", \".claude/skills\"];\n\nexport interface InstallOptions {\n /** The directory holding one subdirectory per skill. */\n source: string;\n /** The directories to install into. */\n destinations: string[];\n /** Copy rather than link. */\n copy: boolean;\n /** The project root; a link to a package inside it is relative. */\n cwd: string;\n /** Where progress goes, one line at a time. */\n log: (line: string) => void;\n}\n\nexport interface InstallResult {\n names: string[];\n refused: number;\n /** A link was refused by the platform and a copy made in its place. */\n copiedInstead: boolean;\n}\n\n/** `absent` covers a dangling symlink, which `existsSync` reports as missing. */\nfunction entryKind(p: string): \"absent\" | \"symlink\" | \"directory\" | \"other\" {\n let stat;\n try {\n stat = lstatSync(p);\n } catch {\n return \"absent\";\n }\n if (stat.isSymbolicLink()) return \"symlink\";\n if (stat.isDirectory()) return \"directory\";\n return \"other\";\n}\n\n/** The `name:` a skill directory declares, or null if there is no skill there. */\nfunction declaredSkillName(dir: string): string | null {\n try {\n const match = /^name:\\s*(\\S+)\\s*$/m.exec(\n readFileSync(path.join(dir, \"SKILL.md\"), \"utf-8\"),\n );\n return match?.[1] ?? null;\n } catch {\n return null;\n }\n}\n\n/**\n * A link into `node_modules` is relative, so the project stays movable and the\n * link means the same thing to everyone who checks it out. A globally\n * installed package gets an absolute path, since a relative one breaks the\n * moment the project moves.\n */\nfunction linkTarget(from: string, to: string, cwd: string): string {\n const inside = path.resolve(from).startsWith(path.resolve(cwd) + path.sep);\n return inside\n ? path.relative(path.dirname(path.resolve(cwd, to)), path.resolve(from))\n : path.resolve(from);\n}\n\n/** The skills under `source`: each directory holding a `SKILL.md`. */\nexport function shippedSkills(source: string): string[] {\n if (!existsSync(source)) return [];\n return readdirSync(source, { withFileTypes: true })\n .filter(\n (entry) =>\n entry.isDirectory() &&\n existsSync(path.join(source, entry.name, \"SKILL.md\")),\n )\n .map((entry) => entry.name)\n .sort();\n}\n\nexport function installSkills(options: InstallOptions): InstallResult {\n const { source, destinations, copy, cwd, log } = options;\n const names = shippedSkills(source);\n let refused = 0;\n let copiedInstead = false;\n\n for (const destination of destinations) {\n for (const name of names) {\n const from = path.join(source, name);\n const to = path.join(destination, name);\n const at = path.resolve(cwd, to);\n const kind = entryKind(at);\n\n // A directory this command wrote says so on its own front matter, and\n // is replaced. Anything else at that path belongs to someone, and a\n // skill install is not permitted to be the thing that lost it.\n if (kind === \"directory\" && declaredSkillName(at) !== name) {\n log(\n ` refused ${to} — a directory is already there and is not the ${name} skill`,\n );\n refused++;\n continue;\n }\n if (kind === \"other\") {\n log(` refused ${to} — a file is already there`);\n refused++;\n continue;\n }\n\n mkdirSync(path.resolve(cwd, destination), { recursive: true });\n rmSync(at, { recursive: true, force: true });\n\n if (copy) {\n cpSync(from, at, { recursive: true });\n log(` copied ${to}`);\n continue;\n }\n\n try {\n symlinkSync(linkTarget(from, to, cwd), at, \"dir\");\n log(` linked ${to}`);\n } catch (error) {\n // Windows refuses a symlink to an unprivileged process unless\n // developer mode is on. A copy is the same skill, so the install\n // succeeds and the difference is reported rather than raised.\n if ((error as NodeJS.ErrnoException).code !== \"EPERM\") throw error;\n cpSync(from, at, { recursive: true });\n copiedInstead = true;\n log(` copied ${to}`);\n }\n }\n }\n\n return { names, refused, copiedInstead };\n}\n"]}
@@ -12,8 +12,7 @@ export declare const LB_RESERVED_PREFIX = "lb-";
12
12
  export declare const ACTION_ROW_INSERT = "lb-row-insert";
13
13
  export declare const ACTION_ROW_DELETE = "lb-row-delete";
14
14
  export declare const ACTION_ROW_UPDATE = "lb-row-update";
15
- export declare const ACTION_CELL_CHANGE = "lb-cell-change";
16
- export declare const LB_ACTIONS: readonly ["lb-row-insert", "lb-row-delete", "lb-row-update", "lb-cell-change"];
15
+ export declare const LB_ACTIONS: readonly ["lb-row-insert", "lb-row-delete", "lb-row-update"];
17
16
  export declare const ATTR_SLOT = "lb-slot";
18
17
  export declare const ATTR_TEMPLATE = "lb-template";
19
18
  export declare const ATTR_NAV_LINK = "lb-nav-link";
@@ -1 +1 @@
1
- {"version":3,"file":"lb-constants.d.ts","sourceRoot":"","sources":["../../core/lb-constants.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,SAAS,YAAY,CAAC;AAQnC,eAAO,MAAM,QAAQ,WAAW,CAAC;AAMjC,eAAO,MAAM,QAAQ,WA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AAc,iBAAiB,CAAC;AAQ7C,eAAO,MAAM,SAAS,YAAY,CAAC;AAanC,eAAO,MAAM,SAAS,YAAY,CAAC;AAEnC,eAAO,MAAM,UAAU,aAAa,CAAC;AAOrC,eAAO,MAAM,cAAc,iBAAiB,CAAC;AAK7C,eAAO,MAAM,aAAa,eAAe,CAAC;AAS1C,eAAO,MAAM,WAAW,cAAc,CAAC;AAYvC,eAAO,MAAM,kBAAkB,QAAQ,CAAC;AAMxC,eAAO,MAAM,iBAAiB,kBAAkB,CAAC;AAKjD,eAAO,MAAM,iBAAiB,kBAAkB,CAAC;AAcjD,eAAO,MAAM,iBAAiB,kBAAkB,CAAC;AAIjD,eAAO,MAAM,UAAU,8DAIb,CAAC;AAMX,eAAO,MAAM,SAAS,YAAY,CAAC;AAYnC,eAAO,MAAM,aAAa,gBAAgB,CAAC;AAK3C,eAAO,MAAM,aAAa,gBAAgB,CAAC;AAM3C,eAAO,MAAM,SAAS,YAAY,CAAC;AAQnC,eAAO,MAAM,OAAO,kBAAkB,CAAC;AAKvC,eAAO,MAAM,cAAc,eAAe,CAAC;AAC3C,eAAO,MAAM,YAAY,aAAa,CAAC;AAUvC,eAAO,MAAM,iBAAiB,oBAAoB,CAAC;AAQnD,eAAO,MAAM,YAAY,WAAW,CAAC;AASrC,eAAO,MAAM,YAAY,eAAe,CAAC;AAOzC,eAAO,MAAM,UAAU,aAAa,CAAC;AAMrC,eAAO,MAAM,WAAW,QAAQ,CAAC;AAIjC,eAAO,MAAM,qBAAqB,QAAS,CAAC"}
@@ -70,7 +70,7 @@ export const ATTR_ACTION = "lb-action";
70
70
  // name can never collide with one an application already uses.
71
71
  //
72
72
  // It is also the whole of the wire discriminant. A request whose `action`
73
- // begins with it is one of the four operations; anything else is a name the
73
+ // begins with it is one of the three operations; anything else is a name the
74
74
  // page declared under its requests. Nothing else tells them apart.
75
75
  export const LB_RESERVED_PREFIX = "lb-";
76
76
  // On a <form> in a list scope: builds a new row on submit. The hub gathers
@@ -82,24 +82,25 @@ export const ACTION_ROW_INSERT = "lb-row-insert";
82
82
  // only the row's own lb-list/lb-key-value binding, which is all the server
83
83
  // needs to know which row and whether the operation is permitted on it.
84
84
  export const ACTION_ROW_DELETE = "lb-row-delete";
85
- // On a <form> inside a live row: commits several cells of that row at once
86
- // on submit — the batch counterpart to a cell change. The hub gathers the
87
- // same values map, plus the row's own lb-key-value: a form that is a list's
88
- // row template root, or sits inside one, has both from its ancestors exactly
89
- // as a delete button does.
85
+ // Commits cells of the row the element is inside. From a <form> or a button,
86
+ // on submit or click, the hub gathers the same values map as an insert, plus
87
+ // the row's own lb-key-value: a form that is a list's row template root, or
88
+ // sits inside one, has both from its ancestors exactly as a delete button
89
+ // does.
90
+ //
91
+ // From an element carrying lb-cell — a widget wrapping one control — the
92
+ // values map holds that one cell and nothing else, the way a control has a
93
+ // value and a form has values. The widget decides when a change is made and
94
+ // sends the action with its value; without one, the hub reads the control
95
+ // the widget wraps. SQL has one UPDATE whether it sets one column or many,
96
+ // and so there is one operation here.
90
97
  export const ACTION_ROW_UPDATE = "lb-row-update";
91
- // On a widget wrapping one control: commits that one cell when the control
92
- // changes. The hub never sends this itself — a native element has no widget
93
- // to decide what a change is — so a widget that carries it builds the
94
- // operation from its own lb-list/lb-key-value/lb-cell binding.
95
- export const ACTION_CELL_CHANGE = "lb-cell-change";
96
98
  // Every reserved lb-action, in one place, so the builder can refuse an
97
99
  // unknown one and the hub can refuse to send one it does not implement.
98
100
  export const LB_ACTIONS = [
99
101
  ACTION_ROW_INSERT,
100
102
  ACTION_ROW_DELETE,
101
103
  ACTION_ROW_UPDATE,
102
- ACTION_CELL_CHANGE,
103
104
  ];
104
105
  // --- Expansion (docs/reference/custom-elements.md) ---------------------
105
106
  // Marks the element in a definition whose children receive the authored
@@ -1 +1 @@
1
- {"version":3,"file":"lb-constants.js","sourceRoot":"","sources":["../../core/lb-constants.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,2DAA2D;AAC3D,kCAAkC;AA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A4E;AAC5E,wEAAwE;AACxE,+CAA+C;AAC/C,MAAM,CAAC,MAAM,SAAS,GAAG,SAAS,CAAC;AAEnC,2EAA2E;AAC3E,uEAAuE;AACvE,uEAAuE;AACvE,wEAAwE;AACxE,sEAAsE;AACtE,4BAA4B;AAC5B,MAAM,CAAC,MAAM,OAAO,GAAG,eAAe,CAAC;AAEvC,uEAAuE;AACvE,2EAA2E;AAC3E,6CAA6C;AAC7C,MAAM,CAAC,MAAM,cAAc,GAAG,YAAY,CAAC;AAC3C,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,CAAC;AAEvC,sEAAsE;AACtE,2EAA2E;AAC3E,qFAAqF;AACrF,2EAA2E;AAC3E,wEAAwE;AACxE,wEAAwE;AACxE,kEAAkE;AAClE,8DAA8D;AAC9D,MAAM,CAAC,MAAM,iBAAiB,GAAG,iBAAiB,CAAC;AAEnD,qEAAqE;AACrE,iFAAiF;AACjF,uEAAuE;AACvE,4EAA4E;AAC5E,qEAAqE;AACrE,qCAAqC;AACrC,MAAM,CAAC,MAAM,YAAY,GAAG,QAAQ,CAAC;AAErC,2EAA2E;AAC3E,0EAA0E;AAC1E,oEAAoE;AACpE,yEAAyE;AACzE,0EAA0E;AAC1E,4EAA4E;AAC5E,sEAAsE;AACtE,MAAM,CAAC,MAAM,YAAY,GAAG,YAAY,CAAC;AAEzC,oEAAoE;AACpE,4EAA4E;AAC5E,kEAAkE;AAClE,uEAAuE;AACvE,YAAY;AACZ,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,CAAC;AAErC,0EAA0E;AAC1E,2EAA2E;AAC3E,yEAAyE;AACzE,yDAAyD;AACzD,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,CAAC;AAEjC,4EAA4E;AAC5E,kEAAkE;AAClE,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC","sourcesContent":["// Every hub attribute name lives here. Nothing writes one as a string\n// literal — not a widget, not a page host, not a test. See\n// docs/reference/data-binding.md.\n\n// --- Binding (docs/reference/data-binding.md) ---------------------------\n// One containment ladder: a list holds rows, a row holds cells. Both scope\n// attributes take a name the server declares, and a nested one of either\n// kind begins a new scope.\n\n// Scopes DOM children to a named set of rows.\nexport const ATTR_LIST = \"lb-list\";\n\n// Scopes DOM children to one named row.\n//\n// A single-row scope is read-only. Every write operation needs a key, and a\n// key exists only on a live row the hub stamped inside a list, so a declared\n// action is the only thing such a scope can send. An application that wants\n// a writable single row declares a list that answers with one row.\nexport const ATTR_ROW = \"lb-row\";\n\n// Named on a row template by the developer: the column that identifies a row\n// of the list. A property of the list rather than of the template — a list\n// without a fixed key column is meaningless — but written where the rows\n// land, because that is the only place the page says anything about them.\nexport const ATTR_KEY = \"lb-key\";\n\n// Stamped on a live row by the row machinery: that row's value of the column\n// ATTR_KEY names. Written by the hub, never by a developer, and read back by\n// whatever needs to know which row it is inside — a delete button, an update\n// form, a widget building its own request, or a stylesheet.\nexport const ATTR_KEY_VALUE = \"lb-key-value\";\n\n// The column an element displays.\n//\n// Its value is a column name and never a cell name. A cell has no name of\n// its own: it is identified by its row and its column, and the row arrives\n// from scope, so the column is all that is left to say. ATTR_KEY holds a\n// column name for the same reason.\nexport const ATTR_CELL = \"lb-cell\";\n\n// The column that decides whether an element is present: `null` and `false`\n// are off, and every other value is on. It binds by the same ancestor rule as\n// ATTR_CELL, and names a column for the same reason.\n//\n// An element that is off is moved into a `<template>` carrying this attribute\n// and the same column, standing where the element stood, and moved back out\n// when the column turns on. The builder ships every such element already\n// inside its template. A developer writes this attribute on an element and\n// never on a template: the template form is Loadbare's, and holds the absent\n// branch in the document so the hub holds nothing. Landing reaches inside it,\n// so a branch that returns is already current; nothing else does.\nexport const ATTR_SHOW = \"lb-show\";\n\nexport const ATTR_VALUE = \"lb-value\";\n\n// Stamped on a list scope by the shared row machinery: how many rows it is\n// showing. Written by the hub and never bound to — it is derived from rows\n// the hub already knows, exactly as the section heading in lb-table is. A\n// list widget watches it, and it exists so that \"no members yet\" is a\n// stylesheet rule rather than a conditional in every list widget.\nexport const ATTR_ROW_COUNT = \"lb-row-count\";\n\n// --- Requests (docs/reference/data-binding.md) --------------------------\n// One event name, used by a widget reaching the server and by a widget\n// reaching an ancestor widget.\nexport const LB_EVENT_NAME = \"lb-request\";\n\n// Names what an interaction asks for.\n//\n// One attribute name, one wire field, one set of values: the request field\n// `action` carries this attribute's value verbatim, and nothing is\n// translated in between. On a native element the hub turns the element's own\n// event into the request — a form submits, anything else clicks; on a\n// widget, the widget builds it from whatever interaction it owns.\nexport const ATTR_ACTION = \"lb-action\";\n\n// --- Reserved names ----------------------------------------------------\n// Loadbare owns every value beginning with this prefix, in every lb-*\n// attribute: a name so prefixed is the hub's own (NAV_ROW), and an\n// lb-action so prefixed is an operation (below). The server refuses a page\n// that declares a query or an action beginning with it, so a new reserved\n// name can never collide with one an application already uses.\n//\n// It is also the whole of the wire discriminant. A request whose `action`\n// begins with it is one of the four operations; anything else is a name the\n// page declared under its requests. Nothing else tells them apart.\nexport const LB_RESERVED_PREFIX = \"lb-\";\n\n// On a <form> in a list scope: builds a new row on submit. The hub gathers\n// every lb-cell inside the form into a values map — no key, because there is\n// no row yet — and the form's own lb-list says which list it is inserting\n// into.\nexport const ACTION_ROW_INSERT = \"lb-row-insert\";\n\n// Deletes the row the element is inside. Needs no declared name: it takes\n// only the row's own lb-list/lb-key-value binding, which is all the server\n// needs to know which row and whether the operation is permitted on it.\nexport const ACTION_ROW_DELETE = \"lb-row-delete\";\n\n// On a <form> inside a live row: commits several cells of that row at once\n// on submit — the batch counterpart to a cell change. The hub gathers the\n// same values map, plus the row's own lb-key-value: a form that is a list's\n// row template root, or sits inside one, has both from its ancestors exactly\n// as a delete button does.\nexport const ACTION_ROW_UPDATE = \"lb-row-update\";\n\n// On a widget wrapping one control: commits that one cell when the control\n// changes. The hub never sends this itself — a native element has no widget\n// to decide what a change is — so a widget that carries it builds the\n// operation from its own lb-list/lb-key-value/lb-cell binding.\nexport const ACTION_CELL_CHANGE = \"lb-cell-change\";\n\n// Every reserved lb-action, in one place, so the builder can refuse an\n// unknown one and the hub can refuse to send one it does not implement.\nexport const LB_ACTIONS = [\n ACTION_ROW_INSERT,\n ACTION_ROW_DELETE,\n ACTION_ROW_UPDATE,\n ACTION_CELL_CHANGE,\n] as const;\n\n// --- Expansion (docs/reference/custom-elements.md) ---------------------\n// Marks the element in a definition whose children receive the authored\n// inner content. An attribute rather than an element because HTML content\n// models discard foreign elements inside <select> and <table>.\nexport const ATTR_SLOT = \"lb-slot\";\n\n// One name in two positions. In a definition it marks a destination; on an\n// authored <template> it names the destination that template is for, and the\n// template is unwrapped into it.\n//\n// It exists because the parser, not the content model, is the obstacle. A\n// <thead> written inside <lb-table> on a page is not in a table, so the\n// tokenizer drops the tag and keeps the text. A <template> survives anywhere\n// and its contents parse as if they were in a table, so wrapping the markup\n// is what gets it to expansion intact — and unwrapping it is what puts real\n// elements in the shipped document.\nexport const ATTR_TEMPLATE = \"lb-template\";\n\n// --- Host channel (docs/reference/chrome.md) ---------------------------\n// Only anchors carrying this are intercepted, so external links are never\n// hijacked.\nexport const ATTR_NAV_LINK = \"lb-nav-link\";\n\n// A page host ships as <template lb-page=\"<name>\">. An attribute rather than\n// an id: an id lives in the application's own namespace, where a page named\n// for something the chrome also ids would collide, and getElementById()\n// answers a collision by silently picking one.\nexport const ATTR_PAGE = \"lb-page\";\n\n// The hub's own row. Landed on every navigation, on any subtree inside the\n// hub that names it, through the same applyData() a server answer goes\n// through — so a chrome displays where the page is the way it displays\n// anything else. One row rather than a list, so a subtree binds it with\n// lb-row. A reserved name (LB_RESERVED_PREFIX): the server refuses to\n// declare a query so named.\nexport const NAV_ROW = \"lb-navigation\";\n\n// Its two columns. The label is the nav's: the text of the lb-nav-link\n// anchor whose href names the current page, and empty when no anchor does.\n// The URI is the path as the browser has it.\nexport const NAV_CELL_LABEL = \"page-label\";\nexport const NAV_CELL_URI = \"page-uri\";\n\n// Marks the chrome's own <dialog> for a page name that resolves to no\n// template — a routing miss discovered client-side, not an HTTP 404 (every\n// route gets the same 200 response; see docs/tutorials/010-pages-and-navigation.md).\n// The hub only opens it; what it says comes from NAV_ROW, which the dialog\n// consumes like any other subtree, by naming it in lb-row. Optional: an\n// application that declares none gets today's console.error and nothing\n// more. The builder requires the element it's on to be a <dialog>\n// (build/assemble.ts), since the hub calls showModal() on it.\nexport const ATTR_UNKNOWN_PAGE = \"lb-unknown-page\";\n\n// The hub's own tag. It is exempt from the rule every other LB-* tag\n// follows: expansion does not require it to have a definition (build/expand.ts),\n// and the client build does not require it to have a script of its own\n// (build/elements.ts) — it is the framework's live element, always present,\n// registered once by the package's main entry point, not a widget an\n// application discovers or declares.\nexport const HUB_TAG_NAME = \"lb-hub\";\n\n// --- Request lifecycle --------------------------------------------------\n// Stamped on the element that dispatched a request — the button, form, or\n// widget itself — for the duration of its round trip. It carries no\n// meaning beyond \"in flight\": a stylesheet dims the element, or a custom\n// button widget watches it to disable itself. The hub sets and clears it,\n// alongside aria-busy, and reads it in one place: a native action (a button\n// or form, not a widget) still pending ignores being performed again.\nexport const ATTR_PENDING = \"lb-pending\";\n\n// Stamped on the same element if that round trip failed — a non-2xx\n// response, a thrown application error, or a timeout, all alike. Cleared at\n// the start of that element's next request. What (if anything) an\n// application shows for it is undecided; this is only the fact that it\n// happened.\nexport const ATTR_ERROR = \"lb-error\";\n\n// --- Wire --------------------------------------------------------------\n// One path, one method: everything the hub asks of the server is a POST to\n// this path. Navigation is therefore the only GET an application serves,\n// which is what leaves the page name space unrestricted.\nexport const LB_ENDPOINT = \"/lb\";\n\n// A client-side deadline for one round trip. fetch() has no deadline of its\n// own; past this the request is aborted and treated as a failure.\nexport const LB_REQUEST_TIMEOUT_MS = 10_000;\n"]}
1
+ {"version":3,"file":"lb-constants.js","sourceRoot":"","sources":["../../core/lb-constants.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,2DAA2D;AAC3D,kCAAkC;AAElC,2EAA2E;AAC3E,2EAA2E;AAC3E,yEAAyE;AACzE,2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C;AAEnC,2EAA2E;AAC3E,uEAAuE;AACvE,uEAAuE;AACvE,wEAAwE;AACxE,sEAAsE;AACtE,4BAA4B;AAC5B,MAAM,CAAC,MAAM,OAAO,GAAG,eAAe,CAAC;AAEvC,uEAAuE;AACvE,2EAA2E;AAC3E,6CAA6C;AAC7C,MAAM,CAAC,MAAM,cAAc,GAAG,YAAY,CAAC;AAC3C,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,CAAC;AAEvC,sEAAsE;AACtE,2EAA2E;AAC3E,qFAAqF;AACrF,2EAA2E;AAC3E,wEAAwE;AACxE,wEAAwE;AACxE,kEAAkE;AAClE,8DAA8D;AAC9D,MAAM,CAAC,MAAM,iBAAiB,GAAG,iBAAiB,CAAC;AAEnD,qEAAqE;AACrE,iFAAiF;AACjF,uEAAuE;AACvE,4EAA4E;AAC5E,qEAAqE;AACrE,qCAAqC;AACrC,MAAM,CAAC,MAAM,YAAY,GAAG,QAAQ,CAAC;AAErC,2EAA2E;AAC3E,0EAA0E;AAC1E,oEAAoE;AACpE,yEAAyE;AACzE,0EAA0E;AAC1E,4EAA4E;AAC5E,sEAAsE;AACtE,MAAM,CAAC,MAAM,YAAY,GAAG,YAAY,CAAC;AAEzC,oEAAoE;AACpE,4EAA4E;AAC5E,kEAAkE;AAClE,uEAAuE;AACvE,YAAY;AACZ,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,CAAC;AAErC,0EAA0E;AAC1E,2EAA2E;AAC3E,yEAAyE;AACzE,yDAAyD;AACzD,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,CAAC;AAEjC,4EAA4E;AAC5E,kEAAkE;AAClE,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC","sourcesContent":["// Every hub attribute name lives here. Nothing writes one as a string\n// literal — not a widget, not a page host, not a test. See\n// docs/reference/data-binding.md.\n\n// --- Binding (docs/reference/data-binding.md) ---------------------------\n// One containment ladder: a list holds rows, a row holds cells. Both scope\n// attributes take a name the server declares, and a nested one of either\n// kind begins a new scope.\n\n// Scopes DOM children to a named set of rows.\nexport const ATTR_LIST = \"lb-list\";\n\n// Scopes DOM children to one named row.\n//\n// A single-row scope is read-only. Every write operation needs a key, and a\n// key exists only on a live row the hub stamped inside a list, so a declared\n// action is the only thing such a scope can send. An application that wants\n// a writable single row declares a list that answers with one row.\nexport const ATTR_ROW = \"lb-row\";\n\n// Named on a row template by the developer: the column that identifies a row\n// of the list. A property of the list rather than of the template — a list\n// without a fixed key column is meaningless — but written where the rows\n// land, because that is the only place the page says anything about them.\nexport const ATTR_KEY = \"lb-key\";\n\n// Stamped on a live row by the row machinery: that row's value of the column\n// ATTR_KEY names. Written by the hub, never by a developer, and read back by\n// whatever needs to know which row it is inside — a delete button, an update\n// form, a widget building its own request, or a stylesheet.\nexport const ATTR_KEY_VALUE = \"lb-key-value\";\n\n// The column an element displays.\n//\n// Its value is a column name and never a cell name. A cell has no name of\n// its own: it is identified by its row and its column, and the row arrives\n// from scope, so the column is all that is left to say. ATTR_KEY holds a\n// column name for the same reason.\nexport const ATTR_CELL = \"lb-cell\";\n\n// The column that decides whether an element is present: `null` and `false`\n// are off, and every other value is on. It binds by the same ancestor rule as\n// ATTR_CELL, and names a column for the same reason.\n//\n// An element that is off is moved into a `<template>` carrying this attribute\n// and the same column, standing where the element stood, and moved back out\n// when the column turns on. The builder ships every such element already\n// inside its template. A developer writes this attribute on an element and\n// never on a template: the template form is Loadbare's, and holds the absent\n// branch in the document so the hub holds nothing. Landing reaches inside it,\n// so a branch that returns is already current; nothing else does.\nexport const ATTR_SHOW = \"lb-show\";\n\nexport const ATTR_VALUE = \"lb-value\";\n\n// Stamped on a list scope by the shared row machinery: how many rows it is\n// showing. Written by the hub and never bound to — it is derived from rows\n// the hub already knows, exactly as the section heading in lb-table is. A\n// list widget watches it, and it exists so that \"no members yet\" is a\n// stylesheet rule rather than a conditional in every list widget.\nexport const ATTR_ROW_COUNT = \"lb-row-count\";\n\n// --- Requests (docs/reference/data-binding.md) --------------------------\n// One event name, used by a widget reaching the server and by a widget\n// reaching an ancestor widget.\nexport const LB_EVENT_NAME = \"lb-request\";\n\n// Names what an interaction asks for.\n//\n// One attribute name, one wire field, one set of values: the request field\n// `action` carries this attribute's value verbatim, and nothing is\n// translated in between. On a native element the hub turns the element's own\n// event into the request — a form submits, anything else clicks; on a\n// widget, the widget builds it from whatever interaction it owns.\nexport const ATTR_ACTION = \"lb-action\";\n\n// --- Reserved names ----------------------------------------------------\n// Loadbare owns every value beginning with this prefix, in every lb-*\n// attribute: a name so prefixed is the hub's own (NAV_ROW), and an\n// lb-action so prefixed is an operation (below). The server refuses a page\n// that declares a query or an action beginning with it, so a new reserved\n// name can never collide with one an application already uses.\n//\n// It is also the whole of the wire discriminant. A request whose `action`\n// begins with it is one of the three operations; anything else is a name the\n// page declared under its requests. Nothing else tells them apart.\nexport const LB_RESERVED_PREFIX = \"lb-\";\n\n// On a <form> in a list scope: builds a new row on submit. The hub gathers\n// every lb-cell inside the form into a values map — no key, because there is\n// no row yet — and the form's own lb-list says which list it is inserting\n// into.\nexport const ACTION_ROW_INSERT = \"lb-row-insert\";\n\n// Deletes the row the element is inside. Needs no declared name: it takes\n// only the row's own lb-list/lb-key-value binding, which is all the server\n// needs to know which row and whether the operation is permitted on it.\nexport const ACTION_ROW_DELETE = \"lb-row-delete\";\n\n// Commits cells of the row the element is inside. From a <form> or a button,\n// on submit or click, the hub gathers the same values map as an insert, plus\n// the row's own lb-key-value: a form that is a list's row template root, or\n// sits inside one, has both from its ancestors exactly as a delete button\n// does.\n//\n// From an element carrying lb-cell — a widget wrapping one control — the\n// values map holds that one cell and nothing else, the way a control has a\n// value and a form has values. The widget decides when a change is made and\n// sends the action with its value; without one, the hub reads the control\n// the widget wraps. SQL has one UPDATE whether it sets one column or many,\n// and so there is one operation here.\nexport const ACTION_ROW_UPDATE = \"lb-row-update\";\n\n// Every reserved lb-action, in one place, so the builder can refuse an\n// unknown one and the hub can refuse to send one it does not implement.\nexport const LB_ACTIONS = [\n ACTION_ROW_INSERT,\n ACTION_ROW_DELETE,\n ACTION_ROW_UPDATE,\n] as const;\n\n// --- Expansion (docs/reference/custom-elements.md) ---------------------\n// Marks the element in a definition whose children receive the authored\n// inner content. An attribute rather than an element because HTML content\n// models discard foreign elements inside <select> and <table>.\nexport const ATTR_SLOT = \"lb-slot\";\n\n// One name in two positions. In a definition it marks a destination; on an\n// authored <template> it names the destination that template is for, and the\n// template is unwrapped into it.\n//\n// It exists because the parser, not the content model, is the obstacle. A\n// <thead> written inside <lb-table> on a page is not in a table, so the\n// tokenizer drops the tag and keeps the text. A <template> survives anywhere\n// and its contents parse as if they were in a table, so wrapping the markup\n// is what gets it to expansion intact — and unwrapping it is what puts real\n// elements in the shipped document.\nexport const ATTR_TEMPLATE = \"lb-template\";\n\n// --- Host channel (docs/reference/chrome.md) ---------------------------\n// Only anchors carrying this are intercepted, so external links are never\n// hijacked.\nexport const ATTR_NAV_LINK = \"lb-nav-link\";\n\n// A page host ships as <template lb-page=\"<name>\">. An attribute rather than\n// an id: an id lives in the application's own namespace, where a page named\n// for something the chrome also ids would collide, and getElementById()\n// answers a collision by silently picking one.\nexport const ATTR_PAGE = \"lb-page\";\n\n// The hub's own row. Landed on every navigation, on any subtree inside the\n// hub that names it, through the same applyData() a server answer goes\n// through — so a chrome displays where the page is the way it displays\n// anything else. One row rather than a list, so a subtree binds it with\n// lb-row. A reserved name (LB_RESERVED_PREFIX): the server refuses to\n// declare a query so named.\nexport const NAV_ROW = \"lb-navigation\";\n\n// Its two columns. The label is the nav's: the text of the lb-nav-link\n// anchor whose href names the current page, and empty when no anchor does.\n// The URI is the path as the browser has it.\nexport const NAV_CELL_LABEL = \"page-label\";\nexport const NAV_CELL_URI = \"page-uri\";\n\n// Marks the chrome's own <dialog> for a page name that resolves to no\n// template — a routing miss discovered client-side, not an HTTP 404 (every\n// route gets the same 200 response; see docs/tutorials/010-pages-and-navigation.md).\n// The hub only opens it; what it says comes from NAV_ROW, which the dialog\n// consumes like any other subtree, by naming it in lb-row. Optional: an\n// application that declares none gets today's console.error and nothing\n// more. The builder requires the element it's on to be a <dialog>\n// (build/assemble.ts), since the hub calls showModal() on it.\nexport const ATTR_UNKNOWN_PAGE = \"lb-unknown-page\";\n\n// The hub's own tag. It is exempt from the rule every other LB-* tag\n// follows: expansion does not require it to have a definition (build/expand.ts),\n// and the client build does not require it to have a script of its own\n// (build/elements.ts) — it is the framework's live element, always present,\n// registered once by the package's main entry point, not a widget an\n// application discovers or declares.\nexport const HUB_TAG_NAME = \"lb-hub\";\n\n// --- Request lifecycle --------------------------------------------------\n// Stamped on the element that dispatched a request — the button, form, or\n// widget itself — for the duration of its round trip. It carries no\n// meaning beyond \"in flight\": a stylesheet dims the element, or a custom\n// button widget watches it to disable itself. The hub sets and clears it,\n// alongside aria-busy, and reads it in one place: a native action (a button\n// or form, not a widget) still pending ignores being performed again.\nexport const ATTR_PENDING = \"lb-pending\";\n\n// Stamped on the same element if that round trip failed — a non-2xx\n// response, a thrown application error, or a timeout, all alike. Cleared at\n// the start of that element's next request. What (if anything) an\n// application shows for it is undecided; this is only the fact that it\n// happened.\nexport const ATTR_ERROR = \"lb-error\";\n\n// --- Wire --------------------------------------------------------------\n// One path, one method: everything the hub asks of the server is a POST to\n// this path. Navigation is therefore the only GET an application serves,\n// which is what leaves the page name space unrestricted.\nexport const LB_ENDPOINT = \"/lb\";\n\n// A client-side deadline for one round trip. fetch() has no deadline of its\n// own; past this the request is aborted and treated as a failure.\nexport const LB_REQUEST_TIMEOUT_MS = 10_000;\n"]}
@@ -1,4 +1,4 @@
1
- import { ACTION_CELL_CHANGE, ACTION_ROW_DELETE, ACTION_ROW_INSERT, ACTION_ROW_UPDATE } from "./lb-constants.js";
1
+ import { ACTION_ROW_DELETE, ACTION_ROW_INSERT, ACTION_ROW_UPDATE } from "./lb-constants.js";
2
2
  /**
3
3
  * One row: its columns, by name.
4
4
  *
@@ -48,11 +48,11 @@ export type HubResult = Row | ListResult;
48
48
  */
49
49
  export type HubData = Record<string, HubResult>;
50
50
  /**
51
- * The four operations — docs/reference/data-binding.md. The set is closed.
51
+ * The three operations — docs/reference/data-binding.md. The set is closed.
52
52
  *
53
53
  * `action` carries the value of `lb-action` verbatim, so the attribute, the
54
54
  * wire field and the CRUD key are one vocabulary with no translation step.
55
- * The scope field is `list` here because all four are list operations: each
55
+ * The scope field is `list` here because all three are list operations: each
56
56
  * needs a key, and a key exists only on a live row inside a list.
57
57
  */
58
58
  export type LbOperation = {
@@ -68,15 +68,9 @@ export type LbOperation = {
68
68
  list: string;
69
69
  key: string;
70
70
  values: Record<string, string>;
71
- } | {
72
- action: typeof ACTION_CELL_CHANGE;
73
- list: string;
74
- key: string;
75
- cell: string;
76
- value: string;
77
71
  };
78
72
  /**
79
- * Everything that is not one of the four.
73
+ * Everything that is not one of the three.
80
74
  *
81
75
  * The name is the application's and is looked up in the page's declared
82
76
  * actions. What keeps this from being an RPC endpoint is that the name must
@@ -1 +1 @@
1
- {"version":3,"file":"lb-types.d.ts","sourceRoot":"","sources":["../../core/lb-types.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EAElB,MAAM,mBAAmB,CAAC;AAE3B;;;;;;;GAOG;AACH,MAAM,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE1C;;;;;;;;;GASG;AACH,MAAM,WAAW,KAAK;IACpB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;CAClB;AAED;;;;;;;;;GASG;AACH,MAAM,MAAM,UAAU,GAAG,GAAG,EAAE,GAAG,KAAK,CAAC;AAEvC,wBAAgB,OAAO,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,IAAI,KAAK,CAE3D;AAED;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,GAAG,GAAG,UAAU,CAAC;AAEzC;;;;;;G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AM,EAAE,MAAM,CAAC,CAAC;CAChC,CAAC;AAEN;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,cAAc,CAAC;AAEtD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,IAAI,WAAW,CAEvE;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,QAAQ;IACvB;;;;OAIG;IACH,UAAU,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAExE,4EAA4E;IAC5E,YAAY,CAAC,IAAI,IAAI,CAAC;CACvB"}
@@ -1 +1 @@
1
- {"version":3,"file":"lb-types.js","sourceRoot":"","sources":["../../core/lb-types.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAE3B,qDAAqD;AAErD,OAAO,EAKL,kBAAkB,GACnB,MAAM,mBAAmB,CAAC;AAuC3B,MAAM,UAAU,OAAO,CAAC,MAAkB;IACxC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAChC,CAAC;AAwED;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,OAAmB;IAC7C,OAAO,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC;AACvD,CAAC","sourcesContent":["/// <reference lib=\"dom\" />\n\n// The wire vocabulary. Shared by browser and server.\n\nimport {\n ACTION_CELL_CHANGE,\n ACTION_ROW_DELETE,\n ACTION_ROW_INSERT,\n ACTION_ROW_UPDATE,\n LB_RESERVED_PREFIX,\n} from \"./lb-constants.js\";\n\n/**\n * One row: its columns, by name.\n *\n * A value is whatever the server serialized. The hub knows nothing about its\n * type and enforces nothing: it hands each value to the browser untouched,\n * and the browser renders it as it sees fit. What a number, a date or a null\n * should look like is the application's decision, made in the query.\n */\nexport type Row = Record<string, unknown>;\n\n/**\n * Part of a list — see docs/reference/server.md, \"Queries\".\n *\n * Rows named here arrive or are updated, keys in `drop` are gone, and\n * anything unnamed is left alone: its contents, and its place in whatever\n * order the widget is keeping. Add and remove are one result rather than two\n * because the interesting cases are both at once — a row whose sort key\n * changed has to move, a swap is one out and one in — and two messages would\n * paint the intermediate state.\n */\nexport interface Patch {\n rows?: Row[];\n drop?: unknown[];\n}\n\n/**\n * What a list answers with.\n *\n * An array is the entire set and therefore also the order: a row whose key\n * is not in it is gone. A Patch disturbs only what it names.\n *\n * `Array.isArray` tells the two apart, which is why no column name has to be\n * reserved to carry a discriminant. A list answering with an object is a\n * patch, because the declaration already said this name answers with rows.\n */\nexport type ListResult = Row[] | Patch;\n\nexport function isPatch(result: ListResult): result is Patch {\n return !Array.isArray(result);\n}\n\n/**\n * What any one name answers with. Which of the two it is comes from the\n * query's own declaration, never from inspecting the value.\n */\nexport type HubResult = Row | ListResult;\n\n/**\n * Every response on the data channel is the same shape, whether it is a cold\n * start or the narrowest refresh. The hub does not know which case it is in.\n *\n * A name rides as an object key and is labelled by nothing, which is why the\n * response direction never needed a noun for the addressable thing.\n */\nexport type HubData = Record<string, HubResult>;\n\n/**\n * The four operations — docs/reference/data-binding.md. The set is closed.\n *\n * `action` carries the value of `lb-action` verbatim, so the attribute, the\n * wire field and the CRUD key are one vocabulary with no translation step.\n * The scope field is `list` here because all four are list operations: each\n * needs a key, and a key exists only on a live row inside a list.\n */\nexport type LbOperation =\n | {\n action: typeof ACTION_ROW_INSERT;\n list: string;\n values: Record<string, string>;\n }\n | { action: typeof ACTION_ROW_DELETE; list: string; key: string }\n | {\n action: typeof ACTION_ROW_UPDATE;\n list: string;\n key: string;\n values: Record<string, string>;\n }\n | {\n action: typeof ACTION_CELL_CHANGE;\n list: string;\n key: string;\n cell: string;\n value: string;\n };\n\n/**\n * Everything that is not one of the four.\n *\n * The name is the application's and is looked up in the page's declared\n * actions. What keeps this from being an RPC endpoint is that the name must\n * already appear in the page's requests: the browser cannot reach anything the\n * page has not published, and there is no argument list — only where the\n * interaction happened and, where a control has one, its value.\n *\n * The scope field is `list` or `row`, whichever attribute scoped the element\n * the interaction came from, so an action fired from a single-row scope says\n * so. A button carries no value, so the server computes the whole of the new\n * state and the browser never displays a number it has not confirmed. A\n * `<select>` carries one, because the choice is the interaction.\n */\nexport interface DeclaredAction {\n action: string;\n list?: string;\n row?: string;\n key?: string;\n cell?: string;\n value?: string;\n}\n\nexport type HubRequest = LbOperation | DeclaredAction;\n\n/**\n * The reserved prefix is the whole of the discriminant. Nothing else tells\n * an operation from a declared action, on the wire or anywhere else.\n */\nexport function isOperation(request: HubRequest): request is LbOperation {\n return request.action.startsWith(LB_RESERVED_PREFIX);\n}\n\n/**\n * The two hooks a list widget may implement, both optional.\n *\n * The hub reconciles every list scope itself, so a widget supplies placement\n * and scaffolding and nothing else. A scope that implements neither is a\n * plain element with a row template inside it, which is why there is no\n * repeater widget.\n *\n * They are methods on an element the hub does not own, so they carry the\n * `lb` prefix that Loadbare reserves for exactly that — see\n * docs/reference/custom-elements.md.\n */\nexport interface ListHost {\n /**\n * Where a row belongs, called with the row detached on its first\n * appearance. Without it a row lands immediately before the template, so\n * rows accumulate in the order they arrive.\n */\n lbPlaceRow?(el: Element, row: Row, template: HTMLTemplateElement): void;\n\n /** Called once after a whole result has landed, for derived scaffolding. */\n lbRowsLanded?(): void;\n}\n"]}
1
+ {"version":3,"file":"lb-types.js","sourceRoot":"","sources":["../../core/lb-types.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAE3B,qDAAqD;AAErD,OAAO,EAIL,kBAAkB,GACnB,MAAM,mBAAmB,CAAC;AAuC3B,MAAM,UAAU,OAAO,CAAC,MAAkB;IACxC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAChC,CAAC;AAiED;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,OAAmB;IAC7C,OAAO,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC;AACvD,CAAC","sourcesContent":["/// <reference lib=\"dom\" />\n\n// The wire vocabulary. Shared by browser and server.\n\nimport {\n ACTION_ROW_DELETE,\n ACTION_ROW_INSERT,\n ACTION_ROW_UPDATE,\n LB_RESERVED_PREFIX,\n} from \"./lb-constants.js\";\n\n/**\n * One row: its columns, by name.\n *\n * A value is whatever the server serialized. The hub knows nothing about its\n * type and enforces nothing: it hands each value to the browser untouched,\n * and the browser renders it as it sees fit. What a number, a date or a null\n * should look like is the application's decision, made in the query.\n */\nexport type Row = Record<string, unknown>;\n\n/**\n * Part of a list — see docs/reference/server.md, \"Queries\".\n *\n * Rows named here arrive or are updated, keys in `drop` are gone, and\n * anything unnamed is left alone: its contents, and its place in whatever\n * order the widget is keeping. Add and remove are one result rather than two\n * because the interesting cases are both at once — a row whose sort key\n * changed has to move, a swap is one out and one in — and two messages would\n * paint the intermediate state.\n */\nexport interface Patch {\n rows?: Row[];\n drop?: unknown[];\n}\n\n/**\n * What a list answers with.\n *\n * An array is the entire set and therefore also the order: a row whose key\n * is not in it is gone. A Patch disturbs only what it names.\n *\n * `Array.isArray` tells the two apart, which is why no column name has to be\n * reserved to carry a discriminant. A list answering with an object is a\n * patch, because the declaration already said this name answers with rows.\n */\nexport type ListResult = Row[] | Patch;\n\nexport function isPatch(result: ListResult): result is Patch {\n return !Array.isArray(result);\n}\n\n/**\n * What any one name answers with. Which of the two it is comes from the\n * query's own declaration, never from inspecting the value.\n */\nexport type HubResult = Row | ListResult;\n\n/**\n * Every response on the data channel is the same shape, whether it is a cold\n * start or the narrowest refresh. The hub does not know which case it is in.\n *\n * A name rides as an object key and is labelled by nothing, which is why the\n * response direction never needed a noun for the addressable thing.\n */\nexport type HubData = Record<string, HubResult>;\n\n/**\n * The three operations — docs/reference/data-binding.md. The set is closed.\n *\n * `action` carries the value of `lb-action` verbatim, so the attribute, the\n * wire field and the CRUD key are one vocabulary with no translation step.\n * The scope field is `list` here because all three are list operations: each\n * needs a key, and a key exists only on a live row inside a list.\n */\nexport type LbOperation =\n | {\n action: typeof ACTION_ROW_INSERT;\n list: string;\n values: Record<string, string>;\n }\n | { action: typeof ACTION_ROW_DELETE; list: string; key: string }\n | {\n action: typeof ACTION_ROW_UPDATE;\n list: string;\n key: string;\n values: Record<string, string>;\n };\n\n/**\n * Everything that is not one of the three.\n *\n * The name is the application's and is looked up in the page's declared\n * actions. What keeps this from being an RPC endpoint is that the name must\n * already appear in the page's requests: the browser cannot reach anything the\n * page has not published, and there is no argument list — only where the\n * interaction happened and, where a control has one, its value.\n *\n * The scope field is `list` or `row`, whichever attribute scoped the element\n * the interaction came from, so an action fired from a single-row scope says\n * so. A button carries no value, so the server computes the whole of the new\n * state and the browser never displays a number it has not confirmed. A\n * `<select>` carries one, because the choice is the interaction.\n */\nexport interface DeclaredAction {\n action: string;\n list?: string;\n row?: string;\n key?: string;\n cell?: string;\n value?: string;\n}\n\nexport type HubRequest = LbOperation | DeclaredAction;\n\n/**\n * The reserved prefix is the whole of the discriminant. Nothing else tells\n * an operation from a declared action, on the wire or anywhere else.\n */\nexport function isOperation(request: HubRequest): request is LbOperation {\n return request.action.startsWith(LB_RESERVED_PREFIX);\n}\n\n/**\n * The two hooks a list widget may implement, both optional.\n *\n * The hub reconciles every list scope itself, so a widget supplies placement\n * and scaffolding and nothing else. A scope that implements neither is a\n * plain element with a row template inside it, which is why there is no\n * repeater widget.\n *\n * They are methods on an element the hub does not own, so they carry the\n * `lb` prefix that Loadbare reserves for exactly that — see\n * docs/reference/custom-elements.md.\n */\nexport interface ListHost {\n /**\n * Where a row belongs, called with the row detached on its first\n * appearance. Without it a row lands immediately before the template, so\n * rows accumulate in the order they arrive.\n */\n lbPlaceRow?(el: Element, row: Row, template: HTMLTemplateElement): void;\n\n /** Called once after a whole result has landed, for derived scaffolding. */\n lbRowsLanded?(): void;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"lb-hub.browser.d.ts","sourceRoot":"","sources":["../../hub/lb-hub.browser.ts"],"names":[],"mappings":"AA+BA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"lb-hub.browser.d.ts","sourceRoot":"","sources":["../../hub/lb-hub.browser.ts"],"names":[],"mappings":"AA8BA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC"}