@hyperfixi/core 2.9.4 → 2.10.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/ast-utils/index.js +295 -85
- package/dist/ast-utils/index.mjs +295 -85
- package/dist/chunks/{bridge-DhmZ3Khh.js → bridge-CPNAPYAo.js} +2 -2
- package/dist/chunks/browser-modular-B0lGdcoP.js +2 -0
- package/dist/chunks/{index-DKrx4rv2.js → index-BQkkNlzO.js} +2 -2
- package/dist/commands/advanced/async.d.ts +0 -8
- package/dist/commands/advanced/js.d.ts +0 -8
- package/dist/commands/animation/measure.d.ts +0 -8
- package/dist/commands/animation/settle.d.ts +0 -8
- package/dist/commands/animation/start-view-transition.d.ts +0 -8
- package/dist/commands/animation/take.d.ts +0 -8
- package/dist/commands/animation/transition.d.ts +0 -8
- package/dist/commands/async/fetch.d.ts +0 -8
- package/dist/commands/async/wait.d.ts +0 -8
- package/dist/commands/behaviors/install.d.ts +0 -8
- package/dist/commands/content/append.d.ts +0 -8
- package/dist/commands/content/prepend.d.ts +0 -8
- package/dist/commands/control-flow/break.d.ts +0 -8
- package/dist/commands/control-flow/continue.d.ts +0 -8
- package/dist/commands/control-flow/exit.d.ts +0 -8
- package/dist/commands/control-flow/halt.d.ts +0 -8
- package/dist/commands/control-flow/if.d.ts +0 -8
- package/dist/commands/control-flow/repeat.d.ts +0 -8
- package/dist/commands/control-flow/return.d.ts +0 -8
- package/dist/commands/control-flow/throw.d.ts +0 -8
- package/dist/commands/data/clear.d.ts +0 -8
- package/dist/commands/data/default.d.ts +0 -8
- package/dist/commands/data/get.d.ts +0 -8
- package/dist/commands/data/increment.d.ts +0 -8
- package/dist/commands/data/set.d.ts +0 -8
- package/dist/commands/decorators/index.d.ts +2 -8
- package/dist/commands/dom/add.d.ts +0 -8
- package/dist/commands/dom/close.d.ts +0 -8
- package/dist/commands/dom/empty.d.ts +0 -8
- package/dist/commands/dom/hide.d.ts +0 -8
- package/dist/commands/dom/make.d.ts +0 -8
- package/dist/commands/dom/open.d.ts +0 -8
- package/dist/commands/dom/process-partials.d.ts +0 -8
- package/dist/commands/dom/put.d.ts +0 -8
- package/dist/commands/dom/remove.d.ts +0 -8
- package/dist/commands/dom/reset.d.ts +0 -8
- package/dist/commands/dom/select.d.ts +0 -8
- package/dist/commands/dom/show.d.ts +0 -8
- package/dist/commands/dom/swap.d.ts +2 -18
- package/dist/commands/dom/toggle.d.ts +0 -8
- package/dist/commands/events/trigger.d.ts +0 -8
- package/dist/commands/execution/blur.d.ts +0 -8
- package/dist/commands/execution/call.d.ts +0 -8
- package/dist/commands/execution/focus.d.ts +0 -8
- package/dist/commands/execution/pseudo-command.d.ts +0 -8
- package/dist/commands/index.js +82 -23
- package/dist/commands/index.mjs +82 -23
- package/dist/commands/navigation/go.d.ts +0 -8
- package/dist/commands/navigation/push-url.d.ts +0 -8
- package/dist/commands/navigation/scroll-to.d.ts +0 -8
- package/dist/commands/templates/render.d.ts +0 -8
- package/dist/commands/utility/beep.d.ts +0 -8
- package/dist/commands/utility/breakpoint.d.ts +0 -8
- package/dist/commands/utility/copy.d.ts +0 -8
- package/dist/commands/utility/log.d.ts +0 -8
- package/dist/commands/utility/pick.d.ts +0 -8
- package/dist/commands/utility/tell.d.ts +0 -8
- 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-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 +441 -143
- package/dist/index.min.js +1 -1
- package/dist/index.mjs +441 -143
- 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-multilingual.js +1 -1
- package/dist/parser/command-parsers/dom-commands.d.ts +1 -0
- package/dist/parser/full-parser.js +47 -1
- package/dist/parser/full-parser.mjs +47 -1
- package/dist/reference/index.js +6 -5
- package/dist/reference/index.mjs +6 -5
- package/dist/registry/index.js +50 -6
- package/dist/registry/index.mjs +50 -6
- package/dist/runtime/command-adapter.d.ts +8 -8
- package/package.json +5 -5
- package/dist/chunks/browser-modular-BllAMlht.js +0 -2
|
@@ -3,6 +3,7 @@ import type { Token } from '../../types/core';
|
|
|
3
3
|
export declare function parseRemoveCommand(ctx: ParserContext, identifierNode: IdentifierNode): import("../..").CommandNode;
|
|
4
4
|
export declare function parseToggleCommand(ctx: ParserContext, identifierNode: IdentifierNode): import("../..").CommandNode;
|
|
5
5
|
export declare function parseTakeCommand(ctx: ParserContext, identifierNode: IdentifierNode): import("../..").CommandNode;
|
|
6
|
+
export declare function parseProcessCommand(ctx: ParserContext, identifierNode: IdentifierNode): import("../..").CommandNode | null;
|
|
6
7
|
export declare function parseAddCommand(ctx: ParserContext, commandToken: Token): import("../..").CommandNode;
|
|
7
8
|
export declare function parsePutCommand(ctx: ParserContext, identifierNode: IdentifierNode): import("../..").CommandNode | null;
|
|
8
9
|
export declare function parseSwapCommand(ctx: ParserContext, identifierNode: IdentifierNode): import("../..").CommandNode;
|
|
@@ -3820,6 +3820,40 @@ function parseTakeCommand(ctx, identifierNode) {
|
|
|
3820
3820
|
.endingAt(ctx.getPosition())
|
|
3821
3821
|
.build();
|
|
3822
3822
|
}
|
|
3823
|
+
function consumeViewTransitionTail(ctx, args) {
|
|
3824
|
+
if (!ctx.check('using')) {
|
|
3825
|
+
return false;
|
|
3826
|
+
}
|
|
3827
|
+
ctx.advance();
|
|
3828
|
+
if (!ctx.match('view')) {
|
|
3829
|
+
throw new Error("expected 'view transition' after 'using'");
|
|
3830
|
+
}
|
|
3831
|
+
if (!ctx.match('transition')) {
|
|
3832
|
+
throw new Error("expected 'transition' after 'using view'");
|
|
3833
|
+
}
|
|
3834
|
+
args.push(ctx.createIdentifier('using'));
|
|
3835
|
+
args.push(ctx.createIdentifier('view'));
|
|
3836
|
+
args.push(ctx.createIdentifier('transition'));
|
|
3837
|
+
return true;
|
|
3838
|
+
}
|
|
3839
|
+
function parseProcessCommand(ctx, identifierNode) {
|
|
3840
|
+
if (!ctx.check('partials')) {
|
|
3841
|
+
return null;
|
|
3842
|
+
}
|
|
3843
|
+
const args = [];
|
|
3844
|
+
consumeKeywordToArgs(ctx, 'partials', args);
|
|
3845
|
+
if (consumeKeywordToArgs(ctx, KEYWORDS.IN, args)) {
|
|
3846
|
+
const contentArg = parseOneArgument(ctx, ['using']);
|
|
3847
|
+
if (contentArg) {
|
|
3848
|
+
args.push(contentArg);
|
|
3849
|
+
}
|
|
3850
|
+
}
|
|
3851
|
+
consumeViewTransitionTail(ctx, args);
|
|
3852
|
+
return CommandNodeBuilder.fromIdentifier(identifierNode)
|
|
3853
|
+
.withArgs(...args)
|
|
3854
|
+
.endingAt(ctx.getPosition())
|
|
3855
|
+
.build();
|
|
3856
|
+
}
|
|
3823
3857
|
function parseAddCommand(ctx, commandToken) {
|
|
3824
3858
|
const args = [];
|
|
3825
3859
|
if (ctx.match('{')) {
|
|
@@ -3941,6 +3975,7 @@ function parseSwapCommand(ctx, identifierNode) {
|
|
|
3941
3975
|
args.push(contentExpr);
|
|
3942
3976
|
}
|
|
3943
3977
|
}
|
|
3978
|
+
consumeViewTransitionTail(ctx, args);
|
|
3944
3979
|
return CommandNodeBuilder.fromIdentifier(identifierNode)
|
|
3945
3980
|
.withArgs(...args)
|
|
3946
3981
|
.endingAt(ctx.getPosition())
|
|
@@ -4454,6 +4489,9 @@ function parseCompoundCommand(ctx, identifierNode) {
|
|
|
4454
4489
|
case 'swap':
|
|
4455
4490
|
case 'morph':
|
|
4456
4491
|
return parseSwapCommand(ctx, identifierNode);
|
|
4492
|
+
case 'process':
|
|
4493
|
+
return (parseProcessCommand(ctx, identifierNode) ??
|
|
4494
|
+
parseRegularCommand(ctx, identifierNode));
|
|
4457
4495
|
default:
|
|
4458
4496
|
return parseRegularCommand(ctx, identifierNode);
|
|
4459
4497
|
}
|
|
@@ -4785,6 +4823,9 @@ function parseTellCommand(ctx, identifierNode) {
|
|
|
4785
4823
|
if (!target) {
|
|
4786
4824
|
throw new Error('tell command requires a target expression');
|
|
4787
4825
|
}
|
|
4826
|
+
if (ctx.check(KEYWORDS.TO)) {
|
|
4827
|
+
ctx.advance();
|
|
4828
|
+
}
|
|
4788
4829
|
const commands = [];
|
|
4789
4830
|
while (!ctx.isAtEnd()) {
|
|
4790
4831
|
if (ctx.checkIsCommand()) {
|
|
@@ -4804,7 +4845,11 @@ function parseTellCommand(ctx, identifierNode) {
|
|
|
4804
4845
|
if (ctx.match(KEYWORDS.AND) || ctx.match(KEYWORDS.THEN)) {
|
|
4805
4846
|
continue;
|
|
4806
4847
|
}
|
|
4807
|
-
if (ctx.check(KEYWORDS.ELSE)
|
|
4848
|
+
if (ctx.check(KEYWORDS.ELSE)) {
|
|
4849
|
+
break;
|
|
4850
|
+
}
|
|
4851
|
+
if (ctx.check(KEYWORDS.END)) {
|
|
4852
|
+
ctx.advance();
|
|
4808
4853
|
break;
|
|
4809
4854
|
}
|
|
4810
4855
|
if (ctx.checkIsCommand()) {
|
|
@@ -7142,6 +7187,7 @@ class Parser {
|
|
|
7142
7187
|
'js',
|
|
7143
7188
|
'tell',
|
|
7144
7189
|
'fetch',
|
|
7190
|
+
'process',
|
|
7145
7191
|
];
|
|
7146
7192
|
if (this.semanticAdapter && !skipSemanticParsing.includes(commandName.toLowerCase())) {
|
|
7147
7193
|
const remainingInput = this.getRemainingInput();
|
|
@@ -3818,6 +3818,40 @@ function parseTakeCommand(ctx, identifierNode) {
|
|
|
3818
3818
|
.endingAt(ctx.getPosition())
|
|
3819
3819
|
.build();
|
|
3820
3820
|
}
|
|
3821
|
+
function consumeViewTransitionTail(ctx, args) {
|
|
3822
|
+
if (!ctx.check('using')) {
|
|
3823
|
+
return false;
|
|
3824
|
+
}
|
|
3825
|
+
ctx.advance();
|
|
3826
|
+
if (!ctx.match('view')) {
|
|
3827
|
+
throw new Error("expected 'view transition' after 'using'");
|
|
3828
|
+
}
|
|
3829
|
+
if (!ctx.match('transition')) {
|
|
3830
|
+
throw new Error("expected 'transition' after 'using view'");
|
|
3831
|
+
}
|
|
3832
|
+
args.push(ctx.createIdentifier('using'));
|
|
3833
|
+
args.push(ctx.createIdentifier('view'));
|
|
3834
|
+
args.push(ctx.createIdentifier('transition'));
|
|
3835
|
+
return true;
|
|
3836
|
+
}
|
|
3837
|
+
function parseProcessCommand(ctx, identifierNode) {
|
|
3838
|
+
if (!ctx.check('partials')) {
|
|
3839
|
+
return null;
|
|
3840
|
+
}
|
|
3841
|
+
const args = [];
|
|
3842
|
+
consumeKeywordToArgs(ctx, 'partials', args);
|
|
3843
|
+
if (consumeKeywordToArgs(ctx, KEYWORDS.IN, args)) {
|
|
3844
|
+
const contentArg = parseOneArgument(ctx, ['using']);
|
|
3845
|
+
if (contentArg) {
|
|
3846
|
+
args.push(contentArg);
|
|
3847
|
+
}
|
|
3848
|
+
}
|
|
3849
|
+
consumeViewTransitionTail(ctx, args);
|
|
3850
|
+
return CommandNodeBuilder.fromIdentifier(identifierNode)
|
|
3851
|
+
.withArgs(...args)
|
|
3852
|
+
.endingAt(ctx.getPosition())
|
|
3853
|
+
.build();
|
|
3854
|
+
}
|
|
3821
3855
|
function parseAddCommand(ctx, commandToken) {
|
|
3822
3856
|
const args = [];
|
|
3823
3857
|
if (ctx.match('{')) {
|
|
@@ -3939,6 +3973,7 @@ function parseSwapCommand(ctx, identifierNode) {
|
|
|
3939
3973
|
args.push(contentExpr);
|
|
3940
3974
|
}
|
|
3941
3975
|
}
|
|
3976
|
+
consumeViewTransitionTail(ctx, args);
|
|
3942
3977
|
return CommandNodeBuilder.fromIdentifier(identifierNode)
|
|
3943
3978
|
.withArgs(...args)
|
|
3944
3979
|
.endingAt(ctx.getPosition())
|
|
@@ -4452,6 +4487,9 @@ function parseCompoundCommand(ctx, identifierNode) {
|
|
|
4452
4487
|
case 'swap':
|
|
4453
4488
|
case 'morph':
|
|
4454
4489
|
return parseSwapCommand(ctx, identifierNode);
|
|
4490
|
+
case 'process':
|
|
4491
|
+
return (parseProcessCommand(ctx, identifierNode) ??
|
|
4492
|
+
parseRegularCommand(ctx, identifierNode));
|
|
4455
4493
|
default:
|
|
4456
4494
|
return parseRegularCommand(ctx, identifierNode);
|
|
4457
4495
|
}
|
|
@@ -4783,6 +4821,9 @@ function parseTellCommand(ctx, identifierNode) {
|
|
|
4783
4821
|
if (!target) {
|
|
4784
4822
|
throw new Error('tell command requires a target expression');
|
|
4785
4823
|
}
|
|
4824
|
+
if (ctx.check(KEYWORDS.TO)) {
|
|
4825
|
+
ctx.advance();
|
|
4826
|
+
}
|
|
4786
4827
|
const commands = [];
|
|
4787
4828
|
while (!ctx.isAtEnd()) {
|
|
4788
4829
|
if (ctx.checkIsCommand()) {
|
|
@@ -4802,7 +4843,11 @@ function parseTellCommand(ctx, identifierNode) {
|
|
|
4802
4843
|
if (ctx.match(KEYWORDS.AND) || ctx.match(KEYWORDS.THEN)) {
|
|
4803
4844
|
continue;
|
|
4804
4845
|
}
|
|
4805
|
-
if (ctx.check(KEYWORDS.ELSE)
|
|
4846
|
+
if (ctx.check(KEYWORDS.ELSE)) {
|
|
4847
|
+
break;
|
|
4848
|
+
}
|
|
4849
|
+
if (ctx.check(KEYWORDS.END)) {
|
|
4850
|
+
ctx.advance();
|
|
4806
4851
|
break;
|
|
4807
4852
|
}
|
|
4808
4853
|
if (ctx.checkIsCommand()) {
|
|
@@ -7140,6 +7185,7 @@ class Parser {
|
|
|
7140
7185
|
'js',
|
|
7141
7186
|
'tell',
|
|
7142
7187
|
'fetch',
|
|
7188
|
+
'process',
|
|
7143
7189
|
];
|
|
7144
7190
|
if (this.semanticAdapter && !skipSemanticParsing.includes(commandName.toLowerCase())) {
|
|
7145
7191
|
const remainingInput = this.getRemainingInput();
|
package/dist/reference/index.js
CHANGED
|
@@ -150,14 +150,15 @@ const commands = {
|
|
|
150
150
|
examples: ['morph result into #content', 'morph "<div>New</div>" into me'],
|
|
151
151
|
},
|
|
152
152
|
processPartials: {
|
|
153
|
-
name: '
|
|
154
|
-
description: 'Process partial
|
|
155
|
-
syntax: '
|
|
153
|
+
name: 'process partials',
|
|
154
|
+
description: 'Process <hx-partial> elements for multi-target swaps',
|
|
155
|
+
syntax: 'process partials in <content> [using view transition]',
|
|
156
156
|
category: 'dom',
|
|
157
157
|
availability: 'full',
|
|
158
158
|
examples: [
|
|
159
|
-
'
|
|
160
|
-
'
|
|
159
|
+
'process partials in it',
|
|
160
|
+
'process partials in fetchedHtml',
|
|
161
|
+
'process partials in it using view transition',
|
|
161
162
|
],
|
|
162
163
|
},
|
|
163
164
|
wait: {
|
package/dist/reference/index.mjs
CHANGED
|
@@ -148,14 +148,15 @@ const commands = {
|
|
|
148
148
|
examples: ['morph result into #content', 'morph "<div>New</div>" into me'],
|
|
149
149
|
},
|
|
150
150
|
processPartials: {
|
|
151
|
-
name: '
|
|
152
|
-
description: 'Process partial
|
|
153
|
-
syntax: '
|
|
151
|
+
name: 'process partials',
|
|
152
|
+
description: 'Process <hx-partial> elements for multi-target swaps',
|
|
153
|
+
syntax: 'process partials in <content> [using view transition]',
|
|
154
154
|
category: 'dom',
|
|
155
155
|
availability: 'full',
|
|
156
156
|
examples: [
|
|
157
|
-
'
|
|
158
|
-
'
|
|
157
|
+
'process partials in it',
|
|
158
|
+
'process partials in fetchedHtml',
|
|
159
|
+
'process partials in it using view transition',
|
|
159
160
|
],
|
|
160
161
|
},
|
|
161
162
|
wait: {
|
package/dist/registry/index.js
CHANGED
|
@@ -5512,6 +5512,40 @@ function parseTakeCommand(ctx, identifierNode) {
|
|
|
5512
5512
|
.endingAt(ctx.getPosition())
|
|
5513
5513
|
.build();
|
|
5514
5514
|
}
|
|
5515
|
+
function consumeViewTransitionTail(ctx, args) {
|
|
5516
|
+
if (!ctx.check('using')) {
|
|
5517
|
+
return false;
|
|
5518
|
+
}
|
|
5519
|
+
ctx.advance();
|
|
5520
|
+
if (!ctx.match('view')) {
|
|
5521
|
+
throw new Error("expected 'view transition' after 'using'");
|
|
5522
|
+
}
|
|
5523
|
+
if (!ctx.match('transition')) {
|
|
5524
|
+
throw new Error("expected 'transition' after 'using view'");
|
|
5525
|
+
}
|
|
5526
|
+
args.push(ctx.createIdentifier('using'));
|
|
5527
|
+
args.push(ctx.createIdentifier('view'));
|
|
5528
|
+
args.push(ctx.createIdentifier('transition'));
|
|
5529
|
+
return true;
|
|
5530
|
+
}
|
|
5531
|
+
function parseProcessCommand(ctx, identifierNode) {
|
|
5532
|
+
if (!ctx.check('partials')) {
|
|
5533
|
+
return null;
|
|
5534
|
+
}
|
|
5535
|
+
const args = [];
|
|
5536
|
+
consumeKeywordToArgs(ctx, 'partials', args);
|
|
5537
|
+
if (consumeKeywordToArgs(ctx, KEYWORDS.IN, args)) {
|
|
5538
|
+
const contentArg = parseOneArgument(ctx, ['using']);
|
|
5539
|
+
if (contentArg) {
|
|
5540
|
+
args.push(contentArg);
|
|
5541
|
+
}
|
|
5542
|
+
}
|
|
5543
|
+
consumeViewTransitionTail(ctx, args);
|
|
5544
|
+
return CommandNodeBuilder.fromIdentifier(identifierNode)
|
|
5545
|
+
.withArgs(...args)
|
|
5546
|
+
.endingAt(ctx.getPosition())
|
|
5547
|
+
.build();
|
|
5548
|
+
}
|
|
5515
5549
|
function parseAddCommand(ctx, commandToken) {
|
|
5516
5550
|
const args = [];
|
|
5517
5551
|
if (ctx.match('{')) {
|
|
@@ -5633,6 +5667,7 @@ function parseSwapCommand(ctx, identifierNode) {
|
|
|
5633
5667
|
args.push(contentExpr);
|
|
5634
5668
|
}
|
|
5635
5669
|
}
|
|
5670
|
+
consumeViewTransitionTail(ctx, args);
|
|
5636
5671
|
return CommandNodeBuilder.fromIdentifier(identifierNode)
|
|
5637
5672
|
.withArgs(...args)
|
|
5638
5673
|
.endingAt(ctx.getPosition())
|
|
@@ -6146,6 +6181,9 @@ function parseCompoundCommand(ctx, identifierNode) {
|
|
|
6146
6181
|
case 'swap':
|
|
6147
6182
|
case 'morph':
|
|
6148
6183
|
return parseSwapCommand(ctx, identifierNode);
|
|
6184
|
+
case 'process':
|
|
6185
|
+
return (parseProcessCommand(ctx, identifierNode) ??
|
|
6186
|
+
parseRegularCommand(ctx, identifierNode));
|
|
6149
6187
|
default:
|
|
6150
6188
|
return parseRegularCommand(ctx, identifierNode);
|
|
6151
6189
|
}
|
|
@@ -6477,6 +6515,9 @@ function parseTellCommand(ctx, identifierNode) {
|
|
|
6477
6515
|
if (!target) {
|
|
6478
6516
|
throw new Error('tell command requires a target expression');
|
|
6479
6517
|
}
|
|
6518
|
+
if (ctx.check(KEYWORDS.TO)) {
|
|
6519
|
+
ctx.advance();
|
|
6520
|
+
}
|
|
6480
6521
|
const commands = [];
|
|
6481
6522
|
while (!ctx.isAtEnd()) {
|
|
6482
6523
|
if (ctx.checkIsCommand()) {
|
|
@@ -6496,7 +6537,11 @@ function parseTellCommand(ctx, identifierNode) {
|
|
|
6496
6537
|
if (ctx.match(KEYWORDS.AND) || ctx.match(KEYWORDS.THEN)) {
|
|
6497
6538
|
continue;
|
|
6498
6539
|
}
|
|
6499
|
-
if (ctx.check(KEYWORDS.ELSE)
|
|
6540
|
+
if (ctx.check(KEYWORDS.ELSE)) {
|
|
6541
|
+
break;
|
|
6542
|
+
}
|
|
6543
|
+
if (ctx.check(KEYWORDS.END)) {
|
|
6544
|
+
ctx.advance();
|
|
6500
6545
|
break;
|
|
6501
6546
|
}
|
|
6502
6547
|
if (ctx.checkIsCommand()) {
|
|
@@ -8834,6 +8879,7 @@ class Parser {
|
|
|
8834
8879
|
'js',
|
|
8835
8880
|
'tell',
|
|
8836
8881
|
'fetch',
|
|
8882
|
+
'process',
|
|
8837
8883
|
];
|
|
8838
8884
|
if (this.semanticAdapter && !skipSemanticParsing.includes(commandName.toLowerCase())) {
|
|
8839
8885
|
const remainingInput = this.getRemainingInput();
|
|
@@ -10870,7 +10916,7 @@ class CommandAdapterV2 {
|
|
|
10870
10916
|
return {
|
|
10871
10917
|
description: this.impl.metadata?.description || '',
|
|
10872
10918
|
examples: this.impl.metadata?.examples || [],
|
|
10873
|
-
syntax:
|
|
10919
|
+
syntax: typeof syntax === 'string' ? syntax : syntax ? syntax.join(' | ') : '',
|
|
10874
10920
|
};
|
|
10875
10921
|
}
|
|
10876
10922
|
async execute(context, ...args) {
|
|
@@ -10946,10 +10992,8 @@ class CommandAdapterV2 {
|
|
|
10946
10992
|
}
|
|
10947
10993
|
}
|
|
10948
10994
|
validate(input) {
|
|
10949
|
-
|
|
10950
|
-
|
|
10951
|
-
}
|
|
10952
|
-
return { isValid: true, errors: [], suggestions: [] };
|
|
10995
|
+
const isValid = this.impl.validate ? this.impl.validate(input) : true;
|
|
10996
|
+
return { isValid, errors: [], suggestions: [] };
|
|
10953
10997
|
}
|
|
10954
10998
|
}
|
|
10955
10999
|
class CommandRegistryV2 {
|
package/dist/registry/index.mjs
CHANGED
|
@@ -5510,6 +5510,40 @@ function parseTakeCommand(ctx, identifierNode) {
|
|
|
5510
5510
|
.endingAt(ctx.getPosition())
|
|
5511
5511
|
.build();
|
|
5512
5512
|
}
|
|
5513
|
+
function consumeViewTransitionTail(ctx, args) {
|
|
5514
|
+
if (!ctx.check('using')) {
|
|
5515
|
+
return false;
|
|
5516
|
+
}
|
|
5517
|
+
ctx.advance();
|
|
5518
|
+
if (!ctx.match('view')) {
|
|
5519
|
+
throw new Error("expected 'view transition' after 'using'");
|
|
5520
|
+
}
|
|
5521
|
+
if (!ctx.match('transition')) {
|
|
5522
|
+
throw new Error("expected 'transition' after 'using view'");
|
|
5523
|
+
}
|
|
5524
|
+
args.push(ctx.createIdentifier('using'));
|
|
5525
|
+
args.push(ctx.createIdentifier('view'));
|
|
5526
|
+
args.push(ctx.createIdentifier('transition'));
|
|
5527
|
+
return true;
|
|
5528
|
+
}
|
|
5529
|
+
function parseProcessCommand(ctx, identifierNode) {
|
|
5530
|
+
if (!ctx.check('partials')) {
|
|
5531
|
+
return null;
|
|
5532
|
+
}
|
|
5533
|
+
const args = [];
|
|
5534
|
+
consumeKeywordToArgs(ctx, 'partials', args);
|
|
5535
|
+
if (consumeKeywordToArgs(ctx, KEYWORDS.IN, args)) {
|
|
5536
|
+
const contentArg = parseOneArgument(ctx, ['using']);
|
|
5537
|
+
if (contentArg) {
|
|
5538
|
+
args.push(contentArg);
|
|
5539
|
+
}
|
|
5540
|
+
}
|
|
5541
|
+
consumeViewTransitionTail(ctx, args);
|
|
5542
|
+
return CommandNodeBuilder.fromIdentifier(identifierNode)
|
|
5543
|
+
.withArgs(...args)
|
|
5544
|
+
.endingAt(ctx.getPosition())
|
|
5545
|
+
.build();
|
|
5546
|
+
}
|
|
5513
5547
|
function parseAddCommand(ctx, commandToken) {
|
|
5514
5548
|
const args = [];
|
|
5515
5549
|
if (ctx.match('{')) {
|
|
@@ -5631,6 +5665,7 @@ function parseSwapCommand(ctx, identifierNode) {
|
|
|
5631
5665
|
args.push(contentExpr);
|
|
5632
5666
|
}
|
|
5633
5667
|
}
|
|
5668
|
+
consumeViewTransitionTail(ctx, args);
|
|
5634
5669
|
return CommandNodeBuilder.fromIdentifier(identifierNode)
|
|
5635
5670
|
.withArgs(...args)
|
|
5636
5671
|
.endingAt(ctx.getPosition())
|
|
@@ -6144,6 +6179,9 @@ function parseCompoundCommand(ctx, identifierNode) {
|
|
|
6144
6179
|
case 'swap':
|
|
6145
6180
|
case 'morph':
|
|
6146
6181
|
return parseSwapCommand(ctx, identifierNode);
|
|
6182
|
+
case 'process':
|
|
6183
|
+
return (parseProcessCommand(ctx, identifierNode) ??
|
|
6184
|
+
parseRegularCommand(ctx, identifierNode));
|
|
6147
6185
|
default:
|
|
6148
6186
|
return parseRegularCommand(ctx, identifierNode);
|
|
6149
6187
|
}
|
|
@@ -6475,6 +6513,9 @@ function parseTellCommand(ctx, identifierNode) {
|
|
|
6475
6513
|
if (!target) {
|
|
6476
6514
|
throw new Error('tell command requires a target expression');
|
|
6477
6515
|
}
|
|
6516
|
+
if (ctx.check(KEYWORDS.TO)) {
|
|
6517
|
+
ctx.advance();
|
|
6518
|
+
}
|
|
6478
6519
|
const commands = [];
|
|
6479
6520
|
while (!ctx.isAtEnd()) {
|
|
6480
6521
|
if (ctx.checkIsCommand()) {
|
|
@@ -6494,7 +6535,11 @@ function parseTellCommand(ctx, identifierNode) {
|
|
|
6494
6535
|
if (ctx.match(KEYWORDS.AND) || ctx.match(KEYWORDS.THEN)) {
|
|
6495
6536
|
continue;
|
|
6496
6537
|
}
|
|
6497
|
-
if (ctx.check(KEYWORDS.ELSE)
|
|
6538
|
+
if (ctx.check(KEYWORDS.ELSE)) {
|
|
6539
|
+
break;
|
|
6540
|
+
}
|
|
6541
|
+
if (ctx.check(KEYWORDS.END)) {
|
|
6542
|
+
ctx.advance();
|
|
6498
6543
|
break;
|
|
6499
6544
|
}
|
|
6500
6545
|
if (ctx.checkIsCommand()) {
|
|
@@ -8832,6 +8877,7 @@ class Parser {
|
|
|
8832
8877
|
'js',
|
|
8833
8878
|
'tell',
|
|
8834
8879
|
'fetch',
|
|
8880
|
+
'process',
|
|
8835
8881
|
];
|
|
8836
8882
|
if (this.semanticAdapter && !skipSemanticParsing.includes(commandName.toLowerCase())) {
|
|
8837
8883
|
const remainingInput = this.getRemainingInput();
|
|
@@ -10868,7 +10914,7 @@ class CommandAdapterV2 {
|
|
|
10868
10914
|
return {
|
|
10869
10915
|
description: this.impl.metadata?.description || '',
|
|
10870
10916
|
examples: this.impl.metadata?.examples || [],
|
|
10871
|
-
syntax:
|
|
10917
|
+
syntax: typeof syntax === 'string' ? syntax : syntax ? syntax.join(' | ') : '',
|
|
10872
10918
|
};
|
|
10873
10919
|
}
|
|
10874
10920
|
async execute(context, ...args) {
|
|
@@ -10944,10 +10990,8 @@ class CommandAdapterV2 {
|
|
|
10944
10990
|
}
|
|
10945
10991
|
}
|
|
10946
10992
|
validate(input) {
|
|
10947
|
-
|
|
10948
|
-
|
|
10949
|
-
}
|
|
10950
|
-
return { isValid: true, errors: [], suggestions: [] };
|
|
10993
|
+
const isValid = this.impl.validate ? this.impl.validate(input) : true;
|
|
10994
|
+
return { isValid, errors: [], suggestions: [] };
|
|
10951
10995
|
}
|
|
10952
10996
|
}
|
|
10953
10997
|
class CommandRegistryV2 {
|
|
@@ -7,15 +7,15 @@ export interface RuntimeCommand {
|
|
|
7
7
|
validate?(input: unknown): ValidationResult<unknown>;
|
|
8
8
|
metadata?: {
|
|
9
9
|
description: string;
|
|
10
|
-
examples: string[];
|
|
10
|
+
examples: readonly string[];
|
|
11
11
|
syntax: string;
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
14
|
export interface CommandMetadata {
|
|
15
15
|
description?: string;
|
|
16
|
-
examples?: string[];
|
|
17
|
-
syntax?: string | string[];
|
|
18
|
-
aliases?: string[];
|
|
16
|
+
examples?: readonly string[];
|
|
17
|
+
syntax?: string | readonly string[];
|
|
18
|
+
aliases?: readonly string[];
|
|
19
19
|
[extra: string]: unknown;
|
|
20
20
|
}
|
|
21
21
|
export interface CommandRawInput {
|
|
@@ -28,8 +28,8 @@ export interface CommandWithParseInput {
|
|
|
28
28
|
parseInput?(raw: CommandRawInput, evaluator: {
|
|
29
29
|
evaluate(node: ASTNode, context: ExecutionContext): Promise<unknown>;
|
|
30
30
|
}, context: ExecutionContext): Promise<unknown>;
|
|
31
|
-
execute(input: unknown, context: TypedExecutionContext):
|
|
32
|
-
validate?(input: unknown):
|
|
31
|
+
execute(input: unknown, context: TypedExecutionContext): unknown;
|
|
32
|
+
validate?(input: unknown): boolean;
|
|
33
33
|
metadata?: CommandMetadata;
|
|
34
34
|
}
|
|
35
35
|
export declare class ContextBridge {
|
|
@@ -45,7 +45,7 @@ export declare class CommandAdapterV2 implements RuntimeCommand {
|
|
|
45
45
|
get name(): string;
|
|
46
46
|
get metadata(): {
|
|
47
47
|
description: string;
|
|
48
|
-
examples: string[];
|
|
48
|
+
examples: readonly string[];
|
|
49
49
|
syntax: string;
|
|
50
50
|
};
|
|
51
51
|
execute(context: ExecutionContext, ...args: unknown[]): Promise<unknown>;
|
|
@@ -58,7 +58,7 @@ export declare class CommandRegistryV2 {
|
|
|
58
58
|
constructor(_legacySharedEvaluator?: unknown, hookRegistry?: HookRegistry);
|
|
59
59
|
setHookRegistry(registry: HookRegistry): void;
|
|
60
60
|
getHookRegistry(): HookRegistry | undefined;
|
|
61
|
-
register(impl:
|
|
61
|
+
register(impl: CommandWithParseInput): void;
|
|
62
62
|
getAdapter(name: string): CommandAdapterV2 | undefined;
|
|
63
63
|
has(name: string): boolean;
|
|
64
64
|
getCommandNames(): string[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperfixi/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.0",
|
|
4
4
|
"description": "Multilingual, tree-shakeable hyperscript",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -284,14 +284,14 @@
|
|
|
284
284
|
"access": "public"
|
|
285
285
|
},
|
|
286
286
|
"dependencies": {
|
|
287
|
-
"@lokascript/intent": "^2.
|
|
288
|
-
"@lokascript/semantic": "^2.
|
|
287
|
+
"@lokascript/intent": "^2.10.0",
|
|
288
|
+
"@lokascript/semantic": "^2.10.0",
|
|
289
289
|
"morphlex": "^1.4.0",
|
|
290
290
|
"tslib": "^2.8.1"
|
|
291
291
|
},
|
|
292
292
|
"peerDependencies": {
|
|
293
|
-
"@hyperfixi/patterns-reference": "^2.
|
|
294
|
-
"@lokascript/framework": "^2.
|
|
293
|
+
"@hyperfixi/patterns-reference": "^2.10.0",
|
|
294
|
+
"@lokascript/framework": "^2.10.0"
|
|
295
295
|
},
|
|
296
296
|
"peerDependenciesMeta": {
|
|
297
297
|
"@hyperfixi/patterns-reference": {
|