@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
|
@@ -81,4 +81,4 @@ exports.semanticNodeToRuntimeAST = semanticNodeToRuntimeAST;
|
|
|
81
81
|
exports.toEnvelopeJSON = toEnvelopeJSON;
|
|
82
82
|
exports.toProtocolJSON = toProtocolJSON;
|
|
83
83
|
exports.validateProtocolJSON = validateProtocolJSON;
|
|
84
|
-
//# sourceMappingURL=index.
|
|
84
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -894,4 +894,4 @@ exports.LOGICAL_KEYWORDS = LOGICAL_KEYWORDS;
|
|
|
894
894
|
exports.POSITIONAL_KEYWORDS = POSITIONAL_KEYWORDS;
|
|
895
895
|
exports.REACTIVE_SIGILS = REACTIVE_SIGILS;
|
|
896
896
|
exports.REFERENCE_KEYWORDS = REFERENCE_KEYWORDS;
|
|
897
|
-
//# sourceMappingURL=lsp-metadata.
|
|
897
|
+
//# sourceMappingURL=lsp-metadata.cjs.map
|
|
@@ -61,7 +61,7 @@ const COMMAND_NAMES = [
|
|
|
61
61
|
'wait',
|
|
62
62
|
];
|
|
63
63
|
|
|
64
|
-
const VERSION = '3.
|
|
64
|
+
const VERSION = '3.1.0';
|
|
65
65
|
|
|
66
66
|
const FULL_RUNTIME_COMMAND_COUNT = COMMAND_NAMES.length;
|
|
67
67
|
const packageInfo = {
|
|
@@ -388,4 +388,4 @@ exports.getBundlesWithFeature = getBundlesWithFeature;
|
|
|
388
388
|
exports.getSmallestBundle = getSmallestBundle;
|
|
389
389
|
exports.packageInfo = packageInfo;
|
|
390
390
|
exports.supportedLanguages = supportedLanguages;
|
|
391
|
-
//# sourceMappingURL=metadata.
|
|
391
|
+
//# sourceMappingURL=metadata.cjs.map
|
package/dist/metadata.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const packageInfo: {
|
|
2
2
|
readonly name: "@hyperfixi/core";
|
|
3
|
-
readonly version: "3.
|
|
3
|
+
readonly version: "3.1.0";
|
|
4
4
|
readonly description: "Modern hyperscript engine with fixi/htmx integration";
|
|
5
5
|
readonly compatibility: "~85% official _hyperscript";
|
|
6
6
|
readonly languages: 24;
|
package/dist/metadata.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { SemanticNode, ASTNode } from '@lokascript/semantic';
|
|
2
|
+
import type { FrontEnd } from '../parser/semantic-integration';
|
|
2
3
|
export interface BridgeConfig {
|
|
3
4
|
confidenceThreshold?: number;
|
|
4
5
|
fallbackOnLowConfidence?: boolean;
|
|
@@ -31,6 +32,7 @@ export declare class SemanticGrammarBridge {
|
|
|
31
32
|
parseToASTWithDetails(input: string, lang: string): Promise<ParseToASTResult>;
|
|
32
33
|
getAllTranslations(input: string, sourceLang: string): Promise<Record<string, BridgeResult>>;
|
|
33
34
|
}
|
|
35
|
+
export declare function createBridgeFrontEnd(bridge: SemanticGrammarBridge): FrontEnd;
|
|
34
36
|
export declare function getDefaultBridge(): Promise<SemanticGrammarBridge>;
|
|
35
37
|
export declare function translate(input: string, sourceLang: string, targetLang: string): Promise<string>;
|
|
36
38
|
//# sourceMappingURL=bridge.d.ts.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var semantic = require('@lokascript/semantic');
|
|
4
|
+
var intent = require('@lokascript/intent');
|
|
4
5
|
|
|
5
6
|
const DEFAULT_CONFIDENCE_THRESHOLD = 0.5;
|
|
6
7
|
|
|
@@ -230,109 +231,6 @@ async function translate(input, sourceLang, targetLang) {
|
|
|
230
231
|
return result.output;
|
|
231
232
|
}
|
|
232
233
|
|
|
233
|
-
// src/types.ts
|
|
234
|
-
|
|
235
|
-
// src/inference/infer-roles.ts
|
|
236
|
-
function inferRolesFromSchema(schema, args, modifiers, target, adapter) {
|
|
237
|
-
const roles = {};
|
|
238
|
-
const skipTokens = new Set(schema.argSkipTokens ?? []);
|
|
239
|
-
const usedArgIndices = /* @__PURE__ */ new Set();
|
|
240
|
-
for (const role of schema.roles) {
|
|
241
|
-
const markers = englishMarkers(role);
|
|
242
|
-
if (markers.length === 0) continue;
|
|
243
|
-
let matched = tryModifierMarkers(role, markers, modifiers, adapter);
|
|
244
|
-
if (!matched) {
|
|
245
|
-
matched = tryArgMarkers(role, markers, args, skipTokens, usedArgIndices, adapter);
|
|
246
|
-
}
|
|
247
|
-
if (matched) {
|
|
248
|
-
roles[role.role] = matched.value;
|
|
249
|
-
if (role.methodCarrier) {
|
|
250
|
-
roles[role.methodCarrier] = adapter.createLiteralValue(matched.matchedMarker);
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
if (target !== void 0) {
|
|
255
|
-
const tgtRole = schema.targetRole ?? "destination";
|
|
256
|
-
if (roles[tgtRole] === void 0) {
|
|
257
|
-
roles[tgtRole] = adapter.convertValue(target);
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
const positionalRoles = schema.roles.filter((r) => englishMarkers(r).length === 0 && roles[r.role] === void 0).sort((a, b) => (a.svoPosition ?? 99) - (b.svoPosition ?? 99));
|
|
261
|
-
let cursor = 0;
|
|
262
|
-
for (const role of positionalRoles) {
|
|
263
|
-
while (cursor < args.length) {
|
|
264
|
-
if (usedArgIndices.has(cursor)) {
|
|
265
|
-
cursor++;
|
|
266
|
-
continue;
|
|
267
|
-
}
|
|
268
|
-
const name = adapter.getIdentifierName(args[cursor]);
|
|
269
|
-
if (name !== void 0 && skipTokens.has(name)) {
|
|
270
|
-
cursor++;
|
|
271
|
-
continue;
|
|
272
|
-
}
|
|
273
|
-
roles[role.role] = adapter.convertValue(args[cursor]);
|
|
274
|
-
usedArgIndices.add(cursor);
|
|
275
|
-
cursor++;
|
|
276
|
-
break;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
return roles;
|
|
280
|
-
}
|
|
281
|
-
function englishMarkers(role) {
|
|
282
|
-
const primary = role.markerOverride?.en;
|
|
283
|
-
const variants = role.markerVariants?.en ?? [];
|
|
284
|
-
const out = [];
|
|
285
|
-
if (typeof primary === "string" && primary !== "") out.push(primary);
|
|
286
|
-
for (const v of variants) if (v !== "") out.push(v);
|
|
287
|
-
return out;
|
|
288
|
-
}
|
|
289
|
-
function tryModifierMarkers(_role, markers, modifiers, adapter) {
|
|
290
|
-
if (!modifiers) return void 0;
|
|
291
|
-
for (const m of markers) {
|
|
292
|
-
if (!(m in modifiers)) continue;
|
|
293
|
-
const raw = modifiers[m];
|
|
294
|
-
if (raw === void 0 || raw === null) continue;
|
|
295
|
-
if (typeof raw === "string") {
|
|
296
|
-
return { value: adapter.createLiteralValue(raw), matchedMarker: m };
|
|
297
|
-
}
|
|
298
|
-
if (typeof raw === "object" && "type" in raw) {
|
|
299
|
-
return { value: adapter.convertValue(raw), matchedMarker: m };
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
return void 0;
|
|
303
|
-
}
|
|
304
|
-
function tryArgMarkers(_role, markers, args, skipTokens, usedArgIndices, adapter) {
|
|
305
|
-
const sorted = [...markers].sort((a, b) => b.split(/\s+/).length - a.split(/\s+/).length);
|
|
306
|
-
for (const marker of sorted) {
|
|
307
|
-
const words = marker.split(/\s+/).filter((w) => w.length > 0);
|
|
308
|
-
if (words.length === 0) continue;
|
|
309
|
-
for (let i = 0; i + words.length <= args.length; i++) {
|
|
310
|
-
let allMatch = true;
|
|
311
|
-
for (let w = 0; w < words.length; w++) {
|
|
312
|
-
if (usedArgIndices.has(i + w)) {
|
|
313
|
-
allMatch = false;
|
|
314
|
-
break;
|
|
315
|
-
}
|
|
316
|
-
const name = adapter.getIdentifierName(args[i + w]);
|
|
317
|
-
if (name !== words[w]) {
|
|
318
|
-
allMatch = false;
|
|
319
|
-
break;
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
if (!allMatch) continue;
|
|
323
|
-
for (let v = i + words.length; v < args.length; v++) {
|
|
324
|
-
if (usedArgIndices.has(v)) continue;
|
|
325
|
-
const name = adapter.getIdentifierName(args[v]);
|
|
326
|
-
if (name !== void 0 && skipTokens.has(name)) continue;
|
|
327
|
-
for (let w = 0; w < words.length; w++) usedArgIndices.add(i + w);
|
|
328
|
-
usedArgIndices.add(v);
|
|
329
|
-
return { value: adapter.convertValue(args[v]), matchedMarker: marker };
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
return void 0;
|
|
334
|
-
}
|
|
335
|
-
|
|
336
234
|
const INTERCHANGE_ADAPTER = {
|
|
337
235
|
getIdentifierName(node) {
|
|
338
236
|
if (node.type !== 'identifier')
|
|
@@ -355,7 +253,7 @@ const schemaRoleInferrer = (name, args, modifiers, target) => {
|
|
|
355
253
|
const schema = semantic.getSchema(name);
|
|
356
254
|
if (!schema)
|
|
357
255
|
return null;
|
|
358
|
-
const inferred = inferRolesFromSchema(schema, args, modifiers, target, INTERCHANGE_ADAPTER);
|
|
256
|
+
const inferred = intent.inferRolesFromSchema(schema, args, modifiers, target, INTERCHANGE_ADAPTER);
|
|
359
257
|
const declared = schema.ast
|
|
360
258
|
?.modifiers;
|
|
361
259
|
if (declared && modifiers) {
|
|
@@ -493,4 +391,4 @@ exports.getMultilingual = getMultilingual;
|
|
|
493
391
|
exports.multilingual = multilingual;
|
|
494
392
|
exports.schemaRoleInferrer = schemaRoleInferrer;
|
|
495
393
|
exports.translate = translate;
|
|
496
|
-
//# sourceMappingURL=index.
|
|
394
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getSchema } from '@lokascript/semantic';
|
|
2
|
+
import { inferRolesFromSchema } from '@lokascript/intent';
|
|
2
3
|
|
|
3
4
|
const DEFAULT_CONFIDENCE_THRESHOLD = 0.5;
|
|
4
5
|
|
|
@@ -228,109 +229,6 @@ async function translate(input, sourceLang, targetLang) {
|
|
|
228
229
|
return result.output;
|
|
229
230
|
}
|
|
230
231
|
|
|
231
|
-
// src/types.ts
|
|
232
|
-
|
|
233
|
-
// src/inference/infer-roles.ts
|
|
234
|
-
function inferRolesFromSchema(schema, args, modifiers, target, adapter) {
|
|
235
|
-
const roles = {};
|
|
236
|
-
const skipTokens = new Set(schema.argSkipTokens ?? []);
|
|
237
|
-
const usedArgIndices = /* @__PURE__ */ new Set();
|
|
238
|
-
for (const role of schema.roles) {
|
|
239
|
-
const markers = englishMarkers(role);
|
|
240
|
-
if (markers.length === 0) continue;
|
|
241
|
-
let matched = tryModifierMarkers(role, markers, modifiers, adapter);
|
|
242
|
-
if (!matched) {
|
|
243
|
-
matched = tryArgMarkers(role, markers, args, skipTokens, usedArgIndices, adapter);
|
|
244
|
-
}
|
|
245
|
-
if (matched) {
|
|
246
|
-
roles[role.role] = matched.value;
|
|
247
|
-
if (role.methodCarrier) {
|
|
248
|
-
roles[role.methodCarrier] = adapter.createLiteralValue(matched.matchedMarker);
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
if (target !== void 0) {
|
|
253
|
-
const tgtRole = schema.targetRole ?? "destination";
|
|
254
|
-
if (roles[tgtRole] === void 0) {
|
|
255
|
-
roles[tgtRole] = adapter.convertValue(target);
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
const positionalRoles = schema.roles.filter((r) => englishMarkers(r).length === 0 && roles[r.role] === void 0).sort((a, b) => (a.svoPosition ?? 99) - (b.svoPosition ?? 99));
|
|
259
|
-
let cursor = 0;
|
|
260
|
-
for (const role of positionalRoles) {
|
|
261
|
-
while (cursor < args.length) {
|
|
262
|
-
if (usedArgIndices.has(cursor)) {
|
|
263
|
-
cursor++;
|
|
264
|
-
continue;
|
|
265
|
-
}
|
|
266
|
-
const name = adapter.getIdentifierName(args[cursor]);
|
|
267
|
-
if (name !== void 0 && skipTokens.has(name)) {
|
|
268
|
-
cursor++;
|
|
269
|
-
continue;
|
|
270
|
-
}
|
|
271
|
-
roles[role.role] = adapter.convertValue(args[cursor]);
|
|
272
|
-
usedArgIndices.add(cursor);
|
|
273
|
-
cursor++;
|
|
274
|
-
break;
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
return roles;
|
|
278
|
-
}
|
|
279
|
-
function englishMarkers(role) {
|
|
280
|
-
const primary = role.markerOverride?.en;
|
|
281
|
-
const variants = role.markerVariants?.en ?? [];
|
|
282
|
-
const out = [];
|
|
283
|
-
if (typeof primary === "string" && primary !== "") out.push(primary);
|
|
284
|
-
for (const v of variants) if (v !== "") out.push(v);
|
|
285
|
-
return out;
|
|
286
|
-
}
|
|
287
|
-
function tryModifierMarkers(_role, markers, modifiers, adapter) {
|
|
288
|
-
if (!modifiers) return void 0;
|
|
289
|
-
for (const m of markers) {
|
|
290
|
-
if (!(m in modifiers)) continue;
|
|
291
|
-
const raw = modifiers[m];
|
|
292
|
-
if (raw === void 0 || raw === null) continue;
|
|
293
|
-
if (typeof raw === "string") {
|
|
294
|
-
return { value: adapter.createLiteralValue(raw), matchedMarker: m };
|
|
295
|
-
}
|
|
296
|
-
if (typeof raw === "object" && "type" in raw) {
|
|
297
|
-
return { value: adapter.convertValue(raw), matchedMarker: m };
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
return void 0;
|
|
301
|
-
}
|
|
302
|
-
function tryArgMarkers(_role, markers, args, skipTokens, usedArgIndices, adapter) {
|
|
303
|
-
const sorted = [...markers].sort((a, b) => b.split(/\s+/).length - a.split(/\s+/).length);
|
|
304
|
-
for (const marker of sorted) {
|
|
305
|
-
const words = marker.split(/\s+/).filter((w) => w.length > 0);
|
|
306
|
-
if (words.length === 0) continue;
|
|
307
|
-
for (let i = 0; i + words.length <= args.length; i++) {
|
|
308
|
-
let allMatch = true;
|
|
309
|
-
for (let w = 0; w < words.length; w++) {
|
|
310
|
-
if (usedArgIndices.has(i + w)) {
|
|
311
|
-
allMatch = false;
|
|
312
|
-
break;
|
|
313
|
-
}
|
|
314
|
-
const name = adapter.getIdentifierName(args[i + w]);
|
|
315
|
-
if (name !== words[w]) {
|
|
316
|
-
allMatch = false;
|
|
317
|
-
break;
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
if (!allMatch) continue;
|
|
321
|
-
for (let v = i + words.length; v < args.length; v++) {
|
|
322
|
-
if (usedArgIndices.has(v)) continue;
|
|
323
|
-
const name = adapter.getIdentifierName(args[v]);
|
|
324
|
-
if (name !== void 0 && skipTokens.has(name)) continue;
|
|
325
|
-
for (let w = 0; w < words.length; w++) usedArgIndices.add(i + w);
|
|
326
|
-
usedArgIndices.add(v);
|
|
327
|
-
return { value: adapter.convertValue(args[v]), matchedMarker: marker };
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
return void 0;
|
|
332
|
-
}
|
|
333
|
-
|
|
334
232
|
const INTERCHANGE_ADAPTER = {
|
|
335
233
|
getIdentifierName(node) {
|
|
336
234
|
if (node.type !== 'identifier')
|
|
@@ -3727,6 +3727,9 @@ function parseSetCommand(ctx, identifierNode) {
|
|
|
3727
3727
|
targetExpression = fallback.expression;
|
|
3728
3728
|
fallbackTokens = fallback.tokens;
|
|
3729
3729
|
}
|
|
3730
|
+
if (targetExpression) {
|
|
3731
|
+
targetExpression = retypeStylePropertyTarget(targetExpression);
|
|
3732
|
+
}
|
|
3730
3733
|
if (!ctx.check(KEYWORDS.TO)) {
|
|
3731
3734
|
const found = ctx.isAtEnd() ? 'end of input' : ctx.peek().value;
|
|
3732
3735
|
throw new Error(`Expected 'to' in set command, found: ${found}`);
|
|
@@ -3754,6 +3757,41 @@ function parseSetCommand(ctx, identifierNode) {
|
|
|
3754
3757
|
}
|
|
3755
3758
|
return builder.endingAt(ctx.getPosition()).build();
|
|
3756
3759
|
}
|
|
3760
|
+
function retypeStylePropertyTarget(target) {
|
|
3761
|
+
const asStyleIdentifier = (node) => {
|
|
3762
|
+
if (!node || node.type !== 'selector')
|
|
3763
|
+
return null;
|
|
3764
|
+
const value = node.value;
|
|
3765
|
+
if (typeof value !== 'string' || !value.startsWith('*'))
|
|
3766
|
+
return null;
|
|
3767
|
+
return createIdentifier(value, {
|
|
3768
|
+
start: node.start ?? 0,
|
|
3769
|
+
end: node.end ?? 0,
|
|
3770
|
+
line: node.line ?? 1,
|
|
3771
|
+
column: node.column ?? 1,
|
|
3772
|
+
});
|
|
3773
|
+
};
|
|
3774
|
+
const pos = {
|
|
3775
|
+
start: target.start ?? 0,
|
|
3776
|
+
end: target.end ?? 0,
|
|
3777
|
+
line: target.line ?? 1,
|
|
3778
|
+
column: target.column ?? 1,
|
|
3779
|
+
};
|
|
3780
|
+
const bare = asStyleIdentifier(target);
|
|
3781
|
+
if (bare)
|
|
3782
|
+
return bare;
|
|
3783
|
+
if (target.type === 'binaryExpression' && target.operator === KEYWORDS.OF) {
|
|
3784
|
+
const property = asStyleIdentifier(target.left);
|
|
3785
|
+
if (property)
|
|
3786
|
+
return createPropertyOfExpression(property, target.right, pos);
|
|
3787
|
+
}
|
|
3788
|
+
if (target.type === 'propertyOfExpression') {
|
|
3789
|
+
const property = asStyleIdentifier(target.property);
|
|
3790
|
+
if (property)
|
|
3791
|
+
return createPropertyOfExpression(property, target.target, pos);
|
|
3792
|
+
}
|
|
3793
|
+
return target;
|
|
3794
|
+
}
|
|
3757
3795
|
function tokenLooksLikeElementTarget(token) {
|
|
3758
3796
|
if (!token)
|
|
3759
3797
|
return false;
|
|
@@ -7659,4 +7697,4 @@ function createFullParser() {
|
|
|
7659
7697
|
|
|
7660
7698
|
exports.createFullParser = createFullParser;
|
|
7661
7699
|
exports.fullParser = fullParser;
|
|
7662
|
-
//# sourceMappingURL=full-parser.
|
|
7700
|
+
//# sourceMappingURL=full-parser.cjs.map
|
|
@@ -3725,6 +3725,9 @@ function parseSetCommand(ctx, identifierNode) {
|
|
|
3725
3725
|
targetExpression = fallback.expression;
|
|
3726
3726
|
fallbackTokens = fallback.tokens;
|
|
3727
3727
|
}
|
|
3728
|
+
if (targetExpression) {
|
|
3729
|
+
targetExpression = retypeStylePropertyTarget(targetExpression);
|
|
3730
|
+
}
|
|
3728
3731
|
if (!ctx.check(KEYWORDS.TO)) {
|
|
3729
3732
|
const found = ctx.isAtEnd() ? 'end of input' : ctx.peek().value;
|
|
3730
3733
|
throw new Error(`Expected 'to' in set command, found: ${found}`);
|
|
@@ -3752,6 +3755,41 @@ function parseSetCommand(ctx, identifierNode) {
|
|
|
3752
3755
|
}
|
|
3753
3756
|
return builder.endingAt(ctx.getPosition()).build();
|
|
3754
3757
|
}
|
|
3758
|
+
function retypeStylePropertyTarget(target) {
|
|
3759
|
+
const asStyleIdentifier = (node) => {
|
|
3760
|
+
if (!node || node.type !== 'selector')
|
|
3761
|
+
return null;
|
|
3762
|
+
const value = node.value;
|
|
3763
|
+
if (typeof value !== 'string' || !value.startsWith('*'))
|
|
3764
|
+
return null;
|
|
3765
|
+
return createIdentifier(value, {
|
|
3766
|
+
start: node.start ?? 0,
|
|
3767
|
+
end: node.end ?? 0,
|
|
3768
|
+
line: node.line ?? 1,
|
|
3769
|
+
column: node.column ?? 1,
|
|
3770
|
+
});
|
|
3771
|
+
};
|
|
3772
|
+
const pos = {
|
|
3773
|
+
start: target.start ?? 0,
|
|
3774
|
+
end: target.end ?? 0,
|
|
3775
|
+
line: target.line ?? 1,
|
|
3776
|
+
column: target.column ?? 1,
|
|
3777
|
+
};
|
|
3778
|
+
const bare = asStyleIdentifier(target);
|
|
3779
|
+
if (bare)
|
|
3780
|
+
return bare;
|
|
3781
|
+
if (target.type === 'binaryExpression' && target.operator === KEYWORDS.OF) {
|
|
3782
|
+
const property = asStyleIdentifier(target.left);
|
|
3783
|
+
if (property)
|
|
3784
|
+
return createPropertyOfExpression(property, target.right, pos);
|
|
3785
|
+
}
|
|
3786
|
+
if (target.type === 'propertyOfExpression') {
|
|
3787
|
+
const property = asStyleIdentifier(target.property);
|
|
3788
|
+
if (property)
|
|
3789
|
+
return createPropertyOfExpression(property, target.target, pos);
|
|
3790
|
+
}
|
|
3791
|
+
return target;
|
|
3792
|
+
}
|
|
3755
3793
|
function tokenLooksLikeElementTarget(token) {
|
|
3756
3794
|
if (!token)
|
|
3757
3795
|
return false;
|
|
@@ -1243,4 +1243,4 @@ exports.addEventAliases = addEventAliases;
|
|
|
1243
1243
|
exports.createHybridParser = createHybridParser;
|
|
1244
1244
|
exports.hybridParser = hybridParser;
|
|
1245
1245
|
exports.tokenize = tokenize;
|
|
1246
|
-
//# sourceMappingURL=hybrid-parser.
|
|
1246
|
+
//# sourceMappingURL=hybrid-parser.cjs.map
|
|
@@ -1,2 +1,17 @@
|
|
|
1
1
|
export declare const DEFAULT_CONFIDENCE_THRESHOLD = 0.5;
|
|
2
|
+
import type { ASTNode } from '../types/base-types';
|
|
3
|
+
export interface FrontEndParseResult {
|
|
4
|
+
ast: ASTNode | null;
|
|
5
|
+
usedDirectPath: boolean;
|
|
6
|
+
confidence: number;
|
|
7
|
+
lang: string;
|
|
8
|
+
fallbackText: string | null;
|
|
9
|
+
warnings?: string[];
|
|
10
|
+
}
|
|
11
|
+
export interface FrontEnd {
|
|
12
|
+
readonly name: string;
|
|
13
|
+
parseToAST(code: string, lang: string): Promise<FrontEndParseResult>;
|
|
14
|
+
parse?(code: string, lang: string): Promise<unknown>;
|
|
15
|
+
render?(node: unknown, lang: string): Promise<string>;
|
|
16
|
+
}
|
|
2
17
|
//# sourceMappingURL=semantic-integration.d.ts.map
|
|
@@ -78,4 +78,4 @@ exports.createCustomEventSource = createCustomEventSource;
|
|
|
78
78
|
exports.createDOMEventSource = createDOMEventSource;
|
|
79
79
|
exports.isBrowserEventSource = isBrowserEventSource;
|
|
80
80
|
exports.isBrowserPayload = isBrowserPayload;
|
|
81
|
-
//# sourceMappingURL=browser-types.
|
|
81
|
+
//# sourceMappingURL=browser-types.cjs.map
|
|
@@ -33,4 +33,4 @@ exports.assertNodeEnvironment = assertNodeEnvironment;
|
|
|
33
33
|
exports.getRuntimeEnvironment = getRuntimeEnvironment;
|
|
34
34
|
exports.isBrowserEnvironment = isBrowserEnvironment;
|
|
35
35
|
exports.isNodeEnvironment = isNodeEnvironment;
|
|
36
|
-
//# sourceMappingURL=environment.
|
|
36
|
+
//# sourceMappingURL=environment.cjs.map
|
|
@@ -7211,6 +7211,9 @@ function parseSetCommand(ctx, identifierNode) {
|
|
|
7211
7211
|
targetExpression = fallback.expression;
|
|
7212
7212
|
fallbackTokens = fallback.tokens;
|
|
7213
7213
|
}
|
|
7214
|
+
if (targetExpression) {
|
|
7215
|
+
targetExpression = retypeStylePropertyTarget(targetExpression);
|
|
7216
|
+
}
|
|
7214
7217
|
if (!ctx.check(KEYWORDS.TO)) {
|
|
7215
7218
|
const found = ctx.isAtEnd() ? 'end of input' : ctx.peek().value;
|
|
7216
7219
|
throw new Error(`Expected 'to' in set command, found: ${found}`);
|
|
@@ -7238,6 +7241,41 @@ function parseSetCommand(ctx, identifierNode) {
|
|
|
7238
7241
|
}
|
|
7239
7242
|
return builder.endingAt(ctx.getPosition()).build();
|
|
7240
7243
|
}
|
|
7244
|
+
function retypeStylePropertyTarget(target) {
|
|
7245
|
+
const asStyleIdentifier = (node) => {
|
|
7246
|
+
if (!node || node.type !== 'selector')
|
|
7247
|
+
return null;
|
|
7248
|
+
const value = node.value;
|
|
7249
|
+
if (typeof value !== 'string' || !value.startsWith('*'))
|
|
7250
|
+
return null;
|
|
7251
|
+
return createIdentifier(value, {
|
|
7252
|
+
start: node.start ?? 0,
|
|
7253
|
+
end: node.end ?? 0,
|
|
7254
|
+
line: node.line ?? 1,
|
|
7255
|
+
column: node.column ?? 1,
|
|
7256
|
+
});
|
|
7257
|
+
};
|
|
7258
|
+
const pos = {
|
|
7259
|
+
start: target.start ?? 0,
|
|
7260
|
+
end: target.end ?? 0,
|
|
7261
|
+
line: target.line ?? 1,
|
|
7262
|
+
column: target.column ?? 1,
|
|
7263
|
+
};
|
|
7264
|
+
const bare = asStyleIdentifier(target);
|
|
7265
|
+
if (bare)
|
|
7266
|
+
return bare;
|
|
7267
|
+
if (target.type === 'binaryExpression' && target.operator === KEYWORDS.OF) {
|
|
7268
|
+
const property = asStyleIdentifier(target.left);
|
|
7269
|
+
if (property)
|
|
7270
|
+
return createPropertyOfExpression(property, target.right, pos);
|
|
7271
|
+
}
|
|
7272
|
+
if (target.type === 'propertyOfExpression') {
|
|
7273
|
+
const property = asStyleIdentifier(target.property);
|
|
7274
|
+
if (property)
|
|
7275
|
+
return createPropertyOfExpression(property, target.target, pos);
|
|
7276
|
+
}
|
|
7277
|
+
return target;
|
|
7278
|
+
}
|
|
7241
7279
|
function tokenLooksLikeElementTarget(token) {
|
|
7242
7280
|
if (!token)
|
|
7243
7281
|
return false;
|
|
@@ -13689,4 +13727,4 @@ exports.getDefaultEventSourceRegistry = getDefaultEventSourceRegistry;
|
|
|
13689
13727
|
exports.getDefaultRegistry = getDefaultRegistry;
|
|
13690
13728
|
exports.getDefaultRegistryIntegration = getDefaultRegistryIntegration;
|
|
13691
13729
|
exports.resetDefaultRegistryIntegration = resetDefaultRegistryIntegration;
|
|
13692
|
-
//# sourceMappingURL=index.
|
|
13730
|
+
//# sourceMappingURL=index.cjs.map
|
package/dist/registry/index.mjs
CHANGED
|
@@ -7209,6 +7209,9 @@ function parseSetCommand(ctx, identifierNode) {
|
|
|
7209
7209
|
targetExpression = fallback.expression;
|
|
7210
7210
|
fallbackTokens = fallback.tokens;
|
|
7211
7211
|
}
|
|
7212
|
+
if (targetExpression) {
|
|
7213
|
+
targetExpression = retypeStylePropertyTarget(targetExpression);
|
|
7214
|
+
}
|
|
7212
7215
|
if (!ctx.check(KEYWORDS.TO)) {
|
|
7213
7216
|
const found = ctx.isAtEnd() ? 'end of input' : ctx.peek().value;
|
|
7214
7217
|
throw new Error(`Expected 'to' in set command, found: ${found}`);
|
|
@@ -7236,6 +7239,41 @@ function parseSetCommand(ctx, identifierNode) {
|
|
|
7236
7239
|
}
|
|
7237
7240
|
return builder.endingAt(ctx.getPosition()).build();
|
|
7238
7241
|
}
|
|
7242
|
+
function retypeStylePropertyTarget(target) {
|
|
7243
|
+
const asStyleIdentifier = (node) => {
|
|
7244
|
+
if (!node || node.type !== 'selector')
|
|
7245
|
+
return null;
|
|
7246
|
+
const value = node.value;
|
|
7247
|
+
if (typeof value !== 'string' || !value.startsWith('*'))
|
|
7248
|
+
return null;
|
|
7249
|
+
return createIdentifier(value, {
|
|
7250
|
+
start: node.start ?? 0,
|
|
7251
|
+
end: node.end ?? 0,
|
|
7252
|
+
line: node.line ?? 1,
|
|
7253
|
+
column: node.column ?? 1,
|
|
7254
|
+
});
|
|
7255
|
+
};
|
|
7256
|
+
const pos = {
|
|
7257
|
+
start: target.start ?? 0,
|
|
7258
|
+
end: target.end ?? 0,
|
|
7259
|
+
line: target.line ?? 1,
|
|
7260
|
+
column: target.column ?? 1,
|
|
7261
|
+
};
|
|
7262
|
+
const bare = asStyleIdentifier(target);
|
|
7263
|
+
if (bare)
|
|
7264
|
+
return bare;
|
|
7265
|
+
if (target.type === 'binaryExpression' && target.operator === KEYWORDS.OF) {
|
|
7266
|
+
const property = asStyleIdentifier(target.left);
|
|
7267
|
+
if (property)
|
|
7268
|
+
return createPropertyOfExpression(property, target.right, pos);
|
|
7269
|
+
}
|
|
7270
|
+
if (target.type === 'propertyOfExpression') {
|
|
7271
|
+
const property = asStyleIdentifier(target.property);
|
|
7272
|
+
if (property)
|
|
7273
|
+
return createPropertyOfExpression(property, target.target, pos);
|
|
7274
|
+
}
|
|
7275
|
+
return target;
|
|
7276
|
+
}
|
|
7239
7277
|
function tokenLooksLikeElementTarget(token) {
|
|
7240
7278
|
if (!token)
|
|
7241
7279
|
return false;
|
|
@@ -88,4 +88,4 @@ exports.createAdaptiveEventSource = createAdaptiveEventSource;
|
|
|
88
88
|
exports.createTimerEventSource = createTimerEventSource;
|
|
89
89
|
exports.isBrowserLikePayload = isBrowserLikePayload;
|
|
90
90
|
exports.isServerLikePayload = isServerLikePayload;
|
|
91
|
-
//# sourceMappingURL=universal-types.
|
|
91
|
+
//# sourceMappingURL=universal-types.cjs.map
|
|
@@ -14,6 +14,7 @@ import { CleanupRegistry } from './cleanup-registry';
|
|
|
14
14
|
import { RegistryIntegration, type RegistryIntegrationOptions } from '../registry/runtime-integration';
|
|
15
15
|
import type { Op, BodyOps } from '../types/program';
|
|
16
16
|
export interface RuntimeBaseOptions {
|
|
17
|
+
logAll?: () => boolean;
|
|
17
18
|
registry: CommandRegistry;
|
|
18
19
|
enableAsyncCommands?: boolean;
|
|
19
20
|
commandTimeout?: number;
|
|
@@ -2,6 +2,7 @@ import { RuntimeBase } from './runtime-base';
|
|
|
2
2
|
import { CommandRegistryV2 } from './command-adapter';
|
|
3
3
|
export interface RuntimeOptions {
|
|
4
4
|
enableAsyncCommands?: boolean;
|
|
5
|
+
logAll?: () => boolean;
|
|
5
6
|
commandTimeout?: number;
|
|
6
7
|
enableErrorReporting?: boolean;
|
|
7
8
|
lazyLoad?: boolean;
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "3.
|
|
1
|
+
export declare const VERSION = "3.1.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|