@almadar/core 10.86.0 → 10.87.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 (41) hide show
  1. package/dist/builders.d.ts +5 -4
  2. package/dist/builders.js +68 -29
  3. package/dist/builders.js.map +1 -1
  4. package/dist/{effect-BgDiw_bG.d.ts → effect-DMA97JxX.d.ts} +22 -6
  5. package/dist/{entityAccess-DK5S_2cT.d.ts → entityAccess-DNDEF75i.d.ts} +2 -2
  6. package/dist/{expression-Fk8bQWef.d.ts → expression-WfTp2arD.d.ts} +2 -65
  7. package/dist/factory/index.d.ts +6 -5
  8. package/dist/factory/index.js +1194 -401
  9. package/dist/factory/index.js.map +1 -1
  10. package/dist/factory-runtime/index.d.ts +35 -5
  11. package/dist/factory-runtime/index.js +127 -52
  12. package/dist/factory-runtime/index.js.map +1 -1
  13. package/dist/i18n/index.d.ts +111 -1
  14. package/dist/i18n/index.js +500 -19
  15. package/dist/i18n/index.js.map +1 -1
  16. package/dist/{index-ChYsqVJj.d.ts → index-xZP_Ajx3.d.ts} +18 -5
  17. package/dist/index.d.ts +82 -14
  18. package/dist/index.js +1876 -333
  19. package/dist/index.js.map +1 -1
  20. package/dist/json-D8gmyK3l.d.ts +65 -0
  21. package/dist/mock/index.d.ts +129 -12
  22. package/dist/mock/index.js +192 -61
  23. package/dist/mock/index.js.map +1 -1
  24. package/dist/patterns/component-mapping.json +1 -1
  25. package/dist/patterns/event-contracts.json +1 -1
  26. package/dist/patterns/index.d.ts +2525 -609
  27. package/dist/patterns/index.js +1238 -384
  28. package/dist/patterns/index.js.map +1 -1
  29. package/dist/patterns/integrators-registry.json +107 -23
  30. package/dist/patterns/patterns-registry.json +1170 -400
  31. package/dist/patterns/registry.json +1170 -400
  32. package/dist/patterns/services-registry.json +170 -35
  33. package/dist/{schema-BhfQb1oe.d.ts → schema-_SPrm5Ic.d.ts} +46381 -21335
  34. package/dist/state-machine/index.d.ts +2 -1
  35. package/dist/trait-9tfq2tQb.d.ts +10554 -0
  36. package/dist/types/index.d.ts +7 -6
  37. package/dist/types/index.js +132 -43
  38. package/dist/types/index.js.map +1 -1
  39. package/dist/{types-CCAmdxcH.d.ts → types-CjRjhiaO.d.ts} +19 -3
  40. package/package.json +2 -2
  41. package/dist/trait-pavNlGqm.d.ts +0 -5385
@@ -1,3 +1,113 @@
1
+ import { J as JsonValue } from '../json-D8gmyK3l.js';
2
+
3
+ /**
4
+ * A `.lolo` lexer — the JS-path mirror of `orbital-lolo/src/lexer.rs`.
5
+ *
6
+ * It exists so the JS path can rewrite a program's VOCABULARY without
7
+ * re-implementing the parser: every token carries its byte span, so a
8
+ * consumer splices replacement text into the original source and every
9
+ * comment, blank line and alignment survives untouched.
10
+ *
11
+ * The character classes below are copied from the Rust lexer rather than
12
+ * re-derived — an identifier continues on `alphanumeric | _ | / | -` (so
13
+ * `render-ui` and `str/upper` are ONE token), a sigil root continues on
14
+ * `alphanumeric | _ | .`, and `true`/`false`/`null` are their own kinds.
15
+ * `is_alphanumeric` there is Unicode, so the `u`-flagged `\p{L}`/`\p{N}`
16
+ * classes here match it for Arabic and Slovenian identifiers.
17
+ *
18
+ * @packageDocumentation
19
+ */
20
+ type LoloTokenKind = 'comment' | 'string' | 'number' | 'identifier' | 'literal' | 'sigil' | 'payload-sigil' | 'punct';
21
+ interface LoloToken {
22
+ kind: LoloTokenKind;
23
+ /** Byte-independent (UTF-16 code unit) start offset into the source. */
24
+ start: number;
25
+ /** Exclusive end offset. */
26
+ end: number;
27
+ /**
28
+ * The token's semantic text. For `identifier`/`literal` it is the word
29
+ * itself; for `sigil`/`payload-sigil` it is the name WITHOUT the `@`/`?`
30
+ * prefix; for everything else it is the raw slice.
31
+ */
32
+ text: string;
33
+ /** Offset at which `text` starts (differs from `start` for sigils). */
34
+ textStart: number;
35
+ }
36
+ /**
37
+ * Tokenize a `.lolo` source. Never throws: an unterminated string or block
38
+ * comment runs to end-of-input and is returned as that token, because this
39
+ * lexer's callers render source they did not necessarily author (a docs
40
+ * fence, an editor buffer mid-keystroke) and must degrade to "translate
41
+ * nothing" rather than fail.
42
+ */
43
+ declare function lexLolo(source: string): LoloToken[];
44
+
45
+ /**
46
+ * English → native rendering of a `.lolo` program and a `.orb` document —
47
+ * the forward direction of `@almadar/core/i18n`.
48
+ *
49
+ * Everything else in this module family goes native → English so a program
50
+ * written in Arabic or Slovenian COMPILES (`aliasMap`, the Rust
51
+ * `Lang::canon_*`). This is the mirror: it takes the canonical English
52
+ * program and renders it in a target language, so a reader can be shown the
53
+ * same program in their own vocabulary.
54
+ *
55
+ * ## Why it is position-aware and not a word substitution
56
+ *
57
+ * The i18n contract (`docs/Almadar_i18n.md` §"What a native program looks
58
+ * like") is that the parser "canonicalizes at the grammar position that
59
+ * expects the word, never by text replacement, so a native identifier that
60
+ * happens to equal a keyword translation is only a keyword where a keyword is
61
+ * expected". The forward direction inherits that constraint exactly. Blind
62
+ * substitution corrupts real programs: `entity`/`type`/`fields`/`name`/
63
+ * `label`/`description` are all vocabulary words AND the commonest pattern
64
+ * prop keys, and `parse_object_literal` takes object keys VERBATIM — a
65
+ * pattern prop is opaque and is never translated. Likewise an entity's field
66
+ * names and a trait's state names are the author's identifiers even when they
67
+ * spell a keyword.
68
+ *
69
+ * So this walks the token stream with a frame stack that reproduces the
70
+ * parser's positional expectations, and translates only where the grammar
71
+ * says a vocabulary word belongs. Rendering splices into the original source
72
+ * by span, so comments, blank lines and alignment survive byte-for-byte.
73
+ *
74
+ * The gate on all of it is round-trip equality: for the whole `.lolo` corpus,
75
+ * `orb emit orb` of the translated program must equal `orb emit orb` of the
76
+ * English one. That proves both halves — every vocabulary word was translated
77
+ * (or the `.orb` would differ) and no identifier was (same).
78
+ *
79
+ * @packageDocumentation
80
+ */
81
+
82
+ /**
83
+ * The flat English → native map over every `.lolo` vocabulary family plus the
84
+ * caller's operators. Well-defined because `checkI18nCoverage` rule 2 forbids
85
+ * one English word having two translations across sections — verified at 545
86
+ * entries with zero conflicts for both `ar` and `sl`.
87
+ *
88
+ * Exported for callers that only need the vocabulary (a highlighter building
89
+ * native token patterns, a docs table); `localizeLoloSource` does NOT use it,
90
+ * because which family applies is a positional question.
91
+ */
92
+ declare function localizeMap(lang: LanguageCode, operators?: OperatorTables): ReadonlyMap<string, string>;
93
+ interface LocalizeLoloOptions {
94
+ /** Operator vocabulary — supplied by the caller (`@almadar/std`), since core must not import std. */
95
+ operators?: OperatorTables;
96
+ }
97
+ /**
98
+ * Render an English `.lolo` source in `lang`, preserving the original
99
+ * formatting exactly. `lang === 'en'` returns the source unchanged.
100
+ */
101
+ declare function localizeLoloSource(source: string, lang: LanguageCode, options?: LocalizeLoloOptions): string;
102
+ /**
103
+ * Render an English `.orb` value in `lang` — the exact inverse of the Rust
104
+ * `translate_orb_value`: object keys via `orb`, a `type` value via `types`,
105
+ * an array's leading string (an s-expression / effect head) via
106
+ * `effects ∪ operators`, and the root of any `@sigil` string. Every other
107
+ * string — an entity name, a label, free text — is left alone.
108
+ */
109
+ declare function localizeOrbValue(value: JsonValue, lang: LanguageCode, options?: LocalizeLoloOptions): JsonValue;
110
+
1
111
  /**
2
112
  * Internationalization (i18n) — vocabulary tables for the `.lolo`/`.orb`
3
113
  * language (English, Arabic, Slovenian). See `Almadar_i18n.md` / the i18n
@@ -66,4 +176,4 @@ declare function checkI18nCoverage(input: I18nCoverageInput): {
66
176
  */
67
177
  declare function reportIdenticalToEnglish(input: I18nCoverageInput): I18nProblem[];
68
178
 
69
- export { I18N_SECTIONS, type I18nCoverageInput, type I18nMeta, type I18nProblem, type I18nProblemKind, type I18nSection, type I18nTables, LANGUAGE_CODES, LOLO_FIRST_TOKEN_KEYWORDS, type LanguageCode, type OperatorTables, aliasMap, checkI18nCoverage, coreTables, getVocabulary, languageOfLoloFirstToken, languageOfOrbTopLevelKeys, parseI18nTables, parseOperatorTables, reportIdenticalToEnglish };
179
+ export { I18N_SECTIONS, type I18nCoverageInput, type I18nMeta, type I18nProblem, type I18nProblemKind, type I18nSection, type I18nTables, LANGUAGE_CODES, LOLO_FIRST_TOKEN_KEYWORDS, type LanguageCode, type LocalizeLoloOptions, type LoloToken, type LoloTokenKind, type OperatorTables, aliasMap, checkI18nCoverage, coreTables, getVocabulary, languageOfLoloFirstToken, languageOfOrbTopLevelKeys, lexLolo, localizeLoloSource, localizeMap, localizeOrbValue, parseI18nTables, parseOperatorTables, reportIdenticalToEnglish };