@hyperfixi/types-browser 2.11.0 → 3.0.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/CHANGELOG.md +120 -0
- package/README.md +14 -9
- package/dist/i18n-api.d.ts +0 -29
- package/dist/i18n-api.d.ts.map +1 -1
- package/dist/type-guards.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/i18n-api.d.ts +11 -21
- package/src/i18n-api.ts +6 -37
- package/src/type-guards.ts +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,126 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [3.0.0] - 2026-09-03
|
|
11
|
+
|
|
12
|
+
Full notes: [GitHub Releases](https://github.com/codetalcott/hyperfixi/releases/tag/v3.0.0).
|
|
13
|
+
|
|
14
|
+
One major, two themes. `@lokascript/i18n`'s grammar transformer is gone,
|
|
15
|
+
because `@lokascript/semantic` overtook it on every row of the translation
|
|
16
|
+
corpus (#973–#1001). And the engine-migration plan
|
|
17
|
+
(`docs-internal/ENGINE_MIGRATION_PLAN.md`) is complete: its last arc deleted
|
|
18
|
+
the exported dead code it had been carrying and collapsed the browser bundle
|
|
19
|
+
lineup to two names (#1099–#1105).
|
|
20
|
+
|
|
21
|
+
### ⚠ BREAKING
|
|
22
|
+
|
|
23
|
+
- **`@lokascript/i18n` no longer translates** (#1001). `translate()`, `toLocale()`,
|
|
24
|
+
`toEnglish()`, `GrammarTransformer` and `createTransformer` are deleted; the
|
|
25
|
+
package is per-language vocabulary and grammar profiles. Migrate to
|
|
26
|
+
`import { translate } from '@lokascript/semantic'` (same signature; it throws
|
|
27
|
+
on unparseable input where the transformer returned nonsense). The classic-i18n
|
|
28
|
+
browser bundle, `@hyperscript-tools/i18n` and `@lokascript/types-browser` drop
|
|
29
|
+
the same members (#998, #999); the patterns corpus writer is semantic-only (#1000).
|
|
30
|
+
- **The prebuilt browser bundles are two names** (#1105): `hyperfixi-hx.js`
|
|
31
|
+
(small: hybrid parser, blocks, expressions, htmx v1/v2 attributes) and
|
|
32
|
+
`hyperfixi.js` (everything); `hyperfixi-hx-v4.js` and
|
|
33
|
+
`hyperfixi-multilingual.js` stay as separate products. `hyperfixi-lite.js`,
|
|
34
|
+
`-lite-plus.js`, `-minimal.js`, `-standard.js` and their `./browser/*`
|
|
35
|
+
exports are gone — use `hyperfixi-hx.js`, `hyperfixi.js`, or the Vite
|
|
36
|
+
plugin, which picks the tier itself. `./browser/hybrid-complete` remains as
|
|
37
|
+
the plugin's internal fallback.
|
|
38
|
+
- **Exported dead code deleted from `@hyperfixi/core`** — none had a
|
|
39
|
+
production caller: the six `@deprecated` `features/` families and the
|
|
40
|
+
modular bundle's `features` namespace (#1099); `Lexer`/`Tokens` (#1100 —
|
|
41
|
+
use `tokenize`); the `unified-types` `Validator`, the `types.d.ts` shim and
|
|
42
|
+
`registry/multilingual` (#1101); the `async` command (#1102 — it was
|
|
43
|
+
unreachable from parsed hyperscript; the manifest is 58 commands);
|
|
44
|
+
`ContextProviderRegistry`, the context-provider `Proxy`, the registry's
|
|
45
|
+
`context` slot and the plugin `contextProviders` field (#1104 — set
|
|
46
|
+
request-scoped values as `context.locals`).
|
|
47
|
+
|
|
48
|
+
### Fixed
|
|
49
|
+
|
|
50
|
+
- **A small bundle fails loudly on a command it lacks and names `hyperfixi.js`**
|
|
51
|
+
(#1103). The hybrid parser had been dropping an unrecognised word silently;
|
|
52
|
+
making it loud also exposed and fixed three silent mis-parses in the hybrid
|
|
53
|
+
bundles: unquoted `fetch /api/data` fetched `/`, `send custom:event` sent
|
|
54
|
+
`custom` to `me`, and `repeat forever` ran zero iterations.
|
|
55
|
+
- **English→foreign rendering is gated** (#931–#972, #953): 3105/3105 corpus
|
|
56
|
+
renders parse on the canonical engine; the bare (handler-less) surface has its
|
|
57
|
+
own gate. `as JSON` stays part of the value (#991); a flattened loop header
|
|
58
|
+
closes (#992).
|
|
59
|
+
- Plugins report their real versions (#926); `analyze_content` is unshadowed in
|
|
60
|
+
the MCP server (#927); four dependency advisories resolved; the `domain-flow`
|
|
61
|
+
→ `server-bridge` route contract is pinned (#1000s).
|
|
62
|
+
|
|
63
|
+
### Changed
|
|
64
|
+
|
|
65
|
+
- `hyperfixi.js` and `hyperfixi-hx-v4.js` carry the 24-language render
|
|
66
|
+
vocabulary (~19 KB gzip each) so `translate` works in the browser (#931).
|
|
67
|
+
- Deprecated `@lokascript/domain-*` references repoint to `@lokascript/domains`.
|
|
68
|
+
|
|
69
|
+
## [2.11.1] - 2026-08-25
|
|
70
|
+
|
|
71
|
+
Patch release. Fixes the release workflow itself: the build now runs **after**
|
|
72
|
+
the version sync, so a published tarball carries its own version rather than
|
|
73
|
+
the previous one, and `version.ts` is committed (#925). Also lands the
|
|
74
|
+
agent-loop A/B benchmark with an isolated generator (#924).
|
|
75
|
+
|
|
76
|
+
## [2.11.0] - 2026-08-24
|
|
77
|
+
|
|
78
|
+
Full notes: [GitHub Releases](https://github.com/codetalcott/hyperfixi/releases/tag/v2.11.0).
|
|
79
|
+
|
|
80
|
+
### Changed
|
|
81
|
+
|
|
82
|
+
- **The domain-DSL family moved out** (#909). Twelve packages left this
|
|
83
|
+
monorepo: the ten publishable `@lokascript/domain-*` packages (bdd,
|
|
84
|
+
behaviorspec, config, flow, jsx, learn, llm, sql, todo, voice) plus the
|
|
85
|
+
private `domain-toolkit` and `mcp-multilingual-intent`. They now ship as
|
|
86
|
+
**`@lokascript/domains`**, one subpath export per domain, from the
|
|
87
|
+
[lokascript-domains](https://github.com/codetalcott/lokascript-domains)
|
|
88
|
+
repository.
|
|
89
|
+
|
|
90
|
+
All ten published names are **deprecated on npm**, each naming its
|
|
91
|
+
replacement subpath (`@lokascript/domain-sql` → "import from
|
|
92
|
+
`@lokascript/domains/sql`"). Existing installs keep working — deprecation is
|
|
93
|
+
a warning, not a removal — they simply stop receiving updates. The
|
|
94
|
+
pre-deletion tree is preserved at the `moved/domain-family` tag.
|
|
95
|
+
|
|
96
|
+
_Migration:_ replace nine dependencies with one, and change
|
|
97
|
+
`from '@lokascript/domain-x'` to `from '@lokascript/domains/x'`. The root
|
|
98
|
+
entry absorbed `domain-config` and exports `createDomainRegistry`,
|
|
99
|
+
`registerAllDomains` and `DOMAIN_PRIORITY`.
|
|
100
|
+
|
|
101
|
+
### Added
|
|
102
|
+
|
|
103
|
+
- **"Show in My Language"** — LSP request plus VSCode command (#921).
|
|
104
|
+
- **Verified-translation badge** in the compilation service (#920).
|
|
105
|
+
- **`scoreFidelity` / `@lokascript/semantic/fidelity`** (#919).
|
|
106
|
+
- **Inert-shape warnings** (#918) and surfaced unconsumed-input warnings (#916)
|
|
107
|
+
in the compilation service.
|
|
108
|
+
- **The agent-loop benchmark** and the silent-failure finding it produced
|
|
109
|
+
(#915), and the MCP server's agent-era roadmap (#914).
|
|
110
|
+
- **Element-collection write-back** for hypermedia tables, with gallery
|
|
111
|
+
examples and four system fixes (#904).
|
|
112
|
+
- **The comprehensive Playwright tier now runs in CI** (#908) alongside
|
|
113
|
+
`quick`. It had never run: 122 specs, hiding four real bugs — a detached
|
|
114
|
+
`startViewTransition`, untracked reads of unset globals, concurrent effects
|
|
115
|
+
clobbering dependency capture, and `put` stringifying DocumentFragments
|
|
116
|
+
(#905).
|
|
117
|
+
|
|
118
|
+
### Fixed
|
|
119
|
+
|
|
120
|
+
- **The `hyperscript-adapter` review arc** (#895–#902): whole-string
|
|
121
|
+
translation first, taking canonical validity from 2849/3105 to **3105/3105**
|
|
122
|
+
(#899); a host-parser validity gate so an invalid render falls back to the
|
|
123
|
+
author's text (#900); the dead split-statement fallback deleted after
|
|
124
|
+
measuring 0 outputs (#901); and the slim divergence set burned 6 → 1 via
|
|
125
|
+
schema marker data, repairing 39 body-dropping corpus rows (#902).
|
|
126
|
+
- **`qu take.recipient`** — the R1 tail's last `take` row (#910).
|
|
127
|
+
- **The release workflows** no longer reference the moved-out domain family
|
|
128
|
+
(#922).
|
|
129
|
+
|
|
10
130
|
## [2.10.0] - 2026-08-01
|
|
11
131
|
|
|
12
132
|
Full notes: [GitHub Releases](https://github.com/codetalcott/hyperfixi/releases/tag/v2.10.0).
|
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ window._hyperscript.compile('on click add .highlight');
|
|
|
30
30
|
window.LokaScriptSemantic.parse('トグル .active', 'ja');
|
|
31
31
|
window.LokaScriptSemantic.translate('toggle .active', 'en', 'ko');
|
|
32
32
|
|
|
33
|
-
window.LokaScriptI18n.
|
|
33
|
+
window.LokaScriptI18n.getProfile('ja');
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
## Provided Types
|
|
@@ -51,9 +51,10 @@ Core LokaScript API (from `lokascript-browser.js` or `lokascript-multilingual.js
|
|
|
51
51
|
|
|
52
52
|
### window.LokaScriptSemantic
|
|
53
53
|
|
|
54
|
-
Semantic parsing API (from
|
|
54
|
+
Semantic parsing and translation API (from `@lokascript/semantic`'s
|
|
55
|
+
`dist/browser.global.js`):
|
|
55
56
|
|
|
56
|
-
- `parse(source, language)` - Parse in any of
|
|
57
|
+
- `parse(source, language)` - Parse in any of 24 languages
|
|
57
58
|
- `translate(source, fromLang, toLang)` - Translate between languages
|
|
58
59
|
- `getAllTranslations(source, sourceLang)` - Get all translations
|
|
59
60
|
- `createSemanticAnalyzer(options?)` - Create analyzer
|
|
@@ -61,19 +62,23 @@ Semantic parsing API (from `lokascript-semantic.browser.global.js`):
|
|
|
61
62
|
|
|
62
63
|
### window.LokaScriptI18n
|
|
63
64
|
|
|
64
|
-
|
|
65
|
+
Language vocabulary API (from `lokascript-i18n.min.js`):
|
|
65
66
|
|
|
66
|
-
- `translate(source, fromLang, toLang)` - Transform with grammar rules
|
|
67
|
-
- `createTransformer(options?)` - Create transformer instance
|
|
68
67
|
- `supportedLocales` - Array of supported locales
|
|
69
68
|
- `getProfile(locale)` - Get language grammar profile
|
|
70
69
|
|
|
70
|
+
> `translate(source, fromLang, toLang)` and `createTransformer(options?)` were
|
|
71
|
+
> removed in 3.0.0 along with `@lokascript/i18n`'s grammar transformer.
|
|
72
|
+
> Translation lives on `window.LokaScriptSemantic.translate` — it parses to a
|
|
73
|
+
> semantic node and renders from it, so the output re-parses in the target
|
|
74
|
+
> language.
|
|
75
|
+
|
|
71
76
|
## Browser Bundle Loading
|
|
72
77
|
|
|
73
78
|
```html
|
|
74
79
|
<!-- Load LokaScript browser bundles -->
|
|
75
|
-
<script src="https://cdn.jsdelivr.net/npm/@
|
|
76
|
-
<script src="https://cdn.jsdelivr.net/npm/@lokascript/semantic/dist/
|
|
80
|
+
<script src="https://cdn.jsdelivr.net/npm/@hyperfixi/core/dist/hyperfixi.js"></script>
|
|
81
|
+
<script src="https://cdn.jsdelivr.net/npm/@lokascript/semantic/dist/browser.global.js"></script>
|
|
77
82
|
<script src="https://cdn.jsdelivr.net/npm/@lokascript/i18n/dist/lokascript-i18n.min.js"></script>
|
|
78
83
|
|
|
79
84
|
<!-- Now use with full TypeScript support -->
|
|
@@ -81,7 +86,7 @@ Grammar transformation API (from `lokascript-i18n.min.js`):
|
|
|
81
86
|
// TypeScript knows about these globals!
|
|
82
87
|
window.lokascript.execute('toggle .active');
|
|
83
88
|
window.LokaScriptSemantic.parse('トグル .active', 'ja');
|
|
84
|
-
window.
|
|
89
|
+
window.LokaScriptSemantic.translate('toggle .active', 'en', 'ja');
|
|
85
90
|
</script>
|
|
86
91
|
```
|
|
87
92
|
|
package/dist/i18n-api.d.ts
CHANGED
|
@@ -5,27 +5,6 @@
|
|
|
5
5
|
* HyperFixi i18n/Grammar transformation API on window.HyperFixiI18n
|
|
6
6
|
*/
|
|
7
7
|
export interface LokaScriptI18nAPI {
|
|
8
|
-
/**
|
|
9
|
-
* Transform hyperscript statement from one language word order to another
|
|
10
|
-
*
|
|
11
|
-
* @param statement Parsed hyperscript statement
|
|
12
|
-
* @param fromLocale Source language locale (e.g., 'en')
|
|
13
|
-
* @param toLocale Target language locale (e.g., 'ja')
|
|
14
|
-
* @returns Transformed statement or null
|
|
15
|
-
*/
|
|
16
|
-
translate(statement: HyperscriptStatement, fromLocale: string, toLocale: string): HyperscriptStatement | null;
|
|
17
|
-
/**
|
|
18
|
-
* Transform code from English to target locale
|
|
19
|
-
*/
|
|
20
|
-
toLocale(code: string, toLocale: string): string | null;
|
|
21
|
-
/**
|
|
22
|
-
* Transform code from any locale to English
|
|
23
|
-
*/
|
|
24
|
-
toEnglish(code: string, fromLocale: string): string | null;
|
|
25
|
-
/**
|
|
26
|
-
* Parse hyperscript statement
|
|
27
|
-
*/
|
|
28
|
-
parseStatement(code: string): HyperscriptStatement | null;
|
|
29
8
|
/**
|
|
30
9
|
* Get supported locales for grammar transformation
|
|
31
10
|
*/
|
|
@@ -77,7 +56,6 @@ export interface LokaScriptI18nAPI {
|
|
|
77
56
|
/**
|
|
78
57
|
* Grammar transformer class
|
|
79
58
|
*/
|
|
80
|
-
GrammarTransformer: any;
|
|
81
59
|
/**
|
|
82
60
|
* Locale manager class
|
|
83
61
|
*/
|
|
@@ -144,13 +122,6 @@ export interface LokaScriptI18nAPI {
|
|
|
144
122
|
* Direct mapping configuration
|
|
145
123
|
*/
|
|
146
124
|
directMappings: any;
|
|
147
|
-
/**
|
|
148
|
-
* Grammar transformation examples
|
|
149
|
-
*/
|
|
150
|
-
grammarExamples: Array<{
|
|
151
|
-
english: string;
|
|
152
|
-
[locale: string]: string;
|
|
153
|
-
}>;
|
|
154
125
|
}
|
|
155
126
|
export interface HyperscriptStatement {
|
|
156
127
|
command: string;
|
package/dist/i18n-api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n-api.d.ts","sourceRoot":"","sources":["../src/i18n-api.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,iBAAiB;
|
|
1
|
+
{"version":3,"file":"i18n-api.d.ts","sourceRoot":"","sources":["../src/i18n-api.ts"],"names":[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ED;;GAEG;AACH,wBAAgB,4BAA4B,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,GAAG,IAAI,qBAAqB,CAOpF;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,GAAG,IAAI,iBAAiB,
|
|
1
|
+
{"version":3,"file":"type-guards.d.ts","sourceRoot":"","sources":["../src/type-guards.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,GAAG,IAAI,iBAAiB,CAO5E;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,GAAG,IAAI,qBAAqB,CAOpF;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,GAAG,IAAI,iBAAiB,CAU5E;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,iBAAiB,GAAG,IAAI,CAK3D;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,qBAAqB,GAAG,IAAI,CAKnE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,iBAAiB,GAAG,IAAI,CAK3D"}
|
package/package.json
CHANGED
package/src/i18n-api.d.ts
CHANGED
|
@@ -2,16 +2,18 @@
|
|
|
2
2
|
* Type definitions for @lokascript/i18n browser global (window.HyperFixiI18n)
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* NOTE: this file and `i18n-api.ts` both declare `LokaScriptI18nAPI`, with
|
|
7
|
+
* different shapes — `index.d.ts` references this one, `index.ts` exports the
|
|
8
|
+
* other. That divergence predates this change and is untouched here; only the
|
|
9
|
+
* retired transformer surface is removed from both.
|
|
10
|
+
*/
|
|
5
11
|
export interface LokaScriptI18nAPI {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Create a grammar transformer instance
|
|
13
|
-
*/
|
|
14
|
-
createTransformer(options?: TransformerOptions): GrammarTransformer;
|
|
12
|
+
// RETIRED 2026-08-28 with `@lokascript/i18n`'s grammar transformer:
|
|
13
|
+
// `translate` and `createTransformer` (plus the `GrammarTransformer` and
|
|
14
|
+
// `TransformerOptions` interfaces they referenced). Translation is
|
|
15
|
+
// `@lokascript/semantic`'s job; in the browser that is `hyperfixi.translate`
|
|
16
|
+
// from the multilingual bundle.
|
|
15
17
|
|
|
16
18
|
/**
|
|
17
19
|
* Get supported locales
|
|
@@ -24,18 +26,6 @@ export interface LokaScriptI18nAPI {
|
|
|
24
26
|
getProfile(locale: string): LanguageProfile | undefined;
|
|
25
27
|
}
|
|
26
28
|
|
|
27
|
-
export interface GrammarTransformer {
|
|
28
|
-
transform(source: string, fromLang: string, toLang: string): string;
|
|
29
|
-
parseStatement(source: string, language: string): ParsedStatement;
|
|
30
|
-
toLocale(statement: ParsedStatement, locale: string): string;
|
|
31
|
-
toEnglish(source: string, locale: string): string;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export interface TransformerOptions {
|
|
35
|
-
strict?: boolean;
|
|
36
|
-
preserveWhitespace?: boolean;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
29
|
export interface LanguageProfile {
|
|
40
30
|
locale: string;
|
|
41
31
|
wordOrder: 'SVO' | 'SOV' | 'VSO';
|
package/src/i18n-api.ts
CHANGED
|
@@ -6,34 +6,12 @@
|
|
|
6
6
|
* HyperFixi i18n/Grammar transformation API on window.HyperFixiI18n
|
|
7
7
|
*/
|
|
8
8
|
export interface LokaScriptI18nAPI {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
* @returns Transformed statement or null
|
|
16
|
-
*/
|
|
17
|
-
translate(
|
|
18
|
-
statement: HyperscriptStatement,
|
|
19
|
-
fromLocale: string,
|
|
20
|
-
toLocale: string
|
|
21
|
-
): HyperscriptStatement | null;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Transform code from English to target locale
|
|
25
|
-
*/
|
|
26
|
-
toLocale(code: string, toLocale: string): string | null;
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Transform code from any locale to English
|
|
30
|
-
*/
|
|
31
|
-
toEnglish(code: string, fromLocale: string): string | null;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Parse hyperscript statement
|
|
35
|
-
*/
|
|
36
|
-
parseStatement(code: string): HyperscriptStatement | null;
|
|
9
|
+
// RETIRED 2026-08-28 with `@lokascript/i18n`'s grammar transformer:
|
|
10
|
+
// `translate`, `toLocale`, `toEnglish`, `parseStatement`, `grammarExamples`.
|
|
11
|
+
// The global keeps its DICTIONARIES, keyword providers, locale manager,
|
|
12
|
+
// direct mappings and grammar PROFILES — everything that was not the
|
|
13
|
+
// transformer. Translation is `@lokascript/semantic`'s job; in the browser
|
|
14
|
+
// that is `hyperfixi.translate` from the multilingual bundle.
|
|
37
15
|
|
|
38
16
|
/**
|
|
39
17
|
* Get supported locales for grammar transformation
|
|
@@ -106,7 +84,6 @@ export interface LokaScriptI18nAPI {
|
|
|
106
84
|
/**
|
|
107
85
|
* Grammar transformer class
|
|
108
86
|
*/
|
|
109
|
-
GrammarTransformer: any;
|
|
110
87
|
|
|
111
88
|
/**
|
|
112
89
|
* Locale manager class
|
|
@@ -181,14 +158,6 @@ export interface LokaScriptI18nAPI {
|
|
|
181
158
|
* Direct mapping configuration
|
|
182
159
|
*/
|
|
183
160
|
directMappings: any;
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* Grammar transformation examples
|
|
187
|
-
*/
|
|
188
|
-
grammarExamples: Array<{
|
|
189
|
-
english: string;
|
|
190
|
-
[locale: string]: string;
|
|
191
|
-
}>;
|
|
192
161
|
}
|
|
193
162
|
|
|
194
163
|
export interface HyperscriptStatement {
|
package/src/type-guards.ts
CHANGED
|
@@ -37,7 +37,10 @@ export function isHyperFixiI18nAvailable(obj?: any): obj is LokaScriptI18nAPI {
|
|
|
37
37
|
return (
|
|
38
38
|
typeof obj === 'object' &&
|
|
39
39
|
obj !== null &&
|
|
40
|
-
|
|
40
|
+
// `translate` used to be the marker here; it left with the grammar
|
|
41
|
+
// transformer (2026-08-28). `getProfile` is the surviving half of the same
|
|
42
|
+
// module and is what makes this global distinguishable.
|
|
43
|
+
typeof obj.getProfile === 'function' &&
|
|
41
44
|
typeof obj.getSupportedLocales === 'function'
|
|
42
45
|
);
|
|
43
46
|
}
|