@hyperfixi/core 2.7.1 → 2.8.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 +1 -0
- package/dist/ast-utils/index.js +1910 -233
- package/dist/ast-utils/index.mjs +1910 -233
- package/dist/behaviors/index.js +10 -1
- package/dist/behaviors/index.mjs +10 -1
- package/dist/bundle-generator/index.d.ts +1 -1
- package/dist/bundle-generator/index.js +77 -68
- package/dist/bundle-generator/index.mjs +76 -69
- package/dist/bundle-generator/template-capabilities.d.ts +2 -0
- package/dist/chunks/bridge-DHj-SYm2.js +2 -0
- package/dist/chunks/browser-modular-D1m0Eikh.js +2 -0
- package/dist/chunks/{index-i_j9Z-1e.js → index-CuPeasRm.js} +2 -2
- package/dist/commands/index.js +127 -6
- package/dist/commands/index.mjs +127 -6
- package/dist/compatibility/browser-modular.d.ts +2 -2
- package/dist/expressions/index.d.ts +1 -1
- package/dist/htmx/hcon.d.ts +9 -0
- package/dist/htmx/htmx-translator.d.ts +1 -0
- package/dist/hyperfixi-browser-classic-i18n.js +1 -1
- package/dist/hyperfixi-browser-minimal.js +1 -1
- package/dist/hyperfixi-browser-standard.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-hx.js +1 -1
- package/dist/hyperfixi-hybrid-complete.js +1 -1
- package/dist/hyperfixi-hybrid-hx.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 +4527 -536
- package/dist/index.min.js +1 -1
- package/dist/index.mjs +4527 -536
- package/dist/lib/dom-globals-shim.d.ts +2 -0
- 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 +7 -7
- package/dist/metadata.d.ts +1 -1
- package/dist/metadata.js +31 -14
- package/dist/metadata.mjs +31 -14
- package/dist/multilingual/index.js +8 -1
- package/dist/multilingual/index.mjs +8 -1
- package/dist/parser/command-parsers/animation-commands.d.ts +2 -2
- package/dist/parser/command-parsers/async-commands.d.ts +2 -2
- package/dist/parser/command-parsers/dom-commands.d.ts +5 -5
- package/dist/parser/command-parsers/navigation-commands.d.ts +4 -0
- package/dist/parser/command-parsers/utility-commands.d.ts +2 -1
- package/dist/parser/command-parsers/variable-commands.d.ts +2 -2
- package/dist/parser/full-parser.js +117 -5
- package/dist/parser/full-parser.mjs +117 -5
- package/dist/parser/semantic-integration.d.ts +1 -0
- package/dist/performance/integration.d.ts +1 -1
- package/dist/registry/index.js +117 -5
- package/dist/registry/index.mjs +117 -5
- package/package.json +13 -20
- package/dist/chunks/bridge-lZbOVRDD.js +0 -2
- package/dist/chunks/browser-modular-DegkWQ8d.js +0 -2
- package/dist/compatibility/browser-bundle-animation-generated.d.ts +0 -16
- package/dist/compatibility/browser-bundle-forms-generated.d.ts +0 -16
- package/dist/compatibility/browser-bundle-minimal-generated.d.ts +0 -16
package/dist/behaviors/index.js
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
function ensureDomGlobals() {
|
|
4
|
+
if (typeof globalThis.Element === 'undefined') {
|
|
5
|
+
globalThis.Element = class {
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
ensureDomGlobals();
|
|
11
|
+
|
|
3
12
|
// src/morphlex.ts
|
|
4
13
|
var SUPPORTS_MOVE_BEFORE = "moveBefore" in Element.prototype;
|
|
5
14
|
var ELEMENT_NODE_TYPE = 1;
|
|
@@ -551,7 +560,7 @@ function longestIncreasingSubsequence(sequence) {
|
|
|
551
560
|
//# debugId=3F4BCB911DEC843864756E2164756E21
|
|
552
561
|
|
|
553
562
|
function toMorphlexOptions(options) {
|
|
554
|
-
return { preserveChanges: options?.preserveChanges ?? true };
|
|
563
|
+
return { preserveChanges: (options?.preserveChanges ?? true) };
|
|
555
564
|
}
|
|
556
565
|
const morphAdapter = {
|
|
557
566
|
morph(target, content, options) {
|
package/dist/behaviors/index.mjs
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
function ensureDomGlobals() {
|
|
2
|
+
if (typeof globalThis.Element === 'undefined') {
|
|
3
|
+
globalThis.Element = class {
|
|
4
|
+
};
|
|
5
|
+
}
|
|
6
|
+
return true;
|
|
7
|
+
}
|
|
8
|
+
ensureDomGlobals();
|
|
9
|
+
|
|
1
10
|
// src/morphlex.ts
|
|
2
11
|
var SUPPORTS_MOVE_BEFORE = "moveBefore" in Element.prototype;
|
|
3
12
|
var ELEMENT_NODE_TYPE = 1;
|
|
@@ -549,7 +558,7 @@ function longestIncreasingSubsequence(sequence) {
|
|
|
549
558
|
//# debugId=3F4BCB911DEC843864756E2164756E21
|
|
550
559
|
|
|
551
560
|
function toMorphlexOptions(options) {
|
|
552
|
-
return { preserveChanges: options?.preserveChanges ?? true };
|
|
561
|
+
return { preserveChanges: (options?.preserveChanges ?? true) };
|
|
553
562
|
}
|
|
554
563
|
const morphAdapter = {
|
|
555
564
|
morph(target, content, options) {
|
|
@@ -2,5 +2,5 @@ export type { BundleConfig, GeneratorOptions, GeneratedBundle, ValidationOptions
|
|
|
2
2
|
export { generateBundle, generateBundleCode } from './generator';
|
|
3
3
|
export { COMMAND_IMPLEMENTATIONS, BLOCK_IMPLEMENTATIONS, STYLE_COMMANDS, ELEMENT_ARRAY_COMMANDS, MORPH_COMMANDS, getAvailableCommands, getAvailableBlocks, getCommandImplementations, getBlockImplementations, type CodeFormat, } from './templates';
|
|
4
4
|
export { LITE_PARSER_TEMPLATE, HYBRID_PARSER_TEMPLATE, getParserTemplate, canUseLiteParser, LITE_PARSER_COMMANDS, } from './parser-templates';
|
|
5
|
-
export { AVAILABLE_COMMANDS, AVAILABLE_BLOCKS, FULL_RUNTIME_ONLY_COMMANDS, isAvailableCommand, isAvailableBlock, requiresFullRuntime, type AvailableCommand, type AvailableBlock, type FullRuntimeOnlyCommand, } from './template-capabilities';
|
|
5
|
+
export { AVAILABLE_COMMANDS, AVAILABLE_BLOCKS, FULL_RUNTIME_ONLY_COMMANDS, COMMAND_ALIASES, resolveCommandKey, isAvailableCommand, isAvailableBlock, requiresFullRuntime, type AvailableCommand, type AvailableBlock, type FullRuntimeOnlyCommand, } from './template-capabilities';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -638,6 +638,78 @@ function getAvailableBlocks() {
|
|
|
638
638
|
const COMMAND_IMPLEMENTATIONS = COMMAND_IMPLEMENTATIONS_TS;
|
|
639
639
|
const BLOCK_IMPLEMENTATIONS = BLOCK_IMPLEMENTATIONS_TS;
|
|
640
640
|
|
|
641
|
+
const AVAILABLE_COMMANDS = [
|
|
642
|
+
'toggle',
|
|
643
|
+
'add',
|
|
644
|
+
'remove',
|
|
645
|
+
'removeClass',
|
|
646
|
+
'show',
|
|
647
|
+
'hide',
|
|
648
|
+
'put',
|
|
649
|
+
'append',
|
|
650
|
+
'take',
|
|
651
|
+
'empty',
|
|
652
|
+
'set',
|
|
653
|
+
'get',
|
|
654
|
+
'increment',
|
|
655
|
+
'decrement',
|
|
656
|
+
'wait',
|
|
657
|
+
'transition',
|
|
658
|
+
'send',
|
|
659
|
+
'trigger',
|
|
660
|
+
'log',
|
|
661
|
+
'call',
|
|
662
|
+
'copy',
|
|
663
|
+
'beep',
|
|
664
|
+
'go',
|
|
665
|
+
'push',
|
|
666
|
+
'push-url',
|
|
667
|
+
'replace',
|
|
668
|
+
'replace-url',
|
|
669
|
+
'focus',
|
|
670
|
+
'blur',
|
|
671
|
+
'return',
|
|
672
|
+
'break',
|
|
673
|
+
'continue',
|
|
674
|
+
'halt',
|
|
675
|
+
'exit',
|
|
676
|
+
'throw',
|
|
677
|
+
'js',
|
|
678
|
+
'morph',
|
|
679
|
+
];
|
|
680
|
+
const AVAILABLE_BLOCKS = ['if', 'repeat', 'for', 'while', 'fetch'];
|
|
681
|
+
const FULL_RUNTIME_ONLY_COMMANDS = [
|
|
682
|
+
'async',
|
|
683
|
+
'make',
|
|
684
|
+
'swap',
|
|
685
|
+
'process-partials',
|
|
686
|
+
'bind',
|
|
687
|
+
'persist',
|
|
688
|
+
'default',
|
|
689
|
+
'tell',
|
|
690
|
+
'pick',
|
|
691
|
+
'unless',
|
|
692
|
+
'settle',
|
|
693
|
+
'measure',
|
|
694
|
+
'install',
|
|
695
|
+
];
|
|
696
|
+
const COMMAND_ALIASES = {
|
|
697
|
+
'push-url': 'push',
|
|
698
|
+
'replace-url': 'replace',
|
|
699
|
+
};
|
|
700
|
+
function resolveCommandKey(command) {
|
|
701
|
+
return COMMAND_ALIASES[command] ?? command;
|
|
702
|
+
}
|
|
703
|
+
function isAvailableCommand(command) {
|
|
704
|
+
return AVAILABLE_COMMANDS.includes(command);
|
|
705
|
+
}
|
|
706
|
+
function isAvailableBlock(block) {
|
|
707
|
+
return AVAILABLE_BLOCKS.includes(block);
|
|
708
|
+
}
|
|
709
|
+
function requiresFullRuntime(command) {
|
|
710
|
+
return FULL_RUNTIME_ONLY_COMMANDS.includes(command);
|
|
711
|
+
}
|
|
712
|
+
|
|
641
713
|
function generateBundleCode(config) {
|
|
642
714
|
const { name, commands, blocks = [], htmxIntegration = false, globalName = 'hyperfixi', positionalExpressions = false, parserImportPath = '../parser/hybrid', autoInit = true, esModule = true, format = 'ts', maxLoopIterations = 1000, } = config;
|
|
643
715
|
const needsStyleHelpers = commands.some(cmd => STYLE_COMMANDS.includes(cmd));
|
|
@@ -646,7 +718,7 @@ function generateBundleCode(config) {
|
|
|
646
718
|
const hasReturn = commands.includes('return');
|
|
647
719
|
const commandImpls = getCommandImplementations(format);
|
|
648
720
|
const blockImpls = getBlockImplementations(format);
|
|
649
|
-
const commandCases = commands
|
|
721
|
+
const commandCases = [...new Set(commands.map(resolveCommandKey))]
|
|
650
722
|
.filter(cmd => commandImpls[cmd])
|
|
651
723
|
.map(cmd => commandImpls[cmd])
|
|
652
724
|
.join('\n');
|
|
@@ -1106,7 +1178,7 @@ function generateBundle(config) {
|
|
|
1106
1178
|
const warnings = [];
|
|
1107
1179
|
const errors = [];
|
|
1108
1180
|
const strict = config.validation?.strict ?? false;
|
|
1109
|
-
const unknownCommands = config.commands.filter(cmd => !COMMAND_IMPLEMENTATIONS[cmd]);
|
|
1181
|
+
const unknownCommands = config.commands.filter(cmd => !COMMAND_IMPLEMENTATIONS[resolveCommandKey(cmd)]);
|
|
1110
1182
|
for (const cmd of unknownCommands) {
|
|
1111
1183
|
const error = {
|
|
1112
1184
|
type: 'unknown-command',
|
|
@@ -1133,7 +1205,7 @@ function generateBundle(config) {
|
|
|
1133
1205
|
const code = generateBundleCode(config);
|
|
1134
1206
|
return {
|
|
1135
1207
|
code,
|
|
1136
|
-
commands: config.commands.filter(cmd => COMMAND_IMPLEMENTATIONS[cmd]),
|
|
1208
|
+
commands: config.commands.filter(cmd => COMMAND_IMPLEMENTATIONS[resolveCommandKey(cmd)]),
|
|
1137
1209
|
blocks: (config.blocks || []).filter(block => BLOCK_IMPLEMENTATIONS[block]),
|
|
1138
1210
|
positional: config.positionalExpressions || false,
|
|
1139
1211
|
warnings,
|
|
@@ -2259,74 +2331,10 @@ function canUseLiteParser(commands, blocks, positional) {
|
|
|
2259
2331
|
return commands.every(cmd => liteCommands.has(cmd));
|
|
2260
2332
|
}
|
|
2261
2333
|
|
|
2262
|
-
const AVAILABLE_COMMANDS = [
|
|
2263
|
-
'toggle',
|
|
2264
|
-
'add',
|
|
2265
|
-
'remove',
|
|
2266
|
-
'removeClass',
|
|
2267
|
-
'show',
|
|
2268
|
-
'hide',
|
|
2269
|
-
'put',
|
|
2270
|
-
'append',
|
|
2271
|
-
'take',
|
|
2272
|
-
'empty',
|
|
2273
|
-
'set',
|
|
2274
|
-
'get',
|
|
2275
|
-
'increment',
|
|
2276
|
-
'decrement',
|
|
2277
|
-
'wait',
|
|
2278
|
-
'transition',
|
|
2279
|
-
'send',
|
|
2280
|
-
'trigger',
|
|
2281
|
-
'log',
|
|
2282
|
-
'call',
|
|
2283
|
-
'copy',
|
|
2284
|
-
'beep',
|
|
2285
|
-
'go',
|
|
2286
|
-
'push',
|
|
2287
|
-
'push-url',
|
|
2288
|
-
'replace',
|
|
2289
|
-
'replace-url',
|
|
2290
|
-
'focus',
|
|
2291
|
-
'blur',
|
|
2292
|
-
'return',
|
|
2293
|
-
'break',
|
|
2294
|
-
'continue',
|
|
2295
|
-
'halt',
|
|
2296
|
-
'exit',
|
|
2297
|
-
'throw',
|
|
2298
|
-
'js',
|
|
2299
|
-
'morph',
|
|
2300
|
-
];
|
|
2301
|
-
const AVAILABLE_BLOCKS = ['if', 'repeat', 'for', 'while', 'fetch'];
|
|
2302
|
-
const FULL_RUNTIME_ONLY_COMMANDS = [
|
|
2303
|
-
'async',
|
|
2304
|
-
'make',
|
|
2305
|
-
'swap',
|
|
2306
|
-
'process-partials',
|
|
2307
|
-
'bind',
|
|
2308
|
-
'persist',
|
|
2309
|
-
'default',
|
|
2310
|
-
'tell',
|
|
2311
|
-
'pick',
|
|
2312
|
-
'unless',
|
|
2313
|
-
'settle',
|
|
2314
|
-
'measure',
|
|
2315
|
-
'install',
|
|
2316
|
-
];
|
|
2317
|
-
function isAvailableCommand(command) {
|
|
2318
|
-
return AVAILABLE_COMMANDS.includes(command);
|
|
2319
|
-
}
|
|
2320
|
-
function isAvailableBlock(block) {
|
|
2321
|
-
return AVAILABLE_BLOCKS.includes(block);
|
|
2322
|
-
}
|
|
2323
|
-
function requiresFullRuntime(command) {
|
|
2324
|
-
return FULL_RUNTIME_ONLY_COMMANDS.includes(command);
|
|
2325
|
-
}
|
|
2326
|
-
|
|
2327
2334
|
exports.AVAILABLE_BLOCKS = AVAILABLE_BLOCKS;
|
|
2328
2335
|
exports.AVAILABLE_COMMANDS = AVAILABLE_COMMANDS;
|
|
2329
2336
|
exports.BLOCK_IMPLEMENTATIONS = BLOCK_IMPLEMENTATIONS;
|
|
2337
|
+
exports.COMMAND_ALIASES = COMMAND_ALIASES;
|
|
2330
2338
|
exports.COMMAND_IMPLEMENTATIONS = COMMAND_IMPLEMENTATIONS;
|
|
2331
2339
|
exports.ELEMENT_ARRAY_COMMANDS = ELEMENT_ARRAY_COMMANDS;
|
|
2332
2340
|
exports.FULL_RUNTIME_ONLY_COMMANDS = FULL_RUNTIME_ONLY_COMMANDS;
|
|
@@ -2346,4 +2354,5 @@ exports.getParserTemplate = getParserTemplate;
|
|
|
2346
2354
|
exports.isAvailableBlock = isAvailableBlock;
|
|
2347
2355
|
exports.isAvailableCommand = isAvailableCommand;
|
|
2348
2356
|
exports.requiresFullRuntime = requiresFullRuntime;
|
|
2357
|
+
exports.resolveCommandKey = resolveCommandKey;
|
|
2349
2358
|
//# sourceMappingURL=index.js.map
|
|
@@ -636,6 +636,78 @@ function getAvailableBlocks() {
|
|
|
636
636
|
const COMMAND_IMPLEMENTATIONS = COMMAND_IMPLEMENTATIONS_TS;
|
|
637
637
|
const BLOCK_IMPLEMENTATIONS = BLOCK_IMPLEMENTATIONS_TS;
|
|
638
638
|
|
|
639
|
+
const AVAILABLE_COMMANDS = [
|
|
640
|
+
'toggle',
|
|
641
|
+
'add',
|
|
642
|
+
'remove',
|
|
643
|
+
'removeClass',
|
|
644
|
+
'show',
|
|
645
|
+
'hide',
|
|
646
|
+
'put',
|
|
647
|
+
'append',
|
|
648
|
+
'take',
|
|
649
|
+
'empty',
|
|
650
|
+
'set',
|
|
651
|
+
'get',
|
|
652
|
+
'increment',
|
|
653
|
+
'decrement',
|
|
654
|
+
'wait',
|
|
655
|
+
'transition',
|
|
656
|
+
'send',
|
|
657
|
+
'trigger',
|
|
658
|
+
'log',
|
|
659
|
+
'call',
|
|
660
|
+
'copy',
|
|
661
|
+
'beep',
|
|
662
|
+
'go',
|
|
663
|
+
'push',
|
|
664
|
+
'push-url',
|
|
665
|
+
'replace',
|
|
666
|
+
'replace-url',
|
|
667
|
+
'focus',
|
|
668
|
+
'blur',
|
|
669
|
+
'return',
|
|
670
|
+
'break',
|
|
671
|
+
'continue',
|
|
672
|
+
'halt',
|
|
673
|
+
'exit',
|
|
674
|
+
'throw',
|
|
675
|
+
'js',
|
|
676
|
+
'morph',
|
|
677
|
+
];
|
|
678
|
+
const AVAILABLE_BLOCKS = ['if', 'repeat', 'for', 'while', 'fetch'];
|
|
679
|
+
const FULL_RUNTIME_ONLY_COMMANDS = [
|
|
680
|
+
'async',
|
|
681
|
+
'make',
|
|
682
|
+
'swap',
|
|
683
|
+
'process-partials',
|
|
684
|
+
'bind',
|
|
685
|
+
'persist',
|
|
686
|
+
'default',
|
|
687
|
+
'tell',
|
|
688
|
+
'pick',
|
|
689
|
+
'unless',
|
|
690
|
+
'settle',
|
|
691
|
+
'measure',
|
|
692
|
+
'install',
|
|
693
|
+
];
|
|
694
|
+
const COMMAND_ALIASES = {
|
|
695
|
+
'push-url': 'push',
|
|
696
|
+
'replace-url': 'replace',
|
|
697
|
+
};
|
|
698
|
+
function resolveCommandKey(command) {
|
|
699
|
+
return COMMAND_ALIASES[command] ?? command;
|
|
700
|
+
}
|
|
701
|
+
function isAvailableCommand(command) {
|
|
702
|
+
return AVAILABLE_COMMANDS.includes(command);
|
|
703
|
+
}
|
|
704
|
+
function isAvailableBlock(block) {
|
|
705
|
+
return AVAILABLE_BLOCKS.includes(block);
|
|
706
|
+
}
|
|
707
|
+
function requiresFullRuntime(command) {
|
|
708
|
+
return FULL_RUNTIME_ONLY_COMMANDS.includes(command);
|
|
709
|
+
}
|
|
710
|
+
|
|
639
711
|
function generateBundleCode(config) {
|
|
640
712
|
const { name, commands, blocks = [], htmxIntegration = false, globalName = 'hyperfixi', positionalExpressions = false, parserImportPath = '../parser/hybrid', autoInit = true, esModule = true, format = 'ts', maxLoopIterations = 1000, } = config;
|
|
641
713
|
const needsStyleHelpers = commands.some(cmd => STYLE_COMMANDS.includes(cmd));
|
|
@@ -644,7 +716,7 @@ function generateBundleCode(config) {
|
|
|
644
716
|
const hasReturn = commands.includes('return');
|
|
645
717
|
const commandImpls = getCommandImplementations(format);
|
|
646
718
|
const blockImpls = getBlockImplementations(format);
|
|
647
|
-
const commandCases = commands
|
|
719
|
+
const commandCases = [...new Set(commands.map(resolveCommandKey))]
|
|
648
720
|
.filter(cmd => commandImpls[cmd])
|
|
649
721
|
.map(cmd => commandImpls[cmd])
|
|
650
722
|
.join('\n');
|
|
@@ -1104,7 +1176,7 @@ function generateBundle(config) {
|
|
|
1104
1176
|
const warnings = [];
|
|
1105
1177
|
const errors = [];
|
|
1106
1178
|
const strict = config.validation?.strict ?? false;
|
|
1107
|
-
const unknownCommands = config.commands.filter(cmd => !COMMAND_IMPLEMENTATIONS[cmd]);
|
|
1179
|
+
const unknownCommands = config.commands.filter(cmd => !COMMAND_IMPLEMENTATIONS[resolveCommandKey(cmd)]);
|
|
1108
1180
|
for (const cmd of unknownCommands) {
|
|
1109
1181
|
const error = {
|
|
1110
1182
|
type: 'unknown-command',
|
|
@@ -1131,7 +1203,7 @@ function generateBundle(config) {
|
|
|
1131
1203
|
const code = generateBundleCode(config);
|
|
1132
1204
|
return {
|
|
1133
1205
|
code,
|
|
1134
|
-
commands: config.commands.filter(cmd => COMMAND_IMPLEMENTATIONS[cmd]),
|
|
1206
|
+
commands: config.commands.filter(cmd => COMMAND_IMPLEMENTATIONS[resolveCommandKey(cmd)]),
|
|
1135
1207
|
blocks: (config.blocks || []).filter(block => BLOCK_IMPLEMENTATIONS[block]),
|
|
1136
1208
|
positional: config.positionalExpressions || false,
|
|
1137
1209
|
warnings,
|
|
@@ -2257,70 +2329,5 @@ function canUseLiteParser(commands, blocks, positional) {
|
|
|
2257
2329
|
return commands.every(cmd => liteCommands.has(cmd));
|
|
2258
2330
|
}
|
|
2259
2331
|
|
|
2260
|
-
|
|
2261
|
-
'toggle',
|
|
2262
|
-
'add',
|
|
2263
|
-
'remove',
|
|
2264
|
-
'removeClass',
|
|
2265
|
-
'show',
|
|
2266
|
-
'hide',
|
|
2267
|
-
'put',
|
|
2268
|
-
'append',
|
|
2269
|
-
'take',
|
|
2270
|
-
'empty',
|
|
2271
|
-
'set',
|
|
2272
|
-
'get',
|
|
2273
|
-
'increment',
|
|
2274
|
-
'decrement',
|
|
2275
|
-
'wait',
|
|
2276
|
-
'transition',
|
|
2277
|
-
'send',
|
|
2278
|
-
'trigger',
|
|
2279
|
-
'log',
|
|
2280
|
-
'call',
|
|
2281
|
-
'copy',
|
|
2282
|
-
'beep',
|
|
2283
|
-
'go',
|
|
2284
|
-
'push',
|
|
2285
|
-
'push-url',
|
|
2286
|
-
'replace',
|
|
2287
|
-
'replace-url',
|
|
2288
|
-
'focus',
|
|
2289
|
-
'blur',
|
|
2290
|
-
'return',
|
|
2291
|
-
'break',
|
|
2292
|
-
'continue',
|
|
2293
|
-
'halt',
|
|
2294
|
-
'exit',
|
|
2295
|
-
'throw',
|
|
2296
|
-
'js',
|
|
2297
|
-
'morph',
|
|
2298
|
-
];
|
|
2299
|
-
const AVAILABLE_BLOCKS = ['if', 'repeat', 'for', 'while', 'fetch'];
|
|
2300
|
-
const FULL_RUNTIME_ONLY_COMMANDS = [
|
|
2301
|
-
'async',
|
|
2302
|
-
'make',
|
|
2303
|
-
'swap',
|
|
2304
|
-
'process-partials',
|
|
2305
|
-
'bind',
|
|
2306
|
-
'persist',
|
|
2307
|
-
'default',
|
|
2308
|
-
'tell',
|
|
2309
|
-
'pick',
|
|
2310
|
-
'unless',
|
|
2311
|
-
'settle',
|
|
2312
|
-
'measure',
|
|
2313
|
-
'install',
|
|
2314
|
-
];
|
|
2315
|
-
function isAvailableCommand(command) {
|
|
2316
|
-
return AVAILABLE_COMMANDS.includes(command);
|
|
2317
|
-
}
|
|
2318
|
-
function isAvailableBlock(block) {
|
|
2319
|
-
return AVAILABLE_BLOCKS.includes(block);
|
|
2320
|
-
}
|
|
2321
|
-
function requiresFullRuntime(command) {
|
|
2322
|
-
return FULL_RUNTIME_ONLY_COMMANDS.includes(command);
|
|
2323
|
-
}
|
|
2324
|
-
|
|
2325
|
-
export { AVAILABLE_BLOCKS, AVAILABLE_COMMANDS, BLOCK_IMPLEMENTATIONS, COMMAND_IMPLEMENTATIONS, ELEMENT_ARRAY_COMMANDS, FULL_RUNTIME_ONLY_COMMANDS, HYBRID_PARSER_TEMPLATE, LITE_PARSER_COMMANDS, LITE_PARSER_TEMPLATE, MORPH_COMMANDS, STYLE_COMMANDS, canUseLiteParser, generateBundle, generateBundleCode, getAvailableBlocks, getAvailableCommands, getBlockImplementations, getCommandImplementations, getParserTemplate, isAvailableBlock, isAvailableCommand, requiresFullRuntime };
|
|
2332
|
+
export { AVAILABLE_BLOCKS, AVAILABLE_COMMANDS, BLOCK_IMPLEMENTATIONS, COMMAND_ALIASES, COMMAND_IMPLEMENTATIONS, ELEMENT_ARRAY_COMMANDS, FULL_RUNTIME_ONLY_COMMANDS, HYBRID_PARSER_TEMPLATE, LITE_PARSER_COMMANDS, LITE_PARSER_TEMPLATE, MORPH_COMMANDS, STYLE_COMMANDS, canUseLiteParser, generateBundle, generateBundleCode, getAvailableBlocks, getAvailableCommands, getBlockImplementations, getCommandImplementations, getParserTemplate, isAvailableBlock, isAvailableCommand, requiresFullRuntime, resolveCommandKey };
|
|
2326
2333
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export declare const AVAILABLE_COMMANDS: readonly ["toggle", "add", "remove", "removeClass", "show", "hide", "put", "append", "take", "empty", "set", "get", "increment", "decrement", "wait", "transition", "send", "trigger", "log", "call", "copy", "beep", "go", "push", "push-url", "replace", "replace-url", "focus", "blur", "return", "break", "continue", "halt", "exit", "throw", "js", "morph"];
|
|
2
2
|
export declare const AVAILABLE_BLOCKS: readonly ["if", "repeat", "for", "while", "fetch"];
|
|
3
3
|
export declare const FULL_RUNTIME_ONLY_COMMANDS: readonly ["async", "make", "swap", "process-partials", "bind", "persist", "default", "tell", "pick", "unless", "settle", "measure", "install"];
|
|
4
|
+
export declare const COMMAND_ALIASES: Record<string, string>;
|
|
5
|
+
export declare function resolveCommandKey(command: string): string;
|
|
4
6
|
export type AvailableCommand = (typeof AVAILABLE_COMMANDS)[number];
|
|
5
7
|
export type AvailableBlock = (typeof AVAILABLE_BLOCKS)[number];
|
|
6
8
|
export type FullRuntimeOnlyCommand = (typeof FULL_RUNTIME_ONLY_COMMANDS)[number];
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{D as n,d as i}from"./browser-modular-D1m0Eikh.js";import"./feature-sockets-CrYvjZ4j.js";function e(n){const i=n.diagnostics;return i?.length?i.filter(n=>"unconsumed-input"===n.code).map(n=>n.message):[]}let t=null;async function a(){return t||(t=await import("./browser-modular-D1m0Eikh.js").then(function(n){return n.n})),t}class c{constructor(i={}){this._initialized=!1,this.config={confidenceThreshold:i.confidenceThreshold??n,fallbackOnLowConfidence:i.fallbackOnLowConfidence??!0}}async initialize(){await a(),this._initialized=!0}isInitialized(){return this._initialized}async transform(n,i,e){if(this.isInitialized()||await this.initialize(),i===e)return{output:n,usedSemantic:!1,confidence:1,sourceLang:i,targetLang:e};const t=await a();try{const a=t.translate(n,i,e);if(a!==n)return{output:a,usedSemantic:!0,confidence:.9,sourceLang:i,targetLang:e}}catch{}return{output:n,usedSemantic:!1,confidence:0,sourceLang:i,targetLang:e}}async parse(n,i){this.isInitialized()||await this.initialize();return(await a()).parseSemantic(n,i).node??null}async render(n,i){return(await a()).render(n,i)}async parseToAST(n,i){this.isInitialized()||await this.initialize();const e=await a(),t=e.parseSemantic(n,i);if(t.confidence>=this.config.confidenceThreshold&&t.node)try{return e.buildAST(t.node).ast}catch(n){}return null}async parseToASTWithDetails(n,i){this.isInitialized()||await this.initialize();const t=await a(),c=t.parseSemantic(n,i);if(c.confidence>=this.config.confidenceThreshold&&c.node)try{const n=t.buildAST(c.node);return{ast:n.ast,usedDirectPath:!0,confidence:c.confidence,lang:i,fallbackText:null,warnings:[...n.warnings??[],...e(c.node)]}}catch{}if(c.node&&this.config.fallbackOnLowConfidence){const n=t.render(c.node,"en");return{ast:null,usedDirectPath:!1,confidence:c.confidence,lang:i,fallbackText:n}}return{ast:null,usedDirectPath:!1,confidence:c.confidence,lang:i,fallbackText:null}}async getAllTranslations(n,i){const e=(await a()).getSupportedLanguages(),t={};for(const a of e)t[a]=await this.transform(n,i,a);return t}}export{c as SemanticGrammarBridge};
|
|
2
|
+
//# sourceMappingURL=bridge-DHj-SYm2.js.map
|