@hyperfixi/core 3.2.0 → 3.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.
@@ -323,13 +323,15 @@ const COMMAND_IMPLEMENTATIONS_TS = {
323
323
  return newVal;
324
324
  }
325
325
 
326
- if (target.type === 'possessive' && isStyleProp(target.property)) {
326
+ if (target.type === 'possessive') {
327
+ const style = isStyleProp(target.property);
327
328
  const obj = await evaluate(target.object, ctx);
328
329
  const elements = toElementArray(obj);
329
330
  for (const el of elements) {
330
- const current = parseFloat(getStyleProp(el, target.property) || '0') || 0;
331
- const newVal = current + amount;
332
- setStyleProp(el, target.property, newVal);
331
+ const was = style ? getStyleProp(el, target.property) : Reflect.get(el, target.property);
332
+ const newVal = (parseFloat(was || '0') || 0) + amount;
333
+ if (style) setStyleProp(el, target.property, newVal);
334
+ else Reflect.set(el, target.property, newVal);
333
335
  ctx.it = newVal;
334
336
  }
335
337
  return ctx.it;
@@ -359,13 +361,15 @@ const COMMAND_IMPLEMENTATIONS_TS = {
359
361
  return newVal;
360
362
  }
361
363
 
362
- if (target.type === 'possessive' && isStyleProp(target.property)) {
364
+ if (target.type === 'possessive') {
365
+ const style = isStyleProp(target.property);
363
366
  const obj = await evaluate(target.object, ctx);
364
367
  const elements = toElementArray(obj);
365
368
  for (const el of elements) {
366
- const current = parseFloat(getStyleProp(el, target.property) || '0') || 0;
367
- const newVal = current - amount;
368
- setStyleProp(el, target.property, newVal);
369
+ const was = style ? getStyleProp(el, target.property) : Reflect.get(el, target.property);
370
+ const newVal = (parseFloat(was || '0') || 0) - amount;
371
+ if (style) setStyleProp(el, target.property, newVal);
372
+ else Reflect.set(el, target.property, newVal);
369
373
  ctx.it = newVal;
370
374
  }
371
375
  return ctx.it;
@@ -321,13 +321,15 @@ const COMMAND_IMPLEMENTATIONS_TS = {
321
321
  return newVal;
322
322
  }
323
323
 
324
- if (target.type === 'possessive' && isStyleProp(target.property)) {
324
+ if (target.type === 'possessive') {
325
+ const style = isStyleProp(target.property);
325
326
  const obj = await evaluate(target.object, ctx);
326
327
  const elements = toElementArray(obj);
327
328
  for (const el of elements) {
328
- const current = parseFloat(getStyleProp(el, target.property) || '0') || 0;
329
- const newVal = current + amount;
330
- setStyleProp(el, target.property, newVal);
329
+ const was = style ? getStyleProp(el, target.property) : Reflect.get(el, target.property);
330
+ const newVal = (parseFloat(was || '0') || 0) + amount;
331
+ if (style) setStyleProp(el, target.property, newVal);
332
+ else Reflect.set(el, target.property, newVal);
331
333
  ctx.it = newVal;
332
334
  }
333
335
  return ctx.it;
@@ -357,13 +359,15 @@ const COMMAND_IMPLEMENTATIONS_TS = {
357
359
  return newVal;
358
360
  }
359
361
 
360
- if (target.type === 'possessive' && isStyleProp(target.property)) {
362
+ if (target.type === 'possessive') {
363
+ const style = isStyleProp(target.property);
361
364
  const obj = await evaluate(target.object, ctx);
362
365
  const elements = toElementArray(obj);
363
366
  for (const el of elements) {
364
- const current = parseFloat(getStyleProp(el, target.property) || '0') || 0;
365
- const newVal = current - amount;
366
- setStyleProp(el, target.property, newVal);
367
+ const was = style ? getStyleProp(el, target.property) : Reflect.get(el, target.property);
368
+ const newVal = (parseFloat(was || '0') || 0) - amount;
369
+ if (style) setStyleProp(el, target.property, newVal);
370
+ else Reflect.set(el, target.property, newVal);
367
371
  ctx.it = newVal;
368
372
  }
369
373
  return ctx.it;
@@ -1,2 +1,2 @@
1
- import{D as n,d as e}from"./browser-modular-BNDYF6Dq.js";function i(n){const e=n.diagnostics;return e?.length?e.filter(n=>"unconsumed-input"===n.code).map(n=>n.message):[]}let t=null;async function a(){return t||(t=await(import("./index-LLuwEQp0.js"))),t}class s{constructor(e={}){this._initialized=!1,this.config={confidenceThreshold:e.confidenceThreshold??n,fallbackOnLowConfidence:e.fallbackOnLowConfidence??!0}}async initialize(){await a(),this._initialized=!0}isInitialized(){return this._initialized}async transform(n,e,i){if(this.isInitialized()||await this.initialize(),e===i)return{output:n,usedSemantic:!1,confidence:1,sourceLang:e,targetLang:i};const t=await a();try{const a=t.translate(n,e,i);if(a!==n)return{output:a,usedSemantic:!0,confidence:.9,sourceLang:e,targetLang:i}}catch{}return{output:n,usedSemantic:!1,confidence:0,sourceLang:e,targetLang:i}}async parse(n,e){this.isInitialized()||await this.initialize();return(await a()).parseSemantic(n,e).node??null}async render(n,e){return(await a()).render(n,e)}async parseToAST(n,e){this.isInitialized()||await this.initialize();const i=await a(),t=i.parseSemantic(n,e);if(t.confidence>=this.config.confidenceThreshold&&t.node)try{return i.buildAST(t.node).ast}catch(n){}return null}async parseToASTWithDetails(n,e){this.isInitialized()||await this.initialize();const t=await a(),s=t.parseSemantic(n,e);if(s.confidence>=this.config.confidenceThreshold&&s.node)try{const n=t.buildAST(s.node);return{ast:n.ast,usedDirectPath:!0,confidence:s.confidence,lang:e,fallbackText:null,warnings:[...n.warnings??[],...i(s.node)]}}catch{}if(s.node&&this.config.fallbackOnLowConfidence){const n=t.render(s.node,"en");return{ast:null,usedDirectPath:!1,confidence:s.confidence,lang:e,fallbackText:n}}return{ast:null,usedDirectPath:!1,confidence:s.confidence,lang:e,fallbackText:null}}async getAllTranslations(n,e){const i=(await a()).getSupportedLanguages(),t={};for(const a of i)t[a]=await this.transform(n,e,a);return t}}function c(n){return{name:"semantic-bridge",parseToAST:(e,i)=>n.parseToASTWithDetails(e,i),parse:(e,i)=>n.parse(e,i),render:(e,i)=>n.render(e,i)}}export{s as SemanticGrammarBridge,c as createBridgeFrontEnd};
2
- //# sourceMappingURL=bridge-Cnj8dQFV.js.map
1
+ import{D as n,d as e}from"./browser-modular-7CpI5VF2.js";function i(n){const e=n.diagnostics;return e?.length?e.filter(n=>"unconsumed-input"===n.code).map(n=>n.message):[]}let t=null;async function a(){return t||(t=await(import("./index-BwXDEK0m.js"))),t}class s{constructor(e={}){this._initialized=!1,this.config={confidenceThreshold:e.confidenceThreshold??n,fallbackOnLowConfidence:e.fallbackOnLowConfidence??!0}}async initialize(){await a(),this._initialized=!0}isInitialized(){return this._initialized}async transform(n,e,i){if(this.isInitialized()||await this.initialize(),e===i)return{output:n,usedSemantic:!1,confidence:1,sourceLang:e,targetLang:i};const t=await a();try{const a=t.translate(n,e,i);if(a!==n)return{output:a,usedSemantic:!0,confidence:.9,sourceLang:e,targetLang:i}}catch{}return{output:n,usedSemantic:!1,confidence:0,sourceLang:e,targetLang:i}}async parse(n,e){this.isInitialized()||await this.initialize();return(await a()).parseSemantic(n,e).node??null}async render(n,e){return(await a()).render(n,e)}async parseToAST(n,e){this.isInitialized()||await this.initialize();const i=await a(),t=i.parseSemantic(n,e);if(t.confidence>=this.config.confidenceThreshold&&t.node)try{return i.buildAST(t.node).ast}catch(n){}return null}async parseToASTWithDetails(n,e){this.isInitialized()||await this.initialize();const t=await a(),s=t.parseSemantic(n,e);if(s.confidence>=this.config.confidenceThreshold&&s.node)try{const n=t.buildAST(s.node);return{ast:n.ast,usedDirectPath:!0,confidence:s.confidence,lang:e,fallbackText:null,warnings:[...n.warnings??[],...i(s.node)]}}catch{}if(s.node&&this.config.fallbackOnLowConfidence){const n=t.render(s.node,"en");return{ast:null,usedDirectPath:!1,confidence:s.confidence,lang:e,fallbackText:n}}return{ast:null,usedDirectPath:!1,confidence:s.confidence,lang:e,fallbackText:null}}async getAllTranslations(n,e){const i=(await a()).getSupportedLanguages(),t={};for(const a of i)t[a]=await this.transform(n,e,a);return t}}function c(n){return{name:"semantic-bridge",parseToAST:(e,i)=>n.parseToASTWithDetails(e,i),parse:(e,i)=>n.parse(e,i),render:(e,i)=>n.render(e,i)}}export{s as SemanticGrammarBridge,c as createBridgeFrontEnd};
2
+ //# sourceMappingURL=bridge-CI9SOl8u.js.map