machinalayout 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +280 -49
- package/dist/chunk-BJOQRPPX.js +382 -0
- package/dist/chunk-HU6XYOH7.js +133 -0
- package/dist/chunk-KYWOCAHK.js +205 -0
- package/dist/chunk-RJYRJ3LD.js +0 -0
- package/dist/chunk-TR24ERZT.js +66 -0
- package/dist/dispatch/index.d.ts +49 -0
- package/dist/dispatch/index.js +217 -0
- package/dist/index.d.ts +15 -238
- package/dist/index.js +596 -591
- package/dist/react/index.d.ts +33 -0
- package/dist/react/index.js +7 -0
- package/dist/react-native/index.d.ts +30 -0
- package/dist/react-native/index.js +83 -0
- package/dist/text/index.d.ts +10 -0
- package/dist/text/index.js +9 -0
- package/dist/text/react/index.d.ts +14 -0
- package/dist/text/react/index.js +7 -0
- package/dist/text/react-native/index.d.ts +16 -0
- package/dist/text/react-native/index.js +155 -0
- package/dist/text/vue/index.d.ts +113 -0
- package/dist/text/vue/index.js +202 -0
- package/dist/types-BudfpzZX.d.ts +184 -0
- package/dist/types-C4poVJpR.d.ts +74 -0
- package/dist/vue/index.d.ts +173 -0
- package/dist/vue/index.js +111 -0
- package/docs/adapter-packaging-a0-plan.md +352 -0
- package/docs/adapters.md +19 -0
- package/docs/api-coherence-m8-audit.md +397 -0
- package/docs/error-codes.md +84 -0
- package/docs/grid-arrange-m5a-contract.md +480 -0
- package/docs/grid-arrange.md +51 -0
- package/docs/layout-interpolation.md +52 -0
- package/docs/machina-dispatch-d0-contract.md +496 -0
- package/docs/machina-dispatch.md +143 -0
- package/docs/named-layers.md +40 -0
- package/docs/react-adapter.md +51 -69
- package/docs/react-native-adapter.md +56 -0
- package/docs/react-native-text-renderer.md +50 -0
- package/docs/reference-alignment-m7a-contract.md +384 -0
- package/docs/reference-alignment.md +44 -0
- package/docs/responsive-variants.md +54 -0
- package/docs/vue-adapter.md +55 -0
- package/docs/vue-text-renderer.md +55 -0
- package/package.json +60 -5
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { b as ResolvedLayoutDocument, N as NodeId, R as Rect, a as ResolvedLayoutNode } from '../types-BudfpzZX.js';
|
|
3
|
+
|
|
4
|
+
type MachinaSlotProps<TViewData = unknown, TNodeData = unknown> = {
|
|
5
|
+
id: NodeId;
|
|
6
|
+
rect: Rect;
|
|
7
|
+
debugLabel?: string;
|
|
8
|
+
node: ResolvedLayoutNode;
|
|
9
|
+
viewKey?: string;
|
|
10
|
+
viewData?: TViewData;
|
|
11
|
+
nodeData?: TNodeData;
|
|
12
|
+
};
|
|
13
|
+
type MachinaRenderLayer = {
|
|
14
|
+
z: number;
|
|
15
|
+
};
|
|
16
|
+
type MachinaReactViewProps = {
|
|
17
|
+
layout: ResolvedLayoutDocument;
|
|
18
|
+
views?: Record<string, React.ComponentType<MachinaSlotProps>>;
|
|
19
|
+
viewData?: Record<string, unknown>;
|
|
20
|
+
nodeData?: Record<NodeId, unknown>;
|
|
21
|
+
className?: string;
|
|
22
|
+
style?: React.CSSProperties;
|
|
23
|
+
nodeClassName?: string;
|
|
24
|
+
debug?: boolean;
|
|
25
|
+
nodeContainment?: "none" | "layout-paint" | "strict";
|
|
26
|
+
nodeContentVisibility?: "none" | "auto";
|
|
27
|
+
nodeContainIntrinsicSize?: string;
|
|
28
|
+
layers?: Record<string, MachinaRenderLayer>;
|
|
29
|
+
defaultLayer?: string;
|
|
30
|
+
};
|
|
31
|
+
declare function MachinaReactView(props: MachinaReactViewProps): React.JSX.Element;
|
|
32
|
+
|
|
33
|
+
export { MachinaReactView, type MachinaReactViewProps, type MachinaSlotProps };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
import { N as NodeId, R as Rect, a as ResolvedLayoutNode, b as ResolvedLayoutDocument } from '../types-BudfpzZX.js';
|
|
4
|
+
|
|
5
|
+
type MachinaNativeSlotProps<TViewData = unknown, TNodeData = unknown> = {
|
|
6
|
+
id: NodeId;
|
|
7
|
+
rect: Rect;
|
|
8
|
+
debugLabel?: string;
|
|
9
|
+
node: ResolvedLayoutNode;
|
|
10
|
+
viewKey?: string;
|
|
11
|
+
viewData?: TViewData;
|
|
12
|
+
nodeData?: TNodeData;
|
|
13
|
+
};
|
|
14
|
+
type MachinaReactNativeLayer = {
|
|
15
|
+
z: number;
|
|
16
|
+
};
|
|
17
|
+
type MachinaReactNativeViewProps = {
|
|
18
|
+
layout: ResolvedLayoutDocument;
|
|
19
|
+
views?: Record<string, React.ComponentType<MachinaNativeSlotProps>>;
|
|
20
|
+
viewData?: Record<string, unknown>;
|
|
21
|
+
nodeData?: Record<NodeId, unknown>;
|
|
22
|
+
layers?: Record<string, MachinaReactNativeLayer>;
|
|
23
|
+
defaultLayer?: string;
|
|
24
|
+
debug?: boolean;
|
|
25
|
+
style?: StyleProp<ViewStyle>;
|
|
26
|
+
nodeStyle?: StyleProp<ViewStyle>;
|
|
27
|
+
};
|
|
28
|
+
declare function MachinaReactNativeView(props: MachinaReactNativeViewProps): React.ReactElement;
|
|
29
|
+
|
|
30
|
+
export { type MachinaNativeSlotProps, type MachinaReactNativeLayer, MachinaReactNativeView, type MachinaReactNativeViewProps };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import {
|
|
2
|
+
toResolvedTree
|
|
3
|
+
} from "../chunk-TR24ERZT.js";
|
|
4
|
+
|
|
5
|
+
// src/react-native/MachinaReactNativeView.tsx
|
|
6
|
+
import React from "react";
|
|
7
|
+
import { Text, View } from "react-native";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
function normalizeLayerZ(value) {
|
|
10
|
+
if (value === void 0 || !Number.isFinite(value)) return 0;
|
|
11
|
+
return value;
|
|
12
|
+
}
|
|
13
|
+
function getLayerZ(node, layers, defaultLayer) {
|
|
14
|
+
return normalizeLayerZ(layers[node.layer ?? defaultLayer]?.z);
|
|
15
|
+
}
|
|
16
|
+
function renderNode(node, parentRect, props) {
|
|
17
|
+
const left = node.rect.x - parentRect.x;
|
|
18
|
+
const top = node.rect.y - parentRect.y;
|
|
19
|
+
const viewKey = node.view ?? node.slot;
|
|
20
|
+
const ViewComponent = viewKey ? props.views[viewKey] : void 0;
|
|
21
|
+
const layerZ = getLayerZ(node, props.layers, props.defaultLayer);
|
|
22
|
+
const nodeZ = node.z ?? 0;
|
|
23
|
+
return /* @__PURE__ */ jsxs(
|
|
24
|
+
View,
|
|
25
|
+
{
|
|
26
|
+
testID: `machina-node-${node.id}`,
|
|
27
|
+
style: [
|
|
28
|
+
{
|
|
29
|
+
position: "absolute",
|
|
30
|
+
left,
|
|
31
|
+
top,
|
|
32
|
+
width: node.rect.width,
|
|
33
|
+
height: node.rect.height,
|
|
34
|
+
zIndex: layerZ * 100 + nodeZ
|
|
35
|
+
},
|
|
36
|
+
props.debug ? { borderWidth: 1, borderColor: "rgba(59, 130, 246, 0.9)" } : null,
|
|
37
|
+
props.nodeStyle
|
|
38
|
+
],
|
|
39
|
+
children: [
|
|
40
|
+
props.debug ? /* @__PURE__ */ jsx(Text, { children: node.debugLabel ?? node.id }) : null,
|
|
41
|
+
ViewComponent && props.nodes[node.id] && viewKey ? React.createElement(ViewComponent, {
|
|
42
|
+
id: node.id,
|
|
43
|
+
rect: { ...node.rect },
|
|
44
|
+
debugLabel: node.debugLabel,
|
|
45
|
+
node: { ...props.nodes[node.id], rect: { ...props.nodes[node.id].rect } },
|
|
46
|
+
viewKey,
|
|
47
|
+
viewData: props.viewData?.[viewKey],
|
|
48
|
+
nodeData: props.nodeData?.[node.id]
|
|
49
|
+
}) : null,
|
|
50
|
+
[...node.children].map((child, index) => ({ child, index })).sort(
|
|
51
|
+
(a, b) => getLayerZ(a.child, props.layers, props.defaultLayer) - getLayerZ(b.child, props.layers, props.defaultLayer) || (a.child.z ?? 0) - (b.child.z ?? 0) || a.index - b.index
|
|
52
|
+
).map(({ child }) => renderNode(child, node.rect, props))
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
node.id
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
function MachinaReactNativeView(props) {
|
|
59
|
+
const tree = toResolvedTree(props.layout);
|
|
60
|
+
return /* @__PURE__ */ jsx(
|
|
61
|
+
View,
|
|
62
|
+
{
|
|
63
|
+
testID: "machina-root-wrapper",
|
|
64
|
+
style: [
|
|
65
|
+
{ position: "relative", width: tree.rect.width, height: tree.rect.height },
|
|
66
|
+
props.style
|
|
67
|
+
],
|
|
68
|
+
children: renderNode(tree, tree.rect, {
|
|
69
|
+
views: props.views ?? {},
|
|
70
|
+
viewData: props.viewData,
|
|
71
|
+
nodeData: props.nodeData,
|
|
72
|
+
nodes: props.layout.nodes,
|
|
73
|
+
layers: props.layers ?? { base: { z: 0 } },
|
|
74
|
+
defaultLayer: props.defaultLayer ?? "base",
|
|
75
|
+
debug: props.debug,
|
|
76
|
+
nodeStyle: props.nodeStyle
|
|
77
|
+
})
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
export {
|
|
82
|
+
MachinaReactNativeView
|
|
83
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { a as MachinaTextSource, P as ParseMachinaTextResult, d as MachinaInline, g as MachinaTextDiagnostic } from '../types-C4poVJpR.js';
|
|
2
|
+
export { c as MachinaBulletItem, e as MachinaTextAlign, f as MachinaTextBlock, h as MachinaTextDiagnosticCode, i as MachinaTextDiagnosticLevel, b as MachinaTextDocument, j as MachinaTextLeading, k as MachinaTextOverflow, M as MachinaTextSpec, l as MachinaTextVariant, m as MachinaTextVerticalAlign, n as MachinaTextWrap } from '../types-C4poVJpR.js';
|
|
3
|
+
|
|
4
|
+
declare function parseMachinaTextInline(text: string): {
|
|
5
|
+
inline: MachinaInline[];
|
|
6
|
+
diagnostics: MachinaTextDiagnostic[];
|
|
7
|
+
};
|
|
8
|
+
declare function parseMachinaText(source: MachinaTextSource | string): ParseMachinaTextResult;
|
|
9
|
+
|
|
10
|
+
export { MachinaInline, MachinaTextDiagnostic, MachinaTextSource, ParseMachinaTextResult, parseMachinaText, parseMachinaTextInline };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { M as MachinaTextSpec, a as MachinaTextSource, b as MachinaTextDocument } from '../../types-C4poVJpR.js';
|
|
3
|
+
|
|
4
|
+
type MachinaTextViewProps = {
|
|
5
|
+
text: MachinaTextSpec | MachinaTextSource | MachinaTextDocument | string;
|
|
6
|
+
className?: string;
|
|
7
|
+
style?: React.CSSProperties;
|
|
8
|
+
linkTarget?: React.HTMLAttributeAnchorTarget;
|
|
9
|
+
onLinkClick?: (href: string, event: React.MouseEvent<HTMLAnchorElement>) => void;
|
|
10
|
+
showDiagnostics?: boolean;
|
|
11
|
+
};
|
|
12
|
+
declare function MachinaTextView(props: MachinaTextViewProps): React.JSX.Element;
|
|
13
|
+
|
|
14
|
+
export { MachinaTextView, type MachinaTextViewProps };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleProp, TextStyle, ViewStyle } from 'react-native';
|
|
3
|
+
import { M as MachinaTextSpec, a as MachinaTextSource, b as MachinaTextDocument } from '../../types-C4poVJpR.js';
|
|
4
|
+
|
|
5
|
+
type MachinaNativeTextViewProps = {
|
|
6
|
+
text: MachinaTextSpec | MachinaTextSource | MachinaTextDocument | string;
|
|
7
|
+
style?: StyleProp<TextStyle>;
|
|
8
|
+
contentStyle?: StyleProp<ViewStyle>;
|
|
9
|
+
linkStyle?: StyleProp<TextStyle>;
|
|
10
|
+
codeStyle?: StyleProp<TextStyle>;
|
|
11
|
+
onLinkPress?: (href: string) => void;
|
|
12
|
+
showDiagnostics?: boolean;
|
|
13
|
+
};
|
|
14
|
+
declare function MachinaNativeTextView(props: MachinaNativeTextViewProps): React.ReactElement;
|
|
15
|
+
|
|
16
|
+
export { MachinaNativeTextView, type MachinaNativeTextViewProps };
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import {
|
|
2
|
+
parseMachinaText
|
|
3
|
+
} from "../../chunk-BJOQRPPX.js";
|
|
4
|
+
|
|
5
|
+
// src/text/react-native/MachinaNativeTextView.tsx
|
|
6
|
+
import React from "react";
|
|
7
|
+
import { Text, View } from "react-native";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
var DEFAULT_POLICY = {
|
|
10
|
+
variant: "body",
|
|
11
|
+
wrap: "word",
|
|
12
|
+
overflow: "clip",
|
|
13
|
+
align: "start",
|
|
14
|
+
leading: "normal",
|
|
15
|
+
blockGap: 8,
|
|
16
|
+
listGap: 2,
|
|
17
|
+
valign: "top"
|
|
18
|
+
};
|
|
19
|
+
var VARIANT_STYLE = {
|
|
20
|
+
body: { fontSize: 14, fontWeight: "400" },
|
|
21
|
+
label: { fontSize: 12, fontWeight: "500" },
|
|
22
|
+
caption: { fontSize: 11, fontWeight: "400", opacity: 0.8 },
|
|
23
|
+
title: { fontSize: 18, fontWeight: "700" },
|
|
24
|
+
mono: { fontSize: 12, fontFamily: "monospace" }
|
|
25
|
+
};
|
|
26
|
+
var isDoc = (v) => typeof v === "object" && v !== null && "blocks" in v;
|
|
27
|
+
var isSpec = (v) => typeof v === "object" && v !== null && "kind" in v && v.kind === "text";
|
|
28
|
+
var normalizePositive = (v, f) => typeof v === "number" && Number.isFinite(v) && v > 0 ? v : f;
|
|
29
|
+
var normalizeNonNegative = (v, f) => typeof v === "number" && Number.isFinite(v) && v >= 0 ? v : f;
|
|
30
|
+
function resolveLeadingMultiplier(policy) {
|
|
31
|
+
if (policy.leading === "tight") return 1.15;
|
|
32
|
+
if (policy.leading === "loose") return 1.6;
|
|
33
|
+
if (typeof policy.leading === "number") return policy.leading;
|
|
34
|
+
if (policy.variant === "body") return 1.4;
|
|
35
|
+
if (policy.variant === "label") return 1.3;
|
|
36
|
+
if (policy.variant === "caption") return 1.25;
|
|
37
|
+
if (policy.variant === "title") return 1.25;
|
|
38
|
+
return 1.35;
|
|
39
|
+
}
|
|
40
|
+
function normalizeLeading(value) {
|
|
41
|
+
if (value === void 0) return DEFAULT_POLICY.leading;
|
|
42
|
+
if (value === "tight" || value === "normal" || value === "loose") return value;
|
|
43
|
+
return normalizePositive(value, resolveLeadingMultiplier(DEFAULT_POLICY));
|
|
44
|
+
}
|
|
45
|
+
function normalizeText(text) {
|
|
46
|
+
if (isDoc(text)) return { document: text, diagnostics: [], policy: DEFAULT_POLICY };
|
|
47
|
+
if (isSpec(text)) {
|
|
48
|
+
const result2 = parseMachinaText(text.source);
|
|
49
|
+
return {
|
|
50
|
+
document: result2.document,
|
|
51
|
+
diagnostics: result2.diagnostics,
|
|
52
|
+
policy: {
|
|
53
|
+
variant: text.variant ?? DEFAULT_POLICY.variant,
|
|
54
|
+
wrap: text.wrap ?? DEFAULT_POLICY.wrap,
|
|
55
|
+
overflow: text.overflow ?? DEFAULT_POLICY.overflow,
|
|
56
|
+
align: text.align ?? DEFAULT_POLICY.align,
|
|
57
|
+
leading: normalizeLeading(text.leading),
|
|
58
|
+
blockGap: normalizeNonNegative(text.blockGap, DEFAULT_POLICY.blockGap),
|
|
59
|
+
listGap: normalizeNonNegative(text.listGap, DEFAULT_POLICY.listGap),
|
|
60
|
+
valign: text.valign ?? DEFAULT_POLICY.valign
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
const result = parseMachinaText(typeof text === "string" ? { kind: "machina-text", text } : text);
|
|
65
|
+
return { document: result.document, diagnostics: result.diagnostics, policy: DEFAULT_POLICY };
|
|
66
|
+
}
|
|
67
|
+
function textStyle(policy) {
|
|
68
|
+
const base = VARIANT_STYLE[policy.variant];
|
|
69
|
+
const fontSize = base.fontSize ?? 14;
|
|
70
|
+
return {
|
|
71
|
+
...base,
|
|
72
|
+
lineHeight: fontSize * resolveLeadingMultiplier(policy),
|
|
73
|
+
textAlign: policy.align === "center" ? "center" : policy.align === "end" ? "right" : "left"
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
var pProps = (policy) => policy.overflow === "ellipsis" ? { numberOfLines: 1, ellipsizeMode: "tail" } : policy.wrap === "none" ? { numberOfLines: 1 } : {};
|
|
77
|
+
function renderInline(inline, key, props) {
|
|
78
|
+
switch (inline.kind) {
|
|
79
|
+
case "text":
|
|
80
|
+
return /* @__PURE__ */ jsx(React.Fragment, { children: inline.text }, key);
|
|
81
|
+
case "strong":
|
|
82
|
+
return /* @__PURE__ */ jsx(Text, { style: { fontWeight: "700" }, children: inline.children.map((c, i) => renderInline(c, `${key}-s-${i}`, props)) }, key);
|
|
83
|
+
case "emphasis":
|
|
84
|
+
return /* @__PURE__ */ jsx(Text, { style: { fontStyle: "italic" }, children: inline.children.map((c, i) => renderInline(c, `${key}-e-${i}`, props)) }, key);
|
|
85
|
+
case "code":
|
|
86
|
+
return /* @__PURE__ */ jsx(Text, { style: [{ fontFamily: "monospace" }, props.codeStyle], children: inline.text }, key);
|
|
87
|
+
case "link":
|
|
88
|
+
return /* @__PURE__ */ jsx(
|
|
89
|
+
Text,
|
|
90
|
+
{
|
|
91
|
+
style: [{ textDecorationLine: "underline", color: "#2563eb" }, props.linkStyle],
|
|
92
|
+
onPress: () => props.onLinkPress?.(inline.href),
|
|
93
|
+
children: inline.children.map((c, i) => renderInline(c, `${key}-l-${i}`, props))
|
|
94
|
+
},
|
|
95
|
+
key
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function renderBullet(item, path, props, policy, depth) {
|
|
100
|
+
return /* @__PURE__ */ jsxs(View, { style: { marginBottom: policy.listGap, marginLeft: depth * 12 }, children: [
|
|
101
|
+
/* @__PURE__ */ jsxs(View, { style: { flexDirection: "row", alignItems: "flex-start" }, children: [
|
|
102
|
+
/* @__PURE__ */ jsx(Text, { style: textStyle(policy), children: "\u2022 " }),
|
|
103
|
+
/* @__PURE__ */ jsx(Text, { style: [{ flexShrink: 1 }, textStyle(policy)], ...pProps(policy), children: item.inline.map((i, idx) => renderInline(i, `${path}-i-${idx}`, props)) })
|
|
104
|
+
] }),
|
|
105
|
+
item.children?.map(
|
|
106
|
+
(child, idx) => renderBullet(child, `${path}-c-${idx}`, props, policy, depth + 1)
|
|
107
|
+
)
|
|
108
|
+
] }, path);
|
|
109
|
+
}
|
|
110
|
+
function MachinaNativeTextView(props) {
|
|
111
|
+
const normalized = normalizeText(props.text);
|
|
112
|
+
const justifyContent = normalized.policy.valign === "center" ? "center" : normalized.policy.valign === "bottom" ? "flex-end" : "flex-start";
|
|
113
|
+
return /* @__PURE__ */ jsx(View, { style: [{ width: "100%", height: "100%", justifyContent }, props.contentStyle], children: /* @__PURE__ */ jsxs(View, { style: { minWidth: 0 }, children: [
|
|
114
|
+
normalized.document.blocks.map(
|
|
115
|
+
(block, idx) => block.kind === "paragraph" ? /* @__PURE__ */ jsx(
|
|
116
|
+
Text,
|
|
117
|
+
{
|
|
118
|
+
style: [
|
|
119
|
+
textStyle(normalized.policy),
|
|
120
|
+
idx === normalized.document.blocks.length - 1 ? void 0 : { marginBottom: normalized.policy.blockGap },
|
|
121
|
+
props.style
|
|
122
|
+
],
|
|
123
|
+
...pProps(normalized.policy),
|
|
124
|
+
children: block.inline.map((i, iIdx) => renderInline(i, `b-${idx}-${iIdx}`, props))
|
|
125
|
+
},
|
|
126
|
+
`b-${idx}`
|
|
127
|
+
) : /* @__PURE__ */ jsx(
|
|
128
|
+
View,
|
|
129
|
+
{
|
|
130
|
+
style: idx === normalized.document.blocks.length - 1 ? void 0 : { marginBottom: normalized.policy.blockGap },
|
|
131
|
+
children: block.items.map(
|
|
132
|
+
(item, itemIdx) => renderBullet(item, `b-${idx}-item-${itemIdx}`, props, normalized.policy, 0)
|
|
133
|
+
)
|
|
134
|
+
},
|
|
135
|
+
`b-${idx}`
|
|
136
|
+
)
|
|
137
|
+
),
|
|
138
|
+
props.showDiagnostics && normalized.diagnostics.length > 0 ? /* @__PURE__ */ jsx(
|
|
139
|
+
Text,
|
|
140
|
+
{
|
|
141
|
+
style: {
|
|
142
|
+
marginTop: normalized.policy.blockGap,
|
|
143
|
+
padding: 8,
|
|
144
|
+
fontSize: 11,
|
|
145
|
+
fontFamily: "monospace",
|
|
146
|
+
backgroundColor: "rgba(127, 127, 127, 0.12)"
|
|
147
|
+
},
|
|
148
|
+
children: normalized.diagnostics.map((d) => `${d.code} (${d.line}:${d.column}) ${d.message}`).join("\n")
|
|
149
|
+
}
|
|
150
|
+
) : null
|
|
151
|
+
] }) });
|
|
152
|
+
}
|
|
153
|
+
export {
|
|
154
|
+
MachinaNativeTextView
|
|
155
|
+
};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
import { PropType, StyleValue } from 'vue';
|
|
3
|
+
import { M as MachinaTextSpec, a as MachinaTextSource, b as MachinaTextDocument } from '../../types-C4poVJpR.js';
|
|
4
|
+
|
|
5
|
+
type MachinaVueTextViewProps = {
|
|
6
|
+
text: MachinaTextSpec | MachinaTextSource | MachinaTextDocument | string;
|
|
7
|
+
rootClass?: unknown;
|
|
8
|
+
rootStyle?: StyleValue;
|
|
9
|
+
linkTarget?: string;
|
|
10
|
+
onLinkClick?: (href: string, event: MouseEvent) => void;
|
|
11
|
+
showDiagnostics?: boolean;
|
|
12
|
+
linkClass?: unknown;
|
|
13
|
+
linkStyle?: StyleValue;
|
|
14
|
+
codeClass?: unknown;
|
|
15
|
+
codeStyle?: StyleValue;
|
|
16
|
+
};
|
|
17
|
+
declare const MachinaVueTextView: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
18
|
+
text: {
|
|
19
|
+
type: PropType<MachinaVueTextViewProps["text"]>;
|
|
20
|
+
required: true;
|
|
21
|
+
};
|
|
22
|
+
rootClass: {
|
|
23
|
+
type: PropType<unknown>;
|
|
24
|
+
default: undefined;
|
|
25
|
+
};
|
|
26
|
+
rootStyle: {
|
|
27
|
+
type: PropType<StyleValue>;
|
|
28
|
+
default: undefined;
|
|
29
|
+
};
|
|
30
|
+
linkTarget: {
|
|
31
|
+
type: StringConstructor;
|
|
32
|
+
default: undefined;
|
|
33
|
+
};
|
|
34
|
+
onLinkClick: {
|
|
35
|
+
type: PropType<MachinaVueTextViewProps["onLinkClick"]>;
|
|
36
|
+
default: undefined;
|
|
37
|
+
};
|
|
38
|
+
showDiagnostics: {
|
|
39
|
+
type: BooleanConstructor;
|
|
40
|
+
default: boolean;
|
|
41
|
+
};
|
|
42
|
+
linkClass: {
|
|
43
|
+
type: PropType<unknown>;
|
|
44
|
+
default: undefined;
|
|
45
|
+
};
|
|
46
|
+
linkStyle: {
|
|
47
|
+
type: PropType<StyleValue>;
|
|
48
|
+
default: undefined;
|
|
49
|
+
};
|
|
50
|
+
codeClass: {
|
|
51
|
+
type: PropType<unknown>;
|
|
52
|
+
default: undefined;
|
|
53
|
+
};
|
|
54
|
+
codeStyle: {
|
|
55
|
+
type: PropType<StyleValue>;
|
|
56
|
+
default: undefined;
|
|
57
|
+
};
|
|
58
|
+
}>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
59
|
+
[key: string]: any;
|
|
60
|
+
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
61
|
+
text: {
|
|
62
|
+
type: PropType<MachinaVueTextViewProps["text"]>;
|
|
63
|
+
required: true;
|
|
64
|
+
};
|
|
65
|
+
rootClass: {
|
|
66
|
+
type: PropType<unknown>;
|
|
67
|
+
default: undefined;
|
|
68
|
+
};
|
|
69
|
+
rootStyle: {
|
|
70
|
+
type: PropType<StyleValue>;
|
|
71
|
+
default: undefined;
|
|
72
|
+
};
|
|
73
|
+
linkTarget: {
|
|
74
|
+
type: StringConstructor;
|
|
75
|
+
default: undefined;
|
|
76
|
+
};
|
|
77
|
+
onLinkClick: {
|
|
78
|
+
type: PropType<MachinaVueTextViewProps["onLinkClick"]>;
|
|
79
|
+
default: undefined;
|
|
80
|
+
};
|
|
81
|
+
showDiagnostics: {
|
|
82
|
+
type: BooleanConstructor;
|
|
83
|
+
default: boolean;
|
|
84
|
+
};
|
|
85
|
+
linkClass: {
|
|
86
|
+
type: PropType<unknown>;
|
|
87
|
+
default: undefined;
|
|
88
|
+
};
|
|
89
|
+
linkStyle: {
|
|
90
|
+
type: PropType<StyleValue>;
|
|
91
|
+
default: undefined;
|
|
92
|
+
};
|
|
93
|
+
codeClass: {
|
|
94
|
+
type: PropType<unknown>;
|
|
95
|
+
default: undefined;
|
|
96
|
+
};
|
|
97
|
+
codeStyle: {
|
|
98
|
+
type: PropType<StyleValue>;
|
|
99
|
+
default: undefined;
|
|
100
|
+
};
|
|
101
|
+
}>> & Readonly<{}>, {
|
|
102
|
+
onLinkClick: ((href: string, event: MouseEvent) => void) | undefined;
|
|
103
|
+
rootClass: undefined;
|
|
104
|
+
rootStyle: StyleValue;
|
|
105
|
+
linkTarget: string;
|
|
106
|
+
showDiagnostics: boolean;
|
|
107
|
+
linkClass: undefined;
|
|
108
|
+
linkStyle: StyleValue;
|
|
109
|
+
codeClass: undefined;
|
|
110
|
+
codeStyle: StyleValue;
|
|
111
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
112
|
+
|
|
113
|
+
export { MachinaVueTextView, type MachinaVueTextViewProps };
|