web-manager 4.0.20 → 4.0.22

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/README.md CHANGED
@@ -314,6 +314,71 @@ const context = Manager.bindings().getContext();
314
314
  Manager.bindings().clear();
315
315
  ```
316
316
 
317
+ #### Attribute Actions
318
+ ```html
319
+ <!-- Set an attribute value -->
320
+ <img data-wm-bind="@attr src auth.user.photoURL" />
321
+ <a data-wm-bind="@attr href settings.profileUrl">Profile</a>
322
+
323
+ <!-- Multiple attributes on same element -->
324
+ <img data-wm-bind="@attr src auth.user.photoURL, @attr alt auth.user.displayName" />
325
+ ```
326
+
327
+ #### Multiple Actions
328
+ You can combine multiple actions on a single element by separating them with commas:
329
+
330
+ ```html
331
+ <!-- Set text AND show/hide -->
332
+ <div data-wm-bind="@show auth.user, @text auth.user.displayName"></div>
333
+
334
+ <!-- Set text AND multiple attributes -->
335
+ <img data-wm-bind="@text auth.user.displayName, @attr src auth.user.photoURL, @attr title auth.user.email" />
336
+
337
+ <!-- Multiple attributes -->
338
+ <a data-wm-bind="@attr href settings.url, @attr target settings.target, @text settings.linkText"></a>
339
+ ```
340
+
341
+ #### Skeleton Loaders
342
+ Add the `wm-binding-skeleton` class to show a loading skeleton while data is being bound:
343
+
344
+ ```html
345
+ <!-- Shows a shimmer loading effect until data is bound -->
346
+ <span data-wm-bind="auth.user.displayName" class="wm-binding-skeleton"></span>
347
+
348
+ <!-- Profile card with multiple skeleton loaders -->
349
+ <div class="profile-card">
350
+ <img data-wm-bind="@attr src auth.user.photoURL" class="wm-binding-skeleton">
351
+ <h3 data-wm-bind="auth.user.displayName" class="wm-binding-skeleton"></h3>
352
+ <p data-wm-bind="auth.user.email" class="wm-binding-skeleton"></p>
353
+ </div>
354
+
355
+ <!-- Elements without the class won't show skeleton loaders -->
356
+ <span data-wm-bind="settings.theme"></span>
357
+ ```
358
+
359
+ The skeleton loader automatically:
360
+ - Displays a shimmer animation while the element is unbound
361
+ - Hides the text content during loading
362
+ - Prevents interaction until data is loaded
363
+ - Fades in smoothly when data arrives
364
+ - Adapts to dark themes
365
+ - Respects `prefers-reduced-motion` accessibility settings
366
+
367
+ #### Visual Feedback
368
+ When an element is bound, Web Manager automatically adds the `wm-bound` class to it. You can use this class for styling or debugging:
369
+
370
+ ```css
371
+ /* Add a subtle indicator for bound elements in development */
372
+ .wm-bound {
373
+ outline: 1px dashed rgba(0, 123, 255, 0.3);
374
+ }
375
+
376
+ /* Custom styling after binding */
377
+ .wm-bound {
378
+ /* Element has been successfully bound */
379
+ }
380
+ ```
381
+
317
382
  #### Supported Actions
318
383
  - **`@text`** (default): Sets the text content of the element
319
384
  - **`@show`**: Shows the element when condition is true
@@ -43,10 +43,13 @@ class Bindings {
43
43
  this._executeAction(element, action, expression, context);
44
44
  });
45
45
 
46
- // Add bound class to indicate element has been processed
47
- if (!element.classList.contains('wm-bound')) {
46
+ // Remove skeleton loader class first to trigger transition
47
+ element.classList.remove('wm-binding-skeleton');
48
+
49
+ // Add bound class after a brief delay to allow for smooth animation (0.25s)
50
+ setTimeout(() => {
48
51
  element.classList.add('wm-bound');
49
- }
52
+ }, 250);
50
53
  });
51
54
  }
52
55
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "web-manager",
3
- "version": "4.0.20",
3
+ "version": "4.0.22",
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",