@hyperfixi/core 2.2.0 → 2.3.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.
@@ -1,2 +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
1
+ let n=null;async function t(){if(!n)try{n=await import("./browser-modular-AbV0Ql4i.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-BDYQHwCF.js.map
@@ -5331,7 +5331,11 @@ let SetCommand = (() => {
5331
5331
  return { type: 'property', element: firstValue[0], property: 'textContent', value };
5332
5332
  }
5333
5333
  if (typeof firstValue !== 'string') {
5334
- throw new Error('set command target must be a string or object literal');
5334
+ const isMember = firstArg?.type === 'memberExpression' || firstArg?.type === 'propertyAccess';
5335
+ const hint = isMember
5336
+ ? ` (a property chain evaluated to ${firstValue === null ? 'null' : typeof firstValue} — check that all intermediate objects exist)`
5337
+ : '';
5338
+ throw new Error(`set command target must be a string or object literal${hint}`);
5335
5339
  }
5336
5340
  const value = await this.extractValue(raw, evaluator, context);
5337
5341
  return { type: 'variable', name: firstValue, value };
@@ -8711,12 +8715,19 @@ class InstallCommand {
8711
8715
  const behaviorRegistry = context.locals.get('_behaviors');
8712
8716
  if (behaviorRegistry && typeof behaviorRegistry === 'object') {
8713
8717
  const registry = behaviorRegistry;
8714
- return registry.has(behaviorName);
8718
+ if (registry.has(behaviorName))
8719
+ return true;
8720
+ if (registry.resolve && registry.resolve(behaviorName))
8721
+ return true;
8715
8722
  }
8716
8723
  if (typeof globalThis !== 'undefined') {
8717
8724
  const hyperscriptGlobal = globalThis._hyperscript;
8718
8725
  if (hyperscriptGlobal?.behaviors) {
8719
- return hyperscriptGlobal.behaviors.has(behaviorName);
8726
+ if (hyperscriptGlobal.behaviors.has(behaviorName))
8727
+ return true;
8728
+ if (hyperscriptGlobal.behaviors.resolve &&
8729
+ hyperscriptGlobal.behaviors.resolve(behaviorName))
8730
+ return true;
8720
8731
  }
8721
8732
  }
8722
8733
  return false;
@@ -5329,7 +5329,11 @@ let SetCommand = (() => {
5329
5329
  return { type: 'property', element: firstValue[0], property: 'textContent', value };
5330
5330
  }
5331
5331
  if (typeof firstValue !== 'string') {
5332
- throw new Error('set command target must be a string or object literal');
5332
+ const isMember = firstArg?.type === 'memberExpression' || firstArg?.type === 'propertyAccess';
5333
+ const hint = isMember
5334
+ ? ` (a property chain evaluated to ${firstValue === null ? 'null' : typeof firstValue} — check that all intermediate objects exist)`
5335
+ : '';
5336
+ throw new Error(`set command target must be a string or object literal${hint}`);
5333
5337
  }
5334
5338
  const value = await this.extractValue(raw, evaluator, context);
5335
5339
  return { type: 'variable', name: firstValue, value };
@@ -8709,12 +8713,19 @@ class InstallCommand {
8709
8713
  const behaviorRegistry = context.locals.get('_behaviors');
8710
8714
  if (behaviorRegistry && typeof behaviorRegistry === 'object') {
8711
8715
  const registry = behaviorRegistry;
8712
- return registry.has(behaviorName);
8716
+ if (registry.has(behaviorName))
8717
+ return true;
8718
+ if (registry.resolve && registry.resolve(behaviorName))
8719
+ return true;
8713
8720
  }
8714
8721
  if (typeof globalThis !== 'undefined') {
8715
8722
  const hyperscriptGlobal = globalThis._hyperscript;
8716
8723
  if (hyperscriptGlobal?.behaviors) {
8717
- return hyperscriptGlobal.behaviors.has(behaviorName);
8724
+ if (hyperscriptGlobal.behaviors.has(behaviorName))
8725
+ return true;
8726
+ if (hyperscriptGlobal.behaviors.resolve &&
8727
+ hyperscriptGlobal.behaviors.resolve(behaviorName))
8728
+ return true;
8718
8729
  }
8719
8730
  }
8720
8731
  return false;
@@ -36,6 +36,10 @@ export declare class BaseExpressionEvaluator {
36
36
  protected evaluateAttributeAccess(node: {
37
37
  attributeName: string;
38
38
  }, context: ExecutionContext): string | boolean | null;
39
+ protected evaluateAsExpression(node: {
40
+ expression: any;
41
+ targetType: string;
42
+ }, context: ExecutionContext): Promise<unknown>;
39
43
  getAvailableExpressions(): string[];
40
44
  protected evaluateDollarExpression(node: {
41
45
  expression: any;
@@ -1380,6 +1380,8 @@ class BaseExpressionEvaluator {
1380
1380
  return this.evaluateIdSelector(node, context);
1381
1381
  case 'attributeAccess':
1382
1382
  return this.evaluateAttributeAccess(node, context);
1383
+ case 'asExpression':
1384
+ return this.evaluateAsExpression(node, context);
1383
1385
  default:
1384
1386
  throw new Error(`Unsupported AST node type for evaluation: ${node.type}`);
1385
1387
  }
@@ -1665,6 +1667,14 @@ class BaseExpressionEvaluator {
1665
1667
  }
1666
1668
  return `@${node.attributeName}`;
1667
1669
  }
1670
+ async evaluateAsExpression(node, context) {
1671
+ const value = await this.evaluate(node.expression, context);
1672
+ const asExpr = this.expressionRegistry.get('as');
1673
+ if (asExpr) {
1674
+ return asExpr.evaluate(context, value, node.targetType);
1675
+ }
1676
+ throw new Error(`Conversion type 'as' not registered`);
1677
+ }
1668
1678
  getAvailableExpressions() {
1669
1679
  return Array.from(this.expressionRegistry.keys());
1670
1680
  }
@@ -1378,6 +1378,8 @@ class BaseExpressionEvaluator {
1378
1378
  return this.evaluateIdSelector(node, context);
1379
1379
  case 'attributeAccess':
1380
1380
  return this.evaluateAttributeAccess(node, context);
1381
+ case 'asExpression':
1382
+ return this.evaluateAsExpression(node, context);
1381
1383
  default:
1382
1384
  throw new Error(`Unsupported AST node type for evaluation: ${node.type}`);
1383
1385
  }
@@ -1663,6 +1665,14 @@ class BaseExpressionEvaluator {
1663
1665
  }
1664
1666
  return `@${node.attributeName}`;
1665
1667
  }
1668
+ async evaluateAsExpression(node, context) {
1669
+ const value = await this.evaluate(node.expression, context);
1670
+ const asExpr = this.expressionRegistry.get('as');
1671
+ if (asExpr) {
1672
+ return asExpr.evaluate(context, value, node.targetType);
1673
+ }
1674
+ throw new Error(`Conversion type 'as' not registered`);
1675
+ }
1666
1676
  getAvailableExpressions() {
1667
1677
  return Array.from(this.expressionRegistry.keys());
1668
1678
  }