@hyperfixi/core 2.0.0 → 2.2.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/dist/api/hyperscript-api.d.ts +8 -1
- package/dist/ast-utils/index.d.ts +1 -1
- package/dist/ast-utils/index.js +11 -1
- package/dist/ast-utils/index.mjs +11 -1
- package/dist/ast-utils/interchange/index.d.ts +1 -1
- package/dist/ast-utils/interchange/lsp.d.ts +4 -1
- package/dist/behaviors/index.js +13 -5
- package/dist/behaviors/index.mjs +13 -5
- package/dist/bundle-generator/index.js +9 -0
- package/dist/bundle-generator/index.mjs +9 -0
- package/dist/chunks/{bridge-I6ceoWxV.js → bridge-D2DBo02Z.js} +2 -2
- package/dist/chunks/browser-modular-BA3JFmkq.js +2 -0
- package/dist/chunks/feature-eventsource-B5F2-H1r.js +2 -0
- package/dist/chunks/feature-sockets-ClOH7vk7.js +2 -0
- package/dist/chunks/feature-webworker-3bAp0ac9.js +2 -0
- package/dist/chunks/index-C6Fn0jGB.js +2 -0
- package/dist/commands/dom/toggle.d.ts +2 -0
- package/dist/commands/index.js +62 -6
- package/dist/commands/index.mjs +62 -6
- package/dist/debug/debug-controller.d.ts +62 -0
- package/dist/debug/index.d.ts +5 -0
- package/dist/expressions/index.js +16 -79
- package/dist/expressions/index.mjs +16 -79
- 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/i18n/error-catalog.d.ts +12 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +35334 -24306
- package/dist/index.min.js +1 -1
- package/dist/index.mjs +35333 -24307
- 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/lse/index.d.ts +15 -0
- package/dist/lse/index.js +84 -0
- package/dist/lse/index.mjs +71 -0
- package/dist/metadata.d.ts +4 -4
- package/dist/metadata.js +4 -4
- package/dist/metadata.mjs +4 -4
- package/dist/parser/full-parser.js +608 -271
- package/dist/parser/full-parser.mjs +608 -271
- package/dist/parser/helpers/ast-helpers.d.ts +1 -0
- package/dist/parser/hybrid/index.js +35 -2
- package/dist/parser/hybrid/index.mjs +35 -2
- package/dist/parser/hybrid/parser-core.d.ts +1 -0
- package/dist/parser/hybrid/parser-core.js +35 -2
- package/dist/parser/hybrid/parser-core.mjs +35 -2
- package/dist/parser/hybrid/tokenizer.js +5 -0
- package/dist/parser/hybrid/tokenizer.mjs +5 -0
- package/dist/parser/hybrid-parser.js +35 -2
- package/dist/parser/hybrid-parser.mjs +35 -2
- package/dist/parser/parser-types.d.ts +22 -7
- package/dist/parser/parser.d.ts +7 -0
- package/dist/parser/pratt-parser.d.ts +42 -0
- package/dist/parser/token-consumer.d.ts +1 -2
- package/dist/parser/tokenizer.d.ts +0 -33
- package/dist/registry/index.js +16 -79
- package/dist/registry/index.mjs +16 -79
- package/dist/runtime/runtime-base.d.ts +4 -0
- package/dist/types/base-types.d.ts +11 -0
- package/dist/types/core.d.ts +1 -0
- package/package.json +15 -6
- package/dist/chunks/browser-modular-Dv6PAV3c.js +0 -2
- package/dist/chunks/feature-eventsource-DWb514fy.js +0 -2
- package/dist/chunks/feature-sockets-3PFuvCVY.js +0 -2
- package/dist/chunks/feature-webworker-DTm_eh-E.js +0 -2
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Token } from '../types/core';
|
|
2
|
+
import type { ASTNode } from '../types/base-types';
|
|
3
|
+
export type BindingPower = [left: number, right: number];
|
|
4
|
+
export type PrefixHandler = (token: Token, ctx: PrattContext) => ASTNode;
|
|
5
|
+
export type InfixHandler = (left: ASTNode, token: Token, ctx: PrattContext) => ASTNode;
|
|
6
|
+
export interface BindingPowerEntry {
|
|
7
|
+
prefix?: {
|
|
8
|
+
bp: number;
|
|
9
|
+
handler: PrefixHandler;
|
|
10
|
+
};
|
|
11
|
+
infix?: {
|
|
12
|
+
bp: BindingPower;
|
|
13
|
+
handler: InfixHandler;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export type BindingPowerFragment = Map<string, BindingPowerEntry>;
|
|
17
|
+
export interface PrattContext {
|
|
18
|
+
peek(): Token | undefined;
|
|
19
|
+
advance(): Token;
|
|
20
|
+
parseExpr(minBp: number): ASTNode;
|
|
21
|
+
isStopToken(): boolean;
|
|
22
|
+
atEnd(): boolean;
|
|
23
|
+
}
|
|
24
|
+
export declare const STOP_TOKENS: Set<string>;
|
|
25
|
+
export declare const STOP_DELIMITERS: Set<string>;
|
|
26
|
+
export declare function mergeFragments(...fragments: BindingPowerFragment[]): BindingPowerFragment;
|
|
27
|
+
export declare function createPrattParser(table: BindingPowerFragment, parsePrimary: PrefixHandler): (tokens: Token[], pos: {
|
|
28
|
+
value: number;
|
|
29
|
+
}, minBp?: number) => ASTNode;
|
|
30
|
+
export declare function binaryHandler(left: ASTNode, token: Token, ctx: PrattContext): ASTNode;
|
|
31
|
+
export declare function unaryHandler(token: Token, ctx: PrattContext): ASTNode;
|
|
32
|
+
export declare function leftAssoc(bp: number, handler?: InfixHandler): Pick<BindingPowerEntry, 'infix'>;
|
|
33
|
+
export declare function rightAssoc(bp: number, handler?: InfixHandler): Pick<BindingPowerEntry, 'infix'>;
|
|
34
|
+
export declare function prefix(bp: number, handler?: PrefixHandler): Pick<BindingPowerEntry, 'prefix'>;
|
|
35
|
+
export declare const CORE_FRAGMENT: BindingPowerFragment;
|
|
36
|
+
export declare const POSITIONAL_FRAGMENT: BindingPowerFragment;
|
|
37
|
+
export declare const PROPERTY_FRAGMENT: BindingPowerFragment;
|
|
38
|
+
export declare const PARSER_COMPARISON_FRAGMENT: BindingPowerFragment;
|
|
39
|
+
export declare const ASSIGNMENT_FRAGMENT: BindingPowerFragment;
|
|
40
|
+
export declare const FULL_TABLE: BindingPowerFragment;
|
|
41
|
+
export declare const PARSER_TABLE: BindingPowerFragment;
|
|
42
|
+
//# sourceMappingURL=pratt-parser.d.ts.map
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { ASTNode, Token } from '../types/core';
|
|
2
|
-
import type { TokenType } from './tokenizer';
|
|
3
2
|
export interface ParserInterface {
|
|
4
3
|
isAtEnd(): boolean;
|
|
5
4
|
check(value: string): boolean;
|
|
6
|
-
checkTokenType(type:
|
|
5
|
+
checkTokenType(type: string): boolean;
|
|
7
6
|
advance(): Token;
|
|
8
7
|
peek(): Token;
|
|
9
8
|
parsePrimary(): ASTNode;
|
|
@@ -12,39 +12,6 @@ export declare enum TokenKind {
|
|
|
12
12
|
SYMBOL = "symbol",
|
|
13
13
|
UNKNOWN = "unknown"
|
|
14
14
|
}
|
|
15
|
-
export declare function getTokenKind(tokenType: TokenType): TokenKind;
|
|
16
|
-
export declare enum TokenType {
|
|
17
|
-
KEYWORD = "keyword",
|
|
18
|
-
COMMAND = "command",
|
|
19
|
-
EXPRESSION = "expression",
|
|
20
|
-
STRING = "string",
|
|
21
|
-
NUMBER = "number",
|
|
22
|
-
BOOLEAN = "boolean",
|
|
23
|
-
TEMPLATE_LITERAL = "template_literal",
|
|
24
|
-
CSS_SELECTOR = "css_selector",
|
|
25
|
-
ID_SELECTOR = "id_selector",
|
|
26
|
-
CLASS_SELECTOR = "class_selector",
|
|
27
|
-
QUERY_REFERENCE = "query_reference",
|
|
28
|
-
CONTEXT_VAR = "context_var",
|
|
29
|
-
GLOBAL_VAR = "global_var",
|
|
30
|
-
EVENT = "event",
|
|
31
|
-
OPERATOR = "operator",
|
|
32
|
-
LOGICAL_OPERATOR = "logical_operator",
|
|
33
|
-
COMPARISON_OPERATOR = "comparison_operator",
|
|
34
|
-
TIME_EXPRESSION = "time_expression",
|
|
35
|
-
OBJECT_LITERAL = "object_literal",
|
|
36
|
-
ARRAY_LITERAL = "array_literal",
|
|
37
|
-
SYMBOL = "symbol",
|
|
38
|
-
COMMENT = "comment",
|
|
39
|
-
IDENTIFIER = "identifier",
|
|
40
|
-
UNKNOWN = "unknown"
|
|
41
|
-
}
|
|
42
|
-
export declare function enableDeferredClassification(): void;
|
|
43
|
-
export declare function disableDeferredClassification(): void;
|
|
44
|
-
export declare function isDeferredClassificationEnabled(): boolean;
|
|
45
|
-
export declare function enableDualOutput(): void;
|
|
46
|
-
export declare function disableDualOutput(): void;
|
|
47
|
-
export declare function isDualOutputEnabled(): boolean;
|
|
48
15
|
export interface Tokenizer {
|
|
49
16
|
input: string;
|
|
50
17
|
position: number;
|
package/dist/registry/index.js
CHANGED
|
@@ -767,8 +767,9 @@ const SPECIAL_DOM_PROPERTIES = {
|
|
|
767
767
|
outerhtml: el => el.outerHTML,
|
|
768
768
|
value: el => (isFormElement(el) ? el.value : undefined),
|
|
769
769
|
checked: el => (isInputElement(el) ? el.checked : undefined),
|
|
770
|
-
disabled: el => (
|
|
770
|
+
disabled: el => ('disabled' in el ? el.disabled : undefined),
|
|
771
771
|
selected: el => (isOptionElement(el) ? el.selected : undefined),
|
|
772
|
+
tabindex: el => (isHTMLElement$1(el) ? el.tabIndex : undefined),
|
|
772
773
|
hidden: el => (isHTMLElement$1(el) ? el.hidden : undefined),
|
|
773
774
|
style: el => getComputedStyle(el),
|
|
774
775
|
children: el => Array.from(el.children),
|
|
@@ -777,7 +778,19 @@ const SPECIAL_DOM_PROPERTIES = {
|
|
|
777
778
|
lastchild: el => el.lastElementChild,
|
|
778
779
|
nextsibling: el => el.nextElementSibling,
|
|
779
780
|
previoussibling: el => el.previousElementSibling,
|
|
781
|
+
values: el => collectFormValues(el),
|
|
780
782
|
};
|
|
783
|
+
function collectFormValues(el) {
|
|
784
|
+
if (el instanceof HTMLFormElement)
|
|
785
|
+
return new FormData(el);
|
|
786
|
+
const fd = new FormData();
|
|
787
|
+
el.querySelectorAll('input, select, textarea').forEach((input) => {
|
|
788
|
+
const name = input.getAttribute('name');
|
|
789
|
+
if (name && 'value' in input)
|
|
790
|
+
fd.append(name, input.value);
|
|
791
|
+
});
|
|
792
|
+
return fd;
|
|
793
|
+
}
|
|
781
794
|
function getElementProperty(element, property) {
|
|
782
795
|
if (property.startsWith('computed-')) {
|
|
783
796
|
const cssProperty = property.slice('computed-'.length);
|
|
@@ -3579,33 +3592,6 @@ var TokenKind;
|
|
|
3579
3592
|
TokenKind["SYMBOL"] = "symbol";
|
|
3580
3593
|
TokenKind["UNKNOWN"] = "unknown";
|
|
3581
3594
|
})(TokenKind || (TokenKind = {}));
|
|
3582
|
-
var TokenType;
|
|
3583
|
-
(function (TokenType) {
|
|
3584
|
-
TokenType["KEYWORD"] = "keyword";
|
|
3585
|
-
TokenType["COMMAND"] = "command";
|
|
3586
|
-
TokenType["EXPRESSION"] = "expression";
|
|
3587
|
-
TokenType["STRING"] = "string";
|
|
3588
|
-
TokenType["NUMBER"] = "number";
|
|
3589
|
-
TokenType["BOOLEAN"] = "boolean";
|
|
3590
|
-
TokenType["TEMPLATE_LITERAL"] = "template_literal";
|
|
3591
|
-
TokenType["CSS_SELECTOR"] = "css_selector";
|
|
3592
|
-
TokenType["ID_SELECTOR"] = "id_selector";
|
|
3593
|
-
TokenType["CLASS_SELECTOR"] = "class_selector";
|
|
3594
|
-
TokenType["QUERY_REFERENCE"] = "query_reference";
|
|
3595
|
-
TokenType["CONTEXT_VAR"] = "context_var";
|
|
3596
|
-
TokenType["GLOBAL_VAR"] = "global_var";
|
|
3597
|
-
TokenType["EVENT"] = "event";
|
|
3598
|
-
TokenType["OPERATOR"] = "operator";
|
|
3599
|
-
TokenType["LOGICAL_OPERATOR"] = "logical_operator";
|
|
3600
|
-
TokenType["COMPARISON_OPERATOR"] = "comparison_operator";
|
|
3601
|
-
TokenType["TIME_EXPRESSION"] = "time_expression";
|
|
3602
|
-
TokenType["OBJECT_LITERAL"] = "object_literal";
|
|
3603
|
-
TokenType["ARRAY_LITERAL"] = "array_literal";
|
|
3604
|
-
TokenType["SYMBOL"] = "symbol";
|
|
3605
|
-
TokenType["COMMENT"] = "comment";
|
|
3606
|
-
TokenType["IDENTIFIER"] = "identifier";
|
|
3607
|
-
TokenType["UNKNOWN"] = "unknown";
|
|
3608
|
-
})(TokenType || (TokenType = {}));
|
|
3609
3595
|
|
|
3610
3596
|
class PerformanceTracker {
|
|
3611
3597
|
constructor() {
|
|
@@ -5027,7 +5013,7 @@ const enhancedConverters = {
|
|
|
5027
5013
|
Values: (value, _context) => {
|
|
5028
5014
|
try {
|
|
5029
5015
|
if (value instanceof HTMLFormElement) {
|
|
5030
|
-
return success(
|
|
5016
|
+
return success(getFormValuesProcessed(value), 'object');
|
|
5031
5017
|
}
|
|
5032
5018
|
if (value instanceof HTMLElement) {
|
|
5033
5019
|
const inputs = value.querySelectorAll('input, select, textarea');
|
|
@@ -5035,7 +5021,7 @@ const enhancedConverters = {
|
|
|
5035
5021
|
inputs.forEach((input) => {
|
|
5036
5022
|
const htmlInput = input;
|
|
5037
5023
|
if (htmlInput.name) {
|
|
5038
|
-
const inputValue =
|
|
5024
|
+
const inputValue = getInputValue(htmlInput);
|
|
5039
5025
|
if (inputValue !== undefined) {
|
|
5040
5026
|
values[htmlInput.name] = inputValue;
|
|
5041
5027
|
}
|
|
@@ -5490,55 +5476,6 @@ class IsExpression extends BaseExpressionImpl {
|
|
|
5490
5476
|
}
|
|
5491
5477
|
}
|
|
5492
5478
|
}
|
|
5493
|
-
function extractFormValues(form) {
|
|
5494
|
-
const values = {};
|
|
5495
|
-
const elements = form.querySelectorAll('input, select, textarea');
|
|
5496
|
-
elements.forEach(element => {
|
|
5497
|
-
const input = element;
|
|
5498
|
-
if (input.name) {
|
|
5499
|
-
const value = extractInputValue(input);
|
|
5500
|
-
if (value !== undefined) {
|
|
5501
|
-
if (values[input.name] !== undefined) {
|
|
5502
|
-
if (!Array.isArray(values[input.name])) {
|
|
5503
|
-
values[input.name] = [values[input.name]];
|
|
5504
|
-
}
|
|
5505
|
-
values[input.name].push(value);
|
|
5506
|
-
}
|
|
5507
|
-
else {
|
|
5508
|
-
values[input.name] = value;
|
|
5509
|
-
}
|
|
5510
|
-
}
|
|
5511
|
-
}
|
|
5512
|
-
});
|
|
5513
|
-
return values;
|
|
5514
|
-
}
|
|
5515
|
-
function extractInputValue(input) {
|
|
5516
|
-
if (input instanceof HTMLInputElement) {
|
|
5517
|
-
switch (input.type) {
|
|
5518
|
-
case 'checkbox':
|
|
5519
|
-
return input.checked;
|
|
5520
|
-
case 'radio':
|
|
5521
|
-
return input.checked ? input.value : undefined;
|
|
5522
|
-
case 'number':
|
|
5523
|
-
case 'range':
|
|
5524
|
-
return input.valueAsNumber;
|
|
5525
|
-
case 'date':
|
|
5526
|
-
case 'datetime-local':
|
|
5527
|
-
return input.valueAsDate;
|
|
5528
|
-
case 'file':
|
|
5529
|
-
return input.files;
|
|
5530
|
-
default:
|
|
5531
|
-
return input.value;
|
|
5532
|
-
}
|
|
5533
|
-
}
|
|
5534
|
-
if (input instanceof HTMLSelectElement) {
|
|
5535
|
-
if (input.multiple) {
|
|
5536
|
-
return Array.from(input.selectedOptions).map(option => option.value);
|
|
5537
|
-
}
|
|
5538
|
-
return input.value;
|
|
5539
|
-
}
|
|
5540
|
-
return input.value;
|
|
5541
|
-
}
|
|
5542
5479
|
({
|
|
5543
5480
|
as: new AsExpression(),
|
|
5544
5481
|
is: new IsExpression(),
|
package/dist/registry/index.mjs
CHANGED
|
@@ -765,8 +765,9 @@ const SPECIAL_DOM_PROPERTIES = {
|
|
|
765
765
|
outerhtml: el => el.outerHTML,
|
|
766
766
|
value: el => (isFormElement(el) ? el.value : undefined),
|
|
767
767
|
checked: el => (isInputElement(el) ? el.checked : undefined),
|
|
768
|
-
disabled: el => (
|
|
768
|
+
disabled: el => ('disabled' in el ? el.disabled : undefined),
|
|
769
769
|
selected: el => (isOptionElement(el) ? el.selected : undefined),
|
|
770
|
+
tabindex: el => (isHTMLElement$1(el) ? el.tabIndex : undefined),
|
|
770
771
|
hidden: el => (isHTMLElement$1(el) ? el.hidden : undefined),
|
|
771
772
|
style: el => getComputedStyle(el),
|
|
772
773
|
children: el => Array.from(el.children),
|
|
@@ -775,7 +776,19 @@ const SPECIAL_DOM_PROPERTIES = {
|
|
|
775
776
|
lastchild: el => el.lastElementChild,
|
|
776
777
|
nextsibling: el => el.nextElementSibling,
|
|
777
778
|
previoussibling: el => el.previousElementSibling,
|
|
779
|
+
values: el => collectFormValues(el),
|
|
778
780
|
};
|
|
781
|
+
function collectFormValues(el) {
|
|
782
|
+
if (el instanceof HTMLFormElement)
|
|
783
|
+
return new FormData(el);
|
|
784
|
+
const fd = new FormData();
|
|
785
|
+
el.querySelectorAll('input, select, textarea').forEach((input) => {
|
|
786
|
+
const name = input.getAttribute('name');
|
|
787
|
+
if (name && 'value' in input)
|
|
788
|
+
fd.append(name, input.value);
|
|
789
|
+
});
|
|
790
|
+
return fd;
|
|
791
|
+
}
|
|
779
792
|
function getElementProperty(element, property) {
|
|
780
793
|
if (property.startsWith('computed-')) {
|
|
781
794
|
const cssProperty = property.slice('computed-'.length);
|
|
@@ -3577,33 +3590,6 @@ var TokenKind;
|
|
|
3577
3590
|
TokenKind["SYMBOL"] = "symbol";
|
|
3578
3591
|
TokenKind["UNKNOWN"] = "unknown";
|
|
3579
3592
|
})(TokenKind || (TokenKind = {}));
|
|
3580
|
-
var TokenType;
|
|
3581
|
-
(function (TokenType) {
|
|
3582
|
-
TokenType["KEYWORD"] = "keyword";
|
|
3583
|
-
TokenType["COMMAND"] = "command";
|
|
3584
|
-
TokenType["EXPRESSION"] = "expression";
|
|
3585
|
-
TokenType["STRING"] = "string";
|
|
3586
|
-
TokenType["NUMBER"] = "number";
|
|
3587
|
-
TokenType["BOOLEAN"] = "boolean";
|
|
3588
|
-
TokenType["TEMPLATE_LITERAL"] = "template_literal";
|
|
3589
|
-
TokenType["CSS_SELECTOR"] = "css_selector";
|
|
3590
|
-
TokenType["ID_SELECTOR"] = "id_selector";
|
|
3591
|
-
TokenType["CLASS_SELECTOR"] = "class_selector";
|
|
3592
|
-
TokenType["QUERY_REFERENCE"] = "query_reference";
|
|
3593
|
-
TokenType["CONTEXT_VAR"] = "context_var";
|
|
3594
|
-
TokenType["GLOBAL_VAR"] = "global_var";
|
|
3595
|
-
TokenType["EVENT"] = "event";
|
|
3596
|
-
TokenType["OPERATOR"] = "operator";
|
|
3597
|
-
TokenType["LOGICAL_OPERATOR"] = "logical_operator";
|
|
3598
|
-
TokenType["COMPARISON_OPERATOR"] = "comparison_operator";
|
|
3599
|
-
TokenType["TIME_EXPRESSION"] = "time_expression";
|
|
3600
|
-
TokenType["OBJECT_LITERAL"] = "object_literal";
|
|
3601
|
-
TokenType["ARRAY_LITERAL"] = "array_literal";
|
|
3602
|
-
TokenType["SYMBOL"] = "symbol";
|
|
3603
|
-
TokenType["COMMENT"] = "comment";
|
|
3604
|
-
TokenType["IDENTIFIER"] = "identifier";
|
|
3605
|
-
TokenType["UNKNOWN"] = "unknown";
|
|
3606
|
-
})(TokenType || (TokenType = {}));
|
|
3607
3593
|
|
|
3608
3594
|
class PerformanceTracker {
|
|
3609
3595
|
constructor() {
|
|
@@ -5025,7 +5011,7 @@ const enhancedConverters = {
|
|
|
5025
5011
|
Values: (value, _context) => {
|
|
5026
5012
|
try {
|
|
5027
5013
|
if (value instanceof HTMLFormElement) {
|
|
5028
|
-
return success(
|
|
5014
|
+
return success(getFormValuesProcessed(value), 'object');
|
|
5029
5015
|
}
|
|
5030
5016
|
if (value instanceof HTMLElement) {
|
|
5031
5017
|
const inputs = value.querySelectorAll('input, select, textarea');
|
|
@@ -5033,7 +5019,7 @@ const enhancedConverters = {
|
|
|
5033
5019
|
inputs.forEach((input) => {
|
|
5034
5020
|
const htmlInput = input;
|
|
5035
5021
|
if (htmlInput.name) {
|
|
5036
|
-
const inputValue =
|
|
5022
|
+
const inputValue = getInputValue(htmlInput);
|
|
5037
5023
|
if (inputValue !== undefined) {
|
|
5038
5024
|
values[htmlInput.name] = inputValue;
|
|
5039
5025
|
}
|
|
@@ -5488,55 +5474,6 @@ class IsExpression extends BaseExpressionImpl {
|
|
|
5488
5474
|
}
|
|
5489
5475
|
}
|
|
5490
5476
|
}
|
|
5491
|
-
function extractFormValues(form) {
|
|
5492
|
-
const values = {};
|
|
5493
|
-
const elements = form.querySelectorAll('input, select, textarea');
|
|
5494
|
-
elements.forEach(element => {
|
|
5495
|
-
const input = element;
|
|
5496
|
-
if (input.name) {
|
|
5497
|
-
const value = extractInputValue(input);
|
|
5498
|
-
if (value !== undefined) {
|
|
5499
|
-
if (values[input.name] !== undefined) {
|
|
5500
|
-
if (!Array.isArray(values[input.name])) {
|
|
5501
|
-
values[input.name] = [values[input.name]];
|
|
5502
|
-
}
|
|
5503
|
-
values[input.name].push(value);
|
|
5504
|
-
}
|
|
5505
|
-
else {
|
|
5506
|
-
values[input.name] = value;
|
|
5507
|
-
}
|
|
5508
|
-
}
|
|
5509
|
-
}
|
|
5510
|
-
});
|
|
5511
|
-
return values;
|
|
5512
|
-
}
|
|
5513
|
-
function extractInputValue(input) {
|
|
5514
|
-
if (input instanceof HTMLInputElement) {
|
|
5515
|
-
switch (input.type) {
|
|
5516
|
-
case 'checkbox':
|
|
5517
|
-
return input.checked;
|
|
5518
|
-
case 'radio':
|
|
5519
|
-
return input.checked ? input.value : undefined;
|
|
5520
|
-
case 'number':
|
|
5521
|
-
case 'range':
|
|
5522
|
-
return input.valueAsNumber;
|
|
5523
|
-
case 'date':
|
|
5524
|
-
case 'datetime-local':
|
|
5525
|
-
return input.valueAsDate;
|
|
5526
|
-
case 'file':
|
|
5527
|
-
return input.files;
|
|
5528
|
-
default:
|
|
5529
|
-
return input.value;
|
|
5530
|
-
}
|
|
5531
|
-
}
|
|
5532
|
-
if (input instanceof HTMLSelectElement) {
|
|
5533
|
-
if (input.multiple) {
|
|
5534
|
-
return Array.from(input.selectedOptions).map(option => option.value);
|
|
5535
|
-
}
|
|
5536
|
-
return input.value;
|
|
5537
|
-
}
|
|
5538
|
-
return input.value;
|
|
5539
|
-
}
|
|
5540
5477
|
({
|
|
5541
5478
|
as: new AsExpression(),
|
|
5542
5479
|
is: new IsExpression(),
|
|
@@ -30,6 +30,7 @@ export declare class RuntimeBase {
|
|
|
30
30
|
protected cleanupRegistry: CleanupRegistry;
|
|
31
31
|
private autoCleanupObserver;
|
|
32
32
|
protected registryIntegration: RegistryIntegration | null;
|
|
33
|
+
protected runtimeWarnings: string[];
|
|
33
34
|
constructor(options: RuntimeBaseOptions);
|
|
34
35
|
private setupAutoCleanup;
|
|
35
36
|
registerHooks(name: string, hooks: RuntimeHooks): void;
|
|
@@ -39,6 +40,8 @@ export declare class RuntimeBase {
|
|
|
39
40
|
cleanupTree(element: Element): number;
|
|
40
41
|
getCleanupStats(): ReturnType<CleanupRegistry['getStats']>;
|
|
41
42
|
destroy(): void;
|
|
43
|
+
private hasErrorDiagnostics;
|
|
44
|
+
getWarnings(): readonly string[];
|
|
42
45
|
execute(node: ASTNode, context: ExecutionContext): Promise<unknown>;
|
|
43
46
|
protected processCommand(node: CommandNode, context: ExecutionContext): Promise<unknown>;
|
|
44
47
|
protected toSignal(error: unknown): ExecutionSignal | null;
|
|
@@ -66,6 +69,7 @@ export declare class RuntimeBase {
|
|
|
66
69
|
parameters?: string[];
|
|
67
70
|
eventHandlers?: EventHandlerNode[];
|
|
68
71
|
initBlock?: ASTNode;
|
|
72
|
+
imperativeInstaller?: (element: HTMLElement, parameters: Record<string, any>) => void;
|
|
69
73
|
}, _context: ExecutionContext): Promise<void>;
|
|
70
74
|
protected installBehaviorOnElement(behaviorName: string, element: HTMLElement, parameters: Record<string, any>): Promise<void>;
|
|
71
75
|
protected executeEventHandler(node: EventHandlerNode, context: ExecutionContext): Promise<void>;
|
|
@@ -86,6 +86,16 @@ export interface ParseError {
|
|
|
86
86
|
readonly position?: number;
|
|
87
87
|
readonly source?: string;
|
|
88
88
|
}
|
|
89
|
+
export type ParseDiagnosticSeverity = 'error' | 'warning' | 'info';
|
|
90
|
+
export interface ParseDiagnostic {
|
|
91
|
+
readonly message: string;
|
|
92
|
+
readonly severity: ParseDiagnosticSeverity;
|
|
93
|
+
readonly code?: string;
|
|
94
|
+
readonly line?: number;
|
|
95
|
+
readonly column?: number;
|
|
96
|
+
readonly source?: string;
|
|
97
|
+
readonly suggestions?: readonly string[];
|
|
98
|
+
}
|
|
89
99
|
export interface ASTNode {
|
|
90
100
|
readonly type: string;
|
|
91
101
|
readonly line?: number;
|
|
@@ -93,6 +103,7 @@ export interface ASTNode {
|
|
|
93
103
|
readonly start?: number;
|
|
94
104
|
readonly end?: number;
|
|
95
105
|
readonly raw?: string;
|
|
106
|
+
readonly diagnostics?: readonly ParseDiagnostic[];
|
|
96
107
|
[key: string]: unknown;
|
|
97
108
|
}
|
|
98
109
|
export interface EnhancedError {
|
package/dist/types/core.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperfixi/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Multilingual, tree-shakeable hyperscript",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -143,6 +143,11 @@
|
|
|
143
143
|
"types": "./dist/ast-utils/index.d.ts",
|
|
144
144
|
"import": "./dist/ast-utils/index.mjs",
|
|
145
145
|
"require": "./dist/ast-utils/index.js"
|
|
146
|
+
},
|
|
147
|
+
"./lse": {
|
|
148
|
+
"types": "./dist/lse/index.d.ts",
|
|
149
|
+
"import": "./dist/lse/index.mjs",
|
|
150
|
+
"require": "./dist/lse/index.js"
|
|
146
151
|
}
|
|
147
152
|
},
|
|
148
153
|
"files": [
|
|
@@ -224,14 +229,14 @@
|
|
|
224
229
|
"@rollup/plugin-commonjs": "^28.0.9",
|
|
225
230
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
226
231
|
"@rollup/plugin-replace": "^6.0.3",
|
|
227
|
-
"@rollup/plugin-terser": "^0.
|
|
232
|
+
"@rollup/plugin-terser": "^1.0.0",
|
|
228
233
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
229
234
|
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
|
230
235
|
"@typescript-eslint/parser": "^6.21.0",
|
|
231
236
|
"@vitest/coverage-v8": "^4.0.17",
|
|
232
237
|
"@vitest/ui": "^4.0.17",
|
|
233
238
|
"better-sqlite3": "^12.6.2",
|
|
234
|
-
"esbuild": "0.
|
|
239
|
+
"esbuild": "0.27.3",
|
|
235
240
|
"eslint": "^8.57.1",
|
|
236
241
|
"eslint-config-prettier": "^9.0.0",
|
|
237
242
|
"eslint-plugin-prettier": "^5.0.0",
|
|
@@ -240,7 +245,7 @@
|
|
|
240
245
|
"jsdom": "^26.1.0",
|
|
241
246
|
"prettier": "^3.0.0",
|
|
242
247
|
"rollup": "^4.28.1",
|
|
243
|
-
"rollup-plugin-visualizer": "^
|
|
248
|
+
"rollup-plugin-visualizer": "^7.0.0",
|
|
244
249
|
"tsx": "^4.0.0",
|
|
245
250
|
"typescript": "^5.8.3",
|
|
246
251
|
"vite": "^7.1.12",
|
|
@@ -279,10 +284,14 @@
|
|
|
279
284
|
"tslib": "^2.8.1"
|
|
280
285
|
},
|
|
281
286
|
"peerDependencies": {
|
|
282
|
-
"@
|
|
287
|
+
"@hyperfixi/patterns-reference": "*",
|
|
288
|
+
"@lokascript/framework": "*"
|
|
283
289
|
},
|
|
284
290
|
"peerDependenciesMeta": {
|
|
285
|
-
"@
|
|
291
|
+
"@hyperfixi/patterns-reference": {
|
|
292
|
+
"optional": true
|
|
293
|
+
},
|
|
294
|
+
"@lokascript/framework": {
|
|
286
295
|
"optional": true
|
|
287
296
|
}
|
|
288
297
|
},
|