@kayjs/kay 1.105.0 → 1.106.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/dist/eslint.js +435 -120
- package/editors/zed/extension.toml +2 -2
- package/llms/action-protection.md +1 -1
- package/llms/actions-from-islands.md +2 -2
- package/llms/actions.md +22 -19
- package/llms/analytics.md +1 -1
- package/llms/api-from-islands.md +1 -1
- package/llms/api-routes.md +6 -6
- package/llms/check-and-tools.md +1 -1
- package/llms/code-lints.md +2 -2
- package/llms/compiler-api.md +1 -1
- package/llms/component-libraries.md +1 -0
- package/llms/content-cms.md +1 -1
- package/llms/content-markdown-to-caching.md +1 -1
- package/llms/content-preview.md +2 -2
- package/llms/content.md +21 -21
- package/llms/deprecated-lints-1-105-libraries.md +2 -0
- package/llms/deprecated-lints-1-105.md +3 -3
- package/llms/deprecated-lints.md +3 -2
- package/llms/dev-tool.md +2 -2
- package/llms/environment.md +22 -22
- package/llms/files.md +5 -5
- package/llms/islands-state-to-ids.md +2 -1
- package/llms/local-collections.md +2 -2
- package/llms/mcp.md +2 -1
- package/llms/navigation-from-code.md +1 -1
- package/llms/notifications.md +4 -2
- package/llms/project.md +1 -1
- package/llms/rate-limits.md +1 -1
- package/llms/recipes.md +16 -16
- package/llms/rooms.md +4 -4
- package/llms/routing-endpoints-and-base.md +1 -1
- package/llms/routing.md +5 -5
- package/llms/schemas.md +10 -5
- package/llms/server.md +7 -7
- package/llms/site.md +9 -9
- package/llms/sitemap-search-fonts.md +2 -0
- package/llms/styles-and-assets.md +2 -1
- package/llms/templates-elements-slots-snippets.md +2 -2
- package/llms/testing-browser.md +20 -0
- package/llms/testing.md +1 -1
- package/llms/upgrading-1-105-config.md +2 -2
- package/llms/upgrading.md +18 -3
- package/llms/whats-new-archive.md +35 -66
- package/llms/whats-new.md +34 -28
- package/llms.txt +1 -1
- package/package.json +15 -11
- package/src/add.ts +1 -1
- package/src/build/class-table.ts +2 -2
- package/src/build/client.ts +7 -6
- package/src/build/plugin.ts +14 -11
- package/src/build/styles.ts +3 -3
- package/src/build/transform.ts +3 -1
- package/src/build/ui-layers.ts +30 -0
- package/src/build/ui.ts +108 -11
- package/src/build/variants.ts +119 -43
- package/src/build/worker-bundle.ts +6 -0
- package/src/check/boot.ts +22 -1
- package/src/check/call-result.ts +242 -0
- package/src/check/config-objects.ts +17 -2
- package/src/check/diagnose.ts +22 -0
- package/src/check/handler-events.ts +149 -0
- package/src/check/index.ts +6 -2
- package/src/check/link-flag-tests.ts +130 -0
- package/src/check/project.ts +4 -3
- package/src/check/refusal-calls.ts +2 -2
- package/src/check/regroup.ts +5 -3
- package/src/check/renamed-packages.ts +58 -14
- package/src/check/schema-builders.ts +256 -0
- package/src/check/secret-keys.ts +15 -2
- package/src/check/shadow-types.ts +2 -0
- package/src/check/template-hints.ts +1 -1
- package/src/check/tool-labels.ts +11 -9
- package/src/check/ui-types.ts +4 -3
- package/src/check/ui.ts +14 -11
- package/src/commands/env-declare.ts +18 -6
- package/src/commands/routes.ts +1 -1
- package/src/compiler/a11y.ts +8 -1
- package/src/compiler/ast.ts +1 -1
- package/src/compiler/bound-props.ts +1 -1
- package/src/compiler/codegen.ts +6 -6
- package/src/compiler/deprecated-lints-1-106.ts +14 -0
- package/src/compiler/deprecated-lints.ts +10 -5
- package/src/compiler/deprecated-typed-lints.ts +23 -0
- package/src/compiler/dom-here.ts +72 -0
- package/src/compiler/dom.ts +23 -23
- package/src/compiler/fence-checks.ts +12 -11
- package/src/compiler/field-described.ts +2 -2
- package/src/compiler/helper-imports.ts +1 -1
- package/src/compiler/html-fields.ts +92 -0
- package/src/compiler/html-initial.ts +5 -3
- package/src/compiler/html.ts +14 -31
- package/src/compiler/index.ts +3 -1
- package/src/compiler/items.ts +5 -5
- package/src/compiler/link-flags.ts +6 -5
- package/src/compiler/lints.ts +12 -12
- package/src/compiler/rest-omits.ts +15 -0
- package/src/config-loader.ts +10 -2
- package/src/config-resolve.ts +3 -1
- package/src/config-shape.ts +2 -2
- package/src/config.ts +20 -4
- package/src/content/markdown.ts +2 -3
- package/src/generate-resource.ts +9 -9
- package/src/generate.ts +1 -1
- package/src/mcp/guards.ts +1 -1
- package/src/mcp/tools.ts +1 -1
- package/src/migrate/content.ts +61 -55
- package/src/runtime/action-shared.ts +2 -2
- package/src/runtime/action.ts +6 -2
- package/src/runtime/form-types.ts +99 -0
- package/src/runtime/form.ts +22 -7
- package/src/runtime/html.ts +36 -5
- package/src/runtime/markdown-autolink.ts +69 -0
- package/src/runtime/markdown-render.client.ts +39 -3
- package/src/runtime/markdown.client.ts +6 -3
- package/src/runtime/markdown.server.ts +6 -3
- package/src/runtime/markdown.ts +125 -1
- package/src/runtime/navigate-api.ts +10 -5
- package/src/runtime/persist.ts +7 -7
- package/src/runtime/query-param.ts +1 -1
- package/src/runtime/reactive.ts +14 -0
- package/src/runtime/sanitize.ts +3 -1
- package/src/runtime/schema-record.ts +31 -0
- package/src/runtime/schema.client.ts +1 -4
- package/src/runtime/schema.ts +321 -26
- package/src/runtime/swap-focus.ts +59 -11
- package/src/server/action-module.ts +16 -0
- package/src/server/actions.ts +6 -14
- package/src/server/api-modules.ts +1 -1
- package/src/server/api.ts +13 -1
- package/src/server/app-stages.ts +23 -18
- package/src/server/dev-ui.ts +2 -2
- package/src/server/env-state.ts +1 -1
- package/src/server/env.ts +11 -3
- package/src/server/favicon.ts +47 -1
- package/src/server/image-metadata-bmff.ts +1 -1
- package/src/server/kept-pages.ts +3 -3
- package/src/server/library.ts +2 -0
- package/src/server/mcp.ts +13 -12
- package/src/server/notifications.ts +4 -2
- package/src/server/offline.ts +24 -7
- package/src/server/push-settings.ts +16 -2
- package/src/server/push.ts +12 -4
- package/src/server/query.ts +13 -6
- package/src/server/render.ts +1 -1
- package/src/server/scope.ts +20 -13
- package/src/server/signals.ts +4 -4
- package/src/template-ws.ts +1 -1
- package/src/test/a11y-dom.ts +70 -0
- package/src/test/html-snapshot.ts +103 -0
- package/src/test/index.ts +2 -1
- package/src/test/mount.ts +8 -1
- package/src/test/page-checks.ts +12 -0
- package/src/test/screenshot-match.ts +2 -2
- package/src/test/shared-modules.ts +27 -5
- package/src/test/site-types.ts +5 -1
- package/types/build/class-table.d.ts +1 -1
- package/types/build/class-table.d.ts.map +1 -1
- package/types/build/client.d.ts.map +1 -1
- package/types/build/plugin.d.ts.map +1 -1
- package/types/build/transform.d.ts +1 -0
- package/types/build/transform.d.ts.map +1 -1
- package/types/build/ui-layers.d.ts +5 -0
- package/types/build/ui-layers.d.ts.map +1 -0
- package/types/build/ui.d.ts +7 -0
- package/types/build/ui.d.ts.map +1 -1
- package/types/build/variants.d.ts +1 -1
- package/types/build/variants.d.ts.map +1 -1
- package/types/build/worker-bundle.d.ts +1 -0
- package/types/build/worker-bundle.d.ts.map +1 -1
- package/types/check/boot.d.ts.map +1 -1
- package/types/check/call-result.d.ts +7 -0
- package/types/check/call-result.d.ts.map +1 -0
- package/types/check/config-objects.d.ts.map +1 -1
- package/types/check/diagnose.d.ts.map +1 -1
- package/types/check/handler-events.d.ts +9 -0
- package/types/check/handler-events.d.ts.map +1 -0
- package/types/check/index.d.ts +1 -0
- package/types/check/index.d.ts.map +1 -1
- package/types/check/link-flag-tests.d.ts +4 -0
- package/types/check/link-flag-tests.d.ts.map +1 -0
- package/types/check/project.d.ts.map +1 -1
- package/types/check/regroup.d.ts +1 -1
- package/types/check/regroup.d.ts.map +1 -1
- package/types/check/renamed-packages.d.ts +1 -0
- package/types/check/renamed-packages.d.ts.map +1 -1
- package/types/check/schema-builders.d.ts +3 -0
- package/types/check/schema-builders.d.ts.map +1 -0
- package/types/check/secret-keys.d.ts.map +1 -1
- package/types/check/shadow-types.d.ts.map +1 -1
- package/types/check/template-hints.d.ts +1 -0
- package/types/check/template-hints.d.ts.map +1 -1
- package/types/check/tool-labels.d.ts.map +1 -1
- package/types/check/ui-types.d.ts.map +1 -1
- package/types/check/ui.d.ts.map +1 -1
- package/types/commands/env-declare.d.ts.map +1 -1
- package/types/compiler/a11y.d.ts.map +1 -1
- package/types/compiler/bound-props.d.ts +1 -0
- package/types/compiler/bound-props.d.ts.map +1 -1
- package/types/compiler/codegen.d.ts +1 -0
- package/types/compiler/codegen.d.ts.map +1 -1
- package/types/compiler/deprecated-lints-1-106.d.ts +12 -0
- package/types/compiler/deprecated-lints-1-106.d.ts.map +1 -0
- package/types/compiler/deprecated-lints.d.ts +32 -5
- package/types/compiler/deprecated-lints.d.ts.map +1 -1
- package/types/compiler/deprecated-typed-lints.d.ts +21 -0
- package/types/compiler/deprecated-typed-lints.d.ts.map +1 -0
- package/types/compiler/dom-here.d.ts +14 -0
- package/types/compiler/dom-here.d.ts.map +1 -0
- package/types/compiler/dom.d.ts +1 -0
- package/types/compiler/dom.d.ts.map +1 -1
- package/types/compiler/fence-checks.d.ts.map +1 -1
- package/types/compiler/field-described.d.ts +1 -1
- package/types/compiler/field-described.d.ts.map +1 -1
- package/types/compiler/html-fields.d.ts +19 -0
- package/types/compiler/html-fields.d.ts.map +1 -0
- package/types/compiler/html-initial.d.ts +3 -2
- package/types/compiler/html-initial.d.ts.map +1 -1
- package/types/compiler/html.d.ts.map +1 -1
- package/types/compiler/index.d.ts +1 -0
- package/types/compiler/index.d.ts.map +1 -1
- package/types/compiler/items.d.ts +4 -1
- package/types/compiler/items.d.ts.map +1 -1
- package/types/compiler/link-flags.d.ts +6 -0
- package/types/compiler/link-flags.d.ts.map +1 -1
- package/types/compiler/lints.d.ts +44 -17
- package/types/compiler/lints.d.ts.map +1 -1
- package/types/compiler/rest-omits.d.ts +4 -0
- package/types/compiler/rest-omits.d.ts.map +1 -0
- package/types/config-loader.d.ts.map +1 -1
- package/types/config-resolve.d.ts.map +1 -1
- package/types/config.d.ts +15 -2
- package/types/config.d.ts.map +1 -1
- package/types/content/markdown.d.ts.map +1 -1
- package/types/migrate/content.d.ts.map +1 -1
- package/types/runtime/action-shared.d.ts +1 -1
- package/types/runtime/action-shared.d.ts.map +1 -1
- package/types/runtime/action.d.ts +3 -0
- package/types/runtime/action.d.ts.map +1 -1
- package/types/runtime/form-types.d.ts +6 -0
- package/types/runtime/form-types.d.ts.map +1 -0
- package/types/runtime/form.d.ts +3 -1
- package/types/runtime/form.d.ts.map +1 -1
- package/types/runtime/html.d.ts +3 -0
- package/types/runtime/html.d.ts.map +1 -1
- package/types/runtime/markdown-autolink.d.ts +11 -0
- package/types/runtime/markdown-autolink.d.ts.map +1 -0
- package/types/runtime/markdown-render.client.d.ts +2 -1
- package/types/runtime/markdown-render.client.d.ts.map +1 -1
- package/types/runtime/markdown.client.d.ts +3 -1
- package/types/runtime/markdown.client.d.ts.map +1 -1
- package/types/runtime/markdown.d.ts +11 -0
- package/types/runtime/markdown.d.ts.map +1 -1
- package/types/runtime/markdown.server.d.ts +3 -1
- package/types/runtime/markdown.server.d.ts.map +1 -1
- package/types/runtime/navigate-api.d.ts +1 -1
- package/types/runtime/navigate-api.d.ts.map +1 -1
- package/types/runtime/persist.d.ts +2 -2
- package/types/runtime/persist.d.ts.map +1 -1
- package/types/runtime/reactive.d.ts +3 -0
- package/types/runtime/reactive.d.ts.map +1 -1
- package/types/runtime/sanitize.d.ts.map +1 -1
- package/types/runtime/schema-record.d.ts +9 -0
- package/types/runtime/schema-record.d.ts.map +1 -0
- package/types/runtime/schema.client.d.ts.map +1 -1
- package/types/runtime/schema.d.ts +94 -10
- package/types/runtime/schema.d.ts.map +1 -1
- package/types/runtime/swap-focus.d.ts.map +1 -1
- package/types/server/action-module.d.ts +2 -0
- package/types/server/action-module.d.ts.map +1 -0
- package/types/server/actions.d.ts +1 -0
- package/types/server/actions.d.ts.map +1 -1
- package/types/server/api.d.ts.map +1 -1
- package/types/server/app-stages.d.ts +3 -2
- package/types/server/app-stages.d.ts.map +1 -1
- package/types/server/env-state.d.ts.map +1 -1
- package/types/server/env.d.ts +5 -1
- package/types/server/env.d.ts.map +1 -1
- package/types/server/favicon.d.ts +3 -1
- package/types/server/favicon.d.ts.map +1 -1
- package/types/server/kept-pages.d.ts +1 -1
- package/types/server/kept-pages.d.ts.map +1 -1
- package/types/server/library.d.ts +2 -0
- package/types/server/library.d.ts.map +1 -1
- package/types/server/mcp.d.ts +1 -1
- package/types/server/mcp.d.ts.map +1 -1
- package/types/server/notifications.d.ts +2 -1
- package/types/server/notifications.d.ts.map +1 -1
- package/types/server/offline.d.ts.map +1 -1
- package/types/server/push-settings.d.ts +1 -1
- package/types/server/push-settings.d.ts.map +1 -1
- package/types/server/push.d.ts +1 -0
- package/types/server/push.d.ts.map +1 -1
- package/types/server/query.d.ts.map +1 -1
- package/types/server/scope.d.ts +1 -1
- package/types/server/scope.d.ts.map +1 -1
- package/types/test/a11y-dom.d.ts +20 -0
- package/types/test/a11y-dom.d.ts.map +1 -0
- package/types/test/html-snapshot.d.ts +4 -0
- package/types/test/html-snapshot.d.ts.map +1 -0
- package/types/test/index.d.ts.map +1 -1
- package/types/test/mount.d.ts +3 -0
- package/types/test/mount.d.ts.map +1 -1
- package/types/test/page-checks.d.ts +6 -0
- package/types/test/page-checks.d.ts.map +1 -0
- package/types/test/screenshot-match.d.ts +1 -1
- package/types/test/screenshot-match.d.ts.map +1 -1
- package/types/test/shared-modules.d.ts.map +1 -1
- package/types/test/site-types.d.ts +3 -1
- package/types/test/site-types.d.ts.map +1 -1
package/dist/eslint.js
CHANGED
|
@@ -25,13 +25,14 @@ var __esm = (fn, res, err) => () => {
|
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
// package.json
|
|
28
|
-
var version = "1.
|
|
28
|
+
var version = "1.106.0", peerDependencies;
|
|
29
29
|
var init_package = __esm(() => {
|
|
30
30
|
peerDependencies = {
|
|
31
31
|
"@happy-dom/global-registrator": "^20.14.6 || ^21.0.3",
|
|
32
32
|
"@kaynooo/pg-orm": "^7.0.0 || ^8.0.0",
|
|
33
33
|
"@types/bun": "^1.4.4",
|
|
34
34
|
"axe-core": "^4.14.0",
|
|
35
|
+
"happy-dom": "^20.14.6 || ^21.0.3",
|
|
35
36
|
typescript7: "npm:typescript@^7.0.2"
|
|
36
37
|
};
|
|
37
38
|
});
|
|
@@ -378,7 +379,7 @@ function formFieldOf(element, source, inherited) {
|
|
|
378
379
|
field.fill = "content";
|
|
379
380
|
else if (element.name === "select")
|
|
380
381
|
field.fill = attributes.has("multiple") ? undefined : "selected";
|
|
381
|
-
else if (inputType === "checkbox" || inputType === "radio")
|
|
382
|
+
else if (inputType === "checkbox" || inputType === "radio" || type === undefined && attributes.has("checked"))
|
|
382
383
|
field.fill = "checked";
|
|
383
384
|
else if (!UNFILLED_TYPES.has(inputType))
|
|
384
385
|
field.fill = "value";
|
|
@@ -4084,7 +4085,7 @@ function childItems(nodes) {
|
|
|
4084
4085
|
if (part.kind === "element")
|
|
4085
4086
|
element(part);
|
|
4086
4087
|
else if (part.kind === "expression")
|
|
4087
|
-
items.push({ kind: "expression", node: part });
|
|
4088
|
+
items.push({ kind: "expression", node: part, line: node });
|
|
4088
4089
|
else if (part.text !== "")
|
|
4089
4090
|
text(part.text);
|
|
4090
4091
|
}
|
|
@@ -4185,8 +4186,8 @@ function fixedSource(element) {
|
|
|
4185
4186
|
const names = (element.fixed ?? "").split(" ").filter((name) => name !== "");
|
|
4186
4187
|
return names.length === 0 ? "" : `, { ${names.map((name) => `${JSON.stringify(name)}: ""`).join(", ")} }`;
|
|
4187
4188
|
}
|
|
4188
|
-
function ambientHelpers(facts) {
|
|
4189
|
-
return facts.ambientForm ? ["formHere", "formError"] : [];
|
|
4189
|
+
function ambientHelpers(facts, mode) {
|
|
4190
|
+
return [...facts.ambientForm ? ["formHere", "formError"] : [], ...mode === "dom" && facts.snippet && facts.forms.size > 0 ? ["issueScope"] : []];
|
|
4190
4191
|
}
|
|
4191
4192
|
var pendingElements;
|
|
4192
4193
|
var init_items = __esm(() => {
|
|
@@ -8504,7 +8505,7 @@ function dateTypeOf(element, src) {
|
|
|
8504
8505
|
const type = staticAttributeText(element, "type", src)?.toLowerCase();
|
|
8505
8506
|
return type !== undefined && DATE_TYPES.has(type) ? type : undefined;
|
|
8506
8507
|
}
|
|
8507
|
-
function addInitial(b, src, element, values, name, box, separator = " ?? ") {
|
|
8508
|
+
function addInitial(b, src, element, values, name, box, separator = " ?? ", typeVariable) {
|
|
8508
8509
|
if (!values)
|
|
8509
8510
|
return;
|
|
8510
8511
|
b.add(`${separator}${helperName(box ? "formInitialChecked" : "formInitial")}((`).addSource(values).add(`), ${JSON.stringify(name)}`);
|
|
@@ -8515,10 +8516,12 @@ function addInitial(b, src, element, values, name, box, separator = " ?? ") {
|
|
|
8515
8516
|
const type = dateTypeOf(element, src);
|
|
8516
8517
|
if (type !== undefined)
|
|
8517
8518
|
b.add(`, ${JSON.stringify(type)}`);
|
|
8519
|
+
else if (typeVariable !== undefined)
|
|
8520
|
+
b.add(`, ${typeVariable}`);
|
|
8518
8521
|
}
|
|
8519
8522
|
b.add(")");
|
|
8520
8523
|
}
|
|
8521
|
-
function addFilled(b, src, element, { filled, fieldArguments, own, box, values, name }) {
|
|
8524
|
+
function addFilled(b, src, element, { filled, fieldArguments, own, box, values, name, schemaType }) {
|
|
8522
8525
|
b.add(`${helperName("attribute")}(${JSON.stringify(filled)}, ${filled === "value" ? "KayFormValue" : "KayFormChecked"}`);
|
|
8523
8526
|
fieldArguments();
|
|
8524
8527
|
if (filled === "checked") {
|
|
@@ -8530,7 +8533,7 @@ function addFilled(b, src, element, { filled, fieldArguments, own, box, values,
|
|
|
8530
8533
|
b.add(" ?? ");
|
|
8531
8534
|
own();
|
|
8532
8535
|
}
|
|
8533
|
-
addInitial(b, src, element, values, name, filled === "checked" ? { value: box } : undefined);
|
|
8536
|
+
addInitial(b, src, element, values, name, filled === "checked" ? { value: box } : undefined, " ?? ", schemaType ? "KaySchemaType" : undefined);
|
|
8534
8537
|
b.add(")");
|
|
8535
8538
|
}
|
|
8536
8539
|
function addBoxValue(b, src, element, { value }) {
|
|
@@ -8594,6 +8597,58 @@ var init_dom_fields = __esm(() => {
|
|
|
8594
8597
|
init_plan();
|
|
8595
8598
|
});
|
|
8596
8599
|
|
|
8600
|
+
// src/compiler/dom-here.ts
|
|
8601
|
+
class FormHere {
|
|
8602
|
+
names = ["KayHere"];
|
|
8603
|
+
snippets = new Set;
|
|
8604
|
+
count = 0;
|
|
8605
|
+
get current() {
|
|
8606
|
+
return this.names.at(-1);
|
|
8607
|
+
}
|
|
8608
|
+
declared(snippet, src) {
|
|
8609
|
+
this.snippets.add(src.slice(snippet.name.start, snippet.name.end));
|
|
8610
|
+
return snippet;
|
|
8611
|
+
}
|
|
8612
|
+
target(b, form) {
|
|
8613
|
+
if (form)
|
|
8614
|
+
b.add("(").addSource(form).add(")");
|
|
8615
|
+
else
|
|
8616
|
+
b.add(this.current);
|
|
8617
|
+
}
|
|
8618
|
+
scope(b, form) {
|
|
8619
|
+
if (!form)
|
|
8620
|
+
return false;
|
|
8621
|
+
b.add(`${helperName("issueScope")}(`);
|
|
8622
|
+
this.target(b, form);
|
|
8623
|
+
b.add(", () => ");
|
|
8624
|
+
return true;
|
|
8625
|
+
}
|
|
8626
|
+
expression(b, expression, src, form) {
|
|
8627
|
+
const scoped = form !== undefined && src.slice(expression.start, expression.end).match(CALLED)?.some((name) => this.snippets.has(name)) === true;
|
|
8628
|
+
if (scoped)
|
|
8629
|
+
this.scope(b, form);
|
|
8630
|
+
b.add("(").addSource(expression).add(scoped ? "))" : ")");
|
|
8631
|
+
}
|
|
8632
|
+
within(b, nodes, forms, children) {
|
|
8633
|
+
if (!someNode(nodes, (line) => (line.kind === "error" || line.kind === "pending") && !forms.has(line))) {
|
|
8634
|
+
children();
|
|
8635
|
+
return;
|
|
8636
|
+
}
|
|
8637
|
+
const own = `KayHere${++this.count}`;
|
|
8638
|
+
b.add(`(() => { const ${own} = ${helperName("formHere")}() ?? ${this.current}; return `);
|
|
8639
|
+
this.names.push(own);
|
|
8640
|
+
children();
|
|
8641
|
+
this.names.pop();
|
|
8642
|
+
b.add("; })()");
|
|
8643
|
+
}
|
|
8644
|
+
}
|
|
8645
|
+
var CALLED;
|
|
8646
|
+
var init_dom_here = __esm(() => {
|
|
8647
|
+
init_ast();
|
|
8648
|
+
init_markup();
|
|
8649
|
+
CALLED = /[a-z_$][\w$]*(?=\s*\()/gi;
|
|
8650
|
+
});
|
|
8651
|
+
|
|
8597
8652
|
// src/compiler/style-arguments.ts
|
|
8598
8653
|
function addStyleArguments(b, attribute) {
|
|
8599
8654
|
if (attribute.expression)
|
|
@@ -8631,7 +8686,7 @@ function awaitAlertTail(alert, target) {
|
|
|
8631
8686
|
var HTML_HELPERS, DOM_HELPERS, APART;
|
|
8632
8687
|
var init_helper_imports = __esm(() => {
|
|
8633
8688
|
init_markup();
|
|
8634
|
-
HTML_HELPERS = ["attempt", "attribute", "checkedMarkup", "child", "className", "component", "componentClass", "currentPage", "dynamic", "element", "errorParagraph", "fieldDescribed", "formConstraints", "formKey", "head", "html", "imageAttributes", "innerMarkup", "leadingNewline", "linkHref", "localHref", "loop", "memo", "merge", "nonEmptyAttribute", "omit", "outsideLink", "partClass", "partHanded", "partsClass", "raw", "rawData", "rawTyped", "refillOptions", "selectOptions", "serverIsland", "show", "spreadAttributes", "spreadWith", "style", "untrack"];
|
|
8689
|
+
HTML_HELPERS = ["attempt", "attribute", "checkedMarkup", "child", "className", "component", "componentClass", "currentPage", "dynamic", "element", "errorParagraph", "fieldDescribed", "formConstraints", "formKey", "formOptions", "formType", "head", "html", "imageAttributes", "innerMarkup", "leadingNewline", "linkHref", "localHref", "loop", "memo", "merge", "nonEmptyAttribute", "omit", "outsideLink", "partClass", "partHanded", "partsClass", "raw", "rawData", "rawTyped", "refillOptions", "schemaFill", "selectOptions", "serverIsland", "show", "spreadAttributes", "spreadWith", "style", "untrack"];
|
|
8635
8690
|
DOM_HELPERS = ["append", "attribute", "branches", "checkedMarkup", "choose", "close", "component", "componentClass", "effect", "errorParagraph", "fragment", "holdSubmits", "insert", "listen", "listenSubmit", "listenSubmitWith", "listenWith", "markers", "memo", "merge", "omit", "outside", "part", "partClass", "partHanded", "partsClass", "property", "ref", "setClass", "setStyle", "spreadAttributes", "spreadWith", "template", "text", "transition", "untrack"];
|
|
8636
8691
|
APART = [["kay/dom-loop", ["loop", "rowKey"]], ["kay/dom-await", ["awaited"]], ["kay/dom-try", ["attempt"]], ["kay/dom-spread", ["dynamic", "spread"]], ["kay/dom-image", ["image"]], ["kay/pending", ["pendingCall"]]];
|
|
8637
8692
|
});
|
|
@@ -8642,6 +8697,7 @@ var init_dom = __esm(() => {
|
|
|
8642
8697
|
init_outside();
|
|
8643
8698
|
init_ast();
|
|
8644
8699
|
init_dom_fields();
|
|
8700
|
+
init_dom_here();
|
|
8645
8701
|
init_event_modifiers();
|
|
8646
8702
|
init_expression();
|
|
8647
8703
|
init_items();
|
|
@@ -8662,6 +8718,7 @@ var init_dom = __esm(() => {
|
|
|
8662
8718
|
constBlocks = 0;
|
|
8663
8719
|
catches = [];
|
|
8664
8720
|
writesLinks = false;
|
|
8721
|
+
here = new FormHere;
|
|
8665
8722
|
constructor(b, src, facts, ownMarkup, errors, located, classTable, awaitAlert = "") {
|
|
8666
8723
|
super(b, src, facts, ownMarkup);
|
|
8667
8724
|
this.errors = errors;
|
|
@@ -8722,7 +8779,9 @@ var init_dom = __esm(() => {
|
|
|
8722
8779
|
const at = `${element}, ${start}, ${end}`;
|
|
8723
8780
|
switch (item.kind) {
|
|
8724
8781
|
case "expression":
|
|
8725
|
-
b.add(`KayInsert(${at}, () =>
|
|
8782
|
+
b.add(`KayInsert(${at}, () => `);
|
|
8783
|
+
this.here.expression(b, item.node.expression, this.src, this.formOf(item.line));
|
|
8784
|
+
b.add(");");
|
|
8726
8785
|
break;
|
|
8727
8786
|
case "component":
|
|
8728
8787
|
b.wrap(item.node, () => {
|
|
@@ -8772,22 +8831,20 @@ var init_dom = __esm(() => {
|
|
|
8772
8831
|
b.wrap(item.node, () => this.try(item.node, at));
|
|
8773
8832
|
break;
|
|
8774
8833
|
case "error":
|
|
8775
|
-
|
|
8834
|
+
b.wrap(item.node, () => {
|
|
8776
8835
|
const target = this.formOf(item.node);
|
|
8777
|
-
b.
|
|
8778
|
-
|
|
8779
|
-
});
|
|
8780
|
-
}
|
|
8781
|
-
b.add(`{ const KayHere = ${helperName("formHere")}(); KayInsert(${at}, () => ${helperName("errorParagraph")}(${helperName("formError")}(KayHere, ${JSON.stringify(item.node.name)}), ${errorParagraphArguments(item.node, this.src, undefined)})); }`);
|
|
8782
|
-
}
|
|
8836
|
+
b.add(`KayInsert(${at}, () => ${helperName("errorParagraph")}(${helperName("formError")}(`);
|
|
8837
|
+
this.here.target(b, target);
|
|
8838
|
+
b.add(`, ${JSON.stringify(item.node.name)}), ${errorParagraphArguments(item.node, this.src, target ? this.errors?.lines.get(item.node) : undefined)}));`);
|
|
8839
|
+
});
|
|
8783
8840
|
break;
|
|
8784
8841
|
}
|
|
8785
8842
|
}
|
|
8786
8843
|
declaration(item) {
|
|
8787
|
-
if (item.kind === "
|
|
8788
|
-
this.snippetDeclaration(item.node);
|
|
8789
|
-
else
|
|
8844
|
+
if (item.kind === "const")
|
|
8790
8845
|
this.b.wrap(item.node, () => constDeclaration(this.b, item.node, this.src, helperName("memo")));
|
|
8846
|
+
else
|
|
8847
|
+
this.snippetDeclaration(this.here.declared(item.node, this.src));
|
|
8791
8848
|
}
|
|
8792
8849
|
if(node, at) {
|
|
8793
8850
|
const { b } = this;
|
|
@@ -8948,10 +9005,9 @@ var init_dom = __esm(() => {
|
|
|
8948
9005
|
followCalls(pending, node) {
|
|
8949
9006
|
const followed = this.formOf(pending);
|
|
8950
9007
|
return (variable) => {
|
|
8951
|
-
|
|
8952
|
-
|
|
8953
|
-
|
|
8954
|
-
this.b.add(`{ const KayHere = ${helperName("formHere")}(); KayEffect(() => ${helperName("pendingCall")}(${variable(node)}, KayHere)); }`);
|
|
9008
|
+
this.b.add(`KayEffect(() => ${helperName("pendingCall")}(${variable(node)}, `);
|
|
9009
|
+
this.here.target(this.b, followed);
|
|
9010
|
+
this.b.add("));");
|
|
8955
9011
|
};
|
|
8956
9012
|
}
|
|
8957
9013
|
templateOf(element, node, bindings) {
|
|
@@ -9190,16 +9246,15 @@ var init_dom = __esm(() => {
|
|
|
9190
9246
|
const form = this.formOf(element);
|
|
9191
9247
|
if (holds)
|
|
9192
9248
|
b.add(`(${helperName("holdSubmits")}(), `);
|
|
9193
|
-
|
|
9194
|
-
b.add(`${helperName(this.scoping)}((`).addSource(form).add("), () => ");
|
|
9249
|
+
const scoped = this.here.scope(b, form);
|
|
9195
9250
|
b.add(dynamic ? "KayDynamic(" : "KayComponent(").addSource(element.tag).add(", ");
|
|
9196
9251
|
this.componentProps(element, true);
|
|
9197
9252
|
b.add(holds ? "))" : ")");
|
|
9198
|
-
if (
|
|
9253
|
+
if (scoped)
|
|
9199
9254
|
b.add(")");
|
|
9200
9255
|
}
|
|
9201
9256
|
rendered(nodes) {
|
|
9202
|
-
this.block(nodes);
|
|
9257
|
+
this.here.within(this.b, nodes, this.facts.forms, () => this.block(nodes));
|
|
9203
9258
|
}
|
|
9204
9259
|
skips(element, name) {
|
|
9205
9260
|
return marksServerIsland(element, name, this.src);
|
|
@@ -9272,9 +9327,9 @@ var init_head = __esm(() => {
|
|
|
9272
9327
|
});
|
|
9273
9328
|
|
|
9274
9329
|
// src/compiler/field-described.ts
|
|
9275
|
-
function addFieldDescribed(b, own, type, aria, refusing) {
|
|
9330
|
+
function addFieldDescribed(b, own, type, aria, refusing, schemaType) {
|
|
9276
9331
|
const expression = (attribute) => attribute?.kind === "value" ? () => b.add("(").addSource(attribute.expression).add(")") : undefined;
|
|
9277
|
-
const typed = type?.kind === "text" ? () => b.add(JSON.stringify(type.text)) : expression(type);
|
|
9332
|
+
const typed = type?.kind === "text" ? () => b.add(JSON.stringify(type.text)) : expression(type) ?? schemaType;
|
|
9278
9333
|
const written = expression(aria?.required) ?? (aria?.required || aria?.unrequirable ? () => b.add("true") : undefined);
|
|
9279
9334
|
const native = expression(aria?.native) ?? (aria?.native ? () => b.add("true") : undefined);
|
|
9280
9335
|
const refused = refusing && (() => {
|
|
@@ -9306,6 +9361,66 @@ var init_field_described = __esm(() => {
|
|
|
9306
9361
|
init_markup();
|
|
9307
9362
|
});
|
|
9308
9363
|
|
|
9364
|
+
// src/compiler/html-fields.ts
|
|
9365
|
+
function addClassAttribute(b, markup, classes, classList) {
|
|
9366
|
+
if (classes?.parts) {
|
|
9367
|
+
const parts = classes;
|
|
9368
|
+
markup.dynamic(() => {
|
|
9369
|
+
b.add(`${helperName("nonEmptyAttribute")}("class", ${helperName("className")}(`);
|
|
9370
|
+
classList(parts);
|
|
9371
|
+
b.add("))");
|
|
9372
|
+
});
|
|
9373
|
+
} else if (classes?.expression) {
|
|
9374
|
+
const { text, expression } = classes;
|
|
9375
|
+
markup.text(' class="');
|
|
9376
|
+
markup.dynamic(() => b.add(`${helperName("className")}([${JSON.stringify(text)}, (`).addSource(expression).add(")])"));
|
|
9377
|
+
markup.text('"');
|
|
9378
|
+
} else if (classes?.pieces) {
|
|
9379
|
+
const { pieces } = classes;
|
|
9380
|
+
markup.text(' class="');
|
|
9381
|
+
markup.dynamic(() => b.add(`${helperName("className")}(${JSON.stringify(pieces)})`));
|
|
9382
|
+
markup.text('"');
|
|
9383
|
+
} else if (classes) {
|
|
9384
|
+
markup.text(` class="${escapeStaticAttribute(classes.text)}"`);
|
|
9385
|
+
}
|
|
9386
|
+
}
|
|
9387
|
+
function addFieldFill(b, src, element, markup, fill, field, typed) {
|
|
9388
|
+
const one = (filled, box = fill.box, schemaType = true) => addFilled(b, src, element, { ...fill, filled, box, own: filled === fill.filled ? fill.own : undefined, schemaType });
|
|
9389
|
+
if (!(typed && field.marked && fill.filled === "value")) {
|
|
9390
|
+
markup.dynamic(() => one(fill.filled, fill.box, false));
|
|
9391
|
+
return;
|
|
9392
|
+
}
|
|
9393
|
+
markup.dynamic(() => {
|
|
9394
|
+
b.add(helperName("schemaFill"));
|
|
9395
|
+
fill.fieldArguments();
|
|
9396
|
+
b.add(", (KaySchemaType) => ");
|
|
9397
|
+
one("value");
|
|
9398
|
+
b.add(", () => ");
|
|
9399
|
+
one("checked", fill.own);
|
|
9400
|
+
if (fill.own) {
|
|
9401
|
+
b.add(` + ${helperName("attribute")}("value", `);
|
|
9402
|
+
fill.own();
|
|
9403
|
+
b.add(")");
|
|
9404
|
+
}
|
|
9405
|
+
b.add(")");
|
|
9406
|
+
});
|
|
9407
|
+
}
|
|
9408
|
+
function schemaTypeCall(b, element, type, field, target) {
|
|
9409
|
+
if (element !== "input" || type !== undefined || !field?.marked || !target)
|
|
9410
|
+
return;
|
|
9411
|
+
return () => void b.add(`${helperName("formType")}((`).addSource(target).add(`), ${JSON.stringify(field.name)})`);
|
|
9412
|
+
}
|
|
9413
|
+
function listsFromSchema(element, children, field) {
|
|
9414
|
+
return element === "select" && children.length === 0 && field?.marked === true;
|
|
9415
|
+
}
|
|
9416
|
+
function addSchemaOptions(b, target, name) {
|
|
9417
|
+
b.add(`${helperName("formOptions")}((`).addSource(target).add(`), ${JSON.stringify(name)})`);
|
|
9418
|
+
}
|
|
9419
|
+
var init_html_fields = __esm(() => {
|
|
9420
|
+
init_html_initial();
|
|
9421
|
+
init_markup();
|
|
9422
|
+
});
|
|
9423
|
+
|
|
9309
9424
|
// src/compiler/html-parts.ts
|
|
9310
9425
|
class Markup {
|
|
9311
9426
|
b;
|
|
@@ -9362,6 +9477,7 @@ var init_html = __esm(() => {
|
|
|
9362
9477
|
init_expression();
|
|
9363
9478
|
init_field_described();
|
|
9364
9479
|
init_form_info();
|
|
9480
|
+
init_html_fields();
|
|
9365
9481
|
init_html_initial();
|
|
9366
9482
|
init_items();
|
|
9367
9483
|
init_markup();
|
|
@@ -9674,33 +9790,15 @@ var init_html = __esm(() => {
|
|
|
9674
9790
|
const describable = fieldAria !== undefined;
|
|
9675
9791
|
let ownDescribed;
|
|
9676
9792
|
let refusing;
|
|
9677
|
-
const
|
|
9793
|
+
const schemaType = schemaTypeCall(b, name, type, field, target);
|
|
9794
|
+
const fieldDescribed = (own, refusing) => addFieldDescribed(b, own, type, fieldAria, refusing, schemaType);
|
|
9678
9795
|
markup.text(`<${name}${element.fixed ?? ""}`);
|
|
9679
9796
|
if (plan.id !== undefined)
|
|
9680
9797
|
markup.text(` id="${escapeStaticAttribute(plan.id)}"`);
|
|
9681
9798
|
const unit = this.options.kept?.groups.get(element.start);
|
|
9682
9799
|
if (unit !== undefined)
|
|
9683
9800
|
markup.text(` data-kay-u="${unit.id}"`);
|
|
9684
|
-
|
|
9685
|
-
const classes = plan.classes;
|
|
9686
|
-
markup.dynamic(() => {
|
|
9687
|
-
b.add(`${helperName("nonEmptyAttribute")}("class", ${helperName("className")}(`);
|
|
9688
|
-
this.classList(classes);
|
|
9689
|
-
b.add("))");
|
|
9690
|
-
});
|
|
9691
|
-
} else if (plan.classes?.expression) {
|
|
9692
|
-
const { text, expression } = plan.classes;
|
|
9693
|
-
markup.text(' class="');
|
|
9694
|
-
markup.dynamic(() => b.add(`${helperName("className")}([${JSON.stringify(text)}, (`).addSource(expression).add(")])"));
|
|
9695
|
-
markup.text('"');
|
|
9696
|
-
} else if (plan.classes?.pieces) {
|
|
9697
|
-
const { pieces } = plan.classes;
|
|
9698
|
-
markup.text(' class="');
|
|
9699
|
-
markup.dynamic(() => b.add(`${helperName("className")}(${JSON.stringify(pieces)})`));
|
|
9700
|
-
markup.text('"');
|
|
9701
|
-
} else if (plan.classes) {
|
|
9702
|
-
markup.text(` class="${escapeStaticAttribute(plan.classes.text)}"`);
|
|
9703
|
-
}
|
|
9801
|
+
addClassAttribute(b, markup, plan.classes, (classes) => this.classList(classes));
|
|
9704
9802
|
for (const attribute of plan.attributes) {
|
|
9705
9803
|
if (attribute.kind === "binding") {
|
|
9706
9804
|
const { binding } = attribute;
|
|
@@ -9812,7 +9910,7 @@ var init_html = __esm(() => {
|
|
|
9812
9910
|
});
|
|
9813
9911
|
}
|
|
9814
9912
|
if (filled)
|
|
9815
|
-
|
|
9913
|
+
addFieldFill(b, this.src, element, markup, { filled, fieldArguments, own: ownFill, box: checkboxValue, values, name: field.name }, field, name === "input" && !this.named(element, "type"));
|
|
9816
9914
|
if (field.invalid) {
|
|
9817
9915
|
refusing = fieldArguments;
|
|
9818
9916
|
markup.dynamic(() => addInvalidAttribute(b, fieldArguments));
|
|
@@ -9872,11 +9970,15 @@ var init_html = __esm(() => {
|
|
|
9872
9970
|
rawText = "raw";
|
|
9873
9971
|
}
|
|
9874
9972
|
const staticContent = field?.fill === "content" && plan.valueText !== undefined ? undefined : plan.staticContent;
|
|
9875
|
-
|
|
9973
|
+
const fromSchema = listsFromSchema(name, children, field);
|
|
9974
|
+
if (field && (fromSchema || children.length > 0 && field.fill === "selected") && target) {
|
|
9876
9975
|
const own = selected;
|
|
9877
9976
|
markup.dynamic(() => {
|
|
9878
9977
|
b.add(`${helperName("refillOptions")}(KayFormValue((`).addSource(target).add(`), ${JSON.stringify(field.name)}), `);
|
|
9879
|
-
|
|
9978
|
+
if (fromSchema)
|
|
9979
|
+
addSchemaOptions(b, target, field.name);
|
|
9980
|
+
else
|
|
9981
|
+
this.markup(children, true);
|
|
9880
9982
|
if (own) {
|
|
9881
9983
|
b.add(", () => ");
|
|
9882
9984
|
own();
|
|
@@ -10570,7 +10672,7 @@ class JsxTemplate {
|
|
|
10570
10672
|
const text = (span) => this.src.slice(span.start, span.end).trim();
|
|
10571
10673
|
const subject = text(node.subject);
|
|
10572
10674
|
const unmatched = this.options.check && !fallback && !TYPED_SUBJECT.test(subject) && node.cases.every((branch) => branch.values.every((value) => UNIT_VALUE.test(text(value))));
|
|
10573
|
-
const called =
|
|
10675
|
+
const called = CALLED2.test(subject);
|
|
10574
10676
|
b.add("(() => { ");
|
|
10575
10677
|
if (unmatched && called)
|
|
10576
10678
|
b.add("const kayMatched = (").addSource(node.subject).add("); switch (kayMatched) { ");
|
|
@@ -11088,7 +11190,7 @@ class JsxTemplate {
|
|
|
11088
11190
|
return this.src.slice(span.start, span.end);
|
|
11089
11191
|
}
|
|
11090
11192
|
}
|
|
11091
|
-
var
|
|
11193
|
+
var CALLED2, TYPED_SUBJECT, UNIT_VALUE, JSX_TEXT_ESCAPES, MARKUP_ATTRIBUTES, EVENT_HANDLER2, PLAIN_PARAMETER;
|
|
11092
11194
|
var init_jsx = __esm(() => {
|
|
11093
11195
|
init_ast();
|
|
11094
11196
|
init_expression();
|
|
@@ -11100,7 +11202,7 @@ var init_jsx = __esm(() => {
|
|
|
11100
11202
|
init_names();
|
|
11101
11203
|
init_plan();
|
|
11102
11204
|
init_validate();
|
|
11103
|
-
|
|
11205
|
+
CALLED2 = /[\w$\])]\s*\(/;
|
|
11104
11206
|
TYPED_SUBJECT = /^(?:typeof\s|true$|false$)/;
|
|
11105
11207
|
UNIT_VALUE = /^(?:'[^'\\]*'|"[^"\\]*"|-?\d[\w.]*|true|false|null|undefined|[A-Z][\w$]*(?:\.[a-z_$][\w$]*)+)$/i;
|
|
11106
11208
|
JSX_TEXT_ESCAPES = /[{}<>]|[ \t]{2,}/g;
|
|
@@ -11491,6 +11593,18 @@ var init_own_markup = __esm(() => {
|
|
|
11491
11593
|
TEXT_ATTRIBUTE = /\bwith\s*\{\s*type\s*:\s*(['"])text\1/;
|
|
11492
11594
|
});
|
|
11493
11595
|
|
|
11596
|
+
// src/compiler/rest-omits.ts
|
|
11597
|
+
function restOmits(props, written, facts) {
|
|
11598
|
+
const owned = facts.parts?.merges === true;
|
|
11599
|
+
const declared = props.bindings.filter((binding) => written?.has(binding.key) ?? true);
|
|
11600
|
+
return [
|
|
11601
|
+
...declared.map((binding) => JSON.stringify(binding.key)),
|
|
11602
|
+
...owned ? ['"class"', '"parts"'] : [],
|
|
11603
|
+
...owned && facts.recipe !== undefined ? [`...${facts.recipe}.variants`] : [],
|
|
11604
|
+
...owned ? Object.keys(facts.ui?.variants ?? {}).map((name) => JSON.stringify(name)) : []
|
|
11605
|
+
];
|
|
11606
|
+
}
|
|
11607
|
+
|
|
11494
11608
|
// src/compiler/slot-types.ts
|
|
11495
11609
|
function slotBlocks(file) {
|
|
11496
11610
|
const blocks = new Map;
|
|
@@ -11687,7 +11801,8 @@ const ${VALUES} = { ${[...this.options.values].map(([name, value]) => `${name}:
|
|
|
11687
11801
|
else if (head && this.kind === "island")
|
|
11688
11802
|
this.emitIslandTitle(head);
|
|
11689
11803
|
this.b.add(`
|
|
11690
|
-
|
|
11804
|
+
${this.mode === "dom" && this.facts.ambientForm ? `const KayHere = ${helperName("formHere")}()
|
|
11805
|
+
` : ""}return `);
|
|
11691
11806
|
this.template(template, errors);
|
|
11692
11807
|
this.exports();
|
|
11693
11808
|
return { builder: this.b, sites: this.sites };
|
|
@@ -11713,7 +11828,7 @@ return `);
|
|
|
11713
11828
|
if (server)
|
|
11714
11829
|
b.add(`import type { ${this.pageContextType()} as KayPageContext, PageData as KayPageData${this.guardValues() !== undefined ? ", GuardValues as KayGuardValues" : ""}${this.declaresQuery() !== undefined ? ", QueryOf as KayQueryOf" : ""}${this.settingType(PRERENDER) !== undefined ? ", PrerenderedContext as KayPrerenderedContext" : ""}${mode === "check" && server.page ? ", PageSettings as KayPageSettings" : ""}${this.actionsTyped ? ", ActionFor as KayActionFor" : ""} } from 'kay'
|
|
11715
11830
|
`);
|
|
11716
|
-
const kayHelpers = [...facts.actionForm ? ["formAction"] : [], ...ambientHelpers(facts)];
|
|
11831
|
+
const kayHelpers = [...facts.actionForm ? ["formAction"] : [], ...ambientHelpers(facts, mode)];
|
|
11717
11832
|
if (this.rootBlocks().length > 0)
|
|
11718
11833
|
kayHelpers.push("fill");
|
|
11719
11834
|
const actions = server?.exportNames.filter((name) => !NOT_ACTIONS.has(name)) ?? [];
|
|
@@ -12143,9 +12258,7 @@ const { `);
|
|
|
12143
12258
|
`);
|
|
12144
12259
|
}
|
|
12145
12260
|
if (props.rest) {
|
|
12146
|
-
const
|
|
12147
|
-
const keys = [...props.bindings.map((binding) => JSON.stringify(binding.key)), ...owned ? ['"class"', '"parts"'] : [], ...owned && this.facts.recipe !== undefined ? [`...${this.facts.recipe}.variants`] : [], ...owned ? Object.keys(this.facts.ui?.variants ?? {}).map((name) => JSON.stringify(name)) : []];
|
|
12148
|
-
b.add("const ").addSource(props.rest).add(` = ${helperName("omit")}(${PROPS}, ${keys.join(", ")});
|
|
12261
|
+
b.add("const ").addSource(props.rest).add(` = ${helperName("omit")}(${PROPS}, ${restOmits(props, this.options.writtenProps, this.facts).join(", ")});
|
|
12149
12262
|
`);
|
|
12150
12263
|
}
|
|
12151
12264
|
if (!this.options.rewrites && props.bindings.length > 0) {
|
|
@@ -12586,6 +12699,34 @@ var init_deprecated_script_fence = __esm(() => {
|
|
|
12586
12699
|
SPELLED_OUT = /^---[ \t]+script\b/;
|
|
12587
12700
|
});
|
|
12588
12701
|
|
|
12702
|
+
// src/runtime/form-types.ts
|
|
12703
|
+
function autocompleteByName(name) {
|
|
12704
|
+
return NAMED_AUTOCOMPLETE.get(name.replace(NAME_SEPARATORS, "").toLowerCase());
|
|
12705
|
+
}
|
|
12706
|
+
var NAMED_AUTOCOMPLETE, NAME_SEPARATORS;
|
|
12707
|
+
var init_form_types = __esm(() => {
|
|
12708
|
+
NAMED_AUTOCOMPLETE = new Map([
|
|
12709
|
+
["firstname", "given-name"],
|
|
12710
|
+
["givenname", "given-name"],
|
|
12711
|
+
["lastname", "family-name"],
|
|
12712
|
+
["familyname", "family-name"],
|
|
12713
|
+
["surname", "family-name"],
|
|
12714
|
+
["username", "username"],
|
|
12715
|
+
["email", "email"],
|
|
12716
|
+
["phone", "tel"],
|
|
12717
|
+
["tel", "tel"],
|
|
12718
|
+
["telephone", "tel"],
|
|
12719
|
+
["zip", "postal-code"],
|
|
12720
|
+
["postalcode", "postal-code"],
|
|
12721
|
+
["postcode", "postal-code"],
|
|
12722
|
+
["currentpassword", "current-password"],
|
|
12723
|
+
["newpassword", "new-password"],
|
|
12724
|
+
["otp", "one-time-code"],
|
|
12725
|
+
["birthday", "bday"]
|
|
12726
|
+
]);
|
|
12727
|
+
NAME_SEPARATORS = /[\s_-]+/g;
|
|
12728
|
+
});
|
|
12729
|
+
|
|
12589
12730
|
// src/runtime/form.ts
|
|
12590
12731
|
function isSecret(name) {
|
|
12591
12732
|
return SECRET_PART.test(name) || (name.match(WORD7) ?? []).some((word) => SECRET_WORDS.has(word.toLowerCase().replace(TRAILING_DIGITS, "")));
|
|
@@ -13152,6 +13293,9 @@ h2 Pricing`
|
|
|
13152
13293
|
});
|
|
13153
13294
|
|
|
13154
13295
|
// src/compiler/a11y.ts
|
|
13296
|
+
function givesAutocomplete(written, field, type) {
|
|
13297
|
+
return written || field !== undefined && (type === "email" || autocompleteByName(field) !== undefined);
|
|
13298
|
+
}
|
|
13155
13299
|
function maskLiterals(code) {
|
|
13156
13300
|
const blank = (part) => part.replace(NOT_LINE_BREAK, " ");
|
|
13157
13301
|
const holes = [];
|
|
@@ -13465,7 +13609,7 @@ import Tooltip from '@kayjs/ui/tooltip.kay'` });
|
|
|
13465
13609
|
if (pointer && !answers.some((name) => has(element, name)))
|
|
13466
13610
|
lint(pointer.name, "mouse-only-event", `\`${text(pointer.name)}\` has no keyboard counterpart on this \`${element.name}\``, { note: "what the pointer reveals or hides is never reached by a keyboard user, whom only focus tells", help: `handle \`${wanted}\` the same way, on an element the keyboard reaches` });
|
|
13467
13611
|
}
|
|
13468
|
-
if (element.name === "input" && type !== undefined && FILLED_TYPES.has(type) && !has(element, "autocomplete"))
|
|
13612
|
+
if (element.name === "input" && type !== undefined && FILLED_TYPES.has(type) && !givesAutocomplete(has(element, "autocomplete"), staticValue(element, "field"), type))
|
|
13469
13613
|
lint(element, "missing-autocomplete", `This \`${type}\` input has no \`autocomplete\``, { note: "a browser or a password manager fills a field from it, which people with motor or memory difficulties rely on", help: type === "email" ? 'write `autocomplete="email"`, or `username`' : 'write `autocomplete="current-password"` or `new-password`' });
|
|
13470
13614
|
const autocomplete = staticValue(element, "autocomplete");
|
|
13471
13615
|
if (autocomplete !== undefined && (element.name === "form" ? !["on", "off"].includes(autocomplete.trim().toLowerCase()) : LABELLED.has(element.name) && !validAutocomplete(autocomplete)))
|
|
@@ -13618,6 +13762,7 @@ function exclusive(a, b) {
|
|
|
13618
13762
|
}
|
|
13619
13763
|
var LABELLED, UNLABELLED_TYPES, NAMING2, HEADING2, UI_IMPORT, TOOLTIP_IMPORT, WHITESPACE_CHAR2, TOOLTIP_NAME, FOCUSABLE, INTERACTIVE, REDUNDANT_ALT, FILENAME_ALT, WHITESPACE15, NOT_LINE_BREAK, DESCRIBING, ROLELESS, UNNAMEABLE, REFERENCES, NAMED_ROLES, GROUP_ROLES, REFRESH_DELAY, FILLED_TYPES, POINTER_IN, FOCUS_IN, POINTER_OUT, FOCUS_OUT, WALKS;
|
|
13620
13764
|
var init_a11y = __esm(() => {
|
|
13765
|
+
init_form_types();
|
|
13621
13766
|
init_a11y_markup();
|
|
13622
13767
|
init_aria();
|
|
13623
13768
|
init_ast();
|
|
@@ -13677,11 +13822,111 @@ export async function members(auth: Auth, org: string) {
|
|
|
13677
13822
|
};
|
|
13678
13823
|
});
|
|
13679
13824
|
|
|
13825
|
+
// src/compiler/deprecated-lints-1-106.ts
|
|
13826
|
+
var SCHEMA_BUILDERS;
|
|
13827
|
+
var init_deprecated_lints_1_106 = __esm(() => {
|
|
13828
|
+
SCHEMA_BUILDERS = {
|
|
13829
|
+
"deprecated-schema-builders": {
|
|
13830
|
+
level: "warn",
|
|
13831
|
+
group: "deprecated",
|
|
13832
|
+
since: "1.106",
|
|
13833
|
+
site: true,
|
|
13834
|
+
summary: "The PascalCase builders of `s` before 1.106, which kay's own lowercase builders replace, each taking the same field options (`optional`, `default`, `error`, `label`, `description`, `example`) and short names for the rest: `s.String` is `s.string` (`min`, `max`), `s.Integer` `s.int`, `s.Number` and `s.Numeric` `s.number`, `s.Boolean` and `s.BooleanString` `s.boolean`, `s.Array` `s.list`, `s.UnionEnum` and `s.UnionKeys` `s.enum`, and `s.Date`, `s.Literal`, `s.Union`, `s.Object`, `s.File`, `s.Files`, `s.Secret` and `s.Public` their lowercase names; `s.Optional(field)` is `optional: true` in the options of the field; an `s.Object({ ... })` that is the schema of an `action` or a `defineEnv` is the record of fields alone; and a file size written `'2m'` is `'2mb'`. The old names work until 2.0. Found on the `s` a file imports from `kay`, in the TypeScript files and the fences of `.kay` files. The fix renames the builder and the options that changed; an `s.Optional` around anything but one of these builders, such as a helper of `kay/content`, is left as it is. A lowercase `s.object` refuses a key its shape lacks where kay reads the schema itself (collection frontmatter, `defineEnv`), where `s.Object` let it by: write `{ extra: 'strip' }` where the old way is wanted. A query, the headers and the cookies of a request carry keys no schema names, so their unknown keys are dropped whatever the schema says.",
|
|
13835
|
+
wrong: `--- server
|
|
13836
|
+
import { action, s } from 'kay'
|
|
13837
|
+
|
|
13838
|
+
export const add = action(s.Object({ title: s.String({ maxLength: 200 }), note: s.Optional(s.String()) }), ({ title }) => title)
|
|
13839
|
+
---
|
|
13840
|
+
p x`,
|
|
13841
|
+
right: `--- server
|
|
13842
|
+
import { action, s } from 'kay'
|
|
13843
|
+
|
|
13844
|
+
export const add = action({ title: s.string({ max: 200 }), note: s.string({ optional: true }) }, ({ title }) => title)
|
|
13845
|
+
---
|
|
13846
|
+
p x`
|
|
13847
|
+
}
|
|
13848
|
+
};
|
|
13849
|
+
});
|
|
13850
|
+
|
|
13851
|
+
// src/compiler/deprecated-typed-lints.ts
|
|
13852
|
+
var TYPED_DEPRECATIONS;
|
|
13853
|
+
var init_deprecated_typed_lints = __esm(() => {
|
|
13854
|
+
TYPED_DEPRECATIONS = {
|
|
13855
|
+
"deprecated-callback-handler": {
|
|
13856
|
+
level: "deny",
|
|
13857
|
+
group: "deprecated",
|
|
13858
|
+
since: "1.105",
|
|
13859
|
+
typed: true,
|
|
13860
|
+
summary: "A function written for the arguments a kayjs-ui, kayjs-ai or kayjs-cms callback took before 1.105, given to a callback that takes one event object since: `onValueChange={query.set}`, `onCheckedChange={toggle}` with `toggle(on: boolean)` or `onFiles={upload}` with `upload(files: File[])`. Found where the type check refuses the function and the component comes from a `@kayjs` library; the fix writes `event => query.set(event.value)`, passing the fields the handler took, first ones first, and is applied where its parameter is no object (a parameter typed as an object may be written for the event already, so that fix is offered). A handler that is not a plain name, such as an arrow function, is reported with no fix. The old form fails the type check, and would receive the event where it took the value, so the level is `deny` until it is rewritten.",
|
|
13861
|
+
wrong: `---
|
|
13862
|
+
import { signal } from 'kay'
|
|
13863
|
+
import Checkbox from '@kayjs/ui/checkbox.kay'
|
|
13864
|
+
|
|
13865
|
+
const on = signal(false)
|
|
13866
|
+
|
|
13867
|
+
function toggle(next: boolean) {
|
|
13868
|
+
on.set(next)
|
|
13869
|
+
}
|
|
13870
|
+
---
|
|
13871
|
+
Checkbox(label="Notify" checked={on()} onChange={toggle})`,
|
|
13872
|
+
right: `---
|
|
13873
|
+
import { signal } from 'kay'
|
|
13874
|
+
import Checkbox from '@kayjs/ui/checkbox.kay'
|
|
13875
|
+
|
|
13876
|
+
const on = signal(false)
|
|
13877
|
+
|
|
13878
|
+
function toggle(next: boolean) {
|
|
13879
|
+
on.set(next)
|
|
13880
|
+
}
|
|
13881
|
+
---
|
|
13882
|
+
Checkbox(label="Notify" checked={on()} onChange={event => toggle(event.checked)})`
|
|
13883
|
+
},
|
|
13884
|
+
"deprecated-call-result": {
|
|
13885
|
+
level: "deny",
|
|
13886
|
+
group: "deprecated",
|
|
13887
|
+
since: "1.105",
|
|
13888
|
+
typed: true,
|
|
13889
|
+
summary: "An island's call read as its data, `const list = await call(notes, '/')` then `list.items`, or `await add(input)` then `.id`, which resolved with the data before 1.105 and answers a `CallResult`, `{ ok: true, data }` or `{ ok: false, error }`, since. Found where the type check refuses a field of a `CallResult`, in a `.kay` script or a module. The fix writes `.orThrow()` after the call, which resolves with the data and throws a refusal as the call did; it is applied where the call is written on an imported name and nothing reads `ok`, `data` or `error` of the answer, and offered otherwise. The old form fails the type check, so the level is `deny`.",
|
|
13890
|
+
wrong: `---
|
|
13891
|
+
import { call, signal } from 'kay'
|
|
13892
|
+
import notes from '../api/notes'
|
|
13893
|
+
|
|
13894
|
+
const names = signal('')
|
|
13895
|
+
|
|
13896
|
+
async function load() {
|
|
13897
|
+
const list = await call(notes, '/')
|
|
13898
|
+
|
|
13899
|
+
names = list.items.join(', ')
|
|
13900
|
+
}
|
|
13901
|
+
---
|
|
13902
|
+
button(onClick={load}) Load
|
|
13903
|
+
p {names()}`,
|
|
13904
|
+
right: `---
|
|
13905
|
+
import { call, signal } from 'kay'
|
|
13906
|
+
import notes from '../api/notes'
|
|
13907
|
+
|
|
13908
|
+
const names = signal('')
|
|
13909
|
+
|
|
13910
|
+
async function load() {
|
|
13911
|
+
const list = await call(notes, '/').orThrow()
|
|
13912
|
+
|
|
13913
|
+
names = list.items.join(', ')
|
|
13914
|
+
}
|
|
13915
|
+
---
|
|
13916
|
+
button(onClick={load}) Load
|
|
13917
|
+
p {names()}`
|
|
13918
|
+
}
|
|
13919
|
+
};
|
|
13920
|
+
});
|
|
13921
|
+
|
|
13680
13922
|
// src/compiler/deprecated-lints.ts
|
|
13681
13923
|
var DEPRECATED_LINTS;
|
|
13682
13924
|
var init_deprecated_lints = __esm(() => {
|
|
13683
13925
|
init_deprecated_auth_lints();
|
|
13926
|
+
init_deprecated_lints_1_106();
|
|
13927
|
+
init_deprecated_typed_lints();
|
|
13684
13928
|
DEPRECATED_LINTS = {
|
|
13929
|
+
...SCHEMA_BUILDERS,
|
|
13685
13930
|
"deprecated-source-readers": {
|
|
13686
13931
|
level: "warn",
|
|
13687
13932
|
group: "deprecated",
|
|
@@ -13849,7 +14094,7 @@ p x`
|
|
|
13849
14094
|
group: "deprecated",
|
|
13850
14095
|
since: "1.104",
|
|
13851
14096
|
site: true,
|
|
13852
|
-
summary: "A package of kay under the `@kaynooo` scope, `@kayjs` since 1.104: `@kaynooo/kayjs` is `@kayjs/kay`, and `@kaynooo/kayjs-ui`, `-auth`, `-mail`, `-cms` and `-ai` are `@kayjs/ui`, `@kayjs/auth`, `@kayjs/mail`, `@kayjs/cms` and `@kayjs/ai`. The old names stop at 1.103, which stays installable, so an app on them installs and checks as before until it moves; this lint goes in 1.107. Found
|
|
14097
|
+
summary: "A package of kay under the `@kaynooo` scope, `@kayjs` since 1.104: `@kaynooo/kayjs` is `@kayjs/kay`, and `@kaynooo/kayjs-ui`, `-auth`, `-mail`, `-cms` and `-ai` are `@kayjs/ui`, `@kayjs/auth`, `@kayjs/mail`, `@kayjs/cms` and `@kayjs/ai`. The old names stop at 1.103, which stays installable, so an app on them installs and checks as before until it moves; this lint goes in 1.107. Found where a name is an `import` or `export ... from` specifier, a `require()`, `import()` or `mock.module()` argument or a config key (a quoted name keyed to anything but a package name or a version, as `librarySettings`) of the project's TypeScript and `.kay` files, in the `@import` and `@plugin` paths of its CSS, and in its package.json and tsconfig files; a name in a comment or any other string, as data a tool reads or a table of renames, is left alone. The fix writes the new name; a package.json that lists the new name already is reported with a fix that is not safe, and `kay upgrade` does the whole move, package.json and install included.",
|
|
13853
14098
|
wrong: `---
|
|
13854
14099
|
import Button from '@kaynooo/kayjs-ui/button.kay'
|
|
13855
14100
|
---
|
|
@@ -13933,7 +14178,7 @@ Card(server defer)`
|
|
|
13933
14178
|
level: "warn",
|
|
13934
14179
|
group: "deprecated",
|
|
13935
14180
|
since: "1.105",
|
|
13936
|
-
summary: '`data-keep-scroll`, `data-no-transition` and `data-no-prefetch`, named as the options of `navigate()` since 1.105: `data-scroll="keep"` (`"top"` for a plain scroll), `data-transition="false"` and `data-prefetch="false"`, typed on every element. The old names work until 1.108. Found on any element and on a component call that forwards them to its link. The fix writes the new attribute, a static `data-keep-scroll="false"` becoming `data-scroll="top"` and a dynamic `data-keep-scroll` being renamed with its value; a dynamic `data-no-transition` or `data-no-prefetch` is reported with no fix, as the old name was set by being present.',
|
|
14181
|
+
summary: '`data-keep-scroll`, `data-no-transition` and `data-no-prefetch`, named as the options of `navigate()` since 1.105: `data-scroll="keep"` (`"top"` for a plain scroll), `data-transition="false"` and `data-prefetch="false"`, typed on every element. The old names work until 1.108. Found on any element and on a component call that forwards them to its link. The fix writes the new attribute, a static `data-keep-scroll="false"` becoming `data-scroll="top"` and a dynamic `data-keep-scroll` being renamed with its value; a dynamic `data-no-transition` or `data-no-prefetch` is reported with no fix, as the old name was set by being present. The app\'s test files (`*.test.*`, `*.spec.*`) are checked too: a selector `[data-keep-scroll]` is written `[data-scroll=keep]` by the fix, an attribute read by name (`getAttribute(\'data-keep-scroll\')`) has a fix that is not safe, a read of `dataset.keepScroll` (and `noTransition`, `noPrefetch`) has one too, and a write of it and any other string naming an old flag have none.',
|
|
13937
14182
|
wrong: `nav(data-keep-scroll)
|
|
13938
14183
|
a(href="/tabs/a" data-no-prefetch) A`,
|
|
13939
14184
|
right: `nav(data-scroll="keep")
|
|
@@ -14049,6 +14294,7 @@ SignedIn(require="admin")
|
|
|
14049
14294
|
a(href="/admin") Admin`
|
|
14050
14295
|
},
|
|
14051
14296
|
...AUTH_LINTS,
|
|
14297
|
+
...TYPED_DEPRECATIONS,
|
|
14052
14298
|
"deprecated-ui-callbacks": {
|
|
14053
14299
|
level: "warn",
|
|
14054
14300
|
group: "deprecated",
|
|
@@ -14459,7 +14705,7 @@ export default { client: { search: true, offline: true } }`
|
|
|
14459
14705
|
group: "deprecated",
|
|
14460
14706
|
since: "1.105",
|
|
14461
14707
|
site: true,
|
|
14462
|
-
summary: "The keys `images`, `fonts`, `favicon`, `manifest` and `publicCache` of kay.config.ts, written in `assets` since 1.105, and `observe`, `health`, `metrics` and `jobs`, written in `ops`: `assets: { images, fonts, favicon, manifest, publicCache }`, `ops: { observe, health, metrics, jobs }`. They work until 1.108. Found in the object kay.config.ts exports
|
|
14708
|
+
summary: "The keys `images`, `fonts`, `favicon`, `manifest` and `publicCache` of kay.config.ts, written in `assets` since 1.105, and `observe`, `health`, `metrics` and `jobs`, written in `ops`: `assets: { images, fonts, favicon, manifest, publicCache }`, `ops: { observe, health, metrics, jobs }`. They work until 1.108. Found in the object kay.config.ts exports, in the `config` of `pages()` and `testSite()` and in the `config` of an extension a file types `KayExtension`, which takes the same keys. The fix moves the keys into their group as written, unless the object spreads, holds a computed key or has the group already.",
|
|
14463
14709
|
wrong: `// kay.config.ts
|
|
14464
14710
|
export default { images: { widths: [640] }, health: false }`,
|
|
14465
14711
|
right: `// kay.config.ts
|
|
@@ -14492,7 +14738,7 @@ export default { endpoints: { mcp: '/tools', health: '/up' }, mcp: {}, health: {
|
|
|
14492
14738
|
group: "deprecated",
|
|
14493
14739
|
since: "1.105",
|
|
14494
14740
|
site: true,
|
|
14495
|
-
summary: "The secrets of kay.config.ts in one shape since 1.105, each `string | { env } | { file }`: `mcp.key` is `mcp.token`, and `proxy.key`, a header name, is `{ header, secret? }`, so `proxy: { key: { header: 'x-upstream-key' } }`; the `mcpKey` and `proxyKey` options of `testSite()` are the `token` and the `secret` of its `config`. They work until 1.108. Found in the object kay.config.ts exports and in the `config` of `pages()` and `testSite()`. The fix renames `mcp.key` (a `key: false` and an `mcp` that spreads or has a `token` are reported with no fix) and wraps the header of `proxy.key`; the options of `testSite()` are reported with no fix.",
|
|
14741
|
+
summary: "The secrets of kay.config.ts in one shape since 1.105, each `string | { env } | { file }`: `mcp.key` is `mcp.token`, and `proxy.key`, a header name, is `{ header, secret? }`, so `proxy: { key: { header: 'x-upstream-key' } }`; the `mcpKey` and `proxyKey` options of `testSite()` are the `token` and the `secret` of its `config`. They work until 1.108. Found in the object kay.config.ts exports and in the `config` of `pages()` and `testSite()`. The fix renames `mcp.key` (a `key: false` and an `mcp` that spreads or has a `token` are reported with no fix) and wraps the header of `proxy.key`; the options of `testSite()` move into its `config`, `mcpKey` always and `proxyKey` where the app's config names the header, and are reported with no fix beside a `config` already written.",
|
|
14496
14742
|
wrong: `// kay.config.ts
|
|
14497
14743
|
export default { mcp: { key: true }, proxy: { key: 'x-upstream-key' } }`,
|
|
14498
14744
|
right: `// kay.config.ts
|
|
@@ -14624,7 +14870,7 @@ export default guard(async (ctx) => {
|
|
|
14624
14870
|
group: "deprecated",
|
|
14625
14871
|
since: "1.105",
|
|
14626
14872
|
site: true,
|
|
14627
|
-
summary: "`deny(status, 'message', data)` of a guard, a page, an action and an endpoint, `deny(status, { message, errors, data })` since 1.105: a refusal takes one object in every place, as `refuse(status, { message, errors, data })` does, so `errors` puts a message on a field and the text is no longer an argument beside the data. An action answers `deny(status, { data, errors })` as `ctx.fail
|
|
14873
|
+
summary: "`deny(status, 'message', data)` of a guard, a page, an action and an endpoint, `deny(status, { message, errors, data })` since 1.105: a refusal takes one object in every place, as `refuse(status, { message, errors, data })` does, so `errors` puts a message on a field and the text is no longer an argument beside the data. An action answers `deny(status, { message, data, errors })` as `ctx.fail` did, the page again or an `ActionError`, so its text form, which stopped with plain text, becomes the form's message after the fix. The text form works until 1.108. Found on a call of `deny`, bare or read off a name, with a literal status from 400 to 599 and a text second argument, in the TypeScript files and `.kay` files of the project. The fix writes the object, unless a comment sits between the arguments or a `data` is given, which an action answers as a failure, not plain text.",
|
|
14628
14874
|
wrong: `// src/routes/_guard.ts
|
|
14629
14875
|
import { guard } from 'kay'
|
|
14630
14876
|
|
|
@@ -14884,7 +15130,7 @@ function linkFlags(file) {
|
|
|
14884
15130
|
if (at === undefined)
|
|
14885
15131
|
continue;
|
|
14886
15132
|
const name = file.source.slice(at.start, at.end);
|
|
14887
|
-
const old =
|
|
15133
|
+
const old = OLD_LINK_FLAGS[name];
|
|
14888
15134
|
if (old !== undefined) {
|
|
14889
15135
|
found.push(oldFlag(file.source, attribute, at, name, old));
|
|
14890
15136
|
continue;
|
|
@@ -14892,7 +15138,7 @@ function linkFlags(file) {
|
|
|
14892
15138
|
const meant = name.startsWith("data-") && !FLAGS.has(name) ? nearest(name) : undefined;
|
|
14893
15139
|
if (meant === undefined)
|
|
14894
15140
|
continue;
|
|
14895
|
-
const renamed =
|
|
15141
|
+
const renamed = OLD_LINK_FLAGS[meant];
|
|
14896
15142
|
const to = renamed === undefined ? meant : `${renamed.name}="${renamed.value}"`;
|
|
14897
15143
|
const fixes = renamed !== undefined && attribute.kind !== "boolean" ? [] : [{ title: `Write \`${to}\``, safe: false, edits: [{ ...at, text: to }] }];
|
|
14898
15144
|
found.push({ ...at, code: "unknown-link-flag", message: `\`${name}\` is no navigation flag of a link`, note: "a link is followed with `data-scroll`, `data-transition`, `data-prefetch` and `data-reload`, and this name does nothing", help: `did you mean \`${to}\`?`, fixes, checkOnly: true });
|
|
@@ -14909,7 +15155,7 @@ function oldFlag(source, attribute, at, name, old) {
|
|
|
14909
15155
|
const end = attribute.kind === "static" ? attribute.value.end + (`"'`.includes(source[attribute.value.end] ?? "") ? 1 : 0) : at.end;
|
|
14910
15156
|
return { ...base, fixes: [{ title: `Write \`${old.name}="${written}"\``, safe: true, edits: [{ start: at.start, end, text: `${old.name}="${written}"` }] }] };
|
|
14911
15157
|
}
|
|
14912
|
-
var LINK_LINTS, FLAGS,
|
|
15158
|
+
var LINK_LINTS, FLAGS, OLD_LINK_FLAGS, NEARBY;
|
|
14913
15159
|
var init_link_flags = __esm(() => {
|
|
14914
15160
|
init_aria();
|
|
14915
15161
|
init_ast();
|
|
@@ -14923,12 +15169,12 @@ var init_link_flags = __esm(() => {
|
|
|
14923
15169
|
}
|
|
14924
15170
|
};
|
|
14925
15171
|
FLAGS = new Set(["data-scroll", "data-transition", "data-prefetch", "data-reload"]);
|
|
14926
|
-
|
|
15172
|
+
OLD_LINK_FLAGS = {
|
|
14927
15173
|
"data-keep-scroll": { name: "data-scroll", value: "keep", off: "top" },
|
|
14928
15174
|
"data-no-transition": { name: "data-transition", value: "false" },
|
|
14929
15175
|
"data-no-prefetch": { name: "data-prefetch", value: "false" }
|
|
14930
15176
|
};
|
|
14931
|
-
NEARBY = [...FLAGS, ...Object.keys(
|
|
15177
|
+
NEARBY = [...FLAGS, ...Object.keys(OLD_LINK_FLAGS)];
|
|
14932
15178
|
});
|
|
14933
15179
|
|
|
14934
15180
|
// src/compiler/loop-lints.ts
|
|
@@ -16009,14 +16255,14 @@ label
|
|
|
16009
16255
|
wrong: `--- server
|
|
16010
16256
|
import { action, s } from 'kay'
|
|
16011
16257
|
|
|
16012
|
-
export const add = action(s.
|
|
16258
|
+
export const add = action(s.object({ title: s.string() }), async ({ title }) => create(title))
|
|
16013
16259
|
---
|
|
16014
16260
|
form(action={add})
|
|
16015
16261
|
input(name="title")`,
|
|
16016
16262
|
right: `--- server
|
|
16017
16263
|
import { action, s } from 'kay'
|
|
16018
16264
|
|
|
16019
|
-
export const add = action(s.
|
|
16265
|
+
export const add = action(s.object({ title: s.string({ max: 200 }) }), async ({ title }) => create(title))
|
|
16020
16266
|
---
|
|
16021
16267
|
form(action={add})
|
|
16022
16268
|
input(name="title")`
|
|
@@ -16042,14 +16288,14 @@ p {theme.length}`
|
|
|
16042
16288
|
import { ask } from '@kayjs/ai'
|
|
16043
16289
|
import { action, s } from 'kay'
|
|
16044
16290
|
|
|
16045
|
-
export const reply = action(s.
|
|
16291
|
+
export const reply = action(s.object({ messages: s.list(s.string()) }), async ({ messages }) => ask(messages))
|
|
16046
16292
|
---
|
|
16047
16293
|
p x`,
|
|
16048
16294
|
right: `--- server
|
|
16049
16295
|
import { ask } from '@kayjs/ai'
|
|
16050
16296
|
import { action, s } from 'kay'
|
|
16051
16297
|
|
|
16052
|
-
export const reply = action(s.
|
|
16298
|
+
export const reply = action(s.object({ messages: s.list(s.string()) }), ({ messages }) => ask(messages))
|
|
16053
16299
|
---
|
|
16054
16300
|
p x`
|
|
16055
16301
|
},
|
|
@@ -16058,7 +16304,7 @@ p x`
|
|
|
16058
16304
|
group: "code",
|
|
16059
16305
|
summary: "A `ctx.fail(...)` statement in an action's handler (or `fail(...)` destructured from the context) that is not returned: `fail` returns the failure the action answers with, where `deny`, `notFound` and `redirect` throw, so the statement does nothing and the handler carries on. An arrow function with an expression body already returns, and a nested function is left alone. The fix prepends `return`. Found in `.kay` fences and `.ts` modules alike.",
|
|
16060
16306
|
wrong: `--- server
|
|
16061
|
-
export const rename = action(s.
|
|
16307
|
+
export const rename = action(s.object({ name: s.string() }), ({ name }, ctx) => {
|
|
16062
16308
|
if (name === 'admin')
|
|
16063
16309
|
ctx.fail(409, 'That name is taken')
|
|
16064
16310
|
|
|
@@ -16067,7 +16313,7 @@ export const rename = action(s.Object({ name: s.String() }), ({ name }, ctx) =>
|
|
|
16067
16313
|
---
|
|
16068
16314
|
p x`,
|
|
16069
16315
|
right: `--- server
|
|
16070
|
-
export const rename = action(s.
|
|
16316
|
+
export const rename = action(s.object({ name: s.string() }), ({ name }, ctx) => {
|
|
16071
16317
|
if (name === 'admin')
|
|
16072
16318
|
return ctx.fail(409, 'That name is taken')
|
|
16073
16319
|
|
|
@@ -16081,11 +16327,11 @@ p x`
|
|
|
16081
16327
|
group: "forms",
|
|
16082
16328
|
summary: "A call to `password.register`, `password.requestReset`, `magicLink.request` or `password.signIn` on an auth (a receiver named `auth`, or ending in `auth`), with no `captcha` option, while no `captcha: false` is written in the same file or in an `authCore` (`createAuth` before 1.91) call of the project (`kay check` reads every module): kayjs-auth asks a proof of work by default, so such a call answers `{ ok: false, error: 'captcha' }` until the form carries the challenge. Put `input(type=\"hidden\" name=\"captcha\" data-kay-work={await auth.captcha.challenge('register')})` in the form (action `'reset'`, `'magic-link'` or `'sign-in'` for the others), read the field in the action and pass it as `{ captcha: input.captcha }`. Found in `.kay` fences and `.ts` modules alike.",
|
|
16083
16329
|
wrong: `--- server
|
|
16084
|
-
export const reset = action(s.
|
|
16330
|
+
export const reset = action(s.object({ email: s.string() }), ({ email }, ctx) => ctx.locals.auth.password.requestReset(email))
|
|
16085
16331
|
---
|
|
16086
16332
|
p x`,
|
|
16087
16333
|
right: `--- server
|
|
16088
|
-
export const reset = action(s.
|
|
16334
|
+
export const reset = action(s.object({ email: s.string(), captcha: s.string() }), ({ email, captcha }, ctx) => ctx.locals.auth.password.requestReset(email, { captcha }))
|
|
16089
16335
|
---
|
|
16090
16336
|
p x`
|
|
16091
16337
|
},
|
|
@@ -16265,9 +16511,9 @@ a(href="/users" title="Hello {name}") Profile`,
|
|
|
16265
16511
|
site: true,
|
|
16266
16512
|
summary: "With `mcp`, an action that sets `tool` and a `honeypot`, `minTime` or `proofOfWork`, with no `_guard.ts` covering it: an agent calls it without the form those protections ask of a person, so anonymous callers can spam it. A guard, or a `rateLimit` with `tool` alone, keeps it in hand.",
|
|
16267
16513
|
wrong: `// kay.config.ts sets mcp: true
|
|
16268
|
-
export const subscribe = action(s.
|
|
16514
|
+
export const subscribe = action(s.object({ email: s.string() }), save, { tool: true, protect: { honeypot: 'website' } })`,
|
|
16269
16515
|
right: `// src/routes/_guard.ts covers it, or the action keeps tool and drops the honeypot
|
|
16270
|
-
export const subscribe = action(s.
|
|
16516
|
+
export const subscribe = action(s.object({ email: s.string() }), save, { tool: true, protect: { rateLimit: { max: 5, window: '1m' } } })`
|
|
16271
16517
|
},
|
|
16272
16518
|
"external-redirect": {
|
|
16273
16519
|
level: "warn",
|
|
@@ -16404,8 +16650,8 @@ button(onClick={() => open.set(true)}) Log`
|
|
|
16404
16650
|
group: "code",
|
|
16405
16651
|
site: true,
|
|
16406
16652
|
summary: "An API route `.ws()` with a `body` and no `response`, written with an object literal of options and no spread: an island's `socket()` receives its messages as `unknown`, so `last()` and `on()` need a cast. Add `response: chats.response` when it sends through `rooms()`, or a `response` schema; a route only other clients read can allow the lint.",
|
|
16407
|
-
wrong: "export default api().ws('/', { body: s.
|
|
16408
|
-
right: "export default api().ws('/', { body: s.
|
|
16653
|
+
wrong: "export default api().ws('/', { body: s.object({ text: s.string() }), message(ws, { text }) { chats.publish('main', { text }) } })",
|
|
16654
|
+
right: "export default api().ws('/', { body: s.object({ text: s.string() }), response: chats.response, message(ws, { text }) { chats.publish('main', { text }) } })"
|
|
16409
16655
|
},
|
|
16410
16656
|
"unsized-image": {
|
|
16411
16657
|
level: "warn",
|
|
@@ -16839,12 +17085,12 @@ function lineEnd(source, end) {
|
|
|
16839
17085
|
return at !== -1 && source[end + at] === `
|
|
16840
17086
|
` ? end + at + 1 : end;
|
|
16841
17087
|
}
|
|
16842
|
-
function maxLengthEdit(call, options) {
|
|
17088
|
+
function maxLengthEdit(call, options, key) {
|
|
16843
17089
|
if (options === undefined)
|
|
16844
|
-
return { at: call.end - 1, text: `{
|
|
17090
|
+
return { at: call.end - 1, text: `{ ${key}: ${SUGGESTED_MAX_LENGTH} }` };
|
|
16845
17091
|
if (options.type === "ObjectExpression" && options.properties.length === 0)
|
|
16846
|
-
return { at: options.start + 1, text: `
|
|
16847
|
-
return { at: options.properties[0].start, text:
|
|
17092
|
+
return { at: options.start + 1, text: ` ${key}: ${SUGGESTED_MAX_LENGTH} ` };
|
|
17093
|
+
return { at: options.properties[0].start, text: `${key}: ${SUGGESTED_MAX_LENGTH}, ` };
|
|
16848
17094
|
}
|
|
16849
17095
|
function isBoundedPattern(source) {
|
|
16850
17096
|
if (!source.startsWith("^") || !source.endsWith("$") || source.endsWith("\\$"))
|
|
@@ -16881,7 +17127,7 @@ function isShortField(field) {
|
|
|
16881
17127
|
}
|
|
16882
17128
|
function unboundedFields(server) {
|
|
16883
17129
|
const fence = server?.fence;
|
|
16884
|
-
if (!fence?.code.includes("String"))
|
|
17130
|
+
if (!fence?.code.includes("String") && !fence?.code.includes("string"))
|
|
16885
17131
|
return [];
|
|
16886
17132
|
const diagnostics = [];
|
|
16887
17133
|
const optional = optionalParts();
|
|
@@ -16891,17 +17137,18 @@ function unboundedFields(server) {
|
|
|
16891
17137
|
schemaStrings(node.arguments[0], undefined, (call, field) => {
|
|
16892
17138
|
const options = call.arguments[0];
|
|
16893
17139
|
const known = options === undefined || options.type === "ObjectExpression" && options.properties.every((property) => property.type !== "SpreadElement");
|
|
16894
|
-
if (!known || options?.type === "ObjectExpression" && options.properties.some((property) => property.type !== "SpreadElement" && (propertyKey2(property) === "maxLength" || isBoundedByValue(property))) || field === undefined || isSecret(field) || !isShortField(field))
|
|
17140
|
+
if (!known || options?.type === "ObjectExpression" && options.properties.some((property) => property.type !== "SpreadElement" && (propertyKey2(property) === "maxLength" || propertyKey2(property) === "max" || isBoundedByValue(property))) || field === undefined || isSecret(field) || !isShortField(field))
|
|
16895
17141
|
return;
|
|
16896
|
-
const
|
|
17142
|
+
const lowercase = call.callee.type === "MemberExpression" && call.callee.property.type === "Identifier" && call.callee.property.name === "string";
|
|
17143
|
+
const edit = maxLengthEdit(call, options, lowercase ? "max" : "maxLength");
|
|
16897
17144
|
const at = fence.offset + edit.at;
|
|
16898
17145
|
diagnostics.push({
|
|
16899
17146
|
...fence.shift(call.callee),
|
|
16900
17147
|
code: "unbounded-string",
|
|
16901
|
-
message: `The string field ${field} has no maxLength of its own`,
|
|
17148
|
+
message: `The string field ${field} has no ${lowercase ? "max" : "maxLength"} of its own`,
|
|
16902
17149
|
note: "it takes the default bound of 10,000 characters, which is a lot for a value of its kind",
|
|
16903
17150
|
help: "give it a tighter one",
|
|
16904
|
-
fixes: [{ title: `Give it a maxLength of ${SUGGESTED_MAX_LENGTH}`, edits: [{ start: at, end: at, text: edit.text }] }],
|
|
17151
|
+
fixes: [{ title: `Give it a ${lowercase ? "max" : "maxLength"} of ${SUGGESTED_MAX_LENGTH}`, edits: [{ start: at, end: at, text: edit.text }] }],
|
|
16905
17152
|
checkOnly: true
|
|
16906
17153
|
});
|
|
16907
17154
|
});
|
|
@@ -17007,7 +17254,7 @@ function schemaStrings(node, field, found) {
|
|
|
17007
17254
|
eachNode(node, (inner, parent) => {
|
|
17008
17255
|
if (isPlainProperty(inner))
|
|
17009
17256
|
schemaStrings(inner.value, propertyKey2(inner) ?? field, found);
|
|
17010
|
-
else if (!optional(inner, parent) && inner.type === "CallExpression" && inner.callee.type === "MemberExpression" && inner.callee.property.type === "Identifier" && inner.callee.property.name === "String")
|
|
17257
|
+
else if (!optional(inner, parent) && inner.type === "CallExpression" && inner.callee.type === "MemberExpression" && inner.callee.property.type === "Identifier" && (inner.callee.property.name === "String" || inner.callee.property.name === "string"))
|
|
17011
17258
|
found(inner, field);
|
|
17012
17259
|
return !isPlainProperty(inner);
|
|
17013
17260
|
});
|
|
@@ -17360,10 +17607,11 @@ var init_markdown_task = __esm(() => {
|
|
|
17360
17607
|
});
|
|
17361
17608
|
|
|
17362
17609
|
// src/runtime/markdown.ts
|
|
17363
|
-
var MARKDOWN_KEPT, USER_MARKDOWN, MARKDOWN_OPTIONS;
|
|
17610
|
+
var MARKDOWN_KEPT, USER_MARKDOWN, UNTOUCHED, MARKDOWN_OPTIONS;
|
|
17364
17611
|
var init_markdown = __esm(() => {
|
|
17365
17612
|
MARKDOWN_KEPT = { tags: ["img", "table", "thead", "tbody", "tr", "th", "td"], attributes: { img: ["src", "alt", "title"], th: ["align"], td: ["align"] } };
|
|
17366
|
-
USER_MARKDOWN = { ...MARKDOWN_KEPT, lazyImages: true };
|
|
17613
|
+
USER_MARKDOWN = { ...MARKDOWN_KEPT, attributes: { ...MARKDOWN_KEPT.attributes, code: ["class"] }, lazyImages: true };
|
|
17614
|
+
UNTOUCHED = new Set(["a", "code", "pre"]);
|
|
17367
17615
|
MARKDOWN_OPTIONS = { autolinks: true };
|
|
17368
17616
|
});
|
|
17369
17617
|
|
|
@@ -19092,7 +19340,7 @@ function compileKay(original, filename, options = {}) {
|
|
|
19092
19340
|
const pin = file.pin;
|
|
19093
19341
|
const rawCause = island === undefined ? undefined : islandCause(file, script) ?? browserCause(file, script, live);
|
|
19094
19342
|
const cause = withInteractive(realCause(rawCause, expansion, original), script);
|
|
19095
|
-
const generateOptions = { cause: options.inspect === true && cause !== undefined ? describeCause(cause) : undefined, classTable: options.classTable, classMerge: options.classMerge, awaitAlert: options.awaitAlert, island, client, lives: island === undefined ? undefined : liveBindings(script, options.importedSignals).map((binding) => binding.local), twin, output: options.output, failedCode, hydratable: hydratableServer && (island !== undefined || options.twinBuild === true), moduleId: islandId(filename, options.root), includeServer: options.includeServer, params: options.params, paramTypes: options.paramTypes, outerQueries: options.outerQueries, outerGuards: options.outerGuards, outerSlots: options.outerSlots, layoutFile: basename5(filename) === LAYOUT, component: options.page === false && !routeFile, check: options.check, route: options.check === true && pageFile, pageFile, namedRefresh: options.namedRefresh, insideIsland: options.insideIsland, inspect: options.inspect, inspectSource: expansion ? { text: original, real: (offset) => expansion.real(offset) } : undefined, relocateImport: options.relocateImport, contextModule: options.check === true ? options.contextModule : undefined, ui: options.output === undefined ? undefined : options.ui, uiAdded: options.output === undefined ? options.ui : undefined, errorPage: isErrorPage(basename5(filename)), cardPage: basename5(filename) === CARD_PAGE, special: basename5(filename).startsWith("_") && basename5(filename) !== LAYOUT };
|
|
19343
|
+
const generateOptions = { cause: options.inspect === true && cause !== undefined ? describeCause(cause) : undefined, classTable: options.classTable, classMerge: options.classMerge, awaitAlert: options.awaitAlert, island, client, lives: island === undefined ? undefined : liveBindings(script, options.importedSignals).map((binding) => binding.local), twin, writtenProps: options.writtenProps, output: options.output, failedCode, hydratable: hydratableServer && (island !== undefined || options.twinBuild === true), moduleId: islandId(filename, options.root), includeServer: options.includeServer, params: options.params, paramTypes: options.paramTypes, outerQueries: options.outerQueries, outerGuards: options.outerGuards, outerSlots: options.outerSlots, layoutFile: basename5(filename) === LAYOUT, component: options.page === false && !routeFile, check: options.check, route: options.check === true && pageFile, pageFile, namedRefresh: options.namedRefresh, insideIsland: options.insideIsland, inspect: options.inspect, inspectSource: expansion ? { text: original, real: (offset) => expansion.real(offset) } : undefined, relocateImport: options.relocateImport, contextModule: options.check === true ? options.contextModule : undefined, ui: options.output === undefined ? undefined : options.ui, uiAdded: options.output === undefined ? options.ui : undefined, errorPage: isErrorPage(basename5(filename)), cardPage: basename5(filename) === CARD_PAGE, special: basename5(filename).startsWith("_") && basename5(filename) !== LAYOUT };
|
|
19096
19344
|
const analysis = generate(file, script, server, { ...generateOptions, name: SELF });
|
|
19097
19345
|
const imported = new Map([...script.imports, ...server?.imports ?? []].flatMap((binding) => {
|
|
19098
19346
|
const kind = binding.typeOnly ? undefined : kindOf(options.importedSignals, binding.source, binding.imported);
|
|
@@ -19371,9 +19619,27 @@ var init_object_literal = __esm(() => {
|
|
|
19371
19619
|
WRAPPERS2 = new Set(["TSAsExpression", "TSSatisfiesExpression", "TSNonNullExpression", "TSTypeAssertion"]);
|
|
19372
19620
|
});
|
|
19373
19621
|
|
|
19622
|
+
// src/build/ui-layers.ts
|
|
19623
|
+
import { realpathSync as realpathSync3 } from "node:fs";
|
|
19624
|
+
import { resolve as resolve6 } from "node:path";
|
|
19625
|
+
function rootKey(root) {
|
|
19626
|
+
try {
|
|
19627
|
+
return realpathSync3(root);
|
|
19628
|
+
} catch {
|
|
19629
|
+
return resolve6(root);
|
|
19630
|
+
}
|
|
19631
|
+
}
|
|
19632
|
+
function layerFilesOf(root) {
|
|
19633
|
+
return layerFiles.get(rootKey(root)) ?? [];
|
|
19634
|
+
}
|
|
19635
|
+
var layerFiles;
|
|
19636
|
+
var init_ui_layers = __esm(() => {
|
|
19637
|
+
layerFiles = new Map;
|
|
19638
|
+
});
|
|
19639
|
+
|
|
19374
19640
|
// src/build/ui.ts
|
|
19375
|
-
import { readdirSync, readFileSync as readFileSync7, realpathSync as
|
|
19376
|
-
import { basename as basename6, dirname as dirname7, join as join9 } from "node:path";
|
|
19641
|
+
import { readdirSync, readFileSync as readFileSync7, realpathSync as realpathSync4, statSync as statSync3 } from "node:fs";
|
|
19642
|
+
import { basename as basename6, dirname as dirname7, join as join9, resolve as resolve7 } from "node:path";
|
|
19377
19643
|
function record() {
|
|
19378
19644
|
return Object.create(null);
|
|
19379
19645
|
}
|
|
@@ -19516,16 +19782,19 @@ function isPage(file) {
|
|
|
19516
19782
|
}
|
|
19517
19783
|
function realOf(file) {
|
|
19518
19784
|
try {
|
|
19519
|
-
return
|
|
19785
|
+
return realpathSync4(file);
|
|
19520
19786
|
} catch {
|
|
19521
19787
|
return file;
|
|
19522
19788
|
}
|
|
19523
19789
|
}
|
|
19790
|
+
function baseOf(ui) {
|
|
19791
|
+
return ui.base ?? dirname7(ui.file);
|
|
19792
|
+
}
|
|
19524
19793
|
function nameIndex(ui) {
|
|
19525
19794
|
if (ui.index !== undefined && Date.now() - ui.index.at < INDEX_LIFETIME)
|
|
19526
19795
|
return ui.index;
|
|
19527
19796
|
const app = new Map;
|
|
19528
|
-
appComponents(
|
|
19797
|
+
appComponents(baseOf(ui), app);
|
|
19529
19798
|
ui.index = { at: Date.now(), app, matches: new Map };
|
|
19530
19799
|
return ui.index;
|
|
19531
19800
|
}
|
|
@@ -19536,7 +19805,7 @@ function componentsNamed(ui, name) {
|
|
|
19536
19805
|
return kept;
|
|
19537
19806
|
const found = (index.app.get(name) ?? []).map(realOf);
|
|
19538
19807
|
try {
|
|
19539
|
-
const library =
|
|
19808
|
+
const library = realpathSync4(Bun.resolveSync(`${UI_LIBRARY}/${name.replace(WORD_BOUNDARY, "-").toLowerCase()}.kay`, baseOf(ui)));
|
|
19540
19809
|
if (componentName(library) === name && !found.includes(library))
|
|
19541
19810
|
found.push(library);
|
|
19542
19811
|
} catch {}
|
|
@@ -19553,11 +19822,11 @@ function componentFile(ui, component) {
|
|
|
19553
19822
|
if (component.file !== undefined || !KAY_EXTENSION2.test(component.specifier))
|
|
19554
19823
|
return component.file;
|
|
19555
19824
|
try {
|
|
19556
|
-
component.file =
|
|
19825
|
+
component.file = realpathSync4(Bun.resolveSync(component.specifier, baseOf(ui)));
|
|
19557
19826
|
} catch {}
|
|
19558
19827
|
return component.file;
|
|
19559
19828
|
}
|
|
19560
|
-
function readUi(file) {
|
|
19829
|
+
function readUi(file, base) {
|
|
19561
19830
|
let source;
|
|
19562
19831
|
try {
|
|
19563
19832
|
source = readFileSync7(file, "utf8");
|
|
@@ -19569,7 +19838,7 @@ function readUi(file) {
|
|
|
19569
19838
|
try {
|
|
19570
19839
|
program = parseProgram(source).program;
|
|
19571
19840
|
} catch (error) {
|
|
19572
|
-
return { file, source, components: [], problems: [{ start: 0, end: 0, message: `src/ui.ts does not parse: ${error instanceof Error ? error.message : String(error)}` }] };
|
|
19841
|
+
return { file, source, base, components: [], problems: [{ start: 0, end: 0, message: `src/ui.ts does not parse: ${error instanceof Error ? error.message : String(error)}` }] };
|
|
19573
19842
|
}
|
|
19574
19843
|
const config = exported(program);
|
|
19575
19844
|
const components = [];
|
|
@@ -19582,7 +19851,7 @@ function readUi(file) {
|
|
|
19582
19851
|
components.push(component);
|
|
19583
19852
|
});
|
|
19584
19853
|
}
|
|
19585
|
-
return { file, source, components, problems };
|
|
19854
|
+
return { file, source, base, components, problems };
|
|
19586
19855
|
}
|
|
19587
19856
|
function uiOf(root) {
|
|
19588
19857
|
const file = join9(root, UI_FILE);
|
|
@@ -19599,26 +19868,71 @@ function uiOf(root) {
|
|
|
19599
19868
|
read.set(file, { stamp, ui });
|
|
19600
19869
|
return ui;
|
|
19601
19870
|
}
|
|
19871
|
+
function uiLayersOf(root) {
|
|
19872
|
+
const base = join9(resolve7(root), "src");
|
|
19873
|
+
const found = [];
|
|
19874
|
+
for (const file of layerFilesOf(root)) {
|
|
19875
|
+
const stat = statSync3(file, { throwIfNoEntry: false });
|
|
19876
|
+
const key = `${base}\x00${file}`;
|
|
19877
|
+
if (stat === undefined) {
|
|
19878
|
+
layerReads.delete(key);
|
|
19879
|
+
continue;
|
|
19880
|
+
}
|
|
19881
|
+
const stamp = `${stat.mtimeMs}:${stat.size}`;
|
|
19882
|
+
let kept = layerReads.get(key);
|
|
19883
|
+
if (kept?.stamp !== stamp)
|
|
19884
|
+
layerReads.set(key, kept = { stamp, ui: readUi(file, base) });
|
|
19885
|
+
if (kept.ui !== undefined)
|
|
19886
|
+
found.push(kept.ui);
|
|
19887
|
+
}
|
|
19888
|
+
return found;
|
|
19889
|
+
}
|
|
19890
|
+
function partsOf2(parts) {
|
|
19891
|
+
return typeof parts === "string" ? { root: parts } : { ...parts };
|
|
19892
|
+
}
|
|
19893
|
+
function mergeEntries(under, over) {
|
|
19894
|
+
const merged = {};
|
|
19895
|
+
if (under.parts !== undefined || over.parts !== undefined)
|
|
19896
|
+
merged.parts = { ...partsOf2(under.parts), ...partsOf2(over.parts) };
|
|
19897
|
+
if (under.variants !== undefined || over.variants !== undefined) {
|
|
19898
|
+
const variants = record();
|
|
19899
|
+
for (const source of [under.variants ?? {}, over.variants ?? {}]) {
|
|
19900
|
+
for (const [name, values] of Object.entries(source))
|
|
19901
|
+
variants[name] = Object.assign(record(), variants[name], values);
|
|
19902
|
+
}
|
|
19903
|
+
merged.variants = variants;
|
|
19904
|
+
}
|
|
19905
|
+
return merged;
|
|
19906
|
+
}
|
|
19602
19907
|
function uiEntryOf(root, file) {
|
|
19603
|
-
const
|
|
19604
|
-
|
|
19908
|
+
const app = uiOf(root);
|
|
19909
|
+
const sources = [...uiLayersOf(root), ...app === undefined ? [] : [app]];
|
|
19910
|
+
if (sources.every(({ components }) => components.length === 0))
|
|
19605
19911
|
return;
|
|
19606
19912
|
let real = file;
|
|
19607
19913
|
try {
|
|
19608
|
-
real =
|
|
19914
|
+
real = realpathSync4(file);
|
|
19609
19915
|
} catch {}
|
|
19610
|
-
|
|
19916
|
+
let entry;
|
|
19917
|
+
for (const ui of sources) {
|
|
19918
|
+
const found = ui.components.findLast((component) => componentFile(ui, component) === real)?.entry;
|
|
19919
|
+
if (found !== undefined)
|
|
19920
|
+
entry = entry === undefined ? found : mergeEntries(entry, found);
|
|
19921
|
+
}
|
|
19922
|
+
return entry;
|
|
19611
19923
|
}
|
|
19612
|
-
var UI_FILE = "src/ui.ts", KAY_EXTENSION2, COMPONENT_NAME, WORD_BOUNDARY, UI_LIBRARY = "@kayjs/ui", read, INDEX_LIFETIME = 1000;
|
|
19924
|
+
var UI_FILE = "src/ui.ts", KAY_EXTENSION2, COMPONENT_NAME, WORD_BOUNDARY, UI_LIBRARY = "@kayjs/ui", read, INDEX_LIFETIME = 1000, layerReads;
|
|
19613
19925
|
var init_ui = __esm(() => {
|
|
19614
19926
|
init_compiler();
|
|
19615
19927
|
init_estree();
|
|
19616
19928
|
init_object_literal();
|
|
19617
19929
|
init_parser();
|
|
19930
|
+
init_ui_layers();
|
|
19618
19931
|
KAY_EXTENSION2 = /\.kay$/;
|
|
19619
19932
|
COMPONENT_NAME = /^[A-Z_$][\w$]*$/i;
|
|
19620
19933
|
WORD_BOUNDARY = /(?<=[a-z0-9])(?=[A-Z])/g;
|
|
19621
19934
|
read = new Map;
|
|
19935
|
+
layerReads = new Map;
|
|
19622
19936
|
});
|
|
19623
19937
|
|
|
19624
19938
|
// src/server/bundle.ts
|
|
@@ -19796,7 +20110,7 @@ var init_config_shape = __esm(() => {
|
|
|
19796
20110
|
METRICS = { path: str, token: either(lit(true), SECRET) };
|
|
19797
20111
|
BUDGET = { js: bytes, css: bytes, weight: bytes, grade: oneOf("A", "B", "C", "D", "E", "F", "G") };
|
|
19798
20112
|
FAVICON = { image: str, svg: str };
|
|
19799
|
-
MANIFEST = { shortName: str, themeColor: either(str, bag({ light: str, dark: str })), backgroundColor: str, display: oneOf("fullscreen", "standalone", "minimal-ui", "browser"), orientation: oneOf("any", "natural", "landscape", "landscape-primary", "landscape-secondary", "portrait", "portrait-primary", "portrait-secondary"), startUrl: str, scope: str, maskable: str, shortcuts: list(obj) };
|
|
20113
|
+
MANIFEST = { shortName: str, themeColor: either(str, bag({ light: str, dark: str })), backgroundColor: str, display: oneOf("fullscreen", "standalone", "minimal-ui", "browser"), orientation: oneOf("any", "natural", "landscape", "landscape-primary", "landscape-secondary", "portrait", "portrait-primary", "portrait-secondary"), startUrl: str, scope: str, maskable: str, shortcuts: list(obj), shareTarget: bag({ action: str, files: list(str), params: bag({ title: str, text: str, url: str, files: str }) }) };
|
|
19800
20114
|
MARKDOWN = { highlight: fn, transform: fn, preprocess: fn, containers: bool, footnotes: bool, headingLinks: bool, readingSpeed: num, imageSizes: str };
|
|
19801
20115
|
CARD = { font: bag({ family: str, weight: num }), background: str, color: str, logo: str };
|
|
19802
20116
|
AVIF = either(bool, bag({ quality: num }));
|
|
@@ -19891,6 +20205,7 @@ var init_env_state = __esm(() => {
|
|
|
19891
20205
|
var lightConfigs, implicitPlugins;
|
|
19892
20206
|
var init_config_loader = __esm(() => {
|
|
19893
20207
|
init_manifests();
|
|
20208
|
+
init_ui_layers();
|
|
19894
20209
|
init_errors();
|
|
19895
20210
|
init_config_resolve();
|
|
19896
20211
|
init_config_shape();
|
|
@@ -19968,7 +20283,7 @@ init_package();
|
|
|
19968
20283
|
import { spawnSync } from "node:child_process";
|
|
19969
20284
|
import { existsSync as existsSync6 } from "node:fs";
|
|
19970
20285
|
import { createRequire as createRequire3 } from "node:module";
|
|
19971
|
-
import { dirname as dirname9, join as join12, relative as relative4, resolve as
|
|
20286
|
+
import { dirname as dirname9, join as join12, relative as relative4, resolve as resolve9 } from "node:path";
|
|
19972
20287
|
|
|
19973
20288
|
// src/check/class-words.ts
|
|
19974
20289
|
init_ast();
|
|
@@ -20133,8 +20448,8 @@ init_compiler();
|
|
|
20133
20448
|
init_ast();
|
|
20134
20449
|
init_parser();
|
|
20135
20450
|
init_project();
|
|
20136
|
-
import { existsSync as existsSync5, readdirSync as readdirSync2, readFileSync as readFileSync8, realpathSync as
|
|
20137
|
-
import { basename as basename7, dirname as dirname8, join as join11, relative as relative3, resolve as
|
|
20451
|
+
import { existsSync as existsSync5, readdirSync as readdirSync2, readFileSync as readFileSync8, realpathSync as realpathSync5, statSync as statSync4 } from "node:fs";
|
|
20452
|
+
import { basename as basename7, dirname as dirname8, join as join11, relative as relative3, resolve as resolve8, sep as sep4 } from "node:path";
|
|
20138
20453
|
|
|
20139
20454
|
// src/runtime/params.ts
|
|
20140
20455
|
var INTEGER = /^-?\d+$/;
|
|
@@ -20202,7 +20517,7 @@ function shadowPath(root, file) {
|
|
|
20202
20517
|
function readShadowSettings(root) {
|
|
20203
20518
|
try {
|
|
20204
20519
|
const saved = JSON.parse(readFileSync8(join11(projectPaths(root).types, SHADOW_SETTINGS), "utf8"));
|
|
20205
|
-
return { routesDir:
|
|
20520
|
+
return { routesDir: resolve8(root, saved.routes), mounts: (saved.mounts ?? []).map((mount) => typeof mount === "string" ? { dir: resolve8(root, mount), prefix: "" } : { ...mount, dir: resolve8(root, mount.dir), ...mount.outer !== undefined && { outer: resolve8(root, mount.outer) } }), islandOnly: new Set(saved.islandOnly.map((file) => resolve8(root, file))), publicDir: resolve8(root, saved.public ?? projectPaths(root).public), lints: saved.lints };
|
|
20206
20521
|
} catch {
|
|
20207
20522
|
return { routesDir: projectPaths(root).routes, mounts: [], islandOnly: new Set };
|
|
20208
20523
|
}
|
|
@@ -20217,7 +20532,7 @@ function compileShadow(root, file, source, { routesDir, mounts, insideIsland = f
|
|
|
20217
20532
|
const relocateImport = (specifier) => {
|
|
20218
20533
|
if (!specifier.startsWith("."))
|
|
20219
20534
|
return;
|
|
20220
|
-
const target =
|
|
20535
|
+
const target = resolve8(dirname8(file), specifier);
|
|
20221
20536
|
if (moved)
|
|
20222
20537
|
return relativeSpecifier(shadowDir, KAY_FILE.test(target) ? shadowOf(target).slice(0, -".tsx".length) : target);
|
|
20223
20538
|
if (target.startsWith(root + sep4) || KAY_FILE.test(target) && !file.startsWith(root + sep4))
|
|
@@ -20349,7 +20664,7 @@ function pageRoute(file, routesDir, mounts) {
|
|
|
20349
20664
|
const pagesDir = mounts.find(({ dir }) => file.startsWith(dir + sep4))?.dir ?? routesDir;
|
|
20350
20665
|
if (file.startsWith(pagesDir + sep4))
|
|
20351
20666
|
return routeOf(pagesDir, file);
|
|
20352
|
-
const real = mounts.length > 0 && file.includes(NODE_MODULES) && existsSync5(file) ?
|
|
20667
|
+
const real = mounts.length > 0 && file.includes(NODE_MODULES) && existsSync5(file) ? realpathSync5(file) : file;
|
|
20353
20668
|
const mount = real === file ? undefined : mounts.find(({ dir }) => real.startsWith(dir + sep4));
|
|
20354
20669
|
return mount ? routeOf(mount.dir, real) : undefined;
|
|
20355
20670
|
}
|
|
@@ -20392,7 +20707,7 @@ var processor = {
|
|
|
20392
20707
|
meta: { name: "kay", version },
|
|
20393
20708
|
supportsAutofix: true,
|
|
20394
20709
|
preprocess(text, filename) {
|
|
20395
|
-
const file =
|
|
20710
|
+
const file = resolve9(filename);
|
|
20396
20711
|
const root = projectRootOf(file);
|
|
20397
20712
|
const { shadow } = compileShadow(root, file, text, shadowOptionsFor(readShadowSettings(root), file));
|
|
20398
20713
|
const indented = shadow.bodyLines ?? [];
|