@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
|
@@ -6,10 +6,6 @@ export interface CloseCommandInput {
|
|
|
6
6
|
}
|
|
7
7
|
export declare class CloseCommand implements DecoratedCommand {
|
|
8
8
|
static readonly metadata: {
|
|
9
|
-
isBlocking: boolean;
|
|
10
|
-
hasBody: boolean;
|
|
11
|
-
version: string;
|
|
12
|
-
} & {
|
|
13
9
|
readonly description: "Close a dialog, details element, or popover";
|
|
14
10
|
readonly syntax: readonly ["close", "close <target>"];
|
|
15
11
|
readonly examples: readonly ["close", "close #myDialog", "close #details", "close #popup"];
|
|
@@ -18,10 +14,6 @@ export declare class CloseCommand implements DecoratedCommand {
|
|
|
18
14
|
readonly compatibility: "standard";
|
|
19
15
|
};
|
|
20
16
|
get metadata(): {
|
|
21
|
-
isBlocking: boolean;
|
|
22
|
-
hasBody: boolean;
|
|
23
|
-
version: string;
|
|
24
|
-
} & {
|
|
25
17
|
readonly description: "Close a dialog, details element, or popover";
|
|
26
18
|
readonly syntax: readonly ["close", "close <target>"];
|
|
27
19
|
readonly examples: readonly ["close", "close #myDialog", "close #details", "close #popup"];
|
|
@@ -6,10 +6,6 @@ export interface EmptyCommandInput {
|
|
|
6
6
|
}
|
|
7
7
|
export declare class EmptyCommand implements DecoratedCommand {
|
|
8
8
|
static readonly metadata: {
|
|
9
|
-
isBlocking: boolean;
|
|
10
|
-
hasBody: boolean;
|
|
11
|
-
version: string;
|
|
12
|
-
} & {
|
|
13
9
|
readonly description: "Remove all children from an element (sets innerHTML to empty)";
|
|
14
10
|
readonly syntax: readonly ["empty", "empty <target>", "empty the <target>"];
|
|
15
11
|
readonly examples: readonly ["empty me", "empty #list", "empty .results"];
|
|
@@ -18,10 +14,6 @@ export declare class EmptyCommand implements DecoratedCommand {
|
|
|
18
14
|
readonly compatibility: "standard";
|
|
19
15
|
};
|
|
20
16
|
get metadata(): {
|
|
21
|
-
isBlocking: boolean;
|
|
22
|
-
hasBody: boolean;
|
|
23
|
-
version: string;
|
|
24
|
-
} & {
|
|
25
17
|
readonly description: "Remove all children from an element (sets innerHTML to empty)";
|
|
26
18
|
readonly syntax: readonly ["empty", "empty <target>", "empty the <target>"];
|
|
27
19
|
readonly examples: readonly ["empty me", "empty #list", "empty .results"];
|
|
@@ -4,10 +4,6 @@ import type { VisibilityInput } from '../helpers/visibility-target-parser';
|
|
|
4
4
|
export type HideCommandInput = VisibilityInput;
|
|
5
5
|
export declare class HideCommand extends VisibilityCommandBase {
|
|
6
6
|
static readonly metadata: {
|
|
7
|
-
isBlocking: boolean;
|
|
8
|
-
hasBody: boolean;
|
|
9
|
-
version: string;
|
|
10
|
-
} & {
|
|
11
7
|
readonly description: "Hide elements by setting display to none";
|
|
12
8
|
readonly syntax: "hide [<target>]";
|
|
13
9
|
readonly examples: readonly ["hide me", "hide #modal", "hide .warnings", "hide <button/>"];
|
|
@@ -16,10 +12,6 @@ export declare class HideCommand extends VisibilityCommandBase {
|
|
|
16
12
|
readonly compatibility: "standard";
|
|
17
13
|
};
|
|
18
14
|
get metadata(): {
|
|
19
|
-
isBlocking: boolean;
|
|
20
|
-
hasBody: boolean;
|
|
21
|
-
version: string;
|
|
22
|
-
} & {
|
|
23
15
|
readonly description: "Hide elements by setting display to none";
|
|
24
16
|
readonly syntax: "hide [<target>]";
|
|
25
17
|
readonly examples: readonly ["hide me", "hide #modal", "hide .warnings", "hide <button/>"];
|
|
@@ -9,10 +9,6 @@ export interface MakeCommandInput {
|
|
|
9
9
|
}
|
|
10
10
|
export declare class MakeCommand implements DecoratedCommand {
|
|
11
11
|
static readonly metadata: {
|
|
12
|
-
isBlocking: boolean;
|
|
13
|
-
hasBody: boolean;
|
|
14
|
-
version: string;
|
|
15
|
-
} & {
|
|
16
12
|
readonly description: "Create DOM elements or class instances";
|
|
17
13
|
readonly syntax: readonly ["make a <tag#id.class1.class2/>", "make a <ClassName> from <args> called <identifier>"];
|
|
18
14
|
readonly examples: readonly ["make an <a.navlink/> called linkElement", "make a URL from \"/path/\", \"https://origin.example.com\""];
|
|
@@ -21,10 +17,6 @@ export declare class MakeCommand implements DecoratedCommand {
|
|
|
21
17
|
readonly compatibility: "standard";
|
|
22
18
|
};
|
|
23
19
|
get metadata(): {
|
|
24
|
-
isBlocking: boolean;
|
|
25
|
-
hasBody: boolean;
|
|
26
|
-
version: string;
|
|
27
|
-
} & {
|
|
28
20
|
readonly description: "Create DOM elements or class instances";
|
|
29
21
|
readonly syntax: readonly ["make a <tag#id.class1.class2/>", "make a <ClassName> from <args> called <identifier>"];
|
|
30
22
|
readonly examples: readonly ["make an <a.navlink/> called linkElement", "make a URL from \"/path/\", \"https://origin.example.com\""];
|
|
@@ -8,10 +8,6 @@ export interface OpenCommandInput {
|
|
|
8
8
|
}
|
|
9
9
|
export declare class OpenCommand implements DecoratedCommand {
|
|
10
10
|
static readonly metadata: {
|
|
11
|
-
isBlocking: boolean;
|
|
12
|
-
hasBody: boolean;
|
|
13
|
-
version: string;
|
|
14
|
-
} & {
|
|
15
11
|
readonly description: "Open a dialog, details element, or popover";
|
|
16
12
|
readonly syntax: readonly ["open [<target>]", "open <dialog> as modal", "open <dialog> as non-modal"];
|
|
17
13
|
readonly examples: readonly ["open", "open #myDialog", "open #details", "open #popup as non-modal"];
|
|
@@ -20,10 +16,6 @@ export declare class OpenCommand implements DecoratedCommand {
|
|
|
20
16
|
readonly compatibility: "standard";
|
|
21
17
|
};
|
|
22
18
|
get metadata(): {
|
|
23
|
-
isBlocking: boolean;
|
|
24
|
-
hasBody: boolean;
|
|
25
|
-
version: string;
|
|
26
|
-
} & {
|
|
27
19
|
readonly description: "Open a dialog, details element, or popover";
|
|
28
20
|
readonly syntax: readonly ["open [<target>]", "open <dialog> as modal", "open <dialog> as non-modal"];
|
|
29
21
|
readonly examples: readonly ["open", "open #myDialog", "open #details", "open #popup as non-modal"];
|
|
@@ -26,10 +26,6 @@ export declare function extractPartials(html: string): ParsedPartial[];
|
|
|
26
26
|
export declare function processPartials(html: string, morphOptions?: MorphOptions): ProcessPartialsResult;
|
|
27
27
|
export declare class ProcessPartialsCommand implements DecoratedCommand {
|
|
28
28
|
static readonly metadata: {
|
|
29
|
-
isBlocking: boolean;
|
|
30
|
-
hasBody: boolean;
|
|
31
|
-
version: string;
|
|
32
|
-
} & {
|
|
33
29
|
readonly description: "Process <hx-partial> elements for multi-target swaps";
|
|
34
30
|
readonly syntax: readonly ["process partials in <content>", "process partials in <content> using view transition"];
|
|
35
31
|
readonly examples: readonly ["process partials in it", "process partials in fetchedHtml", "process partials in it using view transition"];
|
|
@@ -38,10 +34,6 @@ export declare class ProcessPartialsCommand implements DecoratedCommand {
|
|
|
38
34
|
readonly compatibility: "lokascript-extension";
|
|
39
35
|
};
|
|
40
36
|
get metadata(): {
|
|
41
|
-
isBlocking: boolean;
|
|
42
|
-
hasBody: boolean;
|
|
43
|
-
version: string;
|
|
44
|
-
} & {
|
|
45
37
|
readonly description: "Process <hx-partial> elements for multi-target swaps";
|
|
46
38
|
readonly syntax: readonly ["process partials in <content>", "process partials in <content> using view transition"];
|
|
47
39
|
readonly examples: readonly ["process partials in it", "process partials in fetchedHtml", "process partials in it using view transition"];
|
|
@@ -13,10 +13,6 @@ export interface PutCommandInput {
|
|
|
13
13
|
}
|
|
14
14
|
export declare class PutCommand implements DecoratedCommand {
|
|
15
15
|
static readonly metadata: {
|
|
16
|
-
isBlocking: boolean;
|
|
17
|
-
hasBody: boolean;
|
|
18
|
-
version: string;
|
|
19
|
-
} & {
|
|
20
16
|
readonly description: "Insert content into elements or properties";
|
|
21
17
|
readonly syntax: readonly ["put <value> into <target>", "put <value> before <target>", "put <value> after <target>"];
|
|
22
18
|
readonly examples: readonly ["put \"Hello World\" into me", "put <div>Content</div> before #target", "put value into #elem's innerHTML"];
|
|
@@ -25,10 +21,6 @@ export declare class PutCommand implements DecoratedCommand {
|
|
|
25
21
|
readonly compatibility: "standard";
|
|
26
22
|
};
|
|
27
23
|
get metadata(): {
|
|
28
|
-
isBlocking: boolean;
|
|
29
|
-
hasBody: boolean;
|
|
30
|
-
version: string;
|
|
31
|
-
} & {
|
|
32
24
|
readonly description: "Insert content into elements or properties";
|
|
33
25
|
readonly syntax: readonly ["put <value> into <target>", "put <value> before <target>", "put <value> after <target>"];
|
|
34
26
|
readonly examples: readonly ["put \"Hello World\" into me", "put <div>Content</div> before #target", "put value into #elem's innerHTML"];
|
|
@@ -20,10 +20,6 @@ export type RemoveCommandInput = {
|
|
|
20
20
|
};
|
|
21
21
|
export declare class RemoveCommand extends DOMModificationBase {
|
|
22
22
|
static readonly metadata: {
|
|
23
|
-
isBlocking: boolean;
|
|
24
|
-
hasBody: boolean;
|
|
25
|
-
version: string;
|
|
26
|
-
} & {
|
|
27
23
|
readonly description: "Remove CSS classes, attributes, styles, or elements from the DOM";
|
|
28
24
|
readonly syntax: "remove <classes|@attr|*prop|element> [from <target>]";
|
|
29
25
|
readonly examples: readonly ["remove .active from me", "remove \"active selected\" from <button/>", "remove .highlighted from #modal", "remove me", "remove closest .item"];
|
|
@@ -32,10 +28,6 @@ export declare class RemoveCommand extends DOMModificationBase {
|
|
|
32
28
|
readonly compatibility: "standard";
|
|
33
29
|
};
|
|
34
30
|
get metadata(): {
|
|
35
|
-
isBlocking: boolean;
|
|
36
|
-
hasBody: boolean;
|
|
37
|
-
version: string;
|
|
38
|
-
} & {
|
|
39
31
|
readonly description: "Remove CSS classes, attributes, styles, or elements from the DOM";
|
|
40
32
|
readonly syntax: "remove <classes|@attr|*prop|element> [from <target>]";
|
|
41
33
|
readonly examples: readonly ["remove .active from me", "remove \"active selected\" from <button/>", "remove .highlighted from #modal", "remove me", "remove closest .item"];
|
|
@@ -6,10 +6,6 @@ export interface ResetCommandInput {
|
|
|
6
6
|
}
|
|
7
7
|
export declare class ResetCommand implements DecoratedCommand {
|
|
8
8
|
static readonly metadata: {
|
|
9
|
-
isBlocking: boolean;
|
|
10
|
-
hasBody: boolean;
|
|
11
|
-
version: string;
|
|
12
|
-
} & {
|
|
13
9
|
readonly description: "Reset a <form> element to its default values (HTMLFormElement.reset())";
|
|
14
10
|
readonly syntax: readonly ["reset", "reset <target>"];
|
|
15
11
|
readonly examples: readonly ["reset", "reset #myForm", "reset <form/>"];
|
|
@@ -18,10 +14,6 @@ export declare class ResetCommand implements DecoratedCommand {
|
|
|
18
14
|
readonly compatibility: "standard";
|
|
19
15
|
};
|
|
20
16
|
get metadata(): {
|
|
21
|
-
isBlocking: boolean;
|
|
22
|
-
hasBody: boolean;
|
|
23
|
-
version: string;
|
|
24
|
-
} & {
|
|
25
17
|
readonly description: "Reset a <form> element to its default values (HTMLFormElement.reset())";
|
|
26
18
|
readonly syntax: readonly ["reset", "reset <target>"];
|
|
27
19
|
readonly examples: readonly ["reset", "reset #myForm", "reset <form/>"];
|
|
@@ -6,10 +6,6 @@ export interface SelectCommandInput {
|
|
|
6
6
|
}
|
|
7
7
|
export declare class SelectCommand implements DecoratedCommand {
|
|
8
8
|
static readonly metadata: {
|
|
9
|
-
isBlocking: boolean;
|
|
10
|
-
hasBody: boolean;
|
|
11
|
-
version: string;
|
|
12
|
-
} & {
|
|
13
9
|
readonly description: "Select the contents of a text field, or select the contents of a DOM element";
|
|
14
10
|
readonly syntax: readonly ["select", "select <target>"];
|
|
15
11
|
readonly examples: readonly ["select #search", "select <textarea/>", "select me"];
|
|
@@ -18,10 +14,6 @@ export declare class SelectCommand implements DecoratedCommand {
|
|
|
18
14
|
readonly compatibility: "standard";
|
|
19
15
|
};
|
|
20
16
|
get metadata(): {
|
|
21
|
-
isBlocking: boolean;
|
|
22
|
-
hasBody: boolean;
|
|
23
|
-
version: string;
|
|
24
|
-
} & {
|
|
25
17
|
readonly description: "Select the contents of a text field, or select the contents of a DOM element";
|
|
26
18
|
readonly syntax: readonly ["select", "select <target>"];
|
|
27
19
|
readonly examples: readonly ["select #search", "select <textarea/>", "select me"];
|
|
@@ -5,10 +5,6 @@ export interface ShowCommandInput extends VisibilityCommandInput {
|
|
|
5
5
|
}
|
|
6
6
|
export declare class ShowCommand extends VisibilityCommandBase {
|
|
7
7
|
static readonly metadata: {
|
|
8
|
-
isBlocking: boolean;
|
|
9
|
-
hasBody: boolean;
|
|
10
|
-
version: string;
|
|
11
|
-
} & {
|
|
12
8
|
readonly description: "Show elements by restoring display property";
|
|
13
9
|
readonly syntax: "show [<target>]";
|
|
14
10
|
readonly examples: readonly ["show me", "show #modal", "show .hidden", "show <button/>"];
|
|
@@ -17,10 +13,6 @@ export declare class ShowCommand extends VisibilityCommandBase {
|
|
|
17
13
|
readonly compatibility: "standard";
|
|
18
14
|
};
|
|
19
15
|
get metadata(): {
|
|
20
|
-
isBlocking: boolean;
|
|
21
|
-
hasBody: boolean;
|
|
22
|
-
version: string;
|
|
23
|
-
} & {
|
|
24
16
|
readonly description: "Show elements by restoring display property";
|
|
25
17
|
readonly syntax: "show [<target>]";
|
|
26
18
|
readonly examples: readonly ["show me", "show #modal", "show .hidden", "show <button/>"];
|
|
@@ -17,10 +17,6 @@ export interface SwapCommandInput {
|
|
|
17
17
|
}
|
|
18
18
|
export declare class SwapCommand implements DecoratedCommand {
|
|
19
19
|
static readonly metadata: {
|
|
20
|
-
isBlocking: boolean;
|
|
21
|
-
hasBody: boolean;
|
|
22
|
-
version: string;
|
|
23
|
-
} & {
|
|
24
20
|
readonly description: "Swap content into target elements with intelligent morphing support";
|
|
25
21
|
readonly syntax: readonly ["swap <target> with <content>", "swap [strategy] of <target> with <content>", "swap into <target> with <content>", "swap over <target> with <content>", "swap delete <target>", "swap <target> with <content> using view transition"];
|
|
26
22
|
readonly examples: readonly ["swap #target with it", "swap innerHTML of #target with it", "swap over #modal with fetchedContent", "swap delete #notification"];
|
|
@@ -29,10 +25,6 @@ export declare class SwapCommand implements DecoratedCommand {
|
|
|
29
25
|
readonly compatibility: "standard";
|
|
30
26
|
};
|
|
31
27
|
get metadata(): {
|
|
32
|
-
isBlocking: boolean;
|
|
33
|
-
hasBody: boolean;
|
|
34
|
-
version: string;
|
|
35
|
-
} & {
|
|
36
28
|
readonly description: "Swap content into target elements with intelligent morphing support";
|
|
37
29
|
readonly syntax: readonly ["swap <target> with <content>", "swap [strategy] of <target> with <content>", "swap into <target> with <content>", "swap over <target> with <content>", "swap delete <target>", "swap <target> with <content> using view transition"];
|
|
38
30
|
readonly examples: readonly ["swap #target with it", "swap innerHTML of #target with it", "swap over #modal with fetchedContent", "swap delete #notification"];
|
|
@@ -49,24 +41,16 @@ export declare class SwapCommand implements DecoratedCommand {
|
|
|
49
41
|
}
|
|
50
42
|
export declare class MorphCommand implements DecoratedCommand {
|
|
51
43
|
static readonly metadata: {
|
|
52
|
-
isBlocking: boolean;
|
|
53
|
-
hasBody: boolean;
|
|
54
|
-
version: string;
|
|
55
|
-
} & {
|
|
56
44
|
readonly description: "Morph content into target elements (intelligent diffing, preserves state)";
|
|
57
|
-
readonly syntax: readonly ["morph <target> with <content>", "morph over <target> with <content>"];
|
|
45
|
+
readonly syntax: readonly ["morph <target> with <content>", "morph over <target> with <content>", "morph <target> with <content> using view transition"];
|
|
58
46
|
readonly examples: readonly ["morph #target with it", "morph over #modal with fetchedContent"];
|
|
59
47
|
readonly sideEffects: readonly ["dom-mutation"];
|
|
60
48
|
readonly category: "dom";
|
|
61
49
|
readonly compatibility: "standard";
|
|
62
50
|
};
|
|
63
51
|
get metadata(): {
|
|
64
|
-
isBlocking: boolean;
|
|
65
|
-
hasBody: boolean;
|
|
66
|
-
version: string;
|
|
67
|
-
} & {
|
|
68
52
|
readonly description: "Morph content into target elements (intelligent diffing, preserves state)";
|
|
69
|
-
readonly syntax: readonly ["morph <target> with <content>", "morph over <target> with <content>"];
|
|
53
|
+
readonly syntax: readonly ["morph <target> with <content>", "morph over <target> with <content>", "morph <target> with <content> using view transition"];
|
|
70
54
|
readonly examples: readonly ["morph #target with it", "morph over #modal with fetchedContent"];
|
|
71
55
|
readonly sideEffects: readonly ["dom-mutation"];
|
|
72
56
|
readonly category: "dom";
|
|
@@ -45,10 +45,6 @@ export type ToggleCommandInput = {
|
|
|
45
45
|
};
|
|
46
46
|
export declare class ToggleCommand implements DecoratedCommand {
|
|
47
47
|
static readonly metadata: {
|
|
48
|
-
isBlocking: boolean;
|
|
49
|
-
hasBody: boolean;
|
|
50
|
-
version: string;
|
|
51
|
-
} & {
|
|
52
48
|
readonly description: "Toggle classes, attributes, or interactive elements";
|
|
53
49
|
readonly syntax: readonly ["toggle <class> [on <target>]", "toggle @attr", "toggle <element> [as modal]", "toggle <expr> for <duration>"];
|
|
54
50
|
readonly examples: readonly ["toggle .active on me", "toggle @disabled", "toggle #myDialog as modal", "toggle .loading for 2s"];
|
|
@@ -57,10 +53,6 @@ export declare class ToggleCommand implements DecoratedCommand {
|
|
|
57
53
|
readonly compatibility: "standard";
|
|
58
54
|
};
|
|
59
55
|
get metadata(): {
|
|
60
|
-
isBlocking: boolean;
|
|
61
|
-
hasBody: boolean;
|
|
62
|
-
version: string;
|
|
63
|
-
} & {
|
|
64
56
|
readonly description: "Toggle classes, attributes, or interactive elements";
|
|
65
57
|
readonly syntax: readonly ["toggle <class> [on <target>]", "toggle @attr", "toggle <element> [as modal]", "toggle <expr> for <duration>"];
|
|
66
58
|
readonly examples: readonly ["toggle .active on me", "toggle @disabled", "toggle #myDialog as modal", "toggle .loading for 2s"];
|
|
@@ -16,10 +16,6 @@ export type TriggerCommandInput = Omit<EventDispatchInput, 'mode'>;
|
|
|
16
16
|
export type SendCommandInput = Omit<EventDispatchInput, 'mode'>;
|
|
17
17
|
export declare class EventDispatchCommand implements DecoratedCommand {
|
|
18
18
|
static readonly metadata: {
|
|
19
|
-
isBlocking: boolean;
|
|
20
|
-
hasBody: boolean;
|
|
21
|
-
version: string;
|
|
22
|
-
} & {
|
|
23
19
|
readonly description: "Dispatch events on elements";
|
|
24
20
|
readonly syntax: readonly ["trigger <event> on <target>", "trigger <event>(<detail>) on <target>", "send <event> to <target>", "send <event>(<detail>) to <target>"];
|
|
25
21
|
readonly examples: readonly ["trigger click on #button", "trigger customEvent on me", "send dataEvent to #target", "send myEvent(count: 42) to me"];
|
|
@@ -29,10 +25,6 @@ export declare class EventDispatchCommand implements DecoratedCommand {
|
|
|
29
25
|
readonly compatibility: "standard";
|
|
30
26
|
};
|
|
31
27
|
get metadata(): {
|
|
32
|
-
isBlocking: boolean;
|
|
33
|
-
hasBody: boolean;
|
|
34
|
-
version: string;
|
|
35
|
-
} & {
|
|
36
28
|
readonly description: "Dispatch events on elements";
|
|
37
29
|
readonly syntax: readonly ["trigger <event> on <target>", "trigger <event>(<detail>) on <target>", "send <event> to <target>", "send <event>(<detail>) to <target>"];
|
|
38
30
|
readonly examples: readonly ["trigger click on #button", "trigger customEvent on me", "send dataEvent to #target", "send myEvent(count: 42) to me"];
|
|
@@ -6,10 +6,6 @@ export interface BlurCommandInput {
|
|
|
6
6
|
}
|
|
7
7
|
export declare class BlurCommand implements DecoratedCommand {
|
|
8
8
|
static readonly metadata: {
|
|
9
|
-
isBlocking: boolean;
|
|
10
|
-
hasBody: boolean;
|
|
11
|
-
version: string;
|
|
12
|
-
} & {
|
|
13
9
|
readonly description: "Remove focus from an element (calls HTMLElement.blur())";
|
|
14
10
|
readonly syntax: readonly ["blur", "blur <target>", "blur on <target>"];
|
|
15
11
|
readonly examples: readonly ["blur", "blur #search", "blur on <input/>"];
|
|
@@ -18,10 +14,6 @@ export declare class BlurCommand implements DecoratedCommand {
|
|
|
18
14
|
readonly compatibility: "standard";
|
|
19
15
|
};
|
|
20
16
|
get metadata(): {
|
|
21
|
-
isBlocking: boolean;
|
|
22
|
-
hasBody: boolean;
|
|
23
|
-
version: string;
|
|
24
|
-
} & {
|
|
25
17
|
readonly description: "Remove focus from an element (calls HTMLElement.blur())";
|
|
26
18
|
readonly syntax: readonly ["blur", "blur <target>", "blur on <target>"];
|
|
27
19
|
readonly examples: readonly ["blur", "blur #search", "blur on <input/>"];
|
|
@@ -11,10 +11,6 @@ export interface CallCommandOutput {
|
|
|
11
11
|
}
|
|
12
12
|
export declare class CallCommand implements DecoratedCommand {
|
|
13
13
|
static readonly metadata: {
|
|
14
|
-
isBlocking: boolean;
|
|
15
|
-
hasBody: boolean;
|
|
16
|
-
version: string;
|
|
17
|
-
} & {
|
|
18
14
|
readonly description: "Evaluate an expression and store the result in the it variable";
|
|
19
15
|
readonly syntax: readonly ["call <expression>"];
|
|
20
16
|
readonly examples: readonly ["call myFunction()", "call fetch(\"/api/data\")", "call element.focus()"];
|
|
@@ -23,10 +19,6 @@ export declare class CallCommand implements DecoratedCommand {
|
|
|
23
19
|
readonly compatibility: "standard";
|
|
24
20
|
};
|
|
25
21
|
get metadata(): {
|
|
26
|
-
isBlocking: boolean;
|
|
27
|
-
hasBody: boolean;
|
|
28
|
-
version: string;
|
|
29
|
-
} & {
|
|
30
22
|
readonly description: "Evaluate an expression and store the result in the it variable";
|
|
31
23
|
readonly syntax: readonly ["call <expression>"];
|
|
32
24
|
readonly examples: readonly ["call myFunction()", "call fetch(\"/api/data\")", "call element.focus()"];
|
|
@@ -6,10 +6,6 @@ export interface FocusCommandInput {
|
|
|
6
6
|
}
|
|
7
7
|
export declare class FocusCommand implements DecoratedCommand {
|
|
8
8
|
static readonly metadata: {
|
|
9
|
-
isBlocking: boolean;
|
|
10
|
-
hasBody: boolean;
|
|
11
|
-
version: string;
|
|
12
|
-
} & {
|
|
13
9
|
readonly description: "Focus an element (calls HTMLElement.focus())";
|
|
14
10
|
readonly syntax: readonly ["focus", "focus <target>", "focus on <target>"];
|
|
15
11
|
readonly examples: readonly ["focus", "focus #search", "focus on <input/>"];
|
|
@@ -18,10 +14,6 @@ export declare class FocusCommand implements DecoratedCommand {
|
|
|
18
14
|
readonly compatibility: "standard";
|
|
19
15
|
};
|
|
20
16
|
get metadata(): {
|
|
21
|
-
isBlocking: boolean;
|
|
22
|
-
hasBody: boolean;
|
|
23
|
-
version: string;
|
|
24
|
-
} & {
|
|
25
17
|
readonly description: "Focus an element (calls HTMLElement.focus())";
|
|
26
18
|
readonly syntax: readonly ["focus", "focus <target>", "focus on <target>"];
|
|
27
19
|
readonly examples: readonly ["focus", "focus #search", "focus on <input/>"];
|
|
@@ -15,10 +15,6 @@ export interface PseudoCommandOutput {
|
|
|
15
15
|
export declare class PseudoCommand {
|
|
16
16
|
readonly name = "pseudo-command";
|
|
17
17
|
static readonly metadata: {
|
|
18
|
-
isBlocking: boolean;
|
|
19
|
-
hasBody: boolean;
|
|
20
|
-
version: string;
|
|
21
|
-
} & {
|
|
22
18
|
readonly description: "Treat a method on an object as a top-level command";
|
|
23
19
|
readonly syntax: readonly ["<method>(<args>) [(to|on|with|into|from|at)] <expression>"];
|
|
24
20
|
readonly examples: readonly ["getElementById(\"d1\") from the document", "reload() the location of the window", "setAttribute(\"foo\", \"bar\") on me", "foo() on me"];
|
|
@@ -27,10 +23,6 @@ export declare class PseudoCommand {
|
|
|
27
23
|
readonly sideEffects: readonly ["method-execution"];
|
|
28
24
|
};
|
|
29
25
|
get metadata(): {
|
|
30
|
-
isBlocking: boolean;
|
|
31
|
-
hasBody: boolean;
|
|
32
|
-
version: string;
|
|
33
|
-
} & {
|
|
34
26
|
readonly description: "Treat a method on an object as a top-level command";
|
|
35
27
|
readonly syntax: readonly ["<method>(<args>) [(to|on|with|into|from|at)] <expression>"];
|
|
36
28
|
readonly examples: readonly ["getElementById(\"d1\") from the document", "reload() the location of the window", "setAttribute(\"foo\", \"bar\") on me", "foo() on me"];
|
package/dist/commands/index.js
CHANGED
|
@@ -71,7 +71,7 @@ function command(config) {
|
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
73
|
function commandMeta(metadata) {
|
|
74
|
-
return {
|
|
74
|
+
return { ...metadata };
|
|
75
75
|
}
|
|
76
76
|
function createFactory(CommandClass) {
|
|
77
77
|
return () => new CommandClass();
|
|
@@ -7750,6 +7750,40 @@ function parseTakeCommand(ctx, identifierNode) {
|
|
|
7750
7750
|
.endingAt(ctx.getPosition())
|
|
7751
7751
|
.build();
|
|
7752
7752
|
}
|
|
7753
|
+
function consumeViewTransitionTail(ctx, args) {
|
|
7754
|
+
if (!ctx.check('using')) {
|
|
7755
|
+
return false;
|
|
7756
|
+
}
|
|
7757
|
+
ctx.advance();
|
|
7758
|
+
if (!ctx.match('view')) {
|
|
7759
|
+
throw new Error("expected 'view transition' after 'using'");
|
|
7760
|
+
}
|
|
7761
|
+
if (!ctx.match('transition')) {
|
|
7762
|
+
throw new Error("expected 'transition' after 'using view'");
|
|
7763
|
+
}
|
|
7764
|
+
args.push(ctx.createIdentifier('using'));
|
|
7765
|
+
args.push(ctx.createIdentifier('view'));
|
|
7766
|
+
args.push(ctx.createIdentifier('transition'));
|
|
7767
|
+
return true;
|
|
7768
|
+
}
|
|
7769
|
+
function parseProcessCommand(ctx, identifierNode) {
|
|
7770
|
+
if (!ctx.check('partials')) {
|
|
7771
|
+
return null;
|
|
7772
|
+
}
|
|
7773
|
+
const args = [];
|
|
7774
|
+
consumeKeywordToArgs(ctx, 'partials', args);
|
|
7775
|
+
if (consumeKeywordToArgs(ctx, KEYWORDS$1.IN, args)) {
|
|
7776
|
+
const contentArg = parseOneArgument(ctx, ['using']);
|
|
7777
|
+
if (contentArg) {
|
|
7778
|
+
args.push(contentArg);
|
|
7779
|
+
}
|
|
7780
|
+
}
|
|
7781
|
+
consumeViewTransitionTail(ctx, args);
|
|
7782
|
+
return CommandNodeBuilder.fromIdentifier(identifierNode)
|
|
7783
|
+
.withArgs(...args)
|
|
7784
|
+
.endingAt(ctx.getPosition())
|
|
7785
|
+
.build();
|
|
7786
|
+
}
|
|
7753
7787
|
function parseAddCommand(ctx, commandToken) {
|
|
7754
7788
|
const args = [];
|
|
7755
7789
|
if (ctx.match('{')) {
|
|
@@ -7871,6 +7905,7 @@ function parseSwapCommand(ctx, identifierNode) {
|
|
|
7871
7905
|
args.push(contentExpr);
|
|
7872
7906
|
}
|
|
7873
7907
|
}
|
|
7908
|
+
consumeViewTransitionTail(ctx, args);
|
|
7874
7909
|
return CommandNodeBuilder.fromIdentifier(identifierNode)
|
|
7875
7910
|
.withArgs(...args)
|
|
7876
7911
|
.endingAt(ctx.getPosition())
|
|
@@ -8384,6 +8419,9 @@ function parseCompoundCommand(ctx, identifierNode) {
|
|
|
8384
8419
|
case 'swap':
|
|
8385
8420
|
case 'morph':
|
|
8386
8421
|
return parseSwapCommand(ctx, identifierNode);
|
|
8422
|
+
case 'process':
|
|
8423
|
+
return (parseProcessCommand(ctx, identifierNode) ??
|
|
8424
|
+
parseRegularCommand(ctx, identifierNode));
|
|
8387
8425
|
default:
|
|
8388
8426
|
return parseRegularCommand(ctx, identifierNode);
|
|
8389
8427
|
}
|
|
@@ -8715,6 +8753,9 @@ function parseTellCommand(ctx, identifierNode) {
|
|
|
8715
8753
|
if (!target) {
|
|
8716
8754
|
throw new Error('tell command requires a target expression');
|
|
8717
8755
|
}
|
|
8756
|
+
if (ctx.check(KEYWORDS$1.TO)) {
|
|
8757
|
+
ctx.advance();
|
|
8758
|
+
}
|
|
8718
8759
|
const commands = [];
|
|
8719
8760
|
while (!ctx.isAtEnd()) {
|
|
8720
8761
|
if (ctx.checkIsCommand()) {
|
|
@@ -8734,7 +8775,11 @@ function parseTellCommand(ctx, identifierNode) {
|
|
|
8734
8775
|
if (ctx.match(KEYWORDS$1.AND) || ctx.match(KEYWORDS$1.THEN)) {
|
|
8735
8776
|
continue;
|
|
8736
8777
|
}
|
|
8737
|
-
if (ctx.check(KEYWORDS$1.ELSE)
|
|
8778
|
+
if (ctx.check(KEYWORDS$1.ELSE)) {
|
|
8779
|
+
break;
|
|
8780
|
+
}
|
|
8781
|
+
if (ctx.check(KEYWORDS$1.END)) {
|
|
8782
|
+
ctx.advance();
|
|
8738
8783
|
break;
|
|
8739
8784
|
}
|
|
8740
8785
|
if (ctx.checkIsCommand()) {
|
|
@@ -11072,6 +11117,7 @@ class Parser {
|
|
|
11072
11117
|
'js',
|
|
11073
11118
|
'tell',
|
|
11074
11119
|
'fetch',
|
|
11120
|
+
'process',
|
|
11075
11121
|
];
|
|
11076
11122
|
if (this.semanticAdapter && !skipSemanticParsing.includes(commandName.toLowerCase())) {
|
|
11077
11123
|
const remainingInput = this.getRemainingInput();
|
|
@@ -14335,7 +14381,7 @@ let SwapCommand = (() => {
|
|
|
14335
14381
|
};
|
|
14336
14382
|
}
|
|
14337
14383
|
}
|
|
14338
|
-
let useViewTransition =
|
|
14384
|
+
let useViewTransition = raw.modifiers?.viewTransition !== undefined;
|
|
14339
14385
|
if (usingIndex !== -1) {
|
|
14340
14386
|
const afterUsing = argKeywords.slice(usingIndex + 1);
|
|
14341
14387
|
if (afterUsing.includes('view') && afterUsing.includes('transition')) {
|
|
@@ -14545,7 +14591,7 @@ let MorphCommand = (() => {
|
|
|
14545
14591
|
const withIndex = argKeywords.findIndex(k => k === 'with');
|
|
14546
14592
|
const overIndex = argKeywords.findIndex(k => k === 'over');
|
|
14547
14593
|
const usingIndex = argKeywords.findIndex(k => k === 'using');
|
|
14548
|
-
let useViewTransition =
|
|
14594
|
+
let useViewTransition = raw.modifiers?.viewTransition !== undefined;
|
|
14549
14595
|
if (usingIndex !== -1) {
|
|
14550
14596
|
const afterUsing = argKeywords.slice(usingIndex + 1);
|
|
14551
14597
|
if (afterUsing.includes('view') && afterUsing.includes('transition')) {
|
|
@@ -14626,7 +14672,11 @@ let MorphCommand = (() => {
|
|
|
14626
14672
|
})();
|
|
14627
14673
|
_classThis.metadata = commandMeta({
|
|
14628
14674
|
description: 'Morph content into target elements (intelligent diffing, preserves state)',
|
|
14629
|
-
syntax: [
|
|
14675
|
+
syntax: [
|
|
14676
|
+
'morph <target> with <content>',
|
|
14677
|
+
'morph over <target> with <content>',
|
|
14678
|
+
'morph <target> with <content> using view transition',
|
|
14679
|
+
],
|
|
14630
14680
|
examples: ['morph #target with it', 'morph over #modal with fetchedContent'],
|
|
14631
14681
|
sideEffects: ['dom-mutation'],
|
|
14632
14682
|
category: 'dom',
|
|
@@ -15236,24 +15286,33 @@ let ProcessPartialsCommand = (() => {
|
|
|
15236
15286
|
if (!args || args.length === 0) {
|
|
15237
15287
|
throw new Error('process partials command requires content argument');
|
|
15238
15288
|
}
|
|
15239
|
-
const
|
|
15240
|
-
|
|
15241
|
-
|
|
15242
|
-
|
|
15243
|
-
|
|
15244
|
-
|
|
15245
|
-
|
|
15246
|
-
|
|
15247
|
-
|
|
15248
|
-
|
|
15289
|
+
const keywordOf = (node) => {
|
|
15290
|
+
const n = node;
|
|
15291
|
+
if (!n || typeof n !== 'object')
|
|
15292
|
+
return null;
|
|
15293
|
+
if (n.type === 'identifier' && typeof n.name === 'string')
|
|
15294
|
+
return n.name.toLowerCase();
|
|
15295
|
+
if (n.type === 'literal' && typeof n.value === 'string')
|
|
15296
|
+
return n.value.toLowerCase();
|
|
15297
|
+
return null;
|
|
15298
|
+
};
|
|
15299
|
+
const keywords = args.map(keywordOf);
|
|
15300
|
+
const partialsIndex = keywords.indexOf('partials');
|
|
15301
|
+
const inIndex = keywords.indexOf('in');
|
|
15302
|
+
let contentNode;
|
|
15249
15303
|
if (partialsIndex === -1) {
|
|
15250
|
-
|
|
15304
|
+
if (inIndex !== -1) {
|
|
15305
|
+
throw new Error('process command expects "partials" keyword: process partials in <content>');
|
|
15306
|
+
}
|
|
15307
|
+
contentNode = args[0];
|
|
15251
15308
|
}
|
|
15252
|
-
|
|
15253
|
-
|
|
15254
|
-
|
|
15309
|
+
else {
|
|
15310
|
+
if (inIndex === -1 || inIndex <= partialsIndex) {
|
|
15311
|
+
throw new Error('process partials command expects "in" keyword: process partials in <content>');
|
|
15312
|
+
}
|
|
15313
|
+
contentNode = args[inIndex + 1];
|
|
15255
15314
|
}
|
|
15256
|
-
const contentArg =
|
|
15315
|
+
const contentArg = contentNode ? await evaluator.evaluate(contentNode, context) : undefined;
|
|
15257
15316
|
let html;
|
|
15258
15317
|
if (typeof contentArg === 'string') {
|
|
15259
15318
|
html = contentArg;
|
|
@@ -15267,10 +15326,10 @@ let ProcessPartialsCommand = (() => {
|
|
|
15267
15326
|
else {
|
|
15268
15327
|
throw new Error('process partials: content must be an HTML string or element');
|
|
15269
15328
|
}
|
|
15270
|
-
|
|
15271
|
-
|
|
15329
|
+
let useViewTransition = raw.modifiers?.viewTransition !== undefined;
|
|
15330
|
+
const usingIndex = keywords.indexOf('using');
|
|
15272
15331
|
if (usingIndex !== -1) {
|
|
15273
|
-
const remaining =
|
|
15332
|
+
const remaining = keywords.slice(usingIndex + 1);
|
|
15274
15333
|
if (remaining.includes('view') && remaining.includes('transition')) {
|
|
15275
15334
|
useViewTransition = true;
|
|
15276
15335
|
}
|