@hyperfixi/core 2.0.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/LICENSE +21 -0
- package/README.md +218 -0
- package/dist/__test-utils__/context-builders.d.ts +42 -0
- package/dist/__test-utils__/error-testing.d.ts +18 -0
- package/dist/__test-utils__/index.d.ts +6 -0
- package/dist/__test-utils__/mock-types.d.ts +57 -0
- package/dist/__test-utils__/parser-context-mock.d.ts +7 -0
- package/dist/__test-utils__/parser-helpers.d.ts +38 -0
- package/dist/api/dom-processor.d.ts +17 -0
- package/dist/api/hyperscript-api.d.ts +68 -0
- package/dist/api/lokascript-api.d.ts +9 -0
- package/dist/ast-utils/analyzer.d.ts +19 -0
- package/dist/ast-utils/documentation.d.ts +8 -0
- package/dist/ast-utils/generator.d.ts +9 -0
- package/dist/ast-utils/index.d.ts +12 -0
- package/dist/ast-utils/index.js +3366 -0
- package/dist/ast-utils/index.mjs +3320 -0
- package/dist/ast-utils/interchange/from-core.d.ts +8 -0
- package/dist/ast-utils/interchange/index.d.ts +6 -0
- package/dist/ast-utils/interchange/lsp.d.ts +108 -0
- package/dist/ast-utils/interchange/to-core.d.ts +8 -0
- package/dist/ast-utils/interchange/types.d.ts +113 -0
- package/dist/ast-utils/query.d.ts +25 -0
- package/dist/ast-utils/transformer.d.ts +14 -0
- package/dist/ast-utils/types.d.ts +162 -0
- package/dist/ast-utils/visitor.d.ts +40 -0
- package/dist/behaviors/boosted.d.ts +29 -0
- package/dist/behaviors/history-swap.d.ts +24 -0
- package/dist/behaviors/index.d.ts +4 -0
- package/dist/behaviors/index.js +1149 -0
- package/dist/behaviors/index.mjs +1139 -0
- package/dist/bundle-generator/generator.d.ts +4 -0
- package/dist/bundle-generator/index.d.ts +6 -0
- package/dist/bundle-generator/index.js +2294 -0
- package/dist/bundle-generator/index.mjs +2271 -0
- package/dist/bundle-generator/parser-templates.d.ts +6 -0
- package/dist/bundle-generator/template-capabilities.d.ts +10 -0
- package/dist/bundle-generator/templates.d.ts +11 -0
- package/dist/bundle-generator/types.d.ts +34 -0
- package/dist/bundles/test-minimal.d.ts +3 -0
- package/dist/bundles/test-standard.d.ts +3 -0
- package/dist/chunks/bridge-I6ceoWxV.js +2 -0
- package/dist/chunks/browser-modular-Dv6PAV3c.js +2 -0
- package/dist/chunks/feature-eventsource-DWb514fy.js +2 -0
- package/dist/chunks/feature-sockets-3PFuvCVY.js +2 -0
- package/dist/chunks/feature-webworker-DTm_eh-E.js +2 -0
- package/dist/commands/advanced/async.d.ts +28 -0
- package/dist/commands/advanced/js.d.ts +28 -0
- package/dist/commands/animation/measure.d.ts +31 -0
- package/dist/commands/animation/settle.d.ts +26 -0
- package/dist/commands/animation/take.d.ts +28 -0
- package/dist/commands/animation/transition.d.ts +31 -0
- package/dist/commands/async/fetch.d.ts +44 -0
- package/dist/commands/async/wait.d.ts +41 -0
- package/dist/commands/behaviors/install.d.ts +41 -0
- package/dist/commands/content/append.d.ts +27 -0
- package/dist/commands/control-flow/break.d.ts +15 -0
- package/dist/commands/control-flow/continue.d.ts +15 -0
- package/dist/commands/control-flow/exit.d.ts +15 -0
- package/dist/commands/control-flow/halt.d.ts +25 -0
- package/dist/commands/control-flow/if.d.ts +45 -0
- package/dist/commands/control-flow/repeat.d.ts +35 -0
- package/dist/commands/control-flow/return.d.ts +23 -0
- package/dist/commands/control-flow/signal-base.d.ts +25 -0
- package/dist/commands/control-flow/throw.d.ts +22 -0
- package/dist/commands/control-flow/unless.d.ts +3 -0
- package/dist/commands/data/decrement.d.ts +3 -0
- package/dist/commands/data/default.d.ts +31 -0
- package/dist/commands/data/get.d.ts +23 -0
- package/dist/commands/data/increment.d.ts +25 -0
- package/dist/commands/data/set.d.ts +56 -0
- package/dist/commands/decorators/index.d.ts +30 -0
- package/dist/commands/dom/__tests__/add-standalone-helpers.d.ts +11 -0
- package/dist/commands/dom/add.d.ts +31 -0
- package/dist/commands/dom/dom-modification-base.d.ts +48 -0
- package/dist/commands/dom/hide.d.ts +12 -0
- package/dist/commands/dom/make.d.ts +21 -0
- package/dist/commands/dom/process-partials.d.ts +39 -0
- package/dist/commands/dom/put.d.ts +31 -0
- package/dist/commands/dom/remove.d.ts +33 -0
- package/dist/commands/dom/show.d.ts +13 -0
- package/dist/commands/dom/swap.d.ts +38 -0
- package/dist/commands/dom/toggle.d.ts +55 -0
- package/dist/commands/dom/visibility-base.d.ts +20 -0
- package/dist/commands/events/send.d.ts +3 -0
- package/dist/commands/events/trigger.d.ts +36 -0
- package/dist/commands/execution/call.d.ts +24 -0
- package/dist/commands/execution/pseudo-command.d.ts +42 -0
- package/dist/commands/helpers/attribute-manipulation.d.ts +11 -0
- package/dist/commands/helpers/batch-dom-operations.d.ts +12 -0
- package/dist/commands/helpers/class-manipulation.d.ts +11 -0
- package/dist/commands/helpers/condition-helpers.d.ts +4 -0
- package/dist/commands/helpers/dom-mutation.d.ts +15 -0
- package/dist/commands/helpers/duration-parsing.d.ts +8 -0
- package/dist/commands/helpers/element-property-access.d.ts +7 -0
- package/dist/commands/helpers/element-resolution.d.ts +17 -0
- package/dist/commands/helpers/error-helpers.d.ts +17 -0
- package/dist/commands/helpers/event-helpers.d.ts +13 -0
- package/dist/commands/helpers/event-waiting.d.ts +37 -0
- package/dist/commands/helpers/index.d.ts +32 -0
- package/dist/commands/helpers/input-validator.d.ts +23 -0
- package/dist/commands/helpers/loop-executor.d.ts +53 -0
- package/dist/commands/helpers/numeric-target-parser.d.ts +14 -0
- package/dist/commands/helpers/property-target.d.ts +30 -0
- package/dist/commands/helpers/selector-type-detection.d.ts +24 -0
- package/dist/commands/helpers/smart-element.d.ts +16 -0
- package/dist/commands/helpers/style-manipulation.d.ts +16 -0
- package/dist/commands/helpers/temporal-modifiers.d.ts +15 -0
- package/dist/commands/helpers/url-argument-parser.d.ts +10 -0
- package/dist/commands/helpers/url-validation.d.ts +7 -0
- package/dist/commands/helpers/variable-access.d.ts +10 -0
- package/dist/commands/helpers/visibility-target-parser.d.ts +11 -0
- package/dist/commands/index.d.ts +139 -0
- package/dist/commands/index.js +9186 -0
- package/dist/commands/index.mjs +9032 -0
- package/dist/commands/navigation/go.d.ts +35 -0
- package/dist/commands/navigation/push-url.d.ts +35 -0
- package/dist/commands/navigation/replace-url.d.ts +3 -0
- package/dist/commands/templates/render.d.ts +48 -0
- package/dist/commands/utility/beep.d.ts +32 -0
- package/dist/commands/utility/copy.d.ts +29 -0
- package/dist/commands/utility/log.d.ts +24 -0
- package/dist/commands/utility/pick.d.ts +26 -0
- package/dist/commands/utility/tell.d.ts +26 -0
- package/dist/compatibility/browser-bundle-animation-generated.d.ts +16 -0
- package/dist/compatibility/browser-bundle-classic-i18n.d.ts +63 -0
- package/dist/compatibility/browser-bundle-classic.d.ts +17 -0
- package/dist/compatibility/browser-bundle-forms-generated.d.ts +16 -0
- package/dist/compatibility/browser-bundle-hybrid-complete.d.ts +28 -0
- package/dist/compatibility/browser-bundle-hybrid-hx.d.ts +43 -0
- package/dist/compatibility/browser-bundle-lite-plus.d.ts +25 -0
- package/dist/compatibility/browser-bundle-lite.d.ts +23 -0
- package/dist/compatibility/browser-bundle-minimal-generated.d.ts +16 -0
- package/dist/compatibility/browser-bundle-minimal-v2.d.ts +17 -0
- package/dist/compatibility/browser-bundle-minimal.d.ts +8 -0
- package/dist/compatibility/browser-bundle-modular.d.ts +18 -0
- package/dist/compatibility/browser-bundle-multilingual.d.ts +19 -0
- package/dist/compatibility/browser-bundle-semantic-complete.d.ts +24 -0
- package/dist/compatibility/browser-bundle-standard-v2.d.ts +17 -0
- package/dist/compatibility/browser-bundle-standard.d.ts +8 -0
- package/dist/compatibility/browser-bundle-textshelf-minimal.d.ts +16 -0
- package/dist/compatibility/browser-bundle-textshelf-profile.d.ts +18 -0
- package/dist/compatibility/browser-bundle.d.ts +140 -0
- package/dist/compatibility/browser-modular.d.ts +53 -0
- package/dist/compatibility/browser-tests/test-utils.d.ts +21 -0
- package/dist/compatibility/eval-hyperscript.d.ts +15 -0
- package/dist/compatibility/feature-loader.d.ts +8 -0
- package/dist/compatibility/hyperscript-adapter.d.ts +38 -0
- package/dist/compatibility/hyperscript-tests/test-adapter.d.ts +13 -0
- package/dist/core/ast-property-utils.d.ts +2 -0
- package/dist/core/base-expression-evaluator.d.ts +70 -0
- package/dist/core/binary-expression-evaluator.d.ts +7 -0
- package/dist/core/call-expression-evaluator.d.ts +7 -0
- package/dist/core/configurable-expression-evaluator.d.ts +5 -0
- package/dist/core/context.d.ts +15 -0
- package/dist/core/dom.d.ts +15 -0
- package/dist/core/evaluator-types.d.ts +5 -0
- package/dist/core/events.d.ts +48 -0
- package/dist/core/executor.d.ts +34 -0
- package/dist/core/expression-evaluator.d.ts +6 -0
- package/dist/core/lazy-expression-evaluator.d.ts +22 -0
- package/dist/core/parser.d.ts +21 -0
- package/dist/core/selector-evaluator.d.ts +15 -0
- package/dist/core/template-literal-evaluator.d.ts +5 -0
- package/dist/dom/attribute-processor.d.ts +40 -0
- package/dist/dom/minimal-attribute-processor.d.ts +20 -0
- package/dist/experimental/binary-tree/accessor.d.ts +10 -0
- package/dist/experimental/binary-tree/ast-serializer.d.ts +26 -0
- package/dist/experimental/binary-tree/benchmark.d.ts +24 -0
- package/dist/experimental/binary-tree/buffer-context.d.ts +27 -0
- package/dist/experimental/binary-tree/deserializer.d.ts +17 -0
- package/dist/experimental/binary-tree/index.d.ts +22 -0
- package/dist/experimental/binary-tree/serializer.d.ts +4 -0
- package/dist/experimental/binary-tree/types.d.ts +54 -0
- package/dist/expressions/base-expression.d.ts +27 -0
- package/dist/expressions/bundles/common-expressions.d.ts +9 -0
- package/dist/expressions/bundles/core-expressions.d.ts +7 -0
- package/dist/expressions/bundles/full-expressions.d.ts +10 -0
- package/dist/expressions/bundles/index.d.ts +7 -0
- package/dist/expressions/comparison/index.d.ts +80 -0
- package/dist/expressions/comparison/utils.d.ts +2 -0
- package/dist/expressions/conversion/impl/bridge.d.ts +117 -0
- package/dist/expressions/conversion/impl/index.d.ts +59 -0
- package/dist/expressions/conversion/index.d.ts +23 -0
- package/dist/expressions/expression-tiers.d.ts +13 -0
- package/dist/expressions/index.d.ts +11 -0
- package/dist/expressions/index.js +6930 -0
- package/dist/expressions/index.mjs +6912 -0
- package/dist/expressions/logical/impl/index.d.ts +54 -0
- package/dist/expressions/logical/impl/pattern-matching.d.ts +58 -0
- package/dist/expressions/logical/index.d.ts +59 -0
- package/dist/expressions/mathematical/index.d.ts +69 -0
- package/dist/expressions/positional/impl/bridge.d.ts +95 -0
- package/dist/expressions/positional/impl/index.d.ts +73 -0
- package/dist/expressions/positional/index.d.ts +26 -0
- package/dist/expressions/properties/impl/index.d.ts +105 -0
- package/dist/expressions/properties/index.d.ts +26 -0
- package/dist/expressions/property/index.d.ts +55 -0
- package/dist/expressions/property-access-utils.d.ts +23 -0
- package/dist/expressions/references/impl/bridge.d.ts +54 -0
- package/dist/expressions/references/impl/index.d.ts +65 -0
- package/dist/expressions/references/index.d.ts +40 -0
- package/dist/expressions/shared/comparison-utils.d.ts +10 -0
- package/dist/expressions/shared/index.d.ts +9 -0
- package/dist/expressions/shared/number-utils.d.ts +7 -0
- package/dist/expressions/shared/validation-utils.d.ts +13 -0
- package/dist/expressions/special/index.d.ts +104 -0
- package/dist/expressions/type-helpers.d.ts +11 -0
- package/dist/expressions/type-registry.d.ts +57 -0
- package/dist/expressions/validation-helpers.d.ts +15 -0
- package/dist/extensions/index.d.ts +3 -0
- package/dist/extensions/tailwind.d.ts +22 -0
- package/dist/features/behaviors.d.ts +153 -0
- package/dist/features/def.d.ts +135 -0
- package/dist/features/eventsource.d.ts +140 -0
- package/dist/features/init.d.ts +135 -0
- package/dist/features/on.d.ts +131 -0
- package/dist/features/predefined-behaviors/dropdown-behavior.d.ts +20 -0
- package/dist/features/predefined-behaviors/index.d.ts +12 -0
- package/dist/features/predefined-behaviors/modal-behavior.d.ts +18 -0
- package/dist/features/predefined-behaviors/toggle-group-behavior.d.ts +23 -0
- package/dist/features/predefined-behaviors/types.d.ts +14 -0
- package/dist/features/sockets.d.ts +162 -0
- package/dist/features/webworker.d.ts +135 -0
- package/dist/htmx/htmx-attribute-processor.d.ts +84 -0
- package/dist/htmx/htmx-translator.d.ts +19 -0
- package/dist/htmx/index.d.ts +3 -0
- package/dist/hyperfixi-classic-i18n.js +2 -0
- package/dist/hyperfixi-hx.js +1 -0
- package/dist/hyperfixi-hybrid-complete.js +1 -0
- package/dist/hyperfixi-lite-plus.js +1 -0
- package/dist/hyperfixi-lite.js +1 -0
- package/dist/hyperfixi-minimal.js +1 -0
- package/dist/hyperfixi-multilingual.js +2 -0
- package/dist/hyperfixi-standard.js +2 -0
- package/dist/hyperfixi.js +2 -0
- package/dist/hyperfixi.mjs +2 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +65387 -0
- package/dist/index.min.js +2 -0
- package/dist/index.mjs +65343 -0
- package/dist/lib/index.d.ts +4 -0
- package/dist/lib/morph-adapter.d.ts +22 -0
- package/dist/lib/swap-executor.d.ts +22 -0
- package/dist/lib/view-transitions.d.ts +33 -0
- package/dist/lokascript-browser-classic-i18n.js +2 -0
- package/dist/lokascript-browser-minimal.js +1 -0
- package/dist/lokascript-browser-standard.js +2 -0
- package/dist/lokascript-browser.js +2 -0
- package/dist/lokascript-hybrid-complete.js +1 -0
- package/dist/lokascript-hybrid-hx.js +1 -0
- package/dist/lokascript-lite-plus.js +1 -0
- package/dist/lokascript-lite.js +1 -0
- package/dist/lokascript-multilingual.js +2 -0
- package/dist/lsp-metadata.d.ts +25 -0
- package/dist/lsp-metadata.js +680 -0
- package/dist/lsp-metadata.mjs +670 -0
- package/dist/metadata.d.ts +213 -0
- package/dist/metadata.js +378 -0
- package/dist/metadata.mjs +368 -0
- package/dist/mod.d.ts +63 -0
- package/dist/multilingual/bridge.d.ts +36 -0
- package/dist/multilingual/index.d.ts +32 -0
- package/dist/multilingual/index.js +285 -0
- package/dist/multilingual/index.mjs +278 -0
- package/dist/parser/__types__/test-helpers.d.ts +25 -0
- package/dist/parser/command-node-builder.d.ts +45 -0
- package/dist/parser/command-parsers/animation-commands.d.ts +5 -0
- package/dist/parser/command-parsers/async-commands.d.ts +5 -0
- package/dist/parser/command-parsers/control-flow-commands.d.ts +7 -0
- package/dist/parser/command-parsers/dom-commands.d.ts +8 -0
- package/dist/parser/command-parsers/event-commands.d.ts +4 -0
- package/dist/parser/command-parsers/utility-commands.d.ts +9 -0
- package/dist/parser/command-parsers/variable-commands.d.ts +12 -0
- package/dist/parser/error-handler.d.ts +34 -0
- package/dist/parser/expression-parser.d.ts +6 -0
- package/dist/parser/full-parser.d.ts +4 -0
- package/dist/parser/full-parser.js +6532 -0
- package/dist/parser/full-parser.mjs +6529 -0
- package/dist/parser/helpers/ast-helpers.d.ts +22 -0
- package/dist/parser/helpers/parsing-helpers.d.ts +19 -0
- package/dist/parser/helpers/token-helpers.d.ts +28 -0
- package/dist/parser/hybrid/aliases.d.ts +7 -0
- package/dist/parser/hybrid/aliases.js +44 -0
- package/dist/parser/hybrid/aliases.mjs +37 -0
- package/dist/parser/hybrid/ast-types.d.ts +97 -0
- package/dist/parser/hybrid/ast-types.js +3 -0
- package/dist/parser/hybrid/ast-types.mjs +2 -0
- package/dist/parser/hybrid/index.d.ts +6 -0
- package/dist/parser/hybrid/index.js +1015 -0
- package/dist/parser/hybrid/index.mjs +1005 -0
- package/dist/parser/hybrid/parser-core.d.ts +57 -0
- package/dist/parser/hybrid/parser-core.js +1001 -0
- package/dist/parser/hybrid/parser-core.mjs +999 -0
- package/dist/parser/hybrid/tokenizer.d.ts +9 -0
- package/dist/parser/hybrid/tokenizer.js +242 -0
- package/dist/parser/hybrid/tokenizer.mjs +239 -0
- package/dist/parser/hybrid-parser.d.ts +10 -0
- package/dist/parser/hybrid-parser.js +1078 -0
- package/dist/parser/hybrid-parser.mjs +1071 -0
- package/dist/parser/parser-constants.d.ts +102 -0
- package/dist/parser/parser-interface.d.ts +11 -0
- package/dist/parser/parser-types.d.ts +175 -0
- package/dist/parser/parser.d.ts +146 -0
- package/dist/parser/regex-parser.d.ts +4 -0
- package/dist/parser/regex-parser.js +412 -0
- package/dist/parser/regex-parser.mjs +409 -0
- package/dist/parser/runtime.d.ts +3 -0
- package/dist/parser/semantic-integration.d.ts +61 -0
- package/dist/parser/token-consumer.d.ts +35 -0
- package/dist/parser/token-predicates.d.ts +77 -0
- package/dist/parser/tokenizer.d.ts +57 -0
- package/dist/parser/types.d.ts +118 -0
- package/dist/performance/expression-cache.d.ts +78 -0
- package/dist/performance/integration.d.ts +40 -0
- package/dist/performance/production-monitor.d.ts +67 -0
- package/dist/reference/index.d.ts +41 -0
- package/dist/reference/index.js +586 -0
- package/dist/reference/index.mjs +577 -0
- package/dist/registry/browser-types.d.ts +20 -0
- package/dist/registry/browser-types.js +81 -0
- package/dist/registry/browser-types.mjs +76 -0
- package/dist/registry/context-provider-registry.d.ts +38 -0
- package/dist/registry/environment.d.ts +19 -0
- package/dist/registry/environment.js +36 -0
- package/dist/registry/environment.mjs +30 -0
- package/dist/registry/event-source-registry.d.ts +54 -0
- package/dist/registry/examples/server-commands.d.ts +6 -0
- package/dist/registry/examples/server-event-source.d.ts +32 -0
- package/dist/registry/index.d.ts +54 -0
- package/dist/registry/index.js +7636 -0
- package/dist/registry/index.mjs +7612 -0
- package/dist/registry/multilingual/examples.d.ts +16 -0
- package/dist/registry/multilingual/index.d.ts +68 -0
- package/dist/registry/runtime-integration.d.ts +30 -0
- package/dist/registry/universal-types.d.ts +34 -0
- package/dist/registry/universal-types.js +91 -0
- package/dist/registry/universal-types.mjs +86 -0
- package/dist/runtime/cleanup-registry.d.ts +47 -0
- package/dist/runtime/command-adapter.d.ts +63 -0
- package/dist/runtime/environment.d.ts +75 -0
- package/dist/runtime/runtime-base.d.ts +78 -0
- package/dist/runtime/runtime-experimental.d.ts +18 -0
- package/dist/runtime/runtime-factory.d.ts +30 -0
- package/dist/runtime/runtime.d.ts +19 -0
- package/dist/runtime/temporal-modifiers.d.ts +37 -0
- package/dist/scripts/code-generator.d.ts +64 -0
- package/dist/scripts/generate-missing-commands.d.ts +4 -0
- package/dist/test-setup.d.ts +45 -0
- package/dist/test-utilities.d.ts +52 -0
- package/dist/tokenizer.d.ts +49 -0
- package/dist/types/base-types.d.ts +336 -0
- package/dist/types/code-fix.d.ts +39 -0
- package/dist/types/command-metadata.d.ts +57 -0
- package/dist/types/command-types.d.ts +272 -0
- package/dist/types/context-types.d.ts +106 -0
- package/dist/types/core-context.d.ts +21 -0
- package/dist/types/core.d.ts +203 -0
- package/dist/types/error-codes.d.ts +207 -0
- package/dist/types/expression-types.d.ts +155 -0
- package/dist/types/feature-types.d.ts +81 -0
- package/dist/types/hooks.d.ts +45 -0
- package/dist/types/index.d.ts +32 -0
- package/dist/types/result.d.ts +72 -0
- package/dist/types/template-types.d.ts +162 -0
- package/dist/types/type-guards.d.ts +24 -0
- package/dist/types/unified-types.d.ts +99 -0
- package/dist/utils/debug-events.d.ts +41 -0
- package/dist/utils/debug.d.ts +35 -0
- package/dist/utils/dom-utils.d.ts +16 -0
- package/dist/utils/element-check.d.ts +7 -0
- package/dist/utils/keyboard-shortcuts.d.ts +18 -0
- package/dist/utils/performance.d.ts +40 -0
- package/dist/validation/command-pattern-validator.d.ts +53 -0
- package/dist/validation/common-validators.d.ts +24 -0
- package/dist/validation/lightweight-validators.d.ts +113 -0
- package/dist/validation/partial-validation-types.d.ts +50 -0
- package/dist/validation/partial-validator.d.ts +6 -0
- package/dist/validation/partial-warning-formatter.d.ts +6 -0
- package/dist/validation/validate-cli.d.ts +41 -0
- package/package.json +292 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 HyperFixi Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
# @lokascript/core
|
|
2
|
+
|
|
3
|
+
🚀 **Complete hyperscript implementation with 100% \_hyperscript compatibility**
|
|
4
|
+
|
|
5
|
+
An experimental hyperscript engine that provides fast parsing, command execution, and comprehensive error handling for web applications. Built with TypeScript-first design and full compatibility with the official \_hyperscript library.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- 🎯 **100% \_hyperscript Compatible** - Full compatibility with official \_hyperscript library
|
|
10
|
+
- 🚀 **High Performance** - Optimized tokenizer and parser for large expressions
|
|
11
|
+
- 🔧 **TypeScript First** - Complete type safety with comprehensive type definitions
|
|
12
|
+
- 🧪 **Thoroughly Tested** - 2800+ tests with 98.5%+ reliability
|
|
13
|
+
- 🌊 **Complete Command System** - All major commands implemented (PUT, SET, ADD, SHOW/HIDE, etc.)
|
|
14
|
+
- ⚡ **HTML Integration** - Automatic `_=""` attribute processing and event binding
|
|
15
|
+
- 🛡️ **Error Recovery** - Graceful handling of syntax errors with helpful guidance
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install @lokascript/core
|
|
21
|
+
# or
|
|
22
|
+
yarn add @lokascript/core
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Quick Start
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
import { hyperscript } from '@lokascript/core';
|
|
29
|
+
|
|
30
|
+
// Simple expression evaluation
|
|
31
|
+
const result = await hyperscript.run('5 + 3 * 2'); // Returns 11
|
|
32
|
+
|
|
33
|
+
// DOM manipulation with commands
|
|
34
|
+
const button = document.getElementById('myButton');
|
|
35
|
+
const context = hyperscript.createContext(button);
|
|
36
|
+
|
|
37
|
+
await hyperscript.run('hide me', context); // Hides the button
|
|
38
|
+
await hyperscript.run('put "Hello World" into my innerHTML', context);
|
|
39
|
+
await hyperscript.run('set my className to "active"', context);
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### HTML Integration (Automatic)
|
|
43
|
+
|
|
44
|
+
```html
|
|
45
|
+
<!-- Automatic attribute processing - works out of the box -->
|
|
46
|
+
<button _="on click put 'Hello!' into #output">Click me</button>
|
|
47
|
+
<div id="output"></div>
|
|
48
|
+
|
|
49
|
+
<!-- Complex interactions -->
|
|
50
|
+
<button _="on click set my innerHTML to 'Clicked!' then wait 1s then hide me">
|
|
51
|
+
Temporary Button
|
|
52
|
+
</button>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Debugging
|
|
56
|
+
|
|
57
|
+
LokaScript includes a built-in debug control API for troubleshooting compilation and execution issues.
|
|
58
|
+
|
|
59
|
+
### Enable Debug Logging
|
|
60
|
+
|
|
61
|
+
```javascript
|
|
62
|
+
// In browser console
|
|
63
|
+
lokascript.debugControl.enable(); // Enable detailed logging
|
|
64
|
+
// Reload page to see logs
|
|
65
|
+
|
|
66
|
+
lokascript.debugControl.disable(); // Disable logging
|
|
67
|
+
lokascript.debugControl.isEnabled(); // Check if enabled
|
|
68
|
+
lokascript.debugControl.status(); // Get detailed status
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Debug settings persist across page reloads via localStorage. Logs include:
|
|
72
|
+
|
|
73
|
+
- Parser selection (semantic vs traditional)
|
|
74
|
+
- Expression evaluation steps
|
|
75
|
+
- Command execution flow
|
|
76
|
+
- Event handling
|
|
77
|
+
|
|
78
|
+
### Compilation Metadata
|
|
79
|
+
|
|
80
|
+
Every compilation returns metadata about parser usage and warnings:
|
|
81
|
+
|
|
82
|
+
```javascript
|
|
83
|
+
const result = lokascript.compile('toggle .active');
|
|
84
|
+
console.log(result.metadata);
|
|
85
|
+
// {
|
|
86
|
+
// parserUsed: 'semantic',
|
|
87
|
+
// semanticConfidence: 0.98,
|
|
88
|
+
// semanticLanguage: 'en',
|
|
89
|
+
// warnings: []
|
|
90
|
+
// }
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Runtime Hooks
|
|
94
|
+
|
|
95
|
+
LokaScript provides a hooks system for observing and intercepting command execution:
|
|
96
|
+
|
|
97
|
+
```javascript
|
|
98
|
+
import { HookRegistry, createHooks } from '@lokascript/core';
|
|
99
|
+
|
|
100
|
+
// Create hooks for logging, analytics, or debugging
|
|
101
|
+
const hooks = createHooks({
|
|
102
|
+
beforeExecute: ctx => {
|
|
103
|
+
console.log(`Executing: ${ctx.commandName}`);
|
|
104
|
+
},
|
|
105
|
+
afterExecute: (ctx, result) => {
|
|
106
|
+
console.log(`Completed: ${ctx.commandName}`, result);
|
|
107
|
+
},
|
|
108
|
+
onError: (ctx, error) => {
|
|
109
|
+
console.error(`Error in ${ctx.commandName}:`, error);
|
|
110
|
+
return error; // Can transform or wrap the error
|
|
111
|
+
},
|
|
112
|
+
interceptCommand: (name, ctx) => {
|
|
113
|
+
// Return true to skip command execution
|
|
114
|
+
return name === 'disabled-command';
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
// Register hooks with the runtime
|
|
119
|
+
lokascript.registerHooks('my-hooks', hooks);
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Built-in hook utilities:
|
|
123
|
+
|
|
124
|
+
- `loggingHooks()` - Pre-configured debug logging hooks
|
|
125
|
+
- `createTimingHooks()` - Performance timing hooks
|
|
126
|
+
|
|
127
|
+
## Cleanup & Memory Management
|
|
128
|
+
|
|
129
|
+
The runtime automatically tracks event listeners and observers for cleanup when elements are removed from the DOM. You can also manually trigger cleanup:
|
|
130
|
+
|
|
131
|
+
```javascript
|
|
132
|
+
// Clean up a specific element
|
|
133
|
+
lokascript.cleanup(element);
|
|
134
|
+
|
|
135
|
+
// Clean up element and all descendants
|
|
136
|
+
lokascript.cleanupTree(containerElement);
|
|
137
|
+
|
|
138
|
+
// Get cleanup statistics
|
|
139
|
+
const stats = lokascript.getCleanupStats();
|
|
140
|
+
// { elementsTracked: 5, listeners: 12, observers: 2, ... }
|
|
141
|
+
|
|
142
|
+
// Full runtime shutdown
|
|
143
|
+
lokascript.destroy();
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## API Reference
|
|
147
|
+
|
|
148
|
+
For complete API documentation, see [API.md](./docs/API.md).
|
|
149
|
+
|
|
150
|
+
### Main Methods
|
|
151
|
+
|
|
152
|
+
- `hyperscript.compile(code)` - Compile hyperscript to AST
|
|
153
|
+
- `hyperscript.execute(ast, context)` - Execute compiled AST
|
|
154
|
+
- `hyperscript.run(code, context)` - Compile and execute in one step
|
|
155
|
+
- `hyperscript.createContext(element)` - Create execution context
|
|
156
|
+
- `evalHyperScript(code, context)` - \_hyperscript compatibility API
|
|
157
|
+
- `hyperscript.registerHooks(name, hooks)` - Register runtime hooks
|
|
158
|
+
- `hyperscript.cleanup(element)` - Clean up element resources
|
|
159
|
+
- `hyperscript.destroy()` - Full runtime shutdown
|
|
160
|
+
|
|
161
|
+
## Supported Features
|
|
162
|
+
|
|
163
|
+
### Commands (All Implemented)
|
|
164
|
+
|
|
165
|
+
- **DOM Manipulation**: `hide me`, `show me`, `toggle me`
|
|
166
|
+
- **Content Management**: `put "text" into me`, `set my innerHTML to "content"`
|
|
167
|
+
- **CSS Classes**: `add .class to me`, `remove .class from me`
|
|
168
|
+
- **Data Operations**: `increment x`, `decrement y`
|
|
169
|
+
- **Control Flow**: `if condition`, `repeat N times`, `break`, `continue`
|
|
170
|
+
- **Async Operations**: `wait 500ms`, `fetch "/api/data"`
|
|
171
|
+
- **Events**: `send customEvent to me`
|
|
172
|
+
|
|
173
|
+
### Expressions (100% \_hyperscript Compatible)
|
|
174
|
+
|
|
175
|
+
- **Arithmetic**: `5 + 3 * 2`, `value / 2`, `x mod 3`
|
|
176
|
+
- **Logical**: `true and false`, `value > 10`, `x contains y`
|
|
177
|
+
- **Property Access**: `my property`, `element.property`, `object's method()`
|
|
178
|
+
- **Context Variables**: `me`, `it`, `you`, `result`
|
|
179
|
+
- **Type Conversion**: `"123" as Int`, `form as Values`
|
|
180
|
+
- **CSS Selectors**: `<button/>`, `closest <form/>`
|
|
181
|
+
|
|
182
|
+
### HTML Integration
|
|
183
|
+
|
|
184
|
+
- **Automatic Processing**: All `_=""` attributes processed automatically
|
|
185
|
+
- **Event Binding**: `on click`, `on submit`, `on change` etc.
|
|
186
|
+
- **DOM Context**: Automatic `me`, `you`, `it` context setup
|
|
187
|
+
|
|
188
|
+
## Examples
|
|
189
|
+
|
|
190
|
+
See [EXAMPLES.md](./docs/EXAMPLES.md) for comprehensive usage examples.
|
|
191
|
+
|
|
192
|
+
## Compatibility Testing
|
|
193
|
+
|
|
194
|
+
This package includes compatibility tests that validate LokaScript against the official \_hyperscript library:
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
# Run compatibility tests with official hyperscript test suite
|
|
198
|
+
npm run test:browser
|
|
199
|
+
|
|
200
|
+
# Run only command compatibility tests
|
|
201
|
+
npx playwright test --grep "Command Tests"
|
|
202
|
+
|
|
203
|
+
# Run only expression compatibility tests
|
|
204
|
+
npx playwright test --grep "Expression Tests"
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
The compatibility tests measure:
|
|
208
|
+
|
|
209
|
+
- **Expression compatibility**: **100%** (15/15 tests passing) ✅
|
|
210
|
+
- **Command compatibility**: **100%** (2/2 core tests passing) ✅
|
|
211
|
+
- **HTML Integration**: **100%** (3/3 integration tests passing) ✅
|
|
212
|
+
- **Overall compatibility**: **~95%** across all hyperscript features ✅
|
|
213
|
+
|
|
214
|
+
View detailed test results at `http://localhost:9323` after running browser tests.
|
|
215
|
+
|
|
216
|
+
## License
|
|
217
|
+
|
|
218
|
+
MIT - see [LICENSE](../../LICENSE) file for details.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { TestExpressionContext } from '../test-utilities';
|
|
2
|
+
export interface TestContextOptions {
|
|
3
|
+
element?: Element;
|
|
4
|
+
me?: Element;
|
|
5
|
+
you?: Element;
|
|
6
|
+
it?: unknown;
|
|
7
|
+
result?: unknown;
|
|
8
|
+
target?: EventTarget;
|
|
9
|
+
event?: Event;
|
|
10
|
+
globals?: Record<string, unknown>;
|
|
11
|
+
locals?: Map<string, unknown>;
|
|
12
|
+
meta?: Map<string, unknown> | Record<string, unknown>;
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
}
|
|
15
|
+
export declare class TestContextBuilder {
|
|
16
|
+
private options;
|
|
17
|
+
withElement(element: Element): this;
|
|
18
|
+
withMe(me: Element): this;
|
|
19
|
+
withYou(you: Element): this;
|
|
20
|
+
withIt(it: unknown): this;
|
|
21
|
+
withResult(result: unknown): this;
|
|
22
|
+
withTarget(target: EventTarget): this;
|
|
23
|
+
withEvent(event: Event): this;
|
|
24
|
+
withGlobal<T>(key: string, value: T): this;
|
|
25
|
+
withGlobals(globals: Record<string, unknown>): this;
|
|
26
|
+
withLocal<T>(key: string, value: T): this;
|
|
27
|
+
withLocals(locals: Record<string, unknown>): this;
|
|
28
|
+
withMeta(key: string, value: unknown): this;
|
|
29
|
+
withProperty<T>(key: string, value: T): this;
|
|
30
|
+
build(): TestExpressionContext;
|
|
31
|
+
}
|
|
32
|
+
export declare function createTestContext(options?: TestContextOptions): TestExpressionContext;
|
|
33
|
+
export declare function createMinimalContext(element?: Element): TestExpressionContext;
|
|
34
|
+
export declare function createMockElement(tagName?: string, attributes?: Record<string, string>): Element;
|
|
35
|
+
export declare function createMockEvent(type: string, options?: {
|
|
36
|
+
target?: EventTarget;
|
|
37
|
+
currentTarget?: EventTarget;
|
|
38
|
+
bubbles?: boolean;
|
|
39
|
+
cancelable?: boolean;
|
|
40
|
+
[key: string]: unknown;
|
|
41
|
+
}): Event;
|
|
42
|
+
//# sourceMappingURL=context-builders.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare function assertIsError(value: unknown): asserts value is Error;
|
|
2
|
+
export declare function assertErrorType<T extends Error>(value: unknown, ErrorType: new (...args: unknown[]) => T): asserts value is T;
|
|
3
|
+
export declare function expectErrorMessage(error: unknown, pattern: string | RegExp): void;
|
|
4
|
+
export declare function expectThrows<T extends Error = Error>(fn: () => void, ErrorType?: new (...args: unknown[]) => T, messagePattern?: string | RegExp): T;
|
|
5
|
+
export declare function expectThrowsAsync<T extends Error = Error>(fn: () => Promise<void>, ErrorType?: new (...args: unknown[]) => T, messagePattern?: string | RegExp): Promise<T>;
|
|
6
|
+
export declare function handleError<T>(error: unknown, handler: (error: Error) => T, fallback?: (value: unknown) => T): T;
|
|
7
|
+
export declare function hasErrorProperty<K extends string>(error: unknown, property: K): error is Error & Record<K, unknown>;
|
|
8
|
+
export declare function getErrorProperty<T = unknown>(error: unknown, property: string): T | undefined;
|
|
9
|
+
export declare function assertErrorHasProperty<K extends string>(error: unknown, property: K): asserts error is Error & Record<K, unknown>;
|
|
10
|
+
export interface ErrorExpectation<T extends Error = Error> {
|
|
11
|
+
type?: new (...args: unknown[]) => T;
|
|
12
|
+
message?: string | RegExp;
|
|
13
|
+
code?: string;
|
|
14
|
+
properties?: Record<string, unknown>;
|
|
15
|
+
}
|
|
16
|
+
export declare function expectThrowsMatching<T extends Error = Error>(fn: () => void, expectation: ErrorExpectation<T>): T;
|
|
17
|
+
export declare function expectThrowsMatchingAsync<T extends Error = Error>(fn: () => Promise<void>, expectation: ErrorExpectation<T>): Promise<T>;
|
|
18
|
+
//# sourceMappingURL=error-testing.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from './parser-helpers';
|
|
2
|
+
export * from './mock-types';
|
|
3
|
+
export * from './error-testing';
|
|
4
|
+
export * from './context-builders';
|
|
5
|
+
export { isCommandNode, assertCommandNode, assertNodeHasProperty, type ParsedStatementResult, type ParsingMetadata, type ASTNodeAssertable, } from '../parser/__types__/test-helpers';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export interface MockFunction<TArgs extends unknown[] = unknown[], TReturn = unknown> {
|
|
2
|
+
(...args: TArgs): TReturn;
|
|
3
|
+
calls: TArgs[];
|
|
4
|
+
lastCall?: TArgs;
|
|
5
|
+
returnValue?: TReturn;
|
|
6
|
+
callCount: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function createMockFunction<TArgs extends unknown[] = unknown[], TReturn = unknown>(implementation?: (...args: TArgs) => TReturn): MockFunction<TArgs, TReturn>;
|
|
9
|
+
export interface MockWebSocketAPI {
|
|
10
|
+
postMessage<T extends Record<string, unknown> = Record<string, unknown>>(data: T, transferables?: Transferable[]): void;
|
|
11
|
+
addEventListener(event: string, handler: EventListener): void;
|
|
12
|
+
removeEventListener(event: string, handler: EventListener): void;
|
|
13
|
+
close(): void;
|
|
14
|
+
readyState: number;
|
|
15
|
+
url: string;
|
|
16
|
+
}
|
|
17
|
+
export declare function createMockWebSocket(url?: string): MockWebSocketAPI;
|
|
18
|
+
export interface MockEventSourceAPI {
|
|
19
|
+
simulateMessage<T = string>(data: T, eventType?: 'message' | 'open' | 'error', lastEventId?: string): void;
|
|
20
|
+
addEventListener(event: string, handler: EventListener): void;
|
|
21
|
+
removeEventListener(event: string, handler: EventListener): void;
|
|
22
|
+
close(): void;
|
|
23
|
+
readyState: number;
|
|
24
|
+
url: string;
|
|
25
|
+
}
|
|
26
|
+
export declare function createMockEventSource(url?: string): MockEventSourceAPI;
|
|
27
|
+
export interface MockWorkerAPI {
|
|
28
|
+
postMessage<T = unknown>(message: T, transfer?: Transferable[]): void;
|
|
29
|
+
addEventListener(type: string, listener: EventListener): void;
|
|
30
|
+
removeEventListener(type: string, listener: EventListener): void;
|
|
31
|
+
terminate(): void;
|
|
32
|
+
onmessage: ((event: MessageEvent) => void) | null;
|
|
33
|
+
onerror: ((event: ErrorEvent) => void) | null;
|
|
34
|
+
}
|
|
35
|
+
export declare function createMockWorker(): MockWorkerAPI;
|
|
36
|
+
export interface MockExpressResponse<T = unknown> {
|
|
37
|
+
json(data: T): this;
|
|
38
|
+
send(data: T): this;
|
|
39
|
+
status(code: number): this;
|
|
40
|
+
header(name: string, value: string): this;
|
|
41
|
+
contentType(type: string): this;
|
|
42
|
+
getStatusCode(): number;
|
|
43
|
+
getData(): T | undefined;
|
|
44
|
+
getHeaders(): Record<string, string>;
|
|
45
|
+
}
|
|
46
|
+
export declare function createMockExpressResponse<T = unknown>(): MockExpressResponse<T>;
|
|
47
|
+
export interface MockExpressRequest<T = unknown> {
|
|
48
|
+
method: string;
|
|
49
|
+
url: string;
|
|
50
|
+
body: T;
|
|
51
|
+
params: Record<string, string>;
|
|
52
|
+
query: Record<string, string>;
|
|
53
|
+
headers: Record<string, string>;
|
|
54
|
+
get(header: string): string | undefined;
|
|
55
|
+
}
|
|
56
|
+
export declare function createMockExpressRequest<T = unknown>(options?: Partial<MockExpressRequest<T>>): MockExpressRequest<T>;
|
|
57
|
+
//# sourceMappingURL=mock-types.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ParserContext } from '../parser/parser-types';
|
|
2
|
+
import type { Token } from '../types/core';
|
|
3
|
+
export declare function createMockParserContext(tokens?: Token[], overrides?: Record<string, any>): ParserContext;
|
|
4
|
+
export declare function createToken(value: string, kind?: string, start?: number): Token;
|
|
5
|
+
export declare function createTokenStream(values: string[], kinds?: string[]): Token[];
|
|
6
|
+
export declare function createMockParserContextAt(tokens: Token[], position: number, overrides?: Record<string, any>): ParserContext;
|
|
7
|
+
//# sourceMappingURL=parser-context-mock.d.ts.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { CommandNode, ASTNode, Token, ParseError } from '../parser/types';
|
|
2
|
+
export interface ParserTestSuccess {
|
|
3
|
+
success: true;
|
|
4
|
+
node: CommandNode;
|
|
5
|
+
tokens: Token[];
|
|
6
|
+
errors?: ParseError[];
|
|
7
|
+
}
|
|
8
|
+
export interface ParserTestFailure {
|
|
9
|
+
success: false;
|
|
10
|
+
error: Error | ParseError;
|
|
11
|
+
input: string;
|
|
12
|
+
tokens?: Token[];
|
|
13
|
+
}
|
|
14
|
+
export type ParserTestResult = ParserTestSuccess | ParserTestFailure;
|
|
15
|
+
export declare function isParseSuccess(result: ParserTestResult): result is ParserTestSuccess;
|
|
16
|
+
export declare function isParseFailure(result: ParserTestResult): result is ParserTestFailure;
|
|
17
|
+
export declare function assertParseSuccess(result: ParserTestResult): asserts result is ParserTestSuccess;
|
|
18
|
+
export declare function assertParseFailure(result: ParserTestResult): asserts result is ParserTestFailure;
|
|
19
|
+
export declare function expectASTStructure(node: ASTNode | CommandNode, expected: Partial<CommandNode | ASTNode>): void;
|
|
20
|
+
export declare function expectNodeProperty<T = unknown>(node: ASTNode | CommandNode, property: string, expectedValue?: T): void;
|
|
21
|
+
export declare function expectCommandNode(node: ASTNode, expectedName: string): asserts node is CommandNode;
|
|
22
|
+
export declare function expectNodeType<T extends ASTNode>(node: ASTNode, expectedType: T['type']): asserts node is T;
|
|
23
|
+
export declare function getCommandArguments(node: ASTNode): ASTNode[];
|
|
24
|
+
export declare function getCommandTarget(node: ASTNode): ASTNode | undefined;
|
|
25
|
+
export declare function getNodeProperty<T = unknown>(node: ASTNode | CommandNode, property: string): T | undefined;
|
|
26
|
+
export declare class TestNodeBuilder {
|
|
27
|
+
private node;
|
|
28
|
+
withName(name: string): this;
|
|
29
|
+
withArguments(...args: ASTNode[]): this;
|
|
30
|
+
withTarget(target: ASTNode): this;
|
|
31
|
+
withPosition(start: number, end: number, line?: number, column?: number): this;
|
|
32
|
+
build(): CommandNode;
|
|
33
|
+
}
|
|
34
|
+
export declare function createTestCommandNode(name: string, args?: ASTNode[]): CommandNode;
|
|
35
|
+
export declare function createTestLiteral(value: string | number | boolean | null): ASTNode;
|
|
36
|
+
export declare function createTestIdentifier(name: string): ASTNode;
|
|
37
|
+
export declare function createTestSelector(selector: string): ASTNode;
|
|
38
|
+
//# sourceMappingURL=parser-helpers.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ASTNode, ExecutionContext } from '../types/core';
|
|
2
|
+
import type { CompileResult } from './hyperscript-api';
|
|
3
|
+
type CompileFunction = (code: string, options?: any) => CompileResult;
|
|
4
|
+
type CompileAsyncFunction = (code: string, options?: any) => Promise<CompileResult>;
|
|
5
|
+
type GetRuntimeFunction = () => any;
|
|
6
|
+
export declare function initializeDOMProcessor(compileSync: CompileFunction, compileAsync: CompileAsyncFunction, getRuntime: GetRuntimeFunction): void;
|
|
7
|
+
export declare function detectLanguage(element: Element): string;
|
|
8
|
+
export declare function extractEventInfo(ast: ASTNode): {
|
|
9
|
+
eventType: string;
|
|
10
|
+
body: ASTNode;
|
|
11
|
+
} | null;
|
|
12
|
+
export declare function setupEventHandler(element: Element, ast: ASTNode, context: ExecutionContext): void;
|
|
13
|
+
export declare function createHyperscriptContext(element?: HTMLElement | null): ExecutionContext;
|
|
14
|
+
export declare function processHyperscriptAttribute(element: Element, hyperscriptCode: string): void;
|
|
15
|
+
export declare function process(element: Element): void;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=dom-processor.d.ts.map
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Runtime, type RuntimeOptions } from '../runtime/runtime';
|
|
2
|
+
import type { ASTNode, ExecutionContext } from '../types/base-types';
|
|
3
|
+
import type { RuntimeHooks } from '../types/hooks';
|
|
4
|
+
declare global {
|
|
5
|
+
interface Window {
|
|
6
|
+
_hyperscript?: {
|
|
7
|
+
runtime?: Runtime;
|
|
8
|
+
behaviors?: Runtime['behaviorAPI'];
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export interface HyperscriptConfig {
|
|
13
|
+
semantic: boolean;
|
|
14
|
+
language: string;
|
|
15
|
+
confidenceThreshold: number;
|
|
16
|
+
}
|
|
17
|
+
export declare const config: HyperscriptConfig;
|
|
18
|
+
export interface CompileError {
|
|
19
|
+
message: string;
|
|
20
|
+
line: number;
|
|
21
|
+
column: number;
|
|
22
|
+
suggestion?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface NewCompileOptions {
|
|
25
|
+
language?: string;
|
|
26
|
+
traditional?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface CompileResult {
|
|
29
|
+
ok: boolean;
|
|
30
|
+
ast?: ASTNode;
|
|
31
|
+
errors?: CompileError[];
|
|
32
|
+
meta: {
|
|
33
|
+
parser: 'semantic' | 'traditional';
|
|
34
|
+
confidence?: number;
|
|
35
|
+
language: string;
|
|
36
|
+
timeMs: number;
|
|
37
|
+
directPath?: boolean;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export interface ValidateResult {
|
|
41
|
+
valid: boolean;
|
|
42
|
+
errors?: CompileError[];
|
|
43
|
+
}
|
|
44
|
+
export interface HyperscriptAPI {
|
|
45
|
+
compile(code: string, options?: NewCompileOptions): Promise<CompileResult>;
|
|
46
|
+
compileSync(code: string, options?: NewCompileOptions): CompileResult;
|
|
47
|
+
execute(ast: ASTNode, context?: ExecutionContext): Promise<unknown>;
|
|
48
|
+
eval(code: string, context?: ExecutionContext | Element, options?: NewCompileOptions): Promise<unknown>;
|
|
49
|
+
validate(code: string, options?: NewCompileOptions): Promise<ValidateResult>;
|
|
50
|
+
process(element: Element): void;
|
|
51
|
+
createContext(element?: HTMLElement | null, parent?: ExecutionContext): ExecutionContext;
|
|
52
|
+
version: string;
|
|
53
|
+
config: HyperscriptConfig;
|
|
54
|
+
createRuntime(options?: RuntimeOptions): Runtime;
|
|
55
|
+
registerHooks(name: string, hooks: RuntimeHooks): void;
|
|
56
|
+
unregisterHooks(name: string): boolean;
|
|
57
|
+
getRegisteredHooks(): string[];
|
|
58
|
+
clearCache(): void;
|
|
59
|
+
getCacheStats(): {
|
|
60
|
+
size: number;
|
|
61
|
+
hits: number;
|
|
62
|
+
misses: number;
|
|
63
|
+
hitRate: number;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
export declare const hyperscript: HyperscriptAPI;
|
|
67
|
+
export declare const _hyperscript: HyperscriptAPI;
|
|
68
|
+
//# sourceMappingURL=hyperscript-api.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { hyperscript, config } from './hyperscript-api.js';
|
|
2
|
+
import type { HyperscriptAPI } from './hyperscript-api.js';
|
|
3
|
+
export declare const lokascript: HyperscriptAPI;
|
|
4
|
+
export declare const _lokascript: HyperscriptAPI;
|
|
5
|
+
export { hyperscript };
|
|
6
|
+
export { config };
|
|
7
|
+
export type LokascriptAPI = HyperscriptAPI;
|
|
8
|
+
export type { HyperscriptAPI, HyperscriptConfig, CompileResult, CompileError, NewCompileOptions, ValidateResult, } from './hyperscript-api.js';
|
|
9
|
+
//# sourceMappingURL=lokascript-api.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ASTNode, ComplexityMetrics, CodeSmell, AnalysisResult, DependencyGraph, CodeSuggestion, PatternMatch } from './types.js';
|
|
2
|
+
export declare function calculateComplexity(ast: ASTNode): ComplexityMetrics;
|
|
3
|
+
export declare function detectCodeSmells(ast: ASTNode): CodeSmell[];
|
|
4
|
+
export declare function analyzeDependencies(ast: ASTNode): DependencyGraph;
|
|
5
|
+
export declare function findDeadCode(ast: ASTNode): Array<{
|
|
6
|
+
type: 'unused-variable' | 'unreachable-code';
|
|
7
|
+
name?: string;
|
|
8
|
+
location: {
|
|
9
|
+
start?: number;
|
|
10
|
+
end?: number;
|
|
11
|
+
line?: number;
|
|
12
|
+
column?: number;
|
|
13
|
+
};
|
|
14
|
+
message: string;
|
|
15
|
+
}>;
|
|
16
|
+
export declare function suggestOptimizations(ast: ASTNode): CodeSuggestion[];
|
|
17
|
+
export declare function analyzePatterns(ast: ASTNode): PatternMatch[];
|
|
18
|
+
export declare function analyzeMetrics(ast: ASTNode): AnalysisResult;
|
|
19
|
+
//# sourceMappingURL=analyzer.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ASTNode, DocumentationOutput, MarkdownOptions } from './types.js';
|
|
2
|
+
export declare function generateDocumentation(ast: ASTNode): DocumentationOutput;
|
|
3
|
+
export declare function generateMarkdown(ast: ASTNode, options?: MarkdownOptions): string;
|
|
4
|
+
export declare function generateHTML(ast: ASTNode, options?: {
|
|
5
|
+
title?: string;
|
|
6
|
+
}): string;
|
|
7
|
+
export declare function generateJSON(ast: ASTNode): string;
|
|
8
|
+
//# sourceMappingURL=documentation.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ASTNode, GeneratorOptions, GeneratorResult } from './types.js';
|
|
2
|
+
export type { GeneratorOptions, GeneratorResult };
|
|
3
|
+
export declare function generate(ast: ASTNode, options?: GeneratorOptions): string;
|
|
4
|
+
export declare function generateWithMetadata(ast: ASTNode, options?: GeneratorOptions): GeneratorResult;
|
|
5
|
+
export declare function generateCommand(node: ASTNode, opts?: GeneratorOptions): string;
|
|
6
|
+
export declare function generateExpression(node: ASTNode, opts?: GeneratorOptions): string;
|
|
7
|
+
export declare function minify(ast: ASTNode): string;
|
|
8
|
+
export declare function format(ast: ASTNode, indentation?: string): string;
|
|
9
|
+
//# sourceMappingURL=generator.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type { ASTNode as ASTUtilNode, VisitorContext, VisitorHandlers, QueryMatch, ComplexityMetrics, CodeSmell, AnalysisResult, PatternMatch, TransformOptions, OptimizationPass, DependencyGraph, VariableUsage, CodeSuggestion, GeneratorOptions, GeneratorResult, DocumentationOutput, EventHandlerDoc, BehaviorDoc, FunctionDoc, CommandDoc, CodeMetrics, MarkdownOptions, } from './types.js';
|
|
2
|
+
export { ASTVisitor, visit, findNodes, findFirst, getAncestors, createTypeCollector, measureDepth, countNodeTypes, createVisitorContext, } from './visitor.js';
|
|
3
|
+
export { calculateComplexity, detectCodeSmells, analyzeMetrics, analyzeDependencies, findDeadCode, suggestOptimizations, analyzePatterns, } from './analyzer.js';
|
|
4
|
+
export { generate, generateWithMetadata, generateCommand, generateExpression, minify, format, } from './generator.js';
|
|
5
|
+
export { generateDocumentation, generateMarkdown, generateHTML, generateJSON, } from './documentation.js';
|
|
6
|
+
export { query, queryAll, parseSelector, queryXPath } from './query.js';
|
|
7
|
+
export { transform, optimize, applyOptimizationPasses, normalize, inlineVariables, extractCommonExpressions, createOptimizationPass, } from './transformer.js';
|
|
8
|
+
export type { InterchangeNode, BaseNode as InterchangeBaseNode, EventNode as InterchangeEventNode, CommandNode as InterchangeCommandNode, LiteralNode as InterchangeLiteralNode, IdentifierNode as InterchangeIdentifierNode, SelectorNode as InterchangeSelectorNode, VariableNode as InterchangeVariableNode, BinaryNode as InterchangeBinaryNode, UnaryNode as InterchangeUnaryNode, MemberNode as InterchangeMemberNode, PossessiveNode as InterchangePossessiveNode, CallNode as InterchangeCallNode, IfNode as InterchangeIfNode, RepeatNode as InterchangeRepeatNode, ForEachNode as InterchangeForEachNode, WhileNode as InterchangeWhileNode, PositionalNode as InterchangePositionalNode, EventModifiers as InterchangeEventModifiers, } from './interchange/index.js';
|
|
9
|
+
export { fromCoreAST, toCoreAST } from './interchange/index.js';
|
|
10
|
+
export { interchangeToLSPDiagnostics, interchangeToLSPSymbols, interchangeToLSPHover, interchangeToLSPCompletions, calculateCyclomatic, calculateCognitive, } from './interchange/index.js';
|
|
11
|
+
export type { LSPPosition, LSPRange, LSPDiagnostic, LSPDiagnosticSeverity, LSPDocumentSymbol, LSPSymbolKind, LSPCompletionItem, LSPCompletionItemKind, LSPHoverInfo, } from './interchange/index.js';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|