@almadar/ui 4.45.0 → 4.47.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 +173 -58
- package/dist/avl/index.js +174 -59
- package/dist/components/atoms/index.d.ts +1 -1
- package/dist/components/index.cjs +82 -69
- package/dist/components/index.js +82 -69
- package/dist/components/molecules/game/ResourceBar.d.ts +1 -1
- package/dist/components/organisms/layout/{MasterDetail.d.ts → MasterDetailLayout.d.ts} +3 -3
- package/dist/components/organisms/layout/index.d.ts +1 -1
- package/dist/providers/index.cjs +73 -27
- package/dist/providers/index.js +73 -27
- package/dist/runtime/index.cjs +192 -39
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.js +186 -41
- package/dist/runtime/perf.d.ts +34 -0
- package/package.json +1 -1
- /package/dist/components/atoms/{StatCard.d.ts → MarketingStatCard.d.ts} +0 -0
package/dist/runtime/index.cjs
CHANGED
|
@@ -5630,8 +5630,8 @@ function Seigaiha({ size, color, strokeWidth }) {
|
|
|
5630
5630
|
[s, s * 0.1]
|
|
5631
5631
|
];
|
|
5632
5632
|
for (const [cx, cy] of centers) {
|
|
5633
|
-
for (let
|
|
5634
|
-
const cr = r * (
|
|
5633
|
+
for (let ring2 = 1; ring2 <= 3; ring2++) {
|
|
5634
|
+
const cr = r * (ring2 / 3);
|
|
5635
5635
|
paths.push(
|
|
5636
5636
|
`M ${f(cx - cr)},${f(cy)} A ${f(cr)} ${f(cr)} 0 0 1 ${f(cx + cr)},${f(cy)}`
|
|
5637
5637
|
);
|
|
@@ -5728,8 +5728,8 @@ function Arch({ size, color, strokeWidth }) {
|
|
|
5728
5728
|
const h = size * 1.5;
|
|
5729
5729
|
const cx = w / 2;
|
|
5730
5730
|
const paths = [];
|
|
5731
|
-
for (let
|
|
5732
|
-
const scale = 1 -
|
|
5731
|
+
for (let ring2 = 0; ring2 < 4; ring2++) {
|
|
5732
|
+
const scale = 1 - ring2 * 0.2;
|
|
5733
5733
|
const archW = w * 0.48 * scale;
|
|
5734
5734
|
const archH = h * 0.7 * scale;
|
|
5735
5735
|
const baseY = h * 0.85;
|
|
@@ -5744,7 +5744,7 @@ function Arch({ size, color, strokeWidth }) {
|
|
|
5744
5744
|
paths.push(
|
|
5745
5745
|
`M ${f(lx)},${f(baseY)} A ${f(radius)} ${f(radius)} 0 0 1 ${f(cx)},${f(tipY)} A ${f(radius)} ${f(radius)} 0 0 1 ${f(rx)},${f(baseY)}`
|
|
5746
5746
|
);
|
|
5747
|
-
if (
|
|
5747
|
+
if (ring2 === 0) {
|
|
5748
5748
|
paths.push(`M ${f(lx)},${f(baseY)} L ${f(rx)},${f(baseY)}`);
|
|
5749
5749
|
}
|
|
5750
5750
|
}
|
|
@@ -6432,12 +6432,15 @@ function ControlButton({
|
|
|
6432
6432
|
sizeMap3[size] ?? sizeMap3.md,
|
|
6433
6433
|
shapeMap[shape] ?? shapeMap.circle,
|
|
6434
6434
|
variantMap[variant] ?? variantMap.secondary,
|
|
6435
|
-
actualPressed && "scale-95 brightness-110 border-
|
|
6435
|
+
actualPressed && "scale-95 brightness-110 border-foreground",
|
|
6436
6436
|
disabled && "opacity-50 cursor-not-allowed",
|
|
6437
6437
|
className
|
|
6438
6438
|
),
|
|
6439
6439
|
children: [
|
|
6440
|
-
icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-2xl", children: icon
|
|
6440
|
+
icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-2xl", children: typeof icon === "string" ? (() => {
|
|
6441
|
+
const I = resolveIcon(icon);
|
|
6442
|
+
return I ? /* @__PURE__ */ jsxRuntime.jsx(I, { className: "w-6 h-6" }) : null;
|
|
6443
|
+
})() : icon }),
|
|
6441
6444
|
label && !icon && /* @__PURE__ */ jsxRuntime.jsx("span", { children: label })
|
|
6442
6445
|
]
|
|
6443
6446
|
}
|
|
@@ -6449,6 +6452,7 @@ var init_ControlButton = __esm({
|
|
|
6449
6452
|
"use client";
|
|
6450
6453
|
init_cn();
|
|
6451
6454
|
init_useEventBus();
|
|
6455
|
+
init_Icon();
|
|
6452
6456
|
sizeMap3 = {
|
|
6453
6457
|
sm: "w-10 h-10 text-sm",
|
|
6454
6458
|
md: "w-14 h-14 text-base",
|
|
@@ -6461,9 +6465,9 @@ var init_ControlButton = __esm({
|
|
|
6461
6465
|
square: "rounded-md"
|
|
6462
6466
|
};
|
|
6463
6467
|
variantMap = {
|
|
6464
|
-
primary: "bg-
|
|
6465
|
-
secondary: "bg-
|
|
6466
|
-
ghost: "bg-transparent text-
|
|
6468
|
+
primary: "bg-primary text-primary-foreground border-primary hover:bg-primary-hover",
|
|
6469
|
+
secondary: "bg-secondary text-secondary-foreground border-border hover:bg-secondary-hover",
|
|
6470
|
+
ghost: "bg-transparent text-foreground border-border hover:bg-muted"
|
|
6467
6471
|
};
|
|
6468
6472
|
ControlButton.displayName = "ControlButton";
|
|
6469
6473
|
}
|
|
@@ -7191,8 +7195,8 @@ function ChoiceButton({
|
|
|
7191
7195
|
className: cn(
|
|
7192
7196
|
"w-full text-left px-4 py-2.5 rounded-md border transition-all duration-150",
|
|
7193
7197
|
"flex items-center gap-2",
|
|
7194
|
-
selected ? "bg-
|
|
7195
|
-
disabled && "opacity-40 cursor-not-allowed hover:bg-
|
|
7198
|
+
selected ? "bg-accent/15 border-accent text-foreground" : "bg-muted/40 border-border text-foreground hover:bg-muted hover:border-border",
|
|
7199
|
+
disabled && "opacity-40 cursor-not-allowed hover:bg-muted/40 hover:border-border",
|
|
7196
7200
|
className
|
|
7197
7201
|
),
|
|
7198
7202
|
children: [
|
|
@@ -7201,7 +7205,7 @@ function ChoiceButton({
|
|
|
7201
7205
|
{
|
|
7202
7206
|
className: cn(
|
|
7203
7207
|
"flex-shrink-0 font-mono font-bold text-sm",
|
|
7204
|
-
selected ? "text-
|
|
7208
|
+
selected ? "text-accent" : "text-muted-foreground"
|
|
7205
7209
|
),
|
|
7206
7210
|
children: [
|
|
7207
7211
|
index,
|
|
@@ -7242,7 +7246,7 @@ function ActionButton({
|
|
|
7242
7246
|
disabled: isDisabled,
|
|
7243
7247
|
onClick,
|
|
7244
7248
|
className: cn(
|
|
7245
|
-
"relative inline-flex items-center gap-1.5 rounded-md border font-medium
|
|
7249
|
+
"relative inline-flex items-center gap-1.5 rounded-md border font-medium overflow-hidden transition-colors duration-150",
|
|
7246
7250
|
sizes.button,
|
|
7247
7251
|
variantStyles8[variant],
|
|
7248
7252
|
isDisabled && "opacity-60 cursor-not-allowed",
|
|
@@ -7252,7 +7256,7 @@ function ActionButton({
|
|
|
7252
7256
|
onCooldown && /* @__PURE__ */ jsxRuntime.jsx(
|
|
7253
7257
|
"div",
|
|
7254
7258
|
{
|
|
7255
|
-
className: "absolute inset-0 bg-
|
|
7259
|
+
className: "absolute inset-0 bg-foreground/40 pointer-events-none",
|
|
7256
7260
|
style: {
|
|
7257
7261
|
clipPath: `conic-gradient(from 0deg, transparent ${360 - cooldownDeg}deg, black ${360 - cooldownDeg}deg)`,
|
|
7258
7262
|
WebkitClipPath: `conic-gradient(from 0deg, transparent ${360 - cooldownDeg}deg, black ${360 - cooldownDeg}deg)`,
|
|
@@ -7260,13 +7264,16 @@ function ActionButton({
|
|
|
7260
7264
|
}
|
|
7261
7265
|
}
|
|
7262
7266
|
),
|
|
7263
|
-
icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("flex-shrink-0", sizes.icon), children: icon
|
|
7267
|
+
icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("flex-shrink-0", sizes.icon), children: typeof icon === "string" ? (() => {
|
|
7268
|
+
const I = resolveIcon(icon);
|
|
7269
|
+
return I ? /* @__PURE__ */ jsxRuntime.jsx(I, { className: "w-4 h-4" }) : null;
|
|
7270
|
+
})() : icon }),
|
|
7264
7271
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "relative z-10", children: label }),
|
|
7265
7272
|
hotkey && /* @__PURE__ */ jsxRuntime.jsx(
|
|
7266
7273
|
"span",
|
|
7267
7274
|
{
|
|
7268
7275
|
className: cn(
|
|
7269
|
-
"absolute top-0.5 right-0.5 bg-
|
|
7276
|
+
"absolute top-0.5 right-0.5 bg-foreground/30 text-primary-foreground rounded font-mono leading-tight",
|
|
7270
7277
|
sizes.hotkey
|
|
7271
7278
|
),
|
|
7272
7279
|
children: hotkey
|
|
@@ -7280,15 +7287,16 @@ var sizeMap13, variantStyles8;
|
|
|
7280
7287
|
var init_ActionButton = __esm({
|
|
7281
7288
|
"components/atoms/game/ActionButton.tsx"() {
|
|
7282
7289
|
init_cn();
|
|
7290
|
+
init_Icon();
|
|
7283
7291
|
sizeMap13 = {
|
|
7284
7292
|
sm: { button: "px-3 py-1.5 text-xs", hotkey: "text-[9px] px-1", icon: "text-xs" },
|
|
7285
7293
|
md: { button: "px-4 py-2 text-sm", hotkey: "text-[10px] px-1.5", icon: "text-sm" },
|
|
7286
7294
|
lg: { button: "px-5 py-2.5 text-base", hotkey: "text-xs px-2", icon: "text-base" }
|
|
7287
7295
|
};
|
|
7288
7296
|
variantStyles8 = {
|
|
7289
|
-
primary: "bg-
|
|
7290
|
-
secondary: "bg-
|
|
7291
|
-
danger: "bg-
|
|
7297
|
+
primary: "bg-primary text-primary-foreground hover:bg-primary-hover border-primary",
|
|
7298
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary-hover border-border",
|
|
7299
|
+
danger: "bg-error text-error-foreground hover:bg-error/90 border-error"
|
|
7292
7300
|
};
|
|
7293
7301
|
ActionButton.displayName = "ActionButton";
|
|
7294
7302
|
}
|
|
@@ -17939,20 +17947,20 @@ function CanvasEffectEngine({
|
|
|
17939
17947
|
return img?.complete ? img : void 0;
|
|
17940
17948
|
}, []);
|
|
17941
17949
|
React135.useEffect(() => {
|
|
17942
|
-
const
|
|
17950
|
+
const now2 = performance.now();
|
|
17943
17951
|
const effectX = x || width / 2;
|
|
17944
17952
|
const effectY = y || height / 2;
|
|
17945
17953
|
const preset = presets[actionType](effectX, effectY);
|
|
17946
17954
|
const state = stateRef.current;
|
|
17947
17955
|
for (const emitter of preset.particles) {
|
|
17948
17956
|
const scaledEmitter = { ...emitter, count: Math.round(emitter.count * intensity) };
|
|
17949
|
-
state.particles.push(...spawnParticles(scaledEmitter,
|
|
17957
|
+
state.particles.push(...spawnParticles(scaledEmitter, now2));
|
|
17950
17958
|
}
|
|
17951
17959
|
for (const seqConfig of preset.sequences) {
|
|
17952
|
-
state.sequences.push(spawnSequence(seqConfig,
|
|
17960
|
+
state.sequences.push(spawnSequence(seqConfig, now2));
|
|
17953
17961
|
}
|
|
17954
17962
|
for (const ovConfig of preset.overlays) {
|
|
17955
|
-
state.overlays.push(spawnOverlay(ovConfig,
|
|
17963
|
+
state.overlays.push(spawnOverlay(ovConfig, now2));
|
|
17956
17964
|
}
|
|
17957
17965
|
if (preset.screenShake > 0) {
|
|
17958
17966
|
shakeRef.current.intensity = preset.screenShake * intensity;
|
|
@@ -21334,7 +21342,7 @@ function DataGrid({
|
|
|
21334
21342
|
onClick: handleActionClick(action, itemData),
|
|
21335
21343
|
"data-testid": `action-${action.event}`,
|
|
21336
21344
|
"data-row-id": String(itemData.id),
|
|
21337
|
-
className: "text-error hover:bg-error/10 px-2",
|
|
21345
|
+
className: "text-error hover:text-error hover:bg-error/10 px-2",
|
|
21338
21346
|
children: [
|
|
21339
21347
|
action.icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: action.icon, size: "xs" }),
|
|
21340
21348
|
action.label
|
|
@@ -23863,7 +23871,7 @@ function StatBadge({
|
|
|
23863
23871
|
const I = resolveIcon(icon);
|
|
23864
23872
|
return I ? /* @__PURE__ */ jsxRuntime.jsx(I, { className: "w-4 h-4" }) : icon;
|
|
23865
23873
|
})() : icon }),
|
|
23866
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-
|
|
23874
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground font-medium", children: label }),
|
|
23867
23875
|
format === "hearts" && max && /* @__PURE__ */ jsxRuntime.jsx(
|
|
23868
23876
|
HealthBar,
|
|
23869
23877
|
{
|
|
@@ -23890,7 +23898,7 @@ function StatBadge({
|
|
|
23890
23898
|
animated: true
|
|
23891
23899
|
}
|
|
23892
23900
|
),
|
|
23893
|
-
format === "text" && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-bold text-
|
|
23901
|
+
format === "text" && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-bold text-foreground", children: value })
|
|
23894
23902
|
]
|
|
23895
23903
|
}
|
|
23896
23904
|
);
|
|
@@ -23908,11 +23916,11 @@ var init_StatBadge = __esm({
|
|
|
23908
23916
|
lg: "text-base px-4 py-2"
|
|
23909
23917
|
};
|
|
23910
23918
|
variantMap2 = {
|
|
23911
|
-
default: "bg-
|
|
23912
|
-
primary: "bg-
|
|
23913
|
-
success: "bg-
|
|
23914
|
-
warning: "bg-
|
|
23915
|
-
danger: "bg-
|
|
23919
|
+
default: "bg-card/80 border-border text-foreground",
|
|
23920
|
+
primary: "bg-primary/15 border-primary/40 text-foreground",
|
|
23921
|
+
success: "bg-success/15 border-success/40 text-foreground",
|
|
23922
|
+
warning: "bg-warning/15 border-warning/40 text-foreground",
|
|
23923
|
+
danger: "bg-error/15 border-error/40 text-foreground"
|
|
23916
23924
|
};
|
|
23917
23925
|
StatBadge.displayName = "StatBadge";
|
|
23918
23926
|
}
|
|
@@ -36347,9 +36355,45 @@ var init_List = __esm({
|
|
|
36347
36355
|
List3.displayName = "List";
|
|
36348
36356
|
}
|
|
36349
36357
|
});
|
|
36350
|
-
|
|
36358
|
+
function MasterDetail({
|
|
36359
|
+
entity,
|
|
36360
|
+
masterFields,
|
|
36361
|
+
detailFields: _detailFields,
|
|
36362
|
+
// Captured but not used here - detail handled separately
|
|
36363
|
+
loading: externalLoading,
|
|
36364
|
+
isLoading: externalIsLoading,
|
|
36365
|
+
error: externalError,
|
|
36366
|
+
className,
|
|
36367
|
+
...rest
|
|
36368
|
+
}) {
|
|
36369
|
+
const loading = externalLoading ?? false;
|
|
36370
|
+
const isLoading = externalIsLoading ?? false;
|
|
36371
|
+
const error = externalError ?? null;
|
|
36372
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
36373
|
+
DataTable,
|
|
36374
|
+
{
|
|
36375
|
+
fields: masterFields,
|
|
36376
|
+
columns: masterFields,
|
|
36377
|
+
entity,
|
|
36378
|
+
isLoading: loading || isLoading,
|
|
36379
|
+
error,
|
|
36380
|
+
className,
|
|
36381
|
+
emptyTitle: "No items found",
|
|
36382
|
+
emptyDescription: "Create your first item to get started.",
|
|
36383
|
+
...rest
|
|
36384
|
+
}
|
|
36385
|
+
);
|
|
36386
|
+
}
|
|
36351
36387
|
var init_MasterDetail = __esm({
|
|
36352
|
-
"components/organisms/
|
|
36388
|
+
"components/organisms/MasterDetail.tsx"() {
|
|
36389
|
+
"use client";
|
|
36390
|
+
init_DataTable();
|
|
36391
|
+
MasterDetail.displayName = "MasterDetail";
|
|
36392
|
+
}
|
|
36393
|
+
});
|
|
36394
|
+
var DefaultEmptyDetail, MasterDetailLayout;
|
|
36395
|
+
var init_MasterDetailLayout = __esm({
|
|
36396
|
+
"components/organisms/layout/MasterDetailLayout.tsx"() {
|
|
36353
36397
|
init_cn();
|
|
36354
36398
|
init_Typography();
|
|
36355
36399
|
DefaultEmptyDetail = () => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center h-full border-2 border-dashed border-border", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -36360,7 +36404,7 @@ var init_MasterDetail = __esm({
|
|
|
36360
36404
|
children: "Select an item to view details"
|
|
36361
36405
|
}
|
|
36362
36406
|
) });
|
|
36363
|
-
|
|
36407
|
+
MasterDetailLayout = ({
|
|
36364
36408
|
master,
|
|
36365
36409
|
detail,
|
|
36366
36410
|
emptyDetail,
|
|
@@ -36395,7 +36439,7 @@ var init_MasterDetail = __esm({
|
|
|
36395
36439
|
}
|
|
36396
36440
|
);
|
|
36397
36441
|
};
|
|
36398
|
-
|
|
36442
|
+
MasterDetailLayout.displayName = "MasterDetailLayout";
|
|
36399
36443
|
}
|
|
36400
36444
|
});
|
|
36401
36445
|
var COLUMN_CLASSES, ASPECT_CLASSES, MediaGallery;
|
|
@@ -38813,7 +38857,7 @@ function getAllEvents(traits2) {
|
|
|
38813
38857
|
}
|
|
38814
38858
|
function EventDispatcherTab({ traits: traits2, schema }) {
|
|
38815
38859
|
const eventBus = useEventBus();
|
|
38816
|
-
const [
|
|
38860
|
+
const [log12, setLog] = React135__namespace.useState([]);
|
|
38817
38861
|
const prevStatesRef = React135__namespace.useRef(/* @__PURE__ */ new Map());
|
|
38818
38862
|
React135__namespace.useEffect(() => {
|
|
38819
38863
|
for (const trait of traits2) {
|
|
@@ -38877,9 +38921,9 @@ function EventDispatcherTab({ traits: traits2, schema }) {
|
|
|
38877
38921
|
/* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "small", weight: "medium", className: "text-gray-500 mb-1", children: "Other Events (not available from current state)" }),
|
|
38878
38922
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-1", children: unavailableEvents.map((event) => /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "default", size: "sm", className: "opacity-50", children: event }, event)) })
|
|
38879
38923
|
] }),
|
|
38880
|
-
|
|
38924
|
+
log12.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
38881
38925
|
/* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "small", weight: "medium", className: "text-gray-500 mb-1", children: "Recent Transitions" }),
|
|
38882
|
-
/* @__PURE__ */ jsxRuntime.jsx(Stack, { gap: "xs", children:
|
|
38926
|
+
/* @__PURE__ */ jsxRuntime.jsx(Stack, { gap: "xs", children: log12.map((entry, i) => /* @__PURE__ */ jsxRuntime.jsxs(Typography, { variant: "small", className: "font-mono text-xs", children: [
|
|
38883
38927
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-purple-400", children: entry.traitName }),
|
|
38884
38928
|
" ",
|
|
38885
38929
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-500", children: entry.from }),
|
|
@@ -43150,6 +43194,7 @@ var init_component_registry_generated = __esm({
|
|
|
43150
43194
|
init_LoadingState();
|
|
43151
43195
|
init_MarkdownContent();
|
|
43152
43196
|
init_MasterDetail();
|
|
43197
|
+
init_MasterDetailLayout();
|
|
43153
43198
|
init_MatrixQuestion();
|
|
43154
43199
|
init_MediaGallery();
|
|
43155
43200
|
init_Meter();
|
|
@@ -43444,6 +43489,7 @@ var init_component_registry_generated = __esm({
|
|
|
43444
43489
|
"MapViewPattern": MapViewPattern,
|
|
43445
43490
|
"MarkdownContent": MarkdownContent,
|
|
43446
43491
|
"MasterDetail": MasterDetail,
|
|
43492
|
+
"MasterDetailLayout": MasterDetailLayout,
|
|
43447
43493
|
"MatrixQuestion": MatrixQuestion,
|
|
43448
43494
|
"MediaGallery": MediaGallery,
|
|
43449
43495
|
"Menu": MenuPattern,
|
|
@@ -45674,6 +45720,103 @@ function ServerBridgeProvider({
|
|
|
45674
45720
|
// runtime/OrbPreview.tsx
|
|
45675
45721
|
init_navigation();
|
|
45676
45722
|
init_verificationRegistry();
|
|
45723
|
+
var PERF_NAMESPACE = "almadar:perf:canvas";
|
|
45724
|
+
var log11 = logger.createLogger(PERF_NAMESPACE);
|
|
45725
|
+
var RING_SIZE = 50;
|
|
45726
|
+
var ring = [];
|
|
45727
|
+
var writeIdx = 0;
|
|
45728
|
+
var subscribers = /* @__PURE__ */ new Set();
|
|
45729
|
+
function push(entry) {
|
|
45730
|
+
if (ring.length < RING_SIZE) {
|
|
45731
|
+
ring.push(entry);
|
|
45732
|
+
} else {
|
|
45733
|
+
ring[writeIdx] = entry;
|
|
45734
|
+
}
|
|
45735
|
+
writeIdx = (writeIdx + 1) % RING_SIZE;
|
|
45736
|
+
for (const fn of subscribers) fn();
|
|
45737
|
+
}
|
|
45738
|
+
function isEnabled() {
|
|
45739
|
+
return logger.isLogLevelEnabled("DEBUG", PERF_NAMESPACE);
|
|
45740
|
+
}
|
|
45741
|
+
function now() {
|
|
45742
|
+
return typeof performance !== "undefined" && typeof performance.now === "function" ? performance.now() : Date.now();
|
|
45743
|
+
}
|
|
45744
|
+
function perfStart(name) {
|
|
45745
|
+
if (!isEnabled()) return -1;
|
|
45746
|
+
if (typeof performance !== "undefined" && typeof performance.mark === "function") {
|
|
45747
|
+
try {
|
|
45748
|
+
performance.mark(`${name}-start`);
|
|
45749
|
+
} catch {
|
|
45750
|
+
}
|
|
45751
|
+
}
|
|
45752
|
+
return now();
|
|
45753
|
+
}
|
|
45754
|
+
function perfEnd(name, startToken, detail) {
|
|
45755
|
+
if (startToken < 0 || !isEnabled()) return;
|
|
45756
|
+
const endTs = now();
|
|
45757
|
+
const durationMs = endTs - startToken;
|
|
45758
|
+
if (typeof performance !== "undefined" && typeof performance.measure === "function") {
|
|
45759
|
+
try {
|
|
45760
|
+
performance.mark(`${name}-end`);
|
|
45761
|
+
performance.measure(name, `${name}-start`, `${name}-end`);
|
|
45762
|
+
} catch {
|
|
45763
|
+
}
|
|
45764
|
+
}
|
|
45765
|
+
push({ name, durationMs, ts: endTs, detail });
|
|
45766
|
+
log11.debug(name, () => ({ durationMs, ...detail ?? {} }));
|
|
45767
|
+
}
|
|
45768
|
+
function perfTime(name, fn, detail) {
|
|
45769
|
+
const t = perfStart(name);
|
|
45770
|
+
try {
|
|
45771
|
+
return fn();
|
|
45772
|
+
} finally {
|
|
45773
|
+
perfEnd(name, t, detail);
|
|
45774
|
+
}
|
|
45775
|
+
}
|
|
45776
|
+
var profilerOnRender = (id, phase, actualDuration, baseDuration, _startTime, commitTime) => {
|
|
45777
|
+
if (!isEnabled()) return;
|
|
45778
|
+
push({
|
|
45779
|
+
name: `profiler:${id}:${phase}`,
|
|
45780
|
+
durationMs: actualDuration,
|
|
45781
|
+
ts: commitTime,
|
|
45782
|
+
detail: { baseDuration }
|
|
45783
|
+
});
|
|
45784
|
+
log11.debug(`profiler:${id}:${phase}`, () => ({ actualDuration, baseDuration }));
|
|
45785
|
+
};
|
|
45786
|
+
function getPerfSnapshot() {
|
|
45787
|
+
if (ring.length < RING_SIZE) return ring.slice();
|
|
45788
|
+
return [...ring.slice(writeIdx), ...ring.slice(0, writeIdx)];
|
|
45789
|
+
}
|
|
45790
|
+
var cachedSnapshot = [];
|
|
45791
|
+
var cachedRevision = -1;
|
|
45792
|
+
var revision = 0;
|
|
45793
|
+
function bumpRevision() {
|
|
45794
|
+
revision++;
|
|
45795
|
+
}
|
|
45796
|
+
subscribers.add(bumpRevision);
|
|
45797
|
+
function getSnapshot2() {
|
|
45798
|
+
if (cachedRevision !== revision) {
|
|
45799
|
+
cachedSnapshot = getPerfSnapshot();
|
|
45800
|
+
cachedRevision = revision;
|
|
45801
|
+
}
|
|
45802
|
+
return cachedSnapshot;
|
|
45803
|
+
}
|
|
45804
|
+
function subscribe(fn) {
|
|
45805
|
+
subscribers.add(fn);
|
|
45806
|
+
return () => {
|
|
45807
|
+
subscribers.delete(fn);
|
|
45808
|
+
};
|
|
45809
|
+
}
|
|
45810
|
+
function usePerfBuffer() {
|
|
45811
|
+
return React135.useSyncExternalStore(subscribe, getSnapshot2, getSnapshot2);
|
|
45812
|
+
}
|
|
45813
|
+
function clearPerf() {
|
|
45814
|
+
ring.length = 0;
|
|
45815
|
+
writeIdx = 0;
|
|
45816
|
+
for (const fn of subscribers) fn();
|
|
45817
|
+
}
|
|
45818
|
+
|
|
45819
|
+
// runtime/prepareSchemaForPreview.ts
|
|
45677
45820
|
function generateEntityRow(entity, idx) {
|
|
45678
45821
|
const row = { id: String(idx) };
|
|
45679
45822
|
for (const f3 of entity.fields) {
|
|
@@ -45699,6 +45842,7 @@ function generateFieldValue(entityName, field, idx) {
|
|
|
45699
45842
|
}
|
|
45700
45843
|
}
|
|
45701
45844
|
function buildMockData(schema) {
|
|
45845
|
+
const t = perfStart("build-mock-data");
|
|
45702
45846
|
const result = {};
|
|
45703
45847
|
for (const orbital of schema.orbitals) {
|
|
45704
45848
|
const entity = orbital.entity;
|
|
@@ -45716,6 +45860,7 @@ function buildMockData(schema) {
|
|
|
45716
45860
|
);
|
|
45717
45861
|
result[entityName] = rows;
|
|
45718
45862
|
}
|
|
45863
|
+
perfEnd("build-mock-data", t, { orbitalCount: schema.orbitals.length, entityCount: Object.keys(result).length });
|
|
45719
45864
|
return result;
|
|
45720
45865
|
}
|
|
45721
45866
|
function isInlineTrait2(traitRef) {
|
|
@@ -46235,17 +46380,25 @@ function BrowserPlayground({
|
|
|
46235
46380
|
exports.BrowserPlayground = BrowserPlayground;
|
|
46236
46381
|
exports.EntitySchemaProvider = EntitySchemaProvider;
|
|
46237
46382
|
exports.OrbPreview = OrbPreview;
|
|
46383
|
+
exports.PERF_NAMESPACE = PERF_NAMESPACE;
|
|
46238
46384
|
exports.ServerBridgeProvider = ServerBridgeProvider;
|
|
46239
46385
|
exports.TraitContext = TraitContext;
|
|
46240
46386
|
exports.TraitProvider = TraitProvider;
|
|
46241
46387
|
exports.adjustSchemaForMockData = adjustSchemaForMockData;
|
|
46242
46388
|
exports.buildMockData = buildMockData;
|
|
46389
|
+
exports.clearPerf = clearPerf;
|
|
46243
46390
|
exports.clearSchemaCache = clearSchemaCache;
|
|
46244
46391
|
exports.createClientEffectHandlers = createClientEffectHandlers;
|
|
46392
|
+
exports.getPerfSnapshot = getPerfSnapshot;
|
|
46393
|
+
exports.perfEnd = perfEnd;
|
|
46394
|
+
exports.perfStart = perfStart;
|
|
46395
|
+
exports.perfTime = perfTime;
|
|
46245
46396
|
exports.prepareSchemaForPreview = prepareSchemaForPreview;
|
|
46397
|
+
exports.profilerOnRender = profilerOnRender;
|
|
46246
46398
|
exports.useEntityDefinition = useEntityDefinition;
|
|
46247
46399
|
exports.useEntitySchema = useEntitySchema;
|
|
46248
46400
|
exports.useEntitySchemaOptional = useEntitySchemaOptional;
|
|
46401
|
+
exports.usePerfBuffer = usePerfBuffer;
|
|
46249
46402
|
exports.useResolvedSchema = useResolvedSchema;
|
|
46250
46403
|
exports.useServerBridge = useServerBridge;
|
|
46251
46404
|
exports.useTrait = useTrait;
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -18,3 +18,4 @@ export { BrowserPlayground, type BrowserPlaygroundProps } from './BrowserPlaygro
|
|
|
18
18
|
export { prepareSchemaForPreview, buildMockData, adjustSchemaForMockData, type PreparedPreviewSchema, } from './prepareSchemaForPreview';
|
|
19
19
|
export { ServerBridgeProvider, useServerBridge, type ServerBridgeContextValue, type ServerBridgeTransport, type ServerClientEffect } from './ServerBridge';
|
|
20
20
|
export type { ResolvedTraitBinding, ResolvedTrait, ResolvedEntity, ResolvedPage, ResolvedIR, } from './types';
|
|
21
|
+
export { PERF_NAMESPACE, perfStart, perfEnd, perfTime, profilerOnRender, getPerfSnapshot, usePerfBuffer, clearPerf, type PerfEntry, } from './perf';
|