@hyperfixi/core 2.3.0 → 2.4.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.
Files changed (203) hide show
  1. package/README.md +8 -11
  2. package/dist/api/dom-processor.d.ts +8 -4
  3. package/dist/api/hyperscript-api.d.ts +5 -1
  4. package/dist/ast-utils/index.js +25320 -94
  5. package/dist/ast-utils/index.mjs +25320 -94
  6. package/dist/ast-utils/interchange/types.d.ts +7 -1
  7. package/dist/behaviors/index.js +54 -100
  8. package/dist/behaviors/index.mjs +54 -100
  9. package/dist/bundle-generator/index.js +44 -6
  10. package/dist/bundle-generator/index.mjs +44 -6
  11. package/dist/bundle-generator/parser-templates.d.ts +1 -1
  12. package/dist/bundle-generator/template-capabilities.d.ts +1 -1
  13. package/dist/chunks/bridge-C4d3blZX.js +2 -0
  14. package/dist/chunks/browser-modular-BwIRlrTM.js +2 -0
  15. package/dist/chunks/feature-eventsource-BpZvPy_K.js +2 -0
  16. package/dist/chunks/{feature-sockets-ClOH7vk7.js → feature-sockets-CrYvjZ4j.js} +2 -2
  17. package/dist/chunks/feature-webworker-BSYguEIW.js +2 -0
  18. package/dist/chunks/index-Beno_SBy.js +2 -0
  19. package/dist/commands/advanced/async.d.ts +6 -2
  20. package/dist/commands/advanced/js.d.ts +1 -1
  21. package/dist/commands/animation/start-view-transition.d.ts +24 -0
  22. package/dist/commands/async/fetch.d.ts +6 -1
  23. package/dist/commands/control-flow/repeat.d.ts +2 -0
  24. package/dist/commands/data/clear.d.ts +23 -0
  25. package/dist/commands/data/set.d.ts +6 -0
  26. package/dist/commands/dom/close.d.ts +19 -0
  27. package/dist/commands/dom/empty.d.ts +19 -0
  28. package/dist/commands/dom/open.d.ts +21 -0
  29. package/dist/commands/dom/reset.d.ts +19 -0
  30. package/dist/commands/dom/select.d.ts +19 -0
  31. package/dist/commands/dom/swap.d.ts +7 -4
  32. package/dist/commands/events/trigger.d.ts +1 -1
  33. package/dist/commands/execution/blur.d.ts +19 -0
  34. package/dist/commands/execution/call.d.ts +1 -2
  35. package/dist/commands/execution/focus.d.ts +19 -0
  36. package/dist/commands/helpers/element-resolution.d.ts +2 -2
  37. package/dist/commands/helpers/event-waiting.d.ts +1 -1
  38. package/dist/commands/helpers/numeric-target-parser.d.ts +7 -0
  39. package/dist/commands/index.d.ts +34 -2
  40. package/dist/commands/index.js +19374 -4848
  41. package/dist/commands/index.mjs +19342 -4849
  42. package/dist/commands/navigation/go.d.ts +3 -0
  43. package/dist/commands/navigation/scroll-to.d.ts +26 -0
  44. package/dist/commands/utility/beep.d.ts +2 -2
  45. package/dist/commands/utility/breakpoint.d.ts +19 -0
  46. package/dist/commands/utility/pick.d.ts +11 -2
  47. package/dist/compatibility/browser-bundle-modular.d.ts +2 -2
  48. package/dist/compatibility/browser-bundle-multilingual.d.ts +1 -1
  49. package/dist/compatibility/browser-bundle-semantic-complete.d.ts +3 -3
  50. package/dist/compatibility/browser-bundle.d.ts +13 -6
  51. package/dist/compatibility/browser-modular.d.ts +1 -3
  52. package/dist/core/expression-evaluator.d.ts +4 -4
  53. package/dist/core/expression-registry.d.ts +8 -0
  54. package/dist/expressions/bundles/common-expressions.d.ts +2 -2
  55. package/dist/expressions/bundles/core-expressions.d.ts +2 -2
  56. package/dist/expressions/bundles/full-expressions.d.ts +2 -2
  57. package/dist/expressions/bundles/index.d.ts +3 -3
  58. package/dist/expressions/collection/index.d.ts +35 -0
  59. package/dist/expressions/conversion/impl/index.d.ts +1 -1
  60. package/dist/expressions/index.d.ts +4 -3
  61. package/dist/expressions/index.js +1117 -1590
  62. package/dist/expressions/index.mjs +1113 -1586
  63. package/dist/expressions/logical/index.d.ts +2 -0
  64. package/dist/expressions/mathematical/index.d.ts +11 -0
  65. package/dist/expressions/shared/index.d.ts +1 -1
  66. package/dist/expressions/shared/number-utils.d.ts +1 -0
  67. package/dist/htmx/htmx-attribute-processor.d.ts +37 -1
  68. package/dist/htmx/htmx-translator.d.ts +2 -0
  69. package/dist/htmx/i18n-hooks.d.ts +15 -0
  70. package/dist/htmx/i18n-orchestrator.d.ts +15 -0
  71. package/dist/htmx/lang-resolver.d.ts +3 -0
  72. package/dist/htmx/sse.d.ts +60 -0
  73. package/dist/htmx/ws.d.ts +59 -0
  74. package/dist/hyperfixi-browser-classic-i18n.js +2 -0
  75. package/dist/hyperfixi-browser-minimal.js +1 -0
  76. package/dist/hyperfixi-browser-standard.js +2 -0
  77. package/dist/hyperfixi-browser.js +2 -0
  78. package/dist/hyperfixi-classic-i18n.js +1 -1
  79. package/dist/hyperfixi-hx-v4.js +1 -0
  80. package/dist/hyperfixi-hx.js +1 -1
  81. package/dist/hyperfixi-hybrid-complete.js +1 -1
  82. package/dist/hyperfixi-hybrid-hx.js +1 -0
  83. package/dist/hyperfixi-minimal.js +1 -1
  84. package/dist/hyperfixi-multilingual.js +1 -1
  85. package/dist/hyperfixi-standard.js +1 -1
  86. package/dist/hyperfixi.js +1 -1
  87. package/dist/hyperfixi.mjs +1 -1
  88. package/dist/index.d.ts +2 -0
  89. package/dist/index.js +43613 -45063
  90. package/dist/index.min.js +1 -1
  91. package/dist/index.mjs +43610 -45064
  92. package/dist/lib/index.d.ts +2 -2
  93. package/dist/lib/morph-adapter.d.ts +0 -13
  94. package/dist/lib/swap-executor.d.ts +0 -10
  95. package/dist/lib/view-transitions.d.ts +1 -30
  96. package/dist/lokascript-browser-classic-i18n.js +1 -1
  97. package/dist/lokascript-browser-minimal.js +1 -1
  98. package/dist/lokascript-browser-standard.js +1 -1
  99. package/dist/lokascript-browser.js +1 -1
  100. package/dist/lokascript-hybrid-complete.js +1 -1
  101. package/dist/lokascript-hybrid-hx.js +1 -1
  102. package/dist/lokascript-multilingual.js +1 -1
  103. package/dist/lsp-metadata.d.ts +9 -4
  104. package/dist/lsp-metadata.js +187 -3
  105. package/dist/lsp-metadata.mjs +185 -4
  106. package/dist/metadata.d.ts +1 -1
  107. package/dist/metadata.js +3 -3
  108. package/dist/metadata.mjs +3 -3
  109. package/dist/multilingual/bridge.d.ts +1 -1
  110. package/dist/multilingual/index.js +79 -22
  111. package/dist/multilingual/index.mjs +79 -22
  112. package/dist/parser/command-parsers/animation-commands.d.ts +1 -0
  113. package/dist/parser/command-parsers/utility-commands.d.ts +1 -0
  114. package/dist/parser/extensions.d.ts +51 -0
  115. package/dist/parser/full-parser.js +1224 -899
  116. package/dist/parser/full-parser.mjs +1224 -899
  117. package/dist/parser/helpers/ast-helpers.d.ts +1 -0
  118. package/dist/parser/helpers/parsing-helpers.d.ts +4 -0
  119. package/dist/parser/hybrid/index.js +7 -0
  120. package/dist/parser/hybrid/index.mjs +7 -0
  121. package/dist/parser/hybrid/parser-core.js +7 -0
  122. package/dist/parser/hybrid/parser-core.mjs +7 -0
  123. package/dist/parser/hybrid/tokenizer.js +7 -0
  124. package/dist/parser/hybrid/tokenizer.mjs +7 -0
  125. package/dist/parser/hybrid-parser.js +7 -0
  126. package/dist/parser/hybrid-parser.mjs +7 -0
  127. package/dist/parser/parser-types.d.ts +8 -28
  128. package/dist/parser/parser.d.ts +3 -7
  129. package/dist/parser/pratt-parser.d.ts +0 -3
  130. package/dist/parser/runtime.d.ts +4 -0
  131. package/dist/parser/semantic-integration.d.ts +17 -0
  132. package/dist/parser/types.d.ts +7 -1
  133. package/dist/reference/index.js +91 -0
  134. package/dist/reference/index.mjs +91 -0
  135. package/dist/registry/index.js +12866 -5876
  136. package/dist/registry/index.mjs +12866 -5876
  137. package/dist/registry/universal-types.d.ts +2 -1
  138. package/dist/runtime/command-adapter.d.ts +23 -16
  139. package/dist/runtime/plugin.d.ts +14 -0
  140. package/dist/runtime/runtime-base.d.ts +32 -7
  141. package/dist/runtime/runtime-factory.d.ts +3 -3
  142. package/dist/runtime/runtime.d.ts +2 -2
  143. package/dist/test-setup.d.ts +1 -0
  144. package/dist/types/base-types.d.ts +3 -0
  145. package/dist/types/feature-types.d.ts +1 -1
  146. package/dist/types/index.d.ts +2 -2
  147. package/package.json +26 -20
  148. package/vocab/htmx/ar.js +60 -0
  149. package/vocab/htmx/bn.js +49 -0
  150. package/vocab/htmx/de.js +60 -0
  151. package/vocab/htmx/en.js +21 -0
  152. package/vocab/htmx/es.js +60 -0
  153. package/vocab/htmx/fr.js +59 -0
  154. package/vocab/htmx/he.js +40 -0
  155. package/vocab/htmx/hi.js +60 -0
  156. package/vocab/htmx/id.js +57 -0
  157. package/vocab/htmx/it.js +58 -0
  158. package/vocab/htmx/ja.js +60 -0
  159. package/vocab/htmx/ko.js +60 -0
  160. package/vocab/htmx/ms.js +35 -0
  161. package/vocab/htmx/pl.js +60 -0
  162. package/vocab/htmx/pt.js +60 -0
  163. package/vocab/htmx/qu.js +60 -0
  164. package/vocab/htmx/ru.js +60 -0
  165. package/vocab/htmx/sw.js +59 -0
  166. package/vocab/htmx/th.js +49 -0
  167. package/vocab/htmx/tl.js +33 -0
  168. package/vocab/htmx/tr.js +60 -0
  169. package/vocab/htmx/uk.js +60 -0
  170. package/vocab/htmx/vi.js +51 -0
  171. package/vocab/htmx/zh.js +60 -0
  172. package/dist/bundles/test-minimal.d.ts +0 -3
  173. package/dist/bundles/test-standard.d.ts +0 -3
  174. package/dist/chunks/bridge-BlRqsZT4.js +0 -2
  175. package/dist/chunks/browser-modular-AbV0Ql4i.js +0 -2
  176. package/dist/chunks/feature-eventsource-B5F2-H1r.js +0 -2
  177. package/dist/chunks/feature-webworker-3bAp0ac9.js +0 -2
  178. package/dist/chunks/index-BDYQHwCF.js +0 -2
  179. package/dist/compatibility/browser-bundle-minimal.d.ts +0 -8
  180. package/dist/compatibility/browser-bundle-standard.d.ts +0 -8
  181. package/dist/compatibility/hyperscript-tests/test-adapter.d.ts +0 -13
  182. package/dist/core/base-expression-evaluator.d.ts +0 -74
  183. package/dist/core/binary-expression-evaluator.d.ts +0 -7
  184. package/dist/core/call-expression-evaluator.d.ts +0 -7
  185. package/dist/core/configurable-expression-evaluator.d.ts +0 -5
  186. package/dist/core/lazy-expression-evaluator.d.ts +0 -22
  187. package/dist/core/parser.d.ts +0 -21
  188. package/dist/core/selector-evaluator.d.ts +0 -15
  189. package/dist/core/template-literal-evaluator.d.ts +0 -5
  190. package/dist/expressions/comparison/index.d.ts +0 -80
  191. package/dist/expressions/comparison/utils.d.ts +0 -2
  192. package/dist/expressions/conversion/impl/bridge.d.ts +0 -117
  193. package/dist/expressions/logical/impl/pattern-matching.d.ts +0 -58
  194. package/dist/expressions/positional/impl/bridge.d.ts +0 -95
  195. package/dist/expressions/property/index.d.ts +0 -55
  196. package/dist/expressions/references/impl/bridge.d.ts +0 -54
  197. package/dist/extensions/index.d.ts +0 -3
  198. package/dist/extensions/tailwind.d.ts +0 -22
  199. package/dist/mod.d.ts +0 -63
  200. package/dist/parser/expression-parser.d.ts +0 -6
  201. package/dist/runtime/runtime-experimental.d.ts +0 -18
  202. package/dist/scripts/code-generator.d.ts +0 -64
  203. package/dist/scripts/generate-missing-commands.d.ts +0 -4
@@ -1,5 +1,6 @@
1
1
  import type { EventSourcePayload, EventSourceHandler, EventSource, RuntimeEnvironment } from './event-source-registry';
2
2
  import type { ExecutionContext } from '../types/core';
3
+ import type { CommandWithParseInput } from '../runtime/command-adapter';
3
4
  export type UniversalEventPayload = EventSourcePayload<'universal'>;
4
5
  export type UniversalEventHandler = EventSourceHandler<'universal'>;
5
6
  export interface UniversalEventSource<TEnv extends RuntimeEnvironment = 'universal'> extends EventSource {
@@ -20,7 +21,7 @@ export interface TypedRegistry<TEnv extends RuntimeEnvironment = 'universal'> {
20
21
  getProviderNames(): string[];
21
22
  };
22
23
  commands: {
23
- register(command: any): void;
24
+ register(command: CommandWithParseInput): void;
24
25
  has(name: string): boolean;
25
26
  getCommandNames(): string[];
26
27
  };
@@ -1,7 +1,6 @@
1
1
  import type { ExecutionContext, TypedExecutionContext, ValidationResult } from '../types/core';
2
2
  import type { ASTNode } from '../types/base-types';
3
3
  import { HookRegistry } from '../types/hooks';
4
- import { ExpressionEvaluator } from '../core/expression-evaluator';
5
4
  export interface RuntimeCommand {
6
5
  name: string;
7
6
  execute(context: ExecutionContext, ...args: unknown[]): Promise<unknown>;
@@ -12,16 +11,26 @@ export interface RuntimeCommand {
12
11
  syntax: string;
13
12
  };
14
13
  }
14
+ export interface CommandMetadata {
15
+ description?: string;
16
+ examples?: string[];
17
+ syntax?: string | string[];
18
+ aliases?: string[];
19
+ [extra: string]: unknown;
20
+ }
21
+ export interface CommandRawInput {
22
+ args: ASTNode[];
23
+ modifiers: Record<string, unknown>;
24
+ commandName?: string;
25
+ }
15
26
  export interface CommandWithParseInput {
16
27
  name: string;
17
- parseInput?(raw: {
18
- args: ASTNode[];
19
- modifiers: Record<string, any>;
20
- commandName?: string;
21
- }, evaluator: ExpressionEvaluator, context: ExecutionContext): Promise<any>;
22
- execute(input: any, context: TypedExecutionContext): Promise<unknown>;
28
+ parseInput?(raw: CommandRawInput, evaluator: {
29
+ evaluate(node: ASTNode, context: ExecutionContext): Promise<unknown>;
30
+ }, context: ExecutionContext): Promise<unknown>;
31
+ execute(input: unknown, context: TypedExecutionContext): Promise<unknown>;
23
32
  validate?(input: unknown): ValidationResult<unknown>;
24
- metadata?: any;
33
+ metadata?: CommandMetadata;
25
34
  }
26
35
  export declare class ContextBridge {
27
36
  static toTyped(context: ExecutionContext): TypedExecutionContext;
@@ -29,16 +38,15 @@ export declare class ContextBridge {
29
38
  }
30
39
  export declare class CommandAdapterV2 implements RuntimeCommand {
31
40
  private impl;
32
- private expressionEvaluator;
33
41
  private hookRegistry;
34
- constructor(impl: CommandWithParseInput, sharedEvaluator?: ExpressionEvaluator, hookRegistry?: HookRegistry);
42
+ constructor(impl: CommandWithParseInput, _legacySharedEvaluator?: unknown, hookRegistry?: HookRegistry);
35
43
  setHookRegistry(registry: HookRegistry): void;
36
44
  private createHookContext;
37
45
  get name(): string;
38
46
  get metadata(): {
39
- description: any;
40
- examples: any;
41
- syntax: any;
47
+ description: string;
48
+ examples: string[];
49
+ syntax: string;
42
50
  };
43
51
  execute(context: ExecutionContext, ...args: unknown[]): Promise<unknown>;
44
52
  validate(input: unknown): ValidationResult<unknown>;
@@ -46,9 +54,8 @@ export declare class CommandAdapterV2 implements RuntimeCommand {
46
54
  export declare class CommandRegistryV2 {
47
55
  private adapters;
48
56
  private implementations;
49
- private sharedEvaluator?;
50
57
  private hookRegistry?;
51
- constructor(sharedEvaluator?: ExpressionEvaluator, hookRegistry?: HookRegistry);
58
+ constructor(_legacySharedEvaluator?: unknown, hookRegistry?: HookRegistry);
52
59
  setHookRegistry(registry: HookRegistry): void;
53
60
  getHookRegistry(): HookRegistry | undefined;
54
61
  register(impl: any): void;
@@ -59,5 +66,5 @@ export declare class CommandRegistryV2 {
59
66
  getAdapters(): Map<string, CommandAdapterV2>;
60
67
  validateCommand(name: string, input: unknown): ValidationResult<unknown>;
61
68
  }
62
- export declare function createCommandRegistryV2(commands: CommandWithParseInput[], sharedEvaluator?: ExpressionEvaluator, hookRegistry?: HookRegistry): CommandRegistryV2;
69
+ export declare function createCommandRegistryV2(commands: CommandWithParseInput[], _legacySharedEvaluator?: unknown, hookRegistry?: HookRegistry): CommandRegistryV2;
63
70
  //# sourceMappingURL=command-adapter.d.ts.map
@@ -0,0 +1,14 @@
1
+ import type { CommandRegistryV2 } from './command-adapter';
2
+ import type { ParserExtensionRegistry } from '../parser/extensions';
3
+ import type { Runtime } from './runtime';
4
+ export interface HyperfixiPluginContext {
5
+ commandRegistry: CommandRegistryV2;
6
+ parserExtensions: ParserExtensionRegistry;
7
+ runtime: Runtime;
8
+ }
9
+ export interface HyperfixiPlugin {
10
+ name: string;
11
+ install(ctx: HyperfixiPluginContext): void;
12
+ }
13
+ export declare function installPlugin(runtime: Runtime, plugin: HyperfixiPlugin): void;
14
+ //# sourceMappingURL=plugin.d.ts.map
@@ -2,7 +2,7 @@ import type { ASTNode, ExecutionContext, CommandNode, EventHandlerNode } from '.
2
2
  import type { ExecutionResult, ExecutionSignal, ControlFlowError } from '../types/result';
3
3
  import type { RuntimeHooks } from '../types/hooks';
4
4
  import { HookRegistry } from '../types/hooks';
5
- import { BaseExpressionEvaluator } from '../core/base-expression-evaluator';
5
+ import type { ExpressionRegistry } from '../core/expression-registry';
6
6
  export declare function isControlFlowError(e: unknown): e is ControlFlowError;
7
7
  import { CommandRegistryV2 as CommandRegistry } from './command-adapter';
8
8
  import { CleanupRegistry } from './cleanup-registry';
@@ -14,18 +14,37 @@ export interface RuntimeBaseOptions {
14
14
  commandTimeout?: number;
15
15
  enableErrorReporting?: boolean;
16
16
  enableResultPattern?: boolean;
17
- expressionEvaluator: BaseExpressionEvaluator;
17
+ expressionRegistry: ExpressionRegistry;
18
18
  hooks?: RuntimeHooks;
19
19
  enableAutoCleanup?: boolean;
20
20
  registryIntegration?: RegistryIntegrationOptions | boolean;
21
21
  }
22
+ export type BehaviorEntry = {
23
+ name: string;
24
+ parameters: string[];
25
+ type: 'imperative';
26
+ install: (element: HTMLElement, parameters: Record<string, unknown>) => void | Promise<void>;
27
+ } | {
28
+ name: string;
29
+ parameters: string[];
30
+ type?: undefined;
31
+ eventHandlers: EventHandlerNode[];
32
+ initBlock?: ASTNode;
33
+ };
34
+ export interface BehaviorAPI {
35
+ has(name: string): boolean;
36
+ get(name: string): BehaviorEntry | undefined;
37
+ set(name: string, definition: BehaviorEntry): void;
38
+ resolve: ((name: string) => boolean) | null;
39
+ install(behaviorName: string, element: HTMLElement, parameters: Record<string, unknown>): Promise<void>;
40
+ }
22
41
  export declare class RuntimeBase {
23
42
  protected options: RuntimeBaseOptions;
24
43
  protected registry: CommandRegistry;
25
- protected expressionEvaluator: BaseExpressionEvaluator;
26
- behaviorRegistry: Map<string, any>;
27
- behaviorAPI: any;
28
- protected globalVariables: Map<string, any>;
44
+ protected expressionRegistry: ExpressionRegistry;
45
+ behaviorRegistry: Map<string, BehaviorEntry>;
46
+ behaviorAPI: BehaviorAPI;
47
+ protected globalVariables: Map<string, unknown>;
29
48
  protected hookRegistry: HookRegistry;
30
49
  protected cleanupRegistry: CleanupRegistry;
31
50
  private autoCleanupObserver;
@@ -37,8 +56,12 @@ export declare class RuntimeBase {
37
56
  unregisterHooks(name: string): boolean;
38
57
  getRegisteredHooks(): string[];
39
58
  cleanup(element: Element): number;
59
+ trackListener(element: Element, target: EventTarget, eventName: string, handler: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
40
60
  cleanupTree(element: Element): number;
41
61
  getCleanupStats(): ReturnType<CleanupRegistry['getStats']>;
62
+ getCleanupRegistry(): CleanupRegistry;
63
+ protected logError(...args: unknown[]): void;
64
+ protected logWarn(...args: unknown[]): void;
42
65
  destroy(): void;
43
66
  private hasErrorDiagnostics;
44
67
  getWarnings(): readonly string[];
@@ -50,7 +73,9 @@ export declare class RuntimeBase {
50
73
  protected evaluateExpression(node: ASTNode, context: ExecutionContext): Promise<unknown>;
51
74
  protected evaluateExpressionWithResult(node: ASTNode, context: ExecutionContext): Promise<ExecutionResult<unknown>>;
52
75
  protected executeCommandFromPattern(commandName: string, selector: string, context: ExecutionContext): Promise<unknown>;
53
- protected executeProgram(node: any, context: ExecutionContext): Promise<unknown>;
76
+ protected executeProgram(node: ASTNode & {
77
+ statements?: ASTNode[];
78
+ }, context: ExecutionContext): Promise<unknown>;
54
79
  protected executeBlock(node: {
55
80
  commands?: ASTNode[];
56
81
  }, context: ExecutionContext): Promise<void>;
@@ -1,9 +1,9 @@
1
1
  import { RuntimeBase } from './runtime-base';
2
- import type { BaseExpressionEvaluator } from '../core/base-expression-evaluator';
2
+ import { type ExpressionRegistry } from '../core/expression-registry';
3
3
  import type { ParserInterface } from '../parser/parser-interface';
4
4
  import type { ExecutionContext } from '../types/core';
5
5
  export interface TreeShakeableRuntimeOptions {
6
- expressionEvaluator: BaseExpressionEvaluator;
6
+ expressionRegistry: ExpressionRegistry;
7
7
  enableAsyncCommands?: boolean;
8
8
  commandTimeout?: number;
9
9
  enableErrorReporting?: boolean;
@@ -26,5 +26,5 @@ export interface LokaScriptRuntime {
26
26
  }
27
27
  export declare function createTreeShakeableRuntime(commands: any[], options: TreeShakeableRuntimeOptions): RuntimeBase;
28
28
  export declare function createRuntime(options: RuntimeOptions): LokaScriptRuntime;
29
- export type { BaseExpressionEvaluator, ParserInterface };
29
+ export type { ExpressionRegistry, ParserInterface };
30
30
  //# sourceMappingURL=runtime-factory.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import { RuntimeBase } from './runtime-base';
2
- import { CommandRegistryV2, type CommandWithParseInput } from './command-adapter';
2
+ import { CommandRegistryV2 } from './command-adapter';
3
3
  export interface RuntimeOptions {
4
4
  enableAsyncCommands?: boolean;
5
5
  commandTimeout?: number;
@@ -7,6 +7,7 @@ export interface RuntimeOptions {
7
7
  lazyLoad?: boolean;
8
8
  expressionPreload?: 'core' | 'common' | 'all' | 'none';
9
9
  registry?: CommandRegistryV2;
10
+ expressionRegistry?: import('../core/expression-registry').ExpressionRegistry;
10
11
  useEnhancedCommands?: boolean;
11
12
  commands?: string[];
12
13
  }
@@ -15,5 +16,4 @@ export declare class Runtime extends RuntimeBase {
15
16
  getRegistry(): CommandRegistryV2;
16
17
  }
17
18
  export declare function createRuntime(options?: RuntimeOptions): Runtime;
18
- export declare function createMinimalRuntime(commands: CommandWithParseInput[], options?: Omit<RuntimeOptions, 'registry'>): Runtime;
19
19
  //# sourceMappingURL=runtime.d.ts.map
@@ -15,6 +15,7 @@ export declare const createMockHyperscriptContext: (element?: HTMLElement) => {
15
15
  result: any;
16
16
  locals: Map<string, any>;
17
17
  globals: Map<string, any>;
18
+ registry: import("./core/expression-registry").ExpressionRegistry;
18
19
  flags: {
19
20
  halted: boolean;
20
21
  breaking: boolean;
@@ -1,5 +1,6 @@
1
1
  import type { RuntimeValidator } from '../validation/lightweight-validators';
2
2
  import type { CoreExecutionContext } from './core-context';
3
+ import type { ExpressionRegistry } from '../core/expression-registry';
3
4
  export type { CoreExecutionContext } from './core-context';
4
5
  export { createCoreContext, isCoreExecutionContext, assertHTMLElement, asHTMLElement, } from './core-context';
5
6
  export interface ValidationError {
@@ -41,6 +42,7 @@ export declare const evaluationToHyperScriptType: Record<EvaluationType, HyperSc
41
42
  export type ExpressionCategory = 'Reference' | 'Logical' | 'Conversion' | 'Positional' | 'Property' | 'Special' | 'Template' | 'Mathematical';
42
43
  export interface ExecutionContext extends CoreExecutionContext {
43
44
  result: unknown;
45
+ registry?: ExpressionRegistry;
44
46
  readonly halted?: boolean;
45
47
  readonly returned?: boolean;
46
48
  readonly broke?: boolean;
@@ -61,6 +63,7 @@ export interface ExecutionContext extends CoreExecutionContext {
61
63
  returning: boolean;
62
64
  async: boolean;
63
65
  };
66
+ readonly registerCleanup?: (element: Element, cleanup: () => void, description?: string) => void;
64
67
  }
65
68
  export interface TypedExecutionContext extends ExecutionContext {
66
69
  readonly expressionStack?: string[];
@@ -75,7 +75,7 @@ export interface FeatureValidationResult {
75
75
  suggestions: string[];
76
76
  parsedSyntax?: {
77
77
  tokens: string[];
78
- structure: Record<string, any>;
78
+ structure: Record<string, unknown>;
79
79
  };
80
80
  }
81
81
  //# sourceMappingURL=feature-types.d.ts.map
@@ -22,8 +22,8 @@ export type { CodeActionKind, TextRange, TextEdit, FixCommand, CodeFix, FixableE
22
22
  export type { CommandCategory as StandardCommandCategory, CommandSideEffect, CommandMetadata, MetadataValidationResult, CommandRegistryEntry, } from './command-metadata';
23
23
  export { COMMAND_CATEGORIES, COMMAND_SIDE_EFFECTS, validateCommandMetadata, normalizeCategory, createCommandMetadata, mergeCommandMetadata, getSyntaxArray, formatMetadataForDocs, CommandMetadataRegistry, commandMetadataRegistry, } from './command-metadata';
24
24
  export type { SwapStrategy, SwapExecutionOptions } from '../lib/swap-executor';
25
- export type { MorphOptions, MorphEngine } from '../lib/morph-adapter';
26
- export type { TransitionCallback, ViewTransitionOptions, ViewTransitionsConfig, } from '../lib/view-transitions';
25
+ export type { MorphOptions } from '../lib/morph-adapter';
26
+ export type { TransitionCallback } from '../lib/view-transitions';
27
27
  export type { HistorySwapConfig, HistorySwapInstance } from '../behaviors/history-swap';
28
28
  export type { BoostedConfig, BoostedInstance } from '../behaviors/boosted';
29
29
  export type { SwapCommandInput } from '../commands/dom/swap';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperfixi/core",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "description": "Multilingual, tree-shakeable hyperscript",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -40,6 +40,9 @@
40
40
  "./browser/hybrid-hx": {
41
41
  "default": "./dist/hyperfixi-hx.js"
42
42
  },
43
+ "./browser/hybrid-hx-v4": {
44
+ "default": "./dist/hyperfixi-hx-v4.js"
45
+ },
43
46
  "./commands": {
44
47
  "types": "./dist/commands/index.d.ts",
45
48
  "import": "./dist/commands/index.mjs",
@@ -157,6 +160,7 @@
157
160
  "dist/**/*.d.ts",
158
161
  "dist/**/*.d.cts",
159
162
  "dist/**/*.d.mts",
163
+ "vocab/**/*.js",
160
164
  "README.md",
161
165
  "LICENSE"
162
166
  ],
@@ -173,6 +177,7 @@
173
177
  "build:browser:lite-plus": "rollup -c rollup.browser-lite-plus.config.mjs",
174
178
  "build:browser:hybrid-complete": "rollup -c rollup.browser-hybrid-complete.config.mjs",
175
179
  "build:browser:hybrid-hx": "rollup -c rollup.browser-hybrid-hx.config.mjs",
180
+ "build:browser:hybrid-hx-v4": "rollup -c rollup.browser-hybrid-hx-v4.config.mjs",
176
181
  "build:browser:minimal": "rollup -c rollup.browser-minimal.config.mjs",
177
182
  "build:browser:standard": "rollup -c rollup.browser-standard.config.mjs",
178
183
  "build:browser:classic": "rollup -c rollup.browser-classic.config.mjs",
@@ -180,14 +185,13 @@
180
185
  "build:browser:multilingual": "rollup -c rollup.browser-multilingual.config.mjs",
181
186
  "build:browser:semantic-complete": "rollup -c rollup.browser-semantic-complete.config.mjs",
182
187
  "build:browser:all": "npm run build:browser:dev && npm run build:browser:prod && npm run build:browser:llm && npm run build:browser:lite && npm run build:browser:minimal && npm run build:browser:standard && npm run build:browser:classic && npm run build:browser:classic-i18n && npm run build:browser:multilingual && npm run build:browser:semantic-complete",
183
- "build:browser:esm": "rollup -c rollup.browser-esm.config.mjs",
184
- "build:browser:esm:minimal": "rollup -c rollup.browser-minimal-esm.config.mjs",
185
- "build:browser:esm:standard": "rollup -c rollup.browser-standard-esm.config.mjs",
186
- "build:browser:esm:all": "npm run build:browser:esm && npm run build:browser:esm:minimal && npm run build:browser:esm:standard",
187
188
  "build:browser:modular": "rollup -c rollup.browser-modular.config.mjs",
188
189
  "build:parser-modules": "rollup -c rollup.parser-modules.config.mjs",
190
+ "snapshot:bundle-size": "node scripts/bundle-size-snapshot.mjs --check",
191
+ "snapshot:bundle-size:update": "node scripts/bundle-size-snapshot.mjs --update",
189
192
  "generate:bundle": "tsx scripts/generate-inline-bundle.ts",
190
193
  "generate:bundle:textshelf": "tsx scripts/generate-inline-bundle.ts --config bundle-configs/textshelf.config.json",
194
+ "generate:htmx-vocab": "node scripts/gen-htmx-vocab.mjs",
191
195
  "dev": "rollup -c -w",
192
196
  "test": "timeout 120 vitest run || [ $? -eq 124 ]",
193
197
  "test:watch": "vitest",
@@ -197,16 +201,17 @@
197
201
  "bench:ci": "vitest bench --run --reporter=json --outputFile=benchmark-results/latest.json",
198
202
  "test:ui": "vitest --ui",
199
203
  "test:browser": "npm run build:browser && npx playwright test --project=full",
200
- "test:browser:smoke": "npx playwright test --project=smoke --reporter=list",
204
+ "test:browser:smoke": "node scripts/check-dist-freshness.mjs && npx playwright test --project=smoke --reporter=list",
201
205
  "test:browser:quick": "npm run build:browser && npx playwright test --project=quick --reporter=list",
202
- "test:browser:integration": "npx playwright test --project=integration --reporter=list",
203
- "test:browser:debug": "npx playwright test --project=debug --reporter=list",
204
- "test:browser:commands": "npx playwright test --project=commands --reporter=list",
205
- "test:browser:expressions": "npx playwright test --project=expressions --reporter=list",
206
- "test:browser:i18n": "npx playwright test --project=i18n --reporter=list",
207
- "test:browser:bundles": "npx playwright test --project=bundles --reporter=list",
208
- "test:browser:gallery": "npx playwright test --project=gallery --reporter=list",
209
- "test:browser:ui": "npx playwright test --ui",
206
+ "test:browser:integration": "node scripts/check-dist-freshness.mjs && npx playwright test --project=integration --reporter=list",
207
+ "test:browser:debug": "node scripts/check-dist-freshness.mjs && npx playwright test --project=debug --reporter=list",
208
+ "test:browser:commands": "node scripts/check-dist-freshness.mjs && npx playwright test --project=commands --reporter=list",
209
+ "test:browser:expressions": "node scripts/check-dist-freshness.mjs && npx playwright test --project=expressions --reporter=list",
210
+ "test:browser:i18n": "node scripts/check-dist-freshness.mjs && npx playwright test --project=i18n --reporter=list",
211
+ "test:browser:bundles": "node scripts/check-dist-freshness.mjs && npx playwright test --project=bundles --reporter=list",
212
+ "test:browser:gallery": "node scripts/check-dist-freshness.mjs && npx playwright test --project=gallery --reporter=list",
213
+ "test:browser:ui": "node scripts/check-dist-freshness.mjs && npx playwright test --ui",
214
+ "check:dist-freshness": "node scripts/check-dist-freshness.mjs",
210
215
  "test:comprehensive": "npm run build:browser && npx playwright test --grep '@comprehensive' --reporter=list",
211
216
  "test:check": "timeout 120 vitest run --reporter=dot > /dev/null 2>&1; rc=$?; if [ $rc -eq 0 ] || [ $rc -eq 124 ]; then echo 'Core: PASS (6200+ tests)'; else echo 'Core: FAIL (exit '$rc')'; exit 1; fi",
212
217
  "test:quick": "npm run build:browser && { timeout 120 vitest run --reporter=dot || [ $? -eq 124 ]; }",
@@ -226,7 +231,7 @@
226
231
  "devDependencies": {
227
232
  "@playwright/test": "^1.54.2",
228
233
  "@rollup/plugin-alias": "^6.0.0",
229
- "@rollup/plugin-commonjs": "^28.0.9",
234
+ "@rollup/plugin-commonjs": "^29.0.2",
230
235
  "@rollup/plugin-node-resolve": "^16.0.3",
231
236
  "@rollup/plugin-replace": "^6.0.3",
232
237
  "@rollup/plugin-terser": "^1.0.0",
@@ -236,20 +241,20 @@
236
241
  "@vitest/coverage-v8": "^4.0.17",
237
242
  "@vitest/ui": "^4.0.17",
238
243
  "better-sqlite3": "^12.6.2",
239
- "esbuild": "0.27.4",
244
+ "esbuild": "^0.28.0",
240
245
  "eslint": "^8.57.1",
241
246
  "eslint-config-prettier": "^9.0.0",
242
247
  "eslint-plugin-prettier": "^5.0.0",
243
- "happy-dom": "^20.0.6",
248
+ "happy-dom": "^20.8.9",
244
249
  "http-server": "^14.1.1",
245
- "jsdom": "^26.1.0",
250
+ "jsdom": "^29.0.2",
246
251
  "prettier": "^3.0.0",
247
- "rollup": "^4.28.1",
252
+ "rollup": "^4.60.2",
248
253
  "rollup-plugin-visualizer": "^7.0.0",
249
254
  "tsx": "^4.0.0",
250
255
  "typescript": "^5.8.3",
251
256
  "vite": "^7.1.12",
252
- "vitest": "^4.0.17",
257
+ "vitest": "^4.1.5",
253
258
  "zod": "^3.25.76"
254
259
  },
255
260
  "keywords": [
@@ -279,6 +284,7 @@
279
284
  "access": "public"
280
285
  },
281
286
  "dependencies": {
287
+ "@lokascript/intent": "*",
282
288
  "@lokascript/semantic": "*",
283
289
  "morphlex": "^1.0.5",
284
290
  "tslib": "^2.8.1"
@@ -0,0 +1,60 @@
1
+ // Auto-generated by packages/core/scripts/gen-htmx-vocab.mjs — do not edit by hand.
2
+ // Localized htmx-compat attribute vocab for language: ar
3
+ // Re-generate after editing packages/semantic/src/generators/profiles/arabic.ts
4
+ // or packages/i18n/src/dictionaries/ar.ts.
5
+ (function () {
6
+ if (typeof window === 'undefined' || !window.__hyperfixi_i18n) {
7
+ if (typeof console !== 'undefined') {
8
+ console.warn(
9
+ '[hyperfixi-i18n] Vocab for "ar" loaded before the htmx-compat orchestrator. ' +
10
+ 'Move the hyperfixi-hx-v4 (or core) <script> above the vocab <script>.'
11
+ );
12
+ }
13
+ return;
14
+ }
15
+ window.__hyperfixi_i18n.register('ar', {
16
+ hyperfixi: {
17
+ attrs: {
18
+ "hx-احصل": "hx-get",
19
+ "hx-ضع": "hx-put",
20
+ "hx-الهدف": "hx-target",
21
+ "hx-استبدل": "hx-swap",
22
+ "hx-تشغيل": "hx-trigger",
23
+ "hx-على": "hx-on",
24
+ "hx-مباشر": "hx-live",
25
+ "sse-اتصل": "sse-connect",
26
+ "sse-استبدل": "sse-swap",
27
+ "ws-اتصل": "ws-connect",
28
+ "ws-أرسل": "ws-send"
29
+ },
30
+ events: {
31
+ "نقر": "click",
32
+ "نقر مزدوج": "dblclick",
33
+ "فأرة أسفل": "mousedown",
34
+ "فأرة أعلى": "mouseup",
35
+ "فأرة دخول": "mouseenter",
36
+ "فأرة خروج": "mouseleave",
37
+ "فأرة فوق": "mouseover",
38
+ "فأرة خارج": "mouseout",
39
+ "فأرة تحرك": "mousemove",
40
+ "مفتاح أسفل": "keydown",
41
+ "مفتاح أعلى": "keyup",
42
+ "مفتاح ضغط": "keypress",
43
+ "تركيز": "focus",
44
+ "ضبابية": "blur",
45
+ "تغيير": "change",
46
+ "إدخال": "input",
47
+ "إرسال": "submit",
48
+ "إعادة تعيين": "reset",
49
+ "تحميل": "load",
50
+ "إلغاء تحميل": "unload",
51
+ "تغيير حجم": "resize",
52
+ "تمرير": "scroll",
53
+ "بداية لمس": "touchstart",
54
+ "نهاية لمس": "touchend",
55
+ "تحرك لمس": "touchmove",
56
+ "إلغاء لمس": "touchcancel"
57
+ },
58
+ },
59
+ });
60
+ })();
@@ -0,0 +1,49 @@
1
+ // Auto-generated by packages/core/scripts/gen-htmx-vocab.mjs — do not edit by hand.
2
+ // Localized htmx-compat attribute vocab for language: bn
3
+ // Re-generate after editing packages/semantic/src/generators/profiles/bengali.ts
4
+ // or packages/i18n/src/dictionaries/bn.ts.
5
+ (function () {
6
+ if (typeof window === 'undefined' || !window.__hyperfixi_i18n) {
7
+ if (typeof console !== 'undefined') {
8
+ console.warn(
9
+ '[hyperfixi-i18n] Vocab for "bn" loaded before the htmx-compat orchestrator. ' +
10
+ 'Move the hyperfixi-hx-v4 (or core) <script> above the vocab <script>.'
11
+ );
12
+ }
13
+ return;
14
+ }
15
+ window.__hyperfixi_i18n.register('bn', {
16
+ hyperfixi: {
17
+ attrs: {
18
+ "hx-পান": "hx-get",
19
+ "hx-রাখুন": "hx-put",
20
+ "hx-লক্ষ্য": "hx-target",
21
+ "hx-বদল": "hx-swap",
22
+ "hx-ট্রিগার": "hx-trigger",
23
+ "hx-তে": "hx-on",
24
+ "hx-লাইভ": "hx-live",
25
+ "sse-কানেক্ট": "sse-connect",
26
+ "sse-বদল": "sse-swap",
27
+ "ws-কানেক্ট": "ws-connect",
28
+ "ws-পাঠান": "ws-send"
29
+ },
30
+ events: {
31
+ "ক্লিক": "click",
32
+ "পরিবর্তন": "change",
33
+ "ইনপুট": "input",
34
+ "জমা": "submit",
35
+ "লোড": "load",
36
+ "ফোকাস": "focus",
37
+ "ঝাপসা": "blur",
38
+ "রিসেট": "reset",
39
+ "কি-ডাউন": "keydown",
40
+ "কি-আপ": "keyup",
41
+ "মাউস-ওভার": "mouseover",
42
+ "মাউস-আউট": "mouseout",
43
+ "স্ক্রোল": "scroll",
44
+ "রিসাইজ": "resize",
45
+ "প্রতি": "every"
46
+ },
47
+ },
48
+ });
49
+ })();
@@ -0,0 +1,60 @@
1
+ // Auto-generated by packages/core/scripts/gen-htmx-vocab.mjs — do not edit by hand.
2
+ // Localized htmx-compat attribute vocab for language: de
3
+ // Re-generate after editing packages/semantic/src/generators/profiles/german.ts
4
+ // or packages/i18n/src/dictionaries/de.ts.
5
+ (function () {
6
+ if (typeof window === 'undefined' || !window.__hyperfixi_i18n) {
7
+ if (typeof console !== 'undefined') {
8
+ console.warn(
9
+ '[hyperfixi-i18n] Vocab for "de" loaded before the htmx-compat orchestrator. ' +
10
+ 'Move the hyperfixi-hx-v4 (or core) <script> above the vocab <script>.'
11
+ );
12
+ }
13
+ return;
14
+ }
15
+ window.__hyperfixi_i18n.register('de', {
16
+ hyperfixi: {
17
+ attrs: {
18
+ "hx-holen": "hx-get",
19
+ "hx-setzen": "hx-put",
20
+ "hx-Ziel": "hx-target",
21
+ "hx-austauschen": "hx-swap",
22
+ "hx-auslösen": "hx-trigger",
23
+ "hx-bei": "hx-on",
24
+ "hx-direkt": "hx-live",
25
+ "sse-verbinden": "sse-connect",
26
+ "sse-austauschen": "sse-swap",
27
+ "ws-verbinden": "ws-connect",
28
+ "ws-senden": "ws-send"
29
+ },
30
+ events: {
31
+ "klick": "click",
32
+ "doppelklick": "dblclick",
33
+ "mausunten": "mousedown",
34
+ "mausoben": "mouseup",
35
+ "mauseintreten": "mouseenter",
36
+ "mausverlassen": "mouseleave",
37
+ "mausüber": "mouseover",
38
+ "maushinaus": "mouseout",
39
+ "mausbewegen": "mousemove",
40
+ "tasteunten": "keydown",
41
+ "tasteoben": "keyup",
42
+ "tastedrücken": "keypress",
43
+ "fokus": "focus",
44
+ "unscharf": "blur",
45
+ "ändern": "change",
46
+ "eingabe": "input",
47
+ "absenden": "submit",
48
+ "zurücksetzen": "reset",
49
+ "laden": "load",
50
+ "entladen": "unload",
51
+ "größeändern": "resize",
52
+ "scrollen": "scroll",
53
+ "berührungstart": "touchstart",
54
+ "berührungend": "touchend",
55
+ "berührungbewegen": "touchmove",
56
+ "berührungabbrechen": "touchcancel"
57
+ },
58
+ },
59
+ });
60
+ })();
@@ -0,0 +1,21 @@
1
+ // Auto-generated by packages/core/scripts/gen-htmx-vocab.mjs — do not edit by hand.
2
+ // Localized htmx-compat attribute vocab for language: en
3
+ // Re-generate after editing packages/semantic/src/generators/profiles/english.ts
4
+ // or packages/i18n/src/dictionaries/en.ts.
5
+ (function () {
6
+ if (typeof window === 'undefined' || !window.__hyperfixi_i18n) {
7
+ if (typeof console !== 'undefined') {
8
+ console.warn(
9
+ '[hyperfixi-i18n] Vocab for "en" loaded before the htmx-compat orchestrator. ' +
10
+ 'Move the hyperfixi-hx-v4 (or core) <script> above the vocab <script>.'
11
+ );
12
+ }
13
+ return;
14
+ }
15
+ window.__hyperfixi_i18n.register('en', {
16
+ hyperfixi: {
17
+ attrs: {},
18
+ events: {},
19
+ },
20
+ });
21
+ })();