@markless/core 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.browser.d.ts +11 -0
- package/dist/index.browser.js +13 -0
- package/dist/index.d.ts +2 -70
- package/dist/index.js +1 -41
- package/dist/jsx-types-B0waGmH3.d.ts +70 -0
- package/dist/render-BsFGJP_Y.js +42 -0
- package/package.json +5 -4
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { C as state, S as shared, _ as SharedDefinition, a as CsrRenderArtifact, b as computed, c as CsrRenderOutput, d as render, f as AsyncComputedValue, g as FrameworkApiRuntimeError, h as FrameworkApiRuntimeDiagnostic, i as Seeded, l as CsrRenderable, m as FrameworkApiName, n as Component, o as CsrRenderContainer, p as ElementHandle, r as PropsOf, s as CsrRenderOptions, t as Children, u as RenderTarget, v as SharedOptions, w as storage, x as element, y as SharedScope } from "./jsx-types-B0waGmH3.js";
|
|
2
|
+
import { RenderToStringOptions, SsrRenderArtifact, SsrRenderOutput, SsrRenderable } from "@markless/web/render-to-string";
|
|
3
|
+
import { ResumePayloadDocumentInput, ResumePayloadScriptsInput, ResumePayloadScriptsResult } from "@markless/web/resume";
|
|
4
|
+
//#region src/index.browser.d.ts
|
|
5
|
+
type StringRendering = typeof import('@markless/web/render-to-string');
|
|
6
|
+
type PayloadResuming = typeof import('@markless/web/resume');
|
|
7
|
+
export declare function renderToString(...input: Parameters<StringRendering['renderToString']>): ReturnType<StringRendering['renderToString']>;
|
|
8
|
+
export declare function resumeFromPayloadDocument(...input: Parameters<PayloadResuming['resumeFromPayloadDocument']>): ReturnType<PayloadResuming['resumeFromPayloadDocument']>;
|
|
9
|
+
export declare function resumeFromPayloadScripts(...input: Parameters<PayloadResuming['resumeFromPayloadScripts']>): ReturnType<PayloadResuming['resumeFromPayloadScripts']>;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { type AsyncComputedValue, type Children, type Component, type CsrRenderArtifact, type CsrRenderContainer, type CsrRenderOptions, type CsrRenderOutput, type CsrRenderable, type ElementHandle, type FrameworkApiName, type FrameworkApiRuntimeDiagnostic, FrameworkApiRuntimeError, type PropsOf, type RenderTarget, type RenderToStringOptions, type ResumePayloadDocumentInput, type ResumePayloadScriptsInput, type ResumePayloadScriptsResult, type Seeded, type SharedDefinition, type SharedOptions, type SharedScope, type SsrRenderArtifact, type SsrRenderOutput, type SsrRenderable, computed, element, render, shared, state, storage };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { a as shared, i as element, n as FrameworkApiRuntimeError, o as state, r as computed, s as storage, t as render } from "./render-BsFGJP_Y.js";
|
|
2
|
+
//#region src/index.browser.ts
|
|
3
|
+
async function renderToString(...input) {
|
|
4
|
+
return (await import("@markless/web/render-to-string")).renderToString(...input);
|
|
5
|
+
}
|
|
6
|
+
async function resumeFromPayloadDocument(...input) {
|
|
7
|
+
return (await import("@markless/web/resume")).resumeFromPayloadDocument(...input);
|
|
8
|
+
}
|
|
9
|
+
async function resumeFromPayloadScripts(...input) {
|
|
10
|
+
return (await import("@markless/web/resume")).resumeFromPayloadScripts(...input);
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { FrameworkApiRuntimeError, computed, element, render, renderToString, resumeFromPayloadDocument, resumeFromPayloadScripts, shared, state, storage };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,72 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as state, S as shared, _ as SharedDefinition, a as CsrRenderArtifact, b as computed, c as CsrRenderOutput, d as render, f as AsyncComputedValue, g as FrameworkApiRuntimeError, h as FrameworkApiRuntimeDiagnostic, i as Seeded, l as CsrRenderable, m as FrameworkApiName, n as Component, o as CsrRenderContainer, p as ElementHandle, r as PropsOf, s as CsrRenderOptions, t as Children, u as RenderTarget, v as SharedOptions, w as storage, x as element, y as SharedScope } from "./jsx-types-B0waGmH3.js";
|
|
2
2
|
import { RenderToStringOptions, SsrRenderArtifact, SsrRenderOutput, SsrRenderable, renderToString } from "@markless/web/render-to-string";
|
|
3
3
|
import { ResumePayloadDocumentInput, ResumePayloadScriptsInput, ResumePayloadScriptsResult, resumeFromPayloadDocument, resumeFromPayloadScripts } from "@markless/web/resume";
|
|
4
|
-
|
|
5
|
-
type AsyncComputedValue<T> = T extends Promise<infer Value> ? Awaited<Value> : T;
|
|
6
|
-
type ElementHandle<T extends Element | readonly Element[] = Element> = T extends readonly (infer E extends Element)[] ? E[] : T | undefined;
|
|
7
|
-
type SharedScope = 'request' | 'container' | 'page' | 'widget';
|
|
8
|
-
type SharedOptions = {
|
|
9
|
-
readonly scope: SharedScope;
|
|
10
|
-
};
|
|
11
|
-
type FrameworkApiName = 'state' | 'computed' | 'element' | 'shared' | 'storage';
|
|
12
|
-
type FrameworkApiRuntimeDiagnostic = {
|
|
13
|
-
readonly code: 'MARKLESS_FRAMEWORK_API_RUNTIME_CALL';
|
|
14
|
-
readonly severity: 'error';
|
|
15
|
-
readonly phase: 'runtime';
|
|
16
|
-
readonly title: 'Framework API executed without compiler output';
|
|
17
|
-
readonly message: string;
|
|
18
|
-
readonly why: string;
|
|
19
|
-
readonly apiName: FrameworkApiName;
|
|
20
|
-
readonly suggestions: ReadonlyArray<{
|
|
21
|
-
readonly message: string;
|
|
22
|
-
}>;
|
|
23
|
-
readonly docsUrl: string;
|
|
24
|
-
};
|
|
25
|
-
export declare class FrameworkApiRuntimeError extends Error implements FrameworkApiRuntimeDiagnostic {
|
|
26
|
-
readonly code: "MARKLESS_FRAMEWORK_API_RUNTIME_CALL";
|
|
27
|
-
readonly severity: "error";
|
|
28
|
-
readonly phase: "runtime";
|
|
29
|
-
readonly title: "Framework API executed without compiler output";
|
|
30
|
-
readonly why: string;
|
|
31
|
-
readonly apiName: FrameworkApiName;
|
|
32
|
-
readonly suggestions: ReadonlyArray<{
|
|
33
|
-
readonly message: string;
|
|
34
|
-
}>;
|
|
35
|
-
readonly docsUrl = "https://markless.dev/errors/MARKLESS_FRAMEWORK_API_RUNTIME_CALL";
|
|
36
|
-
constructor(apiName: FrameworkApiName);
|
|
37
|
-
}
|
|
38
|
-
export declare function state<T>(initial: T): T;
|
|
39
|
-
export declare function computed<T>(derive: () => T): AsyncComputedValue<T>;
|
|
40
|
-
export declare function element<T extends Element | Element[] = Element>(): ElementHandle<T>;
|
|
41
|
-
type SharedDefinition<T> = () => T;
|
|
42
|
-
export declare function shared<T>(create: () => T, options?: SharedOptions): SharedDefinition<T>;
|
|
43
|
-
export declare function storage(fallback: string): string;
|
|
44
|
-
export declare function storage(key: string, fallback: string): string;
|
|
45
|
-
//#endregion
|
|
46
|
-
//#region src/jsx-types.d.ts
|
|
47
|
-
/** Anything that can sit in a component's `children` position. */
|
|
48
|
-
type Children = __MarklessTypeService.Child;
|
|
49
|
-
/** The HTML tags that cannot have children; every other tag's props include them. */
|
|
50
|
-
type VoidTagName = 'area' | 'base' | 'br' | 'col' | 'embed' | 'hr' | 'img' | 'input' | 'link' | 'meta' | 'source' | 'track' | 'wbr';
|
|
51
|
-
/**
|
|
52
|
-
* Every attribute, event handler, `attach`, and `el` the given intrinsic tag accepts.
|
|
53
|
-
* Tags that can hold content also accept `children`; void tags do not, so a part
|
|
54
|
-
* wrapping an `<input>` cannot be projected into by mistake.
|
|
55
|
-
*/
|
|
56
|
-
type PropsOf<Tag extends __MarklessTypeService.IntrinsicTagName> = __MarklessTypeService.IntrinsicElementFor<Tag> & (Tag extends VoidTagName ? unknown : {
|
|
57
|
-
readonly children?: Children;
|
|
58
|
-
});
|
|
59
|
-
/**
|
|
60
|
-
* The instance fields a widget root seeds from its props: the same fields the
|
|
61
|
-
* consumer knows, made required and mutable, because a prop is optional to the
|
|
62
|
-
* consumer while the root assigns every one of them on every render.
|
|
63
|
-
*/
|
|
64
|
-
type Seeded<Props, Keys extends keyof Props> = { -readonly [Field in Keys]-?: Props[Field]; };
|
|
65
|
-
/**
|
|
66
|
-
* A compiled TSRX component, as a value: what a `.tsrx` module's default export
|
|
67
|
-
* is, what test harnesses mount, and what composition renders. The runtime's
|
|
68
|
-
* internal contract stays internal; this is the name consumers see.
|
|
69
|
-
*/
|
|
70
|
-
type Component = CsrRenderable;
|
|
71
|
-
//#endregion
|
|
72
|
-
export { type AsyncComputedValue, type Children, type Component, type CsrRenderArtifact, type CsrRenderContainer, type CsrRenderOptions, type CsrRenderOutput, type CsrRenderable, type ElementHandle, type FrameworkApiName, type FrameworkApiRuntimeDiagnostic, type PropsOf, type RenderTarget, type RenderToStringOptions, type ResumePayloadDocumentInput, type ResumePayloadScriptsInput, type ResumePayloadScriptsResult, type Seeded, type SharedDefinition, type SharedOptions, type SharedScope, type SsrRenderArtifact, type SsrRenderOutput, type SsrRenderable, render, renderToString, resumeFromPayloadDocument, resumeFromPayloadScripts };
|
|
4
|
+
export { type AsyncComputedValue, type Children, type Component, type CsrRenderArtifact, type CsrRenderContainer, type CsrRenderOptions, type CsrRenderOutput, type CsrRenderable, type ElementHandle, type FrameworkApiName, type FrameworkApiRuntimeDiagnostic, FrameworkApiRuntimeError, type PropsOf, type RenderTarget, type RenderToStringOptions, type ResumePayloadDocumentInput, type ResumePayloadScriptsInput, type ResumePayloadScriptsResult, type Seeded, type SharedDefinition, type SharedOptions, type SharedScope, type SsrRenderArtifact, type SsrRenderOutput, type SsrRenderable, computed, element, render, renderToString, resumeFromPayloadDocument, resumeFromPayloadScripts, shared, state, storage };
|
package/dist/index.js
CHANGED
|
@@ -1,44 +1,4 @@
|
|
|
1
|
-
import { render } from "
|
|
1
|
+
import { a as shared, i as element, n as FrameworkApiRuntimeError, o as state, r as computed, s as storage, t as render } from "./render-BsFGJP_Y.js";
|
|
2
2
|
import { renderToString } from "@markless/web/render-to-string";
|
|
3
3
|
import { resumeFromPayloadDocument, resumeFromPayloadScripts } from "@markless/web/resume";
|
|
4
|
-
//#region src/framework-api.ts
|
|
5
|
-
var FrameworkApiRuntimeError = class extends Error {
|
|
6
|
-
code = "MARKLESS_FRAMEWORK_API_RUNTIME_CALL";
|
|
7
|
-
severity = "error";
|
|
8
|
-
phase = "runtime";
|
|
9
|
-
title = "Framework API executed without compiler output";
|
|
10
|
-
why;
|
|
11
|
-
apiName;
|
|
12
|
-
suggestions;
|
|
13
|
-
docsUrl = "https://markless.dev/errors/MARKLESS_FRAMEWORK_API_RUNTIME_CALL";
|
|
14
|
-
constructor(apiName) {
|
|
15
|
-
super(frameworkApiRuntimeMessage(apiName));
|
|
16
|
-
this.name = "FrameworkApiRuntimeError";
|
|
17
|
-
this.apiName = apiName;
|
|
18
|
-
this.why = `${apiName}() is an markless framework API that must be rewritten by the .tsrx compiler before runtime execution.`;
|
|
19
|
-
this.suggestions = [{ message: "Import this API from markless inside a .tsrx file processed by the compiler. Do not call it from plain runtime JavaScript." }];
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
function state(initial) {
|
|
23
|
-
return frameworkApi("state", initial);
|
|
24
|
-
}
|
|
25
|
-
function computed(derive) {
|
|
26
|
-
return frameworkApi("computed", derive);
|
|
27
|
-
}
|
|
28
|
-
function element() {
|
|
29
|
-
return frameworkApi("element");
|
|
30
|
-
}
|
|
31
|
-
function shared(create, options) {
|
|
32
|
-
return frameworkApi("shared", create, options);
|
|
33
|
-
}
|
|
34
|
-
function storage(...args) {
|
|
35
|
-
return frameworkApi("storage", ...args);
|
|
36
|
-
}
|
|
37
|
-
function frameworkApi(name, ..._args) {
|
|
38
|
-
throw new FrameworkApiRuntimeError(name);
|
|
39
|
-
}
|
|
40
|
-
function frameworkApiRuntimeMessage(name) {
|
|
41
|
-
return `markless ${name}() must be compiled from a .tsrx file before it can run.`;
|
|
42
|
-
}
|
|
43
|
-
//#endregion
|
|
44
4
|
export { FrameworkApiRuntimeError, computed, element, render, renderToString, resumeFromPayloadDocument, resumeFromPayloadScripts, shared, state, storage };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { CsrRenderArtifact, CsrRenderContainer, CsrRenderOptions, CsrRenderOutput, CsrRenderable, RenderTarget, render } from "@markless/web/render";
|
|
2
|
+
//#region src/framework-api.d.ts
|
|
3
|
+
type AsyncComputedValue<T> = T extends Promise<infer Value> ? Awaited<Value> : T;
|
|
4
|
+
type ElementHandle<T extends Element | readonly Element[] = Element> = T extends readonly (infer E extends Element)[] ? E[] : T | undefined;
|
|
5
|
+
type SharedScope = 'request' | 'container' | 'page' | 'widget';
|
|
6
|
+
type SharedOptions = {
|
|
7
|
+
readonly scope: SharedScope;
|
|
8
|
+
};
|
|
9
|
+
type FrameworkApiName = 'state' | 'computed' | 'element' | 'shared' | 'storage';
|
|
10
|
+
type FrameworkApiRuntimeDiagnostic = {
|
|
11
|
+
readonly code: 'MARKLESS_FRAMEWORK_API_RUNTIME_CALL';
|
|
12
|
+
readonly severity: 'error';
|
|
13
|
+
readonly phase: 'runtime';
|
|
14
|
+
readonly title: 'Framework API executed without compiler output';
|
|
15
|
+
readonly message: string;
|
|
16
|
+
readonly why: string;
|
|
17
|
+
readonly apiName: FrameworkApiName;
|
|
18
|
+
readonly suggestions: ReadonlyArray<{
|
|
19
|
+
readonly message: string;
|
|
20
|
+
}>;
|
|
21
|
+
readonly docsUrl: string;
|
|
22
|
+
};
|
|
23
|
+
declare class FrameworkApiRuntimeError extends Error implements FrameworkApiRuntimeDiagnostic {
|
|
24
|
+
readonly code: "MARKLESS_FRAMEWORK_API_RUNTIME_CALL";
|
|
25
|
+
readonly severity: "error";
|
|
26
|
+
readonly phase: "runtime";
|
|
27
|
+
readonly title: "Framework API executed without compiler output";
|
|
28
|
+
readonly why: string;
|
|
29
|
+
readonly apiName: FrameworkApiName;
|
|
30
|
+
readonly suggestions: ReadonlyArray<{
|
|
31
|
+
readonly message: string;
|
|
32
|
+
}>;
|
|
33
|
+
readonly docsUrl = "https://markless.dev/errors/MARKLESS_FRAMEWORK_API_RUNTIME_CALL";
|
|
34
|
+
constructor(apiName: FrameworkApiName);
|
|
35
|
+
}
|
|
36
|
+
declare function state<T>(initial: T): T;
|
|
37
|
+
declare function computed<T>(derive: () => T): AsyncComputedValue<T>;
|
|
38
|
+
declare function element<T extends Element | Element[] = Element>(): ElementHandle<T>;
|
|
39
|
+
type SharedDefinition<T> = () => T;
|
|
40
|
+
declare function shared<T>(create: () => T, options?: SharedOptions): SharedDefinition<T>;
|
|
41
|
+
declare function storage(fallback: string): string;
|
|
42
|
+
declare function storage(key: string, fallback: string): string;
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/jsx-types.d.ts
|
|
45
|
+
/** Anything that can sit in a component's `children` position. */
|
|
46
|
+
type Children = __MarklessTypeService.Child;
|
|
47
|
+
/** The HTML tags that cannot have children; every other tag's props include them. */
|
|
48
|
+
type VoidTagName = 'area' | 'base' | 'br' | 'col' | 'embed' | 'hr' | 'img' | 'input' | 'link' | 'meta' | 'source' | 'track' | 'wbr';
|
|
49
|
+
/**
|
|
50
|
+
* Every attribute, event handler, `attach`, and `el` the given intrinsic tag accepts.
|
|
51
|
+
* Tags that can hold content also accept `children`; void tags do not, so a part
|
|
52
|
+
* wrapping an `<input>` cannot be projected into by mistake.
|
|
53
|
+
*/
|
|
54
|
+
type PropsOf<Tag extends __MarklessTypeService.IntrinsicTagName> = __MarklessTypeService.IntrinsicElementFor<Tag> & (Tag extends VoidTagName ? unknown : {
|
|
55
|
+
readonly children?: Children;
|
|
56
|
+
});
|
|
57
|
+
/**
|
|
58
|
+
* The instance fields a widget root seeds from its props: the same fields the
|
|
59
|
+
* consumer knows, made required and mutable, because a prop is optional to the
|
|
60
|
+
* consumer while the root assigns every one of them on every render.
|
|
61
|
+
*/
|
|
62
|
+
type Seeded<Props, Keys extends keyof Props> = { -readonly [Field in Keys]-?: Props[Field]; };
|
|
63
|
+
/**
|
|
64
|
+
* A compiled TSRX component, as a value: what a `.tsrx` module's default export
|
|
65
|
+
* is, what test harnesses mount, and what composition renders. The runtime's
|
|
66
|
+
* internal contract stays internal; this is the name consumers see.
|
|
67
|
+
*/
|
|
68
|
+
type Component = CsrRenderable;
|
|
69
|
+
//#endregion
|
|
70
|
+
export { state as C, shared as S, SharedDefinition as _, CsrRenderArtifact as a, computed as b, CsrRenderOutput as c, render as d, AsyncComputedValue as f, FrameworkApiRuntimeError as g, FrameworkApiRuntimeDiagnostic as h, Seeded as i, CsrRenderable as l, FrameworkApiName as m, Component as n, CsrRenderContainer as o, ElementHandle as p, PropsOf as r, CsrRenderOptions as s, Children as t, RenderTarget as u, SharedOptions as v, storage as w, element as x, SharedScope as y };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { render } from "@markless/web/render";
|
|
2
|
+
//#region src/framework-api.ts
|
|
3
|
+
var FrameworkApiRuntimeError = class extends Error {
|
|
4
|
+
code = "MARKLESS_FRAMEWORK_API_RUNTIME_CALL";
|
|
5
|
+
severity = "error";
|
|
6
|
+
phase = "runtime";
|
|
7
|
+
title = "Framework API executed without compiler output";
|
|
8
|
+
why;
|
|
9
|
+
apiName;
|
|
10
|
+
suggestions;
|
|
11
|
+
docsUrl = "https://markless.dev/errors/MARKLESS_FRAMEWORK_API_RUNTIME_CALL";
|
|
12
|
+
constructor(apiName) {
|
|
13
|
+
super(frameworkApiRuntimeMessage(apiName));
|
|
14
|
+
this.name = "FrameworkApiRuntimeError";
|
|
15
|
+
this.apiName = apiName;
|
|
16
|
+
this.why = `${apiName}() is an markless framework API that must be rewritten by the .tsrx compiler before runtime execution.`;
|
|
17
|
+
this.suggestions = [{ message: "Import this API from markless inside a .tsrx file processed by the compiler. Do not call it from plain runtime JavaScript." }];
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
function state(initial) {
|
|
21
|
+
return frameworkApi("state", initial);
|
|
22
|
+
}
|
|
23
|
+
function computed(derive) {
|
|
24
|
+
return frameworkApi("computed", derive);
|
|
25
|
+
}
|
|
26
|
+
function element() {
|
|
27
|
+
return frameworkApi("element");
|
|
28
|
+
}
|
|
29
|
+
function shared(create, options) {
|
|
30
|
+
return frameworkApi("shared", create, options);
|
|
31
|
+
}
|
|
32
|
+
function storage(...args) {
|
|
33
|
+
return frameworkApi("storage", ...args);
|
|
34
|
+
}
|
|
35
|
+
function frameworkApi(name, ..._args) {
|
|
36
|
+
throw new FrameworkApiRuntimeError(name);
|
|
37
|
+
}
|
|
38
|
+
function frameworkApiRuntimeMessage(name) {
|
|
39
|
+
return `markless ${name}() must be compiled from a .tsrx file before it can run.`;
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
export { shared as a, element as i, FrameworkApiRuntimeError as n, state as o, computed as r, storage as s, render as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markless/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Markless core authoring APIs: resumable TSRX apps whose server HTML arrives already wired and loads code only when an event needs it.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"exports": {
|
|
18
18
|
".": {
|
|
19
19
|
"types": "./dist/index.d.ts",
|
|
20
|
+
"browser": "./dist/index.browser.js",
|
|
20
21
|
"default": "./dist/index.js"
|
|
21
22
|
},
|
|
22
23
|
"./preload": {
|
|
@@ -113,9 +114,9 @@
|
|
|
113
114
|
"provenance": true
|
|
114
115
|
},
|
|
115
116
|
"dependencies": {
|
|
116
|
-
"@markless/bundler": "0.
|
|
117
|
-
"@markless/
|
|
118
|
-
"@markless/
|
|
117
|
+
"@markless/bundler": "0.10.0",
|
|
118
|
+
"@markless/web": "0.10.0",
|
|
119
|
+
"@markless/router": "0.10.0"
|
|
119
120
|
},
|
|
120
121
|
"scripts": {}
|
|
121
122
|
}
|