@loadbare/app 0.9.0 → 0.10.0
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 +3 -3
- package/dist/build/assemble.d.ts.map +1 -1
- package/dist/build/assemble.js +74 -66
- package/dist/build/assemble.js.map +1 -1
- package/dist/build/expand.d.ts.map +1 -1
- package/dist/build/expand.js +20 -19
- package/dist/build/expand.js.map +1 -1
- package/dist/build/locations.d.ts +2 -3
- package/dist/build/locations.d.ts.map +1 -1
- package/dist/build/locations.js +2 -3
- package/dist/build/locations.js.map +1 -1
- package/dist/build/pages.d.ts +3 -4
- package/dist/build/pages.d.ts.map +1 -1
- package/dist/build/pages.js +3 -4
- package/dist/build/pages.js.map +1 -1
- package/dist/core/lb-constants.d.ts +25 -24
- package/dist/core/lb-constants.d.ts.map +1 -1
- package/dist/core/lb-constants.js +95 -168
- package/dist/core/lb-constants.js.map +1 -1
- package/dist/core/lb-types.d.ts +64 -77
- package/dist/core/lb-types.d.ts.map +1 -1
- package/dist/core/lb-types.js +40 -7
- package/dist/core/lb-types.js.map +1 -1
- package/dist/hub/lb-apply.d.ts +47 -37
- package/dist/hub/lb-apply.d.ts.map +1 -1
- package/dist/hub/lb-apply.js +174 -193
- package/dist/hub/lb-apply.js.map +1 -1
- package/dist/hub/lb-hub.browser.d.ts +1 -1
- package/dist/hub/lb-hub.browser.d.ts.map +1 -1
- package/dist/hub/lb-hub.browser.js +411 -449
- package/dist/hub/lb-hub.browser.js.map +1 -1
- package/dist/server/lb-express.d.ts +5 -5
- package/dist/server/lb-express.d.ts.map +1 -1
- package/dist/server/lb-express.js +35 -66
- package/dist/server/lb-express.js.map +1 -1
- package/dist/server/lb-server.d.ts +77 -135
- package/dist/server/lb-server.d.ts.map +1 -1
- package/dist/server/lb-server.js +132 -79
- package/dist/server/lb-server.js.map +1 -1
- package/docs/TECHREF-1.0.md +861 -587
- package/docs/comparison.md +222 -185
- package/docs/prior-art.md +15 -14
- package/docs/reference/builder.md +9 -3
- package/docs/reference/chrome.md +107 -56
- package/docs/reference/custom-elements.md +199 -173
- package/docs/reference/data-binding.md +374 -374
- package/docs/reference/overview.md +12 -10
- package/docs/reference/page-files.md +135 -99
- package/docs/reference/server.md +2 -2
- package/docs/reference/widgets.md +104 -110
- package/docs/roadmap.md +32 -39
- package/docs/terms-of-art.md +57 -0
- package/docs/testing.md +97 -68
- package/docs/theory.md +92 -58
- package/docs/tutorials/010-pages-and-navigation.md +20 -12
- package/docs/tutorials/020-css.md +6 -3
- package/docs/tutorials/030-html-decomposition.md +9 -7
- package/docs/tutorials/040-displaying-data.md +30 -13
- package/docs/tutorials/{050-actions.md → 050-requests.md} +25 -15
- package/docs/tutorials/060-custom-element-code.md +17 -16
- package/docs/tutorials/065-conditional-rendering.md +34 -23
- package/docs/tutorials/070-displaying-a-list.md +29 -21
- package/docs/tutorials/072-inserting-into-a-list.md +24 -16
- package/docs/tutorials/074-deleting-from-a-list.md +9 -7
- package/docs/tutorials/076-updating-a-list-item.md +11 -10
- package/docs/tutorials/080-widget-requests.md +71 -43
- package/docs/tutorials/090-using-widget-libraries.md +22 -22
- package/package.json +1 -1
- package/skills/loadbare-app/SKILL.md +178 -122
- package/skills/loadbare-app/references/TECHREF-1.0.md +861 -587
- package/skills/loadbare-app/references/builder.md +9 -3
- package/skills/loadbare-app/references/chrome.md +107 -56
- package/skills/loadbare-app/references/custom-elements.md +199 -173
- package/skills/loadbare-app/references/data-binding.md +374 -374
- package/skills/loadbare-app/references/overview.md +12 -10
- package/skills/loadbare-app/references/page-files.md +135 -99
- package/skills/loadbare-app/references/server.md +2 -2
- package/skills/loadbare-app/references/widgets.md +104 -110
- package/docs/analysis-accidental-complexity.md +0 -149
- package/docs/analysis-closed-set.md +0 -210
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locations.js","sourceRoot":"","sources":["../../build/locations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0B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AC;QACtC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CACb,eAAe,IAAI,GAAG,YAAY,SAAS,IAAI,GAAG,cAAc,gBAAgB;gBAC9E,IAAI,IAAI,CAAC,GAAG,sBAAsB,IAAI,GAAG,WAAW,GAAG,CAC1D,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO;QACL,GAAG,IAAI;QACP,MAAM,EAAE,IAAI,CAAC,GAAG;QAChB,UAAU,EAAE,gBAAgB,CAAC,CAAC,CAAE;QAChC,KAAK;QACL,WAAW;QACX,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACtE,MAAM,EAAE,IAAI,CAAC,GAAG;KACjB,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Finding the application's own files by what they're named, not by which\n * directory they happen to sit in.\n *\n * A page and a widget definition can be byte-for-byte identical markup —\n * the only thing that says which one a file is, is extrinsic to its\n * content. `pages/` vs. `widgets/` used to carry that meaning; here a\n * filename suffix does instead: `chrome.html` is the one chrome file, and\n * `*.page.html` is a page.\n *\n * A page's server half is named the same way: `*.requests.ts` and\n * `*.queries.ts` pair with a `*.page.html` by sharing its basename, and are\n * free to sit anywhere too. Either may be absent — a page with no data needs\n * neither — but one with no matching `*.page.html` is a naming mistake and\n * is rejected below.\n *\n * Widget definitions, widget scripts and stylesheets are not found here.\n * They arrive from more than one origin — this package's own widgets, an\n * imported package, or `src` — and all three are scanned the same way by\n * build/origins.ts. `src` is simply the last origin in that cascade.\n *\n * `--src` names the one tree scanned this way; `--out` names where the\n * build lands. Those, plus this package's own root (for its built-in\n * widgets and hub/), are the only locations this module resolves — every\n * other module takes the result as a plain parameter and never\n * reconstructs one of its own.\n */\n\nimport { readdir, readFile } from \"node:fs/promises\";\nimport type { Dirent } from \"node:fs\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { findPackageRoot } from \"./package-root.js\";\nimport type { BuiltinDirs } from \"./origins.js\";\n\nexport { CUSTOM_ELEMENT_TAG } from \"./origins.js\";\n\nconst CHROME_FILENAME = \"chrome.html\";\nconst PAGE_SUFFIX = \".page.html\";\nconst HOOKS_SUFFIX = \".requests.ts\";\nconst QUERIES_SUFFIX = \".queries.ts\";\nconst IMPORTS_FILENAME = \"imports.ts\";\n\nexport interface PageFile {\n name: string;\n file: string;\n}\n\nexport interface PageSource {\n /** Absolute path to the `.requests.ts` module, if this page has one. */\n requests?: string;\n /** Absolute path to the `.queries.ts` module, if this page has one. */\n queries?: string;\n}\n\ninterface Discovered {\n chromeCandidates: string[];\n pages: PageFile[];\n pageSources: Map<string, PageSource>;\n importsCandidates: string[];\n}\n\n/** The raw walk, with no uniqueness checks — usable on its own by anything that does not need a chrome file. */\nexport async function discoverSrc(src: string): Promise<Discovered> {\n const chromeCandidates: string[] = [];\n const pages: PageFile[] = [];\n const pageSources = new Map<string, PageSource>();\n const importsCandidates: string[] = [];\n\n let entries: Dirent[];\n try {\n entries = await readdir(src, { withFileTypes: true, recursive: true });\n } catch {\n entries = [];\n }\n\n const pageSource = (name: string): PageSource => {\n let p = pageSources.get(name);\n if (!p) {\n p = {};\n pageSources.set(name, p);\n }\n return p;\n };\n\n for (const entry of entries) {\n if (!entry.isFile()) continue;\n const file = path.join(entry.parentPath, entry.name);\n\n if (entry.name === IMPORTS_FILENAME) {\n importsCandidates.push(file);\n } else if (entry.name === CHROME_FILENAME) {\n chromeCandidates.push(file);\n } else if (entry.name.endsWith(PAGE_SUFFIX)) {\n pages.push({ name: entry.name.slice(0, -PAGE_SUFFIX.length), file });\n } else if (entry.name.endsWith(HOOKS_SUFFIX)) {\n pageSource(entry.name.slice(0, -HOOKS_SUFFIX.length)).requests = file;\n } else if (entry.name.endsWith(QUERIES_SUFFIX)) {\n pageSource(entry.name.slice(0, -QUERIES_SUFFIX.length)).queries = file;\n }\n }\n\n pages.sort((a, b) => a.name.localeCompare(b.name));\n return { chromeCandidates, pages, pageSources, importsCandidates };\n}\n\nexport type PackageInfo = BuiltinDirs;\n\nexport async function packageInfo(): Promise<PackageInfo> {\n const here = path.dirname(fileURLToPath(import.meta.url));\n const root = await findPackageRoot(here);\n let pkg: { name: string };\n try {\n pkg = JSON.parse(await readFile(path.join(root, \"package.json\"), \"utf-8\"));\n } catch (err) {\n throw new Error(\n `locations: could not read '${root}/package.json': ${(err as Error).message}`,\n );\n }\n return {\n // `hub/` beside this module, not beside package.json: running from source\n // that is the package's own hub/, and running compiled it is dist/hub —\n // the one an installed package ships, since `files` carries dist and not\n // the source tree.\n builtinHubDir: path.join(path.dirname(here), \"hub\"),\n packageName: pkg.name,\n };\n}\n\nexport interface LocationArgs {\n /** The application's source tree, e.g. \"src\". Scanned as a whole — see this file's header. */\n src: string;\n out: string;\n}\n\nexport interface Locations extends PackageInfo {\n srcDir: string;\n chromeFile: string;\n pages: PageFile[];\n pageSources: Map<string, PageSource>;\n importsFile?: string;\n outDir: string;\n}\n\nexport async function resolveLocations(args: LocationArgs): Promise<Locations> {\n const [info, discovered] = await Promise.all([\n packageInfo(),\n discoverSrc(args.src),\n ]);\n const { chromeCandidates, importsCandidates, pages, pageSources } =\n discovered;\n\n if (chromeCandidates.length === 0) {\n throw new Error(\n `locations: no ${CHROME_FILENAME} file found under '${args.src}'`,\n );\n }\n if (chromeCandidates.length > 1) {\n throw new Error(\n `locations: more than one ${CHROME_FILENAME} file found under '${args.src}': ` +\n chromeCandidates.join(\", \"),\n );\n }\n if (importsCandidates.length > 1) {\n throw new Error(\n `locations: more than one ${IMPORTS_FILENAME} found under '${args.src}': ` +\n importsCandidates.join(\", \"),\n );\n }\n\n // Sorted by name above, so duplicates are adjacent. A stub is the page's\n // whole identity — its route, its template and its server half all key on\n // it — so two files claiming one stub is a naming mistake, not a merge.\n for (let i = 1; i < pages.length; i++) {\n const [prev, here] = [pages[i - 1]!, pages[i]!];\n if (prev.name === here.name) {\n throw new Error(\n `locations: more than one '${here.name}${PAGE_SUFFIX}' found under ` +\n `'${args.src}': ${prev.file}, ${here.file}; the page namespace is ` +\n `flat, so a stub names one page`,\n );\n }\n }\n\n const pageNames = new Set(pages.map((p) => p.name));\n for (const name of pageSources.keys()) {\n if (!pageNames.has(name)) {\n throw new Error(\n `locations: '${name}${HOOKS_SUFFIX}' or '${name}${QUERIES_SUFFIX}' found under ` +\n `'${args.src}' but there is no '${name}${PAGE_SUFFIX}'`,\n );\n }\n }\n\n return {\n ...info,\n srcDir: args.src,\n chromeFile: chromeCandidates[0]!,\n pages,\n pageSources,\n ...(importsCandidates[0] ? { importsFile: importsCandidates[0] } : {}),\n outDir: args.out,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"locations.js","sourceRoot":"","sources":["../../build/locations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,MAAM,eAAe,GAAG,aAAa,CAAC;AACtC,MAAM,WAAW,GAAG,YAAY,CAAC;AACjC,MAAM,YAAY,GAAG,cAAc,CAAC;AACpC,MAAM,cAAc,GAAG,aAAa,CAAC;AACrC,MAAM,gBAAgB,GAAG,YAAY,CAAC;AAqBtC,gHAAgH;AAChH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,GAAW;IAC3C,MAAM,gBAAgB,GAAa,EAAE,CAAC;IACtC,MAAM,KAAK,GAAe,EAAE,CAAC;IAC7B,MAAM,WAAW,GAAG,IAAI,GAAG,EAAsB,CAAC;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directory they happen to sit in.\n *\n * A page and a widget definition can be byte-for-byte identical markup —\n * the only thing that says which one a file is, is extrinsic to its\n * content. A filename suffix carries that meaning: `chrome.html` is the one\n * chrome file, and `*.page.html` is a page.\n *\n * A page's server half is named the same way: `*.requests.ts` and\n * `*.queries.ts` pair with a `*.page.html` by sharing its basename, and are\n * free to sit anywhere too. Either may be absent — a page with no data needs\n * neither — but one with no matching `*.page.html` is a naming mistake and\n * is rejected below.\n *\n * Widget definitions, widget scripts and stylesheets are not found here.\n * They arrive from more than one origin — this package's own widgets, an\n * imported package, or `src` — and all three are scanned the same way by\n * build/origins.ts. `src` is simply the last origin in that cascade.\n *\n * `--src` names the one tree scanned this way; `--out` names where the\n * build lands. Those, plus this package's own root (for its built-in\n * widgets and hub/), are the only locations this module resolves — every\n * other module takes the result as a plain parameter and never\n * reconstructs one of its own.\n */\n\nimport { readdir, readFile } from \"node:fs/promises\";\nimport type { Dirent } from \"node:fs\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { findPackageRoot } from \"./package-root.js\";\nimport type { BuiltinDirs } from \"./origins.js\";\n\nexport { CUSTOM_ELEMENT_TAG } from \"./origins.js\";\n\nconst CHROME_FILENAME = \"chrome.html\";\nconst PAGE_SUFFIX = \".page.html\";\nconst HOOKS_SUFFIX = \".requests.ts\";\nconst QUERIES_SUFFIX = \".queries.ts\";\nconst IMPORTS_FILENAME = \"imports.ts\";\n\nexport interface PageFile {\n name: string;\n file: string;\n}\n\nexport interface PageSource {\n /** Absolute path to the `.requests.ts` module, if this page has one. */\n requests?: string;\n /** Absolute path to the `.queries.ts` module, if this page has one. */\n queries?: string;\n}\n\ninterface Discovered {\n chromeCandidates: string[];\n pages: PageFile[];\n pageSources: Map<string, PageSource>;\n importsCandidates: string[];\n}\n\n/** The raw walk, with no uniqueness checks — usable on its own by anything that does not need a chrome file. */\nexport async function discoverSrc(src: string): Promise<Discovered> {\n const chromeCandidates: string[] = [];\n const pages: PageFile[] = [];\n const pageSources = new Map<string, PageSource>();\n const importsCandidates: string[] = [];\n\n let entries: Dirent[];\n try {\n entries = await readdir(src, { withFileTypes: true, recursive: true });\n } catch {\n entries = [];\n }\n\n const pageSource = (name: string): PageSource => {\n let p = pageSources.get(name);\n if (!p) {\n p = {};\n pageSources.set(name, p);\n }\n return p;\n };\n\n for (const entry of entries) {\n if (!entry.isFile()) continue;\n const file = path.join(entry.parentPath, entry.name);\n\n if (entry.name === IMPORTS_FILENAME) {\n importsCandidates.push(file);\n } else if (entry.name === CHROME_FILENAME) {\n chromeCandidates.push(file);\n } else if (entry.name.endsWith(PAGE_SUFFIX)) {\n pages.push({ name: entry.name.slice(0, -PAGE_SUFFIX.length), file });\n } else if (entry.name.endsWith(HOOKS_SUFFIX)) {\n pageSource(entry.name.slice(0, -HOOKS_SUFFIX.length)).requests = file;\n } else if (entry.name.endsWith(QUERIES_SUFFIX)) {\n pageSource(entry.name.slice(0, -QUERIES_SUFFIX.length)).queries = file;\n }\n }\n\n pages.sort((a, b) => a.name.localeCompare(b.name));\n return { chromeCandidates, pages, pageSources, importsCandidates };\n}\n\nexport type PackageInfo = BuiltinDirs;\n\nexport async function packageInfo(): Promise<PackageInfo> {\n const here = path.dirname(fileURLToPath(import.meta.url));\n const root = await findPackageRoot(here);\n let pkg: { name: string };\n try {\n pkg = JSON.parse(await readFile(path.join(root, \"package.json\"), \"utf-8\"));\n } catch (err) {\n throw new Error(\n `locations: could not read '${root}/package.json': ${(err as Error).message}`,\n );\n }\n return {\n // `hub/` beside this module, not beside package.json: running from source\n // that is the package's own hub/, and running compiled it is dist/hub —\n // the one an installed package ships, since `files` carries dist and not\n // the source tree.\n builtinHubDir: path.join(path.dirname(here), \"hub\"),\n packageName: pkg.name,\n };\n}\n\nexport interface LocationArgs {\n /** The application's source tree, e.g. \"src\". Scanned as a whole — see this file's header. */\n src: string;\n out: string;\n}\n\nexport interface Locations extends PackageInfo {\n srcDir: string;\n chromeFile: string;\n pages: PageFile[];\n pageSources: Map<string, PageSource>;\n importsFile?: string;\n outDir: string;\n}\n\nexport async function resolveLocations(args: LocationArgs): Promise<Locations> {\n const [info, discovered] = await Promise.all([\n packageInfo(),\n discoverSrc(args.src),\n ]);\n const { chromeCandidates, importsCandidates, pages, pageSources } =\n discovered;\n\n if (chromeCandidates.length === 0) {\n throw new Error(\n `locations: no ${CHROME_FILENAME} file found under '${args.src}'`,\n );\n }\n if (chromeCandidates.length > 1) {\n throw new Error(\n `locations: more than one ${CHROME_FILENAME} file found under '${args.src}': ` +\n chromeCandidates.join(\", \"),\n );\n }\n if (importsCandidates.length > 1) {\n throw new Error(\n `locations: more than one ${IMPORTS_FILENAME} found under '${args.src}': ` +\n importsCandidates.join(\", \"),\n );\n }\n\n // Sorted by name above, so duplicates are adjacent. A stub is the page's\n // whole identity — its route, its template and its server half all key on\n // it — so two files claiming one stub is a naming mistake, not a merge.\n for (let i = 1; i < pages.length; i++) {\n const [prev, here] = [pages[i - 1]!, pages[i]!];\n if (prev.name === here.name) {\n throw new Error(\n `locations: more than one '${here.name}${PAGE_SUFFIX}' found under ` +\n `'${args.src}': ${prev.file}, ${here.file}; the page namespace is ` +\n `flat, so a stub names one page`,\n );\n }\n }\n\n const pageNames = new Set(pages.map((p) => p.name));\n for (const name of pageSources.keys()) {\n if (!pageNames.has(name)) {\n throw new Error(\n `locations: '${name}${HOOKS_SUFFIX}' or '${name}${QUERIES_SUFFIX}' found under ` +\n `'${args.src}' but there is no '${name}${PAGE_SUFFIX}'`,\n );\n }\n }\n\n return {\n ...info,\n srcDir: args.src,\n chromeFile: chromeCandidates[0]!,\n pages,\n pageSources,\n ...(importsCandidates[0] ? { importsFile: importsCandidates[0] } : {}),\n outDir: args.out,\n };\n}\n"]}
|
package/dist/build/pages.d.ts
CHANGED
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
* build/elements.ts's client entry point.
|
|
4
4
|
*
|
|
5
5
|
* `*.requests.ts` and `*.queries.ts` are ordinary TypeScript, found by
|
|
6
|
-
* build/locations.ts and handed here already paired by page name.
|
|
7
|
-
* module writes
|
|
8
|
-
*
|
|
9
|
-
* `createHub()` call. It is written to `<out>/pages.ts` rather than compiled
|
|
6
|
+
* build/locations.ts and handed here already paired by page name. This
|
|
7
|
+
* module writes an import of each pair, a `Pages` object naming them by
|
|
8
|
+
* page, and the one `createHub()` call. It is written to `<out>/pages.ts` rather than compiled
|
|
10
9
|
* — the application runs it directly, exactly as it does its own server
|
|
11
10
|
* code, so it never needs a bundler step the way the browser-bound client
|
|
12
11
|
* entry does.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pages.d.ts","sourceRoot":"","sources":["../../build/pages.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"pages.d.ts","sourceRoot":"","sources":["../../build/pages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAY3D;;;;GAIG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,QAAQ,EAAE,EACjB,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,EACpC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,GAClB,MAAM,GAAG,SAAS,CAsCpB"}
|
package/dist/build/pages.js
CHANGED
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
* build/elements.ts's client entry point.
|
|
4
4
|
*
|
|
5
5
|
* `*.requests.ts` and `*.queries.ts` are ordinary TypeScript, found by
|
|
6
|
-
* build/locations.ts and handed here already paired by page name.
|
|
7
|
-
* module writes
|
|
8
|
-
*
|
|
9
|
-
* `createHub()` call. It is written to `<out>/pages.ts` rather than compiled
|
|
6
|
+
* build/locations.ts and handed here already paired by page name. This
|
|
7
|
+
* module writes an import of each pair, a `Pages` object naming them by
|
|
8
|
+
* page, and the one `createHub()` call. It is written to `<out>/pages.ts` rather than compiled
|
|
10
9
|
* — the application runs it directly, exactly as it does its own server
|
|
11
10
|
* code, so it never needs a bundler step the way the browser-bound client
|
|
12
11
|
* entry does.
|
package/dist/build/pages.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pages.js","sourceRoot":"","sources":["../../build/pages.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"pages.js","sourceRoot":"","sources":["../../build/pages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,qFAAqF;AACrF,SAAS,UAAU,CAAC,IAAY,EAAE,MAA8B;IAC9D,OAAO,QAAQ,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,GAAG,CAAC,IAAI,MAAM,EAAE,CAAC;AAChE,CAAC;AAED,SAAS,cAAc,CAAC,MAAc,EAAE,IAAY;IAClD,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAClE,OAAO,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;AAChD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,WAAW,CACzB,KAAiB,EACjB,WAAoC,EACpC,MAAc,EACd,WAAmB;IAEnB,IAAI,WAAW,CAAC,IAAI,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAE7C,MAAM,OAAO,GAAa;QACxB,6BAA6B,IAAI,CAAC,SAAS,CAAC,GAAG,WAAW,SAAS,CAAC,GAAG;KACxE,CAAC;IACF,MAAM,OAAO,GAAa,EAAE,CAAC;IAE7B,KAAK,MAAM,EAAE,IAAI,EAAE,IAAI,KAAK,EAAE,CAAC;QAC7B,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACrC,IAAI,CAAC,MAAM;YAAE,SAAS;QAEtB,MAAM,UAAU,GAAG,MAAM,CAAC,QAAQ;YAChC,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC;YAC9B,CAAC,CAAC,SAAS,CAAC;QACd,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAE3E,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;YACpB,OAAO,CAAC,IAAI,CACV,wBAAwB,UAAU,WAAW,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,CACxG,CAAC;QACJ,CAAC;QACD,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACnB,OAAO,CAAC,IAAI,CACV,uBAAuB,SAAS,WAAW,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CACrG,CAAC;QACJ,CAAC;QAED,OAAO,CAAC,IAAI,CACV,KAAK,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,iBAAiB,UAAU,IAAI,IAAI,cAAc,SAAS,IAAI,IAAI,KAAK,CACjG,CAAC;IACJ,CAAC;IAED,OAAO,CACL,CAAC,GAAG,OAAO,EAAE,EAAE,EAAE,gCAAgC,EAAE,GAAG,OAAO,EAAE,KAAK,CAAC,CAAC,IAAI,CACxE,IAAI,CACL,GAAG,IAAI,CACT,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Generating the hub's page registry — the server-side counterpart to\n * build/elements.ts's client entry point.\n *\n * `*.requests.ts` and `*.queries.ts` are ordinary TypeScript, found by\n * build/locations.ts and handed here already paired by page name. This\n * module writes an import of each pair, a `Pages` object naming them by\n * page, and the one `createHub()` call. It is written to `<out>/pages.ts` rather than compiled\n * — the application runs it directly, exactly as it does its own server\n * code, so it never needs a bundler step the way the browser-bound client\n * entry does.\n *\n * Each import keeps its `.ts` extension. Node's loader, including its own\n * type stripping, looks for exactly the path it is given and never tries an\n * extension, so a path without one runs under tsx and nowhere else.\n *\n * Nothing here is emitted for a page with neither a requests nor a queries\n * file — a purely static page needs no hub entry, and createHub is only\n * called at all when there is at least one.\n */\n\nimport path from \"node:path\";\nimport type { PageFile, PageSource } from \"./locations.js\";\n\n/** A page name may contain anything a filename can; an import identifier may not. */\nfunction identifier(name: string, suffix: \"Requests\" | \"Queries\"): string {\n return `page_${name.replace(/[^a-zA-Z0-9]/g, \"_\")}_${suffix}`;\n}\n\nfunction relativeImport(outDir: string, file: string): string {\n const rel = path.relative(outDir, file).split(path.sep).join(\"/\");\n return rel.startsWith(\".\") ? rel : `./${rel}`;\n}\n\n/**\n * `undefined` when no page has a requests or queries file — the caller writes\n * nothing in that case, the same way an app with no custom elements gets no\n * client entry beyond the built-ins.\n */\nexport function pagesSource(\n pages: PageFile[],\n pageSources: Map<string, PageSource>,\n outDir: string,\n packageName: string,\n): string | undefined {\n if (pageSources.size === 0) return undefined;\n\n const imports: string[] = [\n `import { createHub } from ${JSON.stringify(`${packageName}/server`)};`,\n ];\n const entries: string[] = [];\n\n for (const { name } of pages) {\n const source = pageSources.get(name);\n if (!source) continue;\n\n const requestsId = source.requests\n ? identifier(name, \"Requests\")\n : undefined;\n const queriesId = source.queries ? identifier(name, \"Queries\") : undefined;\n\n if (source.requests) {\n imports.push(\n `import { requests as ${requestsId} } from ${JSON.stringify(relativeImport(outDir, source.requests))};`,\n );\n }\n if (source.queries) {\n imports.push(\n `import { queries as ${queriesId} } from ${JSON.stringify(relativeImport(outDir, source.queries))};`,\n );\n }\n\n entries.push(\n ` ${JSON.stringify(name)}: { requests: ${requestsId ?? \"{}\"}, queries: ${queriesId ?? \"{}\"} },`,\n );\n }\n\n return (\n [...imports, \"\", \"export const hub = createHub({\", ...entries, \"});\"].join(\n \"\\n\",\n ) + \"\\n\"\n );\n}\n"]}
|
|
@@ -1,32 +1,33 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const ATTR_KEY = "lb-key";
|
|
4
|
-
export declare const ATTR_KEY_VALUE = "lb-key-value";
|
|
5
|
-
export declare const ATTR_CELL = "lb-cell";
|
|
1
|
+
export declare const ATTR_QUERY = "lb-query";
|
|
2
|
+
export declare const ATTR_COLUMN = "lb-column";
|
|
6
3
|
export declare const ATTR_SHOW = "lb-show";
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const
|
|
4
|
+
export declare const ATTR_COLUMN_VALUE = "lb-column-value";
|
|
5
|
+
export declare const ATTR_KEY_VALUE = "lb-key-value";
|
|
6
|
+
export declare const ATTR_QUERY_ROW_COUNT = "lb-query-row-count";
|
|
7
|
+
export declare const ATTR_REQUEST = "lb-request";
|
|
9
8
|
export declare const LB_EVENT_NAME = "lb-request";
|
|
10
|
-
export declare const
|
|
9
|
+
export declare const ATTR_REQUEST_PENDING = "lb-request-pending";
|
|
10
|
+
export declare const ATTR_REQUEST_ERROR = "lb-request-error";
|
|
11
11
|
export declare const LB_RESERVED_PREFIX = "lb-";
|
|
12
|
-
export declare const
|
|
13
|
-
export declare const
|
|
14
|
-
export declare const
|
|
15
|
-
export declare const
|
|
16
|
-
export declare const
|
|
17
|
-
export declare const
|
|
18
|
-
export declare const
|
|
19
|
-
export declare const
|
|
20
|
-
export declare const
|
|
12
|
+
export declare const REQUEST_ROW_INSERT = "lb-row-insert";
|
|
13
|
+
export declare const REQUEST_ROW_UPDATE = "lb-row-update";
|
|
14
|
+
export declare const REQUEST_ROW_DELETE = "lb-row-delete";
|
|
15
|
+
export declare const LB_ROW_REQUESTS: readonly ["lb-row-insert", "lb-row-update", "lb-row-delete"];
|
|
16
|
+
export declare const KIND_ROW = "row";
|
|
17
|
+
export declare const KIND_ROWS = "rows";
|
|
18
|
+
export declare const URL_QUERY = "lb-url";
|
|
19
|
+
export declare const URL_COLUMN_PATH = "lb-path";
|
|
20
|
+
export declare const URL_COLUMN_PAGE_LABEL = "lb-page-label";
|
|
21
|
+
export declare const URL_COLUMN_PAGE_UNKNOWN = "lb-page-unknown";
|
|
22
|
+
export declare const ATTR_URL_LINK = "lb-url-link";
|
|
23
|
+
export declare const ATTR_URL_PUSH = "lb-url-push";
|
|
24
|
+
export declare const ATTR_URL_UNKNOWN = "lb-url-unknown";
|
|
25
|
+
export declare const ATTR_EXP_SLOT = "lb-exp-slot";
|
|
26
|
+
export declare const ATTR_EXP_TEMPLATE = "lb-exp-template";
|
|
21
27
|
export declare const ATTR_PAGE = "lb-page";
|
|
22
|
-
export declare const
|
|
23
|
-
export declare const
|
|
24
|
-
export declare const NAV_CELL_URI = "page-uri";
|
|
25
|
-
export declare const QUERY_PARMS_ROW = "lb-query-parms";
|
|
26
|
-
export declare const ATTR_UNKNOWN_PAGE = "lb-unknown-page";
|
|
28
|
+
export declare const ATTR_PAGE_TITLE = "lb-page-title";
|
|
29
|
+
export declare const DEVELOPER_ATTRIBUTES: readonly ["lb-query", "lb-column", "lb-show", "lb-request", "lb-url-link", "lb-url-push", "lb-url-unknown"];
|
|
27
30
|
export declare const HUB_TAG_NAME = "lb-hub";
|
|
28
|
-
export declare const ATTR_PENDING = "lb-pending";
|
|
29
|
-
export declare const ATTR_ERROR = "lb-error";
|
|
30
31
|
export declare const LB_ENDPOINT = "/lb";
|
|
31
32
|
export declare const LB_REQUEST_TIMEOUT_MS = 10000;
|
|
32
33
|
//# sourceMappingURL=lb-constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lb-constants.d.ts","sourceRoot":"","sources":["../../core/lb-constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lb-constants.d.ts","sourceRoot":"","sources":["../../core/lb-constants.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,UAAU,aAAa,CAAC;AAKrC,eAAO,MAAM,WAAW,cAAc,CAAC;AAavC,e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
|
+
// Every Loadbare attribute name lives here. Nothing writes one as a string
|
|
2
2
|
// literal — not a widget, not a page host, not a test. See
|
|
3
3
|
// docs/reference/data-binding.md.
|
|
4
|
-
// ---
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
|
|
10
|
-
//
|
|
11
|
-
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
|
|
16
|
-
export const ATTR_ROW = "lb-row";
|
|
17
|
-
// Named on a row template by the developer: the column that identifies a row
|
|
18
|
-
// of the list. A property of the list rather than of the template — a list
|
|
19
|
-
// without a fixed key column is meaningless — but written where the rows
|
|
20
|
-
// land, because that is the only place the page says anything about them.
|
|
21
|
-
export const ATTR_KEY = "lb-key";
|
|
22
|
-
// Stamped on a live row by the row machinery: that row's value of the column
|
|
23
|
-
// ATTR_KEY names. Written by the hub, never by a developer, and read back by
|
|
24
|
-
// whatever needs to know which row it is inside — a delete button, an update
|
|
25
|
-
// form, a widget building its own request, or a stylesheet.
|
|
26
|
-
export const ATTR_KEY_VALUE = "lb-key-value";
|
|
27
|
-
// The column an element displays.
|
|
28
|
-
//
|
|
29
|
-
// Its value is a column name and never a cell name. A cell has no name of
|
|
30
|
-
// its own: it is identified by its row and its column, and the row arrives
|
|
31
|
-
// from scope, so the column is all that is left to say. ATTR_KEY holds a
|
|
32
|
-
// column name for the same reason.
|
|
33
|
-
export const ATTR_CELL = "lb-cell";
|
|
4
|
+
// --- Landing (docs/reference/data-binding.md) ----------------------------
|
|
5
|
+
// Everything is a query. The server answers every request with response
|
|
6
|
+
// items, one per query, and each carries the query's kind and key. The
|
|
7
|
+
// markup names a query and the columns it shows; it never repeats what the
|
|
8
|
+
// server already declared.
|
|
9
|
+
// Names the query whose rows land in an element's content. A nested one
|
|
10
|
+
// begins a new query: what is inside it is that query's.
|
|
11
|
+
export const ATTR_QUERY = "lb-query";
|
|
12
|
+
// The column an element shows, read from the nearest ancestor row. On a
|
|
13
|
+
// control the hub sets its value, and gathers it back under this name when
|
|
14
|
+
// the control's request is issued.
|
|
15
|
+
export const ATTR_COLUMN = "lb-column";
|
|
34
16
|
// The column that decides whether an element is present: `null` and `false`
|
|
35
|
-
// are off, and every other value is on. It
|
|
36
|
-
//
|
|
17
|
+
// are off, and every other value is on. It reads from the nearest ancestor
|
|
18
|
+
// row, as ATTR_COLUMN does.
|
|
37
19
|
//
|
|
38
20
|
// An element that is off is moved into a `<template>` carrying this attribute
|
|
39
21
|
// and the same column, standing where the element stood, and moved back out
|
|
@@ -43,132 +25,91 @@ export const ATTR_CELL = "lb-cell";
|
|
|
43
25
|
// branch in the document so the hub holds nothing. Landing reaches inside it,
|
|
44
26
|
// so a branch that returns is already current; nothing else does.
|
|
45
27
|
export const ATTR_SHOW = "lb-show";
|
|
46
|
-
|
|
47
|
-
//
|
|
48
|
-
//
|
|
49
|
-
|
|
50
|
-
//
|
|
51
|
-
//
|
|
52
|
-
|
|
28
|
+
// Stamped by the hub on every element it sets from a column: the value it
|
|
29
|
+
// set, so a stylesheet can select on it and a custom element that is not a
|
|
30
|
+
// control can render it.
|
|
31
|
+
export const ATTR_COLUMN_VALUE = "lb-column-value";
|
|
32
|
+
// Stamped by the hub on each live row, and on an element a `row` lands on
|
|
33
|
+
// itself: the row's key. The key column is the query's, declared by the
|
|
34
|
+
// server and carried by every response item.
|
|
35
|
+
export const ATTR_KEY_VALUE = "lb-key-value";
|
|
36
|
+
// Stamped by the hub on an element with a row template: how many live rows
|
|
37
|
+
// it holds, so "no members yet" is a stylesheet rule rather than a
|
|
38
|
+
// conditional in every widget.
|
|
39
|
+
export const ATTR_QUERY_ROW_COUNT = "lb-query-row-count";
|
|
53
40
|
// --- Requests (docs/reference/data-binding.md) --------------------------
|
|
54
|
-
//
|
|
55
|
-
//
|
|
41
|
+
// Names the request an element issues when it commits: a form on submit, a
|
|
42
|
+
// control on change, anything else on click.
|
|
43
|
+
export const ATTR_REQUEST = "lb-request";
|
|
44
|
+
// Every request travels as one bubbling event of this name, whoever issued
|
|
45
|
+
// it, so an ancestor may stop it.
|
|
56
46
|
export const LB_EVENT_NAME = "lb-request";
|
|
57
|
-
//
|
|
58
|
-
//
|
|
59
|
-
|
|
60
|
-
//
|
|
61
|
-
//
|
|
62
|
-
//
|
|
63
|
-
|
|
64
|
-
export const ATTR_ACTION = "lb-action";
|
|
47
|
+
// Stamped on the element that issued a request while its round trip is in
|
|
48
|
+
// flight, alongside aria-busy. A commit on an element carrying it is ignored.
|
|
49
|
+
export const ATTR_REQUEST_PENDING = "lb-request-pending";
|
|
50
|
+
// Stamped on the element that issued a request when its round trip failed —
|
|
51
|
+
// a non-2xx response, a thrown application error, or a timeout, all alike.
|
|
52
|
+
// Cleared at the start of that element's next request.
|
|
53
|
+
export const ATTR_REQUEST_ERROR = "lb-request-error";
|
|
65
54
|
// --- Reserved names ----------------------------------------------------
|
|
66
|
-
// Loadbare owns every
|
|
67
|
-
//
|
|
68
|
-
//
|
|
69
|
-
// that declares a query or
|
|
70
|
-
// name can never collide with one an application already uses.
|
|
71
|
-
//
|
|
72
|
-
// It is also the whole of the wire discriminant. A request whose `action`
|
|
73
|
-
// begins with it is one of the three operations; anything else is a name the
|
|
74
|
-
// page declared under its requests. Nothing else tells them apart.
|
|
55
|
+
// Loadbare owns every name beginning with this prefix: attribute names, the
|
|
56
|
+
// values of its attributes, query names, request names, the column names of
|
|
57
|
+
// its own queries, custom element names and event names. The server refuses
|
|
58
|
+
// a page that declares a query or a request so named.
|
|
75
59
|
export const LB_RESERVED_PREFIX = "lb-";
|
|
76
|
-
//
|
|
77
|
-
//
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
export const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
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.
|
|
97
|
-
export const ACTION_ROW_UPDATE = "lb-row-update";
|
|
98
|
-
// Every reserved lb-action, in one place, so the builder can refuse an
|
|
99
|
-
// unknown one and the hub can refuse to send one it does not implement.
|
|
100
|
-
export const LB_ACTIONS = [
|
|
101
|
-
ACTION_ROW_INSERT,
|
|
102
|
-
ACTION_ROW_DELETE,
|
|
103
|
-
ACTION_ROW_UPDATE,
|
|
60
|
+
// The requests Loadbare provides. Each runs the page's crud declaration for
|
|
61
|
+
// the request's query.
|
|
62
|
+
export const REQUEST_ROW_INSERT = "lb-row-insert";
|
|
63
|
+
export const REQUEST_ROW_UPDATE = "lb-row-update";
|
|
64
|
+
export const REQUEST_ROW_DELETE = "lb-row-delete";
|
|
65
|
+
export const LB_ROW_REQUESTS = [
|
|
66
|
+
REQUEST_ROW_INSERT,
|
|
67
|
+
REQUEST_ROW_UPDATE,
|
|
68
|
+
REQUEST_ROW_DELETE,
|
|
104
69
|
];
|
|
105
|
-
// ---
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
//
|
|
109
|
-
|
|
110
|
-
//
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
//
|
|
116
|
-
|
|
117
|
-
//
|
|
118
|
-
//
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
//
|
|
123
|
-
//
|
|
124
|
-
|
|
125
|
-
//
|
|
126
|
-
|
|
127
|
-
//
|
|
128
|
-
//
|
|
129
|
-
//
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
// Changing what the current page shows is not going anywhere, so a query parm
|
|
133
|
-
// write replaces the history entry. A control carrying this pushes one
|
|
134
|
-
// instead, for the rare parm a user would expect Back to undo.
|
|
135
|
-
export const ATTR_QUERY_PARM_PUSH = "lb-query-parm-push";
|
|
136
|
-
// A page host ships as <template lb-page="<name>">. An attribute rather than
|
|
137
|
-
// an id: an id lives in the application's own namespace, where a page named
|
|
138
|
-
// for something the chrome also ids would collide, and getElementById()
|
|
139
|
-
// answers a collision by silently picking one.
|
|
70
|
+
// --- Kinds --------------------------------------------------------------
|
|
71
|
+
export const KIND_ROW = "row";
|
|
72
|
+
export const KIND_ROWS = "rows";
|
|
73
|
+
// --- The URL (docs/reference/chrome.md) ---------------------------------
|
|
74
|
+
// The query the hub serves: one row, keyed by the path, whose other columns
|
|
75
|
+
// are the query parms.
|
|
76
|
+
export const URL_QUERY = "lb-url";
|
|
77
|
+
export const URL_COLUMN_PATH = "lb-path";
|
|
78
|
+
export const URL_COLUMN_PAGE_LABEL = "lb-page-label";
|
|
79
|
+
export const URL_COLUMN_PAGE_UNKNOWN = "lb-page-unknown";
|
|
80
|
+
// On an `<a>`: a plain primary click sets `lb-path` from the `href`.
|
|
81
|
+
export const ATTR_URL_LINK = "lb-url-link";
|
|
82
|
+
// On an element with `lb-request`: its update of `lb-url` pushes a history
|
|
83
|
+
// entry instead of replacing one.
|
|
84
|
+
export const ATTR_URL_PUSH = "lb-url-push";
|
|
85
|
+
// On a `<dialog>`: the hub calls showModal() when `lb-page-unknown` is true.
|
|
86
|
+
export const ATTR_URL_UNKNOWN = "lb-url-unknown";
|
|
87
|
+
// --- Build time (docs/reference/custom-elements.md) ---------------------
|
|
88
|
+
// Marks the element in an element file whose children receive the rest of
|
|
89
|
+
// the custom element's content. An attribute rather than an element because
|
|
90
|
+
// HTML content models discard foreign elements inside <select> and <table>.
|
|
91
|
+
export const ATTR_EXP_SLOT = "lb-exp-slot";
|
|
92
|
+
// One name in two positions. In an element file it marks a destination; on a
|
|
93
|
+
// `<template>` in the custom element's content it names the destination
|
|
94
|
+
// that template is for, and the template's content moves into it.
|
|
95
|
+
export const ATTR_EXP_TEMPLATE = "lb-exp-template";
|
|
96
|
+
// A page ships as <template lb-page="<stub>">.
|
|
140
97
|
export const ATTR_PAGE = "lb-page";
|
|
141
|
-
//
|
|
142
|
-
//
|
|
143
|
-
|
|
144
|
-
//
|
|
145
|
-
//
|
|
146
|
-
//
|
|
147
|
-
export const
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
// run: the key of a row just inserted, or the absence of one just deleted.
|
|
157
|
-
// The server then loads the page at the query string with these parms set,
|
|
158
|
-
// in the same round trip, and the hub writes them into the URL before
|
|
159
|
-
// landing that load. An empty value takes the parm out. Only parms: the
|
|
160
|
-
// path is never the server's to change, so this cannot redirect. A reserved
|
|
161
|
-
// name (LB_RESERVED_PREFIX), so it never collides with a declared query.
|
|
162
|
-
export const QUERY_PARMS_ROW = "lb-query-parms";
|
|
163
|
-
// Marks the chrome's own <dialog> for a page name that resolves to no
|
|
164
|
-
// template — a routing miss discovered client-side, not an HTTP 404 (every
|
|
165
|
-
// route gets the same 200 response; see docs/tutorials/010-pages-and-navigation.md).
|
|
166
|
-
// The hub only opens it; what it says comes from NAV_ROW, which the dialog
|
|
167
|
-
// consumes like any other subtree, by naming it in lb-row. Optional: an
|
|
168
|
-
// application that declares none gets today's console.error and nothing
|
|
169
|
-
// more. The builder requires the element it's on to be a <dialog>
|
|
170
|
-
// (build/assemble.ts), since the hub calls showModal() on it.
|
|
171
|
-
export const ATTR_UNKNOWN_PAGE = "lb-unknown-page";
|
|
98
|
+
// Stamped by the builder beside ATTR_PAGE: the text content of the page
|
|
99
|
+
// file's `<title>`, which the builder removes.
|
|
100
|
+
export const ATTR_PAGE_TITLE = "lb-page-title";
|
|
101
|
+
// The attributes a developer writes. The builder refuses any other `lb-`
|
|
102
|
+
// attribute in markup: the rest are stamps, written by the hub or the
|
|
103
|
+
// builder and never by hand or by script.
|
|
104
|
+
export const DEVELOPER_ATTRIBUTES = [
|
|
105
|
+
ATTR_QUERY,
|
|
106
|
+
ATTR_COLUMN,
|
|
107
|
+
ATTR_SHOW,
|
|
108
|
+
ATTR_REQUEST,
|
|
109
|
+
ATTR_URL_LINK,
|
|
110
|
+
ATTR_URL_PUSH,
|
|
111
|
+
ATTR_URL_UNKNOWN,
|
|
112
|
+
];
|
|
172
113
|
// The hub's own tag. It is exempt from the rule every other LB-* tag
|
|
173
114
|
// follows: expansion does not require it to have a definition (build/expand.ts),
|
|
174
115
|
// and the client build does not require it to have a script of its own
|
|
@@ -176,23 +117,9 @@ export const ATTR_UNKNOWN_PAGE = "lb-unknown-page";
|
|
|
176
117
|
// registered once by the package's main entry point, not a widget an
|
|
177
118
|
// application discovers or declares.
|
|
178
119
|
export const HUB_TAG_NAME = "lb-hub";
|
|
179
|
-
// --- Request lifecycle --------------------------------------------------
|
|
180
|
-
// Stamped on the element that dispatched a request — the button, form, or
|
|
181
|
-
// widget itself — for the duration of its round trip. It carries no
|
|
182
|
-
// meaning beyond "in flight": a stylesheet dims the element, or a custom
|
|
183
|
-
// button widget watches it to disable itself. The hub sets and clears it,
|
|
184
|
-
// alongside aria-busy, and reads it in one place: a native action (a button
|
|
185
|
-
// or form, not a widget) still pending ignores being performed again.
|
|
186
|
-
export const ATTR_PENDING = "lb-pending";
|
|
187
|
-
// Stamped on the same element if that round trip failed — a non-2xx
|
|
188
|
-
// response, a thrown application error, or a timeout, all alike. Cleared at
|
|
189
|
-
// the start of that element's next request. What (if anything) an
|
|
190
|
-
// application shows for it is undecided; this is only the fact that it
|
|
191
|
-
// happened.
|
|
192
|
-
export const ATTR_ERROR = "lb-error";
|
|
193
120
|
// --- Wire --------------------------------------------------------------
|
|
194
121
|
// One path, one method: everything the hub asks of the server is a POST
|
|
195
|
-
// below this path. The page
|
|
122
|
+
// below this path. The page's stub follows it, and the query string the
|
|
196
123
|
// browser is showing rides after that verbatim, so `/accounts?acct=23` asks
|
|
197
124
|
// as `POST /lb/accounts?acct=23` and the server always knows what URL the
|
|
198
125
|
// browser is showing. Navigation is therefore the only GET an application
|
|
@@ -1 +1 @@
|
|
|
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,2BAA2B;AAE3B,8CAA8C;AAC9C,MAAM,CAAC,MAAM,SAAS,GAAG,SAAS,CAAC;AAEnC,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,6EAA6E;AAC7E,4EAA4E;AAC5E,mEAAmE;AACnE,MAAM,CAAC,MAAM,QAAQ,GAAG,QAAQ,CAAC;AAEjC,6EAA6E;AAC7E,2EAA2E;AAC3E,yEAAyE;AACzE,0EAA0E;AAC1E,MAAM,CAAC,MAAM,QAAQ,GAAG,QAAQ,CAAC;AAEjC,6EAA6E;AAC7E,6EAA6E;AAC7E,6EAA6E;AAC7E,4DAA4D;AAC5D,MAAM,CAAC,MAAM,cAAc,GAAG,cAAc,CAAC;AAE7C,kCAAkC;AAClC,EAAE;AACF,0EAA0E;AAC1E,2EAA2E;AAC3E,yEAAyE;AACzE,mCAAmC;AACnC,MAAM,CAAC,MAAM,SAAS,GAAG,SAAS,CAAC;AAEnC,4EAA4E;AAC5E,8EAA8E;AAC9E,qDAAqD;AACrD,EAAE;AACF,8EAA8E;AAC9E,4EAA4E;AAC5E,yEAAyE;AACzE,2EAA2E;AAC3E,6EAA6E;AAC7E,8EAA8E;AAC9E,kEAAkE;AAClE,MAAM,CAAC,MAAM,SAAS,GAAG,SAAS,CAAC;AAEnC,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,CAAC;AAErC,2EAA2E;AAC3E,2EAA2E;AAC3E,0EAA0E;AAC1E,sEAAsE;AAC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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,wEAAwE;AACxE,sEAAsE;AACtE,4EAA4E;AAC5E,0EAA0E;AAC1E,0EAA0E;AAC1E,iEAAiE;AACjE,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// Names the query parm a control writes. The query string describes what is\n// on screen and never commands, so a control that narrows the page writes its\n// value into the address bar rather than sending it: the hub sets the one\n// parm, or deletes it when the value is empty, and loads the page at the new\n// URL. Every other parm is left as it is. Landed back onto the control from\n// the URL on every load, so a reload, a mailed link and Back all show it.\nexport const ATTR_QUERY_PARM = \"lb-query-parm\";\n\n// Changing what the current page shows is not going anywhere, so a query parm\n// write replaces the history entry. A control carrying this pushes one\n// instead, for the rare parm a user would expect Back to undo.\nexport const ATTR_QUERY_PARM_PUSH = \"lb-query-parm-push\";\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 and query string as the browser has them.\nexport const NAV_CELL_LABEL = \"page-label\";\nexport const NAV_CELL_URI = \"page-uri\";\n\n// A server response that changes the query parms, in one row whose columns\n// are the parms. Returned from a request's run (write it with queryParms() in\n// server/lb-server.ts), because some values exist only once the write has\n// run: the key of a row just inserted, or the absence of one just deleted.\n// The server then loads the page at the query string with these parms set,\n// in the same round trip, and the hub writes them into the URL before\n// landing that load. An empty value takes the parm out. Only parms: the\n// path is never the server's to change, so this cannot redirect. A reserved\n// name (LB_RESERVED_PREFIX), so it never collides with a declared query.\nexport const QUERY_PARMS_ROW = \"lb-query-parms\";\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\n// below this path. The page name follows it, and the query string the\n// browser is showing rides after that verbatim, so `/accounts?acct=23` asks\n// as `POST /lb/accounts?acct=23` and the server always knows what URL the\n// browser is showing. Navigation is therefore the only GET an application\n// serves, 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,2EAA2E;AAC3E,2DAA2D;AAC3D,kCAAkC;AAElC,4EAA4E;AAC5E,wEAAwE;AACxE,uEAAuE;AACvE,2EAA2E;AAC3E,2BAA2B;AAE3B,wEAAwE;AACxE,yDAAyD;AACzD,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,CAAC;AAErC,wEAAwE;AACxE,2EAA2E;AAC3E,mCAAmC;AACnC,MAAM,CAAC,MAAM,WAAW,GAAG,WAAW,CAAC;AAEvC,4EAA4E;AAC5E,2EAA2E;AAC3E,4BAA4B;AAC5B,EAAE;AACF,8EAA8E;AAC9E,4EAA4E;AAC5E,yEAAyE;AACzE,2EAA2E;AAC3E,6EAA6E;AAC7E,8EAA8E;AAC9E,kEAAkE;AAClE,MAAM,CAAC,MAAM,SAAS,GAAG,SAAS,CAAC;AAEnC,0EAA0E;AAC1E,2EAA2E;AAC3E,yBAAyB;AACzB,MAAM,CAAC,MAAM,iBAAiB,GAAG,iBAAiB,CAAC;AAEnD,0EAA0E;AAC1E,wEAAwE;AACxE,6CAA6C;AAC7C,MAAM,CAAC,MAAM,cAAc,GAAG,cAAc,CAAC;AAE7C,2EAA2E;AAC3E,mEAAmE;AACnE,+BAA+B;AAC/B,MAAM,CAAC,MAAM,oBAAoB,GAAG,oBAAoB,CAAC;AAEzD,2EAA2E;AAC3E,2EAA2E;AAC3E,6CAA6C;AAC7C,MAAM,CAAC,MAAM,YAAY,GAAG,YAAY,CAAC;AAEzC,2EAA2E;AAC3E,kCAAkC;AAClC,MAAM,CAAC,MAAM,aAAa,GAAG,YAAY,CAAC;AAE1C,0EAA0E;AAC1E,8EAA8E;AAC9E,MAAM,CAAC,MAAM,oBAAoB,GAAG,oBAAoB,CAAC;AAEzD,4EAA4E;AAC5E,2EAA2E;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B,GAAG,iBAAiB,CAAC;AAEnD,+CAA+C;AAC/C,MAAM,CAAC,MAAM,SAAS,GAAG,SAAS,CAAC;AAEnC,wEAAwE;AACxE,+CAA+C;AAC/C,MAAM,CAAC,MAAM,eAAe,GAAG,eAAe,CAAC;AAE/C,yEAAyE;AACzE,sEAAsE;AACtE,0CAA0C;AAC1C,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,UAAU;IACV,WAAW;IACX,SAAS;IACT,YAAY;IACZ,aAAa;IACb,aAAa;IACb,gBAAgB;CACR,CAAC;AAEX,qEAAqE;AACrE,iFAAiF;AACjF,uEAAuE;AACvE,4EAA4E;AAC5E,qEAAqE;AACrE,qCAAqC;AACrC,MAAM,CAAC,MAAM,YAAY,GAAG,QAAQ,CAAC;AAErC,0EAA0E;AAC1E,wEAAwE;AACxE,wEAAwE;AACxE,4EAA4E;AAC5E,0EAA0E;AAC1E,0EAA0E;AAC1E,iEAAiE;AACjE,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,CAAC;AAEjC,4EAA4E;AAC5E,kEAAkE;AAClE,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC","sourcesContent":["// Every Loadbare 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// --- Landing (docs/reference/data-binding.md) ----------------------------\n// Everything is a query. The server answers every request with response\n// items, one per query, and each carries the query's kind and key. The\n// markup names a query and the columns it shows; it never repeats what the\n// server already declared.\n\n// Names the query whose rows land in an element's content. A nested one\n// begins a new query: what is inside it is that query's.\nexport const ATTR_QUERY = \"lb-query\";\n\n// The column an element shows, read from the nearest ancestor row. On a\n// control the hub sets its value, and gathers it back under this name when\n// the control's request is issued.\nexport const ATTR_COLUMN = \"lb-column\";\n\n// The column that decides whether an element is present: `null` and `false`\n// are off, and every other value is on. It reads from the nearest ancestor\n// row, as ATTR_COLUMN does.\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\n// Stamped by the hub on every element it sets from a column: the value it\n// set, so a stylesheet can select on it and a custom element that is not a\n// control can render it.\nexport const ATTR_COLUMN_VALUE = \"lb-column-value\";\n\n// Stamped by the hub on each live row, and on an element a `row` lands on\n// itself: the row's key. The key column is the query's, declared by the\n// server and carried by every response item.\nexport const ATTR_KEY_VALUE = \"lb-key-value\";\n\n// Stamped by the hub on an element with a row template: how many live rows\n// it holds, so \"no members yet\" is a stylesheet rule rather than a\n// conditional in every widget.\nexport const ATTR_QUERY_ROW_COUNT = \"lb-query-row-count\";\n\n// --- Requests (docs/reference/data-binding.md) --------------------------\n// Names the request an element issues when it commits: a form on submit, a\n// control on change, anything else on click.\nexport const ATTR_REQUEST = \"lb-request\";\n\n// Every request travels as one bubbling event of this name, whoever issued\n// it, so an ancestor may stop it.\nexport const LB_EVENT_NAME = \"lb-request\";\n\n// Stamped on the element that issued a request while its round trip is in\n// flight, alongside aria-busy. A commit on an element carrying it is ignored.\nexport const ATTR_REQUEST_PENDING = \"lb-request-pending\";\n\n// Stamped on the element that issued a request when its round trip failed —\n// a non-2xx response, a thrown application error, or a timeout, all alike.\n// Cleared at the start of that element's next request.\nexport const ATTR_REQUEST_ERROR = \"lb-request-error\";\n\n// --- Reserved names ----------------------------------------------------\n// Loadbare owns every name beginning with this prefix: attribute names, the\n// values of its attributes, query names, request names, the column names of\n// its own queries, custom element names and event names. The server refuses\n// a page that declares a query or a request so named.\nexport const LB_RESERVED_PREFIX = \"lb-\";\n\n// The requests Loadbare provides. Each runs the page's crud declaration for\n// the request's query.\nexport const REQUEST_ROW_INSERT = \"lb-row-insert\";\nexport const REQUEST_ROW_UPDATE = \"lb-row-update\";\nexport const REQUEST_ROW_DELETE = \"lb-row-delete\";\n\nexport const LB_ROW_REQUESTS = [\n REQUEST_ROW_INSERT,\n REQUEST_ROW_UPDATE,\n REQUEST_ROW_DELETE,\n] as const;\n\n// --- Kinds --------------------------------------------------------------\nexport const KIND_ROW = \"row\";\nexport const KIND_ROWS = \"rows\";\n\n// --- The URL (docs/reference/chrome.md) ---------------------------------\n// The query the hub serves: one row, keyed by the path, whose other columns\n// are the query parms.\nexport const URL_QUERY = \"lb-url\";\nexport const URL_COLUMN_PATH = \"lb-path\";\nexport const URL_COLUMN_PAGE_LABEL = \"lb-page-label\";\nexport const URL_COLUMN_PAGE_UNKNOWN = \"lb-page-unknown\";\n\n// On an `<a>`: a plain primary click sets `lb-path` from the `href`.\nexport const ATTR_URL_LINK = \"lb-url-link\";\n\n// On an element with `lb-request`: its update of `lb-url` pushes a history\n// entry instead of replacing one.\nexport const ATTR_URL_PUSH = \"lb-url-push\";\n\n// On a `<dialog>`: the hub calls showModal() when `lb-page-unknown` is true.\nexport const ATTR_URL_UNKNOWN = \"lb-url-unknown\";\n\n// --- Build time (docs/reference/custom-elements.md) ---------------------\n// Marks the element in an element file whose children receive the rest of\n// the custom element's content. An attribute rather than an element because\n// HTML content models discard foreign elements inside <select> and <table>.\nexport const ATTR_EXP_SLOT = \"lb-exp-slot\";\n\n// One name in two positions. In an element file it marks a destination; on a\n// `<template>` in the custom element's content it names the destination\n// that template is for, and the template's content moves into it.\nexport const ATTR_EXP_TEMPLATE = \"lb-exp-template\";\n\n// A page ships as <template lb-page=\"<stub>\">.\nexport const ATTR_PAGE = \"lb-page\";\n\n// Stamped by the builder beside ATTR_PAGE: the text content of the page\n// file's `<title>`, which the builder removes.\nexport const ATTR_PAGE_TITLE = \"lb-page-title\";\n\n// The attributes a developer writes. The builder refuses any other `lb-`\n// attribute in markup: the rest are stamps, written by the hub or the\n// builder and never by hand or by script.\nexport const DEVELOPER_ATTRIBUTES = [\n ATTR_QUERY,\n ATTR_COLUMN,\n ATTR_SHOW,\n ATTR_REQUEST,\n ATTR_URL_LINK,\n ATTR_URL_PUSH,\n ATTR_URL_UNKNOWN,\n] as const;\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// --- Wire --------------------------------------------------------------\n// One path, one method: everything the hub asks of the server is a POST\n// below this path. The page's stub follows it, and the query string the\n// browser is showing rides after that verbatim, so `/accounts?acct=23` asks\n// as `POST /lb/accounts?acct=23` and the server always knows what URL the\n// browser is showing. Navigation is therefore the only GET an application\n// serves, 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"]}
|