@hyperfixi/core 2.3.0 → 2.3.1
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/README.md +8 -11
- package/dist/bundle-generator/index.js +25 -4
- package/dist/bundle-generator/index.mjs +25 -4
- package/dist/chunks/{bridge-BlRqsZT4.js → bridge-Clbh_xAj.js} +2 -2
- package/dist/chunks/browser-modular-DIOxQqhV.js +2 -0
- package/dist/chunks/{index-BDYQHwCF.js → index-DcxoRUBe.js} +2 -2
- package/dist/commands/index.js +22 -3
- package/dist/commands/index.mjs +22 -3
- package/dist/hyperfixi-classic-i18n.js +1 -1
- package/dist/hyperfixi-hx.js +1 -1
- package/dist/hyperfixi-hybrid-complete.js +1 -1
- package/dist/hyperfixi-minimal.js +1 -1
- package/dist/hyperfixi-multilingual.js +1 -1
- package/dist/hyperfixi-standard.js +1 -1
- package/dist/hyperfixi.js +1 -1
- package/dist/hyperfixi.mjs +1 -1
- package/dist/index.js +22 -3
- package/dist/index.min.js +1 -1
- package/dist/index.mjs +22 -3
- package/dist/lokascript-browser-classic-i18n.js +1 -1
- package/dist/lokascript-browser-minimal.js +1 -1
- package/dist/lokascript-browser-standard.js +1 -1
- package/dist/lokascript-browser.js +1 -1
- package/dist/lokascript-hybrid-complete.js +1 -1
- package/dist/lokascript-hybrid-hx.js +1 -1
- package/dist/lokascript-multilingual.js +1 -1
- package/dist/parser/hybrid/index.js +7 -0
- package/dist/parser/hybrid/index.mjs +7 -0
- package/dist/parser/hybrid/parser-core.js +7 -0
- package/dist/parser/hybrid/parser-core.mjs +7 -0
- package/dist/parser/hybrid/tokenizer.js +7 -0
- package/dist/parser/hybrid/tokenizer.mjs +7 -0
- package/dist/parser/hybrid-parser.js +7 -0
- package/dist/parser/hybrid-parser.mjs +7 -0
- package/package.json +1 -1
- package/dist/chunks/browser-modular-AbV0Ql4i.js +0 -2
package/README.md
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
# @lokascript/core
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
An experimental hyperscript engine that provides fast parsing, command execution, and comprehensive error handling for web applications. Built with TypeScript-first design and full compatibility with the official \_hyperscript library.
|
|
3
|
+
An experimental hyperscript engine that provides fast parsing, command execution, and comprehensive error handling for web applications. Built with TypeScript-first design.
|
|
6
4
|
|
|
7
5
|
## Features
|
|
8
6
|
|
|
9
|
-
- 🎯
|
|
7
|
+
- 🎯 **\_hyperscript Compatible** - Tested via gallery examples, bundle compatibility matrix, and command/expression browser tests
|
|
10
8
|
- 🚀 **High Performance** - Optimized tokenizer and parser for large expressions
|
|
11
9
|
- 🔧 **TypeScript First** - Complete type safety with comprehensive type definitions
|
|
12
10
|
- 🧪 **Thoroughly Tested** - 2800+ tests with 98.5%+ reliability
|
|
@@ -170,7 +168,7 @@ For complete API documentation, see [API.md](./docs/API.md).
|
|
|
170
168
|
- **Async Operations**: `wait 500ms`, `fetch "/api/data"`
|
|
171
169
|
- **Events**: `send customEvent to me`
|
|
172
170
|
|
|
173
|
-
### Expressions
|
|
171
|
+
### Expressions
|
|
174
172
|
|
|
175
173
|
- **Arithmetic**: `5 + 3 * 2`, `value / 2`, `x mod 3`
|
|
176
174
|
- **Logical**: `true and false`, `value > 10`, `x contains y`
|
|
@@ -204,14 +202,13 @@ npx playwright test --grep "Command Tests"
|
|
|
204
202
|
npx playwright test --grep "Expression Tests"
|
|
205
203
|
```
|
|
206
204
|
|
|
207
|
-
|
|
205
|
+
Compatibility is validated via Playwright browser tests:
|
|
208
206
|
|
|
209
|
-
- **
|
|
210
|
-
- **
|
|
211
|
-
- **
|
|
212
|
-
- **Overall compatibility**: **~95%** across all hyperscript features ✅
|
|
207
|
+
- **Gallery examples** — real hyperscript patterns load and execute without errors
|
|
208
|
+
- **Bundle compatibility matrix** — each bundle size correctly supports its documented features
|
|
209
|
+
- **Command/expression tests** — individual commands and expressions verified in browser context
|
|
213
210
|
|
|
214
|
-
|
|
211
|
+
Run `cd packages/core && npx playwright test` for the full browser test suite.
|
|
215
212
|
|
|
216
213
|
## License
|
|
217
214
|
|
|
@@ -811,10 +811,31 @@ function evaluatePositional(node: ASTNode, ctx: Context): Element | null {
|
|
|
811
811
|
switch (node.position) {
|
|
812
812
|
case 'first': return elements[0] || null;
|
|
813
813
|
case 'last': return elements[elements.length - 1] || null;
|
|
814
|
-
case 'next':
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
814
|
+
case 'next': {
|
|
815
|
+
if (selector) {
|
|
816
|
+
let el = ctx.me.nextElementSibling;
|
|
817
|
+
while (el) { if (el.matches(selector)) return el; el = el.nextElementSibling; }
|
|
818
|
+
return null;
|
|
819
|
+
}
|
|
820
|
+
return ctx.me.nextElementSibling;
|
|
821
|
+
}
|
|
822
|
+
case 'previous': {
|
|
823
|
+
if (selector) {
|
|
824
|
+
let el = ctx.me.previousElementSibling;
|
|
825
|
+
while (el) { if (el.matches(selector)) return el; el = el.previousElementSibling; }
|
|
826
|
+
return null;
|
|
827
|
+
}
|
|
828
|
+
return ctx.me.previousElementSibling;
|
|
829
|
+
}
|
|
830
|
+
case 'closest': return selector ? ctx.me.closest(selector) : null;
|
|
831
|
+
case 'parent': {
|
|
832
|
+
if (selector) {
|
|
833
|
+
let el = ctx.me.parentElement;
|
|
834
|
+
while (el) { if (el.matches(selector)) return el; el = el.parentElement; }
|
|
835
|
+
return null;
|
|
836
|
+
}
|
|
837
|
+
return ctx.me.parentElement;
|
|
838
|
+
}
|
|
818
839
|
default: return elements[0] || null;
|
|
819
840
|
}
|
|
820
841
|
}
|
|
@@ -809,10 +809,31 @@ function evaluatePositional(node: ASTNode, ctx: Context): Element | null {
|
|
|
809
809
|
switch (node.position) {
|
|
810
810
|
case 'first': return elements[0] || null;
|
|
811
811
|
case 'last': return elements[elements.length - 1] || null;
|
|
812
|
-
case 'next':
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
812
|
+
case 'next': {
|
|
813
|
+
if (selector) {
|
|
814
|
+
let el = ctx.me.nextElementSibling;
|
|
815
|
+
while (el) { if (el.matches(selector)) return el; el = el.nextElementSibling; }
|
|
816
|
+
return null;
|
|
817
|
+
}
|
|
818
|
+
return ctx.me.nextElementSibling;
|
|
819
|
+
}
|
|
820
|
+
case 'previous': {
|
|
821
|
+
if (selector) {
|
|
822
|
+
let el = ctx.me.previousElementSibling;
|
|
823
|
+
while (el) { if (el.matches(selector)) return el; el = el.previousElementSibling; }
|
|
824
|
+
return null;
|
|
825
|
+
}
|
|
826
|
+
return ctx.me.previousElementSibling;
|
|
827
|
+
}
|
|
828
|
+
case 'closest': return selector ? ctx.me.closest(selector) : null;
|
|
829
|
+
case 'parent': {
|
|
830
|
+
if (selector) {
|
|
831
|
+
let el = ctx.me.parentElement;
|
|
832
|
+
while (el) { if (el.matches(selector)) return el; el = el.parentElement; }
|
|
833
|
+
return null;
|
|
834
|
+
}
|
|
835
|
+
return ctx.me.parentElement;
|
|
836
|
+
}
|
|
816
837
|
default: return elements[0] || null;
|
|
817
838
|
}
|
|
818
839
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{D as n}from"./browser-modular-
|
|
2
|
-
//# sourceMappingURL=bridge-
|
|
1
|
+
import{D as n}from"./browser-modular-DIOxQqhV.js";import"./feature-sockets-ClOH7vk7.js";let e=null;async function t(){return e||(e=await import("./browser-modular-DIOxQqhV.js").then(function(n){return n.o})),e}class a{constructor(e={}){this.analyzer=null,this.config={confidenceThreshold:e.confidenceThreshold??n,fallbackOnLowConfidence:e.fallbackOnLowConfidence??!0}}async initialize(){const n=await t();this.analyzer=n.createSemanticAnalyzer()}isInitialized(){return null!==this.analyzer}async transform(n,e,a){if(this.isInitialized()||await this.initialize(),e===a)return{output:n,usedSemantic:!1,confidence:1,sourceLang:e,targetLang:a};const i=await t();try{const t=i.translate(n,e,a);if(t!==n)return{output:t,usedSemantic:!0,confidence:.9,sourceLang:e,targetLang:a}}catch{}return{output:n,usedSemantic:!1,confidence:0,sourceLang:e,targetLang:a}}async parse(n,e){if(this.isInitialized()||await this.initialize(),!this.analyzer)return null;return this.analyzer.analyze(n,e).node??null}async render(n,e){return(await t()).render(n,e)}async parseToAST(n,e){if(this.isInitialized()||await this.initialize(),!this.analyzer)return null;const a=this.analyzer.analyze(n,e);if(a.confidence>=this.config.confidenceThreshold&&a.node){const n=await t();try{return n.buildAST(a.node).ast}catch(n){}}return null}async parseToASTWithDetails(n,e){if(this.isInitialized()||await this.initialize(),!this.analyzer)return{ast:null,usedDirectPath:!1,confidence:0,lang:e,fallbackText:null};const a=this.analyzer.analyze(n,e),i=await t();if(a.confidence>=this.config.confidenceThreshold&&a.node)try{const n=i.buildAST(a.node);return{ast:n.ast,usedDirectPath:!0,confidence:a.confidence,lang:e,fallbackText:null,warnings:n.warnings}}catch{}if(a.node&&this.config.fallbackOnLowConfidence){const n=i.render(a.node,"en");return{ast:null,usedDirectPath:!1,confidence:a.confidence,lang:e,fallbackText:n}}return{ast:null,usedDirectPath:!1,confidence:a.confidence,lang:e,fallbackText:null}}async getAllTranslations(n,e){const a=(await t()).getSupportedLanguages(),i={};for(const t of a)i[t]=await this.transform(n,e,t);return i}}export{a as SemanticGrammarBridge};
|
|
2
|
+
//# sourceMappingURL=bridge-Clbh_xAj.js.map
|