@hyperfixi/core 2.1.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/api/hyperscript-api.d.ts +6 -1
  2. package/dist/chunks/{bridge-CZfeDyEz.js → bridge-D2DBo02Z.js} +2 -2
  3. package/dist/chunks/browser-modular-BA3JFmkq.js +2 -0
  4. package/dist/chunks/index-C6Fn0jGB.js +2 -0
  5. package/dist/commands/dom/toggle.d.ts +2 -0
  6. package/dist/commands/index.js +35 -0
  7. package/dist/commands/index.mjs +35 -0
  8. package/dist/expressions/index.js +0 -27
  9. package/dist/expressions/index.mjs +0 -27
  10. package/dist/hyperfixi-classic-i18n.js +1 -1
  11. package/dist/hyperfixi-minimal.js +1 -1
  12. package/dist/hyperfixi-multilingual.js +1 -1
  13. package/dist/hyperfixi-standard.js +1 -1
  14. package/dist/hyperfixi.js +1 -1
  15. package/dist/hyperfixi.mjs +1 -1
  16. package/dist/i18n/error-catalog.d.ts +12 -0
  17. package/dist/index.js +31352 -23495
  18. package/dist/index.min.js +1 -1
  19. package/dist/index.mjs +31352 -23495
  20. package/dist/lokascript-browser-classic-i18n.js +1 -1
  21. package/dist/lokascript-browser-minimal.js +1 -1
  22. package/dist/lokascript-browser-standard.js +1 -1
  23. package/dist/lokascript-browser.js +1 -1
  24. package/dist/lokascript-multilingual.js +1 -1
  25. package/dist/lse/index.d.ts +15 -0
  26. package/dist/lse/index.js +84 -0
  27. package/dist/lse/index.mjs +71 -0
  28. package/dist/parser/full-parser.js +596 -240
  29. package/dist/parser/full-parser.mjs +596 -240
  30. package/dist/parser/helpers/ast-helpers.d.ts +1 -0
  31. package/dist/parser/parser-types.d.ts +22 -7
  32. package/dist/parser/parser.d.ts +7 -0
  33. package/dist/parser/pratt-parser.d.ts +42 -0
  34. package/dist/parser/token-consumer.d.ts +1 -2
  35. package/dist/parser/tokenizer.d.ts +0 -33
  36. package/dist/registry/index.js +0 -27
  37. package/dist/registry/index.mjs +0 -27
  38. package/dist/runtime/runtime-base.d.ts +3 -0
  39. package/dist/types/base-types.d.ts +11 -0
  40. package/dist/types/core.d.ts +1 -0
  41. package/package.json +12 -3
  42. package/dist/chunks/browser-modular-CwTpxqdt.js +0 -2
@@ -0,0 +1,2 @@
1
+ let n=null;async function t(){if(!n)try{n=await import("./browser-modular-BA3JFmkq.js").then(function(n){return n.n})}catch{throw Error("@lokascript/framework is required for LSE support. Install it: npm install @lokascript/framework")}return n}function r(){if(n)return!0;try{return require.resolve("@lokascript/framework"),!0}catch{return!1}}async function a(n,r){return(await t()).parseExplicit(n,r)}async function o(n){return(await t()).isExplicitSyntax(n)}async function i(n){return(await t()).renderExplicit(n)}async function e(n){return(await t()).fromInterchangeNode(n)}async function c(n){return(await t()).toProtocolJSON(n)}async function u(n){return(await t()).fromProtocolJSON(n)}async function s(n){return(await t()).validateProtocolJSON(n)}async function f(n){return(await t()).toEnvelopeJSON(n)}async function l(n){return(await t()).fromEnvelopeJSON(n)}async function w(n){return(await t()).isEnvelope(n)}async function p(n){return(await t()).semanticNodeToRuntimeAST(n)}export{l as fromEnvelopeJSON,e as fromInterchangeNode,u as fromProtocolJSON,w as isEnvelope,o as isExplicitSyntax,r as isLSEAvailable,a as parseExplicit,i as renderExplicit,p as semanticNodeToRuntimeAST,f as toEnvelopeJSON,c as toProtocolJSON,s as validateProtocolJSON};
2
+ //# sourceMappingURL=index-C6Fn0jGB.js.map
@@ -20,6 +20,8 @@ export type ToggleCommandInput = {
20
20
  type: 'css-property';
21
21
  property: 'display' | 'visibility' | 'opacity';
22
22
  targets: HTMLElement[];
23
+ duration?: number;
24
+ untilEvent?: string;
23
25
  } | {
24
26
  type: 'property';
25
27
  target: PropertyTarget;
@@ -2127,6 +2127,41 @@ let ToggleCommand = (() => {
2127
2127
  if (propertyTarget) {
2128
2128
  return { type: 'property', target: propertyTarget };
2129
2129
  }
2130
+ if (firstArg.type === 'selector' &&
2131
+ typeof firstArg.value === 'string' &&
2132
+ firstArg.value.startsWith('*')) {
2133
+ let expression = firstArg.value;
2134
+ let argsConsumed = 1;
2135
+ if (expression === '*' && raw.args.length > 1 && raw.args[1].type === 'identifier') {
2136
+ expression = '*' + raw.args[1].name;
2137
+ argsConsumed = 2;
2138
+ }
2139
+ if (expression === '*' && raw.modifiers?.on) {
2140
+ const modOnName = raw.modifiers.on?.name;
2141
+ if (modOnName && ['display', 'visibility', 'opacity'].includes(modOnName)) {
2142
+ expression = '*' + modOnName;
2143
+ const { duration, untilEvent } = await parseTemporalModifiers(raw.modifiers, evaluator, context);
2144
+ const property = parseToggleableCSSProperty(expression);
2145
+ if (property) {
2146
+ const me = context.me;
2147
+ return {
2148
+ type: 'css-property',
2149
+ property,
2150
+ targets: me ? [me] : [],
2151
+ duration,
2152
+ untilEvent,
2153
+ };
2154
+ }
2155
+ }
2156
+ }
2157
+ const property = parseToggleableCSSProperty(expression);
2158
+ if (property) {
2159
+ const { duration, untilEvent } = await parseTemporalModifiers(raw.modifiers, evaluator, context);
2160
+ const resolveOpts = { filterPrepositions: true, fallbackModifierKey: 'on' };
2161
+ const targets = await resolveTargetsFromArgs(raw.args.slice(argsConsumed), evaluator, context, 'toggle', resolveOpts, raw.modifiers);
2162
+ return { type: 'css-property', property, targets, duration, untilEvent };
2163
+ }
2164
+ }
2130
2165
  const { duration, untilEvent } = await parseTemporalModifiers(raw.modifiers, evaluator, context);
2131
2166
  const { value: firstValue } = await evaluateFirstArg(firstArg, evaluator, context);
2132
2167
  if (isPropertyTargetString(firstValue)) {
@@ -2125,6 +2125,41 @@ let ToggleCommand = (() => {
2125
2125
  if (propertyTarget) {
2126
2126
  return { type: 'property', target: propertyTarget };
2127
2127
  }
2128
+ if (firstArg.type === 'selector' &&
2129
+ typeof firstArg.value === 'string' &&
2130
+ firstArg.value.startsWith('*')) {
2131
+ let expression = firstArg.value;
2132
+ let argsConsumed = 1;
2133
+ if (expression === '*' && raw.args.length > 1 && raw.args[1].type === 'identifier') {
2134
+ expression = '*' + raw.args[1].name;
2135
+ argsConsumed = 2;
2136
+ }
2137
+ if (expression === '*' && raw.modifiers?.on) {
2138
+ const modOnName = raw.modifiers.on?.name;
2139
+ if (modOnName && ['display', 'visibility', 'opacity'].includes(modOnName)) {
2140
+ expression = '*' + modOnName;
2141
+ const { duration, untilEvent } = await parseTemporalModifiers(raw.modifiers, evaluator, context);
2142
+ const property = parseToggleableCSSProperty(expression);
2143
+ if (property) {
2144
+ const me = context.me;
2145
+ return {
2146
+ type: 'css-property',
2147
+ property,
2148
+ targets: me ? [me] : [],
2149
+ duration,
2150
+ untilEvent,
2151
+ };
2152
+ }
2153
+ }
2154
+ }
2155
+ const property = parseToggleableCSSProperty(expression);
2156
+ if (property) {
2157
+ const { duration, untilEvent } = await parseTemporalModifiers(raw.modifiers, evaluator, context);
2158
+ const resolveOpts = { filterPrepositions: true, fallbackModifierKey: 'on' };
2159
+ const targets = await resolveTargetsFromArgs(raw.args.slice(argsConsumed), evaluator, context, 'toggle', resolveOpts, raw.modifiers);
2160
+ return { type: 'css-property', property, targets, duration, untilEvent };
2161
+ }
2162
+ }
2128
2163
  const { duration, untilEvent } = await parseTemporalModifiers(raw.modifiers, evaluator, context);
2129
2164
  const { value: firstValue } = await evaluateFirstArg(firstArg, evaluator, context);
2130
2165
  if (isPropertyTargetString(firstValue)) {
@@ -3284,33 +3284,6 @@ var TokenKind;
3284
3284
  TokenKind["SYMBOL"] = "symbol";
3285
3285
  TokenKind["UNKNOWN"] = "unknown";
3286
3286
  })(TokenKind || (TokenKind = {}));
3287
- var TokenType;
3288
- (function (TokenType) {
3289
- TokenType["KEYWORD"] = "keyword";
3290
- TokenType["COMMAND"] = "command";
3291
- TokenType["EXPRESSION"] = "expression";
3292
- TokenType["STRING"] = "string";
3293
- TokenType["NUMBER"] = "number";
3294
- TokenType["BOOLEAN"] = "boolean";
3295
- TokenType["TEMPLATE_LITERAL"] = "template_literal";
3296
- TokenType["CSS_SELECTOR"] = "css_selector";
3297
- TokenType["ID_SELECTOR"] = "id_selector";
3298
- TokenType["CLASS_SELECTOR"] = "class_selector";
3299
- TokenType["QUERY_REFERENCE"] = "query_reference";
3300
- TokenType["CONTEXT_VAR"] = "context_var";
3301
- TokenType["GLOBAL_VAR"] = "global_var";
3302
- TokenType["EVENT"] = "event";
3303
- TokenType["OPERATOR"] = "operator";
3304
- TokenType["LOGICAL_OPERATOR"] = "logical_operator";
3305
- TokenType["COMPARISON_OPERATOR"] = "comparison_operator";
3306
- TokenType["TIME_EXPRESSION"] = "time_expression";
3307
- TokenType["OBJECT_LITERAL"] = "object_literal";
3308
- TokenType["ARRAY_LITERAL"] = "array_literal";
3309
- TokenType["SYMBOL"] = "symbol";
3310
- TokenType["COMMENT"] = "comment";
3311
- TokenType["IDENTIFIER"] = "identifier";
3312
- TokenType["UNKNOWN"] = "unknown";
3313
- })(TokenType || (TokenType = {}));
3314
3287
 
3315
3288
  class PerformanceTracker {
3316
3289
  constructor() {
@@ -3282,33 +3282,6 @@ var TokenKind;
3282
3282
  TokenKind["SYMBOL"] = "symbol";
3283
3283
  TokenKind["UNKNOWN"] = "unknown";
3284
3284
  })(TokenKind || (TokenKind = {}));
3285
- var TokenType;
3286
- (function (TokenType) {
3287
- TokenType["KEYWORD"] = "keyword";
3288
- TokenType["COMMAND"] = "command";
3289
- TokenType["EXPRESSION"] = "expression";
3290
- TokenType["STRING"] = "string";
3291
- TokenType["NUMBER"] = "number";
3292
- TokenType["BOOLEAN"] = "boolean";
3293
- TokenType["TEMPLATE_LITERAL"] = "template_literal";
3294
- TokenType["CSS_SELECTOR"] = "css_selector";
3295
- TokenType["ID_SELECTOR"] = "id_selector";
3296
- TokenType["CLASS_SELECTOR"] = "class_selector";
3297
- TokenType["QUERY_REFERENCE"] = "query_reference";
3298
- TokenType["CONTEXT_VAR"] = "context_var";
3299
- TokenType["GLOBAL_VAR"] = "global_var";
3300
- TokenType["EVENT"] = "event";
3301
- TokenType["OPERATOR"] = "operator";
3302
- TokenType["LOGICAL_OPERATOR"] = "logical_operator";
3303
- TokenType["COMPARISON_OPERATOR"] = "comparison_operator";
3304
- TokenType["TIME_EXPRESSION"] = "time_expression";
3305
- TokenType["OBJECT_LITERAL"] = "object_literal";
3306
- TokenType["ARRAY_LITERAL"] = "array_literal";
3307
- TokenType["SYMBOL"] = "symbol";
3308
- TokenType["COMMENT"] = "comment";
3309
- TokenType["IDENTIFIER"] = "identifier";
3310
- TokenType["UNKNOWN"] = "unknown";
3311
- })(TokenType || (TokenType = {}));
3312
3285
 
3313
3286
  class PerformanceTracker {
3314
3287
  constructor() {