@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
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type TokenType = 'identifier' | 'number' | 'string' | 'operator' | 'styleProperty' | 'selector' | 'localVar' | 'globalVar' | 'symbol' | 'keyword' | 'eof';
|
|
2
|
+
export interface Token {
|
|
3
|
+
type: TokenType;
|
|
4
|
+
value: string;
|
|
5
|
+
pos: number;
|
|
6
|
+
}
|
|
7
|
+
export declare const KEYWORDS: Set<string>;
|
|
8
|
+
export declare function tokenize(code: string): Token[];
|
|
9
|
+
//# sourceMappingURL=tokenizer.d.ts.map
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const KEYWORDS = new Set([
|
|
4
|
+
'on',
|
|
5
|
+
'from',
|
|
6
|
+
'to',
|
|
7
|
+
'into',
|
|
8
|
+
'before',
|
|
9
|
+
'after',
|
|
10
|
+
'in',
|
|
11
|
+
'of',
|
|
12
|
+
'at',
|
|
13
|
+
'with',
|
|
14
|
+
'if',
|
|
15
|
+
'else',
|
|
16
|
+
'unless',
|
|
17
|
+
'end',
|
|
18
|
+
'then',
|
|
19
|
+
'and',
|
|
20
|
+
'or',
|
|
21
|
+
'not',
|
|
22
|
+
'repeat',
|
|
23
|
+
'times',
|
|
24
|
+
'for',
|
|
25
|
+
'each',
|
|
26
|
+
'while',
|
|
27
|
+
'until',
|
|
28
|
+
'toggle',
|
|
29
|
+
'add',
|
|
30
|
+
'remove',
|
|
31
|
+
'put',
|
|
32
|
+
'set',
|
|
33
|
+
'get',
|
|
34
|
+
'call',
|
|
35
|
+
'return',
|
|
36
|
+
'append',
|
|
37
|
+
'log',
|
|
38
|
+
'send',
|
|
39
|
+
'trigger',
|
|
40
|
+
'wait',
|
|
41
|
+
'settle',
|
|
42
|
+
'fetch',
|
|
43
|
+
'as',
|
|
44
|
+
'show',
|
|
45
|
+
'hide',
|
|
46
|
+
'take',
|
|
47
|
+
'increment',
|
|
48
|
+
'decrement',
|
|
49
|
+
'focus',
|
|
50
|
+
'blur',
|
|
51
|
+
'go',
|
|
52
|
+
'transition',
|
|
53
|
+
'over',
|
|
54
|
+
'the',
|
|
55
|
+
'a',
|
|
56
|
+
'an',
|
|
57
|
+
'my',
|
|
58
|
+
'its',
|
|
59
|
+
'me',
|
|
60
|
+
'it',
|
|
61
|
+
'you',
|
|
62
|
+
'first',
|
|
63
|
+
'last',
|
|
64
|
+
'next',
|
|
65
|
+
'previous',
|
|
66
|
+
'closest',
|
|
67
|
+
'parent',
|
|
68
|
+
'true',
|
|
69
|
+
'false',
|
|
70
|
+
'null',
|
|
71
|
+
'undefined',
|
|
72
|
+
'is',
|
|
73
|
+
'matches',
|
|
74
|
+
'contains',
|
|
75
|
+
'includes',
|
|
76
|
+
'exists',
|
|
77
|
+
'has',
|
|
78
|
+
'init',
|
|
79
|
+
'every',
|
|
80
|
+
'by',
|
|
81
|
+
]);
|
|
82
|
+
function tokenize(code) {
|
|
83
|
+
const tokens = [];
|
|
84
|
+
let pos = 0;
|
|
85
|
+
while (pos < code.length) {
|
|
86
|
+
if (/\s/.test(code[pos])) {
|
|
87
|
+
pos++;
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
if (code.slice(pos, pos + 2) === '--') {
|
|
91
|
+
while (pos < code.length && code[pos] !== '\n')
|
|
92
|
+
pos++;
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
const start = pos;
|
|
96
|
+
if (code[pos] === '<' && /[a-zA-Z]/.test(code[pos + 1] || '')) {
|
|
97
|
+
pos++;
|
|
98
|
+
while (pos < code.length && code[pos] !== '>')
|
|
99
|
+
pos++;
|
|
100
|
+
if (code[pos] === '>')
|
|
101
|
+
pos++;
|
|
102
|
+
const val = code.slice(start, pos);
|
|
103
|
+
if (val.endsWith('/>') || val.endsWith('>')) {
|
|
104
|
+
const normalized = val.slice(1).replace(/\/?>$/, '');
|
|
105
|
+
tokens.push({ type: 'selector', value: normalized, pos: start });
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (code.slice(pos, pos + 2) === "'s" && !/[a-zA-Z]/.test(code[pos + 2] || '')) {
|
|
110
|
+
tokens.push({ type: 'operator', value: "'s", pos: start });
|
|
111
|
+
pos += 2;
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
if (code[pos] === '"' || code[pos] === "'") {
|
|
115
|
+
const quote = code[pos++];
|
|
116
|
+
while (pos < code.length && code[pos] !== quote) {
|
|
117
|
+
if (code[pos] === '\\')
|
|
118
|
+
pos++;
|
|
119
|
+
pos++;
|
|
120
|
+
}
|
|
121
|
+
pos++;
|
|
122
|
+
tokens.push({ type: 'string', value: code.slice(start, pos), pos: start });
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
if (/\d/.test(code[pos]) || (code[pos] === '-' && /\d/.test(code[pos + 1] || ''))) {
|
|
126
|
+
if (code[pos] === '-')
|
|
127
|
+
pos++;
|
|
128
|
+
while (pos < code.length && /[\d.]/.test(code[pos]))
|
|
129
|
+
pos++;
|
|
130
|
+
if (code.slice(pos, pos + 2) === 'ms')
|
|
131
|
+
pos += 2;
|
|
132
|
+
else if (code[pos] === 's' && !/[a-zA-Z]/.test(code[pos + 1] || ''))
|
|
133
|
+
pos++;
|
|
134
|
+
else if (code.slice(pos, pos + 2) === 'px')
|
|
135
|
+
pos += 2;
|
|
136
|
+
tokens.push({ type: 'number', value: code.slice(start, pos), pos: start });
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
if (code[pos] === ':') {
|
|
140
|
+
pos++;
|
|
141
|
+
while (pos < code.length && /[\w]/.test(code[pos]))
|
|
142
|
+
pos++;
|
|
143
|
+
tokens.push({ type: 'localVar', value: code.slice(start, pos), pos: start });
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
if (code[pos] === '$') {
|
|
147
|
+
pos++;
|
|
148
|
+
while (pos < code.length && /[\w]/.test(code[pos]))
|
|
149
|
+
pos++;
|
|
150
|
+
tokens.push({ type: 'globalVar', value: code.slice(start, pos), pos: start });
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
if (code[pos] === '#' || code[pos] === '.') {
|
|
154
|
+
if (code[pos] === '.') {
|
|
155
|
+
const afterDot = code.slice(pos + 1).match(/^(once|prevent|stop|debounce|throttle)\b/i);
|
|
156
|
+
if (afterDot) {
|
|
157
|
+
tokens.push({ type: 'symbol', value: '.', pos: start });
|
|
158
|
+
pos++;
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
pos++;
|
|
163
|
+
while (pos < code.length && /[\w-]/.test(code[pos]))
|
|
164
|
+
pos++;
|
|
165
|
+
tokens.push({ type: 'selector', value: code.slice(start, pos), pos: start });
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
if (code[pos] === '[') {
|
|
169
|
+
let lookahead = pos + 1;
|
|
170
|
+
while (lookahead < code.length && /\s/.test(code[lookahead]))
|
|
171
|
+
lookahead++;
|
|
172
|
+
const nextChar = code[lookahead] || '';
|
|
173
|
+
const isArrayLiteral = /['"\d\[\]:\$\-]/.test(nextChar) || nextChar === '';
|
|
174
|
+
if (isArrayLiteral) {
|
|
175
|
+
tokens.push({ type: 'symbol', value: '[', pos: start });
|
|
176
|
+
pos++;
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
pos++;
|
|
181
|
+
let depth = 1;
|
|
182
|
+
while (pos < code.length && depth > 0) {
|
|
183
|
+
if (code[pos] === '[')
|
|
184
|
+
depth++;
|
|
185
|
+
if (code[pos] === ']')
|
|
186
|
+
depth--;
|
|
187
|
+
pos++;
|
|
188
|
+
}
|
|
189
|
+
tokens.push({ type: 'selector', value: code.slice(start, pos), pos: start });
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
if (code[pos] === ']') {
|
|
194
|
+
tokens.push({ type: 'symbol', value: ']', pos: start });
|
|
195
|
+
pos++;
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
198
|
+
if (code.slice(pos, pos + 2) === "'s") {
|
|
199
|
+
tokens.push({ type: 'operator', value: "'s", pos: start });
|
|
200
|
+
pos += 2;
|
|
201
|
+
continue;
|
|
202
|
+
}
|
|
203
|
+
const twoChar = code.slice(pos, pos + 2);
|
|
204
|
+
if (['==', '!=', '<=', '>=', '&&', '||'].includes(twoChar)) {
|
|
205
|
+
tokens.push({ type: 'operator', value: twoChar, pos: start });
|
|
206
|
+
pos += 2;
|
|
207
|
+
continue;
|
|
208
|
+
}
|
|
209
|
+
if (code[pos] === '*' && /[a-zA-Z]/.test(code[pos + 1] || '')) {
|
|
210
|
+
pos++;
|
|
211
|
+
while (pos < code.length && /[\w-]/.test(code[pos]))
|
|
212
|
+
pos++;
|
|
213
|
+
tokens.push({ type: 'styleProperty', value: code.slice(start, pos), pos: start });
|
|
214
|
+
continue;
|
|
215
|
+
}
|
|
216
|
+
if ('+-*/%<>!'.includes(code[pos])) {
|
|
217
|
+
tokens.push({ type: 'operator', value: code[pos], pos: start });
|
|
218
|
+
pos++;
|
|
219
|
+
continue;
|
|
220
|
+
}
|
|
221
|
+
if ('()[]{},.'.includes(code[pos])) {
|
|
222
|
+
tokens.push({ type: 'symbol', value: code[pos], pos: start });
|
|
223
|
+
pos++;
|
|
224
|
+
continue;
|
|
225
|
+
}
|
|
226
|
+
if (/[a-zA-Z_]/.test(code[pos])) {
|
|
227
|
+
while (pos < code.length && /[\w-]/.test(code[pos]))
|
|
228
|
+
pos++;
|
|
229
|
+
const value = code.slice(start, pos);
|
|
230
|
+
const type = KEYWORDS.has(value.toLowerCase()) ? 'keyword' : 'identifier';
|
|
231
|
+
tokens.push({ type, value, pos: start });
|
|
232
|
+
continue;
|
|
233
|
+
}
|
|
234
|
+
pos++;
|
|
235
|
+
}
|
|
236
|
+
tokens.push({ type: 'eof', value: '', pos: code.length });
|
|
237
|
+
return tokens;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
exports.KEYWORDS = KEYWORDS;
|
|
241
|
+
exports.tokenize = tokenize;
|
|
242
|
+
//# sourceMappingURL=tokenizer.js.map
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
const KEYWORDS = new Set([
|
|
2
|
+
'on',
|
|
3
|
+
'from',
|
|
4
|
+
'to',
|
|
5
|
+
'into',
|
|
6
|
+
'before',
|
|
7
|
+
'after',
|
|
8
|
+
'in',
|
|
9
|
+
'of',
|
|
10
|
+
'at',
|
|
11
|
+
'with',
|
|
12
|
+
'if',
|
|
13
|
+
'else',
|
|
14
|
+
'unless',
|
|
15
|
+
'end',
|
|
16
|
+
'then',
|
|
17
|
+
'and',
|
|
18
|
+
'or',
|
|
19
|
+
'not',
|
|
20
|
+
'repeat',
|
|
21
|
+
'times',
|
|
22
|
+
'for',
|
|
23
|
+
'each',
|
|
24
|
+
'while',
|
|
25
|
+
'until',
|
|
26
|
+
'toggle',
|
|
27
|
+
'add',
|
|
28
|
+
'remove',
|
|
29
|
+
'put',
|
|
30
|
+
'set',
|
|
31
|
+
'get',
|
|
32
|
+
'call',
|
|
33
|
+
'return',
|
|
34
|
+
'append',
|
|
35
|
+
'log',
|
|
36
|
+
'send',
|
|
37
|
+
'trigger',
|
|
38
|
+
'wait',
|
|
39
|
+
'settle',
|
|
40
|
+
'fetch',
|
|
41
|
+
'as',
|
|
42
|
+
'show',
|
|
43
|
+
'hide',
|
|
44
|
+
'take',
|
|
45
|
+
'increment',
|
|
46
|
+
'decrement',
|
|
47
|
+
'focus',
|
|
48
|
+
'blur',
|
|
49
|
+
'go',
|
|
50
|
+
'transition',
|
|
51
|
+
'over',
|
|
52
|
+
'the',
|
|
53
|
+
'a',
|
|
54
|
+
'an',
|
|
55
|
+
'my',
|
|
56
|
+
'its',
|
|
57
|
+
'me',
|
|
58
|
+
'it',
|
|
59
|
+
'you',
|
|
60
|
+
'first',
|
|
61
|
+
'last',
|
|
62
|
+
'next',
|
|
63
|
+
'previous',
|
|
64
|
+
'closest',
|
|
65
|
+
'parent',
|
|
66
|
+
'true',
|
|
67
|
+
'false',
|
|
68
|
+
'null',
|
|
69
|
+
'undefined',
|
|
70
|
+
'is',
|
|
71
|
+
'matches',
|
|
72
|
+
'contains',
|
|
73
|
+
'includes',
|
|
74
|
+
'exists',
|
|
75
|
+
'has',
|
|
76
|
+
'init',
|
|
77
|
+
'every',
|
|
78
|
+
'by',
|
|
79
|
+
]);
|
|
80
|
+
function tokenize(code) {
|
|
81
|
+
const tokens = [];
|
|
82
|
+
let pos = 0;
|
|
83
|
+
while (pos < code.length) {
|
|
84
|
+
if (/\s/.test(code[pos])) {
|
|
85
|
+
pos++;
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
if (code.slice(pos, pos + 2) === '--') {
|
|
89
|
+
while (pos < code.length && code[pos] !== '\n')
|
|
90
|
+
pos++;
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
const start = pos;
|
|
94
|
+
if (code[pos] === '<' && /[a-zA-Z]/.test(code[pos + 1] || '')) {
|
|
95
|
+
pos++;
|
|
96
|
+
while (pos < code.length && code[pos] !== '>')
|
|
97
|
+
pos++;
|
|
98
|
+
if (code[pos] === '>')
|
|
99
|
+
pos++;
|
|
100
|
+
const val = code.slice(start, pos);
|
|
101
|
+
if (val.endsWith('/>') || val.endsWith('>')) {
|
|
102
|
+
const normalized = val.slice(1).replace(/\/?>$/, '');
|
|
103
|
+
tokens.push({ type: 'selector', value: normalized, pos: start });
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (code.slice(pos, pos + 2) === "'s" && !/[a-zA-Z]/.test(code[pos + 2] || '')) {
|
|
108
|
+
tokens.push({ type: 'operator', value: "'s", pos: start });
|
|
109
|
+
pos += 2;
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
if (code[pos] === '"' || code[pos] === "'") {
|
|
113
|
+
const quote = code[pos++];
|
|
114
|
+
while (pos < code.length && code[pos] !== quote) {
|
|
115
|
+
if (code[pos] === '\\')
|
|
116
|
+
pos++;
|
|
117
|
+
pos++;
|
|
118
|
+
}
|
|
119
|
+
pos++;
|
|
120
|
+
tokens.push({ type: 'string', value: code.slice(start, pos), pos: start });
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
if (/\d/.test(code[pos]) || (code[pos] === '-' && /\d/.test(code[pos + 1] || ''))) {
|
|
124
|
+
if (code[pos] === '-')
|
|
125
|
+
pos++;
|
|
126
|
+
while (pos < code.length && /[\d.]/.test(code[pos]))
|
|
127
|
+
pos++;
|
|
128
|
+
if (code.slice(pos, pos + 2) === 'ms')
|
|
129
|
+
pos += 2;
|
|
130
|
+
else if (code[pos] === 's' && !/[a-zA-Z]/.test(code[pos + 1] || ''))
|
|
131
|
+
pos++;
|
|
132
|
+
else if (code.slice(pos, pos + 2) === 'px')
|
|
133
|
+
pos += 2;
|
|
134
|
+
tokens.push({ type: 'number', value: code.slice(start, pos), pos: start });
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
if (code[pos] === ':') {
|
|
138
|
+
pos++;
|
|
139
|
+
while (pos < code.length && /[\w]/.test(code[pos]))
|
|
140
|
+
pos++;
|
|
141
|
+
tokens.push({ type: 'localVar', value: code.slice(start, pos), pos: start });
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
if (code[pos] === '$') {
|
|
145
|
+
pos++;
|
|
146
|
+
while (pos < code.length && /[\w]/.test(code[pos]))
|
|
147
|
+
pos++;
|
|
148
|
+
tokens.push({ type: 'globalVar', value: code.slice(start, pos), pos: start });
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
if (code[pos] === '#' || code[pos] === '.') {
|
|
152
|
+
if (code[pos] === '.') {
|
|
153
|
+
const afterDot = code.slice(pos + 1).match(/^(once|prevent|stop|debounce|throttle)\b/i);
|
|
154
|
+
if (afterDot) {
|
|
155
|
+
tokens.push({ type: 'symbol', value: '.', pos: start });
|
|
156
|
+
pos++;
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
pos++;
|
|
161
|
+
while (pos < code.length && /[\w-]/.test(code[pos]))
|
|
162
|
+
pos++;
|
|
163
|
+
tokens.push({ type: 'selector', value: code.slice(start, pos), pos: start });
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
if (code[pos] === '[') {
|
|
167
|
+
let lookahead = pos + 1;
|
|
168
|
+
while (lookahead < code.length && /\s/.test(code[lookahead]))
|
|
169
|
+
lookahead++;
|
|
170
|
+
const nextChar = code[lookahead] || '';
|
|
171
|
+
const isArrayLiteral = /['"\d\[\]:\$\-]/.test(nextChar) || nextChar === '';
|
|
172
|
+
if (isArrayLiteral) {
|
|
173
|
+
tokens.push({ type: 'symbol', value: '[', pos: start });
|
|
174
|
+
pos++;
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
pos++;
|
|
179
|
+
let depth = 1;
|
|
180
|
+
while (pos < code.length && depth > 0) {
|
|
181
|
+
if (code[pos] === '[')
|
|
182
|
+
depth++;
|
|
183
|
+
if (code[pos] === ']')
|
|
184
|
+
depth--;
|
|
185
|
+
pos++;
|
|
186
|
+
}
|
|
187
|
+
tokens.push({ type: 'selector', value: code.slice(start, pos), pos: start });
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
if (code[pos] === ']') {
|
|
192
|
+
tokens.push({ type: 'symbol', value: ']', pos: start });
|
|
193
|
+
pos++;
|
|
194
|
+
continue;
|
|
195
|
+
}
|
|
196
|
+
if (code.slice(pos, pos + 2) === "'s") {
|
|
197
|
+
tokens.push({ type: 'operator', value: "'s", pos: start });
|
|
198
|
+
pos += 2;
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
201
|
+
const twoChar = code.slice(pos, pos + 2);
|
|
202
|
+
if (['==', '!=', '<=', '>=', '&&', '||'].includes(twoChar)) {
|
|
203
|
+
tokens.push({ type: 'operator', value: twoChar, pos: start });
|
|
204
|
+
pos += 2;
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
if (code[pos] === '*' && /[a-zA-Z]/.test(code[pos + 1] || '')) {
|
|
208
|
+
pos++;
|
|
209
|
+
while (pos < code.length && /[\w-]/.test(code[pos]))
|
|
210
|
+
pos++;
|
|
211
|
+
tokens.push({ type: 'styleProperty', value: code.slice(start, pos), pos: start });
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
if ('+-*/%<>!'.includes(code[pos])) {
|
|
215
|
+
tokens.push({ type: 'operator', value: code[pos], pos: start });
|
|
216
|
+
pos++;
|
|
217
|
+
continue;
|
|
218
|
+
}
|
|
219
|
+
if ('()[]{},.'.includes(code[pos])) {
|
|
220
|
+
tokens.push({ type: 'symbol', value: code[pos], pos: start });
|
|
221
|
+
pos++;
|
|
222
|
+
continue;
|
|
223
|
+
}
|
|
224
|
+
if (/[a-zA-Z_]/.test(code[pos])) {
|
|
225
|
+
while (pos < code.length && /[\w-]/.test(code[pos]))
|
|
226
|
+
pos++;
|
|
227
|
+
const value = code.slice(start, pos);
|
|
228
|
+
const type = KEYWORDS.has(value.toLowerCase()) ? 'keyword' : 'identifier';
|
|
229
|
+
tokens.push({ type, value, pos: start });
|
|
230
|
+
continue;
|
|
231
|
+
}
|
|
232
|
+
pos++;
|
|
233
|
+
}
|
|
234
|
+
tokens.push({ type: 'eof', value: '', pos: code.length });
|
|
235
|
+
return tokens;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export { KEYWORDS, tokenize };
|
|
239
|
+
//# sourceMappingURL=tokenizer.mjs.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ParserInterface } from './parser-interface';
|
|
2
|
+
export declare const hybridParser: ParserInterface;
|
|
3
|
+
export declare function createHybridParser(): ParserInterface;
|
|
4
|
+
export declare function addCommandAliases(aliases: Record<string, string>): void;
|
|
5
|
+
export declare function addEventAliases(aliases: Record<string, string>): void;
|
|
6
|
+
export { HybridParser } from './hybrid/parser-core';
|
|
7
|
+
export { tokenize } from './hybrid/tokenizer';
|
|
8
|
+
export type { Token, TokenType } from './hybrid/tokenizer';
|
|
9
|
+
export type { ASTNode as HybridASTNode } from './hybrid/ast-types';
|
|
10
|
+
//# sourceMappingURL=hybrid-parser.d.ts.map
|