web-manager 4.1.14 → 4.1.15

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.
@@ -47,11 +47,17 @@ class Bindings {
47
47
  // Split by comma to support multiple actions
48
48
  const bindings = this._parseBindings(bindValue);
49
49
 
50
- // Execute each action
50
+ // Execute each action, track if any were actually processed
51
+ let anyProcessed = false;
51
52
  bindings.forEach(({ action, expression }) => {
52
- this._executeAction(element, action, expression, context, updatedKeys);
53
+ if (this._executeAction(element, action, expression, context, updatedKeys)) {
54
+ anyProcessed = true;
55
+ }
53
56
  });
54
57
 
58
+ // Only remove skeleton if at least one binding was actually processed
59
+ if (!anyProcessed) return;
60
+
55
61
  // Add bound class to trigger fade out
56
62
  element.classList.add('wm-bound');
57
63
 
@@ -94,6 +100,7 @@ class Bindings {
94
100
  }
95
101
 
96
102
  // Execute a single action on an element
103
+ // Returns true if the action was processed, false if skipped
97
104
  _executeAction(element, action, expression, context, updatedKeys = null) {
98
105
  switch (action) {
99
106
  case '@show':
@@ -101,7 +108,7 @@ class Bindings {
101
108
 
102
109
  // Check if this path should be updated
103
110
  if (!this._shouldUpdatePath(expression, updatedKeys)) {
104
- return;
111
+ return false;
105
112
  }
106
113
 
107
114
  const shouldShow = expression ? this._evaluateCondition(expression, context) : true;
@@ -110,14 +117,14 @@ class Bindings {
110
117
  } else {
111
118
  element.setAttribute('hidden', '');
112
119
  }
113
- break;
120
+ return true;
114
121
 
115
122
  case '@hide':
116
123
  // Hide element if condition is true (or always if no condition)
117
124
 
118
125
  // Check if this path should be updated
119
126
  if (!this._shouldUpdatePath(expression, updatedKeys)) {
120
- return;
127
+ return false;
121
128
  }
122
129
 
123
130
  const shouldHide = expression ? this._evaluateCondition(expression, context) : true;
@@ -126,7 +133,7 @@ class Bindings {
126
133
  } else {
127
134
  element.removeAttribute('hidden');
128
135
  }
129
- break;
136
+ return true;
130
137
 
131
138
  case '@attr':
132
139
  // Set attribute value
@@ -137,7 +144,7 @@ class Bindings {
137
144
 
138
145
  // Check if this path should be updated
139
146
  if (!this._shouldUpdatePath(attrExpression, updatedKeys)) {
140
- return;
147
+ return false;
141
148
  }
142
149
 
143
150
  const attrValue = this._resolvePath(context, attrExpression) || '';
@@ -147,7 +154,7 @@ class Bindings {
147
154
  } else {
148
155
  element.removeAttribute(attrName);
149
156
  }
150
- break;
157
+ return true;
151
158
 
152
159
  case '@style':
153
160
  // Set CSS custom property or style
@@ -158,7 +165,7 @@ class Bindings {
158
165
 
159
166
  // Check if this path should be updated
160
167
  if (!this._shouldUpdatePath(styleExpression, updatedKeys)) {
161
- return;
168
+ return false;
162
169
  }
163
170
 
164
171
  const styleValue = this._resolvePath(context, styleExpression);
@@ -179,18 +186,18 @@ class Bindings {
179
186
  element.style[styleName] = '';
180
187
  }
181
188
  }
182
- break;
189
+ return true;
183
190
 
184
191
  case '@value':
185
192
  // Set input/textarea value explicitly
186
193
  // Check if this path should be updated
187
194
  if (!this._shouldUpdatePath(expression, updatedKeys)) {
188
- return;
195
+ return false;
189
196
  }
190
197
 
191
198
  const inputValue = this._resolvePath(context, expression) ?? '';
192
199
  element.value = inputValue;
193
- break;
200
+ return true;
194
201
 
195
202
  case '@text':
196
203
  default:
@@ -198,12 +205,12 @@ class Bindings {
198
205
 
199
206
  // Check if this path should be updated
200
207
  if (!this._shouldUpdatePath(expression, updatedKeys)) {
201
- return;
208
+ return false;
202
209
  }
203
210
 
204
211
  const textValue = this._resolvePath(context, expression) ?? '';
205
212
  element.textContent = textValue;
206
- break;
213
+ return true;
207
214
  }
208
215
  }
209
216
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "web-manager",
3
- "version": "4.1.14",
3
+ "version": "4.1.15",
4
4
  "description": "Easily access important variables such as the query string, current domain, and current page in a single object.",
5
5
  "main": "dist/index.js",
6
6
  "module": "src/index.js",