@almadar/ui 6.53.1 → 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-P7A4SZSK.js → UISlotRenderer-QUEG6WFM.js} +7 -7
  3. package/dist/avl/index.cjs +709 -970
  4. package/dist/avl/index.js +24 -20
  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-HB4C27KU.js → chunk-4UP6BZ4R.js} +1 -1
  8. package/dist/{chunk-UOTYAPV5.js → chunk-FJDS4SVD.js} +3 -3
  9. package/dist/{chunk-QVXLKFUQ.js → chunk-MCKFWPT2.js} +1 -1
  10. package/dist/{chunk-7KSLPY56.js → chunk-N2V4LHFQ.js} +1 -0
  11. package/dist/{chunk-HUG25TT3.js → chunk-U2FGMHQP.js} +448 -885
  12. package/dist/{chunk-53VTY5CC.js → chunk-U3CGKPOK.js} +253 -92
  13. package/dist/{chunk-7LM6I3NA.js → chunk-Z5IYJU44.js} +1 -0
  14. package/dist/{chunk-FUQASYEW.js → chunk-Z7JWXIRE.js} +2 -2
  15. package/dist/components/index.cjs +449 -879
  16. package/dist/components/index.d.ts +5 -1
  17. package/dist/components/index.js +15 -16
  18. package/dist/context/index.cjs +2 -0
  19. package/dist/context/index.js +3 -1
  20. package/dist/hooks/index.cjs +6 -0
  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 +2 -0
  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 +1 -0
  27. package/dist/lib/index.js +3 -3
  28. package/dist/locales/index.cjs +3 -0
  29. package/dist/locales/index.js +3 -1
  30. package/dist/providers/index.cjs +444 -879
  31. package/dist/providers/index.d.ts +1 -1
  32. package/dist/providers/index.js +8 -8
  33. package/dist/runtime/index.cjs +3992 -4237
  34. package/dist/runtime/index.d.ts +22 -4
  35. package/dist/runtime/index.js +15 -12
  36. package/dist/ssr/index.cjs +2 -1
  37. package/dist/ssr/index.js +2 -1
  38. package/locales/ar.json +1 -0
  39. package/locales/en.json +1 -0
  40. package/locales/sl.json +1 -0
  41. package/package.json +7 -6
  42. package/scripts/audit-tailwind-safelist.ts +21 -1
  43. package/tailwind-preset.cjs +5 -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-7QEWUTW3.js +0 -5
  49. package/dist/chunk-E37BYSXY.js +0 -51
package/dist/avl/index.js CHANGED
@@ -1,25 +1,24 @@
1
- import { zoomReducer, initialZoomState, getBreadcrumbs } from '../chunk-FUQASYEW.js';
2
- import { JsonTreeEditor } from '../chunk-UOTYAPV5.js';
3
- import { useTranslate as useTranslate$1 } from '../chunk-E37BYSXY.js';
4
- 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';
5
- import { BrowserPlayground, collectEmbeddedTraits } from '../chunk-53VTY5CC.js';
6
- 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';
7
5
  import '../chunk-VHTJRS2N.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-HUG25TT3.js';
9
- export { AvlEffect, AvlEntity, AvlFieldType, AvlPage, AvlState, AvlStateMachine, BehaviorView, FIELD_TYPE_SHAPES, MiniStateMachine, ModuleCard, computeTraitLayout, edgePath } from '../chunk-HUG25TT3.js';
10
- import '../chunk-PQKU62LK.js';
11
- 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';
12
- export { CONNECTION_COLORS, EFFECT_CATEGORY_COLORS, OPERATOR_CATEGORY_COLORS, STATE_COLORS, effectCategoryOf, getStateRole, parseApplicationLevel, parseOrbitalLevel, parseTraitLevel, parseTransitionLevel, traitLevelFromTrait } from '../chunk-7LM6I3NA.js';
13
- import { Typography, INLINE_TEXT_ATTR } from '../chunk-HB4C27KU.js';
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';
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';
14
12
  import { usePrefersReducedMotion, useMediaQuery } from '../chunk-JRW33U35.js';
15
13
  import '../chunk-XJTHMW4G.js';
16
14
  import { useEventBus } from '../chunk-6EV3OEBQ.js';
17
- import '../chunk-PEST66PN.js';
18
15
  import { profilerOnRender, perfStart, perfEnd } from '../chunk-KQXXO42S.js';
19
16
  import { isEditableTarget } from '../chunk-O7OLVVBR.js';
20
17
  import { domPassthrough, cn } from '../chunk-64WACXM7.js';
21
- import '../chunk-QVXLKFUQ.js';
22
- import '../chunk-7KSLPY56.js';
18
+ import '../chunk-MCKFWPT2.js';
19
+ import '../chunk-N2V4LHFQ.js';
20
+ import '../chunk-PQKU62LK.js';
21
+ import '../chunk-PEST66PN.js';
23
22
  import '../chunk-QPXIAUJD.js';
24
23
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
25
24
  import React19, { createContext, useContext, useState, useRef, useCallback, useMemo, useEffect, useLayoutEffect, Profiler, useReducer } from 'react';
@@ -4102,11 +4101,11 @@ function marqueeHits(marquee, boxes) {
4102
4101
  );
4103
4102
  }
4104
4103
  function axisPositionFrom(axis, constraint, offset) {
4105
- const start = offset ? axis === "x" ? offset.left : offset.top : 0;
4106
- 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;
4107
4106
  if (constraint === "center") return { constraint, start: (start - end) / 2, end: 0 };
4108
4107
  if (constraint !== "scale") return { constraint, start, end };
4109
- const size2 = offset ? axis === "x" ? offset.parentWidth : offset.parentHeight : 0;
4108
+ const size2 = axis === "x" ? offset.parentWidth : offset.parentHeight;
4110
4109
  return size2 > 0 ? { constraint, start: start / size2 * 100, end: end / size2 * 100 } : { constraint, start: 0, end: 0 };
4111
4110
  }
4112
4111
  var edgesX = (r) => [r.left, r.left + r.width / 2, r.left + r.width];
@@ -7718,7 +7717,11 @@ function AppearanceSection({ patternConfig, themeManifest, onPropChange, onToken
7718
7717
  {
7719
7718
  checked: position.absolute,
7720
7719
  label: t("orbInspector.absolute"),
7721
- 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
+ }
7722
7725
  }
7723
7726
  ),
7724
7727
  position.absolute && ["x", "y"].map((axis) => /* @__PURE__ */ jsxs(Box, { className: "flex items-center gap-2", "data-testid": `inspector-constraint-${axis}`, children: [
@@ -7729,9 +7732,10 @@ function AppearanceSection({ patternConfig, themeManifest, onPropChange, onToken
7729
7732
  value: position[axis].constraint,
7730
7733
  "aria-label": t(axis === "x" ? "orbInspector.constraintHorizontal" : "orbInspector.constraintVertical"),
7731
7734
  options: CONSTRAINTS.map((c) => ({ value: c, label: t(CONSTRAINT_LABELS[axis][c]) })),
7735
+ disabled: !offsetInParent,
7732
7736
  onValueChange: (v) => {
7733
7737
  const constraint = CONSTRAINTS.find((c) => c === v);
7734
- if (constraint) write({ ...position, [axis]: axisPositionFrom(axis, constraint, offsetInParent) });
7738
+ if (constraint && offsetInParent) write({ ...position, [axis]: axisPositionFrom(axis, constraint, offsetInParent) });
7735
7739
  },
7736
7740
  className: "flex-1 text-xs h-6"
7737
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-QVXLKFUQ.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-HUG25TT3.js';
2
- import { VStack, HStack } from './chunk-7LM6I3NA.js';
3
- import { Typography } from './chunk-HB4C27KU.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-7KSLPY56.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}}",