@almadar/ui 2.18.0 → 2.19.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/components/index.cjs +10 -6
- package/dist/components/index.js +10 -6
- package/dist/components/organisms/game/three/index.cjs +2 -4
- package/dist/components/organisms/game/three/index.js +2 -4
- package/dist/docs/index.cjs +33 -33
- package/dist/docs/index.js +11 -11
- package/dist/hooks/index.cjs +2 -4
- package/dist/hooks/index.js +1 -3
- package/dist/marketing/index.cjs +34 -28
- package/dist/marketing/index.js +21 -15
- package/dist/providers/EventBusProvider.d.ts +14 -4
- package/dist/providers/index.cjs +5 -6
- package/dist/providers/index.js +4 -5
- package/dist/runtime/OrbPreview.d.ts +39 -0
- package/dist/runtime/index.cjs +139 -2
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.js +138 -2
- package/package.json +1 -1
- package/dist/internals/event-bus-context.d.ts +0 -15
package/dist/marketing/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var React5 = require('react');
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var LucideIcons = require('lucide-react');
|
|
6
6
|
|
|
@@ -24,7 +24,7 @@ function _interopNamespace(e) {
|
|
|
24
24
|
return Object.freeze(n);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
var
|
|
27
|
+
var React5__default = /*#__PURE__*/_interopDefault(React5);
|
|
28
28
|
var LucideIcons__namespace = /*#__PURE__*/_interopNamespace(LucideIcons);
|
|
29
29
|
|
|
30
30
|
// node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
|
|
@@ -2506,7 +2506,7 @@ var twMerge = /* @__PURE__ */ createTailwindMerge(getDefaultConfig);
|
|
|
2506
2506
|
function cn(...inputs) {
|
|
2507
2507
|
return twMerge(clsx(inputs));
|
|
2508
2508
|
}
|
|
2509
|
-
var EventBusContext =
|
|
2509
|
+
var EventBusContext = React5.createContext(null);
|
|
2510
2510
|
|
|
2511
2511
|
// hooks/useEventBus.ts
|
|
2512
2512
|
function getGlobalEventBus() {
|
|
@@ -2576,7 +2576,7 @@ var fallbackEventBus = {
|
|
|
2576
2576
|
}
|
|
2577
2577
|
};
|
|
2578
2578
|
function useEventBus() {
|
|
2579
|
-
const context =
|
|
2579
|
+
const context = React5.useContext(EventBusContext);
|
|
2580
2580
|
return context ?? getGlobalEventBus() ?? fallbackEventBus;
|
|
2581
2581
|
}
|
|
2582
2582
|
var paddingStyles = {
|
|
@@ -2681,7 +2681,7 @@ var positionStyles = {
|
|
|
2681
2681
|
fixed: "fixed",
|
|
2682
2682
|
sticky: "sticky"
|
|
2683
2683
|
};
|
|
2684
|
-
var Box =
|
|
2684
|
+
var Box = React5__default.default.forwardRef(
|
|
2685
2685
|
({
|
|
2686
2686
|
padding,
|
|
2687
2687
|
paddingX,
|
|
@@ -2710,20 +2710,20 @@ var Box = React4__default.default.forwardRef(
|
|
|
2710
2710
|
...rest
|
|
2711
2711
|
}, ref) => {
|
|
2712
2712
|
const eventBus = useEventBus();
|
|
2713
|
-
const handleClick =
|
|
2713
|
+
const handleClick = React5.useCallback((e) => {
|
|
2714
2714
|
if (action) {
|
|
2715
2715
|
e.stopPropagation();
|
|
2716
2716
|
eventBus.emit(`UI:${action}`, actionPayload ?? {});
|
|
2717
2717
|
}
|
|
2718
2718
|
onClick?.(e);
|
|
2719
2719
|
}, [action, actionPayload, eventBus, onClick]);
|
|
2720
|
-
const handleMouseEnter =
|
|
2720
|
+
const handleMouseEnter = React5.useCallback((e) => {
|
|
2721
2721
|
if (hoverEvent) {
|
|
2722
2722
|
eventBus.emit(`UI:${hoverEvent}`, { hovered: true });
|
|
2723
2723
|
}
|
|
2724
2724
|
onMouseEnter?.(e);
|
|
2725
2725
|
}, [hoverEvent, eventBus, onMouseEnter]);
|
|
2726
|
-
const handleMouseLeave =
|
|
2726
|
+
const handleMouseLeave = React5.useCallback((e) => {
|
|
2727
2727
|
if (hoverEvent) {
|
|
2728
2728
|
eventBus.emit(`UI:${hoverEvent}`, { hovered: false });
|
|
2729
2729
|
}
|
|
@@ -3107,7 +3107,7 @@ function resolveIconProp(value, sizeClass) {
|
|
|
3107
3107
|
const IconComp = value;
|
|
3108
3108
|
return /* @__PURE__ */ jsxRuntime.jsx(IconComp, { className: sizeClass });
|
|
3109
3109
|
}
|
|
3110
|
-
if (
|
|
3110
|
+
if (React5__default.default.isValidElement(value)) {
|
|
3111
3111
|
return value;
|
|
3112
3112
|
}
|
|
3113
3113
|
if (typeof value === "object" && value !== null && "render" in value) {
|
|
@@ -3116,7 +3116,7 @@ function resolveIconProp(value, sizeClass) {
|
|
|
3116
3116
|
}
|
|
3117
3117
|
return value;
|
|
3118
3118
|
}
|
|
3119
|
-
var Button =
|
|
3119
|
+
var Button = React5__default.default.forwardRef(
|
|
3120
3120
|
({
|
|
3121
3121
|
className,
|
|
3122
3122
|
variant = "primary",
|
|
@@ -3211,7 +3211,7 @@ var sizeStyles3 = {
|
|
|
3211
3211
|
md: "px-2.5 py-1 text-sm",
|
|
3212
3212
|
lg: "px-3 py-1.5 text-base"
|
|
3213
3213
|
};
|
|
3214
|
-
var Badge =
|
|
3214
|
+
var Badge = React5__default.default.forwardRef(
|
|
3215
3215
|
({ className, variant = "default", size = "sm", amount, label, icon, children, ...props }, ref) => {
|
|
3216
3216
|
const iconSizes = { sm: "w-3 h-3", md: "w-3.5 h-3.5", lg: "w-4 h-4" };
|
|
3217
3217
|
const resolvedIcon = typeof icon === "string" ? (() => {
|
|
@@ -3280,7 +3280,7 @@ var shadowStyles2 = {
|
|
|
3280
3280
|
md: "shadow-[var(--shadow-main)]",
|
|
3281
3281
|
lg: "shadow-[var(--shadow-lg)]"
|
|
3282
3282
|
};
|
|
3283
|
-
var Card =
|
|
3283
|
+
var Card = React5__default.default.forwardRef(
|
|
3284
3284
|
({
|
|
3285
3285
|
className,
|
|
3286
3286
|
variant = "bordered",
|
|
@@ -3316,9 +3316,9 @@ var Card = React4__default.default.forwardRef(
|
|
|
3316
3316
|
}
|
|
3317
3317
|
);
|
|
3318
3318
|
Card.displayName = "Card";
|
|
3319
|
-
var CardHeader =
|
|
3319
|
+
var CardHeader = React5__default.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("mb-4", className), ...props }));
|
|
3320
3320
|
CardHeader.displayName = "CardHeader";
|
|
3321
|
-
var CardTitle =
|
|
3321
|
+
var CardTitle = React5__default.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3322
3322
|
"h3",
|
|
3323
3323
|
{
|
|
3324
3324
|
ref,
|
|
@@ -3331,11 +3331,11 @@ var CardTitle = React4__default.default.forwardRef(({ className, ...props }, ref
|
|
|
3331
3331
|
}
|
|
3332
3332
|
));
|
|
3333
3333
|
CardTitle.displayName = "CardTitle";
|
|
3334
|
-
var CardContent =
|
|
3334
|
+
var CardContent = React5__default.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("", className), ...props }));
|
|
3335
3335
|
CardContent.displayName = "CardContent";
|
|
3336
3336
|
var CardBody = CardContent;
|
|
3337
3337
|
CardBody.displayName = "CardBody";
|
|
3338
|
-
var CardFooter =
|
|
3338
|
+
var CardFooter = React5__default.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3339
3339
|
"div",
|
|
3340
3340
|
{
|
|
3341
3341
|
ref,
|
|
@@ -3492,7 +3492,7 @@ var paddingClasses = {
|
|
|
3492
3492
|
md: "py-16",
|
|
3493
3493
|
lg: "py-24"
|
|
3494
3494
|
};
|
|
3495
|
-
var ContentSection =
|
|
3495
|
+
var ContentSection = React5__default.default.forwardRef(
|
|
3496
3496
|
({ children, background = "default", padding = "lg", id, className }, ref) => {
|
|
3497
3497
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3498
3498
|
Box,
|
|
@@ -3516,8 +3516,8 @@ var InstallBox = ({
|
|
|
3516
3516
|
label,
|
|
3517
3517
|
className
|
|
3518
3518
|
}) => {
|
|
3519
|
-
const [copied, setCopied] =
|
|
3520
|
-
const handleCopy =
|
|
3519
|
+
const [copied, setCopied] = React5.useState(false);
|
|
3520
|
+
const handleCopy = React5.useCallback(() => {
|
|
3521
3521
|
void navigator.clipboard.writeText(command);
|
|
3522
3522
|
setCopied(true);
|
|
3523
3523
|
const timer = setTimeout(() => setCopied(false), 2e3);
|
|
@@ -3656,8 +3656,14 @@ var HeroSection = ({
|
|
|
3656
3656
|
),
|
|
3657
3657
|
installCommand && /* @__PURE__ */ jsxRuntime.jsx(InstallBox, { command: installCommand }),
|
|
3658
3658
|
(primaryAction || secondaryAction) && /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "md", align: "center", children: [
|
|
3659
|
-
primaryAction && /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "primary", size: "lg",
|
|
3660
|
-
|
|
3659
|
+
primaryAction && /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "primary", size: "lg", onClick: () => {
|
|
3660
|
+
const external = primaryAction.href.startsWith("http");
|
|
3661
|
+
window.open(primaryAction.href, external ? "_blank" : "_self");
|
|
3662
|
+
}, children: primaryAction.label }),
|
|
3663
|
+
secondaryAction && /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "secondary", size: "lg", onClick: () => {
|
|
3664
|
+
const external = secondaryAction.href.startsWith("http");
|
|
3665
|
+
window.open(secondaryAction.href, external ? "_blank" : "_self");
|
|
3666
|
+
}, children: secondaryAction.label })
|
|
3661
3667
|
] }),
|
|
3662
3668
|
children
|
|
3663
3669
|
]
|
|
@@ -4063,7 +4069,7 @@ var StepFlow = ({
|
|
|
4063
4069
|
className
|
|
4064
4070
|
}) => {
|
|
4065
4071
|
if (orientation === "vertical") {
|
|
4066
|
-
return /* @__PURE__ */ jsxRuntime.jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
4072
|
+
return /* @__PURE__ */ jsxRuntime.jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsxRuntime.jsx(React5__default.default.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
|
|
4067
4073
|
/* @__PURE__ */ jsxRuntime.jsxs(VStack, { gap: "none", align: "center", children: [
|
|
4068
4074
|
/* @__PURE__ */ jsxRuntime.jsx(StepCircle, { step, index }),
|
|
4069
4075
|
showConnectors && index < steps.length - 1 && /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "w-px h-8 bg-[var(--color-border)]" })
|
|
@@ -4074,7 +4080,7 @@ var StepFlow = ({
|
|
|
4074
4080
|
] })
|
|
4075
4081
|
] }) }, index)) });
|
|
4076
4082
|
}
|
|
4077
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Box, { className: cn("w-full flex flex-col md:flex-row items-start gap-0", className), children: steps.map((step, index) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4083
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Box, { className: cn("w-full flex flex-col md:flex-row items-start gap-0", className), children: steps.map((step, index) => /* @__PURE__ */ jsxRuntime.jsxs(React5__default.default.Fragment, { children: [
|
|
4078
4084
|
/* @__PURE__ */ jsxRuntime.jsxs(VStack, { gap: "sm", align: "center", className: "flex-1 w-full md:w-auto", children: [
|
|
4079
4085
|
/* @__PURE__ */ jsxRuntime.jsx(StepCircle, { step, index }),
|
|
4080
4086
|
/* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "h4", className: "text-center", children: step.title }),
|
|
@@ -4589,10 +4595,10 @@ var AnimatedCounter = ({
|
|
|
4589
4595
|
duration = 1500,
|
|
4590
4596
|
className
|
|
4591
4597
|
}) => {
|
|
4592
|
-
const ref =
|
|
4593
|
-
const [displayValue, setDisplayValue] =
|
|
4594
|
-
const [hasAnimated, setHasAnimated] =
|
|
4595
|
-
const animate =
|
|
4598
|
+
const ref = React5.useRef(null);
|
|
4599
|
+
const [displayValue, setDisplayValue] = React5.useState("0");
|
|
4600
|
+
const [hasAnimated, setHasAnimated] = React5.useState(false);
|
|
4601
|
+
const animate = React5.useCallback(() => {
|
|
4596
4602
|
const { num, prefix, suffix, decimals } = parseValue(value);
|
|
4597
4603
|
if (num === 0) {
|
|
4598
4604
|
setDisplayValue(value);
|
|
@@ -4613,7 +4619,7 @@ var AnimatedCounter = ({
|
|
|
4613
4619
|
};
|
|
4614
4620
|
requestAnimationFrame(tick);
|
|
4615
4621
|
}, [value, duration]);
|
|
4616
|
-
|
|
4622
|
+
React5.useEffect(() => {
|
|
4617
4623
|
if (hasAnimated) return;
|
|
4618
4624
|
const el = ref.current;
|
|
4619
4625
|
if (!el) return;
|
package/dist/marketing/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React5, { createContext, useCallback, useContext, useState, useRef, useEffect } from 'react';
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
3
|
import * as LucideIcons from 'lucide-react';
|
|
4
4
|
import { Loader2, Check, User } from 'lucide-react';
|
|
@@ -2657,7 +2657,7 @@ var positionStyles = {
|
|
|
2657
2657
|
fixed: "fixed",
|
|
2658
2658
|
sticky: "sticky"
|
|
2659
2659
|
};
|
|
2660
|
-
var Box =
|
|
2660
|
+
var Box = React5.forwardRef(
|
|
2661
2661
|
({
|
|
2662
2662
|
padding,
|
|
2663
2663
|
paddingX,
|
|
@@ -3083,7 +3083,7 @@ function resolveIconProp(value, sizeClass) {
|
|
|
3083
3083
|
const IconComp = value;
|
|
3084
3084
|
return /* @__PURE__ */ jsx(IconComp, { className: sizeClass });
|
|
3085
3085
|
}
|
|
3086
|
-
if (
|
|
3086
|
+
if (React5.isValidElement(value)) {
|
|
3087
3087
|
return value;
|
|
3088
3088
|
}
|
|
3089
3089
|
if (typeof value === "object" && value !== null && "render" in value) {
|
|
@@ -3092,7 +3092,7 @@ function resolveIconProp(value, sizeClass) {
|
|
|
3092
3092
|
}
|
|
3093
3093
|
return value;
|
|
3094
3094
|
}
|
|
3095
|
-
var Button =
|
|
3095
|
+
var Button = React5.forwardRef(
|
|
3096
3096
|
({
|
|
3097
3097
|
className,
|
|
3098
3098
|
variant = "primary",
|
|
@@ -3187,7 +3187,7 @@ var sizeStyles3 = {
|
|
|
3187
3187
|
md: "px-2.5 py-1 text-sm",
|
|
3188
3188
|
lg: "px-3 py-1.5 text-base"
|
|
3189
3189
|
};
|
|
3190
|
-
var Badge =
|
|
3190
|
+
var Badge = React5.forwardRef(
|
|
3191
3191
|
({ className, variant = "default", size = "sm", amount, label, icon, children, ...props }, ref) => {
|
|
3192
3192
|
const iconSizes = { sm: "w-3 h-3", md: "w-3.5 h-3.5", lg: "w-4 h-4" };
|
|
3193
3193
|
const resolvedIcon = typeof icon === "string" ? (() => {
|
|
@@ -3256,7 +3256,7 @@ var shadowStyles2 = {
|
|
|
3256
3256
|
md: "shadow-[var(--shadow-main)]",
|
|
3257
3257
|
lg: "shadow-[var(--shadow-lg)]"
|
|
3258
3258
|
};
|
|
3259
|
-
var Card =
|
|
3259
|
+
var Card = React5.forwardRef(
|
|
3260
3260
|
({
|
|
3261
3261
|
className,
|
|
3262
3262
|
variant = "bordered",
|
|
@@ -3292,9 +3292,9 @@ var Card = React4.forwardRef(
|
|
|
3292
3292
|
}
|
|
3293
3293
|
);
|
|
3294
3294
|
Card.displayName = "Card";
|
|
3295
|
-
var CardHeader =
|
|
3295
|
+
var CardHeader = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
|
|
3296
3296
|
CardHeader.displayName = "CardHeader";
|
|
3297
|
-
var CardTitle =
|
|
3297
|
+
var CardTitle = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
3298
3298
|
"h3",
|
|
3299
3299
|
{
|
|
3300
3300
|
ref,
|
|
@@ -3307,11 +3307,11 @@ var CardTitle = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
3307
3307
|
}
|
|
3308
3308
|
));
|
|
3309
3309
|
CardTitle.displayName = "CardTitle";
|
|
3310
|
-
var CardContent =
|
|
3310
|
+
var CardContent = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
|
|
3311
3311
|
CardContent.displayName = "CardContent";
|
|
3312
3312
|
var CardBody = CardContent;
|
|
3313
3313
|
CardBody.displayName = "CardBody";
|
|
3314
|
-
var CardFooter =
|
|
3314
|
+
var CardFooter = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
3315
3315
|
"div",
|
|
3316
3316
|
{
|
|
3317
3317
|
ref,
|
|
@@ -3468,7 +3468,7 @@ var paddingClasses = {
|
|
|
3468
3468
|
md: "py-16",
|
|
3469
3469
|
lg: "py-24"
|
|
3470
3470
|
};
|
|
3471
|
-
var ContentSection =
|
|
3471
|
+
var ContentSection = React5.forwardRef(
|
|
3472
3472
|
({ children, background = "default", padding = "lg", id, className }, ref) => {
|
|
3473
3473
|
return /* @__PURE__ */ jsx(
|
|
3474
3474
|
Box,
|
|
@@ -3632,8 +3632,14 @@ var HeroSection = ({
|
|
|
3632
3632
|
),
|
|
3633
3633
|
installCommand && /* @__PURE__ */ jsx(InstallBox, { command: installCommand }),
|
|
3634
3634
|
(primaryAction || secondaryAction) && /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "center", children: [
|
|
3635
|
-
primaryAction && /* @__PURE__ */ jsx(Button, { variant: "primary", size: "lg",
|
|
3636
|
-
|
|
3635
|
+
primaryAction && /* @__PURE__ */ jsx(Button, { variant: "primary", size: "lg", onClick: () => {
|
|
3636
|
+
const external = primaryAction.href.startsWith("http");
|
|
3637
|
+
window.open(primaryAction.href, external ? "_blank" : "_self");
|
|
3638
|
+
}, children: primaryAction.label }),
|
|
3639
|
+
secondaryAction && /* @__PURE__ */ jsx(Button, { variant: "secondary", size: "lg", onClick: () => {
|
|
3640
|
+
const external = secondaryAction.href.startsWith("http");
|
|
3641
|
+
window.open(secondaryAction.href, external ? "_blank" : "_self");
|
|
3642
|
+
}, children: secondaryAction.label })
|
|
3637
3643
|
] }),
|
|
3638
3644
|
children
|
|
3639
3645
|
]
|
|
@@ -4039,7 +4045,7 @@ var StepFlow = ({
|
|
|
4039
4045
|
className
|
|
4040
4046
|
}) => {
|
|
4041
4047
|
if (orientation === "vertical") {
|
|
4042
|
-
return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(
|
|
4048
|
+
return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React5.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
|
|
4043
4049
|
/* @__PURE__ */ jsxs(VStack, { gap: "none", align: "center", children: [
|
|
4044
4050
|
/* @__PURE__ */ jsx(StepCircle, { step, index }),
|
|
4045
4051
|
showConnectors && index < steps.length - 1 && /* @__PURE__ */ jsx(Box, { className: "w-px h-8 bg-[var(--color-border)]" })
|
|
@@ -4050,7 +4056,7 @@ var StepFlow = ({
|
|
|
4050
4056
|
] })
|
|
4051
4057
|
] }) }, index)) });
|
|
4052
4058
|
}
|
|
4053
|
-
return /* @__PURE__ */ jsx(Box, { className: cn("w-full flex flex-col md:flex-row items-start gap-0", className), children: steps.map((step, index) => /* @__PURE__ */ jsxs(
|
|
4059
|
+
return /* @__PURE__ */ jsx(Box, { className: cn("w-full flex flex-col md:flex-row items-start gap-0", className), children: steps.map((step, index) => /* @__PURE__ */ jsxs(React5.Fragment, { children: [
|
|
4054
4060
|
/* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", className: "flex-1 w-full md:w-auto", children: [
|
|
4055
4061
|
/* @__PURE__ */ jsx(StepCircle, { step, index }),
|
|
4056
4062
|
/* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-center", children: step.title }),
|
|
@@ -9,11 +9,21 @@
|
|
|
9
9
|
*
|
|
10
10
|
* @packageDocumentation
|
|
11
11
|
*/
|
|
12
|
-
import { type ReactNode } from 'react';
|
|
12
|
+
import React, { type ReactNode } from 'react';
|
|
13
13
|
import type { EventBusContextType } from '../hooks/event-bus-types';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Extended context type for backward compatibility.
|
|
16
|
+
*
|
|
17
|
+
* @deprecated getSelectedEntity and clearSelectedEntity are deprecated.
|
|
18
|
+
* Use SelectionProvider and useSelection hook instead.
|
|
19
|
+
*/
|
|
20
|
+
export interface EventBusContextTypeExtended extends EventBusContextType {
|
|
21
|
+
/** @deprecated Use useSelection from SelectionProvider instead. */
|
|
22
|
+
getSelectedEntity: () => unknown | null;
|
|
23
|
+
/** @deprecated Use useSelection from SelectionProvider instead. */
|
|
24
|
+
clearSelectedEntity: () => void;
|
|
25
|
+
}
|
|
26
|
+
export declare const EventBusContext: React.Context<EventBusContextTypeExtended | null>;
|
|
17
27
|
interface EventBusProviderProps {
|
|
18
28
|
children: ReactNode;
|
|
19
29
|
/** Enable debug logging in development */
|
package/dist/providers/index.cjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var React110 = require('react');
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var providers = require('@almadar/ui/providers');
|
|
5
6
|
require('react-dom');
|
|
6
7
|
require('@almadar/ui/context');
|
|
7
8
|
var LucideIcons = require('lucide-react');
|
|
@@ -283,9 +284,6 @@ var ThemeProvider = ({
|
|
|
283
284
|
);
|
|
284
285
|
return /* @__PURE__ */ jsxRuntime.jsx(ThemeContext.Provider, { value: contextValue, children });
|
|
285
286
|
};
|
|
286
|
-
var EventBusContext = React110.createContext(null);
|
|
287
|
-
|
|
288
|
-
// hooks/useEventBus.ts
|
|
289
287
|
function setGlobalEventBus(bus) {
|
|
290
288
|
if (typeof window !== "undefined") {
|
|
291
289
|
window.__kflowEventBus = bus;
|
|
@@ -358,9 +356,10 @@ var fallbackEventBus = {
|
|
|
358
356
|
}
|
|
359
357
|
};
|
|
360
358
|
function useEventBus() {
|
|
361
|
-
const context = React110.useContext(EventBusContext);
|
|
359
|
+
const context = React110.useContext(providers.EventBusContext);
|
|
362
360
|
return context ?? getGlobalEventBus() ?? fallbackEventBus;
|
|
363
361
|
}
|
|
362
|
+
var EventBusContext2 = React110.createContext(null);
|
|
364
363
|
function EventBusProvider({ children, debug: debug2 = false }) {
|
|
365
364
|
const listenersRef = React110.useRef(/* @__PURE__ */ new Map());
|
|
366
365
|
const anyListenersRef = React110.useRef(/* @__PURE__ */ new Set());
|
|
@@ -476,7 +475,7 @@ function EventBusProvider({ children, debug: debug2 = false }) {
|
|
|
476
475
|
setGlobalEventBus(null);
|
|
477
476
|
};
|
|
478
477
|
}, [contextValue]);
|
|
479
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
478
|
+
return /* @__PURE__ */ jsxRuntime.jsx(EventBusContext2.Provider, { value: contextValue, children });
|
|
480
479
|
}
|
|
481
480
|
var SelectionContext = React110.createContext(null);
|
|
482
481
|
var defaultCompareEntities = (a, b) => {
|
|
@@ -3426,7 +3425,7 @@ function useOptionalOfflineMode() {
|
|
|
3426
3425
|
return React110.useContext(OfflineModeContext);
|
|
3427
3426
|
}
|
|
3428
3427
|
|
|
3429
|
-
exports.EventBusContext =
|
|
3428
|
+
exports.EventBusContext = EventBusContext2;
|
|
3430
3429
|
exports.EventBusProvider = EventBusProvider;
|
|
3431
3430
|
exports.FetchedDataContext = FetchedDataContext;
|
|
3432
3431
|
exports.FetchedDataProvider = FetchedDataProvider;
|
package/dist/providers/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React110 from 'react';
|
|
2
2
|
import React110__default, { createContext, useCallback, useState, useRef, useLayoutEffect, useEffect, lazy, useContext, useMemo } from 'react';
|
|
3
3
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
|
+
import { EventBusContext } from '@almadar/ui/providers';
|
|
4
5
|
import 'react-dom';
|
|
5
6
|
import '@almadar/ui/context';
|
|
6
7
|
import * as LucideIcons from 'lucide-react';
|
|
@@ -253,9 +254,6 @@ var ThemeProvider = ({
|
|
|
253
254
|
);
|
|
254
255
|
return /* @__PURE__ */ jsx(ThemeContext.Provider, { value: contextValue, children });
|
|
255
256
|
};
|
|
256
|
-
var EventBusContext = createContext(null);
|
|
257
|
-
|
|
258
|
-
// hooks/useEventBus.ts
|
|
259
257
|
function setGlobalEventBus(bus) {
|
|
260
258
|
if (typeof window !== "undefined") {
|
|
261
259
|
window.__kflowEventBus = bus;
|
|
@@ -331,6 +329,7 @@ function useEventBus() {
|
|
|
331
329
|
const context = useContext(EventBusContext);
|
|
332
330
|
return context ?? getGlobalEventBus() ?? fallbackEventBus;
|
|
333
331
|
}
|
|
332
|
+
var EventBusContext2 = createContext(null);
|
|
334
333
|
function EventBusProvider({ children, debug: debug2 = false }) {
|
|
335
334
|
const listenersRef = useRef(/* @__PURE__ */ new Map());
|
|
336
335
|
const anyListenersRef = useRef(/* @__PURE__ */ new Set());
|
|
@@ -446,7 +445,7 @@ function EventBusProvider({ children, debug: debug2 = false }) {
|
|
|
446
445
|
setGlobalEventBus(null);
|
|
447
446
|
};
|
|
448
447
|
}, [contextValue]);
|
|
449
|
-
return /* @__PURE__ */ jsx(
|
|
448
|
+
return /* @__PURE__ */ jsx(EventBusContext2.Provider, { value: contextValue, children });
|
|
450
449
|
}
|
|
451
450
|
var SelectionContext = createContext(null);
|
|
452
451
|
var defaultCompareEntities = (a, b) => {
|
|
@@ -3396,4 +3395,4 @@ function useOptionalOfflineMode() {
|
|
|
3396
3395
|
return useContext(OfflineModeContext);
|
|
3397
3396
|
}
|
|
3398
3397
|
|
|
3399
|
-
export { EventBusContext, EventBusProvider, FetchedDataContext, FetchedDataProvider, OfflineModeProvider, OrbitalProvider, SelectionContext, SelectionProvider, VerificationProvider, useFetchedData, useFetchedDataContext, useFetchedEntity, useOfflineMode, useOptionalOfflineMode, useSelection, useSelectionOptional };
|
|
3398
|
+
export { EventBusContext2 as EventBusContext, EventBusProvider, FetchedDataContext, FetchedDataProvider, OfflineModeProvider, OrbitalProvider, SelectionContext, SelectionProvider, VerificationProvider, useFetchedData, useFetchedDataContext, useFetchedEntity, useOfflineMode, useOptionalOfflineMode, useSelection, useSelectionOptional };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OrbPreview Component
|
|
3
|
+
*
|
|
4
|
+
* Renders a live preview of an Orbital schema (.orb program).
|
|
5
|
+
* Lazily loads the full runtime stack (providers, context, state machines)
|
|
6
|
+
* and renders the schema's UI via UISlotRenderer.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* <OrbPreview schema={orbJsonStringOrObject} />
|
|
10
|
+
*
|
|
11
|
+
* @packageDocumentation
|
|
12
|
+
*/
|
|
13
|
+
import React from 'react';
|
|
14
|
+
export interface OrbPreviewProps {
|
|
15
|
+
/** The orbital schema. Accepts a JSON string or a parsed object. */
|
|
16
|
+
schema: string | Record<string, unknown>;
|
|
17
|
+
/** Mock entity data keyed by entity name. */
|
|
18
|
+
mockData?: Record<string, unknown[]>;
|
|
19
|
+
/** Preview container height. Default: '400px'. */
|
|
20
|
+
height?: string;
|
|
21
|
+
/** CSS class for the outer container. */
|
|
22
|
+
className?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Renders a live preview of an Orbital schema.
|
|
26
|
+
*
|
|
27
|
+
* Lazily loads the full Almadar runtime (providers, state machines, slot system)
|
|
28
|
+
* and renders the schema's UI. Suitable for documentation sites, playgrounds,
|
|
29
|
+
* and any context where you want to show a running .orb program.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```tsx
|
|
33
|
+
* <OrbPreview schema={orbJsonString} height="300px" />
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function OrbPreview({ schema, mockData, height, className, }: OrbPreviewProps): React.ReactElement;
|
|
37
|
+
export declare namespace OrbPreview {
|
|
38
|
+
var displayName: string;
|
|
39
|
+
}
|
package/dist/runtime/index.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var React110 = require('react');
|
|
4
|
+
var providers = require('@almadar/ui/providers');
|
|
4
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
6
|
require('@tanstack/react-query');
|
|
6
7
|
require('react-dom');
|
|
@@ -56,7 +57,6 @@ var dark__default = /*#__PURE__*/_interopDefault(dark);
|
|
|
56
57
|
var __defProp = Object.defineProperty;
|
|
57
58
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
58
59
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
59
|
-
var EventBusContext = React110.createContext(null);
|
|
60
60
|
function getGlobalEventBus() {
|
|
61
61
|
if (typeof window !== "undefined") {
|
|
62
62
|
return window.__kflowEventBus ?? null;
|
|
@@ -124,7 +124,7 @@ var fallbackEventBus = {
|
|
|
124
124
|
}
|
|
125
125
|
};
|
|
126
126
|
function useEventBus() {
|
|
127
|
-
const context = React110.useContext(EventBusContext);
|
|
127
|
+
const context = React110.useContext(providers.EventBusContext);
|
|
128
128
|
return context ?? getGlobalEventBus() ?? fallbackEventBus;
|
|
129
129
|
}
|
|
130
130
|
React110.createContext(null);
|
|
@@ -255,6 +255,7 @@ function useTranslate() {
|
|
|
255
255
|
}
|
|
256
256
|
typeof process !== "undefined" && process.env?.VITE_API_URL ? process.env.VITE_API_URL : "http://localhost:3000";
|
|
257
257
|
React110.createContext(void 0);
|
|
258
|
+
React110.createContext(null);
|
|
258
259
|
var FetchedDataContext = React110.createContext(null);
|
|
259
260
|
function useFetchedDataContext() {
|
|
260
261
|
return React110.useContext(FetchedDataContext);
|
|
@@ -3013,8 +3014,144 @@ function useSlotsActions() {
|
|
|
3013
3014
|
}
|
|
3014
3015
|
return actions;
|
|
3015
3016
|
}
|
|
3017
|
+
var runtimeCache = null;
|
|
3018
|
+
async function loadRuntime() {
|
|
3019
|
+
if (runtimeCache) return runtimeCache;
|
|
3020
|
+
const [providers, context, runtime, components] = await Promise.all([
|
|
3021
|
+
import('@almadar/ui/providers'),
|
|
3022
|
+
import('@almadar/ui/context'),
|
|
3023
|
+
import('@almadar/ui/runtime'),
|
|
3024
|
+
import('@almadar/ui/components')
|
|
3025
|
+
]);
|
|
3026
|
+
runtimeCache = {
|
|
3027
|
+
OrbitalProvider: providers.OrbitalProvider,
|
|
3028
|
+
UISlotProvider: context.UISlotProvider,
|
|
3029
|
+
SlotsProvider: runtime.SlotsProvider,
|
|
3030
|
+
EntitySchemaProvider: runtime.EntitySchemaProvider,
|
|
3031
|
+
VerificationProvider: providers.VerificationProvider,
|
|
3032
|
+
UISlotRenderer: components.UISlotRenderer,
|
|
3033
|
+
useResolvedSchema: runtime.useResolvedSchema,
|
|
3034
|
+
useTraitStateMachine: runtime.useTraitStateMachine,
|
|
3035
|
+
useSlotsActions: runtime.useSlotsActions,
|
|
3036
|
+
useSlots: runtime.useSlots,
|
|
3037
|
+
useUISlots: context.useUISlots
|
|
3038
|
+
};
|
|
3039
|
+
return runtimeCache;
|
|
3040
|
+
}
|
|
3041
|
+
function normalizeChild(child) {
|
|
3042
|
+
const { type, children, ...rest } = child;
|
|
3043
|
+
const normalizedChildren = Array.isArray(children) ? children.map((c) => normalizeChild(c)) : children;
|
|
3044
|
+
return {
|
|
3045
|
+
type,
|
|
3046
|
+
props: { ...rest, ...normalizedChildren !== void 0 ? { children: normalizedChildren } : {} }
|
|
3047
|
+
};
|
|
3048
|
+
}
|
|
3049
|
+
function SlotBridge({ rt }) {
|
|
3050
|
+
const slots = rt.useSlots();
|
|
3051
|
+
const { render, clear } = rt.useUISlots();
|
|
3052
|
+
React110.useEffect(() => {
|
|
3053
|
+
for (const [slotName, slotState] of Object.entries(slots)) {
|
|
3054
|
+
if (slotState.patterns.length === 0) {
|
|
3055
|
+
clear(slotName);
|
|
3056
|
+
continue;
|
|
3057
|
+
}
|
|
3058
|
+
const entry = slotState.patterns[slotState.patterns.length - 1];
|
|
3059
|
+
const { type: patternType, children, ...inlineProps } = entry.pattern;
|
|
3060
|
+
const normalizedChildren = Array.isArray(children) ? children.map((c) => normalizeChild(c)) : children;
|
|
3061
|
+
render({
|
|
3062
|
+
target: slotName,
|
|
3063
|
+
pattern: patternType,
|
|
3064
|
+
props: {
|
|
3065
|
+
...inlineProps,
|
|
3066
|
+
...entry.props,
|
|
3067
|
+
...normalizedChildren !== void 0 ? { children: normalizedChildren } : {}
|
|
3068
|
+
},
|
|
3069
|
+
sourceTrait: slotState.source?.trait
|
|
3070
|
+
});
|
|
3071
|
+
}
|
|
3072
|
+
}, [slots]);
|
|
3073
|
+
return null;
|
|
3074
|
+
}
|
|
3075
|
+
function TraitInitializer({ rt, traits: traits2 }) {
|
|
3076
|
+
const slotsActions = rt.useSlotsActions();
|
|
3077
|
+
const { sendEvent } = rt.useTraitStateMachine(traits2, slotsActions, {});
|
|
3078
|
+
React110.useEffect(() => {
|
|
3079
|
+
const t = setTimeout(() => sendEvent("INIT"), 50);
|
|
3080
|
+
return () => clearTimeout(t);
|
|
3081
|
+
}, [traits2]);
|
|
3082
|
+
return null;
|
|
3083
|
+
}
|
|
3084
|
+
function SchemaRunner({ rt, schema, mockData }) {
|
|
3085
|
+
const { traits: traits2, allEntities, ir } = rt.useResolvedSchema(schema);
|
|
3086
|
+
const allPageTraits = React110.useMemo(() => {
|
|
3087
|
+
if (!ir?.pages || ir.pages.size <= 1) return traits2;
|
|
3088
|
+
const combined = [];
|
|
3089
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3090
|
+
for (const page of ir.pages.values()) {
|
|
3091
|
+
for (const t of page.traits) {
|
|
3092
|
+
const binding = t;
|
|
3093
|
+
const traitObj = binding.trait;
|
|
3094
|
+
const name = traitObj?.name ?? binding.name ?? "";
|
|
3095
|
+
if (name && !seen.has(name)) {
|
|
3096
|
+
seen.add(name);
|
|
3097
|
+
combined.push(t);
|
|
3098
|
+
}
|
|
3099
|
+
}
|
|
3100
|
+
}
|
|
3101
|
+
return combined.length > 0 ? combined : traits2;
|
|
3102
|
+
}, [ir, traits2]);
|
|
3103
|
+
return /* @__PURE__ */ jsxRuntime.jsx(rt.VerificationProvider, { enabled: true, children: /* @__PURE__ */ jsxRuntime.jsx(rt.SlotsProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(rt.EntitySchemaProvider, { entities: Array.from(allEntities.values()), children: [
|
|
3104
|
+
/* @__PURE__ */ jsxRuntime.jsx(TraitInitializer, { rt, traits: allPageTraits }),
|
|
3105
|
+
/* @__PURE__ */ jsxRuntime.jsx(SlotBridge, { rt }),
|
|
3106
|
+
/* @__PURE__ */ jsxRuntime.jsx(Box, { className: "min-h-full p-4", children: /* @__PURE__ */ jsxRuntime.jsx(rt.UISlotRenderer, { includeHud: true, hudMode: "inline", includeFloating: true }) })
|
|
3107
|
+
] }) }) });
|
|
3108
|
+
}
|
|
3109
|
+
function OrbPreview({
|
|
3110
|
+
schema,
|
|
3111
|
+
mockData = {},
|
|
3112
|
+
height = "400px",
|
|
3113
|
+
className
|
|
3114
|
+
}) {
|
|
3115
|
+
const [rt, setRt] = React110.useState(null);
|
|
3116
|
+
const [error, setError] = React110.useState(null);
|
|
3117
|
+
const parsedSchema = React110.useMemo(() => {
|
|
3118
|
+
if (typeof schema === "string") {
|
|
3119
|
+
try {
|
|
3120
|
+
return JSON.parse(schema);
|
|
3121
|
+
} catch (e) {
|
|
3122
|
+
return { error: String(e) };
|
|
3123
|
+
}
|
|
3124
|
+
}
|
|
3125
|
+
return schema;
|
|
3126
|
+
}, [schema]);
|
|
3127
|
+
React110.useEffect(() => {
|
|
3128
|
+
loadRuntime().then(setRt).catch((e) => setError(String(e)));
|
|
3129
|
+
}, []);
|
|
3130
|
+
if (parsedSchema.error) {
|
|
3131
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Box, { className, style: { height }, children: /* @__PURE__ */ jsxRuntime.jsxs(Typography, { as: "pre", color: "error", variant: "small", className: "font-mono whitespace-pre-wrap break-all m-0 p-4", children: [
|
|
3132
|
+
"Parse error: ",
|
|
3133
|
+
parsedSchema.error
|
|
3134
|
+
] }) });
|
|
3135
|
+
}
|
|
3136
|
+
if (error) {
|
|
3137
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Box, { className, style: { height }, children: /* @__PURE__ */ jsxRuntime.jsx(Typography, { as: "pre", color: "error", variant: "small", className: "font-mono whitespace-pre-wrap break-all m-0 p-4", children: error }) });
|
|
3138
|
+
}
|
|
3139
|
+
if (!rt) {
|
|
3140
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Box, { className: `flex items-center justify-center ${className ?? ""}`, style: { height }, children: /* @__PURE__ */ jsxRuntime.jsx(Typography, { color: "muted", variant: "small", children: "Loading runtime..." }) });
|
|
3141
|
+
}
|
|
3142
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3143
|
+
Box,
|
|
3144
|
+
{
|
|
3145
|
+
className: `overflow-auto border border-[var(--color-border)] rounded-[var(--radius-md)] ${className ?? ""}`,
|
|
3146
|
+
style: { height },
|
|
3147
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(rt.OrbitalProvider, { initialData: mockData, skipTheme: true, verification: true, children: /* @__PURE__ */ jsxRuntime.jsx(rt.UISlotProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(SchemaRunner, { rt, schema: parsedSchema, mockData }) }) })
|
|
3148
|
+
}
|
|
3149
|
+
);
|
|
3150
|
+
}
|
|
3151
|
+
OrbPreview.displayName = "OrbPreview";
|
|
3016
3152
|
|
|
3017
3153
|
exports.EntitySchemaProvider = EntitySchemaProvider;
|
|
3154
|
+
exports.OrbPreview = OrbPreview;
|
|
3018
3155
|
exports.SlotsProvider = SlotsProvider;
|
|
3019
3156
|
exports.TraitContext = TraitContext;
|
|
3020
3157
|
exports.TraitProvider = TraitProvider;
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -12,4 +12,5 @@ export { EntitySchemaProvider, useEntitySchema, useEntityDefinition, type Entity
|
|
|
12
12
|
export { TraitProvider, TraitContext, useTraitContext, useTrait, type TraitContextValue, type TraitInstance, type TraitProviderProps, } from './TraitProvider';
|
|
13
13
|
export { SlotsProvider, useSlots, useSlotContent, useSlotsActions, type SlotsState, type SlotState, type SlotPatternEntry, type SlotSource, type SlotsActions, type SlotsProviderProps, } from './ui/SlotsContext';
|
|
14
14
|
export { createClientEffectHandlers, type ClientEventBus, type SlotSetter, type CreateClientEffectHandlersOptions, } from './createClientEffectHandlers';
|
|
15
|
+
export { OrbPreview, type OrbPreviewProps } from './OrbPreview';
|
|
15
16
|
export type { ResolvedTraitBinding, ResolvedTrait, ResolvedEntity, ResolvedPage, ResolvedIR, } from './types';
|