@hyperfixi/core 3.1.1 → 3.3.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/README.md +28 -36
- package/dist/ast/command-slots.d.ts +1 -1
- package/dist/ast/nodes.d.ts +2 -0
- package/dist/ast-utils/index.cjs +193 -48
- package/dist/ast-utils/index.mjs +193 -48
- package/dist/ast-utils/interchange/types.d.ts +19 -1
- package/dist/behaviors/index.cjs +19 -0
- package/dist/behaviors/index.mjs +19 -0
- package/dist/bundle-generator/index.cjs +36 -17
- package/dist/bundle-generator/index.mjs +36 -17
- package/dist/bundle-generator/parser-templates.d.ts +1 -1
- package/dist/chunks/bridge-CI9SOl8u.js +2 -0
- package/dist/chunks/browser-modular-7CpI5VF2.js +2 -0
- package/dist/chunks/index-BwXDEK0m.js +2 -0
- package/dist/chunks/index-DQi2o8Lk.js +2 -0
- package/dist/chunks/index-uCOQ8Qn0.js +2 -0
- package/dist/commands/animation/transition.d.ts +12 -6
- package/dist/commands/helpers/loop-executor.d.ts +2 -2
- package/dist/commands/helpers/numeric-target-parser.d.ts +1 -1
- package/dist/commands/helpers/variable-access.d.ts +5 -2
- package/dist/commands/helpers/write-target.d.ts +5 -0
- package/dist/commands/index.cjs +938 -425
- package/dist/commands/index.mjs +938 -425
- package/dist/commands/templates/render.d.ts +4 -4
- package/dist/commands/utility/beep.d.ts +0 -3
- package/dist/expressions/index.cjs +7 -13
- package/dist/expressions/index.mjs +7 -13
- package/dist/htmx/i18n-hooks.d.ts +4 -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-hx.js +1 -1
- package/dist/hyperfixi-hybrid-complete.js +1 -1
- package/dist/hyperfixi-hybrid-hx.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 +1149 -485
- package/dist/index.min.js +1 -1
- package/dist/index.mjs +1149 -485
- package/dist/lib/swap-executor.d.ts +1 -1
- package/dist/lokascript-browser-classic-i18n.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/metadata.cjs +9 -9
- package/dist/metadata.d.ts +1 -1
- package/dist/metadata.mjs +9 -9
- package/dist/parser/command-grammar.d.ts +1 -0
- package/dist/parser/full-parser.cjs +396 -153
- package/dist/parser/full-parser.mjs +396 -153
- package/dist/parser/helpers/parsing-helpers.d.ts +3 -0
- package/dist/parser/hybrid/index.cjs +3 -0
- package/dist/parser/hybrid/index.mjs +3 -0
- package/dist/parser/hybrid/parser-core.cjs +3 -0
- package/dist/parser/hybrid/parser-core.mjs +3 -0
- package/dist/parser/hybrid-parser.cjs +3 -0
- package/dist/parser/hybrid-parser.mjs +3 -0
- package/dist/parser/parser-types.d.ts +2 -0
- package/dist/parser/parser.d.ts +9 -0
- package/dist/parser/pratt-parser.d.ts +2 -0
- package/dist/registry/index.cjs +535 -210
- package/dist/registry/index.mjs +535 -210
- package/dist/utils/beep.d.ts +8 -0
- package/dist/version.d.ts +1 -1
- package/package.json +21 -18
- package/vocab/htmx/ar.js +22 -20
- package/vocab/htmx/bn.js +21 -5
- package/vocab/htmx/de.js +33 -10
- package/vocab/htmx/en.js +4 -1
- package/vocab/htmx/es.js +28 -9
- package/vocab/htmx/fr.js +28 -8
- package/vocab/htmx/he.js +22 -1
- package/vocab/htmx/hi.js +28 -7
- package/vocab/htmx/id.js +29 -10
- package/vocab/htmx/it.js +26 -5
- package/vocab/htmx/ja.js +36 -11
- package/vocab/htmx/ko.js +27 -6
- package/vocab/htmx/ms.js +24 -1
- package/vocab/htmx/pl.js +27 -7
- package/vocab/htmx/pt.js +30 -9
- package/vocab/htmx/qu.js +32 -9
- package/vocab/htmx/ru.js +28 -6
- package/vocab/htmx/sw.js +28 -8
- package/vocab/htmx/th.js +19 -1
- package/vocab/htmx/tl.js +24 -1
- package/vocab/htmx/tr.js +34 -8
- package/vocab/htmx/uk.js +28 -6
- package/vocab/htmx/vi.js +27 -19
- package/vocab/htmx/zh.js +28 -9
- package/dist/chunks/bridge-D7qrHhV0.js +0 -2
- package/dist/chunks/browser-modular-C4LFxfoS.js +0 -2
- package/dist/chunks/index-C7lqD4mo.js +0 -2
- package/dist/chunks/index-CAPhqA6k.js +0 -2
- package/dist/chunks/index-CLdRyZaP.js +0 -2
|
@@ -14,16 +14,16 @@ export declare class RenderCommand {
|
|
|
14
14
|
readonly name = "render";
|
|
15
15
|
static readonly metadata: {
|
|
16
16
|
readonly description: "Render templates with @if, @else, and @repeat directives";
|
|
17
|
-
readonly syntax: readonly ["render <template>", "render <template> with <
|
|
18
|
-
readonly examples: readonly ["render myTemplate", "render myTemplate with
|
|
17
|
+
readonly syntax: readonly ["render <template>", "render <template> with <name>: <value>, ..."];
|
|
18
|
+
readonly examples: readonly ["render myTemplate", "render myTemplate with name: \"Alice\"", "render \"<template>Hello ${name}!</template>\" with name: \"World\"", "render template with items: data"];
|
|
19
19
|
readonly category: "templates";
|
|
20
20
|
readonly compatibility: "standard";
|
|
21
21
|
readonly sideEffects: readonly ["dom-creation", "template-execution"];
|
|
22
22
|
};
|
|
23
23
|
get metadata(): {
|
|
24
24
|
readonly description: "Render templates with @if, @else, and @repeat directives";
|
|
25
|
-
readonly syntax: readonly ["render <template>", "render <template> with <
|
|
26
|
-
readonly examples: readonly ["render myTemplate", "render myTemplate with
|
|
25
|
+
readonly syntax: readonly ["render <template>", "render <template> with <name>: <value>, ..."];
|
|
26
|
+
readonly examples: readonly ["render myTemplate", "render myTemplate with name: \"Alice\"", "render \"<template>Hello ${name}!</template>\" with name: \"World\"", "render template with items: data"];
|
|
27
27
|
readonly category: "templates";
|
|
28
28
|
readonly compatibility: "standard";
|
|
29
29
|
readonly sideEffects: readonly ["dom-creation", "template-execution"];
|
|
@@ -35,9 +35,6 @@ export declare class BeepCommand implements DecoratedCommand {
|
|
|
35
35
|
parseInput(raw: CommandRaw<'beep'>, evaluator: ExpressionEvaluator, context: ExecutionContext): Promise<BeepCommandInput>;
|
|
36
36
|
execute(input: BeepCommandInput, context: TypedExecutionContext): Promise<BeepCommandOutput>;
|
|
37
37
|
private debugContext;
|
|
38
|
-
private debugExpression;
|
|
39
|
-
private getType;
|
|
40
|
-
private getRepresentation;
|
|
41
38
|
}
|
|
42
39
|
export declare const createBeepCommand: () => BeepCommand;
|
|
43
40
|
export default BeepCommand;
|
|
@@ -545,14 +545,15 @@ const closestExpression = {
|
|
|
545
545
|
if (typeof selector !== 'string') {
|
|
546
546
|
throw new Error('closest requires a string selector');
|
|
547
547
|
}
|
|
548
|
-
|
|
548
|
+
const start = args.length > 1 ? args[1] : context.me;
|
|
549
|
+
if (!(start instanceof Element)) {
|
|
549
550
|
return null;
|
|
550
551
|
}
|
|
551
|
-
return
|
|
552
|
+
return start.closest(selector);
|
|
552
553
|
},
|
|
553
554
|
validate(args) {
|
|
554
|
-
if (args.length !== 1) {
|
|
555
|
-
return 'closest requires
|
|
555
|
+
if (args.length !== 1 && args.length !== 2) {
|
|
556
|
+
return 'closest requires a selector and, optionally, the element to start from';
|
|
556
557
|
}
|
|
557
558
|
const arg = args[0];
|
|
558
559
|
if (typeof arg === 'string')
|
|
@@ -2066,7 +2067,7 @@ const isEmptyExpression = {
|
|
|
2066
2067
|
else if (value instanceof Node || value instanceof Element)
|
|
2067
2068
|
result = false;
|
|
2068
2069
|
else if (isObject(value))
|
|
2069
|
-
result =
|
|
2070
|
+
result = value.length === 0;
|
|
2070
2071
|
else
|
|
2071
2072
|
result = false;
|
|
2072
2073
|
return result;
|
|
@@ -3913,13 +3914,6 @@ function createCommonRegistry() {
|
|
|
3913
3914
|
function isInputElement(el) {
|
|
3914
3915
|
return (el !== null && typeof el === 'object' && 'tagName' in el && el.tagName === 'INPUT');
|
|
3915
3916
|
}
|
|
3916
|
-
function isFormElement(el) {
|
|
3917
|
-
if (el === null || typeof el !== 'object' || !('tagName' in el)) {
|
|
3918
|
-
return false;
|
|
3919
|
-
}
|
|
3920
|
-
const tag = el.tagName;
|
|
3921
|
-
return tag === 'INPUT' || tag === 'SELECT' || tag === 'TEXTAREA';
|
|
3922
|
-
}
|
|
3923
3917
|
function isHTMLElement$1(el) {
|
|
3924
3918
|
return (el !== null &&
|
|
3925
3919
|
typeof el === 'object' &&
|
|
@@ -3976,7 +3970,7 @@ const SPECIAL_DOM_PROPERTIES = {
|
|
|
3976
3970
|
innertext: el => el.textContent?.trim(),
|
|
3977
3971
|
innerHTML: el => el.innerHTML,
|
|
3978
3972
|
outerhtml: el => el.outerHTML,
|
|
3979
|
-
value: el => (
|
|
3973
|
+
value: el => ('value' in el ? el.value : undefined),
|
|
3980
3974
|
checked: el => (isInputElement(el) ? el.checked : undefined),
|
|
3981
3975
|
disabled: el => ('disabled' in el ? el.disabled : undefined),
|
|
3982
3976
|
selected: el => (isOptionElement(el) ? el.selected : undefined),
|
|
@@ -543,14 +543,15 @@ const closestExpression = {
|
|
|
543
543
|
if (typeof selector !== 'string') {
|
|
544
544
|
throw new Error('closest requires a string selector');
|
|
545
545
|
}
|
|
546
|
-
|
|
546
|
+
const start = args.length > 1 ? args[1] : context.me;
|
|
547
|
+
if (!(start instanceof Element)) {
|
|
547
548
|
return null;
|
|
548
549
|
}
|
|
549
|
-
return
|
|
550
|
+
return start.closest(selector);
|
|
550
551
|
},
|
|
551
552
|
validate(args) {
|
|
552
|
-
if (args.length !== 1) {
|
|
553
|
-
return 'closest requires
|
|
553
|
+
if (args.length !== 1 && args.length !== 2) {
|
|
554
|
+
return 'closest requires a selector and, optionally, the element to start from';
|
|
554
555
|
}
|
|
555
556
|
const arg = args[0];
|
|
556
557
|
if (typeof arg === 'string')
|
|
@@ -2064,7 +2065,7 @@ const isEmptyExpression = {
|
|
|
2064
2065
|
else if (value instanceof Node || value instanceof Element)
|
|
2065
2066
|
result = false;
|
|
2066
2067
|
else if (isObject(value))
|
|
2067
|
-
result =
|
|
2068
|
+
result = value.length === 0;
|
|
2068
2069
|
else
|
|
2069
2070
|
result = false;
|
|
2070
2071
|
return result;
|
|
@@ -3911,13 +3912,6 @@ function createCommonRegistry() {
|
|
|
3911
3912
|
function isInputElement(el) {
|
|
3912
3913
|
return (el !== null && typeof el === 'object' && 'tagName' in el && el.tagName === 'INPUT');
|
|
3913
3914
|
}
|
|
3914
|
-
function isFormElement(el) {
|
|
3915
|
-
if (el === null || typeof el !== 'object' || !('tagName' in el)) {
|
|
3916
|
-
return false;
|
|
3917
|
-
}
|
|
3918
|
-
const tag = el.tagName;
|
|
3919
|
-
return tag === 'INPUT' || tag === 'SELECT' || tag === 'TEXTAREA';
|
|
3920
|
-
}
|
|
3921
3915
|
function isHTMLElement$1(el) {
|
|
3922
3916
|
return (el !== null &&
|
|
3923
3917
|
typeof el === 'object' &&
|
|
@@ -3974,7 +3968,7 @@ const SPECIAL_DOM_PROPERTIES = {
|
|
|
3974
3968
|
innertext: el => el.textContent?.trim(),
|
|
3975
3969
|
innerHTML: el => el.innerHTML,
|
|
3976
3970
|
outerhtml: el => el.outerHTML,
|
|
3977
|
-
value: el => (
|
|
3971
|
+
value: el => ('value' in el ? el.value : undefined),
|
|
3978
3972
|
checked: el => (isInputElement(el) ? el.checked : undefined),
|
|
3979
3973
|
disabled: el => ('disabled' in el ? el.disabled : undefined),
|
|
3980
3974
|
selected: el => (isOptionElement(el) ? el.selected : undefined),
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
export type AttrNamespace = 'hx' | 'sse' | 'ws';
|
|
2
|
+
export interface EventNameOptions {
|
|
3
|
+
fromAttrName?: boolean;
|
|
4
|
+
}
|
|
2
5
|
export interface I18nHooks {
|
|
3
6
|
nameOf(elt: Element, ns: AttrNamespace, key: string): string;
|
|
4
7
|
selectorFor(ns: AttrNamespace, key: string): string;
|
|
5
|
-
eventNameOf(elt: Element, value: string): string;
|
|
8
|
+
eventNameOf(elt: Element, value: string, opts?: EventNameOptions): string;
|
|
6
9
|
}
|
|
7
10
|
export declare function installHooks(hooks: I18nHooks): void;
|
|
8
11
|
export declare function getHooks(): I18nHooks;
|