@lokascript/hyperscript-adapter 2.9.4 → 2.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.
- package/CHANGELOG.md +21 -1
- package/README.md +16 -11
- package/dist/hyperscript-i18n-ar.global.js +5 -6
- package/dist/hyperscript-i18n-bn.global.js +5 -6
- package/dist/hyperscript-i18n-de.global.js +5 -6
- package/dist/hyperscript-i18n-east-asian.global.js +5 -6
- package/dist/hyperscript-i18n-en.global.js +7 -8
- package/dist/hyperscript-i18n-es.global.js +5 -6
- package/dist/hyperscript-i18n-fr.global.js +5 -6
- package/dist/hyperscript-i18n-he.global.js +5 -6
- package/dist/hyperscript-i18n-hi.global.js +5 -6
- package/dist/hyperscript-i18n-id.global.js +5 -6
- package/dist/hyperscript-i18n-it.global.js +5 -6
- package/dist/hyperscript-i18n-ja.global.js +5 -6
- package/dist/hyperscript-i18n-ko.global.js +5 -6
- package/dist/hyperscript-i18n-lite.global.js +2 -2
- package/dist/hyperscript-i18n-ms.global.js +5 -6
- package/dist/hyperscript-i18n-pl.global.js +5 -6
- package/dist/hyperscript-i18n-pt.global.js +5 -6
- package/dist/hyperscript-i18n-qu.global.js +5 -6
- package/dist/hyperscript-i18n-ru.global.js +5 -6
- package/dist/hyperscript-i18n-slavic.global.js +5 -6
- package/dist/hyperscript-i18n-south-asian.global.js +5 -6
- package/dist/hyperscript-i18n-southeast-asian.global.js +5 -6
- package/dist/hyperscript-i18n-sw.global.js +5 -6
- package/dist/hyperscript-i18n-th.global.js +5 -6
- package/dist/hyperscript-i18n-tl.global.js +5 -6
- package/dist/hyperscript-i18n-tr.global.js +5 -6
- package/dist/hyperscript-i18n-uk.global.js +5 -6
- package/dist/hyperscript-i18n-vi.global.js +5 -6
- package/dist/hyperscript-i18n-western.global.js +5 -6
- package/dist/hyperscript-i18n-zh.global.js +5 -6
- package/dist/hyperscript-i18n.global.js +27 -28
- package/dist/hyperscript-i18n.global.js.map +1 -1
- package/dist/index.cjs +107 -86
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +75 -12
- package/dist/index.d.ts +75 -12
- package/dist/index.js +107 -93
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/attribute-translator.ts +12 -7
- package/src/browser-lite.ts +18 -3
- package/src/generated/syntax-table.ts +4 -4
- package/src/host-validate.ts +63 -0
- package/src/hyperscript-renderer.ts +64 -5
- package/src/index.ts +6 -1
- package/src/language-resolver.ts +15 -3
- package/src/plugin.ts +57 -7
- package/src/preprocessor-core.ts +217 -0
- package/src/preprocessor.ts +14 -215
- package/src/slim-plugin.ts +18 -3
- package/src/slim-preprocessor.ts +16 -154
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [2.10.0] - 2026-08-01
|
|
11
|
+
|
|
12
|
+
Full notes: [GitHub Releases](https://github.com/codetalcott/hyperfixi/releases/tag/v2.10.0).
|
|
13
|
+
|
|
14
|
+
Highlights: `swap`/`process`/`morph … using view transition` across all 24
|
|
15
|
+
languages (#870, #873, #875), typed command registration (#869, #871),
|
|
16
|
+
`tell`/`process` parser fixes (#861, #872), the R1 role-fidelity burn-down
|
|
17
|
+
(#864, #867, #868, #874, #878), and guards for the remaining hand-maintained
|
|
18
|
+
CI package lists (#862, #865).
|
|
19
|
+
|
|
20
|
+
## [2.9.0] - 2026-07-25
|
|
21
|
+
|
|
22
|
+
> **Gap note:** 2.9.1 through 2.9.4 shipped without entries in this file; their
|
|
23
|
+
> details live in [GitHub Releases](https://github.com/codetalcott/hyperfixi/releases).
|
|
24
|
+
|
|
10
25
|
### ⚠ BREAKING (types)
|
|
11
26
|
|
|
12
27
|
- **Domain renderers return `string | null`.** `renderSQL`, `renderJSX`, `renderTodo`,
|
|
@@ -379,7 +394,12 @@ _Synchronized version release. See git history for details._
|
|
|
379
394
|
- npm access token stored in GitHub Secrets
|
|
380
395
|
- 2FA recommended for npm organization
|
|
381
396
|
|
|
382
|
-
[Unreleased]: https://github.com/codetalcott/hyperfixi/compare/v2.
|
|
397
|
+
[Unreleased]: https://github.com/codetalcott/hyperfixi/compare/v2.10.0...HEAD
|
|
398
|
+
[2.10.0]: https://github.com/codetalcott/hyperfixi/compare/v2.9.0...v2.10.0
|
|
399
|
+
[2.9.0]: https://github.com/codetalcott/hyperfixi/compare/v2.8.0...v2.9.0
|
|
400
|
+
[2.8.0]: https://github.com/codetalcott/hyperfixi/compare/v2.5.1...v2.8.0
|
|
401
|
+
[2.5.1]: https://github.com/codetalcott/hyperfixi/compare/v2.5.0...v2.5.1
|
|
402
|
+
[2.5.0]: https://github.com/codetalcott/hyperfixi/compare/v2.4.0...v2.5.0
|
|
383
403
|
[2.4.0]: https://github.com/codetalcott/hyperfixi/compare/v2.3.1...v2.4.0
|
|
384
404
|
[2.3.1]: https://github.com/codetalcott/hyperfixi/compare/v2.3.0...v2.3.1
|
|
385
405
|
[2.3.0]: https://github.com/codetalcott/hyperfixi/compare/v2.2.1...v2.3.0
|
package/README.md
CHANGED
|
@@ -112,21 +112,26 @@ The plugin resolves language in this order:
|
|
|
112
112
|
|
|
113
113
|
1. `data-lang` attribute on the element
|
|
114
114
|
2. `data-hyperscript-lang` on the element or closest ancestor
|
|
115
|
-
3.
|
|
116
|
-
|
|
115
|
+
3. `lang` attribute on the element or closest ancestor (the standard HTML
|
|
116
|
+
cascade — a `<section lang="es">` localizes everything inside it, and a
|
|
117
|
+
nested `lang="en"` opts back out)
|
|
118
|
+
4. `<html lang="...">` on the document (reached via step 3 for attached
|
|
119
|
+
elements; still applies to detached fragments)
|
|
120
|
+
5. `defaultLanguage` option (if configured)
|
|
117
121
|
|
|
118
122
|
English (`en`) and unresolved languages pass through without translation.
|
|
119
123
|
|
|
120
124
|
## Options
|
|
121
125
|
|
|
122
|
-
| Option | Type | Default | Description
|
|
123
|
-
| --------------------- | ---------------------------------- | ------------- |
|
|
124
|
-
| `defaultLanguage` | `string` | — | Default language for all elements
|
|
125
|
-
| `languageAttribute` | `string` | `"data-lang"` | Custom attribute name for per-element language
|
|
126
|
-
| `confidenceThreshold` | `number \| Record<string, number>` | `0.5` | Min confidence (0–1). Per-language map supported (see below).
|
|
127
|
-
| `strategy` | `'semantic' \| 'i18n' \| 'auto'` | `'semantic'` | Translation strategy
|
|
128
|
-
| `debug` | `boolean` | `false` | Log translations to console
|
|
129
|
-
| `i18nToEnglish` | `function` | — | Optional `@lokascript/i18n` `toEnglish` function for fallback
|
|
126
|
+
| Option | Type | Default | Description |
|
|
127
|
+
| --------------------- | ---------------------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------ |
|
|
128
|
+
| `defaultLanguage` | `string` | — | Default language for all elements |
|
|
129
|
+
| `languageAttribute` | `string` | `"data-lang"` | Custom attribute name for per-element language |
|
|
130
|
+
| `confidenceThreshold` | `number \| Record<string, number>` | `0.5` | Min confidence (0–1). Per-language map supported (see below). |
|
|
131
|
+
| `strategy` | `'semantic' \| 'i18n' \| 'auto'` | `'semantic'` | Translation strategy |
|
|
132
|
+
| `debug` | `boolean` | `false` | Log translations to console |
|
|
133
|
+
| `i18nToEnglish` | `function` | — | Optional `@lokascript/i18n` `toEnglish` function for fallback |
|
|
134
|
+
| `validateWithHost` | `boolean` | `true` | Check rendered English on the host parser; on rejection keep the original text (no-op on builds without `parse()`) |
|
|
130
135
|
|
|
131
136
|
### Per-language confidence thresholds
|
|
132
137
|
|
|
@@ -147,7 +152,7 @@ _hyperscript.use(
|
|
|
147
152
|
|
|
148
153
|
## How It Works
|
|
149
154
|
|
|
150
|
-
The plugin
|
|
155
|
+
The plugin registers an `addBeforeProcessHook` callback — \_hyperscript's supported public extension point, which fires before the runtime reads `_="..."` attributes (or `<script type="text/hyperscript">` bodies). Non-English input is rewritten to English in place via the `@lokascript/semantic` parser before the runtime's own scan reaches it, and the rendered English is checked on the host's own parser before it is committed (see `validateWithHost`). No \_hyperscript internals are patched. Requires a \_hyperscript build that exposes `addBeforeProcessHook` (0.9.9x era).
|
|
151
156
|
|
|
152
157
|
## Limitations
|
|
153
158
|
|