@almadar/ui 6.53.0 → 6.54.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/Typography-CFI7JUVE.js +5 -0
  2. package/dist/{UISlotRenderer-JT34I3O7.js → UISlotRenderer-QUEG6WFM.js} +5 -5
  3. package/dist/avl/index.cjs +578 -262
  4. package/dist/avl/index.js +28 -19
  5. package/dist/{avl-3d-context-MAt_NuU9.d.ts → avl-3d-context-BpBKZIbc.d.ts} +1 -0
  6. package/dist/{chunk-DQTV6QVS.js → chunk-4HC5HRHB.js} +53 -2
  7. package/dist/{chunk-GMDMOYXD.js → chunk-4UP6BZ4R.js} +1 -1
  8. package/dist/{chunk-CBIJP5PL.js → chunk-FJDS4SVD.js} +3 -3
  9. package/dist/{chunk-4OZDHCZV.js → chunk-MCKFWPT2.js} +1 -1
  10. package/dist/{chunk-UGHAADU5.js → chunk-N2V4LHFQ.js} +4 -1
  11. package/dist/{chunk-3EF5SDIJ.js → chunk-U2FGMHQP.js} +306 -174
  12. package/dist/{chunk-IKULQIDX.js → chunk-U3CGKPOK.js} +252 -91
  13. package/dist/{chunk-7LM6I3NA.js → chunk-Z5IYJU44.js} +1 -0
  14. package/dist/{chunk-WPNM2KC6.js → chunk-Z7JWXIRE.js} +2 -2
  15. package/dist/components/index.cjs +312 -170
  16. package/dist/components/index.d.ts +5 -1
  17. package/dist/components/index.js +11 -12
  18. package/dist/context/index.cjs +2 -0
  19. package/dist/context/index.js +2 -0
  20. package/dist/hooks/index.cjs +9 -1
  21. package/dist/hooks/index.d.ts +10 -1
  22. package/dist/hooks/index.js +3 -4
  23. package/dist/lib/drawable/three/index.cjs +5 -1
  24. package/dist/lib/drawable/three/index.d.ts +2 -2
  25. package/dist/lib/drawable/three/index.js +6 -6
  26. package/dist/lib/index.cjs +4 -1
  27. package/dist/lib/index.js +2 -2
  28. package/dist/locales/index.cjs +12 -3
  29. package/dist/locales/index.js +9 -3
  30. package/dist/providers/index.cjs +307 -170
  31. package/dist/providers/index.d.ts +1 -1
  32. package/dist/providers/index.js +5 -5
  33. package/dist/runtime/index.cjs +3850 -3523
  34. package/dist/runtime/index.d.ts +22 -4
  35. package/dist/runtime/index.js +13 -10
  36. package/dist/ssr/index.cjs +5 -2
  37. package/dist/ssr/index.js +5 -2
  38. package/locales/ar.json +4 -1
  39. package/locales/en.json +4 -1
  40. package/locales/sl.json +4 -1
  41. package/package.json +7 -6
  42. package/scripts/audit-tailwind-safelist.ts +21 -1
  43. package/tailwind-preset.cjs +15 -6
  44. package/themes/_fonts.css +6 -4
  45. package/themes/_presets.css +2 -0
  46. package/themes/almadar-heritage.css +373 -0
  47. package/themes/orb.css +373 -0
  48. package/dist/Typography-JGSDH4JP.js +0 -5
  49. package/dist/chunk-GODZKHAL.js +0 -51
package/dist/avl/index.js CHANGED
@@ -1,23 +1,22 @@
1
- import { BrowserPlayground, collectEmbeddedTraits } from '../chunk-IKULQIDX.js';
2
- import { zoomReducer, initialZoomState, getBreadcrumbs } from '../chunk-WPNM2KC6.js';
3
- import { JsonTreeEditor } from '../chunk-CBIJP5PL.js';
4
- import { useTranslate as useTranslate$1 } from '../chunk-GODZKHAL.js';
5
- import '../chunk-DQTV6QVS.js';
1
+ import { BrowserPlayground, collectEmbeddedTraits } from '../chunk-U3CGKPOK.js';
2
+ import { zoomReducer, initialZoomState, getBreadcrumbs } from '../chunk-Z7JWXIRE.js';
3
+ import { JsonTreeEditor } from '../chunk-FJDS4SVD.js';
4
+ import { useTranslate as useTranslate$1 } from '../chunk-4HC5HRHB.js';
6
5
  import '../chunk-VHTJRS2N.js';
7
6
  import { spacingTokenOf, positionOf, withPosition, snapToSpacingStep, defaultSpacingStepPx, spacingOf, withSizing, withSpacing, layoutOf, withLayout, sizingOf, DESIGN_COLOR_TOKENS, DESIGN_RADIUS_TOKENS, DESIGN_SPACING_SCALE, sizeLimitOf, withSizeLimit, isArbitraryClass, tokenOfDesignClass } from '../chunk-ERXIHZW3.js';
8
- import { Popover, Button, Icon, Select, Badge, IconButton, AvlStateMachine, Input, AvlFieldType, AvlEffect, AvlState, AvlPage, AvlEntity, useContainerWidth, useAlmadarDndSensors, almadarDndCollisionDetection, TagInput, Checkbox, Switch, CodeBlock, FileTree, Card, Accordion, RangeSlider, computeTraitLayout, edgePath, FormField, Radio, useCompactLayout, ButtonGroup, roundedEdgePath } from '../chunk-3EF5SDIJ.js';
9
- export { AvlEffect, AvlEntity, AvlFieldType, AvlPage, AvlState, AvlStateMachine, BehaviorView, FIELD_TYPE_SHAPES, MiniStateMachine, ModuleCard, computeTraitLayout, edgePath } from '../chunk-3EF5SDIJ.js';
10
- import { avlSeries, STATE_COLORS, Box, HStack, VStack, avlTint, CONNECTION_COLORS, parseTraitLevel, OPERATOR_CATEGORY_COLORS, AVL_INK, AVL_FONT, parseApplicationLevel, parseOrbitalLevel, getStateRole, effectCategoryOf, EFFECT_CATEGORY_COLORS, pressableProps, traitTransitionRenderUi, traitEventWires, effectZoneOf, avlBlend } from '../chunk-7LM6I3NA.js';
11
- export { CONNECTION_COLORS, EFFECT_CATEGORY_COLORS, OPERATOR_CATEGORY_COLORS, STATE_COLORS, effectCategoryOf, getStateRole, parseApplicationLevel, parseOrbitalLevel, parseTraitLevel, parseTransitionLevel, traitLevelFromTrait } from '../chunk-7LM6I3NA.js';
12
- import { Typography, INLINE_TEXT_ATTR } from '../chunk-GMDMOYXD.js';
7
+ import { Popover, Button, Icon, Select, Badge, IconButton, AvlStateMachine, Input, AvlFieldType, AvlEffect, AvlState, AvlPage, AvlEntity, useContainerWidth, useAlmadarDndSensors, almadarDndCollisionDetection, TagInput, Checkbox, Switch, CodeBlock, FileTree, Card, Accordion, RangeSlider, computeTraitLayout, edgePath, FormField, Radio, useCompactLayout, ButtonGroup, roundedEdgePath } from '../chunk-U2FGMHQP.js';
8
+ export { AvlEffect, AvlEntity, AvlFieldType, AvlPage, AvlState, AvlStateMachine, BehaviorView, FIELD_TYPE_SHAPES, MiniStateMachine, ModuleCard, computeTraitLayout, edgePath } from '../chunk-U2FGMHQP.js';
9
+ import { avlSeries, STATE_COLORS, Box, HStack, VStack, avlTint, CONNECTION_COLORS, parseTraitLevel, OPERATOR_CATEGORY_COLORS, AVL_INK, AVL_FONT, parseApplicationLevel, parseOrbitalLevel, getStateRole, effectCategoryOf, EFFECT_CATEGORY_COLORS, pressableProps, traitTransitionRenderUi, traitEventWires, effectZoneOf, avlBlend } from '../chunk-Z5IYJU44.js';
10
+ export { CONNECTION_COLORS, EFFECT_CATEGORY_COLORS, OPERATOR_CATEGORY_COLORS, STATE_COLORS, effectCategoryOf, getStateRole, parseApplicationLevel, parseOrbitalLevel, parseTraitLevel, parseTransitionLevel, traitLevelFromTrait } from '../chunk-Z5IYJU44.js';
11
+ import { Typography, INLINE_TEXT_ATTR } from '../chunk-4UP6BZ4R.js';
13
12
  import { usePrefersReducedMotion, useMediaQuery } from '../chunk-JRW33U35.js';
14
13
  import '../chunk-XJTHMW4G.js';
15
14
  import { useEventBus } from '../chunk-6EV3OEBQ.js';
16
15
  import { profilerOnRender, perfStart, perfEnd } from '../chunk-KQXXO42S.js';
17
16
  import { isEditableTarget } from '../chunk-O7OLVVBR.js';
18
17
  import { domPassthrough, cn } from '../chunk-64WACXM7.js';
19
- import '../chunk-4OZDHCZV.js';
20
- import '../chunk-UGHAADU5.js';
18
+ import '../chunk-MCKFWPT2.js';
19
+ import '../chunk-N2V4LHFQ.js';
21
20
  import '../chunk-PQKU62LK.js';
22
21
  import '../chunk-PEST66PN.js';
23
22
  import '../chunk-QPXIAUJD.js';
@@ -3476,13 +3475,18 @@ function stateOptionsFor(schema, orbitalName, entityName, transitions, view, moc
3476
3475
  const key = `${s.entry.traitName}|${s.entry.transition.to}`;
3477
3476
  stateUses.set(key, (stateUses.get(key) ?? 0) + 1);
3478
3477
  }
3478
+ const armsSeen = /* @__PURE__ */ new Map();
3479
3479
  return screens.map(({ entry, enteredBy }) => {
3480
3480
  const t = entry.transition;
3481
3481
  const from = String(t.from);
3482
3482
  const state = view === "screens" ? (stateUses.get(`${entry.traitName}|${t.to}`) ?? 0) > 1 ? `${t.to} \xB7 ${t.event}` : t.to : `${t.event}: ${from} \u2192 ${t.to}`;
3483
- const label = manyTraits ? `${entry.traitName} \xB7 ${state}` : state;
3483
+ const baseId = `${entry.traitName}:${t.event}:${from}:${t.to}`;
3484
+ const arm = (armsSeen.get(baseId) ?? 0) + 1;
3485
+ armsSeen.set(baseId, arm);
3486
+ const named = manyTraits ? `${entry.traitName} \xB7 ${state}` : state;
3487
+ const label = arm > 1 ? `${named} (guard ${arm})` : named;
3484
3488
  return {
3485
- id: `${entry.traitName}:${t.event}:${from}:${t.to}`,
3489
+ id: arm > 1 ? `${baseId}#${arm}` : baseId,
3486
3490
  label,
3487
3491
  hint: view === "screens" ? enteredBy.join(" \xB7 ") : entry.traitName,
3488
3492
  data: {
@@ -4097,11 +4101,11 @@ function marqueeHits(marquee, boxes) {
4097
4101
  );
4098
4102
  }
4099
4103
  function axisPositionFrom(axis, constraint, offset) {
4100
- const start = offset ? axis === "x" ? offset.left : offset.top : 0;
4101
- const end = offset ? axis === "x" ? offset.right : offset.bottom : 0;
4104
+ const start = axis === "x" ? offset.left : offset.top;
4105
+ const end = axis === "x" ? offset.right : offset.bottom;
4102
4106
  if (constraint === "center") return { constraint, start: (start - end) / 2, end: 0 };
4103
4107
  if (constraint !== "scale") return { constraint, start, end };
4104
- const size2 = offset ? axis === "x" ? offset.parentWidth : offset.parentHeight : 0;
4108
+ const size2 = axis === "x" ? offset.parentWidth : offset.parentHeight;
4105
4109
  return size2 > 0 ? { constraint, start: start / size2 * 100, end: end / size2 * 100 } : { constraint, start: 0, end: 0 };
4106
4110
  }
4107
4111
  var edgesX = (r) => [r.left, r.left + r.width / 2, r.left + r.width];
@@ -7713,7 +7717,11 @@ function AppearanceSection({ patternConfig, themeManifest, onPropChange, onToken
7713
7717
  {
7714
7718
  checked: position.absolute,
7715
7719
  label: t("orbInspector.absolute"),
7716
- onChange: (on) => write(on ? { absolute: true, x: axisPositionFrom("x", "start", offsetInParent), y: axisPositionFrom("y", "start", offsetInParent) } : { ...position, absolute: false })
7720
+ disabled: !offsetInParent && !position.absolute,
7721
+ onChange: (on) => {
7722
+ if (!on) write({ ...position, absolute: false });
7723
+ else if (offsetInParent) write({ absolute: true, x: axisPositionFrom("x", "start", offsetInParent), y: axisPositionFrom("y", "start", offsetInParent) });
7724
+ }
7717
7725
  }
7718
7726
  ),
7719
7727
  position.absolute && ["x", "y"].map((axis) => /* @__PURE__ */ jsxs(Box, { className: "flex items-center gap-2", "data-testid": `inspector-constraint-${axis}`, children: [
@@ -7724,9 +7732,10 @@ function AppearanceSection({ patternConfig, themeManifest, onPropChange, onToken
7724
7732
  value: position[axis].constraint,
7725
7733
  "aria-label": t(axis === "x" ? "orbInspector.constraintHorizontal" : "orbInspector.constraintVertical"),
7726
7734
  options: CONSTRAINTS.map((c) => ({ value: c, label: t(CONSTRAINT_LABELS[axis][c]) })),
7735
+ disabled: !offsetInParent,
7727
7736
  onValueChange: (v) => {
7728
7737
  const constraint = CONSTRAINTS.find((c) => c === v);
7729
- if (constraint) write({ ...position, [axis]: axisPositionFrom(axis, constraint, offsetInParent) });
7738
+ if (constraint && offsetInParent) write({ ...position, [axis]: axisPositionFrom(axis, constraint, offsetInParent) });
7730
7739
  },
7731
7740
  className: "flex-1 text-xs h-6"
7732
7741
  }
@@ -59,6 +59,7 @@ declare const AVL_3D_COLORS: {
59
59
  readonly "op:std-json": string;
60
60
  readonly "op:std-time": string;
61
61
  readonly "op:std-format": string;
62
+ readonly "op:std-i18n": string;
62
63
  readonly "op:std-async": string;
63
64
  readonly "op:std-nn": string;
64
65
  readonly "op:std-tensor": string;
@@ -1,7 +1,58 @@
1
- import { createContext, useRef, useContext, useSyncExternalStore } from 'react';
1
+ import { DEFAULT_CURRENCY } from './chunk-MCKFWPT2.js';
2
+ import { en_default } from './chunk-N2V4LHFQ.js';
3
+ import React, { createContext, useEffect, useContext, useMemo, useRef, useSyncExternalStore } from 'react';
2
4
  import { mergeEntityFrame } from '@almadar/core';
3
5
  import { createLogger } from '@almadar/logger';
4
6
 
7
+ var { $meta: _meta, ...coreMessages } = en_default;
8
+ var coreLocale = coreMessages;
9
+ var I18nContext = createContext({
10
+ locale: "en",
11
+ direction: "ltr",
12
+ t: (key, params) => {
13
+ let msg = coreLocale[key] ?? key;
14
+ if (params) {
15
+ for (const [k, v] of Object.entries(params)) {
16
+ msg = msg.split(`{{${k}}}`).join(String(v));
17
+ }
18
+ }
19
+ return msg;
20
+ }
21
+ });
22
+ I18nContext.displayName = "I18nContext";
23
+ function I18nProvider({ value, children, documentRoot }) {
24
+ useEffect(() => {
25
+ if (!documentRoot) return;
26
+ document.documentElement.lang = value.locale;
27
+ document.documentElement.dir = value.direction;
28
+ }, [documentRoot, value.locale, value.direction]);
29
+ return React.createElement(I18nContext.Provider, { value }, children);
30
+ }
31
+ function useTranslate() {
32
+ return useContext(I18nContext);
33
+ }
34
+ function useRenderI18n() {
35
+ const { locale, messages } = useContext(I18nContext);
36
+ return useMemo(() => messages !== void 0 ? { locale, messages } : void 0, [locale, messages]);
37
+ }
38
+ function useFormatContext() {
39
+ const { t, locale, currency } = useContext(I18nContext);
40
+ return useMemo(
41
+ () => ({ locale, currency: currency ?? DEFAULT_CURRENCY, booleanLabels: { yes: t("common.yes"), no: t("common.no") } }),
42
+ [t, locale, currency]
43
+ );
44
+ }
45
+ function createTranslate(messages) {
46
+ return (key, params) => {
47
+ let msg = messages[key] ?? coreLocale[key] ?? key;
48
+ if (params) {
49
+ for (const [k, v] of Object.entries(params)) {
50
+ msg = msg.split(`{{${k}}}`).join(String(v));
51
+ }
52
+ }
53
+ return msg;
54
+ };
55
+ }
5
56
  var log = createLogger("almadar:ui:shared-entity-store");
6
57
  var EMPTY_ENTITY_STATE = {};
7
58
  function createSharedEntityStore() {
@@ -79,4 +130,4 @@ function runTickFrame(entityId, orderedWriters, store) {
79
130
  return scratch;
80
131
  }
81
132
 
82
- export { SharedEntityStoreContext, createSharedEntityStore, runTickFrame, useSharedEntitySnapshot, useSharedEntityStore, useSharedEntityStoreContext };
133
+ export { I18nProvider, SharedEntityStoreContext, createSharedEntityStore, createTranslate, runTickFrame, useFormatContext, useRenderI18n, useSharedEntitySnapshot, useSharedEntityStore, useSharedEntityStoreContext, useTranslate };
@@ -1,5 +1,5 @@
1
1
  import { cn, domPassthrough } from './chunk-64WACXM7.js';
2
- import { formatValue } from './chunk-4OZDHCZV.js';
2
+ import { formatValue } from './chunk-MCKFWPT2.js';
3
3
  import React from 'react';
4
4
  import { useFormatContext } from '@almadar/ui/hooks';
5
5
 
@@ -1,6 +1,6 @@
1
- import { Icon, Button, Switch, Input } from './chunk-3EF5SDIJ.js';
2
- import { VStack, HStack } from './chunk-7LM6I3NA.js';
3
- import { Typography } from './chunk-GMDMOYXD.js';
1
+ import { Icon, Button, Switch, Input } from './chunk-U2FGMHQP.js';
2
+ import { VStack, HStack } from './chunk-Z5IYJU44.js';
3
+ import { Typography } from './chunk-4UP6BZ4R.js';
4
4
  import { cn } from './chunk-64WACXM7.js';
5
5
  import React from 'react';
6
6
  import { useTranslate } from '@almadar/ui/hooks';
@@ -1,4 +1,4 @@
1
- import { en_default } from './chunk-UGHAADU5.js';
1
+ import { en_default } from './chunk-N2V4LHFQ.js';
2
2
 
3
3
  // lib/format.ts
4
4
  var { $meta: _meta, ...coreMessages } = en_default;
@@ -59,6 +59,7 @@ var en_default = {
59
59
  "status.draft": "Draft",
60
60
  "status.archived": "Archived",
61
61
  "error.generic": "Something went wrong",
62
+ "error.traitMountFailed": "{{trait}} failed to start",
62
63
  "error.retry": "Try again",
63
64
  "error.notFound": "Not found",
64
65
  "error.loadFailed": "Failed to load: {{message}}",
@@ -1227,7 +1228,9 @@ var en_default = {
1227
1228
  "agentActivity.llmToolCalls": "Tool calls",
1228
1229
  "agentActivity.showRawLlm": "Raw LLM",
1229
1230
  "agentActivity.earlierConversations": "Earlier conversations ({{count}})",
1230
- "agentActivity.earlierActivity": "Earlier activity"
1231
+ "agentActivity.earlierActivity": "Earlier activity",
1232
+ "tabs.scrollStart": "Scroll tabs back",
1233
+ "tabs.scrollEnd": "Scroll tabs forward"
1231
1234
  };
1232
1235
 
1233
1236
  export { en_default };