@aw-webflow/workflow-automation 1.0.0 → 1.0.2

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 (2) hide show
  1. package/package.json +1 -1
  2. package/script.js +26 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aw-webflow/workflow-automation",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "start": "parcel script.js",
package/script.js CHANGED
@@ -675,6 +675,31 @@
675
675
  watch(el, function () { if (!run) { run = true; cycle(); } }, function () { run = false; for (var i = 0; i < timers.length; i++) clearTimeout(timers[i]); timers = []; }, 0.35);
676
676
  }
677
677
 
678
+ /* ---------- 10. Sticky Act bar: highlight the section in view ---------- */
679
+ function initActBar() {
680
+ var starts = document.querySelectorAll('[data-actstart]'), links = document.querySelectorAll('[data-act]');
681
+ if (!starts.length || !links.length) return;
682
+ var cur = 0, bar = document.querySelector('[data-actbar]');
683
+ /* stick right under whichever site nav is showing (desktop 61-109px, mobile 74px) */
684
+ function pos() {
685
+ var n = document.querySelector('.nav_latest'), m = document.querySelector('.mob_nav_latest');
686
+ if (bar) bar.style.top = ((n && n.offsetHeight) || (m && m.offsetHeight) || 61) + 'px';
687
+ }
688
+ function upd() {
689
+ pos();
690
+ var y = window.innerHeight * 0.4, a = 1, i;
691
+ for (i = 0; i < starts.length; i++) if (starts[i].getBoundingClientRect().top <= y) a = +starts[i].getAttribute('data-actstart');
692
+ if (a === cur) return;
693
+ cur = a;
694
+ for (i = 0; i < links.length; i++) {
695
+ var on = +links[i].getAttribute('data-act') === a, t = links[i].lastElementChild;
696
+ links[i].classList.toggle('is-on', on);
697
+ if (t) t.classList.toggle('is-open', on);
698
+ }
699
+ }
700
+ window.addEventListener('scroll', upd, { passive: true }); window.addEventListener('resize', upd); upd();
701
+ }
702
+
678
703
  /* ---------- 8. Bento tiles (10 small feature mockups) ---------- */
679
704
  function initTiles() {
680
705
  var CARD = 'background:#fff;border:1px solid ' + LINE + ';border-radius:6px;padding:12px 14px;width:100%;max-width:205px;box-sizing:border-box;';
@@ -736,6 +761,7 @@
736
761
  mount('[data-mock="dark"]', buildDark, STEPS_DARK, 4500);
737
762
  mount('[data-anim="pk"]', buildPK, STEPS_PK, 4500);
738
763
  var hero = document.querySelector('[data-anim="hero"]'); if (hero) { hero.style.background = 'linear-gradient(rgba(255,255,255,.8),rgba(255,255,255,.8)),url(' + IMG.floral + ') center/cover no-repeat'; initHero(hero); }
764
+ initActBar();
739
765
  var cn = document.querySelector('[data-anim="cn"]'); if (cn) initCN(cn);
740
766
  var teams = document.querySelector('[data-mock="teams"]'); if (teams) initTeams(teams);
741
767
  var gov = document.querySelector('[data-mock="gov"]'); if (gov) initGov(gov);