@almadar/ui 5.29.0 → 5.31.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/avl/index.cjs +933 -6749
- package/dist/avl/index.js +934 -6750
- package/dist/components/core/atoms/Card.d.ts +2 -0
- package/dist/components/core/atoms/Input.d.ts +2 -0
- package/dist/components/core/atoms/Select.d.ts +18 -6
- package/dist/components/core/atoms/Spinner.d.ts +2 -0
- package/dist/components/core/atoms/index.d.ts +1 -1
- package/dist/components/core/molecules/DocumentViewer.d.ts +0 -2
- package/dist/components/core/molecules/Header.d.ts +0 -4
- package/dist/components/core/molecules/JsonTreeEditor.d.ts +3 -8
- package/dist/components/core/molecules/Menu.d.ts +4 -0
- package/dist/components/core/molecules/Navigation.d.ts +0 -2
- package/dist/components/core/molecules/PageHeader.d.ts +0 -2
- package/dist/components/core/molecules/PropertyInspector.d.ts +8 -1
- package/dist/components/core/molecules/index.d.ts +1 -1
- package/dist/components/core/organisms/index.d.ts +0 -1
- package/dist/components/core/templates/index.d.ts +0 -3
- package/dist/components/game/molecules/index.d.ts +0 -1
- package/dist/components/game/molecules/three/index.cjs +27 -2
- package/dist/components/game/molecules/three/index.js +27 -2
- package/dist/components/game/molecules/three/patterns.d.ts +20 -0
- package/dist/components/game/organisms/TraitSlot.d.ts +3 -1
- package/dist/components/game/organisms/types/isometric.d.ts +2 -0
- package/dist/components/index.cjs +1198 -1062
- package/dist/components/index.js +1201 -1064
- package/dist/docs/index.cjs +205 -172
- package/dist/docs/index.d.cts +4 -0
- package/dist/docs/index.js +146 -113
- package/dist/marketing/index.cjs +91 -54
- package/dist/marketing/index.d.cts +2 -0
- package/dist/marketing/index.js +58 -21
- package/dist/providers/index.cjs +563 -275
- package/dist/providers/index.js +563 -275
- package/dist/renderer/pattern-resolver.d.ts +2 -5
- package/dist/runtime/index.cjs +563 -275
- package/dist/runtime/index.js +563 -275
- package/package.json +16 -2
package/dist/docs/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var React8 = require('react');
|
|
4
4
|
var logger = require('@almadar/logger');
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var LucideIcons2 = require('lucide-react');
|
|
@@ -47,7 +47,7 @@ function _interopNamespace(e) {
|
|
|
47
47
|
return Object.freeze(n);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
var
|
|
50
|
+
var React8__default = /*#__PURE__*/_interopDefault(React8);
|
|
51
51
|
var LucideIcons2__namespace = /*#__PURE__*/_interopNamespace(LucideIcons2);
|
|
52
52
|
var PhosphorIcons__namespace = /*#__PURE__*/_interopNamespace(PhosphorIcons);
|
|
53
53
|
var TablerIcons__namespace = /*#__PURE__*/_interopNamespace(TablerIcons);
|
|
@@ -2576,17 +2576,17 @@ var init_EventBusProvider = __esm({
|
|
|
2576
2576
|
"use client";
|
|
2577
2577
|
logger.createLogger("almadar:eventbus");
|
|
2578
2578
|
logger.createLogger("almadar:eventbus:subscribe");
|
|
2579
|
-
EventBusContext =
|
|
2579
|
+
EventBusContext = React8.createContext(null);
|
|
2580
2580
|
}
|
|
2581
2581
|
});
|
|
2582
2582
|
function useTraitScope() {
|
|
2583
|
-
return
|
|
2583
|
+
return React8.useContext(TraitScopeContext);
|
|
2584
2584
|
}
|
|
2585
2585
|
var TraitScopeContext;
|
|
2586
2586
|
var init_TraitScopeProvider = __esm({
|
|
2587
2587
|
"providers/TraitScopeProvider.tsx"() {
|
|
2588
2588
|
"use client";
|
|
2589
|
-
TraitScopeContext =
|
|
2589
|
+
TraitScopeContext = React8.createContext(null);
|
|
2590
2590
|
}
|
|
2591
2591
|
});
|
|
2592
2592
|
function getGlobalEventBus() {
|
|
@@ -2596,10 +2596,10 @@ function getGlobalEventBus() {
|
|
|
2596
2596
|
return null;
|
|
2597
2597
|
}
|
|
2598
2598
|
function useEventBus() {
|
|
2599
|
-
const context =
|
|
2599
|
+
const context = React8.useContext(EventBusContext);
|
|
2600
2600
|
const baseBus = context ?? getGlobalEventBus() ?? fallbackEventBus;
|
|
2601
2601
|
const scope = useTraitScope();
|
|
2602
|
-
return
|
|
2602
|
+
return React8.useMemo(() => {
|
|
2603
2603
|
if (!scope) {
|
|
2604
2604
|
return {
|
|
2605
2605
|
...baseBus,
|
|
@@ -2816,7 +2816,7 @@ var init_Box = __esm({
|
|
|
2816
2816
|
fixed: "fixed",
|
|
2817
2817
|
sticky: "sticky"
|
|
2818
2818
|
};
|
|
2819
|
-
exports.Box =
|
|
2819
|
+
exports.Box = React8__default.default.forwardRef(
|
|
2820
2820
|
({
|
|
2821
2821
|
padding,
|
|
2822
2822
|
paddingX,
|
|
@@ -2846,27 +2846,27 @@ var init_Box = __esm({
|
|
|
2846
2846
|
...rest
|
|
2847
2847
|
}, ref) => {
|
|
2848
2848
|
const eventBus = useEventBus();
|
|
2849
|
-
const handleClick =
|
|
2849
|
+
const handleClick = React8.useCallback((e) => {
|
|
2850
2850
|
if (action) {
|
|
2851
2851
|
e.stopPropagation();
|
|
2852
2852
|
eventBus.emit(`UI:${action}`, actionPayload ?? {});
|
|
2853
2853
|
}
|
|
2854
2854
|
onClick?.(e);
|
|
2855
2855
|
}, [action, actionPayload, eventBus, onClick]);
|
|
2856
|
-
const handleMouseEnter =
|
|
2856
|
+
const handleMouseEnter = React8.useCallback((e) => {
|
|
2857
2857
|
if (hoverEvent) {
|
|
2858
2858
|
eventBus.emit(`UI:${hoverEvent}`, { hovered: true });
|
|
2859
2859
|
}
|
|
2860
2860
|
onMouseEnter?.(e);
|
|
2861
2861
|
}, [hoverEvent, eventBus, onMouseEnter]);
|
|
2862
|
-
const handleMouseLeave =
|
|
2862
|
+
const handleMouseLeave = React8.useCallback((e) => {
|
|
2863
2863
|
if (hoverEvent) {
|
|
2864
2864
|
eventBus.emit(`UI:${hoverEvent}`, { hovered: false });
|
|
2865
2865
|
}
|
|
2866
2866
|
onMouseLeave?.(e);
|
|
2867
2867
|
}, [hoverEvent, eventBus, onMouseLeave]);
|
|
2868
2868
|
const isClickable = action || onClick;
|
|
2869
|
-
return
|
|
2869
|
+
return React8__default.default.createElement(
|
|
2870
2870
|
Component,
|
|
2871
2871
|
{
|
|
2872
2872
|
ref,
|
|
@@ -3139,7 +3139,7 @@ function getIconFamilyServerSnapshot() {
|
|
|
3139
3139
|
return DEFAULT_FAMILY;
|
|
3140
3140
|
}
|
|
3141
3141
|
function useIconFamily() {
|
|
3142
|
-
return
|
|
3142
|
+
return React8.useSyncExternalStore(
|
|
3143
3143
|
subscribeIconFamily,
|
|
3144
3144
|
getIconFamilySnapshot,
|
|
3145
3145
|
getIconFamilyServerSnapshot
|
|
@@ -3856,7 +3856,7 @@ var init_Icon = __esm({
|
|
|
3856
3856
|
const directIcon = typeof icon === "string" ? void 0 : icon;
|
|
3857
3857
|
const effectiveName = typeof icon === "string" ? icon : name;
|
|
3858
3858
|
const family = useIconFamily();
|
|
3859
|
-
const RenderedComponent =
|
|
3859
|
+
const RenderedComponent = React8__default.default.useMemo(() => {
|
|
3860
3860
|
if (directIcon) return null;
|
|
3861
3861
|
return effectiveName ? resolveIconForFamily(effectiveName, family) : null;
|
|
3862
3862
|
}, [directIcon, effectiveName, family]);
|
|
@@ -3915,7 +3915,7 @@ function resolveIconProp(value, sizeClass) {
|
|
|
3915
3915
|
const IconComp = value;
|
|
3916
3916
|
return /* @__PURE__ */ jsxRuntime.jsx(IconComp, { className: sizeClass });
|
|
3917
3917
|
}
|
|
3918
|
-
if (
|
|
3918
|
+
if (React8__default.default.isValidElement(value)) {
|
|
3919
3919
|
return value;
|
|
3920
3920
|
}
|
|
3921
3921
|
if (typeof value === "object" && value !== null && "render" in value) {
|
|
@@ -3991,7 +3991,7 @@ var init_Button = __esm({
|
|
|
3991
3991
|
md: "h-icon-default w-icon-default",
|
|
3992
3992
|
lg: "h-icon-default w-icon-default"
|
|
3993
3993
|
};
|
|
3994
|
-
exports.Button =
|
|
3994
|
+
exports.Button = React8__default.default.forwardRef(
|
|
3995
3995
|
({
|
|
3996
3996
|
className,
|
|
3997
3997
|
variant = "primary",
|
|
@@ -4052,11 +4052,54 @@ var init_Button = __esm({
|
|
|
4052
4052
|
exports.Button.displayName = "Button";
|
|
4053
4053
|
}
|
|
4054
4054
|
});
|
|
4055
|
+
var sizeStyles2, Spinner;
|
|
4056
|
+
var init_Spinner = __esm({
|
|
4057
|
+
"components/core/atoms/Spinner.tsx"() {
|
|
4058
|
+
init_cn();
|
|
4059
|
+
init_Icon();
|
|
4060
|
+
sizeStyles2 = {
|
|
4061
|
+
xs: "h-3 w-3",
|
|
4062
|
+
sm: "h-icon-default w-icon-default",
|
|
4063
|
+
md: "h-6 w-6",
|
|
4064
|
+
lg: "h-8 w-8"
|
|
4065
|
+
};
|
|
4066
|
+
Spinner = React8__default.default.forwardRef(
|
|
4067
|
+
({ className, size = "md", overlay, ...props }, ref) => {
|
|
4068
|
+
if (overlay) {
|
|
4069
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4070
|
+
"div",
|
|
4071
|
+
{
|
|
4072
|
+
ref,
|
|
4073
|
+
className: cn(
|
|
4074
|
+
"absolute inset-0 z-10 flex items-center justify-center",
|
|
4075
|
+
"bg-background/60 backdrop-blur-sm",
|
|
4076
|
+
className
|
|
4077
|
+
),
|
|
4078
|
+
...props,
|
|
4079
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { name: "loader", className: cn("animate-spin text-foreground", sizeStyles2[size]) })
|
|
4080
|
+
}
|
|
4081
|
+
);
|
|
4082
|
+
}
|
|
4083
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4084
|
+
"div",
|
|
4085
|
+
{
|
|
4086
|
+
ref,
|
|
4087
|
+
className: cn("text-foreground", className),
|
|
4088
|
+
...props,
|
|
4089
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { name: "loader", className: cn("animate-spin", sizeStyles2[size]) })
|
|
4090
|
+
}
|
|
4091
|
+
);
|
|
4092
|
+
}
|
|
4093
|
+
);
|
|
4094
|
+
Spinner.displayName = "Spinner";
|
|
4095
|
+
}
|
|
4096
|
+
});
|
|
4055
4097
|
var variantStyles3, paddingStyles2, shadowStyles2, lookStyles; exports.Card = void 0; var CardHeader, CardTitle, CardContent, CardBody, CardFooter;
|
|
4056
4098
|
var init_Card = __esm({
|
|
4057
4099
|
"components/core/atoms/Card.tsx"() {
|
|
4058
4100
|
init_cn();
|
|
4059
4101
|
init_useEventBus();
|
|
4102
|
+
init_Spinner();
|
|
4060
4103
|
variantStyles3 = {
|
|
4061
4104
|
default: [
|
|
4062
4105
|
"bg-card",
|
|
@@ -4110,7 +4153,7 @@ var init_Card = __esm({
|
|
|
4110
4153
|
chip: "shadow-none rounded-pill border-[length:var(--border-width)] border-border",
|
|
4111
4154
|
"tile-image-first": "p-0 overflow-hidden"
|
|
4112
4155
|
};
|
|
4113
|
-
exports.Card =
|
|
4156
|
+
exports.Card = React8__default.default.forwardRef(
|
|
4114
4157
|
({
|
|
4115
4158
|
className,
|
|
4116
4159
|
variant = "bordered",
|
|
@@ -4121,6 +4164,7 @@ var init_Card = __esm({
|
|
|
4121
4164
|
look = "elevated",
|
|
4122
4165
|
children,
|
|
4123
4166
|
action,
|
|
4167
|
+
loading,
|
|
4124
4168
|
onClick,
|
|
4125
4169
|
...props
|
|
4126
4170
|
}, ref) => {
|
|
@@ -4134,7 +4178,7 @@ var init_Card = __esm({
|
|
|
4134
4178
|
{
|
|
4135
4179
|
ref,
|
|
4136
4180
|
className: cn(
|
|
4137
|
-
"rounded-container",
|
|
4181
|
+
"rounded-container relative",
|
|
4138
4182
|
"transition-all duration-[var(--transition-normal)]",
|
|
4139
4183
|
variantStyles3[variant],
|
|
4140
4184
|
paddingStyles2[padding],
|
|
@@ -4145,6 +4189,7 @@ var init_Card = __esm({
|
|
|
4145
4189
|
onClick: handleClick,
|
|
4146
4190
|
...props,
|
|
4147
4191
|
children: [
|
|
4192
|
+
loading && /* @__PURE__ */ jsxRuntime.jsx(Spinner, { overlay: true, size: "md" }),
|
|
4148
4193
|
(title || subtitle) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-4", children: [
|
|
4149
4194
|
title && /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-lg text-card-foreground font-bold", children: title }),
|
|
4150
4195
|
subtitle && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground mt-1", children: subtitle })
|
|
@@ -4156,9 +4201,9 @@ var init_Card = __esm({
|
|
|
4156
4201
|
}
|
|
4157
4202
|
);
|
|
4158
4203
|
exports.Card.displayName = "Card";
|
|
4159
|
-
CardHeader =
|
|
4204
|
+
CardHeader = React8__default.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("mb-4", className), ...props }));
|
|
4160
4205
|
CardHeader.displayName = "CardHeader";
|
|
4161
|
-
CardTitle =
|
|
4206
|
+
CardTitle = React8__default.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
4162
4207
|
"h3",
|
|
4163
4208
|
{
|
|
4164
4209
|
ref,
|
|
@@ -4171,11 +4216,11 @@ var init_Card = __esm({
|
|
|
4171
4216
|
}
|
|
4172
4217
|
));
|
|
4173
4218
|
CardTitle.displayName = "CardTitle";
|
|
4174
|
-
CardContent =
|
|
4219
|
+
CardContent = React8__default.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("", className), ...props }));
|
|
4175
4220
|
CardContent.displayName = "CardContent";
|
|
4176
4221
|
CardBody = CardContent;
|
|
4177
4222
|
CardBody.displayName = "CardBody";
|
|
4178
|
-
CardFooter =
|
|
4223
|
+
CardFooter = React8__default.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
4179
4224
|
"div",
|
|
4180
4225
|
{
|
|
4181
4226
|
ref,
|
|
@@ -4741,7 +4786,7 @@ var init_en = __esm({
|
|
|
4741
4786
|
}
|
|
4742
4787
|
});
|
|
4743
4788
|
function useTranslate() {
|
|
4744
|
-
return
|
|
4789
|
+
return React8.useContext(I18nContext);
|
|
4745
4790
|
}
|
|
4746
4791
|
var _meta, coreMessages, coreLocale, I18nContext;
|
|
4747
4792
|
var init_useTranslate = __esm({
|
|
@@ -4750,7 +4795,7 @@ var init_useTranslate = __esm({
|
|
|
4750
4795
|
init_en();
|
|
4751
4796
|
({ $meta: _meta, ...coreMessages } = en_default);
|
|
4752
4797
|
coreLocale = coreMessages;
|
|
4753
|
-
I18nContext =
|
|
4798
|
+
I18nContext = React8.createContext({
|
|
4754
4799
|
locale: "en",
|
|
4755
4800
|
direction: "ltr",
|
|
4756
4801
|
t: (key, params) => {
|
|
@@ -4774,11 +4819,13 @@ var init_Input = __esm({
|
|
|
4774
4819
|
init_Icon();
|
|
4775
4820
|
init_useTranslate();
|
|
4776
4821
|
init_useEventBus();
|
|
4777
|
-
exports.Input =
|
|
4822
|
+
exports.Input = React8__default.default.forwardRef(
|
|
4778
4823
|
({
|
|
4779
4824
|
className,
|
|
4780
4825
|
inputType,
|
|
4781
4826
|
type: htmlType,
|
|
4827
|
+
label,
|
|
4828
|
+
helperText,
|
|
4782
4829
|
error,
|
|
4783
4830
|
leftIcon,
|
|
4784
4831
|
rightIcon,
|
|
@@ -4834,82 +4881,95 @@ var init_Input = __esm({
|
|
|
4834
4881
|
onClear?.();
|
|
4835
4882
|
}
|
|
4836
4883
|
};
|
|
4884
|
+
const wrapField = (field) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full", children: [
|
|
4885
|
+
label && /* @__PURE__ */ jsxRuntime.jsx("label", { className: "block text-sm font-medium text-foreground mb-1", children: label }),
|
|
4886
|
+
field,
|
|
4887
|
+
(helperText || error) && /* @__PURE__ */ jsxRuntime.jsx("p", { className: cn("mt-1 text-xs", error ? "text-error" : "text-muted-foreground"), children: error ?? helperText })
|
|
4888
|
+
] });
|
|
4837
4889
|
if (type === "select") {
|
|
4838
|
-
return
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4890
|
+
return wrapField(
|
|
4891
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative w-full", children: [
|
|
4892
|
+
resolvedLeftIcon && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none text-muted-foreground", children: resolvedLeftIcon }),
|
|
4893
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
4894
|
+
"select",
|
|
4895
|
+
{
|
|
4896
|
+
ref,
|
|
4897
|
+
value,
|
|
4898
|
+
onChange: handleChange,
|
|
4899
|
+
className: cn(baseClassName, "appearance-none pr-10", className),
|
|
4900
|
+
...props,
|
|
4901
|
+
children: [
|
|
4902
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "", children: t("form.selectPlaceholder", { label: "" }) }),
|
|
4903
|
+
options?.map((opt) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: opt.value, children: opt.label }, opt.value))
|
|
4904
|
+
]
|
|
4905
|
+
}
|
|
4906
|
+
),
|
|
4907
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none text-muted-foreground", children: /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { name: "chevron-down", className: "h-icon-default w-icon-default" }) })
|
|
4908
|
+
] })
|
|
4909
|
+
);
|
|
4910
|
+
}
|
|
4911
|
+
if (type === "textarea") {
|
|
4912
|
+
return wrapField(
|
|
4913
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative w-full", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4914
|
+
"textarea",
|
|
4842
4915
|
{
|
|
4843
4916
|
ref,
|
|
4844
4917
|
value,
|
|
4845
4918
|
onChange: handleChange,
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "", children: t("form.selectPlaceholder", { label: "" }) }),
|
|
4850
|
-
options?.map((opt) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: opt.value, children: opt.label }, opt.value))
|
|
4851
|
-
]
|
|
4919
|
+
rows,
|
|
4920
|
+
className: baseClassName,
|
|
4921
|
+
...props
|
|
4852
4922
|
}
|
|
4853
|
-
)
|
|
4854
|
-
|
|
4855
|
-
] });
|
|
4856
|
-
}
|
|
4857
|
-
if (type === "textarea") {
|
|
4858
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative w-full", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4859
|
-
"textarea",
|
|
4860
|
-
{
|
|
4861
|
-
ref,
|
|
4862
|
-
value,
|
|
4863
|
-
onChange: handleChange,
|
|
4864
|
-
rows,
|
|
4865
|
-
className: baseClassName,
|
|
4866
|
-
...props
|
|
4867
|
-
}
|
|
4868
|
-
) });
|
|
4923
|
+
) })
|
|
4924
|
+
);
|
|
4869
4925
|
}
|
|
4870
4926
|
if (type === "checkbox") {
|
|
4871
|
-
return
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4927
|
+
return wrapField(
|
|
4928
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4929
|
+
"input",
|
|
4930
|
+
{
|
|
4931
|
+
ref,
|
|
4932
|
+
type: "checkbox",
|
|
4933
|
+
checked: props.checked,
|
|
4934
|
+
onChange: handleChange,
|
|
4935
|
+
className: cn(
|
|
4936
|
+
"h-icon-default w-icon-default rounded-sm",
|
|
4937
|
+
"border-border",
|
|
4938
|
+
"text-primary focus:ring-ring",
|
|
4939
|
+
"disabled:opacity-50 disabled:cursor-not-allowed",
|
|
4940
|
+
className
|
|
4941
|
+
),
|
|
4942
|
+
...props
|
|
4943
|
+
}
|
|
4944
|
+
)
|
|
4887
4945
|
);
|
|
4888
4946
|
}
|
|
4889
|
-
return
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
|
|
4947
|
+
return wrapField(
|
|
4948
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative w-full", children: [
|
|
4949
|
+
resolvedLeftIcon && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none text-muted-foreground", children: resolvedLeftIcon }),
|
|
4950
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4951
|
+
"input",
|
|
4952
|
+
{
|
|
4953
|
+
ref,
|
|
4954
|
+
type,
|
|
4955
|
+
value,
|
|
4956
|
+
onChange: handleChange,
|
|
4957
|
+
className: baseClassName,
|
|
4958
|
+
...props
|
|
4959
|
+
}
|
|
4960
|
+
),
|
|
4961
|
+
showClearButton && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4962
|
+
"button",
|
|
4963
|
+
{
|
|
4964
|
+
type: "button",
|
|
4965
|
+
onClick: handleClear,
|
|
4966
|
+
className: "absolute inset-y-0 right-0 pr-3 flex items-center text-muted-foreground hover:text-foreground",
|
|
4967
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { name: "x", className: "h-icon-default w-icon-default" })
|
|
4968
|
+
}
|
|
4969
|
+
),
|
|
4970
|
+
rightIcon && !showClearButton && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-y-0 right-0 pr-3 flex items-center text-muted-foreground", children: resolveIconNode(rightIcon, iconCls) })
|
|
4971
|
+
] })
|
|
4972
|
+
);
|
|
4913
4973
|
}
|
|
4914
4974
|
);
|
|
4915
4975
|
exports.Input.displayName = "Input";
|
|
@@ -4927,7 +4987,7 @@ var init_DocSidebar = __esm({
|
|
|
4927
4987
|
init_Icon();
|
|
4928
4988
|
init_useTranslate();
|
|
4929
4989
|
DocSidebarCategory = ({ item, depth }) => {
|
|
4930
|
-
const [expanded, setExpanded] =
|
|
4990
|
+
const [expanded, setExpanded] = React8.useState(
|
|
4931
4991
|
() => item.items?.some(function hasActive(child) {
|
|
4932
4992
|
if (child.active) return true;
|
|
4933
4993
|
return child.items?.some(hasActive) ?? false;
|
|
@@ -5108,7 +5168,7 @@ var init_DocBreadcrumb = __esm({
|
|
|
5108
5168
|
"aria-label": t("aria.breadcrumb"),
|
|
5109
5169
|
children: /* @__PURE__ */ jsxRuntime.jsx(exports.HStack, { gap: "xs", align: "center", wrap: true, children: items.map((item, idx) => {
|
|
5110
5170
|
const isLast = idx === items.length - 1;
|
|
5111
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5171
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React8__default.default.Fragment, { children: [
|
|
5112
5172
|
idx > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
5113
5173
|
exports.Icon,
|
|
5114
5174
|
{
|
|
@@ -5166,7 +5226,7 @@ var init_Textarea = __esm({
|
|
|
5166
5226
|
"components/core/atoms/Textarea.tsx"() {
|
|
5167
5227
|
init_cn();
|
|
5168
5228
|
init_useEventBus();
|
|
5169
|
-
Textarea =
|
|
5229
|
+
Textarea = React8__default.default.forwardRef(
|
|
5170
5230
|
({ className, error, onChange, ...props }, ref) => {
|
|
5171
5231
|
const eventBus = useEventBus();
|
|
5172
5232
|
const handleChange = (e) => {
|
|
@@ -5200,7 +5260,7 @@ var init_Textarea = __esm({
|
|
|
5200
5260
|
Textarea.displayName = "Textarea";
|
|
5201
5261
|
}
|
|
5202
5262
|
});
|
|
5203
|
-
var variantStyles5,
|
|
5263
|
+
var variantStyles5, sizeStyles3, Badge;
|
|
5204
5264
|
var init_Badge = __esm({
|
|
5205
5265
|
"components/core/atoms/Badge.tsx"() {
|
|
5206
5266
|
init_cn();
|
|
@@ -5237,12 +5297,12 @@ var init_Badge = __esm({
|
|
|
5237
5297
|
"border-[length:var(--border-width-thin)] border-border"
|
|
5238
5298
|
].join(" ")
|
|
5239
5299
|
};
|
|
5240
|
-
|
|
5300
|
+
sizeStyles3 = {
|
|
5241
5301
|
sm: "px-2 py-0.5 text-xs",
|
|
5242
5302
|
md: "px-2.5 py-1 text-sm",
|
|
5243
5303
|
lg: "px-3 py-1.5 text-base"
|
|
5244
5304
|
};
|
|
5245
|
-
Badge =
|
|
5305
|
+
Badge = React8__default.default.forwardRef(
|
|
5246
5306
|
({ className, variant = "default", size = "sm", amount, label, icon, children, onRemove, removeLabel, ...props }, ref) => {
|
|
5247
5307
|
const iconSizes = {
|
|
5248
5308
|
sm: "h-icon-default w-icon-default",
|
|
@@ -5257,7 +5317,7 @@ var init_Badge = __esm({
|
|
|
5257
5317
|
className: cn(
|
|
5258
5318
|
"inline-flex items-center gap-1 font-bold rounded-sm",
|
|
5259
5319
|
variantStyles5[variant],
|
|
5260
|
-
|
|
5320
|
+
sizeStyles3[size],
|
|
5261
5321
|
onRemove && "pr-1",
|
|
5262
5322
|
className
|
|
5263
5323
|
),
|
|
@@ -5291,33 +5351,6 @@ var init_Badge = __esm({
|
|
|
5291
5351
|
Badge.displayName = "Badge";
|
|
5292
5352
|
}
|
|
5293
5353
|
});
|
|
5294
|
-
var sizeStyles3, Spinner;
|
|
5295
|
-
var init_Spinner = __esm({
|
|
5296
|
-
"components/core/atoms/Spinner.tsx"() {
|
|
5297
|
-
init_cn();
|
|
5298
|
-
init_Icon();
|
|
5299
|
-
sizeStyles3 = {
|
|
5300
|
-
xs: "h-3 w-3",
|
|
5301
|
-
sm: "h-icon-default w-icon-default",
|
|
5302
|
-
md: "h-6 w-6",
|
|
5303
|
-
lg: "h-8 w-8"
|
|
5304
|
-
};
|
|
5305
|
-
Spinner = React7__default.default.forwardRef(
|
|
5306
|
-
({ className, size = "md", ...props }, ref) => {
|
|
5307
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5308
|
-
"div",
|
|
5309
|
-
{
|
|
5310
|
-
ref,
|
|
5311
|
-
className: cn("text-foreground", className),
|
|
5312
|
-
...props,
|
|
5313
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { name: "loader", className: cn("animate-spin", sizeStyles3[size]) })
|
|
5314
|
-
}
|
|
5315
|
-
);
|
|
5316
|
-
}
|
|
5317
|
-
);
|
|
5318
|
-
Spinner.displayName = "Spinner";
|
|
5319
|
-
}
|
|
5320
|
-
});
|
|
5321
5354
|
|
|
5322
5355
|
// components/game/atoms/index.ts
|
|
5323
5356
|
var init_atoms = __esm({
|
|
@@ -5366,11 +5399,11 @@ var init_Tabs = __esm({
|
|
|
5366
5399
|
const eventBus = useEventBus();
|
|
5367
5400
|
const { t } = useTranslate();
|
|
5368
5401
|
const initialActive = safeItems.find((item) => item.active)?.id;
|
|
5369
|
-
const [internalActiveTab, setInternalActiveTab] =
|
|
5402
|
+
const [internalActiveTab, setInternalActiveTab] = React8.useState(
|
|
5370
5403
|
defaultActiveTab || initialActive || safeItems[0]?.id || ""
|
|
5371
5404
|
);
|
|
5372
5405
|
const activeTab = controlledActiveTab !== void 0 ? controlledActiveTab : internalActiveTab;
|
|
5373
|
-
const tabRefs =
|
|
5406
|
+
const tabRefs = React8.useRef({});
|
|
5374
5407
|
const handleTabChange = (tabId, tabEvent) => {
|
|
5375
5408
|
if (controlledActiveTab === void 0) {
|
|
5376
5409
|
setInternalActiveTab(tabId);
|
|
@@ -5862,7 +5895,7 @@ var init_CodeBlock = __esm({
|
|
|
5862
5895
|
};
|
|
5863
5896
|
LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
|
|
5864
5897
|
HIDDEN_LINE_NUMBERS = { display: "none" };
|
|
5865
|
-
exports.DocCodeBlock =
|
|
5898
|
+
exports.DocCodeBlock = React8__default.default.memo(
|
|
5866
5899
|
({
|
|
5867
5900
|
code: rawCode,
|
|
5868
5901
|
language = "text",
|
|
@@ -5894,16 +5927,16 @@ var init_CodeBlock = __esm({
|
|
|
5894
5927
|
const activeStyle = isOrb ? orbStyle : isLolo ? loloStyle : dark__default.default;
|
|
5895
5928
|
const eventBus = useEventBus();
|
|
5896
5929
|
const { t } = useTranslate();
|
|
5897
|
-
const scrollRef =
|
|
5898
|
-
const codeRef =
|
|
5899
|
-
const savedScrollLeftRef =
|
|
5900
|
-
const [copied, setCopied] =
|
|
5901
|
-
const [wrap, setWrap] =
|
|
5902
|
-
const [activeFileIndex, setActiveFileIndex] =
|
|
5930
|
+
const scrollRef = React8.useRef(null);
|
|
5931
|
+
const codeRef = React8.useRef(null);
|
|
5932
|
+
const savedScrollLeftRef = React8.useRef(0);
|
|
5933
|
+
const [copied, setCopied] = React8.useState(false);
|
|
5934
|
+
const [wrap, setWrap] = React8.useState(wordWrap);
|
|
5935
|
+
const [activeFileIndex, setActiveFileIndex] = React8.useState(0);
|
|
5903
5936
|
const activeFile = files?.[activeFileIndex];
|
|
5904
5937
|
const activeCode = activeFile?.code ?? code;
|
|
5905
5938
|
const activeLanguage = activeFile?.language ?? language;
|
|
5906
|
-
const diffLines =
|
|
5939
|
+
const diffLines = React8.useMemo(() => {
|
|
5907
5940
|
if (propDiff) return propDiff;
|
|
5908
5941
|
if (mode === "diff" && oldValue !== void 0 && newValue !== void 0) {
|
|
5909
5942
|
return generateDiff(oldValue, newValue);
|
|
@@ -5912,19 +5945,19 @@ var init_CodeBlock = __esm({
|
|
|
5912
5945
|
}, [propDiff, mode, oldValue, newValue]);
|
|
5913
5946
|
const isViewerMode = !!(title || files || showLineNumbers || diffLines || mode === "diff" || actions);
|
|
5914
5947
|
const effectiveCopy = showCopy ?? showCopyButton;
|
|
5915
|
-
const [editableValue, setEditableValue] =
|
|
5916
|
-
const [editableTextareaKey, setEditableTextareaKey] =
|
|
5917
|
-
const lastPropCodeRef =
|
|
5918
|
-
const editableTextareaRef =
|
|
5919
|
-
const editableOverlayRef =
|
|
5920
|
-
|
|
5948
|
+
const [editableValue, setEditableValue] = React8.useState(code);
|
|
5949
|
+
const [editableTextareaKey, setEditableTextareaKey] = React8.useState(0);
|
|
5950
|
+
const lastPropCodeRef = React8.useRef(code);
|
|
5951
|
+
const editableTextareaRef = React8.useRef(null);
|
|
5952
|
+
const editableOverlayRef = React8.useRef(null);
|
|
5953
|
+
React8.useEffect(() => {
|
|
5921
5954
|
if (code !== lastPropCodeRef.current) {
|
|
5922
5955
|
lastPropCodeRef.current = code;
|
|
5923
5956
|
setEditableValue(code);
|
|
5924
5957
|
setEditableTextareaKey((k) => k + 1);
|
|
5925
5958
|
}
|
|
5926
5959
|
}, [code]);
|
|
5927
|
-
const handleEditableScroll =
|
|
5960
|
+
const handleEditableScroll = React8.useCallback(() => {
|
|
5928
5961
|
const ta = editableTextareaRef.current;
|
|
5929
5962
|
const ov = editableOverlayRef.current;
|
|
5930
5963
|
if (ta && ov) {
|
|
@@ -5932,7 +5965,7 @@ var init_CodeBlock = __esm({
|
|
|
5932
5965
|
ov.scrollLeft = ta.scrollLeft;
|
|
5933
5966
|
}
|
|
5934
5967
|
}, []);
|
|
5935
|
-
const errorLineProps =
|
|
5968
|
+
const errorLineProps = React8.useMemo(() => {
|
|
5936
5969
|
if (!errorLines || errorLines.size === 0) {
|
|
5937
5970
|
return LINE_PROPS_FN;
|
|
5938
5971
|
}
|
|
@@ -5955,17 +5988,17 @@ var init_CodeBlock = __esm({
|
|
|
5955
5988
|
};
|
|
5956
5989
|
}, [errorLines]);
|
|
5957
5990
|
const isFoldable = foldableProp ?? true;
|
|
5958
|
-
const [collapsed, setCollapsed] =
|
|
5959
|
-
const foldRegions =
|
|
5991
|
+
const [collapsed, setCollapsed] = React8.useState(() => /* @__PURE__ */ new Set());
|
|
5992
|
+
const foldRegions = React8.useMemo(
|
|
5960
5993
|
() => isFoldable ? computeFoldRegions(code) : [],
|
|
5961
5994
|
[code, isFoldable]
|
|
5962
5995
|
);
|
|
5963
|
-
const foldStartMap =
|
|
5996
|
+
const foldStartMap = React8.useMemo(() => {
|
|
5964
5997
|
const m = /* @__PURE__ */ new Map();
|
|
5965
5998
|
for (const r2 of foldRegions) m.set(r2.start, r2);
|
|
5966
5999
|
return m;
|
|
5967
6000
|
}, [foldRegions]);
|
|
5968
|
-
const hiddenLines =
|
|
6001
|
+
const hiddenLines = React8.useMemo(() => {
|
|
5969
6002
|
const h = /* @__PURE__ */ new Set();
|
|
5970
6003
|
for (const r2 of foldRegions) {
|
|
5971
6004
|
if (!collapsed.has(r2.start)) continue;
|
|
@@ -5973,13 +6006,13 @@ var init_CodeBlock = __esm({
|
|
|
5973
6006
|
}
|
|
5974
6007
|
return h;
|
|
5975
6008
|
}, [foldRegions, collapsed]);
|
|
5976
|
-
const collapsedRef =
|
|
6009
|
+
const collapsedRef = React8.useRef(collapsed);
|
|
5977
6010
|
collapsedRef.current = collapsed;
|
|
5978
|
-
const foldStartMapRef =
|
|
6011
|
+
const foldStartMapRef = React8.useRef(foldStartMap);
|
|
5979
6012
|
foldStartMapRef.current = foldStartMap;
|
|
5980
|
-
const hiddenLinesRef =
|
|
6013
|
+
const hiddenLinesRef = React8.useRef(hiddenLines);
|
|
5981
6014
|
hiddenLinesRef.current = hiddenLines;
|
|
5982
|
-
const toggleFold =
|
|
6015
|
+
const toggleFold = React8.useCallback((lineNum) => {
|
|
5983
6016
|
setCollapsed((prev) => {
|
|
5984
6017
|
const next = new Set(prev);
|
|
5985
6018
|
if (next.has(lineNum)) next.delete(lineNum);
|
|
@@ -5987,12 +6020,12 @@ var init_CodeBlock = __esm({
|
|
|
5987
6020
|
return next;
|
|
5988
6021
|
});
|
|
5989
6022
|
}, []);
|
|
5990
|
-
const toggleFoldRef =
|
|
6023
|
+
const toggleFoldRef = React8.useRef(toggleFold);
|
|
5991
6024
|
toggleFoldRef.current = toggleFold;
|
|
5992
|
-
|
|
6025
|
+
React8.useEffect(() => {
|
|
5993
6026
|
setCollapsed(/* @__PURE__ */ new Set());
|
|
5994
6027
|
}, [code]);
|
|
5995
|
-
const highlightedElement =
|
|
6028
|
+
const highlightedElement = React8.useMemo(
|
|
5996
6029
|
() => /* @__PURE__ */ jsxRuntime.jsx(
|
|
5997
6030
|
SyntaxHighlighter__default.default,
|
|
5998
6031
|
{
|
|
@@ -6017,7 +6050,7 @@ var init_CodeBlock = __esm({
|
|
|
6017
6050
|
),
|
|
6018
6051
|
[code, language, activeStyle]
|
|
6019
6052
|
);
|
|
6020
|
-
|
|
6053
|
+
React8.useLayoutEffect(() => {
|
|
6021
6054
|
const container = codeRef.current;
|
|
6022
6055
|
if (!container) return;
|
|
6023
6056
|
container.querySelectorAll(".fold-toggle, .fold-summary").forEach((el) => el.remove());
|
|
@@ -6061,17 +6094,17 @@ var init_CodeBlock = __esm({
|
|
|
6061
6094
|
}
|
|
6062
6095
|
});
|
|
6063
6096
|
}, [collapsed, hiddenLines, foldStartMap, foldRegions, isFoldable]);
|
|
6064
|
-
|
|
6097
|
+
React8.useLayoutEffect(() => {
|
|
6065
6098
|
const el = scrollRef.current;
|
|
6066
6099
|
return () => {
|
|
6067
6100
|
if (el) savedScrollLeftRef.current = el.scrollLeft;
|
|
6068
6101
|
};
|
|
6069
6102
|
}, [language, code]);
|
|
6070
|
-
|
|
6103
|
+
React8.useLayoutEffect(() => {
|
|
6071
6104
|
const el = scrollRef.current;
|
|
6072
6105
|
if (el) el.scrollLeft = savedScrollLeftRef.current;
|
|
6073
6106
|
}, [language, code]);
|
|
6074
|
-
|
|
6107
|
+
React8.useEffect(() => {
|
|
6075
6108
|
const el = scrollRef.current;
|
|
6076
6109
|
if (!el) return;
|
|
6077
6110
|
const handle = () => {
|
|
@@ -6091,7 +6124,7 @@ var init_CodeBlock = __esm({
|
|
|
6091
6124
|
eventBus.emit("UI:COPY_CODE", { language: activeLanguage, success: false });
|
|
6092
6125
|
}
|
|
6093
6126
|
};
|
|
6094
|
-
const handleSelectionCopy =
|
|
6127
|
+
const handleSelectionCopy = React8.useCallback((e) => {
|
|
6095
6128
|
if (hiddenLinesRef.current.size === 0) return;
|
|
6096
6129
|
const sel = typeof window !== "undefined" ? window.getSelection() : null;
|
|
6097
6130
|
if (!sel || sel.rangeCount === 0 || sel.isCollapsed) return;
|
|
@@ -6537,13 +6570,13 @@ function DocSearch({
|
|
|
6537
6570
|
}) {
|
|
6538
6571
|
const { t } = useTranslate();
|
|
6539
6572
|
const resolvedPlaceholder = placeholder ?? t("docSearch.placeholder");
|
|
6540
|
-
const [query, setQuery] =
|
|
6541
|
-
const [results, setResults] =
|
|
6542
|
-
const [isOpen, setIsOpen] =
|
|
6543
|
-
const [activeIndex, setActiveIndex] =
|
|
6544
|
-
const containerRef =
|
|
6545
|
-
const debounceRef =
|
|
6546
|
-
|
|
6573
|
+
const [query, setQuery] = React8.useState("");
|
|
6574
|
+
const [results, setResults] = React8.useState([]);
|
|
6575
|
+
const [isOpen, setIsOpen] = React8.useState(false);
|
|
6576
|
+
const [activeIndex, setActiveIndex] = React8.useState(-1);
|
|
6577
|
+
const containerRef = React8.useRef(null);
|
|
6578
|
+
const debounceRef = React8.useRef(void 0);
|
|
6579
|
+
React8.useEffect(() => {
|
|
6547
6580
|
function handleClickOutside(e) {
|
|
6548
6581
|
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
6549
6582
|
setIsOpen(false);
|
|
@@ -6552,7 +6585,7 @@ function DocSearch({
|
|
|
6552
6585
|
document.addEventListener("mousedown", handleClickOutside);
|
|
6553
6586
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
6554
6587
|
}, []);
|
|
6555
|
-
const performSearch =
|
|
6588
|
+
const performSearch = React8.useCallback(
|
|
6556
6589
|
(value) => {
|
|
6557
6590
|
if (!onSearch || !value.trim()) {
|
|
6558
6591
|
setResults([]);
|
|
@@ -6574,7 +6607,7 @@ function DocSearch({
|
|
|
6574
6607
|
},
|
|
6575
6608
|
[onSearch]
|
|
6576
6609
|
);
|
|
6577
|
-
const handleChange =
|
|
6610
|
+
const handleChange = React8.useCallback(
|
|
6578
6611
|
(e) => {
|
|
6579
6612
|
const value = e.target.value;
|
|
6580
6613
|
setQuery(value);
|
|
@@ -6587,18 +6620,18 @@ function DocSearch({
|
|
|
6587
6620
|
},
|
|
6588
6621
|
[performSearch]
|
|
6589
6622
|
);
|
|
6590
|
-
const handleFocus =
|
|
6623
|
+
const handleFocus = React8.useCallback(() => {
|
|
6591
6624
|
if (results.length > 0) {
|
|
6592
6625
|
setIsOpen(true);
|
|
6593
6626
|
}
|
|
6594
6627
|
}, [results]);
|
|
6595
|
-
const navigateTo =
|
|
6628
|
+
const navigateTo = React8.useCallback((href) => {
|
|
6596
6629
|
setIsOpen(false);
|
|
6597
6630
|
setQuery("");
|
|
6598
6631
|
setResults([]);
|
|
6599
6632
|
window.location.href = href;
|
|
6600
6633
|
}, []);
|
|
6601
|
-
const handleKeyDown =
|
|
6634
|
+
const handleKeyDown = React8.useCallback(
|
|
6602
6635
|
(e) => {
|
|
6603
6636
|
if (e.key === "Escape") {
|
|
6604
6637
|
setIsOpen(false);
|
|
@@ -6625,7 +6658,7 @@ function DocSearch({
|
|
|
6625
6658
|
},
|
|
6626
6659
|
[isOpen, results, activeIndex, navigateTo]
|
|
6627
6660
|
);
|
|
6628
|
-
|
|
6661
|
+
React8.useEffect(() => {
|
|
6629
6662
|
return () => {
|
|
6630
6663
|
if (debounceRef.current) {
|
|
6631
6664
|
clearTimeout(debounceRef.current);
|