@hyperfixi/core 3.0.0 → 3.1.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 +2 -0
- package/dist/ast-utils/{index.js → index.cjs} +1 -1
- package/dist/behaviors/{index.js → index.cjs} +1 -1
- package/dist/bundle-generator/{index.js → index.cjs} +1 -1
- package/dist/chunks/bridge-DylVo1oZ.js +2 -0
- package/dist/chunks/browser-modular-sLPMdxR7.js +2 -0
- package/dist/chunks/index-C7lqD4mo.js +2 -0
- package/dist/commands/{index.js → index.cjs} +39 -1
- package/dist/commands/index.mjs +38 -0
- package/dist/dom/attribute-processor.d.ts +35 -1
- package/dist/dom/detect-language.d.ts +3 -0
- package/dist/expressions/{index.js → index.cjs} +1 -1
- package/dist/hyperfixi-browser-classic-i18n.js +1 -1
- package/dist/hyperfixi-browser.js +1 -1
- package/dist/hyperfixi-classic-i18n.js +1 -1
- package/dist/hyperfixi-hx-v4.js +1 -1
- package/dist/hyperfixi-multilingual.js +1 -1
- package/dist/hyperfixi.js +1 -1
- package/dist/hyperfixi.mjs +1 -1
- package/dist/index.cjs +28495 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.min.js +1 -1
- package/dist/index.mjs +630 -57829
- package/dist/lokascript-browser-classic-i18n.js +1 -1
- package/dist/lokascript-browser.js +1 -1
- package/dist/lokascript-multilingual.js +1 -1
- package/dist/lse/{index.js → index.cjs} +1 -1
- package/dist/{lsp-metadata.js → lsp-metadata.cjs} +1 -1
- package/dist/{metadata.js → metadata.cjs} +2 -2
- package/dist/metadata.d.ts +1 -1
- package/dist/metadata.mjs +1 -1
- package/dist/multilingual/bridge.d.ts +2 -0
- package/dist/multilingual/{index.js → index.cjs} +3 -105
- package/dist/multilingual/index.mjs +1 -103
- package/dist/parser/{full-parser.js → full-parser.cjs} +39 -1
- package/dist/parser/full-parser.mjs +38 -0
- package/dist/parser/hybrid/{aliases.js → aliases.cjs} +1 -1
- package/dist/parser/hybrid/ast-types.cjs +3 -0
- package/dist/parser/hybrid/{index.js → index.cjs} +1 -1
- package/dist/parser/hybrid/{parser-core.js → parser-core.cjs} +1 -1
- package/dist/parser/hybrid/{tokenizer.js → tokenizer.cjs} +1 -1
- package/dist/parser/{hybrid-parser.js → hybrid-parser.cjs} +1 -1
- package/dist/parser/{regex-parser.js → regex-parser.cjs} +1 -1
- package/dist/parser/semantic-integration.d.ts +15 -0
- package/dist/reference/{index.js → index.cjs} +1 -1
- package/dist/registry/{browser-types.js → browser-types.cjs} +1 -1
- package/dist/registry/{environment.js → environment.cjs} +1 -1
- package/dist/registry/{index.js → index.cjs} +39 -1
- package/dist/registry/index.mjs +38 -0
- package/dist/registry/{universal-types.js → universal-types.cjs} +1 -1
- package/dist/runtime/runtime-base.d.ts +1 -0
- package/dist/runtime/runtime.d.ts +1 -0
- package/dist/version.d.ts +1 -1
- package/package.json +28 -28
- package/dist/api/dom-processor.d.ts +0 -21
- package/dist/chunks/bridge-8SRzBI2K.js +0 -2
- package/dist/chunks/browser-modular-L1qgqF_N.js +0 -2
- package/dist/chunks/index-SorDzXmq.js +0 -2
- package/dist/index.js +0 -85694
- package/dist/parser/hybrid/ast-types.js +0 -3
|
@@ -9668,6 +9668,9 @@ function parseSetCommand(ctx, identifierNode) {
|
|
|
9668
9668
|
targetExpression = fallback.expression;
|
|
9669
9669
|
fallbackTokens = fallback.tokens;
|
|
9670
9670
|
}
|
|
9671
|
+
if (targetExpression) {
|
|
9672
|
+
targetExpression = retypeStylePropertyTarget(targetExpression);
|
|
9673
|
+
}
|
|
9671
9674
|
if (!ctx.check(KEYWORDS.TO)) {
|
|
9672
9675
|
const found = ctx.isAtEnd() ? 'end of input' : ctx.peek().value;
|
|
9673
9676
|
throw new Error(`Expected 'to' in set command, found: ${found}`);
|
|
@@ -9695,6 +9698,41 @@ function parseSetCommand(ctx, identifierNode) {
|
|
|
9695
9698
|
}
|
|
9696
9699
|
return builder.endingAt(ctx.getPosition()).build();
|
|
9697
9700
|
}
|
|
9701
|
+
function retypeStylePropertyTarget(target) {
|
|
9702
|
+
const asStyleIdentifier = (node) => {
|
|
9703
|
+
if (!node || node.type !== 'selector')
|
|
9704
|
+
return null;
|
|
9705
|
+
const value = node.value;
|
|
9706
|
+
if (typeof value !== 'string' || !value.startsWith('*'))
|
|
9707
|
+
return null;
|
|
9708
|
+
return createIdentifier(value, {
|
|
9709
|
+
start: node.start ?? 0,
|
|
9710
|
+
end: node.end ?? 0,
|
|
9711
|
+
line: node.line ?? 1,
|
|
9712
|
+
column: node.column ?? 1,
|
|
9713
|
+
});
|
|
9714
|
+
};
|
|
9715
|
+
const pos = {
|
|
9716
|
+
start: target.start ?? 0,
|
|
9717
|
+
end: target.end ?? 0,
|
|
9718
|
+
line: target.line ?? 1,
|
|
9719
|
+
column: target.column ?? 1,
|
|
9720
|
+
};
|
|
9721
|
+
const bare = asStyleIdentifier(target);
|
|
9722
|
+
if (bare)
|
|
9723
|
+
return bare;
|
|
9724
|
+
if (target.type === 'binaryExpression' && target.operator === KEYWORDS.OF) {
|
|
9725
|
+
const property = asStyleIdentifier(target.left);
|
|
9726
|
+
if (property)
|
|
9727
|
+
return createPropertyOfExpression(property, target.right, pos);
|
|
9728
|
+
}
|
|
9729
|
+
if (target.type === 'propertyOfExpression') {
|
|
9730
|
+
const property = asStyleIdentifier(target.property);
|
|
9731
|
+
if (property)
|
|
9732
|
+
return createPropertyOfExpression(property, target.target, pos);
|
|
9733
|
+
}
|
|
9734
|
+
return target;
|
|
9735
|
+
}
|
|
9698
9736
|
function tokenLooksLikeElementTarget(token) {
|
|
9699
9737
|
if (!token)
|
|
9700
9738
|
return false;
|
|
@@ -23614,4 +23652,4 @@ exports.transition = createTransitionCommand;
|
|
|
23614
23652
|
exports.trigger = createTriggerCommand;
|
|
23615
23653
|
exports.unless = createUnlessCommand;
|
|
23616
23654
|
exports.wait = createWaitCommand;
|
|
23617
|
-
//# sourceMappingURL=index.
|
|
23655
|
+
//# sourceMappingURL=index.cjs.map
|
package/dist/commands/index.mjs
CHANGED
|
@@ -9666,6 +9666,9 @@ function parseSetCommand(ctx, identifierNode) {
|
|
|
9666
9666
|
targetExpression = fallback.expression;
|
|
9667
9667
|
fallbackTokens = fallback.tokens;
|
|
9668
9668
|
}
|
|
9669
|
+
if (targetExpression) {
|
|
9670
|
+
targetExpression = retypeStylePropertyTarget(targetExpression);
|
|
9671
|
+
}
|
|
9669
9672
|
if (!ctx.check(KEYWORDS.TO)) {
|
|
9670
9673
|
const found = ctx.isAtEnd() ? 'end of input' : ctx.peek().value;
|
|
9671
9674
|
throw new Error(`Expected 'to' in set command, found: ${found}`);
|
|
@@ -9693,6 +9696,41 @@ function parseSetCommand(ctx, identifierNode) {
|
|
|
9693
9696
|
}
|
|
9694
9697
|
return builder.endingAt(ctx.getPosition()).build();
|
|
9695
9698
|
}
|
|
9699
|
+
function retypeStylePropertyTarget(target) {
|
|
9700
|
+
const asStyleIdentifier = (node) => {
|
|
9701
|
+
if (!node || node.type !== 'selector')
|
|
9702
|
+
return null;
|
|
9703
|
+
const value = node.value;
|
|
9704
|
+
if (typeof value !== 'string' || !value.startsWith('*'))
|
|
9705
|
+
return null;
|
|
9706
|
+
return createIdentifier(value, {
|
|
9707
|
+
start: node.start ?? 0,
|
|
9708
|
+
end: node.end ?? 0,
|
|
9709
|
+
line: node.line ?? 1,
|
|
9710
|
+
column: node.column ?? 1,
|
|
9711
|
+
});
|
|
9712
|
+
};
|
|
9713
|
+
const pos = {
|
|
9714
|
+
start: target.start ?? 0,
|
|
9715
|
+
end: target.end ?? 0,
|
|
9716
|
+
line: target.line ?? 1,
|
|
9717
|
+
column: target.column ?? 1,
|
|
9718
|
+
};
|
|
9719
|
+
const bare = asStyleIdentifier(target);
|
|
9720
|
+
if (bare)
|
|
9721
|
+
return bare;
|
|
9722
|
+
if (target.type === 'binaryExpression' && target.operator === KEYWORDS.OF) {
|
|
9723
|
+
const property = asStyleIdentifier(target.left);
|
|
9724
|
+
if (property)
|
|
9725
|
+
return createPropertyOfExpression(property, target.right, pos);
|
|
9726
|
+
}
|
|
9727
|
+
if (target.type === 'propertyOfExpression') {
|
|
9728
|
+
const property = asStyleIdentifier(target.property);
|
|
9729
|
+
if (property)
|
|
9730
|
+
return createPropertyOfExpression(property, target.target, pos);
|
|
9731
|
+
}
|
|
9732
|
+
return target;
|
|
9733
|
+
}
|
|
9696
9734
|
function tokenLooksLikeElementTarget(token) {
|
|
9697
9735
|
if (!token)
|
|
9698
9736
|
return false;
|
|
@@ -1,3 +1,34 @@
|
|
|
1
|
+
import type { ASTNode, ExecutionContext } from '../types/base-types';
|
|
2
|
+
import { detectLanguage } from './detect-language';
|
|
3
|
+
export { detectLanguage };
|
|
4
|
+
export interface CompileFailure {
|
|
5
|
+
message: string;
|
|
6
|
+
line: number;
|
|
7
|
+
column: number;
|
|
8
|
+
suggestion?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ProcessorCompileResult {
|
|
11
|
+
ok: boolean;
|
|
12
|
+
ast?: ASTNode;
|
|
13
|
+
errors?: CompileFailure[];
|
|
14
|
+
}
|
|
15
|
+
export interface CompileErrorReport {
|
|
16
|
+
source: 'attribute' | 'script';
|
|
17
|
+
code: string;
|
|
18
|
+
errors: CompileFailure[];
|
|
19
|
+
element: Element | null;
|
|
20
|
+
}
|
|
21
|
+
export interface ProcessorHost {
|
|
22
|
+
compileSync(code: string): ProcessorCompileResult;
|
|
23
|
+
compile(code: string, options: {
|
|
24
|
+
language: string;
|
|
25
|
+
}): Promise<ProcessorCompileResult>;
|
|
26
|
+
execute(ast: ASTNode, context: ExecutionContext): Promise<unknown>;
|
|
27
|
+
config: {
|
|
28
|
+
onCompileError: ((report: CompileErrorReport) => void) | null;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export declare function initializeAttributeProcessor(host: ProcessorHost): void;
|
|
1
32
|
declare global {
|
|
2
33
|
interface Window {
|
|
3
34
|
__hyperfixi_behaviors_ready?: Promise<void>;
|
|
@@ -13,15 +44,18 @@ export interface AttributeProcessorOptions {
|
|
|
13
44
|
}
|
|
14
45
|
export declare class AttributeProcessor {
|
|
15
46
|
private processedElements;
|
|
47
|
+
private lazyStubs;
|
|
16
48
|
private options;
|
|
17
49
|
private observer;
|
|
18
50
|
private processedCount;
|
|
19
51
|
private readyEventDispatched;
|
|
20
52
|
private initialized;
|
|
21
|
-
private lazyElements;
|
|
22
53
|
constructor(options?: AttributeProcessorOptions);
|
|
23
54
|
init(): Promise<void>;
|
|
24
55
|
scanAndProcessAll(): Promise<void>;
|
|
56
|
+
private processElements;
|
|
57
|
+
processTree(root: Element): Promise<void>;
|
|
58
|
+
forget(root: Element): void;
|
|
25
59
|
private reportCompileError;
|
|
26
60
|
private processHyperscriptTag;
|
|
27
61
|
private processHyperscriptTagForElements;
|
|
@@ -4334,4 +4334,4 @@ exports.references = referencesExpressions;
|
|
|
4334
4334
|
exports.referencesExpressions = referencesExpressions;
|
|
4335
4335
|
exports.special = specialExpressions;
|
|
4336
4336
|
exports.specialExpressions = specialExpressions;
|
|
4337
|
-
//# sourceMappingURL=index.
|
|
4337
|
+
//# sourceMappingURL=index.cjs.map
|