@mintjamsinc/ichigojs 0.1.41 → 0.1.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/ichigo.cjs CHANGED
@@ -7189,9 +7189,12 @@
7189
7189
  */
7190
7190
  static compileExpression(expression, identifiers, options) {
7191
7191
  // Build parameter list: globals first, then identifiers (base names), then additional context
7192
+ // Filter out identifiers that are already in the global whitelist to avoid duplicate parameters
7193
+ const globalKeys = new Set(Object.keys(ExpressionEvaluator.GLOBAL_WHITELIST));
7194
+ const filteredIdentifiers = identifiers.filter(id => !globalKeys.has(id));
7192
7195
  const params = [
7193
7196
  ...Object.keys(ExpressionEvaluator.GLOBAL_WHITELIST),
7194
- ...identifiers
7197
+ ...filteredIdentifiers
7195
7198
  ];
7196
7199
  // Add additional context parameters if provided
7197
7200
  if (options?.additionalContext) {
@@ -7215,11 +7218,14 @@
7215
7218
  evaluate() {
7216
7219
  try {
7217
7220
  // Build arguments: globals first, then identifiers, then additional context
7221
+ // Filter out identifiers that are already in the global whitelist to match compileExpression
7222
+ const globalKeys = new Set(Object.keys(ExpressionEvaluator.GLOBAL_WHITELIST));
7223
+ const filteredIdentifiers = this.identifiers.filter(id => !globalKeys.has(id));
7218
7224
  const values = [
7219
7225
  // Global whitelist values
7220
7226
  ...Object.values(ExpressionEvaluator.GLOBAL_WHITELIST),
7221
- // Identifier values from bindings
7222
- ...this.identifiers.map(id => this.bindings.get(id))
7227
+ // Identifier values from bindings (excluding globals)
7228
+ ...filteredIdentifiers.map(id => this.bindings.get(id))
7223
7229
  ];
7224
7230
  // Add additional context values if provided
7225
7231
  if (this.additionalContext) {
@@ -8144,6 +8150,21 @@
8144
8150
  newValue = value;
8145
8151
  }
8146
8152
  else {
8153
+ // Before wrapping, check if any properties are existing ReactiveProxies
8154
+ // and register path aliases for them
8155
+ if (!Array.isArray(value)) {
8156
+ for (const propKey of Object.keys(value)) {
8157
+ const propValue = value[propKey];
8158
+ if (typeof propValue === 'object' && propValue !== null) {
8159
+ const propPath = ReactiveProxy.getPath(propValue);
8160
+ if (propPath) {
8161
+ // Register alias: key.propKey -> propPath
8162
+ ReactiveProxy.registerPathAlias(`${key}.${propKey}`, propPath);
8163
+ this.#logger?.debug(`Property path alias registered: ${key}.${propKey} -> ${propPath}`);
8164
+ }
8165
+ }
8166
+ }
8167
+ }
8147
8168
  // Wrap objects/arrays with reactive proxy, tracking the root key
8148
8169
  newValue = ReactiveProxy.create(value, (changedPath) => {
8149
8170
  let path = '';
@@ -9010,8 +9031,8 @@
9010
9031
  const changes = this.bindings?.changes || [];
9011
9032
  if (this.#nodeType === Node.TEXT_NODE && this.#textEvaluator) {
9012
9033
  // If this is a text node with a text evaluator, update its content if needed
9013
- // Check if any of the identifiers are in the changed identifiers
9014
- const changed = this.#textEvaluator.identifiers.some(id => changes.includes(id));
9034
+ // Check if any of the identifiers are in the changed identifiers (considering path aliases)
9035
+ const changed = this.#textEvaluator.identifiers.some(id => changes.some(change => ReactiveProxy.doesChangeMatchIdentifier(change, id)));
9015
9036
  // If the text node has changed, update its content
9016
9037
  if (changed) {
9017
9038
  const text = this.#node;