@flaier/core 0.1.1
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/LICENSE +21 -0
- package/README.md +41 -0
- package/dist/catalog.d.ts +1520 -0
- package/dist/code-node-sizing.d.ts +3 -0
- package/dist/components/Flaier.vue.d.ts +20 -0
- package/dist/components/FlaierPanel.vue.d.ts +10 -0
- package/dist/components/controls/TimelineControls.vue.d.ts +31 -0
- package/dist/components/edges/ArchitectureSmoothEdge.vue.d.ts +6 -0
- package/dist/components/nodes/ArchitectureNode.vue.d.ts +24 -0
- package/dist/components/nodes/CodeNode.vue.d.ts +28 -0
- package/dist/components/nodes/DecisionNode.vue.d.ts +12 -0
- package/dist/components/nodes/DescriptionNode.vue.d.ts +11 -0
- package/dist/components/nodes/ErrorNode.vue.d.ts +14 -0
- package/dist/components/nodes/LinkNode.vue.d.ts +12 -0
- package/dist/components/nodes/NodeSourceAnchor.vue.d.ts +6 -0
- package/dist/components/nodes/PayloadNode.vue.d.ts +17 -0
- package/dist/components/nodes/TriggerNode.vue.d.ts +14 -0
- package/dist/components/renderer/FlowTimelineRenderer.vue.d.ts +33 -0
- package/dist/composables/useDiagramExport.d.ts +15 -0
- package/dist/composables/useFlaierFullscreen.d.ts +5 -0
- package/dist/composables/useFlaierRuntime.d.ts +1 -0
- package/dist/composables/useShiki.d.ts +10 -0
- package/dist/composables/useTimeline.d.ts +20 -0
- package/dist/context.d.ts +11 -0
- package/dist/custom-nodes.d.ts +11 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +5680 -0
- package/dist/index.js.map +1 -0
- package/dist/index.unstyled.d.ts +12 -0
- package/dist/registry.d.ts +488 -0
- package/dist/style.css +2654 -0
- package/dist/twoslash.d.ts +10 -0
- package/dist/types.d.ts +291 -0
- package/package.json +75 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type SupportedTwoslashLanguage = "ts" | "tsx";
|
|
2
|
+
export interface TwoslashHtml {
|
|
3
|
+
dark?: string;
|
|
4
|
+
light?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function hasTwoslashHints(code: string): boolean;
|
|
7
|
+
export declare function normalizeTwoslashLanguage(language?: string): SupportedTwoslashLanguage | null;
|
|
8
|
+
export declare function normalizeTwoslashHtml(value: unknown): TwoslashHtml | undefined;
|
|
9
|
+
export declare function hasTwoslashHtml(value: TwoslashHtml | undefined): boolean;
|
|
10
|
+
export declare function resolveTwoslashHtmlForTheme(value: TwoslashHtml | undefined, theme: "dark" | "light"): string;
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
import type { Node, Edge } from "@vue-flow/core";
|
|
2
|
+
import type { Component } from "vue";
|
|
3
|
+
import type { ZodTypeAny } from "zod";
|
|
4
|
+
/** A single code beat for magic-move animation with optional narration metadata */
|
|
5
|
+
export interface MagicMoveStep {
|
|
6
|
+
code: string;
|
|
7
|
+
title?: string;
|
|
8
|
+
comment?: string;
|
|
9
|
+
story?: string;
|
|
10
|
+
speaker?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface TwoslashHtml {
|
|
13
|
+
dark?: string;
|
|
14
|
+
light?: string;
|
|
15
|
+
}
|
|
16
|
+
/** Optional metadata for traversal edges between nodes */
|
|
17
|
+
export type EdgeTransitionKind = "default" | "success" | "error" | "warning" | "retry" | "async";
|
|
18
|
+
/** Declarative edge metadata for branch labels and styling */
|
|
19
|
+
export interface EdgeTransition {
|
|
20
|
+
to: string;
|
|
21
|
+
label?: string;
|
|
22
|
+
description?: string;
|
|
23
|
+
kind?: EdgeTransitionKind;
|
|
24
|
+
protocol?: string;
|
|
25
|
+
transport?: "sync" | "async";
|
|
26
|
+
auth?: string;
|
|
27
|
+
contract?: string;
|
|
28
|
+
criticality?: "low" | "medium" | "high";
|
|
29
|
+
}
|
|
30
|
+
/** Structured node source anchor */
|
|
31
|
+
export interface SourceAnchor {
|
|
32
|
+
path: string;
|
|
33
|
+
line?: number;
|
|
34
|
+
column?: number;
|
|
35
|
+
label?: string;
|
|
36
|
+
href?: string;
|
|
37
|
+
}
|
|
38
|
+
/** Source anchor can be a compact string or structured object */
|
|
39
|
+
export type SourceAnchorInput = string | SourceAnchor;
|
|
40
|
+
/** Architectural zone/group container metadata */
|
|
41
|
+
export interface ArchitectureZone {
|
|
42
|
+
id: string;
|
|
43
|
+
label: string;
|
|
44
|
+
description?: string;
|
|
45
|
+
color?: string;
|
|
46
|
+
padding?: number;
|
|
47
|
+
}
|
|
48
|
+
/** Architecture interface contract metadata */
|
|
49
|
+
export interface ArchitectureInterface {
|
|
50
|
+
name: string;
|
|
51
|
+
protocol?: string;
|
|
52
|
+
direction?: "inbound" | "outbound" | "bidirectional";
|
|
53
|
+
contract?: string;
|
|
54
|
+
auth?: string;
|
|
55
|
+
notes?: string;
|
|
56
|
+
}
|
|
57
|
+
/** Architecture data asset metadata */
|
|
58
|
+
export interface ArchitectureDataAsset {
|
|
59
|
+
name: string;
|
|
60
|
+
kind?: string;
|
|
61
|
+
classification?: "public" | "internal" | "confidential" | "restricted";
|
|
62
|
+
retention?: string;
|
|
63
|
+
notes?: string;
|
|
64
|
+
}
|
|
65
|
+
/** Architecture security metadata */
|
|
66
|
+
export interface ArchitectureSecurity {
|
|
67
|
+
auth?: string;
|
|
68
|
+
encryption?: string;
|
|
69
|
+
pii?: boolean;
|
|
70
|
+
threatModel?: string;
|
|
71
|
+
}
|
|
72
|
+
/** Architecture operations metadata */
|
|
73
|
+
export interface ArchitectureOperations {
|
|
74
|
+
owner?: string;
|
|
75
|
+
slo?: string;
|
|
76
|
+
alert?: string;
|
|
77
|
+
runbook?: string;
|
|
78
|
+
}
|
|
79
|
+
/** Architecture reference links */
|
|
80
|
+
export interface ArchitectureLink {
|
|
81
|
+
label: string;
|
|
82
|
+
href: string;
|
|
83
|
+
}
|
|
84
|
+
/** Props for the FlowTimeline root element */
|
|
85
|
+
export interface FlowTimelineProps {
|
|
86
|
+
title: string;
|
|
87
|
+
description?: string;
|
|
88
|
+
mode?: "narrative" | "architecture";
|
|
89
|
+
zones?: ArchitectureZone[];
|
|
90
|
+
direction?: "horizontal" | "vertical";
|
|
91
|
+
minHeight?: number;
|
|
92
|
+
layoutEngine?: "dagre" | "manual";
|
|
93
|
+
layoutRankSep?: number;
|
|
94
|
+
layoutNodeSep?: number;
|
|
95
|
+
layoutEdgeSep?: number;
|
|
96
|
+
themeMode?: "local" | "document";
|
|
97
|
+
showHeaderOverlay?: boolean;
|
|
98
|
+
showExportControls?: boolean;
|
|
99
|
+
showThemeToggle?: boolean;
|
|
100
|
+
showArchitectureInspector?: boolean;
|
|
101
|
+
defaultArchitectureInspectorOpen?: boolean;
|
|
102
|
+
showArchitectureInspectorToggleText?: boolean;
|
|
103
|
+
}
|
|
104
|
+
/** Props for architecture/infrastructure nodes */
|
|
105
|
+
export interface ArchitectureNodeProps {
|
|
106
|
+
label: string;
|
|
107
|
+
kind?: "service" | "database" | "queue" | "cache" | "gateway" | "external" | "compute";
|
|
108
|
+
technology?: string;
|
|
109
|
+
runtime?: string;
|
|
110
|
+
owner?: string;
|
|
111
|
+
tier?: "edge" | "application" | "integration" | "data" | "platform" | "external";
|
|
112
|
+
status?: "planned" | "active" | "degraded" | "retired";
|
|
113
|
+
zone?: string;
|
|
114
|
+
description?: string;
|
|
115
|
+
tags?: string[];
|
|
116
|
+
responsibilities?: string[];
|
|
117
|
+
capabilities?: string[];
|
|
118
|
+
interfaces?: ArchitectureInterface[];
|
|
119
|
+
data?: ArchitectureDataAsset[];
|
|
120
|
+
security?: ArchitectureSecurity;
|
|
121
|
+
operations?: ArchitectureOperations;
|
|
122
|
+
links?: ArchitectureLink[];
|
|
123
|
+
sourceAnchor?: SourceAnchorInput;
|
|
124
|
+
transitions?: EdgeTransition[];
|
|
125
|
+
}
|
|
126
|
+
/** Props for trigger/entry-point nodes */
|
|
127
|
+
export interface TriggerNodeProps {
|
|
128
|
+
label: string;
|
|
129
|
+
description?: string;
|
|
130
|
+
color?: string;
|
|
131
|
+
sourceAnchor?: SourceAnchorInput;
|
|
132
|
+
transitions?: EdgeTransition[];
|
|
133
|
+
}
|
|
134
|
+
/** Props for code block nodes */
|
|
135
|
+
export interface CodeNodeProps {
|
|
136
|
+
label: string;
|
|
137
|
+
file?: string;
|
|
138
|
+
sourceAnchor?: SourceAnchorInput;
|
|
139
|
+
language?: string;
|
|
140
|
+
code: string;
|
|
141
|
+
comment?: string;
|
|
142
|
+
story?: string;
|
|
143
|
+
wrapLongLines?: boolean;
|
|
144
|
+
magicMoveSteps?: MagicMoveStep[];
|
|
145
|
+
twoslash?: boolean;
|
|
146
|
+
twoslashHtml?: TwoslashHtml;
|
|
147
|
+
transitions?: EdgeTransition[];
|
|
148
|
+
}
|
|
149
|
+
/** Props for branch/decision nodes */
|
|
150
|
+
export interface DecisionNodeProps {
|
|
151
|
+
label: string;
|
|
152
|
+
condition?: string;
|
|
153
|
+
description?: string;
|
|
154
|
+
sourceAnchor?: SourceAnchorInput;
|
|
155
|
+
transitions?: EdgeTransition[];
|
|
156
|
+
}
|
|
157
|
+
/** Props for payload snapshot/diff nodes */
|
|
158
|
+
export interface PayloadNodeProps {
|
|
159
|
+
label: string;
|
|
160
|
+
payload?: string;
|
|
161
|
+
before?: string;
|
|
162
|
+
after?: string;
|
|
163
|
+
format?: "json" | "yaml" | "text";
|
|
164
|
+
description?: string;
|
|
165
|
+
sourceAnchor?: SourceAnchorInput;
|
|
166
|
+
transitions?: EdgeTransition[];
|
|
167
|
+
}
|
|
168
|
+
/** Props for failure/error handling nodes */
|
|
169
|
+
export interface ErrorNodeProps {
|
|
170
|
+
label: string;
|
|
171
|
+
message: string;
|
|
172
|
+
code?: string;
|
|
173
|
+
cause?: string;
|
|
174
|
+
mitigation?: string;
|
|
175
|
+
sourceAnchor?: SourceAnchorInput;
|
|
176
|
+
transitions?: EdgeTransition[];
|
|
177
|
+
}
|
|
178
|
+
/** Props for prose/description nodes */
|
|
179
|
+
export interface DescriptionNodeProps {
|
|
180
|
+
label: string;
|
|
181
|
+
body: string;
|
|
182
|
+
sourceAnchor?: SourceAnchorInput;
|
|
183
|
+
transitions?: EdgeTransition[];
|
|
184
|
+
}
|
|
185
|
+
/** Props for link/reference nodes */
|
|
186
|
+
export interface LinkNodeProps {
|
|
187
|
+
label: string;
|
|
188
|
+
href: string;
|
|
189
|
+
description?: string;
|
|
190
|
+
sourceAnchor?: SourceAnchorInput;
|
|
191
|
+
transitions?: EdgeTransition[];
|
|
192
|
+
}
|
|
193
|
+
export interface FlaierResolvedSourceAnchor {
|
|
194
|
+
label: string;
|
|
195
|
+
href?: string;
|
|
196
|
+
}
|
|
197
|
+
export interface FlaierCustomNodeSize {
|
|
198
|
+
width: number;
|
|
199
|
+
height: number;
|
|
200
|
+
}
|
|
201
|
+
export interface FlaierCustomNodeContext<TProps = Record<string, unknown>> {
|
|
202
|
+
key: string;
|
|
203
|
+
elementType: string;
|
|
204
|
+
props: TProps;
|
|
205
|
+
sourceAnchor?: FlaierResolvedSourceAnchor;
|
|
206
|
+
}
|
|
207
|
+
export interface FlaierCustomNodeComponentProps {
|
|
208
|
+
active?: boolean;
|
|
209
|
+
nodeKey?: string;
|
|
210
|
+
elementType?: string;
|
|
211
|
+
sourceAnchor?: FlaierResolvedSourceAnchor;
|
|
212
|
+
}
|
|
213
|
+
export interface FlaierCustomNodeDefinition<TProps extends ZodTypeAny = ZodTypeAny> {
|
|
214
|
+
props: TProps;
|
|
215
|
+
description: string;
|
|
216
|
+
component: Component;
|
|
217
|
+
estimateSize?: (context: FlaierCustomNodeContext<Record<string, unknown>>) => FlaierCustomNodeSize;
|
|
218
|
+
getSummary?: (context: FlaierCustomNodeContext<Record<string, unknown>>) => string;
|
|
219
|
+
}
|
|
220
|
+
export type FlaierCustomNodeDefinitions = Record<string, FlaierCustomNodeDefinition>;
|
|
221
|
+
export interface FlaierCatalogOptions<TNodes extends FlaierCustomNodeDefinitions = FlaierCustomNodeDefinitions> {
|
|
222
|
+
nodes?: TNodes;
|
|
223
|
+
}
|
|
224
|
+
/** Union of all node prop types */
|
|
225
|
+
export type AnyNodeProps = ArchitectureNodeProps | TriggerNodeProps | CodeNodeProps | DecisionNodeProps | PayloadNodeProps | ErrorNodeProps | DescriptionNodeProps | LinkNodeProps;
|
|
226
|
+
/** VueFlow custom node type names */
|
|
227
|
+
export type BuiltInFlowNodeType = "architecture" | "trigger" | "code" | "decision" | "payload" | "error" | "description" | "link";
|
|
228
|
+
export type FlowNodeType = BuiltInFlowNodeType | (string & {});
|
|
229
|
+
/** Data payload attached to each VueFlow node */
|
|
230
|
+
export interface FlowNodeData {
|
|
231
|
+
key: string;
|
|
232
|
+
type: FlowNodeType;
|
|
233
|
+
elementType: string;
|
|
234
|
+
props: Record<string, unknown>;
|
|
235
|
+
active: boolean;
|
|
236
|
+
sourceAnchor?: FlaierResolvedSourceAnchor;
|
|
237
|
+
index: number;
|
|
238
|
+
}
|
|
239
|
+
export type FlowNode = Node<FlowNodeData>;
|
|
240
|
+
export type FlowEdge = Edge;
|
|
241
|
+
/** A single element in the flat spec */
|
|
242
|
+
export interface SpecElement {
|
|
243
|
+
type: string;
|
|
244
|
+
props: Record<string, unknown>;
|
|
245
|
+
children?: string[];
|
|
246
|
+
}
|
|
247
|
+
/** The json-render spec format for flaier */
|
|
248
|
+
export interface FlaierSpec {
|
|
249
|
+
root: string;
|
|
250
|
+
elements: Record<string, SpecElement>;
|
|
251
|
+
state?: Record<string, unknown>;
|
|
252
|
+
}
|
|
253
|
+
/** A single flow entry in a multi-flow manifest */
|
|
254
|
+
export interface FlaierManifestFlow {
|
|
255
|
+
id: string;
|
|
256
|
+
title?: string;
|
|
257
|
+
description?: string;
|
|
258
|
+
src: FlaierSpec | string;
|
|
259
|
+
tags?: string[];
|
|
260
|
+
entrypoints?: string[];
|
|
261
|
+
}
|
|
262
|
+
/** Multi-flow manifest generated by AI harnesses */
|
|
263
|
+
export interface FlaierManifest {
|
|
264
|
+
version?: number;
|
|
265
|
+
defaultFlowId?: string;
|
|
266
|
+
flows: FlaierManifestFlow[];
|
|
267
|
+
}
|
|
268
|
+
/** Runtime-friendly flow option metadata */
|
|
269
|
+
export interface FlaierFlowOption {
|
|
270
|
+
id: string;
|
|
271
|
+
title: string;
|
|
272
|
+
description?: string;
|
|
273
|
+
tags?: string[];
|
|
274
|
+
entrypoints?: string[];
|
|
275
|
+
}
|
|
276
|
+
/** Spec object, manifest object, or remote/local JSON source */
|
|
277
|
+
export type FlaierSource = FlaierSpec | FlaierManifest | string;
|
|
278
|
+
/** Public component props */
|
|
279
|
+
export interface FlaierProps {
|
|
280
|
+
src: FlaierSource;
|
|
281
|
+
autoPlay?: boolean;
|
|
282
|
+
interval?: number;
|
|
283
|
+
themeMode?: "local" | "document";
|
|
284
|
+
nodes?: FlaierCustomNodeDefinitions;
|
|
285
|
+
}
|
|
286
|
+
export interface FlaierPanelProps extends FlaierProps {
|
|
287
|
+
height?: number | string;
|
|
288
|
+
minHeight?: number;
|
|
289
|
+
zIndex?: number;
|
|
290
|
+
fullscreenEnabled?: boolean;
|
|
291
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@flaier/core",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Vue components and registry helpers for rendering Flaier flow specs.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"diagram",
|
|
7
|
+
"flaier",
|
|
8
|
+
"flow",
|
|
9
|
+
"visualizer",
|
|
10
|
+
"vue"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://github.com/WeAreRetex/flaier/tree/main/packages/core#readme",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/WeAreRetex/flaier/issues"
|
|
15
|
+
},
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/WeAreRetex/flaier.git",
|
|
20
|
+
"directory": "packages/core"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist"
|
|
24
|
+
],
|
|
25
|
+
"type": "module",
|
|
26
|
+
"sideEffects": [
|
|
27
|
+
"**/*.css"
|
|
28
|
+
],
|
|
29
|
+
"main": "dist/index.js",
|
|
30
|
+
"types": "dist/index.d.ts",
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"import": "./dist/index.js",
|
|
34
|
+
"types": "./dist/index.d.ts"
|
|
35
|
+
},
|
|
36
|
+
"./style.css": "./dist/style.css"
|
|
37
|
+
},
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "public",
|
|
40
|
+
"provenance": true
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"build": "vp pack && vue-tsc --project tsconfig.build.json",
|
|
44
|
+
"dev": "vp pack --watch",
|
|
45
|
+
"check": "vp check",
|
|
46
|
+
"typecheck": "vue-tsc --noEmit"
|
|
47
|
+
},
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"@dagrejs/dagre": "^2.0.4",
|
|
50
|
+
"@json-render/core": "^0.17.0",
|
|
51
|
+
"@json-render/vue": "^0.17.0",
|
|
52
|
+
"@shikijs/twoslash": "^3",
|
|
53
|
+
"@vue-flow/core": "^1",
|
|
54
|
+
"html-to-image": "^1.11.11",
|
|
55
|
+
"jspdf": "^2.5.2",
|
|
56
|
+
"shiki": "^3",
|
|
57
|
+
"shiki-magic-move": "^0.5",
|
|
58
|
+
"zod": "^4.3.6"
|
|
59
|
+
},
|
|
60
|
+
"devDependencies": {
|
|
61
|
+
"@tailwindcss/postcss": "^4.2.2",
|
|
62
|
+
"@tsdown/css": "^0.21.7",
|
|
63
|
+
"@vitejs/plugin-vue": "^6.0.6",
|
|
64
|
+
"postcss": "^8.5.9",
|
|
65
|
+
"postcss-import": "^16.1.1",
|
|
66
|
+
"tailwindcss": "^4",
|
|
67
|
+
"typescript": "^5",
|
|
68
|
+
"vite-plus": "^0.1.16",
|
|
69
|
+
"vue": "^3.5",
|
|
70
|
+
"vue-tsc": "^2"
|
|
71
|
+
},
|
|
72
|
+
"peerDependencies": {
|
|
73
|
+
"vue": "^3.5"
|
|
74
|
+
}
|
|
75
|
+
}
|