@vef-framework-react/expression 2.4.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 (37) hide show
  1. package/dist/cjs/condition/compile.cjs +1 -0
  2. package/dist/cjs/condition/types.cjs +1 -0
  3. package/dist/cjs/engine/errors.cjs +1 -0
  4. package/dist/cjs/engine/evaluate.cjs +1 -0
  5. package/dist/cjs/engine/intellisense.cjs +1 -0
  6. package/dist/cjs/engine/loader.cjs +1 -0
  7. package/dist/cjs/engine/messages.cjs +1 -0
  8. package/dist/cjs/index.cjs +1 -0
  9. package/dist/cjs/react/context.cjs +1 -0
  10. package/dist/cjs/react/index.cjs +1 -0
  11. package/dist/cjs/react/provider.cjs +1 -0
  12. package/dist/cjs/react/use-expression-engine.cjs +1 -0
  13. package/dist/es/condition/compile.js +91 -0
  14. package/dist/es/condition/types.js +20 -0
  15. package/dist/es/engine/errors.js +14 -0
  16. package/dist/es/engine/evaluate.js +26 -0
  17. package/dist/es/engine/intellisense.js +64 -0
  18. package/dist/es/engine/loader.js +69 -0
  19. package/dist/es/engine/messages.js +122 -0
  20. package/dist/es/index.js +9 -0
  21. package/dist/es/react/context.js +6 -0
  22. package/dist/es/react/index.js +4 -0
  23. package/dist/es/react/provider.js +20 -0
  24. package/dist/es/react/use-expression-engine.js +11 -0
  25. package/dist/types/src/condition/compile.d.ts +49 -0
  26. package/dist/types/src/condition/types.d.ts +77 -0
  27. package/dist/types/src/engine/errors.d.ts +17 -0
  28. package/dist/types/src/engine/evaluate.d.ts +36 -0
  29. package/dist/types/src/engine/intellisense.d.ts +123 -0
  30. package/dist/types/src/engine/loader.d.ts +102 -0
  31. package/dist/types/src/engine/messages.d.ts +28 -0
  32. package/dist/types/src/index.d.ts +7 -0
  33. package/dist/types/src/react/context.d.ts +3 -0
  34. package/dist/types/src/react/index.d.ts +2 -0
  35. package/dist/types/src/react/provider.d.ts +23 -0
  36. package/dist/types/src/react/use-expression-engine.d.ts +7 -0
  37. package/package.json +81 -0
@@ -0,0 +1 @@
1
+ const e=require("../engine/errors.cjs"),t=require("../engine/loader.cjs");let n=require("@vef-framework-react/shared");var r=/^[A-Z_$][\w$]*(?:\.[A-Z_$][\w$]*|\[\d+\])*$/i;function i(t){if((0,n.isNullish)(t))return`null`;if(typeof t==`number`||typeof t==`boolean`||typeof t==`bigint`)return String(t);if((0,n.isString)(t))return a(t);if((0,n.isArray)(t))return`[${t.map(e=>i(e)).join(`, `)}]`;throw new e.ExpressionError(`Value of type "${typeof t}" has no ZEN literal representation`)}function a(t){let n=t.includes(`'`),r=t.includes(`"`);if(n&&r)throw new e.ExpressionError(`String contains both single and double quotes and has no ZEN literal representation`);return n?`"${t}"`:`'${t}'`}function o(e){return(0,n.isArray)(e)?i(e):`[${i(e)}]`}function s(e){return`(${e} == null or (type(${e}) == 'string' and len(trim(${e})) == 0) or (type(${e}) == 'array' and len(${e}) == 0))`}function c(t,n,r){switch(n){case`eq`:return`${t} == ${i(r)}`;case`ne`:return`${t} != ${i(r)}`;case`gt`:return`${t} > ${i(r)}`;case`gte`:return`${t} >= ${i(r)}`;case`lt`:return`${t} < ${i(r)}`;case`lte`:return`${t} <= ${i(r)}`;case`contains`:return`contains(${t}, ${i(r)})`;case`not_contains`:return`not contains(${t}, ${i(r)})`;case`starts_with`:return`startsWith(${t}, ${i(r)})`;case`ends_with`:return`endsWith(${t}, ${i(r)})`;case`in`:return`${t} in ${o(r)}`;case`not_in`:return`not (${t} in ${o(r)})`;case`is_empty`:return s(t);case`is_not_empty`:return`not ${s(t)}`;default:throw new e.ExpressionError(`Unsupported operator: ${String(n)}`)}}function l(e){if(e.kind===`expression`){let t=e.expression.trim();return t===``?null:t}let t=e.subject.trim();if(!r.test(t))return null;try{return c(t,e.operator,e.value)}catch{return null}}function u(e){let t=e.conditions.map(e=>l(e)).filter(e=>e!==null);return t.length===0?null:t.join(` and `)}function d(e){let t=(e.conditionGroups??[]).map(e=>u(e)).filter(e=>e!==null);return t.length===0?null:t.map(e=>`(${e})`).join(` or `)}function f(e,t,n){let r=e.toSorted((e,t)=>e.priority-t.priority);for(let e of r){if(e.isDefault)continue;let r=d(e);if(r!==null&&p(n,r,t))return{branchId:e.id,matched:!0}}return{branchId:r.find(e=>e.isDefault)?.id??null,matched:!1}}function p(e,t,n){try{return e.evaluate(t,n)===!0}catch{return!1}}async function m(e,n){return f(e,n,await t.loadEngine())}exports.compileBranch=d,exports.compileCondition=l,exports.compileGroup=u,exports.selectBranch=m,exports.selectBranchWith=f,exports.toZenLiteral=i;
@@ -0,0 +1 @@
1
+ var e=[`eq`,`ne`,`gt`,`gte`,`lt`,`lte`,`contains`,`not_contains`,`starts_with`,`ends_with`,`in`,`not_in`,`is_empty`,`is_not_empty`];exports.CONDITION_OPERATORS=e;
@@ -0,0 +1 @@
1
+ var e=class extends Error{expression;constructor(e,t,n){super(e,{cause:n}),this.name=`ExpressionError`,this.expression=t}},t=class extends e{constructor(e=`Expression engine is not initialized. Await loadEngine() or render under <ExpressionEngineProvider>.`){super(e),this.name=`ExpressionNotReadyError`}};exports.ExpressionError=e,exports.ExpressionNotReadyError=t;
@@ -0,0 +1 @@
1
+ const e=require("./loader.cjs");async function t(t,n){return(await e.loadEngine()).evaluate(t,n)}async function n(t,n){return(await e.loadEngine()).evaluateUnary(t,n)}function r(t,n){return e.getEngineSync().evaluate(t,n)}function i(t,n){return e.getEngineSync().evaluateUnary(t,n)}async function a(t){return(await e.loadEngine()).validate(t)}async function o(t){return(await e.loadEngine()).validateUnary(t)}async function s(){return(await e.loadEngine()).getCompletions()}exports.evaluate=t,exports.evaluateSync=r,exports.evaluateUnary=n,exports.evaluateUnarySync=i,exports.getCompletions=s,exports.validate=a,exports.validateUnary=o;
@@ -0,0 +1 @@
1
+ const e=require("./loader.cjs"),t=require("./messages.cjs");function n(e){let t=e.split(` at `),n=t.length<=1?void 0:t.at(-1);if(n===void 0)return null;let[r,i]=n.replace(`(`,``).replace(`)`,``).split(`, `),a=r===void 0?NaN:Number.parseInt(r,10);if(Number.isNaN(a))return null;if(i===void 0)return a;let o=Number.parseInt(i,10);return Number.isNaN(o)?a:[a,o]}function r(e,r){if(e==null)return null;let i=e,a=typeof i.source==`string`?i.source:String(e),o=n(a),[s,c]=o===null?[0,r.length]:typeof o==`number`?[o,o]:o;return{from:s,to:c,message:a,source:t.localizeSourceLabel(i.type)}}function i(e){return Array.isArray(e)?e.flatMap(e=>{let n=e;return typeof n.label!=`string`||n.label===``?[]:[{type:n.type===`method`||n.type===`variable`?n.type:`function`,label:n.label,detail:typeof n.detail==`string`?n.detail.replaceAll("`",``):``,info:t.localizeCompletionInfo(typeof n.info==`string`?n.info:``),boost:typeof n.boost==`number`?n.boost:null,methodFor:typeof n.methodFor==`string`?n.methodFor:null}]}):[]}async function a(t,n){let i=await e.loadEngine();return r(n===`unary`?i.validateUnary(t):i.validate(t),t)}function o(t,n){let i=e.getEngineSync();return r(n===`unary`?i.validateUnary(t):i.validate(t),t)}async function s(){return i((await e.loadEngine()).getCompletions())}function c(){return i(e.getEngineSync().getCompletions())}async function l(t,n,r){return(await e.loadEngine()).analyze(t,n,r===`unary`)}function u(t,n,r){return e.getEngineSync().analyze(t,n,r===`unary`)}async function d(t,n){return(await e.loadEngine()).satisfies(t,n)}function f(t,n){return e.getEngineSync().satisfies(t,n)}exports.analyzeTypes=l,exports.analyzeTypesSync=u,exports.getCompletionItems=s,exports.getCompletionItemsSync=c,exports.getDiagnostics=a,exports.getDiagnosticsSync=o,exports.satisfiesType=d,exports.satisfiesTypeSync=f;
@@ -0,0 +1 @@
1
+ const e=require("./errors.cjs");let t=require("@vef-framework-react/shared");var n=null,r=null,i=null,a;function o(t,n){try{return n()}catch(n){throw new e.ExpressionError(`Failed to evaluate expression: ${t}`,t,n)}}function s(){let e=`Failed to load the ZEN expression engine`;return(0,t.isUndefined)(globalThis.window)?`${e}. In a non-browser host (Node / SSR) the wasm cannot be auto-resolved; call configureEngine({ wasmInput }) with the wasm bytes or URL before loading.`:e}function c(t){if(n||r)throw new e.ExpressionError(`configureEngine() must be called before the engine loads.`);a=t.wasmInput}function l(){return n||(i=null,n=(async()=>{let e=await import(`@gorules/zen-engine-wasm`);await e.default((0,t.isUndefined)(a)?void 0:{module_or_path:a});let n=Object.freeze({evaluate:(t,n={})=>o(t,()=>e.evaluateExpression(t,n)),evaluateUnary:(t,n={})=>o(t,()=>e.evaluateUnaryExpression(t,n)),validate:t=>e.validateExpression(t),validateUnary:t=>e.validateUnaryExpression(t),getCompletions:()=>e.getCompletions(),analyze:(t,n,r)=>{let i=e.VariableType.fromJson(t);try{let e=i.toJson(),t=r?i.typeCheckUnary(n):i.typeCheck(n);return{rootKind:e,spans:Array.isArray(t)?t:[]}}finally{i.free()}},satisfies:(t,n)=>{let r=e.VariableType.fromJson(t),i=e.VariableType.fromJson(n);try{return r.satisfies(i)}finally{r.free(),i.free()}},isReady:()=>e.isReady()});return r=n,n})().catch(t=>{throw n=null,i=new e.ExpressionError(s(),void 0,t),i}),n)}function u(){return r?.isReady()??!1}function d(){return i}function f(){if(!r)throw new e.ExpressionNotReadyError;return r}exports.configureEngine=c,exports.getEngineError=d,exports.getEngineSync=f,exports.isEngineReady=u,exports.loadEngine=l;
@@ -0,0 +1 @@
1
+ var e=`en-US`;function t(t){e=t}function n(){return e}var r={"Returns the length of variable":`返回变量的长度`,"Checks if variable contains a needle":`检查变量是否包含指定元素`,"Flattens an array":`将数组扁平化`,"Merges multiple objects into one.":`将多个对象合并为一个。`,"Deeply merges multiple objects into one.":`将多个对象深度合并为一个。`,"Converts all characters in a string to uppercase":`将字符串中所有字符转换为大写`,"Converts all characters in a string to lowercase":`将字符串中所有字符转换为小写`,"Returns the string with leading and trailing whitespace removed":`返回去除首尾空白后的字符串`,"Returns true if the string starts with the specified prefix":`若字符串以指定前缀开头则返回 true`,"Returns true if the string ends with the specified suffix":`若字符串以指定后缀结尾则返回 true`,"Returns true if the string matches the specified pattern":`若字符串匹配指定模式则返回 true`,"Extracts matching substrings according to a pattern":`按模式提取匹配的子串`,"Performs a fuzzy search of the needle in the haystack, and returns the match score(s).":`在目标中对关键字进行模糊搜索,并返回匹配得分。`,"Splits a string into an array of substrings using the specified delimiter.":`使用指定分隔符将字符串拆分为子串数组。`,"Returns the absolute value of a number":`返回数字的绝对值`,"Returns the sum of all elements in the input array.":`返回输入数组中所有元素之和。`,"Calculates the average of all elements in the input array.":`计算输入数组中所有元素的平均值。`,"Returns the smallest of the elements in the input array.":`返回输入数组中的最小元素。`,"Returns the largest of the elements in the input array.":`返回输入数组中的最大元素。`,"Generates a random number between 0 (inclusive) and max (inclusive).":`生成 0 到 max(均包含)之间的随机数。`,"Calculates the median value of all elements in the input array.":`计算输入数组中所有元素的中位数。`,"Finds the mode(s) of the input array, which are the most frequent element(s).":`求输入数组的众数,即出现最频繁的元素。`,"Rounds a number down to the nearest integer.":`向下取整到最接近的整数。`,"Rounds a number up to the nearest integer.":`向上取整到最接近的整数。`,"Rounds a number to a specified number of decimal places.":`将数字四舍五入到指定的小数位数。`,"Truncates a number to a specified number of decimal places.":`将数字截断到指定的小数位数。`,"Checks if the given value is of a numeric type.":`检查给定值是否为数值类型。`,"Converts the given value to a string.":`将给定值转换为字符串。`,"Converts the given value to a number.":`将给定值转换为数字。`,"Converts the given value to a boolean.":`将给定值转换为布尔值。`,"Returns a string representing the data type of the value.":`返回表示该值数据类型的字符串。`,"Returns an array of a given object's own enumerable property names.":`返回由给定对象自身可枚举属性名组成的数组。`,"Returns an array of a given object's own enumerable property values.":`返回由给定对象自身可枚举属性值组成的数组。`,"Returns a new date time instance.":`返回一个新的日期时间实例。`,"Converts a numeric timestamp to a unix timestamp.":`将数值时间戳转换为 Unix 时间戳。`,"Extracts the time from a numeric timestamp and returns it as a seconds from beginning of day.":`从数值时间戳中提取时间,以当天起始的秒数返回。`,"e.g. 1h30min":`例如 1h30min`,"Extracts the year from a given timestamp.":`从给定时间戳中提取年份。`,"Gets the day of the week from a given timestamp, where Sunday might be 0.":`获取给定时间戳的星期几(周日可能为 0)。`,"Extracts the day of the month from a given timestamp.":`从给定时间戳中提取当月的日期。`,"Gets the day of the year from a given timestamp.":`获取给定时间戳在一年中的第几天。`,"Calculates the week of the year from a given timestamp.":`计算给定时间戳在一年中的第几周。`,"Extracts the month from a given timestamp, typically with January as 1.":`从给定时间戳中提取月份(通常 1 月为 1)。`,"Converts the month from a given timestamp into its string representation (e.g., 'Jan').":`将给定时间戳的月份转换为字符串表示(例如 'Jan')。`,"Converts a timestamp to a human-readable date string.":`将时间戳转换为人类可读的日期字符串。`,"Converts the day of the week from a given timestamp into its string representation (e.g., 'Mon').":`将给定时间戳的星期几转换为字符串表示(例如 'Mon')。`,"Returns the timestamp representing the start of a specified unit (e.g., day, month, year) based on a given timestamp.":`返回给定时间戳在指定单位(如日、月、年)起始处的时间戳。`,"Returns the timestamp representing the end of a specified unit (e.g., day, month, year) based on a given timestamp.":`返回给定时间戳在指定单位(如日、月、年)结束处的时间戳。`,"Checks if all elements in the array satisfy the condition defined in the callback.":`检查数组中所有元素是否都满足回调中定义的条件。`,"Checks if no elements in the array satisfy the condition defined in the callback.":`检查数组中是否没有任何元素满足回调中定义的条件。`,"Checks if at least one element in the array satisfies the condition defined in the callback.":`检查数组中是否至少有一个元素满足回调中定义的条件。`,"Checks if exactly one element in the array satisfies the condition defined in the callback.":`检查数组中是否恰好有一个元素满足回调中定义的条件。`,"Creates a new array with all elements that satisfy the condition defined in the callback.":`创建一个仅包含满足回调中定义条件的元素的新数组。`,"Creates a new array populated with the results of calling the provided function on every element in the calling array.":`创建一个新数组,其元素为对原数组每个元素调用所提供函数的结果。`,"First maps each element using a mapping function, then flattens the result into a new array.":`先用映射函数处理每个元素,再将结果扁平化为新数组。`,"Counts the number of elements in the array that satisfy the condition defined in the callback.":`统计数组中满足回调中定义条件的元素个数。`,"Adds time to a date":`为日期增加时间`,"Subtracts time from a date":`从日期中减去时间`,"Sets a specific unit of time on a date":`设置日期的某个时间单位`,"Formats a date into a string representation":`将日期格式化为字符串`,"Returns the start of a specified time unit for a date":`返回日期在指定时间单位上的起始`,"Returns the end of a specified time unit for a date":`返回日期在指定时间单位上的结束`,"Calculates the difference between two dates":`计算两个日期之间的差值`,"Converts a date to a different timezone":`将日期转换到不同的时区`,"Checks if two dates are the same":`检查两个日期是否相同`,"Checks if a date is before another date":`检查日期是否早于另一个日期`,"Checks if a date is after another date":`检查日期是否晚于另一个日期`,"Checks if a date is the same as or before another date":`检查日期是否等于或早于另一个日期`,"Checks if a date is the same as or after another date":`检查日期是否等于或晚于另一个日期`,"Gets the seconds of a date":`获取日期的秒`,"Gets the minutes of a date":`获取日期的分钟`,"Gets the hours of a date":`获取日期的小时`,"Gets the day of the month for a date":`获取日期在当月的第几天`,"Gets the day of the year for a date":`获取日期在当年的第几天`,"Gets the week of the year for a date":`获取日期在当年的第几周`,"Gets the day of the week for a date":`获取日期的星期几`,"Gets the month for a date":`获取日期的月份`,"Gets the quarter for a date":`获取日期所在的季度`,"Gets the year for a date":`获取日期的年份`,"Gets the Unix timestamp for a date":`获取日期的 Unix 时间戳`,"Gets the timezone offset name for a date":`获取日期的时区偏移名称`,"Checks if a date is valid":`检查日期是否有效`,"Checks if a date is yesterday":`检查日期是否为昨天`,"Checks if a date is today":`检查日期是否为今天`,"Checks if a date is tomorrow":`检查日期是否为明天`,"Checks if the year of a date is a leap year":`检查日期所在年份是否为闰年`};function i(t){return e!==`zh-CN`||t===``?t:r[t]??t}var a={"en-US":{lexerError:`Lexer error`,parserError:`Parser error`,compilerError:`Compiler error`,vmError:`VM error`,fallback:`Error`},"zh-CN":{lexerError:`词法错误`,parserError:`语法错误`,compilerError:`编译错误`,vmError:`运行时错误`,fallback:`错误`}};function o(t){let n=a[e];return(t===void 0?void 0:n[t])??n.fallback}exports.getExpressionLocale=n,exports.localizeCompletionInfo=i,exports.localizeSourceLabel=o,exports.setExpressionLocale=t;
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./engine/errors.cjs"),t=require("./engine/loader.cjs"),n=require("./condition/compile.cjs"),r=require("./condition/types.cjs"),i=require("./engine/evaluate.cjs"),a=require("./engine/messages.cjs"),o=require("./engine/intellisense.cjs");exports.CONDITION_OPERATORS=r.CONDITION_OPERATORS,exports.ExpressionError=e.ExpressionError,exports.ExpressionNotReadyError=e.ExpressionNotReadyError,exports.analyzeTypes=o.analyzeTypes,exports.analyzeTypesSync=o.analyzeTypesSync,exports.compileBranch=n.compileBranch,exports.compileCondition=n.compileCondition,exports.compileGroup=n.compileGroup,exports.configureEngine=t.configureEngine,exports.evaluate=i.evaluate,exports.evaluateSync=i.evaluateSync,exports.evaluateUnary=i.evaluateUnary,exports.evaluateUnarySync=i.evaluateUnarySync,exports.getCompletionItems=o.getCompletionItems,exports.getCompletionItemsSync=o.getCompletionItemsSync,exports.getCompletions=i.getCompletions,exports.getDiagnostics=o.getDiagnostics,exports.getDiagnosticsSync=o.getDiagnosticsSync,exports.getEngineError=t.getEngineError,exports.getEngineSync=t.getEngineSync,exports.getExpressionLocale=a.getExpressionLocale,exports.isEngineReady=t.isEngineReady,exports.loadEngine=t.loadEngine,exports.satisfiesType=o.satisfiesType,exports.satisfiesTypeSync=o.satisfiesTypeSync,exports.selectBranch=n.selectBranch,exports.selectBranchWith=n.selectBranchWith,exports.setExpressionLocale=a.setExpressionLocale,exports.toZenLiteral=n.toZenLiteral,exports.validate=i.validate,exports.validateUnary=i.validateUnary;
@@ -0,0 +1 @@
1
+ var e=(0,require("react").createContext)(null);exports.ExpressionEngineContext=e;
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./provider.cjs"),t=require("./use-expression-engine.cjs");exports.ExpressionEngineProvider=e.ExpressionEngineProvider,exports.useExpressionEngine=t.useExpressionEngine;
@@ -0,0 +1 @@
1
+ const e=require("../engine/loader.cjs"),t=require("../engine/messages.cjs"),n=require("./context.cjs");let r=require("react"),i=require("react/jsx-runtime");function a({children:t}){if(!e.isEngineReady())throw e.getEngineError()||e.loadEngine();let r=e.getEngineSync();return(0,i.jsx)(n.ExpressionEngineContext,{value:r,children:t})}var o=({children:e,fallback:n=null,locale:o})=>(o!==void 0&&t.setExpressionLocale(o),(0,i.jsx)(r.Suspense,{fallback:n,children:(0,i.jsx)(a,{children:e})}));exports.ExpressionEngineProvider=o;
@@ -0,0 +1 @@
1
+ const e=require("./context.cjs");let t=require("react");function n(){let n=(0,t.use)(e.ExpressionEngineContext);if(!n)throw Error(`useExpressionEngine must be used within <ExpressionEngineProvider>.`);return n}exports.useExpressionEngine=n;
@@ -0,0 +1,91 @@
1
+ /*! @vef-framework-react/expression v2.4.0 made by Venus | 2026-06-15T15:10:07.346Z */
2
+ import { ExpressionError as e } from "../engine/errors.js";
3
+ import { loadEngine as t } from "../engine/loader.js";
4
+ import { isArray as n, isNullish as r, isString as i } from "@vef-framework-react/shared";
5
+ //#region src/condition/compile.ts
6
+ var a = /^[A-Z_$][\w$]*(?:\.[A-Z_$][\w$]*|\[\d+\])*$/i;
7
+ function o(t) {
8
+ if (r(t)) return "null";
9
+ if (typeof t == "number" || typeof t == "boolean" || typeof t == "bigint") return String(t);
10
+ if (i(t)) return s(t);
11
+ if (n(t)) return `[${t.map((e) => o(e)).join(", ")}]`;
12
+ throw new e(`Value of type "${typeof t}" has no ZEN literal representation`);
13
+ }
14
+ function s(t) {
15
+ let n = t.includes("'"), r = t.includes("\"");
16
+ if (n && r) throw new e("String contains both single and double quotes and has no ZEN literal representation");
17
+ return n ? `"${t}"` : `'${t}'`;
18
+ }
19
+ function c(e) {
20
+ return n(e) ? o(e) : `[${o(e)}]`;
21
+ }
22
+ function l(e) {
23
+ return `(${e} == null or (type(${e}) == 'string' and len(trim(${e})) == 0) or (type(${e}) == 'array' and len(${e}) == 0))`;
24
+ }
25
+ function u(t, n, r) {
26
+ switch (n) {
27
+ case "eq": return `${t} == ${o(r)}`;
28
+ case "ne": return `${t} != ${o(r)}`;
29
+ case "gt": return `${t} > ${o(r)}`;
30
+ case "gte": return `${t} >= ${o(r)}`;
31
+ case "lt": return `${t} < ${o(r)}`;
32
+ case "lte": return `${t} <= ${o(r)}`;
33
+ case "contains": return `contains(${t}, ${o(r)})`;
34
+ case "not_contains": return `not contains(${t}, ${o(r)})`;
35
+ case "starts_with": return `startsWith(${t}, ${o(r)})`;
36
+ case "ends_with": return `endsWith(${t}, ${o(r)})`;
37
+ case "in": return `${t} in ${c(r)}`;
38
+ case "not_in": return `not (${t} in ${c(r)})`;
39
+ case "is_empty": return l(t);
40
+ case "is_not_empty": return `not ${l(t)}`;
41
+ default: throw new e(`Unsupported operator: ${String(n)}`);
42
+ }
43
+ }
44
+ function d(e) {
45
+ if (e.kind === "expression") {
46
+ let t = e.expression.trim();
47
+ return t === "" ? null : t;
48
+ }
49
+ let t = e.subject.trim();
50
+ if (!a.test(t)) return null;
51
+ try {
52
+ return u(t, e.operator, e.value);
53
+ } catch {
54
+ return null;
55
+ }
56
+ }
57
+ function f(e) {
58
+ let t = e.conditions.map((e) => d(e)).filter((e) => e !== null);
59
+ return t.length === 0 ? null : t.join(" and ");
60
+ }
61
+ function p(e) {
62
+ let t = (e.conditionGroups ?? []).map((e) => f(e)).filter((e) => e !== null);
63
+ return t.length === 0 ? null : t.map((e) => `(${e})`).join(" or ");
64
+ }
65
+ function m(e, t, n) {
66
+ let r = e.toSorted((e, t) => e.priority - t.priority);
67
+ for (let e of r) {
68
+ if (e.isDefault) continue;
69
+ let r = p(e);
70
+ if (r !== null && h(n, r, t)) return {
71
+ branchId: e.id,
72
+ matched: !0
73
+ };
74
+ }
75
+ return {
76
+ branchId: r.find((e) => e.isDefault)?.id ?? null,
77
+ matched: !1
78
+ };
79
+ }
80
+ function h(e, t, n) {
81
+ try {
82
+ return e.evaluate(t, n) === !0;
83
+ } catch {
84
+ return !1;
85
+ }
86
+ }
87
+ async function g(e, n) {
88
+ return m(e, n, await t());
89
+ }
90
+ //#endregion
91
+ export { p as compileBranch, d as compileCondition, f as compileGroup, g as selectBranch, m as selectBranchWith, o as toZenLiteral };
@@ -0,0 +1,20 @@
1
+ /*! @vef-framework-react/expression v2.4.0 made by Venus | 2026-06-15T15:10:07.346Z */
2
+ //#region src/condition/types.ts
3
+ var e = [
4
+ "eq",
5
+ "ne",
6
+ "gt",
7
+ "gte",
8
+ "lt",
9
+ "lte",
10
+ "contains",
11
+ "not_contains",
12
+ "starts_with",
13
+ "ends_with",
14
+ "in",
15
+ "not_in",
16
+ "is_empty",
17
+ "is_not_empty"
18
+ ];
19
+ //#endregion
20
+ export { e as CONDITION_OPERATORS };
@@ -0,0 +1,14 @@
1
+ /*! @vef-framework-react/expression v2.4.0 made by Venus | 2026-06-15T15:10:07.346Z */
2
+ //#region src/engine/errors.ts
3
+ var e = class extends Error {
4
+ expression;
5
+ constructor(e, t, n) {
6
+ super(e, { cause: n }), this.name = "ExpressionError", this.expression = t;
7
+ }
8
+ }, t = class extends e {
9
+ constructor(e = "Expression engine is not initialized. Await loadEngine() or render under <ExpressionEngineProvider>.") {
10
+ super(e), this.name = "ExpressionNotReadyError";
11
+ }
12
+ };
13
+ //#endregion
14
+ export { e as ExpressionError, t as ExpressionNotReadyError };
@@ -0,0 +1,26 @@
1
+ /*! @vef-framework-react/expression v2.4.0 made by Venus | 2026-06-15T15:10:07.346Z */
2
+ import { getEngineSync as e, loadEngine as t } from "./loader.js";
3
+ //#region src/engine/evaluate.ts
4
+ async function n(e, n) {
5
+ return (await t()).evaluate(e, n);
6
+ }
7
+ async function r(e, n) {
8
+ return (await t()).evaluateUnary(e, n);
9
+ }
10
+ function i(t, n) {
11
+ return e().evaluate(t, n);
12
+ }
13
+ function a(t, n) {
14
+ return e().evaluateUnary(t, n);
15
+ }
16
+ async function o(e) {
17
+ return (await t()).validate(e);
18
+ }
19
+ async function s(e) {
20
+ return (await t()).validateUnary(e);
21
+ }
22
+ async function c() {
23
+ return (await t()).getCompletions();
24
+ }
25
+ //#endregion
26
+ export { n as evaluate, i as evaluateSync, r as evaluateUnary, a as evaluateUnarySync, c as getCompletions, o as validate, s as validateUnary };
@@ -0,0 +1,64 @@
1
+ /*! @vef-framework-react/expression v2.4.0 made by Venus | 2026-06-15T15:10:07.346Z */
2
+ import { getEngineSync as e, loadEngine as t } from "./loader.js";
3
+ import { localizeCompletionInfo as n, localizeSourceLabel as r } from "./messages.js";
4
+ //#region src/engine/intellisense.ts
5
+ function i(e) {
6
+ let t = e.split(" at "), n = t.length <= 1 ? void 0 : t.at(-1);
7
+ if (n === void 0) return null;
8
+ let [r, i] = n.replace("(", "").replace(")", "").split(", "), a = r === void 0 ? NaN : Number.parseInt(r, 10);
9
+ if (Number.isNaN(a)) return null;
10
+ if (i === void 0) return a;
11
+ let o = Number.parseInt(i, 10);
12
+ return Number.isNaN(o) ? a : [a, o];
13
+ }
14
+ function a(e, t) {
15
+ if (e == null) return null;
16
+ let n = e, a = typeof n.source == "string" ? n.source : String(e), o = i(a), [s, c] = o === null ? [0, t.length] : typeof o == "number" ? [o, o] : o;
17
+ return {
18
+ from: s,
19
+ to: c,
20
+ message: a,
21
+ source: r(n.type)
22
+ };
23
+ }
24
+ function o(e) {
25
+ return Array.isArray(e) ? e.flatMap((e) => {
26
+ let t = e;
27
+ return typeof t.label != "string" || t.label === "" ? [] : [{
28
+ type: t.type === "method" || t.type === "variable" ? t.type : "function",
29
+ label: t.label,
30
+ detail: typeof t.detail == "string" ? t.detail.replaceAll("`", "") : "",
31
+ info: n(typeof t.info == "string" ? t.info : ""),
32
+ boost: typeof t.boost == "number" ? t.boost : null,
33
+ methodFor: typeof t.methodFor == "string" ? t.methodFor : null
34
+ }];
35
+ }) : [];
36
+ }
37
+ async function s(e, n) {
38
+ let r = await t();
39
+ return a(n === "unary" ? r.validateUnary(e) : r.validate(e), e);
40
+ }
41
+ function c(t, n) {
42
+ let r = e();
43
+ return a(n === "unary" ? r.validateUnary(t) : r.validate(t), t);
44
+ }
45
+ async function l() {
46
+ return o((await t()).getCompletions());
47
+ }
48
+ function u() {
49
+ return o(e().getCompletions());
50
+ }
51
+ async function d(e, n, r) {
52
+ return (await t()).analyze(e, n, r === "unary");
53
+ }
54
+ function f(t, n, r) {
55
+ return e().analyze(t, n, r === "unary");
56
+ }
57
+ async function p(e, n) {
58
+ return (await t()).satisfies(e, n);
59
+ }
60
+ function m(t, n) {
61
+ return e().satisfies(t, n);
62
+ }
63
+ //#endregion
64
+ export { d as analyzeTypes, f as analyzeTypesSync, l as getCompletionItems, u as getCompletionItemsSync, s as getDiagnostics, c as getDiagnosticsSync, p as satisfiesType, m as satisfiesTypeSync };
@@ -0,0 +1,69 @@
1
+ /*! @vef-framework-react/expression v2.4.0 made by Venus | 2026-06-15T15:10:07.346Z */
2
+ import { ExpressionError as e, ExpressionNotReadyError as t } from "./errors.js";
3
+ import { isUndefined as n } from "@vef-framework-react/shared";
4
+ //#region src/engine/loader.ts
5
+ var r = null, i = null, a = null, o;
6
+ function s(t, n) {
7
+ try {
8
+ return n();
9
+ } catch (n) {
10
+ throw new e(`Failed to evaluate expression: ${t}`, t, n);
11
+ }
12
+ }
13
+ function c() {
14
+ let e = "Failed to load the ZEN expression engine";
15
+ return n(globalThis.window) ? `${e}. In a non-browser host (Node / SSR) the wasm cannot be auto-resolved; call configureEngine({ wasmInput }) with the wasm bytes or URL before loading.` : e;
16
+ }
17
+ function l(t) {
18
+ if (r || i) throw new e("configureEngine() must be called before the engine loads.");
19
+ o = t.wasmInput;
20
+ }
21
+ function u() {
22
+ return r || (a = null, r = (async () => {
23
+ let e = await import("@gorules/zen-engine-wasm");
24
+ await e.default(n(o) ? void 0 : { module_or_path: o });
25
+ let t = Object.freeze({
26
+ evaluate: (t, n = {}) => s(t, () => e.evaluateExpression(t, n)),
27
+ evaluateUnary: (t, n = {}) => s(t, () => e.evaluateUnaryExpression(t, n)),
28
+ validate: (t) => e.validateExpression(t),
29
+ validateUnary: (t) => e.validateUnaryExpression(t),
30
+ getCompletions: () => e.getCompletions(),
31
+ analyze: (t, n, r) => {
32
+ let i = e.VariableType.fromJson(t);
33
+ try {
34
+ let e = i.toJson(), t = r ? i.typeCheckUnary(n) : i.typeCheck(n);
35
+ return {
36
+ rootKind: e,
37
+ spans: Array.isArray(t) ? t : []
38
+ };
39
+ } finally {
40
+ i.free();
41
+ }
42
+ },
43
+ satisfies: (t, n) => {
44
+ let r = e.VariableType.fromJson(t), i = e.VariableType.fromJson(n);
45
+ try {
46
+ return r.satisfies(i);
47
+ } finally {
48
+ r.free(), i.free();
49
+ }
50
+ },
51
+ isReady: () => e.isReady()
52
+ });
53
+ return i = t, t;
54
+ })().catch((t) => {
55
+ throw r = null, a = new e(c(), void 0, t), a;
56
+ }), r);
57
+ }
58
+ function d() {
59
+ return i?.isReady() ?? !1;
60
+ }
61
+ function f() {
62
+ return a;
63
+ }
64
+ function p() {
65
+ if (!i) throw new t();
66
+ return i;
67
+ }
68
+ //#endregion
69
+ export { l as configureEngine, f as getEngineError, p as getEngineSync, d as isEngineReady, u as loadEngine };
@@ -0,0 +1,122 @@
1
+ /*! @vef-framework-react/expression v2.4.0 made by Venus | 2026-06-15T15:10:07.346Z */
2
+ //#region src/engine/messages.ts
3
+ var e = "en-US";
4
+ function t(t) {
5
+ e = t;
6
+ }
7
+ function n() {
8
+ return e;
9
+ }
10
+ var r = {
11
+ "Returns the length of variable": "返回变量的长度",
12
+ "Checks if variable contains a needle": "检查变量是否包含指定元素",
13
+ "Flattens an array": "将数组扁平化",
14
+ "Merges multiple objects into one.": "将多个对象合并为一个。",
15
+ "Deeply merges multiple objects into one.": "将多个对象深度合并为一个。",
16
+ "Converts all characters in a string to uppercase": "将字符串中所有字符转换为大写",
17
+ "Converts all characters in a string to lowercase": "将字符串中所有字符转换为小写",
18
+ "Returns the string with leading and trailing whitespace removed": "返回去除首尾空白后的字符串",
19
+ "Returns true if the string starts with the specified prefix": "若字符串以指定前缀开头则返回 true",
20
+ "Returns true if the string ends with the specified suffix": "若字符串以指定后缀结尾则返回 true",
21
+ "Returns true if the string matches the specified pattern": "若字符串匹配指定模式则返回 true",
22
+ "Extracts matching substrings according to a pattern": "按模式提取匹配的子串",
23
+ "Performs a fuzzy search of the needle in the haystack, and returns the match score(s).": "在目标中对关键字进行模糊搜索,并返回匹配得分。",
24
+ "Splits a string into an array of substrings using the specified delimiter.": "使用指定分隔符将字符串拆分为子串数组。",
25
+ "Returns the absolute value of a number": "返回数字的绝对值",
26
+ "Returns the sum of all elements in the input array.": "返回输入数组中所有元素之和。",
27
+ "Calculates the average of all elements in the input array.": "计算输入数组中所有元素的平均值。",
28
+ "Returns the smallest of the elements in the input array.": "返回输入数组中的最小元素。",
29
+ "Returns the largest of the elements in the input array.": "返回输入数组中的最大元素。",
30
+ "Generates a random number between 0 (inclusive) and max (inclusive).": "生成 0 到 max(均包含)之间的随机数。",
31
+ "Calculates the median value of all elements in the input array.": "计算输入数组中所有元素的中位数。",
32
+ "Finds the mode(s) of the input array, which are the most frequent element(s).": "求输入数组的众数,即出现最频繁的元素。",
33
+ "Rounds a number down to the nearest integer.": "向下取整到最接近的整数。",
34
+ "Rounds a number up to the nearest integer.": "向上取整到最接近的整数。",
35
+ "Rounds a number to a specified number of decimal places.": "将数字四舍五入到指定的小数位数。",
36
+ "Truncates a number to a specified number of decimal places.": "将数字截断到指定的小数位数。",
37
+ "Checks if the given value is of a numeric type.": "检查给定值是否为数值类型。",
38
+ "Converts the given value to a string.": "将给定值转换为字符串。",
39
+ "Converts the given value to a number.": "将给定值转换为数字。",
40
+ "Converts the given value to a boolean.": "将给定值转换为布尔值。",
41
+ "Returns a string representing the data type of the value.": "返回表示该值数据类型的字符串。",
42
+ "Returns an array of a given object's own enumerable property names.": "返回由给定对象自身可枚举属性名组成的数组。",
43
+ "Returns an array of a given object's own enumerable property values.": "返回由给定对象自身可枚举属性值组成的数组。",
44
+ "Returns a new date time instance.": "返回一个新的日期时间实例。",
45
+ "Converts a numeric timestamp to a unix timestamp.": "将数值时间戳转换为 Unix 时间戳。",
46
+ "Extracts the time from a numeric timestamp and returns it as a seconds from beginning of day.": "从数值时间戳中提取时间,以当天起始的秒数返回。",
47
+ "e.g. 1h30min": "例如 1h30min",
48
+ "Extracts the year from a given timestamp.": "从给定时间戳中提取年份。",
49
+ "Gets the day of the week from a given timestamp, where Sunday might be 0.": "获取给定时间戳的星期几(周日可能为 0)。",
50
+ "Extracts the day of the month from a given timestamp.": "从给定时间戳中提取当月的日期。",
51
+ "Gets the day of the year from a given timestamp.": "获取给定时间戳在一年中的第几天。",
52
+ "Calculates the week of the year from a given timestamp.": "计算给定时间戳在一年中的第几周。",
53
+ "Extracts the month from a given timestamp, typically with January as 1.": "从给定时间戳中提取月份(通常 1 月为 1)。",
54
+ "Converts the month from a given timestamp into its string representation (e.g., 'Jan').": "将给定时间戳的月份转换为字符串表示(例如 'Jan')。",
55
+ "Converts a timestamp to a human-readable date string.": "将时间戳转换为人类可读的日期字符串。",
56
+ "Converts the day of the week from a given timestamp into its string representation (e.g., 'Mon').": "将给定时间戳的星期几转换为字符串表示(例如 'Mon')。",
57
+ "Returns the timestamp representing the start of a specified unit (e.g., day, month, year) based on a given timestamp.": "返回给定时间戳在指定单位(如日、月、年)起始处的时间戳。",
58
+ "Returns the timestamp representing the end of a specified unit (e.g., day, month, year) based on a given timestamp.": "返回给定时间戳在指定单位(如日、月、年)结束处的时间戳。",
59
+ "Checks if all elements in the array satisfy the condition defined in the callback.": "检查数组中所有元素是否都满足回调中定义的条件。",
60
+ "Checks if no elements in the array satisfy the condition defined in the callback.": "检查数组中是否没有任何元素满足回调中定义的条件。",
61
+ "Checks if at least one element in the array satisfies the condition defined in the callback.": "检查数组中是否至少有一个元素满足回调中定义的条件。",
62
+ "Checks if exactly one element in the array satisfies the condition defined in the callback.": "检查数组中是否恰好有一个元素满足回调中定义的条件。",
63
+ "Creates a new array with all elements that satisfy the condition defined in the callback.": "创建一个仅包含满足回调中定义条件的元素的新数组。",
64
+ "Creates a new array populated with the results of calling the provided function on every element in the calling array.": "创建一个新数组,其元素为对原数组每个元素调用所提供函数的结果。",
65
+ "First maps each element using a mapping function, then flattens the result into a new array.": "先用映射函数处理每个元素,再将结果扁平化为新数组。",
66
+ "Counts the number of elements in the array that satisfy the condition defined in the callback.": "统计数组中满足回调中定义条件的元素个数。",
67
+ "Adds time to a date": "为日期增加时间",
68
+ "Subtracts time from a date": "从日期中减去时间",
69
+ "Sets a specific unit of time on a date": "设置日期的某个时间单位",
70
+ "Formats a date into a string representation": "将日期格式化为字符串",
71
+ "Returns the start of a specified time unit for a date": "返回日期在指定时间单位上的起始",
72
+ "Returns the end of a specified time unit for a date": "返回日期在指定时间单位上的结束",
73
+ "Calculates the difference between two dates": "计算两个日期之间的差值",
74
+ "Converts a date to a different timezone": "将日期转换到不同的时区",
75
+ "Checks if two dates are the same": "检查两个日期是否相同",
76
+ "Checks if a date is before another date": "检查日期是否早于另一个日期",
77
+ "Checks if a date is after another date": "检查日期是否晚于另一个日期",
78
+ "Checks if a date is the same as or before another date": "检查日期是否等于或早于另一个日期",
79
+ "Checks if a date is the same as or after another date": "检查日期是否等于或晚于另一个日期",
80
+ "Gets the seconds of a date": "获取日期的秒",
81
+ "Gets the minutes of a date": "获取日期的分钟",
82
+ "Gets the hours of a date": "获取日期的小时",
83
+ "Gets the day of the month for a date": "获取日期在当月的第几天",
84
+ "Gets the day of the year for a date": "获取日期在当年的第几天",
85
+ "Gets the week of the year for a date": "获取日期在当年的第几周",
86
+ "Gets the day of the week for a date": "获取日期的星期几",
87
+ "Gets the month for a date": "获取日期的月份",
88
+ "Gets the quarter for a date": "获取日期所在的季度",
89
+ "Gets the year for a date": "获取日期的年份",
90
+ "Gets the Unix timestamp for a date": "获取日期的 Unix 时间戳",
91
+ "Gets the timezone offset name for a date": "获取日期的时区偏移名称",
92
+ "Checks if a date is valid": "检查日期是否有效",
93
+ "Checks if a date is yesterday": "检查日期是否为昨天",
94
+ "Checks if a date is today": "检查日期是否为今天",
95
+ "Checks if a date is tomorrow": "检查日期是否为明天",
96
+ "Checks if the year of a date is a leap year": "检查日期所在年份是否为闰年"
97
+ };
98
+ function i(t) {
99
+ return e !== "zh-CN" || t === "" ? t : r[t] ?? t;
100
+ }
101
+ var a = {
102
+ "en-US": {
103
+ lexerError: "Lexer error",
104
+ parserError: "Parser error",
105
+ compilerError: "Compiler error",
106
+ vmError: "VM error",
107
+ fallback: "Error"
108
+ },
109
+ "zh-CN": {
110
+ lexerError: "词法错误",
111
+ parserError: "语法错误",
112
+ compilerError: "编译错误",
113
+ vmError: "运行时错误",
114
+ fallback: "错误"
115
+ }
116
+ };
117
+ function o(t) {
118
+ let n = a[e];
119
+ return (t === void 0 ? void 0 : n[t]) ?? n.fallback;
120
+ }
121
+ //#endregion
122
+ export { n as getExpressionLocale, i as localizeCompletionInfo, o as localizeSourceLabel, t as setExpressionLocale };
@@ -0,0 +1,9 @@
1
+ /*! @vef-framework-react/expression v2.4.0 made by Venus | 2026-06-15T15:10:07.346Z */
2
+ import { ExpressionError as e, ExpressionNotReadyError as t } from "./engine/errors.js";
3
+ import { configureEngine as n, getEngineError as r, getEngineSync as i, isEngineReady as a, loadEngine as o } from "./engine/loader.js";
4
+ import { compileBranch as s, compileCondition as c, compileGroup as l, selectBranch as u, selectBranchWith as d, toZenLiteral as f } from "./condition/compile.js";
5
+ import { CONDITION_OPERATORS as p } from "./condition/types.js";
6
+ import { evaluate as m, evaluateSync as h, evaluateUnary as g, evaluateUnarySync as _, getCompletions as v, validate as y, validateUnary as b } from "./engine/evaluate.js";
7
+ import { getExpressionLocale as x, setExpressionLocale as S } from "./engine/messages.js";
8
+ import { analyzeTypes as C, analyzeTypesSync as w, getCompletionItems as T, getCompletionItemsSync as E, getDiagnostics as D, getDiagnosticsSync as O, satisfiesType as k, satisfiesTypeSync as A } from "./engine/intellisense.js";
9
+ export { p as CONDITION_OPERATORS, e as ExpressionError, t as ExpressionNotReadyError, C as analyzeTypes, w as analyzeTypesSync, s as compileBranch, c as compileCondition, l as compileGroup, n as configureEngine, m as evaluate, h as evaluateSync, g as evaluateUnary, _ as evaluateUnarySync, T as getCompletionItems, E as getCompletionItemsSync, v as getCompletions, D as getDiagnostics, O as getDiagnosticsSync, r as getEngineError, i as getEngineSync, x as getExpressionLocale, a as isEngineReady, o as loadEngine, k as satisfiesType, A as satisfiesTypeSync, u as selectBranch, d as selectBranchWith, S as setExpressionLocale, f as toZenLiteral, y as validate, b as validateUnary };
@@ -0,0 +1,6 @@
1
+ /*! @vef-framework-react/expression v2.4.0 made by Venus | 2026-06-15T15:10:07.346Z */
2
+ import { createContext as e } from "react";
3
+ //#region src/react/context.ts
4
+ var t = e(null);
5
+ //#endregion
6
+ export { t as ExpressionEngineContext };
@@ -0,0 +1,4 @@
1
+ /*! @vef-framework-react/expression v2.4.0 made by Venus | 2026-06-15T15:10:07.346Z */
2
+ import { ExpressionEngineProvider as e } from "./provider.js";
3
+ import { useExpressionEngine as t } from "./use-expression-engine.js";
4
+ export { e as ExpressionEngineProvider, t as useExpressionEngine };
@@ -0,0 +1,20 @@
1
+ /*! @vef-framework-react/expression v2.4.0 made by Venus | 2026-06-15T15:10:07.346Z */
2
+ import { getEngineError as e, getEngineSync as t, isEngineReady as n, loadEngine as r } from "../engine/loader.js";
3
+ import { setExpressionLocale as i } from "../engine/messages.js";
4
+ import { ExpressionEngineContext as a } from "./context.js";
5
+ import { Suspense as o } from "react";
6
+ import { jsx as s } from "react/jsx-runtime";
7
+ //#region src/react/provider.tsx
8
+ function c({ children: i }) {
9
+ if (!n()) throw e() || r();
10
+ return /* @__PURE__ */ s(a, {
11
+ value: t(),
12
+ children: i
13
+ });
14
+ }
15
+ var l = ({ children: e, fallback: t = null, locale: n }) => (n !== void 0 && i(n), /* @__PURE__ */ s(o, {
16
+ fallback: t,
17
+ children: /* @__PURE__ */ s(c, { children: e })
18
+ }));
19
+ //#endregion
20
+ export { l as ExpressionEngineProvider };
@@ -0,0 +1,11 @@
1
+ /*! @vef-framework-react/expression v2.4.0 made by Venus | 2026-06-15T15:10:07.346Z */
2
+ import { ExpressionEngineContext as e } from "./context.js";
3
+ import { use as t } from "react";
4
+ //#region src/react/use-expression-engine.ts
5
+ function n() {
6
+ let n = t(e);
7
+ if (!n) throw Error("useExpressionEngine must be used within <ExpressionEngineProvider>.");
8
+ return n;
9
+ }
10
+ //#endregion
11
+ export { n as useExpressionEngine };
@@ -0,0 +1,49 @@
1
+ import { ExpressionContext, ExpressionEngine } from '../engine/loader';
2
+ import { BranchSelection, ConditionBranchInput, ConditionGroupInput, ConditionInput } from './types';
3
+ /**
4
+ * Serialize a JavaScript value into a ZEN literal. Nullish becomes `null`;
5
+ * numbers / booleans / bigints are emitted verbatim; strings are quoted via
6
+ * {@link encodeZenString}; arrays become `[a, b, ...]`.
7
+ *
8
+ * Throws {@link ExpressionError} for a value with no faithful ZEN
9
+ * representation — an object, symbol, or function, or a string containing both
10
+ * quote styles. Callers that need a sentinel instead of a throw go through
11
+ * {@link compileCondition}, which degrades such a value to a non-compiling
12
+ * (null) condition.
13
+ */
14
+ export declare function toZenLiteral(value: unknown): string;
15
+ /**
16
+ * Compile a single condition into a ZEN boolean expression. Field conditions map
17
+ * their operator to ZEN; expression conditions pass through verbatim. Returns
18
+ * `null` when the condition is empty, its subject is not an identifier path, or
19
+ * its value has no ZEN representation.
20
+ */
21
+ export declare function compileCondition(condition: ConditionInput): string | null;
22
+ /**
23
+ * Compile a condition group (its conditions joined with AND). Returns `null`
24
+ * when the group has no compilable conditions.
25
+ */
26
+ export declare function compileGroup(group: ConditionGroupInput): string | null;
27
+ /**
28
+ * Compile a branch's condition groups into a single ZEN expression (groups
29
+ * joined with OR). Returns `null` when the branch has no compilable groups
30
+ * (e.g. a default branch).
31
+ */
32
+ export declare function compileBranch(branch: ConditionBranchInput): string | null;
33
+ /**
34
+ * Pick the matching branch for the given context using a pre-loaded engine.
35
+ * Non-default branches are tested in ascending `priority` order; the first whose
36
+ * compiled expression evaluates to `true` wins. Falls back to the default
37
+ * branch, or a `null` id when neither matches.
38
+ *
39
+ * A branch whose expression throws for the given context (e.g. ZEN's `>`
40
+ * throws when the subject is missing or non-numeric) is treated as not matching
41
+ * rather than propagating — so a missing field degrades to the default branch
42
+ * instead of crashing the caller.
43
+ */
44
+ export declare function selectBranchWith(branches: ConditionBranchInput[], context: ExpressionContext, engine: Pick<ExpressionEngine, "evaluate" | "validate">): BranchSelection;
45
+ /**
46
+ * Pick the matching branch for the given context, loading the ZEN engine on
47
+ * first use. See {@link selectBranchWith} for the selection semantics.
48
+ */
49
+ export declare function selectBranch(branches: ConditionBranchInput[], context: ExpressionContext): Promise<BranchSelection>;
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Structural shapes for the visual condition model compiled to ZEN. They mirror
3
+ * the condition types used in the form and flow editors so a host can map those
4
+ * definitions to {@link compileCondition} / {@link selectBranch} without this
5
+ * package depending on either editor. The editors keep a flat working model for
6
+ * form ergonomics (a row can hold both a half-typed field triple and an
7
+ * expression while the author toggles between them); this discriminated input is
8
+ * the narrowed, compiler-facing shape where each kind carries only what it uses.
9
+ */
10
+ /**
11
+ * The closed operator vocabulary understood by {@link compileCondition}, as a
12
+ * runtime constant so validators can build allow-lists from it instead of
13
+ * re-declaring the set. The {@link ConditionOperator} type derives from this
14
+ * array — one definition site for both the type and the runtime list.
15
+ */
16
+ export declare const CONDITION_OPERATORS: readonly ["eq", "ne", "gt", "gte", "lt", "lte", "contains", "not_contains", "starts_with", "ends_with", "in", "not_in", "is_empty", "is_not_empty"];
17
+ /**
18
+ * Operators understood by {@link compileCondition}. The compiler maps each to a
19
+ * ZEN expression; this closed set is the single source of truth for the operator
20
+ * vocabulary (the flow editor shares it instead of re-declaring its own).
21
+ */
22
+ export type ConditionOperator = typeof CONDITION_OPERATORS[number];
23
+ /**
24
+ * A field/operator/value condition.
25
+ */
26
+ export interface FieldConditionInput {
27
+ kind: "field";
28
+ /**
29
+ * The field path the operator tests. Emitted **verbatim** into the compiled
30
+ * ZEN source as a path expression (guarded by an identifier-path pattern),
31
+ * unlike `value`, which is serialized to a ZEN literal — so callers must supply
32
+ * a valid identifier path, not arbitrary user text.
33
+ */
34
+ subject: string;
35
+ operator: ConditionOperator;
36
+ value: unknown;
37
+ }
38
+ /**
39
+ * A raw ZEN expression condition, passed through to the engine verbatim.
40
+ */
41
+ export interface ExpressionConditionInput {
42
+ kind: "expression";
43
+ expression: string;
44
+ }
45
+ /**
46
+ * A single condition: either a field/operator/value triple or a raw expression.
47
+ */
48
+ export type ConditionInput = FieldConditionInput | ExpressionConditionInput;
49
+ /**
50
+ * A group of conditions, combined with AND.
51
+ */
52
+ export interface ConditionGroupInput {
53
+ conditions: ConditionInput[];
54
+ }
55
+ /**
56
+ * A branch guarded by one or more condition groups (combined with OR).
57
+ */
58
+ export interface ConditionBranchInput {
59
+ id: string;
60
+ priority: number;
61
+ isDefault?: boolean;
62
+ conditionGroups?: ConditionGroupInput[];
63
+ }
64
+ /**
65
+ * The branch chosen by {@link selectBranch}. `matched` is true only when a
66
+ * non-default branch's expression evaluated true (then `branchId` is that
67
+ * branch's id). On the default-branch fallback `matched` is false while
68
+ * `branchId` is the default's id; `branchId` is null only when nothing matched
69
+ * and there is no default branch.
70
+ */
71
+ export type BranchSelection = {
72
+ matched: true;
73
+ branchId: string;
74
+ } | {
75
+ matched: false;
76
+ branchId: string | null;
77
+ };
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Error raised when the ZEN engine fails to load or an expression cannot be
3
+ * evaluated. The original failure is preserved on {@link cause} and the
4
+ * offending expression (if any) on {@link expression}.
5
+ */
6
+ export declare class ExpressionError extends Error {
7
+ readonly expression?: string;
8
+ constructor(message: string, expression?: string, cause?: unknown);
9
+ }
10
+ /**
11
+ * Raised by the synchronous evaluation helpers when the engine has not finished
12
+ * initializing yet. Await {@link loadEngine} (or render under
13
+ * `<ExpressionEngineProvider>`) before evaluating synchronously.
14
+ */
15
+ export declare class ExpressionNotReadyError extends ExpressionError {
16
+ constructor(message?: string);
17
+ }
@@ -0,0 +1,36 @@
1
+ import { ExpressionContext } from './loader';
2
+ /**
3
+ * Evaluate a standard ZEN expression, loading the engine on first use.
4
+ *
5
+ * `T` is an **unchecked** assertion — the value is returned as `T` with no
6
+ * runtime validation, and ZEN's result type depends on the expression and
7
+ * context. Prefer the `unknown` default and narrow at the call site.
8
+ */
9
+ export declare function evaluate<T = unknown>(expression: string, context?: ExpressionContext): Promise<T>;
10
+ /**
11
+ * Evaluate a ZEN unary (test) expression, loading the engine on first use.
12
+ */
13
+ export declare function evaluateUnary(expression: string, context?: ExpressionContext): Promise<boolean>;
14
+ /**
15
+ * Evaluate a standard ZEN expression synchronously. Throws
16
+ * {@link ExpressionNotReadyError} when the engine has not loaded yet — use this
17
+ * only behind a readiness gate (e.g. under `<ExpressionEngineProvider>`).
18
+ */
19
+ export declare function evaluateSync<T = unknown>(expression: string, context?: ExpressionContext): T;
20
+ /**
21
+ * Evaluate a ZEN unary (test) expression synchronously. Throws
22
+ * {@link ExpressionNotReadyError} when the engine has not loaded yet.
23
+ */
24
+ export declare function evaluateUnarySync(expression: string, context?: ExpressionContext): boolean;
25
+ /**
26
+ * Validate a standard expression, loading the engine on first use.
27
+ */
28
+ export declare function validate(expression: string): Promise<unknown>;
29
+ /**
30
+ * Validate a unary expression, loading the engine on first use.
31
+ */
32
+ export declare function validateUnary(expression: string): Promise<unknown>;
33
+ /**
34
+ * Return ZEN completion metadata, loading the engine on first use.
35
+ */
36
+ export declare function getCompletions(): Promise<unknown>;
@@ -0,0 +1,123 @@
1
+ import { VariableTypeJson } from '@gorules/zen-engine-wasm';
2
+ /**
3
+ * Whether an expression is a standard value expression or a unary (test) expression.
4
+ */
5
+ export type ExpressionMode = "standard" | "unary";
6
+ /**
7
+ * A ZEN type descriptor — the shape the engine understands for type-aware
8
+ * completion and validation. Structurally identical to the wasm
9
+ * `VariableTypeJson`: a primitive (`"String"`, `"Number"`, `"Bool"`, ...) or one
10
+ * of `{ Object }`, `{ Array }`, `{ Const }`, `{ Enum }`.
11
+ */
12
+ export type ExpressionType = VariableTypeJson;
13
+ /**
14
+ * A single syntax / type diagnostic, positioned by character offset.
15
+ */
16
+ export interface ExpressionDiagnostic {
17
+ /**
18
+ * Start offset in the source.
19
+ */
20
+ from: number;
21
+ /**
22
+ * End offset in the source.
23
+ */
24
+ to: number;
25
+ /**
26
+ * Human-readable error message.
27
+ */
28
+ message: string;
29
+ /**
30
+ * Diagnostic origin label (e.g. `"Parser error"`).
31
+ */
32
+ source: string;
33
+ }
34
+ /**
35
+ * An autocomplete suggestion for a ZEN built-in (function / method / variable).
36
+ */
37
+ export interface ExpressionCompletion {
38
+ type: "function" | "method" | "variable";
39
+ label: string;
40
+ detail: string;
41
+ info: string;
42
+ boost: number | null;
43
+ /**
44
+ * For methods, the type-kind they attach to (e.g. `"Date"`); otherwise `null`.
45
+ */
46
+ methodFor: string | null;
47
+ }
48
+ /**
49
+ * The inferred type of one span of the source, produced by type-checking.
50
+ */
51
+ export interface ExpressionTypeSpan {
52
+ error: string | null;
53
+ kind: ExpressionType;
54
+ nodeKind: string;
55
+ span: [number, number];
56
+ }
57
+ /**
58
+ * The result of type-checking an expression against a variable context.
59
+ */
60
+ export interface ExpressionAnalysis {
61
+ /**
62
+ * The root context type (the variables object).
63
+ */
64
+ rootKind: ExpressionType;
65
+ /**
66
+ * Per-span inferred types; `spans[0]` is the whole-expression result type.
67
+ */
68
+ spans: ExpressionTypeSpan[];
69
+ }
70
+ /**
71
+ * Parse a trailing `... at (from, to)` / `... at pos` position out of a ZEN error
72
+ * message. Returns a `[from, to]` range, a single offset, or `null` when absent.
73
+ */
74
+ export declare function extractPosition(message: string): [number, number] | number | null;
75
+ /**
76
+ * Normalize the wasm validate payload (`null` or `{ type, source }`) into a
77
+ * positioned {@link ExpressionDiagnostic}, or `null` when the expression is valid.
78
+ */
79
+ export declare function normalizeDiagnostic(raw: unknown, source: string): ExpressionDiagnostic | null;
80
+ /**
81
+ * Normalize the wasm `getCompletions` payload into a typed list, dropping
82
+ * malformed entries and stripping the backtick markers ZEN wraps type names in.
83
+ */
84
+ export declare function normalizeCompletions(raw: unknown): ExpressionCompletion[];
85
+ /**
86
+ * Validate an expression, loading the engine on first use. Resolves to `null`
87
+ * when the expression is valid, or a positioned diagnostic otherwise.
88
+ */
89
+ export declare function getDiagnostics(expression: string, mode: ExpressionMode): Promise<ExpressionDiagnostic | null>;
90
+ /**
91
+ * Synchronous {@link getDiagnostics}. Throws `ExpressionNotReadyError` if the
92
+ * engine has not loaded yet — use only behind a readiness gate.
93
+ */
94
+ export declare function getDiagnosticsSync(expression: string, mode: ExpressionMode): ExpressionDiagnostic | null;
95
+ /**
96
+ * Return the ZEN built-in completion list, loading the engine on first use.
97
+ */
98
+ export declare function getCompletionItems(): Promise<ExpressionCompletion[]>;
99
+ /**
100
+ * Synchronous {@link getCompletionItems}. Throws `ExpressionNotReadyError` if the
101
+ * engine has not loaded yet.
102
+ */
103
+ export declare function getCompletionItemsSync(): ExpressionCompletion[];
104
+ /**
105
+ * Type-check an expression against a `variables` context, loading the engine on
106
+ * first use. See {@link ExpressionAnalysis}.
107
+ */
108
+ export declare function analyzeTypes(variables: ExpressionType, source: string, mode: ExpressionMode): Promise<ExpressionAnalysis>;
109
+ /**
110
+ * Synchronous {@link analyzeTypes}. Throws `ExpressionNotReadyError` if the
111
+ * engine has not loaded yet.
112
+ */
113
+ export declare function analyzeTypesSync(variables: ExpressionType, source: string, mode: ExpressionMode): ExpressionAnalysis;
114
+ /**
115
+ * Whether `actual` satisfies (is assignable to) `expected`, loading the engine on
116
+ * first use. Used for expected-return-type validation.
117
+ */
118
+ export declare function satisfiesType(actual: ExpressionType, expected: ExpressionType): Promise<boolean>;
119
+ /**
120
+ * Synchronous {@link satisfiesType}. Throws `ExpressionNotReadyError` if the
121
+ * engine has not loaded yet.
122
+ */
123
+ export declare function satisfiesTypeSync(actual: ExpressionType, expected: ExpressionType): boolean;
@@ -0,0 +1,102 @@
1
+ import { InitInput } from '@gorules/zen-engine-wasm';
2
+ import { ExpressionAnalysis, ExpressionType } from './intellisense';
3
+ import { ExpressionError } from './errors';
4
+ /**
5
+ * The data an expression reads from. Property paths in the expression (e.g.
6
+ * `customer.name`) resolve against this object.
7
+ */
8
+ export type ExpressionContext = Record<string, unknown>;
9
+ export interface LoadEngineOptions {
10
+ /**
11
+ * Override how the wasm binary is located. By default the engine resolves the
12
+ * co-located `.wasm` through the GoRules package's own `import.meta.url`,
13
+ * which the host bundler (Vite / webpack) rewrites to a served asset URL — no
14
+ * option is needed in normal browser app setups. Supply a URL / Response /
15
+ * bytes for exotic hosting (CDN, embedded buffer) or for a non-browser host
16
+ * (Node / SSR), where `import.meta.url` asset resolution does not work and the
17
+ * input must be provided explicitly. Aliased to the wasm initializer's own
18
+ * `InitInput` so it never drifts from the dependency.
19
+ */
20
+ wasmInput?: InitInput;
21
+ }
22
+ /**
23
+ * The initialized ZEN expression engine. Every method is synchronous — obtain
24
+ * an instance via {@link loadEngine} (async, loads the wasm) before calling.
25
+ */
26
+ export interface ExpressionEngine {
27
+ /**
28
+ * Evaluate a standard ZEN expression, returning its computed value.
29
+ */
30
+ evaluate: <T = unknown>(expression: string, context?: ExpressionContext) => T;
31
+ /**
32
+ * Evaluate a ZEN unary (test) expression, returning a boolean.
33
+ */
34
+ evaluateUnary: (expression: string, context?: ExpressionContext) => boolean;
35
+ /**
36
+ * Validate a standard expression; returns ZEN's diagnostic payload (`null`
37
+ * when the expression parses, an error object otherwise).
38
+ */
39
+ validate: (expression: string) => unknown;
40
+ /**
41
+ * Validate a unary expression; returns ZEN's diagnostic payload.
42
+ */
43
+ validateUnary: (expression: string) => unknown;
44
+ /**
45
+ * Return ZEN's completion metadata, for building an expression editor.
46
+ */
47
+ getCompletions: () => unknown;
48
+ /**
49
+ * Type-check `source` against a `variables` context, returning the root context
50
+ * type and the inferred type of every span (`unary` selects test-expression
51
+ * checking). Powers an editor's type-aware completion / hover / diagnostics.
52
+ */
53
+ analyze: (variables: ExpressionType, source: string, unary: boolean) => ExpressionAnalysis;
54
+ /**
55
+ * Whether `actual` satisfies (is assignable to) `expected`. Powers
56
+ * expected-return-type validation in an editor.
57
+ */
58
+ satisfies: (actual: ExpressionType, expected: ExpressionType) => boolean;
59
+ /**
60
+ * Whether the underlying wasm module reports itself ready.
61
+ */
62
+ isReady: () => boolean;
63
+ }
64
+ /**
65
+ * Configure how the wasm binary is located, before the engine loads. Must be
66
+ * called before the first {@link loadEngine} (or any evaluation), so that the
67
+ * configured input is the one actually used — calling it after the engine has
68
+ * started loading throws, rather than silently taking no effect.
69
+ */
70
+ export declare function configureEngine(options: LoadEngineOptions): void;
71
+ /**
72
+ * Load and initialize the ZEN expression engine exactly once. Concurrent and
73
+ * subsequent calls share the same in-flight promise / resolved instance. Set a
74
+ * custom wasm source up front with {@link configureEngine}.
75
+ *
76
+ * The GoRules wasm dependency is reached via a dynamic `import()` on purpose: it
77
+ * keeps this module usable from the package's CommonJS build (the dep is
78
+ * ESM-only, so a static `require` would throw) and defers the multi-megabyte
79
+ * wasm download until the engine is actually needed. Do NOT convert this to a
80
+ * static import.
81
+ */
82
+ export declare function loadEngine(): Promise<ExpressionEngine>;
83
+ /**
84
+ * Whether the engine has finished initializing and is ready for sync use.
85
+ */
86
+ export declare function isEngineReady(): boolean;
87
+ /**
88
+ * The error from the last failed {@link loadEngine} attempt, or `null`. Used by
89
+ * the React provider to surface a wasm-load failure to an error boundary rather
90
+ * than suspending forever, and by imperative pollers to tell "failed" apart from
91
+ * "still loading". Cleared when a new load starts or {@link resetEngine}.
92
+ */
93
+ export declare function getEngineError(): ExpressionError | null;
94
+ /**
95
+ * Return the already-initialized engine synchronously, or throw
96
+ * {@link ExpressionNotReadyError} if {@link loadEngine} has not resolved yet.
97
+ */
98
+ export declare function getEngineSync(): ExpressionEngine;
99
+ /**
100
+ * Reset the singleton. Intended for tests only.
101
+ */
102
+ export declare function resetEngine(): void;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * The display language for engine-produced text (built-in descriptions and
3
+ * diagnostic labels). Defaults to `"en-US"`; a host opts into Chinese with
4
+ * {@link setExpressionLocale}. Identifiers, type signatures and the wasm's own
5
+ * error message bodies are never translated — only descriptive prose is.
6
+ */
7
+ export type ExpressionLocale = "en-US" | "zh-CN";
8
+ /**
9
+ * Set the active locale for engine-produced descriptive text. Module-global (the
10
+ * sync editor accessors read it without a React context), mirroring the engine
11
+ * singleton itself. Defaults to `"en-US"` so published consumers are unaffected.
12
+ */
13
+ export declare function setExpressionLocale(locale: ExpressionLocale): void;
14
+ /**
15
+ * The active locale set by {@link setExpressionLocale}.
16
+ */
17
+ export declare function getExpressionLocale(): ExpressionLocale;
18
+ /**
19
+ * Translate a built-in's English `info` description to the active locale, or
20
+ * return it unchanged when the locale is English, the description is empty, or no
21
+ * translation exists.
22
+ */
23
+ export declare function localizeCompletionInfo(info: string): string;
24
+ /**
25
+ * The localized diagnostic origin label for a wasm error `type`
26
+ * (`"parserError"` → `"语法错误"`), or the locale's fallback label.
27
+ */
28
+ export declare function localizeSourceLabel(type?: string): string;
@@ -0,0 +1,7 @@
1
+ export { compileBranch, compileCondition, compileGroup, selectBranch, selectBranchWith, toZenLiteral } from './condition/compile';
2
+ export { CONDITION_OPERATORS, type BranchSelection, type ConditionBranchInput, type ConditionGroupInput, type ConditionInput, type ConditionOperator, type ExpressionConditionInput, type FieldConditionInput } from './condition/types';
3
+ export { ExpressionError, ExpressionNotReadyError } from './engine/errors';
4
+ export { evaluate, evaluateSync, evaluateUnary, evaluateUnarySync, getCompletions, validate, validateUnary } from './engine/evaluate';
5
+ export { analyzeTypes, analyzeTypesSync, getCompletionItems, getCompletionItemsSync, getDiagnostics, getDiagnosticsSync, satisfiesType, satisfiesTypeSync, type ExpressionAnalysis, type ExpressionCompletion, type ExpressionDiagnostic, type ExpressionMode, type ExpressionType, type ExpressionTypeSpan } from './engine/intellisense';
6
+ export { configureEngine, getEngineError, getEngineSync, isEngineReady, loadEngine, type ExpressionContext, type ExpressionEngine, type LoadEngineOptions } from './engine/loader';
7
+ export { getExpressionLocale, setExpressionLocale, type ExpressionLocale } from './engine/messages';
@@ -0,0 +1,3 @@
1
+ import { ExpressionEngine } from '../engine/loader';
2
+ import { Context } from 'react';
3
+ export declare const ExpressionEngineContext: Context<ExpressionEngine | null>;
@@ -0,0 +1,2 @@
1
+ export { ExpressionEngineProvider, type ExpressionEngineProviderProps } from './provider';
2
+ export { useExpressionEngine } from './use-expression-engine';
@@ -0,0 +1,23 @@
1
+ import { FC, ReactNode } from 'react';
2
+ import { ExpressionLocale } from '../engine/messages';
3
+ export interface ExpressionEngineProviderProps {
4
+ children: ReactNode;
5
+ /**
6
+ * Shown while the wasm engine is loading. Children do not render — and thus no
7
+ * synchronous evaluation runs — until the engine is ready, so anything inside
8
+ * can rely on the engine being initialized.
9
+ */
10
+ fallback?: ReactNode;
11
+ /**
12
+ * Language for engine-produced descriptive text (built-in descriptions and
13
+ * diagnostic labels). Omitted leaves the module default (`"en-US"`) untouched.
14
+ * Equivalent to calling {@link setExpressionLocale} — provided here for hosts
15
+ * that already wrap their tree in this provider.
16
+ */
17
+ locale?: ExpressionLocale;
18
+ }
19
+ /**
20
+ * Loads the ZEN engine and gates its subtree behind `<Suspense>` until the wasm
21
+ * is initialized. Descendants read the engine via {@link useExpressionEngine}.
22
+ */
23
+ export declare const ExpressionEngineProvider: FC<ExpressionEngineProviderProps>;
@@ -0,0 +1,7 @@
1
+ import { ExpressionEngine } from '../engine/loader';
2
+ /**
3
+ * Return the initialized {@link ExpressionEngine}. Must be rendered under
4
+ * `<ExpressionEngineProvider>`, which suspends until the wasm engine is ready —
5
+ * so the returned engine is always safe to evaluate against synchronously.
6
+ */
7
+ export declare function useExpressionEngine(): ExpressionEngine;
package/package.json ADDED
@@ -0,0 +1,81 @@
1
+ {
2
+ "name": "@vef-framework-react/expression",
3
+ "type": "module",
4
+ "version": "2.4.0",
5
+ "private": false,
6
+ "description": "Frontend abstraction over the GoRules ZEN expression engine (WASM) for VEF framework",
7
+ "author": {
8
+ "name": "Venus",
9
+ "email": "iweixiaopeng@163.com",
10
+ "url": "https://github.com/ilxqx"
11
+ },
12
+ "license": "Apache-2.0",
13
+ "homepage": "https://vef.ilxqx.com",
14
+ "keywords": [
15
+ "vef",
16
+ "framework",
17
+ "react",
18
+ "expression",
19
+ "zen",
20
+ "gorules",
21
+ "wasm"
22
+ ],
23
+ "sideEffects": false,
24
+ "exports": {
25
+ ".": {
26
+ "vef": "./src/index.ts",
27
+ "import": {
28
+ "types": "./dist/types/index.d.ts",
29
+ "default": "./dist/es/index.js"
30
+ },
31
+ "require": {
32
+ "types": "./dist/types/index.d.ts",
33
+ "default": "./dist/cjs/index.cjs"
34
+ }
35
+ },
36
+ "./react": {
37
+ "vef": "./src/react/index.ts",
38
+ "import": {
39
+ "types": "./dist/types/react/index.d.ts",
40
+ "default": "./dist/es/react/index.js"
41
+ },
42
+ "require": {
43
+ "types": "./dist/types/react/index.d.ts",
44
+ "default": "./dist/cjs/react/index.cjs"
45
+ }
46
+ },
47
+ "./package.json": "./package.json"
48
+ },
49
+ "main": "dist/cjs/index.cjs",
50
+ "module": "dist/es/index.js",
51
+ "types": "dist/types/index.d.ts",
52
+ "files": [
53
+ "dist"
54
+ ],
55
+ "engines": {
56
+ "node": ">=22.x"
57
+ },
58
+ "publishConfig": {
59
+ "access": "public"
60
+ },
61
+ "peerDependencies": {
62
+ "react": ">=19"
63
+ },
64
+ "peerDependenciesMeta": {
65
+ "react": {
66
+ "optional": true
67
+ }
68
+ },
69
+ "dependencies": {
70
+ "@gorules/zen-engine-wasm": "0.23.1",
71
+ "@vef-framework-react/shared": "2.4.0"
72
+ },
73
+ "devDependencies": {
74
+ "react": "^19.2.7"
75
+ },
76
+ "scripts": {
77
+ "clean": "rimraf dist",
78
+ "typecheck": "tsc --noEmit",
79
+ "build": "vite build"
80
+ }
81
+ }