@hyperfixi/core 3.3.0 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +57 -179
- package/dist/ast-utils/index.cjs +74 -806
- package/dist/ast-utils/index.d.ts +1 -1
- package/dist/ast-utils/index.mjs +74 -805
- package/dist/ast-utils/interchange/engine-positions.d.ts +3 -0
- package/dist/ast-utils/interchange/index.d.ts +1 -2
- package/dist/hyperfixi.js +19 -2
- package/dist/index.d.ts +2 -22
- package/dist/index.mjs +3 -29128
- package/dist/lsp-metadata.cjs +77 -73
- package/dist/lsp-metadata.d.ts +4 -4
- package/dist/lsp-metadata.mjs +77 -73
- package/dist/metadata.cjs +34 -266
- package/dist/metadata.d.ts +31 -26
- package/dist/metadata.mjs +34 -266
- package/dist/multilingual/index.cjs +16 -382
- package/dist/multilingual/index.d.ts +4 -32
- package/dist/multilingual/index.mjs +15 -377
- package/dist/reference/index.cjs +67 -216
- package/dist/reference/index.d.ts +0 -3
- package/dist/reference/index.mjs +68 -216
- package/dist/version.d.ts +1 -1
- package/package.json +13 -179
- package/dist/__test-utils__/context-builders.d.ts +0 -42
- package/dist/__test-utils__/error-testing.d.ts +0 -18
- package/dist/__test-utils__/index.d.ts +0 -6
- package/dist/__test-utils__/mock-types.d.ts +0 -57
- package/dist/__test-utils__/parser-context-mock.d.ts +0 -7
- package/dist/__test-utils__/parser-helpers.d.ts +0 -38
- package/dist/api/hyperscript-api.d.ts +0 -90
- package/dist/api/lokascript-api.d.ts +0 -9
- package/dist/ast/command-slots.d.ts +0 -140
- package/dist/ast/guards.d.ts +0 -15
- package/dist/ast/legacy.d.ts +0 -15
- package/dist/ast/nodes.d.ts +0 -243
- package/dist/ast-utils/interchange/from-core.d.ts +0 -12
- package/dist/ast-utils/interchange/to-core.d.ts +0 -8
- package/dist/behaviors/boosted.d.ts +0 -29
- package/dist/behaviors/history-swap.d.ts +0 -24
- package/dist/behaviors/index.cjs +0 -1155
- package/dist/behaviors/index.d.ts +0 -4
- package/dist/behaviors/index.mjs +0 -1145
- package/dist/bundle-generator/executor-core.d.ts +0 -4
- package/dist/bundle-generator/generator.d.ts +0 -4
- package/dist/bundle-generator/index.cjs +0 -2804
- package/dist/bundle-generator/index.d.ts +0 -6
- package/dist/bundle-generator/index.mjs +0 -2779
- package/dist/bundle-generator/parser-templates.d.ts +0 -6
- package/dist/bundle-generator/template-capabilities.d.ts +0 -12
- package/dist/bundle-generator/templates.d.ts +0 -12
- package/dist/bundle-generator/types.d.ts +0 -34
- package/dist/chunks/bridge-CI9SOl8u.js +0 -2
- package/dist/chunks/browser-modular-7CpI5VF2.js +0 -2
- package/dist/chunks/index-BwXDEK0m.js +0 -2
- package/dist/chunks/index-DQi2o8Lk.js +0 -2
- package/dist/chunks/index-uCOQ8Qn0.js +0 -2
- package/dist/commands/advanced/js.d.ts +0 -40
- package/dist/commands/animation/measure.d.ts +0 -43
- package/dist/commands/animation/settle.d.ts +0 -38
- package/dist/commands/animation/start-view-transition.d.ts +0 -38
- package/dist/commands/animation/take.d.ts +0 -41
- package/dist/commands/animation/transition.d.ts +0 -49
- package/dist/commands/async/fetch.d.ts +0 -61
- package/dist/commands/async/wait.d.ts +0 -51
- package/dist/commands/behaviors/install.d.ts +0 -40
- package/dist/commands/content/append.d.ts +0 -26
- package/dist/commands/content/insertion-base.d.ts +0 -60
- package/dist/commands/content/prepend.d.ts +0 -26
- package/dist/commands/control-flow/break.d.ts +0 -29
- package/dist/commands/control-flow/continue.d.ts +0 -29
- package/dist/commands/control-flow/exit.d.ts +0 -29
- package/dist/commands/control-flow/halt.d.ts +0 -39
- package/dist/commands/control-flow/if.d.ts +0 -58
- package/dist/commands/control-flow/repeat.d.ts +0 -50
- package/dist/commands/control-flow/return.d.ts +0 -33
- package/dist/commands/control-flow/signal-base.d.ts +0 -18
- package/dist/commands/control-flow/throw.d.ts +0 -34
- package/dist/commands/control-flow/unless.d.ts +0 -3
- package/dist/commands/data/clear.d.ts +0 -37
- package/dist/commands/data/decrement.d.ts +0 -3
- package/dist/commands/data/default.d.ts +0 -60
- package/dist/commands/data/get.d.ts +0 -35
- package/dist/commands/data/increment.d.ts +0 -42
- package/dist/commands/data/set.d.ts +0 -76
- package/dist/commands/decorators/index.d.ts +0 -14
- package/dist/commands/dom/add.d.ts +0 -44
- package/dist/commands/dom/close.d.ts +0 -32
- package/dist/commands/dom/dom-modification-base.d.ts +0 -48
- package/dist/commands/dom/empty.d.ts +0 -32
- package/dist/commands/dom/hide.d.ts +0 -28
- package/dist/commands/dom/make.d.ts +0 -34
- package/dist/commands/dom/open.d.ts +0 -34
- package/dist/commands/dom/process-partials.d.ts +0 -51
- package/dist/commands/dom/put.d.ts +0 -42
- package/dist/commands/dom/remove.d.ts +0 -46
- package/dist/commands/dom/reset.d.ts +0 -32
- package/dist/commands/dom/select.d.ts +0 -32
- package/dist/commands/dom/show.d.ts +0 -29
- package/dist/commands/dom/swap.d.ts +0 -65
- package/dist/commands/dom/toggle.d.ts +0 -69
- package/dist/commands/dom/visibility-base.d.ts +0 -22
- package/dist/commands/events/send.d.ts +0 -3
- package/dist/commands/events/trigger.d.ts +0 -49
- package/dist/commands/execution/blur.d.ts +0 -32
- package/dist/commands/execution/call.d.ts +0 -35
- package/dist/commands/execution/focus.d.ts +0 -32
- package/dist/commands/execution/pseudo-command.d.ts +0 -41
- package/dist/commands/helpers/attribute-manipulation.d.ts +0 -11
- package/dist/commands/helpers/attribute-target.d.ts +0 -9
- package/dist/commands/helpers/batch-dom-operations.d.ts +0 -12
- package/dist/commands/helpers/body-ops.d.ts +0 -10
- package/dist/commands/helpers/class-manipulation.d.ts +0 -11
- package/dist/commands/helpers/condition-helpers.d.ts +0 -4
- package/dist/commands/helpers/dom-mutation.d.ts +0 -16
- package/dist/commands/helpers/duration-parsing.d.ts +0 -8
- package/dist/commands/helpers/element-property-access.d.ts +0 -7
- package/dist/commands/helpers/element-resolution.d.ts +0 -16
- package/dist/commands/helpers/error-helpers.d.ts +0 -17
- package/dist/commands/helpers/event-helpers.d.ts +0 -13
- package/dist/commands/helpers/event-waiting.d.ts +0 -37
- package/dist/commands/helpers/index.d.ts +0 -32
- package/dist/commands/helpers/input-validator.d.ts +0 -23
- package/dist/commands/helpers/loop-executor.d.ts +0 -56
- package/dist/commands/helpers/numeric-target-parser.d.ts +0 -21
- package/dist/commands/helpers/property-target.d.ts +0 -20
- package/dist/commands/helpers/selector-type-detection.d.ts +0 -24
- package/dist/commands/helpers/slots.d.ts +0 -5
- package/dist/commands/helpers/smart-element.d.ts +0 -16
- package/dist/commands/helpers/style-manipulation.d.ts +0 -16
- package/dist/commands/helpers/target-elements.d.ts +0 -5
- package/dist/commands/helpers/temporal-modifiers.d.ts +0 -15
- package/dist/commands/helpers/url-argument-parser.d.ts +0 -13
- package/dist/commands/helpers/url-validation.d.ts +0 -7
- package/dist/commands/helpers/variable-access.d.ts +0 -13
- package/dist/commands/helpers/visibility-target-parser.d.ts +0 -15
- package/dist/commands/helpers/write-target.d.ts +0 -42
- package/dist/commands/index.cjs +0 -24168
- package/dist/commands/index.d.ts +0 -171
- package/dist/commands/index.mjs +0 -23981
- package/dist/commands/manifest.d.ts +0 -17
- package/dist/commands/navigation/go.d.ts +0 -58
- package/dist/commands/navigation/push-url.d.ts +0 -48
- package/dist/commands/navigation/replace-url.d.ts +0 -3
- package/dist/commands/navigation/scroll-to.d.ts +0 -43
- package/dist/commands/templates/render.d.ts +0 -47
- package/dist/commands/utility/beep.d.ts +0 -41
- package/dist/commands/utility/breakpoint.d.ts +0 -32
- package/dist/commands/utility/copy.d.ts +0 -41
- package/dist/commands/utility/log.d.ts +0 -36
- package/dist/commands/utility/pick.d.ts +0 -47
- package/dist/commands/utility/tell.d.ts +0 -39
- package/dist/compatibility/browser-bundle-classic.d.ts +0 -17
- package/dist/compatibility/browser-bundle-hybrid-complete.d.ts +0 -22
- package/dist/compatibility/browser-bundle-hybrid-hx.d.ts +0 -43
- package/dist/compatibility/browser-bundle-lite.d.ts +0 -15
- package/dist/compatibility/browser-bundle-modular.d.ts +0 -18
- package/dist/compatibility/browser-bundle-multilingual.d.ts +0 -19
- package/dist/compatibility/browser-bundle-semantic-complete.d.ts +0 -24
- package/dist/compatibility/browser-bundle-textshelf-minimal.d.ts +0 -16
- package/dist/compatibility/browser-bundle-textshelf-profile.d.ts +0 -18
- package/dist/compatibility/browser-modular.d.ts +0 -42
- package/dist/compatibility/browser-tests/helpers/semantic-page.d.ts +0 -3
- package/dist/compatibility/browser-tests/test-utils.d.ts +0 -21
- package/dist/compatibility/bundle-shell.d.ts +0 -13
- package/dist/compatibility/bundle-sources.d.ts +0 -4
- package/dist/compatibility/eval-hyperscript.d.ts +0 -16
- package/dist/compatibility/hyperscript-adapter.d.ts +0 -38
- package/dist/core/ast-property-utils.d.ts +0 -2
- package/dist/core/context.d.ts +0 -19
- package/dist/core/dom.d.ts +0 -15
- package/dist/core/evaluator-types.d.ts +0 -5
- package/dist/core/events.d.ts +0 -48
- package/dist/core/executor.d.ts +0 -34
- package/dist/core/expression-evaluator.d.ts +0 -6
- package/dist/core/expression-registry.d.ts +0 -8
- package/dist/core/scope-hooks.d.ts +0 -24
- package/dist/debug/debug-controller.d.ts +0 -62
- package/dist/debug/index.d.ts +0 -5
- package/dist/dom/attribute-processor.d.ts +0 -75
- package/dist/dom/detect-language.d.ts +0 -3
- package/dist/dom/minimal-attribute-processor.d.ts +0 -20
- package/dist/expressions/base-expression.d.ts +0 -27
- package/dist/expressions/bundles/common-expressions.d.ts +0 -10
- package/dist/expressions/bundles/core-expressions.d.ts +0 -8
- package/dist/expressions/bundles/full-expressions.d.ts +0 -11
- package/dist/expressions/bundles/index.d.ts +0 -7
- package/dist/expressions/collection/index.d.ts +0 -10
- package/dist/expressions/conversion/index.d.ts +0 -31
- package/dist/expressions/expression-tiers.d.ts +0 -13
- package/dist/expressions/index.cjs +0 -4331
- package/dist/expressions/index.d.ts +0 -13
- package/dist/expressions/index.mjs +0 -4312
- package/dist/expressions/logical/index.d.ts +0 -61
- package/dist/expressions/mathematical/index.d.ts +0 -80
- package/dist/expressions/positional/index.d.ts +0 -31
- package/dist/expressions/properties/index.d.ts +0 -27
- package/dist/expressions/property-access-utils.d.ts +0 -23
- package/dist/expressions/references/index.d.ts +0 -39
- package/dist/expressions/shared/comparison-utils.d.ts +0 -10
- package/dist/expressions/shared/index.d.ts +0 -10
- package/dist/expressions/shared/number-utils.d.ts +0 -8
- package/dist/expressions/shared/tracking.d.ts +0 -20
- package/dist/expressions/shared/validation-utils.d.ts +0 -13
- package/dist/expressions/special/index.d.ts +0 -78
- package/dist/expressions/type-helpers.d.ts +0 -11
- package/dist/expressions/type-registry.d.ts +0 -57
- package/dist/expressions/validation-helpers.d.ts +0 -15
- package/dist/htmx/hcon.d.ts +0 -9
- package/dist/htmx/htmx-attribute-processor.d.ts +0 -120
- package/dist/htmx/htmx-translator.d.ts +0 -22
- package/dist/htmx/i18n-hooks.d.ts +0 -18
- package/dist/htmx/i18n-orchestrator.d.ts +0 -16
- package/dist/htmx/index.d.ts +0 -3
- package/dist/htmx/lang-resolver.d.ts +0 -3
- package/dist/htmx/sse.d.ts +0 -60
- package/dist/htmx/ws.d.ts +0 -59
- package/dist/hyperfixi-browser-classic-i18n.js +0 -2
- package/dist/hyperfixi-browser.js +0 -2
- package/dist/hyperfixi-classic-i18n.js +0 -2
- package/dist/hyperfixi-hx-v4.js +0 -1
- package/dist/hyperfixi-hx.js +0 -1
- package/dist/hyperfixi-hybrid-complete.js +0 -1
- package/dist/hyperfixi-hybrid-hx.js +0 -1
- package/dist/hyperfixi-multilingual.js +0 -2
- package/dist/hyperfixi.mjs +0 -2
- package/dist/i18n/error-catalog.d.ts +0 -12
- package/dist/index.cjs +0 -29159
- package/dist/index.min.js +0 -2
- package/dist/lib/dom-globals-shim.d.ts +0 -2
- package/dist/lib/index.d.ts +0 -4
- package/dist/lib/morph-adapter.d.ts +0 -9
- package/dist/lib/swap-executor.d.ts +0 -12
- package/dist/lib/view-transitions.d.ts +0 -7
- package/dist/lokascript-browser-classic-i18n.js +0 -2
- package/dist/lokascript-browser.js +0 -2
- package/dist/lokascript-hybrid-complete.js +0 -1
- package/dist/lokascript-hybrid-hx.js +0 -1
- package/dist/lokascript-multilingual.js +0 -2
- package/dist/lse/index.cjs +0 -84
- package/dist/lse/index.d.ts +0 -15
- package/dist/lse/index.mjs +0 -71
- package/dist/multilingual/bridge.d.ts +0 -38
- package/dist/multilingual/schema-roles.d.ts +0 -3
- package/dist/parser/__types__/test-helpers.d.ts +0 -25
- package/dist/parser/command-grammar.d.ts +0 -14
- package/dist/parser/command-node-builder.d.ts +0 -46
- package/dist/parser/command-parsers/animation-commands.d.ts +0 -6
- package/dist/parser/command-parsers/async-commands.d.ts +0 -5
- package/dist/parser/command-parsers/control-flow-commands.d.ts +0 -7
- package/dist/parser/command-parsers/declared-commands.d.ts +0 -6
- package/dist/parser/command-parsers/dom-commands.d.ts +0 -11
- package/dist/parser/command-parsers/event-commands.d.ts +0 -4
- package/dist/parser/command-parsers/navigation-commands.d.ts +0 -6
- package/dist/parser/command-parsers/utility-commands.d.ts +0 -14
- package/dist/parser/command-parsers/variable-commands.d.ts +0 -12
- package/dist/parser/error-handler.d.ts +0 -34
- package/dist/parser/extensions.d.ts +0 -43
- package/dist/parser/full-parser.cjs +0 -7943
- package/dist/parser/full-parser.d.ts +0 -4
- package/dist/parser/full-parser.mjs +0 -7940
- package/dist/parser/helpers/ast-helpers.d.ts +0 -24
- package/dist/parser/helpers/parsing-helpers.d.ts +0 -19
- package/dist/parser/helpers/token-helpers.d.ts +0 -28
- package/dist/parser/hybrid/aliases.cjs +0 -44
- package/dist/parser/hybrid/aliases.d.ts +0 -7
- package/dist/parser/hybrid/aliases.mjs +0 -37
- package/dist/parser/hybrid/ast-types.cjs +0 -3
- package/dist/parser/hybrid/ast-types.d.ts +0 -97
- package/dist/parser/hybrid/ast-types.mjs +0 -2
- package/dist/parser/hybrid/index.cjs +0 -1185
- package/dist/parser/hybrid/index.d.ts +0 -6
- package/dist/parser/hybrid/index.mjs +0 -1175
- package/dist/parser/hybrid/parser-core.cjs +0 -1171
- package/dist/parser/hybrid/parser-core.d.ts +0 -69
- package/dist/parser/hybrid/parser-core.mjs +0 -1169
- package/dist/parser/hybrid/tokenizer.cjs +0 -255
- package/dist/parser/hybrid/tokenizer.d.ts +0 -9
- package/dist/parser/hybrid/tokenizer.mjs +0 -252
- package/dist/parser/hybrid-parser.cjs +0 -1249
- package/dist/parser/hybrid-parser.d.ts +0 -10
- package/dist/parser/hybrid-parser.mjs +0 -1242
- package/dist/parser/parser-constants.d.ts +0 -100
- package/dist/parser/parser-interface.d.ts +0 -12
- package/dist/parser/parser-types.d.ts +0 -164
- package/dist/parser/parser.d.ts +0 -165
- package/dist/parser/pratt-parser.d.ts +0 -41
- package/dist/parser/regex-parser.cjs +0 -422
- package/dist/parser/regex-parser.d.ts +0 -4
- package/dist/parser/regex-parser.mjs +0 -419
- package/dist/parser/runtime.d.ts +0 -14
- package/dist/parser/semantic-integration.d.ts +0 -17
- package/dist/parser/token-consumer.d.ts +0 -34
- package/dist/parser/token-predicates.d.ts +0 -77
- package/dist/parser/tokenizer.d.ts +0 -28
- package/dist/parser/types.d.ts +0 -105
- package/dist/performance/expression-cache.d.ts +0 -78
- package/dist/performance/integration.d.ts +0 -40
- package/dist/performance/production-monitor.d.ts +0 -67
- package/dist/registry/browser-types.cjs +0 -81
- package/dist/registry/browser-types.d.ts +0 -20
- package/dist/registry/browser-types.mjs +0 -76
- package/dist/registry/environment.cjs +0 -36
- package/dist/registry/environment.d.ts +0 -19
- package/dist/registry/environment.mjs +0 -30
- package/dist/registry/event-source-registry.d.ts +0 -54
- package/dist/registry/examples/server-commands.d.ts +0 -6
- package/dist/registry/examples/server-event-source.d.ts +0 -32
- package/dist/registry/index.cjs +0 -14055
- package/dist/registry/index.d.ts +0 -39
- package/dist/registry/index.mjs +0 -14039
- package/dist/registry/runtime-integration.d.ts +0 -23
- package/dist/registry/universal-types.cjs +0 -91
- package/dist/registry/universal-types.d.ts +0 -35
- package/dist/registry/universal-types.mjs +0 -86
- package/dist/runtime/cleanup-registry.d.ts +0 -47
- package/dist/runtime/command-adapter.d.ts +0 -69
- package/dist/runtime/environment.d.ts +0 -75
- package/dist/runtime/plugin.d.ts +0 -14
- package/dist/runtime/runtime-base.d.ts +0 -100
- package/dist/runtime/runtime-factory.d.ts +0 -29
- package/dist/runtime/runtime.d.ts +0 -20
- package/dist/runtime/temporal-modifiers.d.ts +0 -37
- package/dist/test-setup.d.ts +0 -28
- package/dist/test-utilities.d.ts +0 -39
- package/dist/types/base-types.d.ts +0 -231
- package/dist/types/code-fix.d.ts +0 -39
- package/dist/types/command-metadata.d.ts +0 -57
- package/dist/types/command-types.d.ts +0 -262
- package/dist/types/context-types.d.ts +0 -106
- package/dist/types/core-context.d.ts +0 -22
- package/dist/types/core.d.ts +0 -143
- package/dist/types/error-codes.d.ts +0 -207
- package/dist/types/expression-types.d.ts +0 -155
- package/dist/types/hooks.d.ts +0 -45
- package/dist/types/index.d.ts +0 -32
- package/dist/types/program.d.ts +0 -8
- package/dist/types/result.d.ts +0 -73
- package/dist/types/template-types.d.ts +0 -162
- package/dist/types/type-guards.d.ts +0 -24
- package/dist/types/unified-types.d.ts +0 -91
- package/dist/utils/beep.d.ts +0 -8
- package/dist/utils/debug-events.d.ts +0 -41
- package/dist/utils/debug.d.ts +0 -35
- package/dist/utils/dom-utils.d.ts +0 -16
- package/dist/utils/element-check.d.ts +0 -8
- package/dist/utils/keyboard-shortcuts.d.ts +0 -18
- package/dist/utils/performance.d.ts +0 -40
- package/dist/validation/command-pattern-validator.d.ts +0 -53
- package/dist/validation/common-validators.d.ts +0 -24
- package/dist/validation/lightweight-validators.d.ts +0 -113
- package/dist/validation/partial-validation-types.d.ts +0 -50
- package/dist/validation/partial-validator.d.ts +0 -6
- package/dist/validation/partial-warning-formatter.d.ts +0 -6
- package/dist/validation/validate-cli.d.ts +0 -41
- package/vocab/htmx/ar.js +0 -62
- package/vocab/htmx/bn.js +0 -65
- package/vocab/htmx/de.js +0 -83
- package/vocab/htmx/en.js +0 -24
- package/vocab/htmx/es.js +0 -79
- package/vocab/htmx/fr.js +0 -79
- package/vocab/htmx/he.js +0 -61
- package/vocab/htmx/hi.js +0 -81
- package/vocab/htmx/id.js +0 -76
- package/vocab/htmx/it.js +0 -79
- package/vocab/htmx/ja.js +0 -85
- package/vocab/htmx/ko.js +0 -81
- package/vocab/htmx/ms.js +0 -58
- package/vocab/htmx/pl.js +0 -80
- package/vocab/htmx/pt.js +0 -81
- package/vocab/htmx/qu.js +0 -83
- package/vocab/htmx/ru.js +0 -82
- package/vocab/htmx/sw.js +0 -79
- package/vocab/htmx/th.js +0 -67
- package/vocab/htmx/tl.js +0 -56
- package/vocab/htmx/tr.js +0 -86
- package/vocab/htmx/uk.js +0 -82
- package/vocab/htmx/vi.js +0 -59
- package/vocab/htmx/zh.js +0 -79
|
@@ -1,419 +0,0 @@
|
|
|
1
|
-
function createProcessElements(parse, run, errorLabel) {
|
|
2
|
-
return (root = document) => {
|
|
3
|
-
root.querySelectorAll('[_]').forEach(el => {
|
|
4
|
-
const code = el.getAttribute('_');
|
|
5
|
-
if (!code)
|
|
6
|
-
return;
|
|
7
|
-
try {
|
|
8
|
-
run(parse(code), el);
|
|
9
|
-
}
|
|
10
|
-
catch (err) {
|
|
11
|
-
console.error(`HyperFixi ${errorLabel} error:`, err, 'Code:', code);
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
function installBundleGlobal(api, processElements, globalName = 'hyperfixi') {
|
|
17
|
-
if (typeof window === 'undefined')
|
|
18
|
-
return;
|
|
19
|
-
window[globalName] = api;
|
|
20
|
-
if (document.readyState === 'loading') {
|
|
21
|
-
document.addEventListener('DOMContentLoaded', () => processElements());
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
processElements();
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function parseLite(code) {
|
|
29
|
-
const trimmed = code.trim();
|
|
30
|
-
const onMatch = trimmed.match(/^on\s+(\w+)(?:\s+from\s+([^\s]+))?\s+(.+)$/i);
|
|
31
|
-
if (onMatch) {
|
|
32
|
-
return {
|
|
33
|
-
event: onMatch[1],
|
|
34
|
-
filter: onMatch[2],
|
|
35
|
-
commands: parseCommands(onMatch[3]),
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
const everyMatch = trimmed.match(/^every\s+(\d+)(ms|s)?\s+(.+)$/i);
|
|
39
|
-
if (everyMatch) {
|
|
40
|
-
const ms = everyMatch[2] === 's' ? parseInt(everyMatch[1]) * 1000 : parseInt(everyMatch[1]);
|
|
41
|
-
return {
|
|
42
|
-
event: `interval:${ms}`,
|
|
43
|
-
commands: parseCommands(everyMatch[3]),
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
const initMatch = trimmed.match(/^init\s+(.+)$/i);
|
|
47
|
-
if (initMatch) {
|
|
48
|
-
return {
|
|
49
|
-
event: 'init',
|
|
50
|
-
commands: parseCommands(initMatch[1]),
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
return parseCommands(trimmed);
|
|
54
|
-
}
|
|
55
|
-
function parseCommands(code) {
|
|
56
|
-
const parts = code.split(/\s+(?:then|and)\s+/i);
|
|
57
|
-
return parts.map(parseCommand).filter(Boolean);
|
|
58
|
-
}
|
|
59
|
-
function parseCommand(code) {
|
|
60
|
-
const trimmed = code.trim();
|
|
61
|
-
if (!trimmed)
|
|
62
|
-
return null;
|
|
63
|
-
let match = trimmed.match(/^toggle\s+(\.\w+|\w+)(?:\s+on\s+(.+))?$/i);
|
|
64
|
-
if (match) {
|
|
65
|
-
return { name: 'toggle', args: [match[1]], target: match[2] };
|
|
66
|
-
}
|
|
67
|
-
match = trimmed.match(/^add\s+(\.\w+|\w+)(?:\s+to\s+(.+))?$/i);
|
|
68
|
-
if (match) {
|
|
69
|
-
return { name: 'add', args: [match[1]], target: match[2] };
|
|
70
|
-
}
|
|
71
|
-
match = trimmed.match(/^remove\s+(\.\w+)(?:\s+from\s+(.+))?$/i);
|
|
72
|
-
if (match) {
|
|
73
|
-
return { name: 'remove', args: [match[1]], target: match[2] };
|
|
74
|
-
}
|
|
75
|
-
match = trimmed.match(/^remove\s+(.+)$/i);
|
|
76
|
-
if (match) {
|
|
77
|
-
return { name: 'remove', args: [], target: match[1] };
|
|
78
|
-
}
|
|
79
|
-
match = trimmed.match(/^put\s+(?:"([^"]+)"|'([^']+)'|(\S+))\s+(into|before|after)\s+(.+)$/i);
|
|
80
|
-
if (match) {
|
|
81
|
-
const content = match[1] || match[2] || match[3];
|
|
82
|
-
return { name: 'put', args: [content], modifier: match[4], target: match[5] };
|
|
83
|
-
}
|
|
84
|
-
match = trimmed.match(/^set\s+(.+?)\s+to\s+(.+)$/i);
|
|
85
|
-
if (match) {
|
|
86
|
-
return { name: 'set', args: [match[1], match[2]] };
|
|
87
|
-
}
|
|
88
|
-
match = trimmed.match(/^log\s+(.+)$/i);
|
|
89
|
-
if (match) {
|
|
90
|
-
return { name: 'log', args: [match[1]] };
|
|
91
|
-
}
|
|
92
|
-
match = trimmed.match(/^send\s+(\w+)(?:\s+to\s+(.+))?$/i);
|
|
93
|
-
if (match) {
|
|
94
|
-
return { name: 'send', args: [match[1]], target: match[2] };
|
|
95
|
-
}
|
|
96
|
-
match = trimmed.match(/^wait\s+(\d+)(ms|s)?$/i);
|
|
97
|
-
if (match) {
|
|
98
|
-
const ms = match[2] === 's' ? parseInt(match[1]) * 1000 : parseInt(match[1]);
|
|
99
|
-
return { name: 'wait', args: [ms.toString()] };
|
|
100
|
-
}
|
|
101
|
-
match = trimmed.match(/^(if|unless)\s+(.+?)\s+(toggle|add|remove|put|set|log|send|wait)\s+(.+)$/i);
|
|
102
|
-
if (match) {
|
|
103
|
-
const innerCmd = parseCommand(`${match[3]} ${match[4]}`);
|
|
104
|
-
if (innerCmd) {
|
|
105
|
-
innerCmd.modifier = match[1].toLowerCase();
|
|
106
|
-
innerCmd.args.unshift(match[2]);
|
|
107
|
-
return innerCmd;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
match = trimmed.match(/^(show|hide)(?:\s+(.+))?$/i);
|
|
111
|
-
if (match) {
|
|
112
|
-
const target = match[2];
|
|
113
|
-
return match[1].toLowerCase() === 'show'
|
|
114
|
-
? { name: 'remove', args: ['.hidden'], target }
|
|
115
|
-
: { name: 'add', args: ['.hidden'], target };
|
|
116
|
-
}
|
|
117
|
-
const parts = trimmed.split(/\s+/);
|
|
118
|
-
if (parts.length > 0) {
|
|
119
|
-
return { name: parts[0], args: parts.slice(1) };
|
|
120
|
-
}
|
|
121
|
-
return null;
|
|
122
|
-
}
|
|
123
|
-
const elementVars = new WeakMap();
|
|
124
|
-
function elemScope(el) {
|
|
125
|
-
let m = elementVars.get(el);
|
|
126
|
-
if (!m) {
|
|
127
|
-
m = new Map();
|
|
128
|
-
elementVars.set(el, m);
|
|
129
|
-
}
|
|
130
|
-
return m;
|
|
131
|
-
}
|
|
132
|
-
function resolveTarget(target, me) {
|
|
133
|
-
if (!target)
|
|
134
|
-
return me;
|
|
135
|
-
const t = target.trim();
|
|
136
|
-
if (t === 'me')
|
|
137
|
-
return me;
|
|
138
|
-
if (t === 'body')
|
|
139
|
-
return document.body;
|
|
140
|
-
if (t.startsWith('#') || t.startsWith('.') || t.startsWith('[')) {
|
|
141
|
-
const elements = document.querySelectorAll(t);
|
|
142
|
-
return elements.length === 1 ? elements[0] : Array.from(elements);
|
|
143
|
-
}
|
|
144
|
-
if (/^\w+$/.test(t) && document.getElementById(t)) {
|
|
145
|
-
return document.getElementById(t);
|
|
146
|
-
}
|
|
147
|
-
return me;
|
|
148
|
-
}
|
|
149
|
-
function getClassName(arg) {
|
|
150
|
-
return arg.startsWith('.') ? arg.slice(1) : arg;
|
|
151
|
-
}
|
|
152
|
-
async function executeCommand(cmd, me, locals) {
|
|
153
|
-
const target = resolveTarget(cmd.target, me);
|
|
154
|
-
const elements = Array.isArray(target) ? target : target ? [target] : [me];
|
|
155
|
-
switch (cmd.name) {
|
|
156
|
-
case 'toggle': {
|
|
157
|
-
const className = getClassName(cmd.args[0]);
|
|
158
|
-
for (const el of elements) {
|
|
159
|
-
el.classList.toggle(className);
|
|
160
|
-
}
|
|
161
|
-
return elements.length === 1 ? elements[0] : elements;
|
|
162
|
-
}
|
|
163
|
-
case 'add': {
|
|
164
|
-
const className = getClassName(cmd.args[0]);
|
|
165
|
-
for (const el of elements) {
|
|
166
|
-
el.classList.add(className);
|
|
167
|
-
}
|
|
168
|
-
return elements.length === 1 ? elements[0] : elements;
|
|
169
|
-
}
|
|
170
|
-
case 'remove': {
|
|
171
|
-
if (cmd.args[0]) {
|
|
172
|
-
const className = getClassName(cmd.args[0]);
|
|
173
|
-
for (const el of elements) {
|
|
174
|
-
el.classList.remove(className);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
else {
|
|
178
|
-
for (const el of elements) {
|
|
179
|
-
el.remove();
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
return null;
|
|
183
|
-
}
|
|
184
|
-
case 'put': {
|
|
185
|
-
const content = evaluateValue(cmd.args[0], me);
|
|
186
|
-
for (const el of elements) {
|
|
187
|
-
switch (cmd.modifier?.toLowerCase()) {
|
|
188
|
-
case 'into':
|
|
189
|
-
el.innerHTML = String(content);
|
|
190
|
-
break;
|
|
191
|
-
case 'before':
|
|
192
|
-
el.insertAdjacentHTML('beforebegin', String(content));
|
|
193
|
-
break;
|
|
194
|
-
case 'after':
|
|
195
|
-
el.insertAdjacentHTML('afterend', String(content));
|
|
196
|
-
break;
|
|
197
|
-
default:
|
|
198
|
-
el.innerHTML = String(content);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
return elements.length === 1 ? elements[0] : elements;
|
|
202
|
-
}
|
|
203
|
-
case 'set': {
|
|
204
|
-
const [targetExpr, valueExpr] = cmd.args;
|
|
205
|
-
const value = evaluateValue(valueExpr, me);
|
|
206
|
-
if (targetExpr.startsWith(':')) {
|
|
207
|
-
elemScope(me).set(targetExpr.slice(1), value);
|
|
208
|
-
return value;
|
|
209
|
-
}
|
|
210
|
-
const propMatch = targetExpr.match(/^(.+?)(?:'s|\.)\s*(\w+)$/);
|
|
211
|
-
if (propMatch) {
|
|
212
|
-
const obj = resolveTarget(propMatch[1], me);
|
|
213
|
-
if (obj) {
|
|
214
|
-
obj[propMatch[2]] = value;
|
|
215
|
-
return obj;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
return value;
|
|
219
|
-
}
|
|
220
|
-
case 'log': {
|
|
221
|
-
const value = evaluateValue(cmd.args.join(' '), me);
|
|
222
|
-
console.log(value);
|
|
223
|
-
return value;
|
|
224
|
-
}
|
|
225
|
-
case 'send': {
|
|
226
|
-
const eventName = cmd.args[0];
|
|
227
|
-
const event = new CustomEvent(eventName, { bubbles: true });
|
|
228
|
-
for (const el of elements) {
|
|
229
|
-
el.dispatchEvent(event);
|
|
230
|
-
}
|
|
231
|
-
return event;
|
|
232
|
-
}
|
|
233
|
-
case 'wait': {
|
|
234
|
-
const ms = parseInt(cmd.args[0]) || 0;
|
|
235
|
-
await new Promise(resolve => setTimeout(resolve, ms));
|
|
236
|
-
return ms;
|
|
237
|
-
}
|
|
238
|
-
default:
|
|
239
|
-
console.error(`[hyperfixi] Unknown command "${cmd.name}" \u2014 not in this bundle. Use hyperfixi.js (full bundle).`);
|
|
240
|
-
return null;
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
function evaluateValue(expr, me, locals) {
|
|
244
|
-
if (!expr)
|
|
245
|
-
return undefined;
|
|
246
|
-
const e = expr.trim();
|
|
247
|
-
if ((e.startsWith('"') && e.endsWith('"')) || (e.startsWith("'") && e.endsWith("'"))) {
|
|
248
|
-
return e.slice(1, -1);
|
|
249
|
-
}
|
|
250
|
-
if (/^-?\d+(\.\d+)?$/.test(e)) {
|
|
251
|
-
return parseFloat(e);
|
|
252
|
-
}
|
|
253
|
-
if (e === 'true')
|
|
254
|
-
return true;
|
|
255
|
-
if (e === 'false')
|
|
256
|
-
return false;
|
|
257
|
-
if (e === 'null')
|
|
258
|
-
return null;
|
|
259
|
-
if (e.startsWith(':')) {
|
|
260
|
-
return elemScope(me).get(e.slice(1));
|
|
261
|
-
}
|
|
262
|
-
if (e === 'me')
|
|
263
|
-
return me;
|
|
264
|
-
if (e === 'my')
|
|
265
|
-
return me;
|
|
266
|
-
if (e === 'body')
|
|
267
|
-
return document.body;
|
|
268
|
-
const propMatch = e.match(/^(me|my)\.(\w+)$/);
|
|
269
|
-
if (propMatch) {
|
|
270
|
-
return me[propMatch[2]];
|
|
271
|
-
}
|
|
272
|
-
return e;
|
|
273
|
-
}
|
|
274
|
-
async function executeParsed(parsed, me, locals = new Map()) {
|
|
275
|
-
if (Array.isArray(parsed)) {
|
|
276
|
-
let result;
|
|
277
|
-
for (const cmd of parsed) {
|
|
278
|
-
if (cmd.modifier === 'if' || cmd.modifier === 'unless') {
|
|
279
|
-
const condition = evaluateCondition(cmd.args[0], me);
|
|
280
|
-
const shouldRun = cmd.modifier === 'if' ? condition : !condition;
|
|
281
|
-
if (!shouldRun)
|
|
282
|
-
continue;
|
|
283
|
-
cmd.args.shift();
|
|
284
|
-
}
|
|
285
|
-
result = await executeCommand(cmd, me);
|
|
286
|
-
}
|
|
287
|
-
return result;
|
|
288
|
-
}
|
|
289
|
-
const handler = parsed;
|
|
290
|
-
const targetEl = handler.filter ? document.querySelector(handler.filter) : me;
|
|
291
|
-
const eventName = handler.event;
|
|
292
|
-
if (eventName.startsWith('interval:')) {
|
|
293
|
-
const ms = parseInt(eventName.split(':')[1]);
|
|
294
|
-
setInterval(async () => {
|
|
295
|
-
new Map(locals);
|
|
296
|
-
for (const cmd of handler.commands) {
|
|
297
|
-
await executeCommand(cmd, me);
|
|
298
|
-
}
|
|
299
|
-
}, ms);
|
|
300
|
-
return me;
|
|
301
|
-
}
|
|
302
|
-
if (eventName === 'init') {
|
|
303
|
-
new Map(locals);
|
|
304
|
-
for (const cmd of handler.commands) {
|
|
305
|
-
await executeCommand(cmd, me);
|
|
306
|
-
}
|
|
307
|
-
return me;
|
|
308
|
-
}
|
|
309
|
-
if (targetEl) {
|
|
310
|
-
targetEl.addEventListener(eventName, async (event) => {
|
|
311
|
-
const handlerLocals = new Map(locals);
|
|
312
|
-
handlerLocals.set('event', event);
|
|
313
|
-
for (const cmd of handler.commands) {
|
|
314
|
-
await executeCommand(cmd, me);
|
|
315
|
-
}
|
|
316
|
-
});
|
|
317
|
-
}
|
|
318
|
-
return me;
|
|
319
|
-
}
|
|
320
|
-
function evaluateCondition(expr, me, locals) {
|
|
321
|
-
const e = expr.trim();
|
|
322
|
-
const hasMatch = e.match(/^(me|my)\s+has\s+\.(\w+)$/i);
|
|
323
|
-
if (hasMatch) {
|
|
324
|
-
return me.classList.contains(hasMatch[2]);
|
|
325
|
-
}
|
|
326
|
-
const propMatch = e.match(/^(me|my)\.(\w+)$/i);
|
|
327
|
-
if (propMatch) {
|
|
328
|
-
return Boolean(me[propMatch[2]]);
|
|
329
|
-
}
|
|
330
|
-
if (e.startsWith(':')) {
|
|
331
|
-
return Boolean(elemScope(me).get(e.slice(1)));
|
|
332
|
-
}
|
|
333
|
-
const value = evaluateValue(e, me);
|
|
334
|
-
return Boolean(value);
|
|
335
|
-
}
|
|
336
|
-
const processElements = createProcessElements(parseLite, executeParsed, 'Lite');
|
|
337
|
-
const api = {
|
|
338
|
-
version: '1.0.0-lite',
|
|
339
|
-
parse: parseLite,
|
|
340
|
-
execute: async (code, element) => executeParsed(parseLite(code), element || document.body),
|
|
341
|
-
init: processElements,
|
|
342
|
-
process: processElements,
|
|
343
|
-
commands: ['add', 'remove', 'toggle', 'put', 'set', 'log', 'send', 'wait'],
|
|
344
|
-
};
|
|
345
|
-
installBundleGlobal(api, processElements);
|
|
346
|
-
|
|
347
|
-
class RegexParserImpl {
|
|
348
|
-
constructor() {
|
|
349
|
-
this.name = 'regex';
|
|
350
|
-
this.supportedCommands = [
|
|
351
|
-
'add',
|
|
352
|
-
'remove',
|
|
353
|
-
'toggle',
|
|
354
|
-
'put',
|
|
355
|
-
'set',
|
|
356
|
-
'log',
|
|
357
|
-
'send',
|
|
358
|
-
'wait',
|
|
359
|
-
];
|
|
360
|
-
}
|
|
361
|
-
parse(code) {
|
|
362
|
-
const result = api.parse(code);
|
|
363
|
-
if ('event' in result) {
|
|
364
|
-
return {
|
|
365
|
-
type: 'eventHandler',
|
|
366
|
-
event: result.event,
|
|
367
|
-
filter: result.filter,
|
|
368
|
-
commands: result.commands.map(cmd => this.convertCommand(cmd)),
|
|
369
|
-
};
|
|
370
|
-
}
|
|
371
|
-
if (Array.isArray(result)) {
|
|
372
|
-
if (result.length === 1) {
|
|
373
|
-
return this.convertCommand(result[0]);
|
|
374
|
-
}
|
|
375
|
-
return {
|
|
376
|
-
type: 'sequence',
|
|
377
|
-
commands: result.map(cmd => this.convertCommand(cmd)),
|
|
378
|
-
};
|
|
379
|
-
}
|
|
380
|
-
return this.convertCommand(result);
|
|
381
|
-
}
|
|
382
|
-
convertCommand(cmd) {
|
|
383
|
-
return {
|
|
384
|
-
type: 'command',
|
|
385
|
-
name: cmd.name,
|
|
386
|
-
args: cmd.args.map(arg => ({
|
|
387
|
-
type: 'literal',
|
|
388
|
-
value: arg,
|
|
389
|
-
})),
|
|
390
|
-
...(cmd.target && {
|
|
391
|
-
target: {
|
|
392
|
-
type: 'selector',
|
|
393
|
-
value: cmd.target,
|
|
394
|
-
},
|
|
395
|
-
}),
|
|
396
|
-
};
|
|
397
|
-
}
|
|
398
|
-
parseCommands(code) {
|
|
399
|
-
const result = this.parse(code);
|
|
400
|
-
if (result.type === 'sequence' && 'commands' in result) {
|
|
401
|
-
return result.commands;
|
|
402
|
-
}
|
|
403
|
-
return [result];
|
|
404
|
-
}
|
|
405
|
-
supports(syntax) {
|
|
406
|
-
const firstWord = syntax.trim().split(/\s+/)[0]?.toLowerCase();
|
|
407
|
-
if (firstWord === 'on' || firstWord === 'every' || firstWord === 'init') {
|
|
408
|
-
return true;
|
|
409
|
-
}
|
|
410
|
-
return this.supportedCommands.includes(firstWord);
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
const regexParser = new RegexParserImpl();
|
|
414
|
-
function createRegexParser() {
|
|
415
|
-
return new RegexParserImpl();
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
export { createRegexParser, regexParser };
|
|
419
|
-
//# sourceMappingURL=regex-parser.mjs.map
|
package/dist/parser/runtime.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { ExecutionContext } from '../types/core';
|
|
2
|
-
import type { ExecutionResult } from '../types/result';
|
|
3
|
-
import { setGlobal } from './extensions';
|
|
4
|
-
export { setGlobal };
|
|
5
|
-
import { type AnyNode } from '../ast/legacy';
|
|
6
|
-
export declare function evaluateAST(node: AnyNode, context: ExecutionContext): Promise<any>;
|
|
7
|
-
export declare function evaluateASTWithResult(node: AnyNode, context: ExecutionContext): Promise<ExecutionResult<unknown>>;
|
|
8
|
-
export declare class NotSyncEvaluable extends Error {
|
|
9
|
-
constructor(nodeType: string);
|
|
10
|
-
}
|
|
11
|
-
export declare function evaluateExpressionSync(node: AnyNode, context: ExecutionContext): unknown;
|
|
12
|
-
export declare function evaluateExpressionFromSourceSync(source: string, context: ExecutionContext): unknown;
|
|
13
|
-
export declare function evaluateExpressionFromSource(source: string, context: ExecutionContext): Promise<any>;
|
|
14
|
-
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export declare const DEFAULT_CONFIDENCE_THRESHOLD = 0.5;
|
|
2
|
-
import type { ASTNode } from '../types/base-types';
|
|
3
|
-
export interface FrontEndParseResult {
|
|
4
|
-
ast: ASTNode | null;
|
|
5
|
-
usedDirectPath: boolean;
|
|
6
|
-
confidence: number;
|
|
7
|
-
lang: string;
|
|
8
|
-
fallbackText: string | null;
|
|
9
|
-
warnings?: string[];
|
|
10
|
-
}
|
|
11
|
-
export interface FrontEnd {
|
|
12
|
-
readonly name: string;
|
|
13
|
-
parseToAST(code: string, lang: string): Promise<FrontEndParseResult>;
|
|
14
|
-
parse?(code: string, lang: string): Promise<unknown>;
|
|
15
|
-
render?(node: unknown, lang: string): Promise<string>;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=semantic-integration.d.ts.map
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { ASTNode, Token } from '../types/core';
|
|
2
|
-
export interface ParserInterface {
|
|
3
|
-
isAtEnd(): boolean;
|
|
4
|
-
check(value: string): boolean;
|
|
5
|
-
checkTokenType(type: string): boolean;
|
|
6
|
-
advance(): Token;
|
|
7
|
-
peek(): Token;
|
|
8
|
-
parsePrimary(): ASTNode;
|
|
9
|
-
parseExpression(): ASTNode;
|
|
10
|
-
isCommand(name: string): boolean;
|
|
11
|
-
}
|
|
12
|
-
export interface ParseUntilOptions {
|
|
13
|
-
additionalTerminators?: string[];
|
|
14
|
-
allowExpressions?: boolean;
|
|
15
|
-
stopAtCommands?: boolean;
|
|
16
|
-
stopWhen?: (parser: ParserInterface) => boolean;
|
|
17
|
-
}
|
|
18
|
-
export declare class TokenConsumer {
|
|
19
|
-
private parser;
|
|
20
|
-
constructor(parser: ParserInterface);
|
|
21
|
-
parseArgsUntilTerminator(options?: ParseUntilOptions): ASTNode[];
|
|
22
|
-
private shouldStopParsing;
|
|
23
|
-
consumeOptionalThe(): boolean;
|
|
24
|
-
consumeOptionalArticle(): 'a' | 'an' | null;
|
|
25
|
-
parsePrepositionTarget(preposition: string, parseExpression?: boolean): {
|
|
26
|
-
preposition: string;
|
|
27
|
-
target: ASTNode;
|
|
28
|
-
} | null;
|
|
29
|
-
parseOptionalModifiers(prepositions: Record<string, boolean>): Record<string, ASTNode>;
|
|
30
|
-
isAtCommandSeparator(): boolean;
|
|
31
|
-
consumeOptionalSeparator(): 'then' | 'and' | null;
|
|
32
|
-
tryParseKeywordPhrase(keywords: string[]): string | null;
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=token-consumer.d.ts.map
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import type { Token } from '../types/core';
|
|
2
|
-
export declare function isCommand(token: Token): boolean;
|
|
3
|
-
export declare function isKeyword(token: Token): boolean;
|
|
4
|
-
export declare function isEvent(token: Token): boolean;
|
|
5
|
-
export declare function isContextVar(token: Token): boolean;
|
|
6
|
-
export declare function isLogicalOperator(token: Token): boolean;
|
|
7
|
-
export declare function isComparisonOperator(token: Token): boolean;
|
|
8
|
-
export declare function isIdentifierLike(token: Token): boolean;
|
|
9
|
-
export declare function isSelector(token: Token): boolean;
|
|
10
|
-
export declare function isBasicSelector(token: Token): boolean;
|
|
11
|
-
export declare function isLiteral(token: Token): boolean;
|
|
12
|
-
export declare function isOperator(token: Token): boolean;
|
|
13
|
-
export declare function isReference(token: Token): boolean;
|
|
14
|
-
export declare function isTimeExpression(token: Token): boolean;
|
|
15
|
-
export declare function isSymbol(token: Token): boolean;
|
|
16
|
-
export declare function isComment(token: Token): boolean;
|
|
17
|
-
export declare function isIdentifier(token: Token): boolean;
|
|
18
|
-
export declare function isString(token: Token): boolean;
|
|
19
|
-
export declare function isNumber(token: Token): boolean;
|
|
20
|
-
export declare function isBoolean(token: Token): boolean;
|
|
21
|
-
export declare function isTemplateLiteral(token: Token): boolean;
|
|
22
|
-
export declare function isQueryReference(token: Token): boolean;
|
|
23
|
-
export declare function isIdSelector(token: Token): boolean;
|
|
24
|
-
export declare function isClassSelector(token: Token): boolean;
|
|
25
|
-
export declare function isCssSelector(token: Token): boolean;
|
|
26
|
-
export declare function isGlobalVar(token: Token): boolean;
|
|
27
|
-
export declare function isBasicOperator(token: Token): boolean;
|
|
28
|
-
export declare function hasValue(token: Token, value: string): boolean;
|
|
29
|
-
export declare function hasValueIn(token: Token, values: readonly string[]): boolean;
|
|
30
|
-
export declare function isOperatorValue(token: Token, value: string): boolean;
|
|
31
|
-
export declare function isPossessive(token: Token): boolean;
|
|
32
|
-
export declare function isDot(token: Token): boolean;
|
|
33
|
-
export declare function isOptionalChain(token: Token): boolean;
|
|
34
|
-
export declare function isOpenBracket(token: Token): boolean;
|
|
35
|
-
export declare function isOpenParen(token: Token): boolean;
|
|
36
|
-
export declare function canStartExpression(token: Token): boolean;
|
|
37
|
-
export declare function isCommandTerminator(token: Token): boolean;
|
|
38
|
-
export declare const TokenPredicates: {
|
|
39
|
-
isCommand: typeof isCommand;
|
|
40
|
-
isKeyword: typeof isKeyword;
|
|
41
|
-
isEvent: typeof isEvent;
|
|
42
|
-
isContextVar: typeof isContextVar;
|
|
43
|
-
isLogicalOperator: typeof isLogicalOperator;
|
|
44
|
-
isComparisonOperator: typeof isComparisonOperator;
|
|
45
|
-
isIdentifierLike: typeof isIdentifierLike;
|
|
46
|
-
isSelector: typeof isSelector;
|
|
47
|
-
isBasicSelector: typeof isBasicSelector;
|
|
48
|
-
isLiteral: typeof isLiteral;
|
|
49
|
-
isOperator: typeof isOperator;
|
|
50
|
-
isReference: typeof isReference;
|
|
51
|
-
isTimeExpression: typeof isTimeExpression;
|
|
52
|
-
isSymbol: typeof isSymbol;
|
|
53
|
-
isComment: typeof isComment;
|
|
54
|
-
isIdentifier: typeof isIdentifier;
|
|
55
|
-
isString: typeof isString;
|
|
56
|
-
isNumber: typeof isNumber;
|
|
57
|
-
isBoolean: typeof isBoolean;
|
|
58
|
-
isTemplateLiteral: typeof isTemplateLiteral;
|
|
59
|
-
isQueryReference: typeof isQueryReference;
|
|
60
|
-
isIdSelector: typeof isIdSelector;
|
|
61
|
-
isClassSelector: typeof isClassSelector;
|
|
62
|
-
isCssSelector: typeof isCssSelector;
|
|
63
|
-
isGlobalVar: typeof isGlobalVar;
|
|
64
|
-
isBasicOperator: typeof isBasicOperator;
|
|
65
|
-
hasValue: typeof hasValue;
|
|
66
|
-
hasValueIn: typeof hasValueIn;
|
|
67
|
-
isOperatorValue: typeof isOperatorValue;
|
|
68
|
-
isPossessive: typeof isPossessive;
|
|
69
|
-
isDot: typeof isDot;
|
|
70
|
-
isOptionalChain: typeof isOptionalChain;
|
|
71
|
-
isOpenBracket: typeof isOpenBracket;
|
|
72
|
-
isOpenParen: typeof isOpenParen;
|
|
73
|
-
canStartExpression: typeof canStartExpression;
|
|
74
|
-
isCommandTerminator: typeof isCommandTerminator;
|
|
75
|
-
};
|
|
76
|
-
export default TokenPredicates;
|
|
77
|
-
//# sourceMappingURL=token-predicates.d.ts.map
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { Token } from '../types/core';
|
|
2
|
-
export type { Token } from '../types/core';
|
|
3
|
-
export declare enum TokenKind {
|
|
4
|
-
IDENTIFIER = "identifier",
|
|
5
|
-
STRING = "string",
|
|
6
|
-
NUMBER = "number",
|
|
7
|
-
SELECTOR = "selector",
|
|
8
|
-
OPERATOR = "operator",
|
|
9
|
-
TIME = "time",
|
|
10
|
-
TEMPLATE = "template",
|
|
11
|
-
COMMENT = "comment",
|
|
12
|
-
SYMBOL = "symbol",
|
|
13
|
-
UNKNOWN = "unknown"
|
|
14
|
-
}
|
|
15
|
-
export interface Tokenizer {
|
|
16
|
-
input: string;
|
|
17
|
-
position: number;
|
|
18
|
-
line: number;
|
|
19
|
-
column: number;
|
|
20
|
-
tokens: Token[];
|
|
21
|
-
}
|
|
22
|
-
export declare function createTokenizer(): Tokenizer;
|
|
23
|
-
export declare function tokenize(input: string): Token[];
|
|
24
|
-
export declare function lineColumnAt(input: string, offset: number): {
|
|
25
|
-
line: number;
|
|
26
|
-
column: number;
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=tokenizer.d.ts.map
|
package/dist/parser/types.d.ts
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
export type TokenType = 'STRING' | 'NUMBER' | 'BOOLEAN' | 'NULL' | 'IDENTIFIER' | 'KEYWORD' | 'OPERATOR' | 'COMPARISON' | 'LOGICAL' | 'ASSIGNMENT' | 'LPAREN' | 'RPAREN' | 'LBRACKET' | 'RBRACKET' | 'LBRACE' | 'RBRACE' | 'COMMA' | 'DOT' | 'COLON' | 'SEMICOLON' | 'APOSTROPHE' | 'WHITESPACE' | 'NEWLINE' | 'EOF' | 'UNKNOWN';
|
|
2
|
-
export interface Token {
|
|
3
|
-
type: TokenType;
|
|
4
|
-
value: string;
|
|
5
|
-
position: number;
|
|
6
|
-
line: number;
|
|
7
|
-
column: number;
|
|
8
|
-
}
|
|
9
|
-
export type ASTNodeType = 'Literal' | 'Identifier' | 'BinaryExpression' | 'UnaryExpression' | 'CallExpression' | 'MemberExpression' | 'ConditionalExpression' | 'ExpressionStatement' | 'BlockStatement' | 'EventStatement' | 'CommandStatement' | 'EventHandler' | 'Command' | 'Selector' | 'PropertyAccess' | 'PossessiveExpression';
|
|
10
|
-
export interface BaseASTNode {
|
|
11
|
-
type: ASTNodeType;
|
|
12
|
-
position: {
|
|
13
|
-
start: number;
|
|
14
|
-
end: number;
|
|
15
|
-
line: number;
|
|
16
|
-
column: number;
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
export interface LiteralNode extends BaseASTNode {
|
|
20
|
-
type: 'Literal';
|
|
21
|
-
value: string | number | boolean | null;
|
|
22
|
-
raw: string;
|
|
23
|
-
}
|
|
24
|
-
export interface IdentifierNode extends BaseASTNode {
|
|
25
|
-
type: 'Identifier';
|
|
26
|
-
name: string;
|
|
27
|
-
}
|
|
28
|
-
export interface BinaryExpressionNode extends BaseASTNode {
|
|
29
|
-
type: 'BinaryExpression';
|
|
30
|
-
operator: string;
|
|
31
|
-
left: ASTNode;
|
|
32
|
-
right: ASTNode;
|
|
33
|
-
}
|
|
34
|
-
export interface UnaryExpressionNode extends BaseASTNode {
|
|
35
|
-
type: 'UnaryExpression';
|
|
36
|
-
operator: string;
|
|
37
|
-
argument: ASTNode;
|
|
38
|
-
prefix: boolean;
|
|
39
|
-
}
|
|
40
|
-
export interface CallExpressionNode extends BaseASTNode {
|
|
41
|
-
type: 'CallExpression';
|
|
42
|
-
callee: ASTNode;
|
|
43
|
-
arguments: ASTNode[];
|
|
44
|
-
}
|
|
45
|
-
export interface MemberExpressionNode extends BaseASTNode {
|
|
46
|
-
type: 'MemberExpression';
|
|
47
|
-
object: ASTNode;
|
|
48
|
-
property: ASTNode;
|
|
49
|
-
computed: boolean;
|
|
50
|
-
}
|
|
51
|
-
export interface EventHandlerNode extends BaseASTNode {
|
|
52
|
-
type: 'EventHandler';
|
|
53
|
-
event: string;
|
|
54
|
-
selector?: string;
|
|
55
|
-
commands: CommandNode[];
|
|
56
|
-
}
|
|
57
|
-
export interface CommandNode extends BaseASTNode {
|
|
58
|
-
type: 'Command';
|
|
59
|
-
name: string;
|
|
60
|
-
arguments: ASTNode[];
|
|
61
|
-
target?: ASTNode;
|
|
62
|
-
}
|
|
63
|
-
export interface SelectorNode extends BaseASTNode {
|
|
64
|
-
type: 'Selector';
|
|
65
|
-
value: string;
|
|
66
|
-
}
|
|
67
|
-
export interface PossessiveExpressionNode extends BaseASTNode {
|
|
68
|
-
type: 'PossessiveExpression';
|
|
69
|
-
object: ASTNode;
|
|
70
|
-
property: ASTNode;
|
|
71
|
-
}
|
|
72
|
-
export type ASTNode = LiteralNode | IdentifierNode | BinaryExpressionNode | UnaryExpressionNode | CallExpressionNode | MemberExpressionNode | EventHandlerNode | CommandNode | SelectorNode | PossessiveExpressionNode;
|
|
73
|
-
export interface ParseResult {
|
|
74
|
-
ast: ASTNode;
|
|
75
|
-
tokens: Token[];
|
|
76
|
-
errors: ParseError[];
|
|
77
|
-
}
|
|
78
|
-
export interface ParseError {
|
|
79
|
-
name?: string;
|
|
80
|
-
message: string;
|
|
81
|
-
position: number;
|
|
82
|
-
line: number;
|
|
83
|
-
column: number;
|
|
84
|
-
token?: Token;
|
|
85
|
-
}
|
|
86
|
-
export interface KeywordResolver {
|
|
87
|
-
resolve(token: string): string | undefined;
|
|
88
|
-
isCommand(token: string): boolean;
|
|
89
|
-
isKeyword(token: string): boolean;
|
|
90
|
-
}
|
|
91
|
-
export interface ParserOptions {
|
|
92
|
-
includeWhitespace?: boolean;
|
|
93
|
-
includeComments?: boolean;
|
|
94
|
-
strict?: boolean;
|
|
95
|
-
keywords?: KeywordResolver;
|
|
96
|
-
registryIntegration?: ParserRegistryIntegration;
|
|
97
|
-
}
|
|
98
|
-
export interface ParserRegistryIntegration {
|
|
99
|
-
hasEventSource(eventName: string): boolean;
|
|
100
|
-
getEventSource(eventName: string): {
|
|
101
|
-
name: string;
|
|
102
|
-
} | undefined;
|
|
103
|
-
}
|
|
104
|
-
export declare const HYPERSCRIPT_KEYWORDS: Set<string>;
|
|
105
|
-
//# sourceMappingURL=types.d.ts.map
|