@almadar/ui 6.10.0 → 6.11.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 (35) hide show
  1. package/dist/{EntityBindingContext-Y4zXyNJZ.d.cts → EntityBindingContext-D5lRu6p1.d.cts} +11 -0
  2. package/dist/{EntityBindingContext-Y4zXyNJZ.d.ts → EntityBindingContext-D5lRu6p1.d.ts} +11 -0
  3. package/dist/{GameAudioProvider-Dk_Y3LN3.d.cts → GameAudioProvider-D8GynTNq.d.cts} +1 -1
  4. package/dist/{GameAudioProvider-Ctceau1s.d.ts → GameAudioProvider-Dozqx4sL.d.ts} +1 -1
  5. package/dist/avl/index.cjs +250 -106
  6. package/dist/avl/index.js +209 -65
  7. package/dist/{avl-schema-parser-DncJLEn9.d.ts → avl-schema-parser-DX-aVCCm.d.ts} +1 -1
  8. package/dist/{avl-schema-parser-FQ1474v8.d.cts → avl-schema-parser-PVu8rgsy.d.cts} +1 -1
  9. package/dist/{cn-C7fvp9gH.d.ts → cn-Do5gsPBm.d.cts} +2 -100
  10. package/dist/{cn-DnLYahyL.d.cts → cn-Do5gsPBm.d.ts} +2 -100
  11. package/dist/components/index.cjs +103 -68
  12. package/dist/components/index.d.cts +44 -20
  13. package/dist/components/index.d.ts +44 -20
  14. package/dist/components/index.js +64 -29
  15. package/dist/lib/drawable/three/index.d.cts +3 -4
  16. package/dist/lib/drawable/three/index.d.ts +3 -4
  17. package/dist/lib/index.cjs +7 -23
  18. package/dist/lib/index.d.cts +6 -28
  19. package/dist/lib/index.d.ts +6 -28
  20. package/dist/lib/index.js +5 -23
  21. package/dist/{paintDispatch-B5ObLnUv.d.ts → paintDispatch-CK5uwYEq.d.cts} +50 -3
  22. package/dist/{paintDispatch-D3R8NNmV.d.cts → paintDispatch-CK5uwYEq.d.ts} +50 -3
  23. package/dist/providers/index.cjs +129 -78
  24. package/dist/providers/index.d.cts +5 -3
  25. package/dist/providers/index.d.ts +5 -3
  26. package/dist/providers/index.js +90 -39
  27. package/dist/runtime/index.cjs +249 -105
  28. package/dist/runtime/index.d.cts +27 -5
  29. package/dist/runtime/index.d.ts +27 -5
  30. package/dist/runtime/index.js +208 -64
  31. package/dist/verificationRegistry-BLsjb1oU.d.cts +110 -0
  32. package/dist/verificationRegistry-D8bHWD8Q.d.ts +110 -0
  33. package/package.json +7 -7
  34. package/dist/types-B3nHgnMG.d.cts +0 -51
  35. package/dist/types-B3nHgnMG.d.ts +0 -51
@@ -3,7 +3,7 @@ import React89__default, { createContext, useContext, useMemo, useRef, useEffect
3
3
  import { EventBusContext, useTraitScopeChain, RenderSlotProvider, useEntitySchemaOptional, useEntityBindingSnapshot, useTraitScope, TraitScopeProvider, useNavStack, useCurrentPagePath, useRenderSlot, useGameAudioContextOptional, matchPathAmong } from '@almadar/ui/providers';
4
4
  import { createLogger, isLogLevelEnabled } from '@almadar/logger';
5
5
  import { createContextFromBindings, interpolateValue } from '@almadar/runtime';
6
- import { ANONYMOUS_USER, isRenderBindingMarker, isFileValue, isInlineTrait } from '@almadar/core';
6
+ import { ANONYMOUS_USER, isRenderBindingMarker, getNestedValue, isFileValue, isInlineTrait } from '@almadar/core';
7
7
  export { ANONYMOUS_USER } from '@almadar/core';
8
8
  import { clsx } from 'clsx';
9
9
  import { twMerge } from 'tailwind-merge';
@@ -20,7 +20,8 @@ import { useLocation, useNavigate, Link, Outlet } from 'react-router-dom';
20
20
  import ELK from 'elkjs/lib/elk.bundled.js';
21
21
  import SyntaxHighlighter from 'react-syntax-highlighter/dist/esm/prism-light.js';
22
22
  import dark from 'react-syntax-highlighter/dist/esm/styles/prism/vsc-dark-plus.js';
23
- import { orbLanguage, loloLanguage, ORB_COLORS } from '@almadar/syntax';
23
+ import { orbLanguage, loloLanguage, ORB_COLORS, translateLolo, translateOrb } from '@almadar/syntax';
24
+ import { coreTables } from '@almadar/core/i18n';
24
25
  import langJson from 'react-syntax-highlighter/dist/esm/languages/prism/json.js';
25
26
  import langJavascript from 'react-syntax-highlighter/dist/esm/languages/prism/javascript.js';
26
27
  import langTypescript from 'react-syntax-highlighter/dist/esm/languages/prism/typescript.js';
@@ -18210,6 +18211,15 @@ function buildLineProps(errorLines, extraClassName) {
18210
18211
  };
18211
18212
  };
18212
18213
  }
18214
+ function translateProgram(source, language, lang) {
18215
+ if (lang === "en") return source;
18216
+ if (language === "lolo") return translateLolo(source, lang);
18217
+ if (language === "orb") {
18218
+ const translated = translateOrb(source, lang);
18219
+ return typeof translated === "string" ? translated : source;
18220
+ }
18221
+ return source;
18222
+ }
18213
18223
  var dynamicallyLoaded, codeLanguageLoader, orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, log7, CODE_LANGUAGES, CODE_LANGUAGE_SET, DIFF_STYLES, DIFF_STYLE_FALLBACK, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, HIGHLIGHT_CAPACITY_BYTES, MONO_FONT_FAMILY, VIEWER_LINE_NUMBER_STYLE, CodeBlock;
18214
18224
  var init_CodeBlock = __esm({
18215
18225
  "components/core/molecules/markdown/CodeBlock.tsx"() {
@@ -18475,6 +18485,7 @@ var init_CodeBlock = __esm({
18475
18485
  showLineNumbers = false,
18476
18486
  wordWrap = false,
18477
18487
  files,
18488
+ naturalLanguages,
18478
18489
  actions,
18479
18490
  isLoading = false,
18480
18491
  error,
@@ -18521,7 +18532,48 @@ var init_CodeBlock = __esm({
18521
18532
  "replace"
18522
18533
  ]
18523
18534
  }) => {
18524
- const code = typeof rawCode === "string" ? rawCode : String(rawCode ?? "");
18535
+ const englishCode = typeof rawCode === "string" ? rawCode : String(rawCode ?? "");
18536
+ const naturalTabs = !editable && naturalLanguages && naturalLanguages.length > 1 ? naturalLanguages : void 0;
18537
+ const [naturalLanguage, setNaturalLanguage] = useState(() => naturalTabs?.[0] ?? "en");
18538
+ const activeNaturalLanguage = naturalTabs?.includes(naturalLanguage) === true ? naturalLanguage : naturalTabs?.[0] ?? "en";
18539
+ const translationCache = useMemo(() => /* @__PURE__ */ new Map(), [englishCode, files]);
18540
+ const translateFor = useCallback(
18541
+ (source, sourceLanguage, cacheKey) => {
18542
+ if (activeNaturalLanguage === "en") return source;
18543
+ const key = `${cacheKey}|${sourceLanguage}|${activeNaturalLanguage}`;
18544
+ const hit = translationCache.get(key);
18545
+ if (hit !== void 0) return hit;
18546
+ const translated = translateProgram(source, sourceLanguage, activeNaturalLanguage);
18547
+ translationCache.set(key, translated);
18548
+ return translated;
18549
+ },
18550
+ [translationCache, activeNaturalLanguage]
18551
+ );
18552
+ const code = translateFor(englishCode, language, "code");
18553
+ const naturalTabItems = naturalTabs?.map((lang) => ({
18554
+ id: `lang-${lang}`,
18555
+ label: coreTables[lang].meta.name,
18556
+ content: null
18557
+ }));
18558
+ const naturalTabStrip = naturalTabs && naturalTabItems ? /* @__PURE__ */ jsx(
18559
+ Box,
18560
+ {
18561
+ className: "border-b border-border",
18562
+ dir: coreTables[activeNaturalLanguage].meta.rtl ? "rtl" : "ltr",
18563
+ "data-testid": "codeblock-language-tabs",
18564
+ children: /* @__PURE__ */ jsx(
18565
+ Tabs,
18566
+ {
18567
+ tabs: naturalTabItems,
18568
+ activeTab: `lang-${activeNaturalLanguage}`,
18569
+ onTabChange: (id) => {
18570
+ const next = naturalTabs.find((lang) => `lang-${lang}` === id);
18571
+ if (next) setNaturalLanguage(next);
18572
+ }
18573
+ }
18574
+ )
18575
+ }
18576
+ ) : null;
18525
18577
  const activeStyle = resolveHighlightStyle(language);
18526
18578
  const overCapacity = code.length > HIGHLIGHT_CAPACITY_BYTES;
18527
18579
  const plainCodeColor = plainCodeColorOf(activeStyle);
@@ -18534,8 +18586,8 @@ var init_CodeBlock = __esm({
18534
18586
  const [wrap, setWrap] = useState(wordWrap);
18535
18587
  const [activeFileIndex, setActiveFileIndex] = useState(0);
18536
18588
  const activeFile = files?.[activeFileIndex];
18537
- const activeCode = activeFile?.code ?? code;
18538
18589
  const activeLanguage = activeFile?.language ?? language;
18590
+ const activeCode = activeFile ? translateFor(activeFile.code, activeLanguage, `file-${activeFileIndex}`) : code;
18539
18591
  const languageReady = useLanguageReady(activeLanguage);
18540
18592
  const viewerStyle = resolveHighlightStyle(activeLanguage);
18541
18593
  const viewerPlainCodeColor = plainCodeColorOf(viewerStyle);
@@ -19020,6 +19072,7 @@ var init_CodeBlock = __esm({
19020
19072
  content: null
19021
19073
  }));
19022
19074
  return /* @__PURE__ */ jsx(Card, { className: cn("overflow-hidden", className), children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column" }, children: [
19075
+ naturalTabStrip,
19023
19076
  tabItems && tabItems.length > 1 && /* @__PURE__ */ jsx(Box, { className: "border-b border-border", children: /* @__PURE__ */ jsx(
19024
19077
  Tabs,
19025
19078
  {
@@ -19081,7 +19134,7 @@ var init_CodeBlock = __esm({
19081
19134
  ]
19082
19135
  }
19083
19136
  ),
19084
- /* @__PURE__ */ jsx(Box, { className: "overflow-auto bg-muted/20", style: { maxHeight }, children: diffLines ? /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column" }, className: "font-mono text-xs", children: diffRowElements }) : /* @__PURE__ */ jsx("div", { className: "font-mono text-xs", children: viewerHighlightedElement }) })
19137
+ /* @__PURE__ */ jsx(Box, { className: "overflow-auto bg-muted/20", style: { maxHeight }, dir: "ltr", children: diffLines ? /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column" }, className: "font-mono text-xs", children: diffRowElements }) : /* @__PURE__ */ jsx("div", { className: "font-mono text-xs", children: viewerHighlightedElement }) })
19085
19138
  ] }) });
19086
19139
  }
19087
19140
  const hasHeader = showLanguageBadge || effectiveCopy;
@@ -19108,6 +19161,7 @@ var init_CodeBlock = __esm({
19108
19161
  ]
19109
19162
  }
19110
19163
  ),
19164
+ naturalTabStrip,
19111
19165
  editable ? (
19112
19166
  /* GAP-77 / GAP-82 / GAP-83: editable mode = transparent textarea on
19113
19167
  top of a Prism-highlighted SyntaxHighlighter overlay.
@@ -19259,6 +19313,7 @@ var init_CodeBlock = __esm({
19259
19313
  {
19260
19314
  ref: scrollRef,
19261
19315
  onCopy: handleSelectionCopy,
19316
+ dir: "ltr",
19262
19317
  style: {
19263
19318
  flex: 1,
19264
19319
  minHeight: 0,
@@ -19277,7 +19332,7 @@ var init_CodeBlock = __esm({
19277
19332
  )
19278
19333
  ] });
19279
19334
  },
19280
- (prev, next) => prev.language === next.language && prev.code === next.code && prev.showCopyButton === next.showCopyButton && prev.showCopy === next.showCopy && prev.maxHeight === next.maxHeight && prev.foldable === next.foldable && prev.editable === next.editable && prev.onChange === next.onChange && prev.errorLines === next.errorLines && prev.mode === next.mode && prev.title === next.title && prev.diff === next.diff && prev.files === next.files && prev.actions === next.actions && prev.isLoading === next.isLoading && prev.error === next.error && prev.editorId === next.editorId && prev.onEditorFocus === next.onEditorFocus && prev.onEditorBlur === next.onEditorBlur && prev.onMotion === next.onMotion && prev.onOperate === next.onOperate && prev.onInsertText === next.onInsertText && prev.onSetMode === next.onSetMode && prev.motions === next.motions && prev.operators === next.operators
19335
+ (prev, next) => prev.language === next.language && prev.code === next.code && prev.showCopyButton === next.showCopyButton && prev.showCopy === next.showCopy && prev.maxHeight === next.maxHeight && prev.foldable === next.foldable && prev.editable === next.editable && prev.onChange === next.onChange && prev.errorLines === next.errorLines && prev.mode === next.mode && prev.title === next.title && prev.diff === next.diff && prev.files === next.files && prev.naturalLanguages === next.naturalLanguages && prev.actions === next.actions && prev.isLoading === next.isLoading && prev.error === next.error && prev.editorId === next.editorId && prev.onEditorFocus === next.onEditorFocus && prev.onEditorBlur === next.onEditorBlur && prev.onMotion === next.onMotion && prev.onOperate === next.onOperate && prev.onInsertText === next.onInsertText && prev.onSetMode === next.onSetMode && prev.motions === next.motions && prev.operators === next.operators
19281
19336
  );
19282
19337
  CodeBlock.displayName = "CodeBlock";
19283
19338
  }
@@ -22972,26 +23027,6 @@ var init_ButtonGroup = __esm({
22972
23027
  ButtonGroup.displayName = "ButtonGroup";
22973
23028
  }
22974
23029
  });
22975
- function getNestedValue(obj, path) {
22976
- if (obj === null || obj === void 0 || !path) {
22977
- return void 0;
22978
- }
22979
- if (!path.includes(".")) {
22980
- return obj[path];
22981
- }
22982
- const parts = path.split(".");
22983
- let value = obj;
22984
- for (const part of parts) {
22985
- if (value === null || value === void 0) {
22986
- return void 0;
22987
- }
22988
- if (typeof value !== "object" || Array.isArray(value)) {
22989
- return void 0;
22990
- }
22991
- value = value[part];
22992
- }
22993
- return value;
22994
- }
22995
23030
  function resolveImageUrl(value) {
22996
23031
  if (typeof value === "string") {
22997
23032
  return value;
@@ -41968,11 +42003,11 @@ var init_WizardContainer = __esm({
41968
42003
  });
41969
42004
  function calculateComplexity(schema) {
41970
42005
  if (!schema) return 1;
41971
- const entities = schema.dataEntities?.length || 0;
42006
+ const entities = schema.dataEntities || 0;
41972
42007
  const pages = schema.ui?.pages?.length || 0;
41973
- const traits2 = schema.traits?.length || 0;
42008
+ const traits2 = schema.traits || 0;
41974
42009
  const sections = schema.ui?.pages?.reduce(
41975
- (acc, page) => acc + (page.sections?.length || 0),
42010
+ (acc, page) => acc + (page.sections || 0),
41976
42011
  0
41977
42012
  ) || 0;
41978
42013
  return entities * 3 + pages * 2 + traits2 * 2 + sections * 1;
@@ -52941,6 +52976,29 @@ function parseLifecycleEvent(type) {
52941
52976
  }
52942
52977
  return null;
52943
52978
  }
52979
+ function mapServerEffectResults(effectResults) {
52980
+ return effectResults.map((er) => {
52981
+ const target = er["entityType"] ?? er["entity"] ?? er["service"];
52982
+ const entityName = typeof target === "string" && target !== "" ? target : void 0;
52983
+ const rawAction = er["action"];
52984
+ const action = rawAction === "create" || rawAction === "update" || rawAction === "delete" || rawAction === "batch" ? rawAction : void 0;
52985
+ const data = er["data"];
52986
+ const resultId = data !== null && typeof data === "object" && !Array.isArray(data) && typeof data["id"] === "string" ? data["id"] : void 0;
52987
+ const denied = er["denied"] === true;
52988
+ const success = er["success"] !== false;
52989
+ const outcome = denied ? "denied" : success ? "success" : "failed";
52990
+ return {
52991
+ type: String(er["type"] ?? er["effect"] ?? "server-effect"),
52992
+ ...entityName !== void 0 ? { entityName } : {},
52993
+ ...action !== void 0 ? { action } : {},
52994
+ ...resultId !== void 0 ? { resultId } : {},
52995
+ outcome,
52996
+ args: entityName !== void 0 ? [entityName] : [],
52997
+ status: outcome === "success" ? "executed" : "failed",
52998
+ error: er["error"]
52999
+ };
53000
+ });
53001
+ }
52944
53002
  function VerificationProvider({
52945
53003
  children,
52946
53004
  enabled,
@@ -52978,16 +53036,8 @@ function VerificationProvider({
52978
53036
  args: Array.isArray(e["args"]) ? e["args"] : [],
52979
53037
  status: "executed"
52980
53038
  }));
52981
- const effectResults = Array.isArray(payload["effectResults"]) ? payload["effectResults"] : [];
52982
- for (const er of effectResults) {
52983
- const target = er["entity"] ?? er["service"];
52984
- effects.push({
52985
- type: String(er["type"] ?? er["effect"] ?? "server-effect"),
52986
- args: typeof target === "string" && target !== "" ? [target] : [],
52987
- status: er["error"] ? "failed" : "executed",
52988
- error: er["error"]
52989
- });
52990
- }
53039
+ const effectResultsRaw = Array.isArray(payload["effectResults"]) ? payload["effectResults"] : [];
53040
+ effects.push(...mapServerEffectResults(effectResultsRaw));
52991
53041
  const dataEntities = {};
52992
53042
  const responseData = payload["data"];
52993
53043
  if (responseData && typeof responseData === "object") {
@@ -53989,6 +54039,7 @@ function ServerBridgeProvider({
53989
54039
  dataEntities,
53990
54040
  data: responseData,
53991
54041
  emittedEvents: result.emittedEvents?.map((e) => e.event) ?? [],
54042
+ effectResults: result.effectResults,
53992
54043
  error: result.error
53993
54044
  };
53994
54045
  if (result.success) {