@mdsnai/sdk 0.2.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -76
- package/dist/core/errors.d.ts +14 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js +13 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/index.d.ts +16 -4
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +69 -13
- package/dist/core/index.js.map +1 -0
- package/dist/core/markdown-body.d.ts +3 -0
- package/dist/core/markdown-body.d.ts.map +1 -0
- package/dist/core/markdown-body.js +65 -0
- package/dist/core/markdown-body.js.map +1 -0
- package/dist/core/markdown-renderer.d.ts +5 -0
- package/dist/core/markdown-renderer.d.ts.map +1 -0
- package/dist/core/markdown-renderer.js +75 -0
- package/dist/core/markdown-renderer.js.map +1 -0
- package/dist/core/negotiate.d.ts +3 -0
- package/dist/core/negotiate.d.ts.map +1 -0
- package/dist/core/negotiate.js +63 -0
- package/dist/core/negotiate.js.map +1 -0
- package/dist/core/parse/anchors.d.ts +2 -0
- package/dist/core/parse/anchors.d.ts.map +1 -0
- package/dist/core/parse/anchors.js +26 -0
- package/dist/core/parse/anchors.js.map +1 -0
- package/dist/core/parse/block-parser.d.ts +3 -0
- package/dist/core/parse/block-parser.d.ts.map +1 -0
- package/dist/core/parse/block-parser.js +116 -0
- package/dist/core/parse/block-parser.js.map +1 -0
- package/dist/core/parse/executable-block.d.ts +6 -0
- package/dist/core/parse/executable-block.d.ts.map +1 -0
- package/dist/core/parse/executable-block.js +48 -0
- package/dist/core/parse/executable-block.js.map +1 -0
- package/dist/core/parse/frontmatter.d.ts +7 -0
- package/dist/core/parse/frontmatter.d.ts.map +1 -0
- package/dist/core/parse/frontmatter.js +45 -0
- package/dist/core/parse/frontmatter.js.map +1 -0
- package/dist/core/serialize.d.ts +4 -0
- package/dist/core/serialize.d.ts.map +1 -0
- package/dist/core/serialize.js +123 -0
- package/dist/core/serialize.js.map +1 -0
- package/dist/core/types.d.ts +66 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +2 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/validate.d.ts +3 -0
- package/dist/core/validate.d.ts.map +1 -0
- package/dist/core/validate.js +91 -0
- package/dist/core/validate.js.map +1 -0
- package/dist/elements/components/mdsn-action.d.ts +6 -0
- package/dist/elements/components/mdsn-action.d.ts.map +1 -0
- package/dist/elements/components/mdsn-action.js +34 -0
- package/dist/elements/components/mdsn-action.js.map +1 -0
- package/dist/elements/components/mdsn-block.d.ts +9 -0
- package/dist/elements/components/mdsn-block.d.ts.map +1 -0
- package/dist/elements/components/mdsn-block.js +36 -0
- package/dist/elements/components/mdsn-block.js.map +1 -0
- package/dist/elements/components/mdsn-error.d.ts +9 -0
- package/dist/elements/components/mdsn-error.d.ts.map +1 -0
- package/dist/elements/components/mdsn-error.js +36 -0
- package/dist/elements/components/mdsn-error.js.map +1 -0
- package/dist/elements/components/mdsn-field.d.ts +6 -0
- package/dist/elements/components/mdsn-field.d.ts.map +1 -0
- package/dist/elements/components/mdsn-field.js +35 -0
- package/dist/elements/components/mdsn-field.js.map +1 -0
- package/dist/elements/components/mdsn-form.d.ts +6 -0
- package/dist/elements/components/mdsn-form.d.ts.map +1 -0
- package/dist/elements/components/mdsn-form.js +22 -0
- package/dist/elements/components/mdsn-form.js.map +1 -0
- package/dist/elements/components/mdsn-page.d.ts +9 -0
- package/dist/elements/components/mdsn-page.d.ts.map +1 -0
- package/dist/elements/components/mdsn-page.js +46 -0
- package/dist/elements/components/mdsn-page.js.map +1 -0
- package/dist/elements/index.d.ts +3 -0
- package/dist/elements/index.d.ts.map +1 -0
- package/dist/elements/index.js +3 -0
- package/dist/elements/index.js.map +1 -0
- package/dist/elements/mount.d.ts +11 -0
- package/dist/elements/mount.d.ts.map +1 -0
- package/dist/elements/mount.js +245 -0
- package/dist/elements/mount.js.map +1 -0
- package/dist/elements/register.d.ts +2 -0
- package/dist/elements/register.d.ts.map +1 -0
- package/dist/elements/register.js +27 -0
- package/dist/elements/register.js.map +1 -0
- package/dist/elements/theme.d.ts +2 -0
- package/dist/elements/theme.d.ts.map +1 -0
- package/dist/elements/theme.js +13 -0
- package/dist/elements/theme.js.map +1 -0
- package/dist/index.d.ts +4 -8
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -35
- package/dist/index.js.map +1 -0
- package/dist/server/hosted-app.d.ts +35 -0
- package/dist/server/hosted-app.d.ts.map +1 -0
- package/dist/server/hosted-app.js +105 -0
- package/dist/server/hosted-app.js.map +1 -0
- package/dist/server/html-render.d.ts +13 -0
- package/dist/server/html-render.d.ts.map +1 -0
- package/dist/server/html-render.js +316 -0
- package/dist/server/html-render.js.map +1 -0
- package/dist/server/index.d.ts +8 -15
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +6 -32
- package/dist/server/index.js.map +1 -0
- package/dist/server/node.d.ts +23 -0
- package/dist/server/node.d.ts.map +1 -0
- package/dist/server/node.js +200 -0
- package/dist/server/node.js.map +1 -0
- package/dist/server/result.d.ts +15 -0
- package/dist/server/result.d.ts.map +1 -0
- package/dist/server/result.js +64 -0
- package/dist/server/result.js.map +1 -0
- package/dist/server/router.d.ts +12 -0
- package/dist/server/router.d.ts.map +1 -0
- package/dist/server/router.js +24 -0
- package/dist/server/router.js.map +1 -0
- package/dist/server/runtime.d.ts +15 -0
- package/dist/server/runtime.d.ts.map +1 -0
- package/dist/server/runtime.js +245 -0
- package/dist/server/runtime.js.map +1 -0
- package/dist/server/session.d.ts +5 -40
- package/dist/server/session.d.ts.map +1 -0
- package/dist/server/session.js +11 -213
- package/dist/server/session.js.map +1 -0
- package/dist/server/types.d.ts +62 -0
- package/dist/server/types.d.ts.map +1 -0
- package/dist/server/types.js +2 -0
- package/dist/server/types.js.map +1 -0
- package/dist/web/headless.d.ts +22 -92
- package/dist/web/headless.d.ts.map +1 -0
- package/dist/web/headless.js +311 -337
- package/dist/web/headless.js.map +1 -0
- package/dist/web/index.d.ts +2 -11
- package/dist/web/index.d.ts.map +1 -0
- package/dist/web/index.js +2 -23
- package/dist/web/index.js.map +1 -0
- package/package.json +19 -43
- package/LICENSE +0 -21
- package/dist/cli/args.d.ts +0 -8
- package/dist/cli/args.js +0 -63
- package/dist/cli/commands/build.d.ts +0 -5
- package/dist/cli/commands/build.js +0 -19
- package/dist/cli/commands/create.d.ts +0 -2
- package/dist/cli/commands/create.js +0 -39
- package/dist/cli/commands/dev.d.ts +0 -10
- package/dist/cli/commands/dev.js +0 -13
- package/dist/cli/commands/start.d.ts +0 -9
- package/dist/cli/commands/start.js +0 -13
- package/dist/cli/entry.d.ts +0 -2
- package/dist/cli/entry.js +0 -8
- package/dist/cli/index.d.ts +0 -9
- package/dist/cli/index.js +0 -58
- package/dist/core/document/frontmatter.d.ts +0 -5
- package/dist/core/document/frontmatter.js +0 -41
- package/dist/core/document/markdown.d.ts +0 -5
- package/dist/core/document/markdown.js +0 -81
- package/dist/core/document/page-definition.d.ts +0 -2
- package/dist/core/document/page-definition.js +0 -23
- package/dist/core/model/block.d.ts +0 -26
- package/dist/core/model/block.js +0 -8
- package/dist/core/model/document.d.ts +0 -11
- package/dist/core/model/document.js +0 -2
- package/dist/core/model/fragment.d.ts +0 -4
- package/dist/core/model/fragment.js +0 -2
- package/dist/core/model/index.d.ts +0 -4
- package/dist/core/model/index.js +0 -2
- package/dist/core/model/input.d.ts +0 -10
- package/dist/core/model/input.js +0 -2
- package/dist/core/protocol/mdsn.d.ts +0 -4
- package/dist/core/protocol/mdsn.js +0 -66
- package/dist/core/protocol/statements.d.ts +0 -7
- package/dist/core/protocol/statements.js +0 -115
- package/dist/core/protocol/validation.d.ts +0 -3
- package/dist/core/protocol/validation.js +0 -70
- package/dist/core/utils/html.d.ts +0 -6
- package/dist/core/utils/html.js +0 -28
- package/dist/core/utils/index.d.ts +0 -2
- package/dist/core/utils/index.js +0 -12
- package/dist/core/utils/logger.d.ts +0 -12
- package/dist/core/utils/logger.js +0 -45
- package/dist/framework/create-framework-app.d.ts +0 -13
- package/dist/framework/create-framework-app.js +0 -12
- package/dist/framework/hosted-app.d.ts +0 -34
- package/dist/framework/hosted-app.js +0 -223
- package/dist/framework/index.d.ts +0 -6
- package/dist/framework/index.js +0 -9
- package/dist/framework/site-app.d.ts +0 -13
- package/dist/framework/site-app.js +0 -147
- package/dist/server/action-context.d.ts +0 -11
- package/dist/server/action-context.js +0 -26
- package/dist/server/action-host.d.ts +0 -2
- package/dist/server/action-host.js +0 -10
- package/dist/server/action-inputs.d.ts +0 -3
- package/dist/server/action-inputs.js +0 -178
- package/dist/server/action-runtime.d.ts +0 -8
- package/dist/server/action-runtime.js +0 -62
- package/dist/server/action.d.ts +0 -33
- package/dist/server/action.js +0 -101
- package/dist/server/build.d.ts +0 -10
- package/dist/server/build.js +0 -170
- package/dist/server/config.d.ts +0 -56
- package/dist/server/config.js +0 -42
- package/dist/server/dev.d.ts +0 -48
- package/dist/server/dev.js +0 -90
- package/dist/server/error-fragments.d.ts +0 -46
- package/dist/server/error-fragments.js +0 -77
- package/dist/server/init.d.ts +0 -1
- package/dist/server/init.js +0 -176
- package/dist/server/layout.d.ts +0 -17
- package/dist/server/layout.js +0 -40
- package/dist/server/markdown.d.ts +0 -49
- package/dist/server/markdown.js +0 -77
- package/dist/server/module-loader.d.ts +0 -4
- package/dist/server/module-loader.js +0 -71
- package/dist/server/negotiate.d.ts +0 -3
- package/dist/server/negotiate.js +0 -61
- package/dist/server/page-host.d.ts +0 -21
- package/dist/server/page-host.js +0 -66
- package/dist/server/page-links.d.ts +0 -10
- package/dist/server/page-links.js +0 -80
- package/dist/server/route-matcher.d.ts +0 -6
- package/dist/server/route-matcher.js +0 -73
- package/dist/server/routes.d.ts +0 -6
- package/dist/server/routes.js +0 -73
- package/dist/server/server.d.ts +0 -28
- package/dist/server/server.js +0 -161
- package/dist/server/site.d.ts +0 -11
- package/dist/server/site.js +0 -59
- package/dist/server/targets.d.ts +0 -7
- package/dist/server/targets.js +0 -21
- package/dist/web/block-runtime.d.ts +0 -2
- package/dist/web/block-runtime.js +0 -25
- package/dist/web/fragment-render.d.ts +0 -8
- package/dist/web/fragment-render.js +0 -58
- package/dist/web/i18n.d.ts +0 -29
- package/dist/web/i18n.js +0 -65
- package/dist/web/navigation.d.ts +0 -3
- package/dist/web/navigation.js +0 -32
- package/dist/web/page-bootstrap.d.ts +0 -6
- package/dist/web/page-bootstrap.js +0 -28
- package/dist/web/page-client-runtime.d.ts +0 -4
- package/dist/web/page-client-runtime.js +0 -7
- package/dist/web/page-client-script.d.ts +0 -1
- package/dist/web/page-client-script.js +0 -579
- package/dist/web/page-html.d.ts +0 -8
- package/dist/web/page-html.js +0 -42
- package/dist/web/page-render.d.ts +0 -20
- package/dist/web/page-render.js +0 -84
- package/dist/web/public-client-runtime.d.ts +0 -1
- package/dist/web/public-client-runtime.js +0 -5
- package/dist/web/public-render.d.ts +0 -12
- package/dist/web/public-render.js +0 -18
- package/dist/web/target-path.d.ts +0 -1
- package/dist/web/target-path.js +0 -35
package/dist/web/i18n.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export type WebRuntimeLocale = "en" | "zh";
|
|
2
|
-
export type WebRuntimeMessages = {
|
|
3
|
-
chooseOption: string;
|
|
4
|
-
inputSectionTitle: string;
|
|
5
|
-
readSectionTitle: string;
|
|
6
|
-
writeSectionTitle: string;
|
|
7
|
-
sourceLabel: string;
|
|
8
|
-
viewRawMarkdownLink: string;
|
|
9
|
-
pageReadyStatus: string;
|
|
10
|
-
emptyBlock: string;
|
|
11
|
-
emptyList: string;
|
|
12
|
-
emptyImage: string;
|
|
13
|
-
imageAltFallback: string;
|
|
14
|
-
listItemFallback: string;
|
|
15
|
-
missingInput: string;
|
|
16
|
-
fillRequired: string;
|
|
17
|
-
operationRunning: string;
|
|
18
|
-
operationFailed: string;
|
|
19
|
-
operationSuccess: string;
|
|
20
|
-
networkError: string;
|
|
21
|
-
dependencyChainInterrupted: string;
|
|
22
|
-
blockErrorState: string;
|
|
23
|
-
dependencyNotReady: string;
|
|
24
|
-
unknownError: string;
|
|
25
|
-
};
|
|
26
|
-
export declare const WEB_RUNTIME_MESSAGES: Record<WebRuntimeLocale, WebRuntimeMessages>;
|
|
27
|
-
export declare const DEFAULT_WEB_RUNTIME_LOCALE: WebRuntimeLocale;
|
|
28
|
-
export declare function resolveWebRuntimeLocale(input?: string | null): WebRuntimeLocale;
|
|
29
|
-
export declare function getWebRuntimeMessages(input?: string | null): WebRuntimeMessages;
|
package/dist/web/i18n.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_WEB_RUNTIME_LOCALE = exports.WEB_RUNTIME_MESSAGES = void 0;
|
|
4
|
-
exports.resolveWebRuntimeLocale = resolveWebRuntimeLocale;
|
|
5
|
-
exports.getWebRuntimeMessages = getWebRuntimeMessages;
|
|
6
|
-
exports.WEB_RUNTIME_MESSAGES = {
|
|
7
|
-
en: {
|
|
8
|
-
chooseOption: "Please choose",
|
|
9
|
-
inputSectionTitle: "Input",
|
|
10
|
-
readSectionTitle: "Read",
|
|
11
|
-
writeSectionTitle: "Write",
|
|
12
|
-
sourceLabel: "Source",
|
|
13
|
-
viewRawMarkdownLink: "View raw Markdown",
|
|
14
|
-
pageReadyStatus: "Page loaded. Ready for action.",
|
|
15
|
-
emptyBlock: "No content yet.",
|
|
16
|
-
emptyList: "No entries yet.",
|
|
17
|
-
emptyImage: "No image yet.",
|
|
18
|
-
imageAltFallback: "image",
|
|
19
|
-
listItemFallback: "item",
|
|
20
|
-
missingInput: "Missing input: ",
|
|
21
|
-
fillRequired: "Please fill: ",
|
|
22
|
-
operationRunning: "Running: ",
|
|
23
|
-
operationFailed: "Failed: ",
|
|
24
|
-
operationSuccess: "Succeeded: ",
|
|
25
|
-
networkError: "Network error: ",
|
|
26
|
-
dependencyChainInterrupted: "Execution failed, dependency chain interrupted.",
|
|
27
|
-
blockErrorState: "This block is in an error state.",
|
|
28
|
-
dependencyNotReady: "Dependencies not ready: ",
|
|
29
|
-
unknownError: "UNKNOWN_ERROR",
|
|
30
|
-
},
|
|
31
|
-
zh: {
|
|
32
|
-
chooseOption: "请选择",
|
|
33
|
-
inputSectionTitle: "输入",
|
|
34
|
-
readSectionTitle: "读取",
|
|
35
|
-
writeSectionTitle: "写入",
|
|
36
|
-
sourceLabel: "源文件",
|
|
37
|
-
viewRawMarkdownLink: "查看原始 Markdown",
|
|
38
|
-
pageReadyStatus: "页面已加载,等待操作。",
|
|
39
|
-
emptyBlock: "暂无内容。",
|
|
40
|
-
emptyList: "还没有内容。",
|
|
41
|
-
emptyImage: "暂无图片。",
|
|
42
|
-
imageAltFallback: "image",
|
|
43
|
-
listItemFallback: "item",
|
|
44
|
-
missingInput: "缺少输入:",
|
|
45
|
-
fillRequired: "请先填写:",
|
|
46
|
-
operationRunning: "执行中:",
|
|
47
|
-
operationFailed: "执行失败:",
|
|
48
|
-
operationSuccess: "执行成功:",
|
|
49
|
-
networkError: "网络错误:",
|
|
50
|
-
dependencyChainInterrupted: "执行失败,依赖链已中断。",
|
|
51
|
-
blockErrorState: "当前 block 已进入错误状态。",
|
|
52
|
-
dependencyNotReady: "依赖未就绪:",
|
|
53
|
-
unknownError: "UNKNOWN_ERROR",
|
|
54
|
-
},
|
|
55
|
-
};
|
|
56
|
-
exports.DEFAULT_WEB_RUNTIME_LOCALE = "en";
|
|
57
|
-
function resolveWebRuntimeLocale(input) {
|
|
58
|
-
if (typeof input !== "string")
|
|
59
|
-
return exports.DEFAULT_WEB_RUNTIME_LOCALE;
|
|
60
|
-
const normalized = input.trim().toLowerCase();
|
|
61
|
-
return normalized.startsWith("zh") ? "zh" : "en";
|
|
62
|
-
}
|
|
63
|
-
function getWebRuntimeMessages(input) {
|
|
64
|
-
return exports.WEB_RUNTIME_MESSAGES[resolveWebRuntimeLocale(input)];
|
|
65
|
-
}
|
package/dist/web/navigation.d.ts
DELETED
package/dist/web/navigation.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.normalizeMarkdownRouteTarget = normalizeMarkdownRouteTarget;
|
|
4
|
-
exports.resolveTargetValue = resolveTargetValue;
|
|
5
|
-
exports.getNavigationRuntimeSource = getNavigationRuntimeSource;
|
|
6
|
-
function normalizeMarkdownRouteTarget(target, baseOrigin) {
|
|
7
|
-
if (typeof target !== "string" || target.length === 0) {
|
|
8
|
-
return null;
|
|
9
|
-
}
|
|
10
|
-
if (/^https?:\/\//i.test(target)) {
|
|
11
|
-
return target;
|
|
12
|
-
}
|
|
13
|
-
const url = new URL(target, baseOrigin);
|
|
14
|
-
if (!/\.md$/i.test(url.pathname)) {
|
|
15
|
-
return url.pathname + url.search + url.hash;
|
|
16
|
-
}
|
|
17
|
-
if (url.pathname === "/index.md") {
|
|
18
|
-
return "/" + url.search + url.hash;
|
|
19
|
-
}
|
|
20
|
-
const stripped = url.pathname.slice(0, -3);
|
|
21
|
-
const routePath = stripped.endsWith("/index") ? stripped.slice(0, -6) || "/" : stripped;
|
|
22
|
-
return routePath + url.search + url.hash;
|
|
23
|
-
}
|
|
24
|
-
function resolveTargetValue(value) {
|
|
25
|
-
return typeof value === "string" && value.length > 0 ? value : null;
|
|
26
|
-
}
|
|
27
|
-
function getNavigationRuntimeSource() {
|
|
28
|
-
return [
|
|
29
|
-
normalizeMarkdownRouteTarget.toString(),
|
|
30
|
-
resolveTargetValue.toString(),
|
|
31
|
-
].join("\n\n");
|
|
32
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { DocumentDefinition } from "../core/model/document";
|
|
2
|
-
export interface PageBootstrap extends DocumentDefinition {
|
|
3
|
-
version: "vNext";
|
|
4
|
-
inputState: Record<string, unknown>;
|
|
5
|
-
}
|
|
6
|
-
export declare function createPageBootstrap(document: DocumentDefinition): PageBootstrap;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createPageBootstrap = createPageBootstrap;
|
|
4
|
-
function getInitialInputValue(type) {
|
|
5
|
-
if (type === "boolean") {
|
|
6
|
-
return false;
|
|
7
|
-
}
|
|
8
|
-
if (type === "number") {
|
|
9
|
-
return null;
|
|
10
|
-
}
|
|
11
|
-
return "";
|
|
12
|
-
}
|
|
13
|
-
function createPageBootstrap(document) {
|
|
14
|
-
const inputState = {};
|
|
15
|
-
for (const block of document.blocks) {
|
|
16
|
-
for (const input of block.inputs) {
|
|
17
|
-
inputState[input.id] = getInitialInputValue(input.type);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return {
|
|
21
|
-
version: "vNext",
|
|
22
|
-
frontmatter: document.frontmatter,
|
|
23
|
-
markdown: document.markdown,
|
|
24
|
-
blocks: document.blocks,
|
|
25
|
-
blockAnchors: document.blockAnchors,
|
|
26
|
-
inputState,
|
|
27
|
-
};
|
|
28
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.applyActionResultToPageHtml = applyActionResultToPageHtml;
|
|
4
|
-
const block_runtime_1 = require("./block-runtime");
|
|
5
|
-
function applyActionResultToPageHtml(currentHtml, blockName, result) {
|
|
6
|
-
return (0, block_runtime_1.replaceBlockRegionMarkup)(currentHtml, blockName, result.html);
|
|
7
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function getPageClientRuntimeScript(): string;
|