@valancex/common 0.13.0 → 0.15.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/app.d.ts +4 -0
- package/dist/app.js +21 -1
- package/dist/client.d.ts +4 -1
- package/dist/client.js +10 -2
- package/dist/desktop.d.ts +4 -2
- package/dist/desktop.js +2 -1
- package/dist/early-replay.d.ts +57 -0
- package/dist/early-replay.js +75 -0
- package/dist/early.d.ts +8 -0
- package/dist/early.js +30 -0
- package/dist/form.d.ts +165 -0
- package/dist/form.js +388 -0
- package/dist/index.d.ts +97 -4
- package/dist/index.js +64 -0
- package/dist/internal.d.ts +1 -0
- package/dist/internal.js +1 -0
- package/dist/primitives.d.ts +21 -0
- package/dist/primitives.js +792 -56
- package/dist/record.d.ts +4 -0
- package/dist/record.js +14 -0
- package/dist/server.js +2 -1
- package/dist/vocabulary.d.ts +24 -0
- package/dist/vocabulary.js +5 -8
- package/package.json +10 -6
package/dist/record.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type * as Valance from "@valancex/valance";
|
|
2
|
+
import type { Redaction, SessionRecorder } from "@valancex/valance/replay";
|
|
3
|
+
/** A recorder for the page of `program`, posting to the development server's `/__vlx/record`; it writes the last tree when the page is hidden. */
|
|
4
|
+
export declare const recording: (program: Valance.Program, redact?: Redaction) => SessionRecorder;
|
package/dist/record.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { postTo, recorder } from "@valancex/valance/replay";
|
|
2
|
+
/** A recorder for the page of `program`, posting to the development server's `/__vlx/record`; it writes the last tree when the page is hidden. */
|
|
3
|
+
export const recording = (program, redact) => {
|
|
4
|
+
const model = program.model;
|
|
5
|
+
const { root, templates } = program;
|
|
6
|
+
const record = recorder({
|
|
7
|
+
write: postTo("/__vlx/record"),
|
|
8
|
+
warn: (message) => console.warn(`vlx dev --record: ${message}`),
|
|
9
|
+
...(redact === undefined ? {} : { redact }),
|
|
10
|
+
programs: () => ({ root, templates, model: typeof model === "string" ? model : JSON.stringify(model) }),
|
|
11
|
+
});
|
|
12
|
+
addEventListener("pagehide", () => void record.flush());
|
|
13
|
+
return record;
|
|
14
|
+
};
|
package/dist/server.js
CHANGED
|
@@ -2,6 +2,7 @@ import { renderHead } from "@valancex/valance/web/plugin";
|
|
|
2
2
|
import { renderToHtml } from "@valancex/valance/web/server";
|
|
3
3
|
import { Effect } from "effect";
|
|
4
4
|
import { application, stateFor } from "./app.js";
|
|
5
|
+
import { earlyHead } from "./early.js";
|
|
5
6
|
import { plugin } from "./web-app.js";
|
|
6
7
|
import { routes } from "./routes.js";
|
|
7
8
|
export { routes };
|
|
@@ -15,7 +16,7 @@ export const createRenderer = ({ content, program, author }) => {
|
|
|
15
16
|
const boot = safe(JSON.stringify({ state: served.state, built }));
|
|
16
17
|
return {
|
|
17
18
|
status: table.known(pathname) ? 200 : 404,
|
|
18
|
-
html: `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">${renderHead(served.head)}</head><body><div id="app">${served.html}</div><script id="valance-boot" type="application/json">${boot}</script><script type="module" src="${built.script}"></script></body></html>`,
|
|
19
|
+
html: `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">${built.wasm === undefined ? "" : `<link rel="modulepreload" href="${built.script}">`}${earlyHead(built)}${renderHead(served.head)}</head><body><div id="app" data-vlx="starting">${served.html}</div><script id="valance-boot" type="application/json">${boot}</script><script type="module" src="${built.script}"></script></body></html>`,
|
|
19
20
|
};
|
|
20
21
|
};
|
|
21
22
|
};
|
package/dist/vocabulary.d.ts
CHANGED
|
@@ -13,6 +13,30 @@ export interface WebVocabulary {
|
|
|
13
13
|
* one; this is the author-facing rule beside it. An absent prop is not in the render tree, and PORT Web realizes an absent prop as no attribute (or the element's own initial value).
|
|
14
14
|
*/
|
|
15
15
|
readonly optional?: Readonly<Record<string, ReadonlyArray<string>>>;
|
|
16
|
+
/**
|
|
17
|
+
* What each tag's props and events are, as a specification states them: the type of a prop and whether a use must write it, which the table alone cannot say. Where present it settles the manifest
|
|
18
|
+
* entry's props and events (the table still says how they are realized); `optional` then applies to what it does not cover.
|
|
19
|
+
*/
|
|
20
|
+
/** Tags that were renamed, old to new: a template that writes the old one is told the new one. */
|
|
21
|
+
readonly renamed?: Readonly<Record<string, string>>;
|
|
22
|
+
/** Props that were renamed, by tag, old to new: a template that writes the old one is told the new one. */
|
|
23
|
+
readonly renamedProps?: Readonly<Record<string, Readonly<Record<string, string>>>>;
|
|
24
|
+
readonly rules?: {
|
|
25
|
+
readonly named: ReadonlyArray<string>;
|
|
26
|
+
/** The tags that are a modal layer: none is inside another (`nested-modal`). */
|
|
27
|
+
readonly modal?: ReadonlyArray<string>;
|
|
28
|
+
readonly only: Readonly<Record<string, ReadonlyArray<string>>>;
|
|
29
|
+
readonly within: Readonly<Record<string, ReadonlyArray<string>>>;
|
|
30
|
+
};
|
|
31
|
+
readonly declared?: Readonly<Record<string, {
|
|
32
|
+
readonly props: Readonly<Record<string, {
|
|
33
|
+
readonly type: Readonly<Record<string, unknown>>;
|
|
34
|
+
readonly required: boolean;
|
|
35
|
+
}>>;
|
|
36
|
+
readonly events: Readonly<Record<string, {
|
|
37
|
+
readonly payload?: Readonly<Record<string, unknown>>;
|
|
38
|
+
}>>;
|
|
39
|
+
}>>;
|
|
16
40
|
}
|
|
17
41
|
export interface ManifestVocabulary {
|
|
18
42
|
readonly target: string;
|
package/dist/vocabulary.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { primitives } from "./primitives.js";
|
|
1
|
+
import { declared, primitives, renamed, renamedProps, rules } from "./primitives.js";
|
|
2
2
|
/** The names a template may write as a primitive in this vocabulary. */
|
|
3
3
|
export const namesOf = (vocabulary) => Object.keys("tags" in vocabulary ? vocabulary.tags : vocabulary.components);
|
|
4
4
|
/** A vocabulary that is a MESH manifest (or several: their components are merged, and a name may not be in two). */
|
|
@@ -18,11 +18,8 @@ export const fromManifests = (target, ...manifests) => {
|
|
|
18
18
|
export const webVocabulary = {
|
|
19
19
|
target: "web",
|
|
20
20
|
tags: primitives,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
textfield: ["label", "placeholder"],
|
|
26
|
-
heading: ["level"],
|
|
27
|
-
},
|
|
21
|
+
declared,
|
|
22
|
+
rules,
|
|
23
|
+
renamed,
|
|
24
|
+
renamedProps,
|
|
28
25
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@valancex/common",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "The author's side of a VALANCE application (defineApp, component, field) and the runtime the vlx build runs: the browser and server entries. What src/main.ts imports; @valancex/cli builds what it describes.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"valance",
|
|
@@ -32,6 +32,10 @@
|
|
|
32
32
|
"types": "./dist/client.d.ts",
|
|
33
33
|
"default": "./dist/client.js"
|
|
34
34
|
},
|
|
35
|
+
"./record": {
|
|
36
|
+
"types": "./dist/record.d.ts",
|
|
37
|
+
"default": "./dist/record.js"
|
|
38
|
+
},
|
|
35
39
|
"./desktop": {
|
|
36
40
|
"types": "./dist/desktop.d.ts",
|
|
37
41
|
"default": "./dist/desktop.js"
|
|
@@ -60,11 +64,11 @@
|
|
|
60
64
|
"provenance": true
|
|
61
65
|
},
|
|
62
66
|
"dependencies": {
|
|
63
|
-
"@valancex/mesh-runtime": "^0.
|
|
64
|
-
"@valancex/nexus": "^0.
|
|
65
|
-
"@valancex/port-web": "^0.
|
|
66
|
-
"@valancex/router": "^0.
|
|
67
|
-
"@valancex/valance": "^0.
|
|
67
|
+
"@valancex/mesh-runtime": "^0.15.0 || ^0.16.0 || ^0.17.0",
|
|
68
|
+
"@valancex/nexus": "^0.14.0 || ^0.15.0 || ^0.16.0",
|
|
69
|
+
"@valancex/port-web": "^0.12.0 || ^0.13.0 || ^0.14.0",
|
|
70
|
+
"@valancex/router": "^0.15.0",
|
|
71
|
+
"@valancex/valance": "^0.15.0"
|
|
68
72
|
},
|
|
69
73
|
"peerDependencies": {
|
|
70
74
|
"effect": "^3.10.0"
|