@nebutra/ui 0.2.2 → 2.0.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.
Files changed (43) hide show
  1. package/dist/animate-in-BlvjVh2S.d.ts +250 -0
  2. package/dist/{canonical-CrO71UPO.d.ts → canonical-Bf4czR2u.d.ts} +225 -211
  3. package/dist/chat/index.d.ts +1 -0
  4. package/dist/chat/index.js +3 -0
  5. package/dist/chat/index.js.map +1 -0
  6. package/dist/components/index.d.ts +58 -123
  7. package/dist/components/index.js +504 -203
  8. package/dist/components/index.js.map +1 -1
  9. package/dist/editorial/index.d.ts +404 -0
  10. package/dist/editorial/index.js +868 -0
  11. package/dist/editorial/index.js.map +1 -0
  12. package/dist/icons/index.d.ts +1 -0
  13. package/dist/layout/index.d.ts +2 -2
  14. package/dist/layout/index.js +116 -26
  15. package/dist/layout/index.js.map +1 -1
  16. package/dist/layouts/index.d.ts +80 -2
  17. package/dist/layouts/index.js +13 -11
  18. package/dist/layouts/index.js.map +1 -1
  19. package/dist/patterns/index.d.ts +4 -5
  20. package/dist/patterns/index.js +221 -106
  21. package/dist/patterns/index.js.map +1 -1
  22. package/dist/primitives/canonical.d.ts +4 -3
  23. package/dist/primitives/canonical.js +609 -197
  24. package/dist/primitives/canonical.js.map +1 -1
  25. package/dist/primitives/index.d.ts +213 -21
  26. package/dist/primitives/index.js +2209 -1317
  27. package/dist/primitives/index.js.map +1 -1
  28. package/dist/tailwind.preset.d.ts +2 -2
  29. package/dist/tailwind.preset.js +1 -1
  30. package/dist/tailwind.preset.js.map +1 -1
  31. package/dist/typography/fonts.css +21 -26
  32. package/dist/typography/index.d.ts +4 -4
  33. package/dist/typography/index.js +1 -1
  34. package/dist/typography/index.js.map +1 -1
  35. package/dist/utils/auth-surfaces.d.ts +33 -0
  36. package/dist/utils/auth-surfaces.js +9 -0
  37. package/dist/utils/auth-surfaces.js.map +1 -0
  38. package/dist/utils/index.d.ts +33 -5
  39. package/dist/utils/index.js +15 -3
  40. package/dist/utils/index.js.map +1 -1
  41. package/package.json +43 -9
  42. package/src/styles/sources.css +10 -0
  43. package/src/typography/fonts.css +21 -26
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js","sourcesContent":[]}
@@ -1,11 +1,8 @@
1
- export { ActionIcon, ActionIconGroup, Alert, Avatar, Button, Checkbox, DraggablePanel, DraggablePanelBody, DraggablePanelContainer, DraggablePanelFooter, DraggablePanelHeader, Flexbox, FlexboxProps, Form, FormGroup, FormItem, Highlighter, Image, Input, List, Markdown, Menu, Modal, SearchBar, Segmented, Select, SideNav, Tag, TextArea, Tooltip } from '@lobehub/ui';
2
- export { ChatInputArea, ChatItem, ChatItemProps, ChatList, ChatListProps, ChatMessage, MessageInput, MessageModal } from '@lobehub/ui/chat';
3
- export { default as Spotlight } from '@lobehub/ui/es/awesome/Spotlight/Spotlight';
4
1
  export { AnimatePresence, HTMLMotionProps, LayoutGroup, LazyMotion, MotionConfig, MotionProps, MotionStyle, MotionValue, Transition, Variants, animate, domAnimation, m, motion, useAnimationFrame, useInView, useMotionTemplate, useMotionValue, useReducedMotion, useScroll, useSpring, useTransform, useVelocity } from 'framer-motion';
5
2
  export { A as AnimatedCard, a as AnimatedDrawer, b as AnimatedList, c as AnimatedModal, d as AnimatedPopover, e as AnimationDuration, f as AnimationTransition, F as FadeIn, P as PageTransition, S as ScaleIn, g as SlideIn, h as animatedList, i as animatedListItem, j as animationDistances, k as animationDurations, l as animationEasings, m as animationSprings, n as animationTransitions, o as drawerSurface, p as fadeIn, q as modalSurface, r as pageTransition, s as popoverSurface, t as reducedMotionVariants, u as scaleIn, v as slideIn } from '../tokens-EAC6uPem.js';
6
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
7
- import * as React from 'react';
8
4
  import React__default, { ReactNode } from 'react';
5
+ export { A as AnimateIn, a as AnimateInGroup, b as AnimateInGroupProps, c as AnimateInProps, d as AnimateSwap, e as AnimateSwapProps } from '../animate-in-BlvjVh2S.js';
9
6
  import { GraphEdge, GraphNode, Graph } from '@nebutra/graph-model';
10
7
 
11
8
  declare const isImageFile: (file: File) => boolean;
@@ -49,124 +46,6 @@ interface VoiceRecorderProps {
49
46
  }
50
47
  declare const VoiceRecorder: React__default.FC<VoiceRecorderProps>;
51
48
 
52
- declare const PRESETS: {
53
- readonly emerge: {
54
- readonly initial: {
55
- readonly opacity: 0;
56
- readonly y: 16;
57
- readonly filter: "blur(6px)";
58
- };
59
- readonly animate: {
60
- readonly opacity: 1;
61
- readonly y: 0;
62
- readonly filter: "blur(0px)";
63
- };
64
- readonly exit: {
65
- readonly opacity: 0;
66
- readonly y: -8;
67
- readonly filter: "blur(4px)";
68
- };
69
- readonly transition: {
70
- duration: 0.5;
71
- ease: [number, number, number, number];
72
- };
73
- };
74
- readonly flow: {
75
- readonly initial: {
76
- readonly opacity: 0;
77
- readonly x: -20;
78
- };
79
- readonly animate: {
80
- readonly opacity: 1;
81
- readonly x: 0;
82
- };
83
- readonly exit: {
84
- readonly opacity: 0;
85
- readonly x: 20;
86
- };
87
- readonly transition: {
88
- duration: 0.3;
89
- ease: [number, number, number, number];
90
- };
91
- };
92
- readonly fade: {
93
- readonly initial: {
94
- readonly opacity: 0;
95
- };
96
- readonly animate: {
97
- readonly opacity: 1;
98
- };
99
- readonly exit: {
100
- readonly opacity: 0;
101
- };
102
- readonly transition: {
103
- readonly duration: 0.3;
104
- };
105
- };
106
- readonly fadeUp: {
107
- readonly initial: {
108
- readonly opacity: 0;
109
- readonly y: 16;
110
- };
111
- readonly animate: {
112
- readonly opacity: 1;
113
- readonly y: 0;
114
- };
115
- readonly exit: {
116
- readonly opacity: 0;
117
- readonly y: 16;
118
- };
119
- readonly transition: {
120
- type: "spring";
121
- stiffness: 200;
122
- damping: 24;
123
- mass: 1;
124
- };
125
- };
126
- readonly scale: {
127
- readonly initial: {
128
- readonly opacity: 0;
129
- readonly scale: 0.95;
130
- };
131
- readonly animate: {
132
- readonly opacity: 1;
133
- readonly scale: 1;
134
- };
135
- readonly exit: {
136
- readonly opacity: 0;
137
- readonly scale: 0.95;
138
- };
139
- readonly transition: {
140
- type: "spring";
141
- stiffness: 200;
142
- damping: 24;
143
- mass: 1;
144
- };
145
- };
146
- };
147
- type Preset = keyof typeof PRESETS;
148
- declare const STAGGER: {
149
- readonly fast: 0.05;
150
- readonly normal: 0.1;
151
- readonly slow: 0.2;
152
- };
153
- interface AnimateInProps {
154
- children: React.ReactNode;
155
- preset?: Preset;
156
- delay?: number;
157
- duration?: number;
158
- inView?: boolean;
159
- className?: string;
160
- }
161
- declare function AnimateIn(props: AnimateInProps): react_jsx_runtime.JSX.Element;
162
- interface AnimateInGroupProps {
163
- children: React.ReactNode;
164
- stagger?: keyof typeof STAGGER;
165
- inView?: boolean;
166
- className?: string;
167
- }
168
- declare function AnimateInGroup(props: AnimateInGroupProps): react_jsx_runtime.JSX.Element;
169
-
170
49
  interface AsciiTextProps {
171
50
  text: string;
172
51
  className?: string;
@@ -207,6 +86,28 @@ declare function ChangelogWidget({ entries, changelogUrl, className, }: Changelo
207
86
  type EdgeIdentity<E extends GraphEdge> = (edge: E) => string;
208
87
  /** Build a domain edge from an xyflow connection, or reject it (null). */
209
88
  type MakeEdge<E extends GraphEdge> = (from: string, to: string, targetHandle: string | null) => E | null;
89
+ /** xyflow node shape we consume/produce (structurally compatible). */
90
+ interface FlowNode<N extends GraphNode> {
91
+ id: string;
92
+ type: string;
93
+ position: {
94
+ x: number;
95
+ y: number;
96
+ };
97
+ data: {
98
+ node: N;
99
+ };
100
+ }
101
+ /** xyflow edge shape we consume/produce (structurally compatible). */
102
+ interface FlowEdge<E extends GraphEdge> {
103
+ id: string;
104
+ source: string;
105
+ target: string;
106
+ targetHandle?: string | null;
107
+ data: {
108
+ edge: E;
109
+ };
110
+ }
210
111
  /** xyflow's connection payload (source/target may be null mid-drag). */
211
112
  interface FlowConnection {
212
113
  source: string | null;
@@ -214,6 +115,40 @@ interface FlowConnection {
214
115
  sourceHandle: string | null;
215
116
  targetHandle: string | null;
216
117
  }
118
+ type AddEdgeResult<G> = {
119
+ ok: true;
120
+ graph: G;
121
+ } | {
122
+ ok: false;
123
+ reason: string;
124
+ };
125
+ /** Single custom xyflow node `type` key — one renderer for every node. */
126
+ declare const GRAPH_NODE_FLOW_TYPE: "graph-node";
127
+ /** Graph → xyflow view model. Pure; allocates fresh arrays. */
128
+ declare function graphToFlow<N extends GraphNode, E extends GraphEdge>(graph: Graph<N, E>, edgeIdentity: EdgeIdentity<E>): {
129
+ nodes: FlowNode<N>[];
130
+ edges: FlowEdge<E>[];
131
+ };
132
+ /**
133
+ * Apply xyflow node positions back onto the graph. Returns a *new* graph;
134
+ * the input and its `nodes` array are never mutated. Non-structural fields
135
+ * (anything besides `nodes`/`edges`) are preserved by spread.
136
+ */
137
+ declare function applyNodePositions<N extends GraphNode, E extends GraphEdge, G extends Graph<N, E>>(graph: G, flowNodes: readonly FlowNode<N>[]): G;
138
+ /**
139
+ * Attempt to add a connection as a domain edge. Rejected (with a
140
+ * human-readable hint) on missing endpoints, self-loop, duplicate, a domain
141
+ * `makeEdge` veto, or when it would make the graph cyclic — enforced via the
142
+ * neutral `@nebutra/graph-model` guard so the UI can never persist a non-DAG.
143
+ */
144
+ declare function tryAddEdge<N extends GraphNode, E extends GraphEdge, G extends Graph<N, E>>(graph: G, connection: FlowConnection, opts: {
145
+ makeEdge: MakeEdge<E>;
146
+ edgeIdentity: EdgeIdentity<E>;
147
+ }): AddEdgeResult<G>;
148
+ /** Remove a node and every edge incident to it. Returns a new graph. */
149
+ declare function removeNode<N extends GraphNode, E extends GraphEdge, G extends Graph<N, E>>(graph: G, nodeId: string): G;
150
+ /** Remove one edge identified by its injected stable identity. */
151
+ declare function removeFlowEdge<N extends GraphNode, E extends GraphEdge, G extends Graph<N, E>>(graph: G, flowEdgeId: string, edgeIdentity: EdgeIdentity<E>): G;
217
152
 
218
153
  /** Domain-supplied presentation for one node. */
219
154
  interface NodeView {
@@ -372,4 +307,4 @@ interface TeamChatProps {
372
307
  */
373
308
  declare function TeamChat({ chatName, tagline, messages, inputPlaceholder, onSendMessage, onReactionClick, onMoreOptions, className, }: TeamChatProps): react_jsx_runtime.JSX.Element;
374
309
 
375
- export { AnimateIn, AnimateInGroup, type AnimateInGroupProps, type AnimateInProps, AsciiText, type ChangelogEntry, ChangelogWidget, type ChangelogWidgetProps, type ChatReaction, type ChatSender, type ChecklistItem, type EdgeIdentity, type FlowConnection, ImageViewDialog, type ImageViewDialogProps, MAX_VISUALIZER_BARS, type MakeEdge, NodeGraphCanvas, type NodeGraphCanvasProps, type NodeView, OnboardingChecklist, type OnboardingChecklistProps, PromptAttachmentPreviews, type PromptAttachmentPreviewsProps, PromptInputBox, type PromptInputBoxProps, TeamChat, type TeamChatProps, VISUALIZER_BAR_STYLES, VoiceRecorder, type VoiceRecorderProps, formatRecordingTime, getFilePreviewKey, isImageFile, preventDragDefaults };
310
+ export { type AddEdgeResult, AsciiText, type ChangelogEntry, ChangelogWidget, type ChangelogWidgetProps, type ChatMessage, type ChatReaction, type ChatSender, type ChecklistItem, type EdgeIdentity, type FlowConnection, type FlowEdge, type FlowNode, GRAPH_NODE_FLOW_TYPE, ImageViewDialog, type ImageViewDialogProps, MAX_VISUALIZER_BARS, type MakeEdge, NodeGraphCanvas, type NodeGraphCanvasProps, type NodeView, OnboardingChecklist, type OnboardingChecklistProps, PromptAttachmentPreviews, type PromptAttachmentPreviewsProps, PromptInputBox, type PromptInputBoxProps, TeamChat, type TeamChatProps, VISUALIZER_BAR_STYLES, VoiceRecorder, type VoiceRecorderProps, applyNodePositions, formatRecordingTime, getFilePreviewKey, graphToFlow, isImageFile, preventDragDefaults, removeFlowEdge, removeNode, tryAddEdge };