@brightspot/ui 5.0.4-pre.20260624 → 5.2.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 (142) hide show
  1. package/dist/components/button-group/ButtonGroup.d.ts +7 -2
  2. package/dist/components/button-group/ButtonGroup.d.ts.map +1 -1
  3. package/dist/components/button-group/ButtonGroup.js +23 -16
  4. package/dist/components/button-group/ButtonGroup.js.map +1 -1
  5. package/dist/components/card/Card.css +7 -0
  6. package/dist/components/card/Card.d.ts +244 -0
  7. package/dist/components/card/Card.d.ts.map +1 -0
  8. package/dist/components/card/Card.js +512 -0
  9. package/dist/components/card/Card.js.map +1 -0
  10. package/dist/components/empty-state/EmptyState.d.ts +11 -2
  11. package/dist/components/empty-state/EmptyState.d.ts.map +1 -1
  12. package/dist/components/empty-state/EmptyState.js +19 -8
  13. package/dist/components/empty-state/EmptyState.js.map +1 -1
  14. package/dist/components/esca-avatar/EscaAvatar.d.ts +70 -0
  15. package/dist/components/esca-avatar/EscaAvatar.d.ts.map +1 -0
  16. package/dist/components/esca-avatar/EscaAvatar.js +218 -0
  17. package/dist/components/esca-avatar/EscaAvatar.js.map +1 -0
  18. package/dist/components/esca-avatar/animations/esca-search.json +1 -0
  19. package/dist/components/esca-avatar/animations/esca-task-complete.json +1 -0
  20. package/dist/components/esca-avatar/animations/esca-wave.json +1 -0
  21. package/dist/components/widget/Widget.d.ts +11 -2
  22. package/dist/components/widget/Widget.d.ts.map +1 -1
  23. package/dist/components/widget/Widget.js +21 -10
  24. package/dist/components/widget/Widget.js.map +1 -1
  25. package/dist/custom-elements.json +1081 -365
  26. package/dist/storybook/assets/{ActionBar.stories-cyX9vc6C.js → ActionBar.stories-CBN_ShP5.js} +1 -1
  27. package/dist/storybook/assets/{ActionItem.stories-Bs-Kxp5J.js → ActionItem.stories-DysfIj7U.js} +1 -1
  28. package/dist/storybook/assets/{Avatar.stories-B1Uee53f.js → Avatar.stories-BdgqH7I_.js} +1 -1
  29. package/dist/storybook/assets/{AvatarGroup.stories-W2EtKQBu.js → AvatarGroup.stories-DFCG_0Py.js} +1 -1
  30. package/dist/storybook/assets/{Badge.stories-BotNIO18.js → Badge.stories-BWPIJ2jm.js} +1 -1
  31. package/dist/storybook/assets/{Button-YTBnP55L.js → Button-B1_SwzVL.js} +1 -1
  32. package/dist/storybook/assets/{Button.stories-B-X7_d_i.js → Button.stories-C-H-KIcV.js} +1 -1
  33. package/dist/storybook/assets/{ButtonGroup.stories-BM-pxfK2.js → ButtonGroup.stories-BBdtnaP_.js} +1 -1
  34. package/dist/storybook/assets/Card.stories-FLC-WKC_.js +556 -0
  35. package/dist/storybook/assets/{Celebrate.stories-D9EJwzxo.js → Celebrate.stories-CZ7SfTOh.js} +1 -1
  36. package/dist/storybook/assets/{Checkbox.stories-f5VLVSw5.js → Checkbox.stories-C42Z-jkF.js} +1 -1
  37. package/dist/storybook/assets/{CircularProgress.stories-BI9e372u.js → CircularProgress.stories-DoC0japf.js} +1 -1
  38. package/dist/storybook/assets/{ClipboardMixin.stories-CsyJDNxc.js → ClipboardMixin.stories-Ci-drbJq.js} +1 -1
  39. package/dist/storybook/assets/{Color-6BZIO3FS-ClVOLIJG.js → Color-6BZIO3FS-rxeQBzj6.js} +1 -1
  40. package/dist/storybook/assets/{Colors.stories-hUYBvymM.js → Colors.stories-Bw1Kp3B7.js} +1 -1
  41. package/dist/storybook/assets/{CombinedEffects.stories-DkokyKCS.js → CombinedEffects.stories-DArqLKI1.js} +1 -1
  42. package/dist/storybook/assets/{ComponentStatesMixin-C4I_rtgt.js → ComponentStatesMixin-kUcZl-YW.js} +1 -1
  43. package/dist/storybook/assets/{ComponentStatesMixin.stories-BeLCYevK.js → ComponentStatesMixin.stories-PrGY6akN.js} +1 -1
  44. package/dist/storybook/assets/{CopyToClipboard.stories-DN9oagz-.js → CopyToClipboard.stories-CUzNoCic.js} +1 -1
  45. package/dist/storybook/assets/{Debounce.stories-CtNQAJxO.js → Debounce.stories-CrnUlkHs.js} +1 -1
  46. package/dist/storybook/assets/{DocsRenderer-LL677BLK-Bx1Fds2q.js → DocsRenderer-LL677BLK-BM3eNhez.js} +3 -3
  47. package/dist/storybook/assets/{Dropdown.stories-B862-mco.js → Dropdown.stories-DyIY6e6W.js} +1 -1
  48. package/dist/storybook/assets/{EmptyState.stories-Im3Vr4ZL.js → EmptyState.stories-BXFcxFcG.js} +1 -1
  49. package/dist/storybook/assets/EscaAvatar.stories-DnriDX7_.js +138 -0
  50. package/dist/storybook/assets/{Events.stories-B0tluV0t.js → Events.stories-YjZ1Qtl4.js} +1 -1
  51. package/dist/storybook/assets/{Heading.stories-6CzGqAAc.js → Heading.stories-CfQHk5pf.js} +1 -1
  52. package/dist/storybook/assets/{HueRipple.stories-DaQiDn9K.js → HueRipple.stories-CR75dLBM.js} +1 -1
  53. package/dist/storybook/assets/{Icon.stories-CFkYO_7w.js → Icon.stories-BCSRhY2s.js} +1 -1
  54. package/dist/storybook/assets/{IconButton.stories-DwBTqvTi.js → IconButton.stories-0O4LM1u6.js} +1 -1
  55. package/dist/storybook/assets/{LinearProgress.stories-Coxmgjmo.js → LinearProgress.stories-B7GYC8WE.js} +1 -1
  56. package/dist/storybook/assets/OnFindMixin.stories-UOK_ZP2n.js +300 -0
  57. package/dist/storybook/assets/{Pagination.stories-CYrKX5iI.js → Pagination.stories-Co3mbyct.js} +1 -1
  58. package/dist/storybook/assets/{Popover.stories-BkGiUOfu.js → Popover.stories-D5gsWcB0.js} +1 -1
  59. package/dist/storybook/assets/{ReadyMixin-CP6tQ4FB.js → ReadyMixin-DkhLzoe0.js} +1 -1
  60. package/dist/storybook/assets/{RovingTabindexMixin.stories-CzkPw8Nl.js → RovingTabindexMixin.stories-DPhOWmKd.js} +1 -1
  61. package/dist/storybook/assets/{Rtc.stories-CVch488H.js → Rtc.stories-D5Vpw1oP.js} +1 -1
  62. package/dist/storybook/assets/{ScrollShadow.stories-BGh-Irt7.js → ScrollShadow.stories-Cmbqjk5X.js} +1 -1
  63. package/dist/storybook/assets/{Switch.stories-DPfP0QVK.js → Switch.stories-Bfmr9Ugg.js} +1 -1
  64. package/dist/storybook/assets/{Tab.stories-CBcuRcDB.js → Tab.stories-DbucUczE.js} +1 -1
  65. package/dist/storybook/assets/{Tabs.stories-CDOBjYbs.js → Tabs.stories-DnPRsSsj.js} +1 -1
  66. package/dist/storybook/assets/{Throttle.stories-Bqyul0aW.js → Throttle.stories-DNwTsNRC.js} +1 -1
  67. package/dist/storybook/assets/{Tooltip.stories-B9dohX1h.js → Tooltip.stories-Fsp2BRAr.js} +1 -1
  68. package/dist/storybook/assets/{Upload.stories-C7dq2Wdk.js → Upload.stories-C-WggEd6.js} +1 -1
  69. package/dist/storybook/assets/{UploadItem.stories-35zsIKTv.js → UploadItem.stories-DwQzECXv.js} +1 -1
  70. package/dist/storybook/assets/{Welcome.stories-BuD3fpke.js → Welcome.stories-DFluhbVr.js} +1 -1
  71. package/dist/storybook/assets/{Widget.stories-D2UYzfyE.js → Widget.stories-7pJNHWTu.js} +1 -1
  72. package/dist/storybook/assets/{WithTooltip-65CFNBJE-DGiY8cz9.js → WithTooltip-65CFNBJE-BcgHQTz7.js} +1 -1
  73. package/dist/storybook/assets/{blocks-YjKl5E55.js → blocks-U4F5yAu3.js} +5 -5
  74. package/dist/storybook/assets/{formatter-EIJCOSYU-XYAiuXAN.js → formatter-EIJCOSYU-BjQsmbLH.js} +1 -1
  75. package/dist/storybook/assets/if-defined-CM2lJk-0.js +1 -0
  76. package/dist/storybook/assets/iframe-1F7Ef_8q.css +1 -0
  77. package/dist/storybook/assets/{iframe-CufEXQ5F.js → iframe-DNJdsh5L.js} +225 -225
  78. package/dist/storybook/assets/{index-DbEDIsEB.js → index-1U9xrCIK.js} +1 -1
  79. package/dist/storybook/assets/onFind-AbVF4rYD.js +1 -0
  80. package/dist/storybook/assets/{onFind.stories-UpwJxFqR.js → onFind.stories-j334ViWp.js} +15 -15
  81. package/dist/storybook/assets/{onRemove.stories-BMwQGBCl.js → onRemove.stories-fKMxne2_.js} +1 -1
  82. package/dist/storybook/assets/{onVisible.stories-axSo0Zv3.js → onVisible.stories-BCRoHlJz.js} +1 -1
  83. package/dist/storybook/assets/{style-map-BkaK9546.js → style-map-BZ07XihX.js} +1 -1
  84. package/dist/storybook/assets/{syntaxhighlighter-ED5Y7EFY-CDDZTVRn.js → syntaxhighlighter-ED5Y7EFY-C2D-CgsB.js} +1 -1
  85. package/dist/storybook/iframe.html +48 -2
  86. package/dist/storybook/index.json +1 -1
  87. package/dist/storybook/project.json +1 -1
  88. package/dist/tailwind-plugin-button.js +5 -5
  89. package/dist/tailwind-plugin-button.js.map +1 -1
  90. package/dist/tailwind-plugin-button.ts +5 -5
  91. package/dist/tailwind-plugin-card.d.ts +2 -0
  92. package/dist/tailwind-plugin-card.d.ts.map +1 -0
  93. package/dist/tailwind-plugin-card.js +438 -0
  94. package/dist/tailwind-plugin-card.js.map +1 -0
  95. package/dist/tailwind-plugin-card.ts +515 -0
  96. package/dist/tailwind.config.d.ts.map +1 -1
  97. package/dist/tailwind.config.js +3 -1
  98. package/dist/tailwind.config.js.map +1 -1
  99. package/dist/tailwind.config.ts +3 -2
  100. package/dist/util/EventEmitterMixin.d.ts +5 -0
  101. package/dist/util/EventEmitterMixin.d.ts.map +1 -1
  102. package/dist/util/EventEmitterMixin.js.map +1 -1
  103. package/dist/util/OnFindMixin.d.ts +55 -0
  104. package/dist/util/OnFindMixin.d.ts.map +1 -0
  105. package/dist/util/OnFindMixin.js +70 -0
  106. package/dist/util/OnFindMixin.js.map +1 -0
  107. package/dist/util/onFind.d.ts +4 -2
  108. package/dist/util/onFind.d.ts.map +1 -1
  109. package/dist/util/onFind.js +12 -0
  110. package/dist/util/onFind.js.map +1 -1
  111. package/docs/components/ButtonGroup.md +7 -3
  112. package/docs/components/Card.md +83 -0
  113. package/docs/components/EmptyState.md +10 -6
  114. package/docs/components/EscaAvatar.md +70 -0
  115. package/docs/components/README.md +2 -0
  116. package/docs/components/Widget.md +18 -14
  117. package/package.json +2 -2
  118. package/src/legacy/tool-ui/src/AIInline.css +1 -1
  119. package/src/legacy/tool-ui/src/ContentForm.css +1 -1
  120. package/src/legacy/tool-ui/src/Guide.css +1 -1
  121. package/src/legacy/tool-ui/src/Notification.css +1 -1
  122. package/src/legacy/tool-ui/src/Popup.css +4 -1
  123. package/src/legacy/tool-ui/src/RepeatableContentInputGroup.css +3 -3
  124. package/src/legacy/tool-ui/src/SearchWidget.ts +10 -1
  125. package/src/legacy/tool-ui/src/dropdown/index.ts +2 -2
  126. package/src/legacy/tool-ui/src/main/webapp/dist/RTEProseMirror.c6f3142a97caa5cd3c21.js +500 -0
  127. package/src/legacy/tool-ui/src/main/webapp/dist/v4.c1c3bde6e394b2a2b75c.css +3 -0
  128. package/src/legacy/tool-ui/src/main/webapp/dist/{v4.c5bcef50efdfa2d2e35f.js → v4.da15ce3ce45e85b4880a.js} +5 -5
  129. package/src/legacy/tool-ui/src/main/webapp/dist/v5.4edf99db4a5f4969d041.css +5 -0
  130. package/src/legacy/tool-ui/src/main/webapp/dist/{v5.86effb9bf858ae7b0640.js → v5.8491d982a282935a3058.js} +5 -5
  131. package/src/legacy/tool-ui/src/main/webapp/v4/ContentForm.less +1 -1
  132. package/src/legacy/tool-ui/src/main/webapp/v4/ContentSelector.less +3 -3
  133. package/src/legacy/tool-ui/src/v5.ts +4 -2
  134. package/dist/storybook/assets/if-defined-f_e-RnGa.js +0 -1
  135. package/dist/storybook/assets/iframe-PeGbyIdX.css +0 -1
  136. package/dist/storybook/assets/onFind-C7Wi8jr6.js +0 -1
  137. package/src/legacy/tool-ui/src/main/webapp/dist/RTEProseMirror.945bd28778b1a3e937c7.js +0 -500
  138. package/src/legacy/tool-ui/src/main/webapp/dist/v4.a6f53058dbb04a69aa5c.css +0 -3
  139. package/src/legacy/tool-ui/src/main/webapp/dist/v5.f60c05ef0c9b89aae888.css +0 -5
  140. /package/src/legacy/tool-ui/src/main/webapp/dist/{RTEProseMirror.945bd28778b1a3e937c7.js.LICENSE.txt → RTEProseMirror.c6f3142a97caa5cd3c21.js.LICENSE.txt} +0 -0
  141. /package/src/legacy/tool-ui/src/main/webapp/dist/{v4.c5bcef50efdfa2d2e35f.js.LICENSE.txt → v4.da15ce3ce45e85b4880a.js.LICENSE.txt} +0 -0
  142. /package/src/legacy/tool-ui/src/main/webapp/dist/{v5.86effb9bf858ae7b0640.js.LICENSE.txt → v5.8491d982a282935a3058.js.LICENSE.txt} +0 -0
@@ -1 +1 @@
1
- import{R as e}from"./iframe-CufEXQ5F.js";import"./preload-helper-PPVm8Dsz.js";const o={},c=e.createContext(o);function u(n){const t=e.useContext(c);return e.useMemo(function(){return typeof n=="function"?n(t):{...t,...n}},[t,n])}function r(n){let t;return n.disableParentContext?t=typeof n.components=="function"?n.components(o):n.components||o:t=u(n.components),e.createElement(c.Provider,{value:t},n.children)}export{r as MDXProvider,u as useMDXComponents};
1
+ import{R as e}from"./iframe-DNJdsh5L.js";import"./preload-helper-PPVm8Dsz.js";const o={},c=e.createContext(o);function u(n){const t=e.useContext(c);return e.useMemo(function(){return typeof n=="function"?n(t):{...t,...n}},[t,n])}function r(n){let t;return n.disableParentContext?t=typeof n.components=="function"?n.components(o):n.components||o:t=u(n.components),e.createElement(c.Provider,{value:t},n.children)}export{r as MDXProvider,u as useMDXComponents};
@@ -0,0 +1 @@
1
+ import{Q as W}from"./iframe-DNJdsh5L.js";var L={exports:{}},K=L.exports,I;function V(){return I||(I=1,(function(s){(function(t,e){s.exports?s.exports=e():t.log=e()})(K,function(){var t=function(){},e="undefined",c=typeof window!==e&&typeof window.navigator!==e&&/Trident\/|MSIE /.test(window.navigator.userAgent),o=["trace","debug","info","warn","error"],n={},a=null;function v(i,u){var r=i[u];if(typeof r.bind=="function")return r.bind(i);try{return Function.prototype.bind.call(r,i)}catch{return function(){return Function.prototype.apply.apply(r,[i,arguments])}}}function U(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function P(i){return i==="debug"&&(i="log"),typeof console===e?!1:i==="trace"&&c?U:console[i]!==void 0?v(console,i):console.log!==void 0?v(console,"log"):t}function y(){for(var i=this.getLevel(),u=0;u<o.length;u++){var r=o[u];this[r]=u<i?t:this.methodFactory(r,i,this.name)}if(this.log=this.debug,typeof console===e&&i<this.levels.SILENT)return"No console available for logging"}function q(i){return function(){typeof console!==e&&(y.call(this),this[i].apply(this,arguments))}}function z(i,u,r){return P(i)||q.apply(this,arguments)}function T(i,u){var r=this,m,k,h,g="loglevel";typeof i=="string"?g+=":"+i:typeof i=="symbol"&&(g=void 0);function D(l){var f=(o[l]||"silent").toUpperCase();if(!(typeof window===e||!g)){try{window.localStorage[g]=f;return}catch{}try{window.document.cookie=encodeURIComponent(g)+"="+f+";"}catch{}}}function x(){var l;if(!(typeof window===e||!g)){try{l=window.localStorage[g]}catch{}if(typeof l===e)try{var f=window.document.cookie,w=encodeURIComponent(g),C=f.indexOf(w+"=");C!==-1&&(l=/^([^;]+)/.exec(f.slice(C+w.length+1))[1])}catch{}return r.levels[l]===void 0&&(l=void 0),l}}function $(){if(!(typeof window===e||!g)){try{window.localStorage.removeItem(g)}catch{}try{window.document.cookie=encodeURIComponent(g)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function b(l){var f=l;if(typeof f=="string"&&r.levels[f.toUpperCase()]!==void 0&&(f=r.levels[f.toUpperCase()]),typeof f=="number"&&f>=0&&f<=r.levels.SILENT)return f;throw new TypeError("log.setLevel() called with invalid level: "+l)}r.name=i,r.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},r.methodFactory=u||z,r.getLevel=function(){return h??k??m},r.setLevel=function(l,f){return h=b(l),f!==!1&&D(h),y.call(r)},r.setDefaultLevel=function(l){k=b(l),x()||r.setLevel(l,!1)},r.resetLevel=function(){h=null,$(),y.call(r)},r.enableAll=function(l){r.setLevel(r.levels.TRACE,l)},r.disableAll=function(l){r.setLevel(r.levels.SILENT,l)},r.rebuild=function(){if(a!==r&&(m=b(a.getLevel())),y.call(r),a===r)for(var l in n)n[l].rebuild()},m=b(a?a.getLevel():"WARN");var F=x();F!=null&&(h=b(F)),y.call(r)}a=new T,a.getLogger=function(u){if(typeof u!="symbol"&&typeof u!="string"||u==="")throw new TypeError("You must supply a name when creating a logger.");var r=n[u];return r||(r=n[u]=new T(u,a.methodFactory)),r};var _=typeof window!==e?window.log:void 0;return a.noConflict=function(){return typeof window!==e&&window.log===a&&(window.log=_),a},a.getLoggers=function(){return n},a.default=a,a})})(L)),L.exports}var Y=V();const G=W(Y),R=Symbol.for("brightspot.onFind");let p;function d(){return p||(p=globalThis[R],p||(p={calledIndex:0,callbacks:[],blacklist:[],triggerPaused:!1,triggerOnResume:!1,triggerAll:!1,triggerElements:[],triggerFrame:0,initialized:!1},globalThis[R]=p),p)}class J{#r;#e;#t;#i;#n;constructor(t,e,c){this.#r=t,this.#e=`data-ofc${d().calledIndex++}`,Array.isArray(e)||(e=[e]),this.#t=e.map(e.some(n=>n.indexOf(",")>-1)?n=>n:n=>`${n}:not([${this.#e}])`).join(","),this.#i=c;const o=e.map(n=>n.trim()).filter(n=>n.indexOf(" ")<0&&n.indexOf(",")<0);o.length===e.length&&(this.#n=o)}addTriggerElements(t,e){if(this.#r.contains(e)){e.matches(this.#t)&&t.push(e);for(const c of e.querySelectorAll(this.#t))t.push(c)}}trigger(t){if(document.readyState!=="loading")if(this.#n&&Array.isArray(t))for(const e of t)this.#n.some(c=>e.matches(c))&&this.#o(e);else for(const e of this.#r.querySelectorAll(this.#t))this.#o(e)}#o(t){if(!N(t)&&!t.hasAttribute(this.#e)){t.setAttribute(this.#e,"");try{this.#i(t)}catch(e){G.error("Failed callback!",t,e)}}}}function N(s){if(!(s instanceof Element))return!1;const{blacklist:t}=d();return t.length>0&&t.some(e=>s.closest(e)!==null)}const S=Array.prototype.every,O=s=>s.nodeType===Node.TEXT_NODE;function A(s){const t=d();if(t.triggerPaused){t.triggerOnResume=!0;return}const e=Array.isArray(s),c=[];if(e){for(const o of s){const n=o.target;if(!N(n))switch(o.type){case"attributes":o.oldValue!==n.getAttribute(o.attributeName)&&c.push(o);break;case"childList":(!S.call(o.addedNodes,O)||!S.call(o.removedNodes,O))&&c.push(o);break}}if(c.length===0)return}if(c.length>500&&(t.triggerAll=!0),!t.triggerAll)if(e)for(const o of c){const n=o.target;switch(o.type){case"attributes":t.triggerElements.push(n);break;case"childList":for(const a of t.callbacks)a.addTriggerElements(t.triggerElements,n);break}}else t.triggerAll=!0;(t.triggerAll||t.triggerElements.length>0)&&!t.triggerFrame&&(t.triggerFrame=window.requestAnimationFrame(()=>{const o=t.triggerAll?void 0:t.triggerElements;t.triggerAll=!1,t.triggerElements=[],t.triggerFrame=0,t.callbacks.forEach(n=>n.trigger(o))}))}function M(){A(),new MutationObserver(A).observe(document,{attributes:!0,attributeFilter:["class","data-bsp-autosubmit","data-chart-type","data-code-type","data-internal-name","data-tab","name","rel","target"],attributeOldValue:!0,childList:!0,subtree:!0})}function Q(){const s=d();s.initialized||(s.initialized=!0,document.readyState==="loading"?document.addEventListener("DOMContentLoaded",M):M())}function E(s,t,e){Q();let c,o;typeof e<"u"?(c=s,o=t):(c=document,o=s,e=t);const n=new J(c,o,e);return n.trigger(),d().callbacks.push(n),()=>{const{callbacks:a}=d(),v=a.indexOf(n);v!==-1&&a.splice(v,1)}}E.triggerCallbacks=A;E.pause=()=>{d().triggerPaused=!0};E.resume=()=>{const s=d();s.triggerPaused=!1,s.triggerOnResume&&(s.triggerOnResume=!1,setTimeout(A,100))};E.ignore=(...s)=>{const{blacklist:t}=d();for(const e of s){try{document.querySelector(e)}catch{continue}t.includes(e)||t.push(e)}};export{G as l,E as o};
@@ -1,4 +1,4 @@
1
- import{x as f}from"./iframe-CufEXQ5F.js";import{l as P,o as b}from"./onFind-C7Wi8jr6.js";import"./preload-helper-PPVm8Dsz.js";const F=Symbol.for("brightspot.onFind");let y;function v(){return y||(y=globalThis[F],y||(y={calledIndex:0,callbacks:[],blacklist:[],triggerPaused:!1,triggerOnResume:!1,triggerAll:!1,triggerElements:[],triggerFrame:0,initialized:!1},globalThis[F]=y),y)}class O{#n;#e;#t;#a;#s;constructor(t,e,n){this.#n=t,this.#e=`data-ofc${v().calledIndex++}`,Array.isArray(e)||(e=[e]),this.#t=e.map(e.some(o=>o.indexOf(",")>-1)?o=>o:o=>`${o}:not([${this.#e}])`).join(","),this.#a=n;const a=e.map(o=>o.trim()).filter(o=>o.indexOf(" ")<0&&o.indexOf(",")<0);a.length===e.length&&(this.#s=a)}addTriggerElements(t,e){if(this.#n.contains(e)){e.matches(this.#t)&&t.push(e);for(const n of e.querySelectorAll(this.#t))t.push(n)}}trigger(t){if(document.readyState!=="loading")if(this.#s&&Array.isArray(t))for(const e of t)this.#s.some(n=>e.matches(n))&&this.#o(e);else for(const e of this.#n.querySelectorAll(this.#t))this.#o(e)}#o(t){if(!H(t)&&!t.hasAttribute(this.#e)){t.setAttribute(this.#e,"");try{this.#a(t)}catch(e){P.error("Failed callback!",t,e)}}}}function H(s){if(!(s instanceof Element))return!1;const{blacklist:t}=v();return t.length>0&&t.some(e=>s.closest(e)!==null)}const $=Array.prototype.every,S=s=>s.nodeType===Node.TEXT_NODE;function C(s){const t=v();if(t.triggerPaused){t.triggerOnResume=!0;return}const e=Array.isArray(s),n=[];if(e){for(const a of s){const o=a.target;if(!H(o))switch(a.type){case"attributes":a.oldValue!==o.getAttribute(a.attributeName)&&n.push(a);break;case"childList":(!$.call(a.addedNodes,S)||!$.call(a.removedNodes,S))&&n.push(a);break}}if(n.length===0)return}if(n.length>500&&(t.triggerAll=!0),!t.triggerAll)if(e)for(const a of n){const o=a.target;switch(a.type){case"attributes":t.triggerElements.push(o);break;case"childList":for(const r of t.callbacks)r.addTriggerElements(t.triggerElements,o);break}}else t.triggerAll=!0;(t.triggerAll||t.triggerElements.length>0)&&!t.triggerFrame&&(t.triggerFrame=window.requestAnimationFrame(()=>{const a=t.triggerAll?void 0:t.triggerElements;t.triggerAll=!1,t.triggerElements=[],t.triggerFrame=0,t.callbacks.forEach(o=>o.trigger(a))}))}function z(){C(),new MutationObserver(C).observe(document,{attributes:!0,attributeFilter:["class","data-bsp-autosubmit","data-chart-type","data-code-type","data-internal-name","data-tab","name","rel","target"],attributeOldValue:!0,childList:!0,subtree:!0})}function D(){const s=v();s.initialized||(s.initialized=!0,document.readyState==="loading"?document.addEventListener("DOMContentLoaded",z):z())}function m(s,t,e){D();let n,a;typeof e<"u"?(n=s,a=t):(n=document,a=s,e=t);const o=new O(n,a,e);o.trigger(),v().callbacks.push(o)}m.triggerCallbacks=C;m.pause=()=>{v().triggerPaused=!0};m.resume=()=>{const s=v();s.triggerPaused=!1,s.triggerOnResume&&(s.triggerOnResume=!1,setTimeout(C,100))};m.ignore=(...s)=>{const{blacklist:t}=v();for(const e of s){try{document.querySelector(e)}catch{continue}t.includes(e)||t.push(e)}};const{expect:d,userEvent:c,waitFor:u,within:k}=__STORYBOOK_MODULE_TEST__,R={title:"Utilities/onFind",tags:["autodocs"],parameters:{docs:{subtitle:"The `onFind` utility observes DOM mutations and executes callbacks when elements matching specified selectors appear. Uses MutationObserver internally to efficiently track element additions and attribute changes."},controls:{expanded:!0}},argTypes:{selector:{control:{type:"text"},description:"CSS selector to watch for"}},args:{selector:".dynamic-item"}},x={render:s=>{const t=`onfind-${Math.random().toString(36).substring(2,9)}`,e=`.dynamic-item-${t}`;let n=0,a=0;const o=()=>{const i=document.getElementById(`${t}-items-count`),l=document.getElementById(`${t}-found-count`);i&&(i.textContent=String(n)),l&&(l.textContent=String(a))};return b(e,i=>{a++,o(),i.classList.add("ring-2","ring-success-500")}),f`
1
+ import{x as f}from"./iframe-DNJdsh5L.js";import{l as P,o as p}from"./onFind-AbVF4rYD.js";import"./preload-helper-PPVm8Dsz.js";const F=Symbol.for("brightspot.onFind");let y;function v(){return y||(y=globalThis[F],y||(y={calledIndex:0,callbacks:[],blacklist:[],triggerPaused:!1,triggerOnResume:!1,triggerAll:!1,triggerElements:[],triggerFrame:0,initialized:!1},globalThis[F]=y),y)}class O{#n;#e;#t;#a;#s;constructor(t,e,n){this.#n=t,this.#e=`data-ofc${v().calledIndex++}`,Array.isArray(e)||(e=[e]),this.#t=e.map(e.some(o=>o.indexOf(",")>-1)?o=>o:o=>`${o}:not([${this.#e}])`).join(","),this.#a=n;const a=e.map(o=>o.trim()).filter(o=>o.indexOf(" ")<0&&o.indexOf(",")<0);a.length===e.length&&(this.#s=a)}addTriggerElements(t,e){if(this.#n.contains(e)){e.matches(this.#t)&&t.push(e);for(const n of e.querySelectorAll(this.#t))t.push(n)}}trigger(t){if(document.readyState!=="loading")if(this.#s&&Array.isArray(t))for(const e of t)this.#s.some(n=>e.matches(n))&&this.#o(e);else for(const e of this.#n.querySelectorAll(this.#t))this.#o(e)}#o(t){if(!H(t)&&!t.hasAttribute(this.#e)){t.setAttribute(this.#e,"");try{this.#a(t)}catch(e){P.error("Failed callback!",t,e)}}}}function H(s){if(!(s instanceof Element))return!1;const{blacklist:t}=v();return t.length>0&&t.some(e=>s.closest(e)!==null)}const $=Array.prototype.every,S=s=>s.nodeType===Node.TEXT_NODE;function C(s){const t=v();if(t.triggerPaused){t.triggerOnResume=!0;return}const e=Array.isArray(s),n=[];if(e){for(const a of s){const o=a.target;if(!H(o))switch(a.type){case"attributes":a.oldValue!==o.getAttribute(a.attributeName)&&n.push(a);break;case"childList":(!$.call(a.addedNodes,S)||!$.call(a.removedNodes,S))&&n.push(a);break}}if(n.length===0)return}if(n.length>500&&(t.triggerAll=!0),!t.triggerAll)if(e)for(const a of n){const o=a.target;switch(a.type){case"attributes":t.triggerElements.push(o);break;case"childList":for(const c of t.callbacks)c.addTriggerElements(t.triggerElements,o);break}}else t.triggerAll=!0;(t.triggerAll||t.triggerElements.length>0)&&!t.triggerFrame&&(t.triggerFrame=window.requestAnimationFrame(()=>{const a=t.triggerAll?void 0:t.triggerElements;t.triggerAll=!1,t.triggerElements=[],t.triggerFrame=0,t.callbacks.forEach(o=>o.trigger(a))}))}function z(){C(),new MutationObserver(C).observe(document,{attributes:!0,attributeFilter:["class","data-bsp-autosubmit","data-chart-type","data-code-type","data-internal-name","data-tab","name","rel","target"],attributeOldValue:!0,childList:!0,subtree:!0})}function D(){const s=v();s.initialized||(s.initialized=!0,document.readyState==="loading"?document.addEventListener("DOMContentLoaded",z):z())}function b(s,t,e){D();let n,a;typeof e<"u"?(n=s,a=t):(n=document,a=s,e=t);const o=new O(n,a,e);return o.trigger(),v().callbacks.push(o),()=>{const{callbacks:c}=v(),m=c.indexOf(o);m!==-1&&c.splice(m,1)}}b.triggerCallbacks=C;b.pause=()=>{v().triggerPaused=!0};b.resume=()=>{const s=v();s.triggerPaused=!1,s.triggerOnResume&&(s.triggerOnResume=!1,setTimeout(C,100))};b.ignore=(...s)=>{const{blacklist:t}=v();for(const e of s){try{document.querySelector(e)}catch{continue}t.includes(e)||t.push(e)}};const{expect:d,userEvent:r,waitFor:u,within:k}=__STORYBOOK_MODULE_TEST__,R={title:"Utilities/onFind",tags:["autodocs"],parameters:{docs:{subtitle:"The `onFind` utility observes DOM mutations and executes callbacks when elements matching specified selectors appear. Uses MutationObserver internally to efficiently track element additions and attribute changes."},controls:{expanded:!0}},argTypes:{selector:{control:{type:"text"},description:"CSS selector to watch for"}},args:{selector:".dynamic-item"}},h={render:s=>{const t=`onfind-${Math.random().toString(36).substring(2,9)}`,e=`.dynamic-item-${t}`;let n=0,a=0;const o=()=>{const i=document.getElementById(`${t}-items-count`),l=document.getElementById(`${t}-found-count`);i&&(i.textContent=String(n)),l&&(l.textContent=String(a))};return p(e,i=>{a++,o(),i.classList.add("ring-2","ring-success-500")}),f`
2
2
  <div class="space-y-4">
3
3
  <div class="text-base">
4
4
  <p class="mb-2">
@@ -35,7 +35,7 @@ import{x as f}from"./iframe-CufEXQ5F.js";import{l as P,o as b}from"./onFind-C7Wi
35
35
  </div>
36
36
  </div>
37
37
  </div>
38
- `},parameters:{docs:{description:{story:"Interactive example showing onFind detecting dynamically added elements. Elements are automatically highlighted when detected."}}},play:async({canvasElement:s,step:t})=>{const e=k(s);await t("Detects dynamically added element",async()=>{await c.click(e.getByTestId("add-item")),await u(()=>d(e.getByTestId("found-count")).toHaveTextContent("1"))}),await t("Detects multiple elements",async()=>{await c.click(e.getByTestId("add-item")),await c.click(e.getByTestId("add-item")),await u(()=>d(e.getByTestId("found-count")).toHaveTextContent("3"))}),await t("Clear resets counts",async()=>{await c.click(e.getByTestId("clear-items")),d(e.getByTestId("items-count")).toHaveTextContent("0"),d(e.getByTestId("found-count")).toHaveTextContent("0")}),await t("Detection resumes after clear",async()=>{await c.click(e.getByTestId("add-item")),await u(()=>d(e.getByTestId("found-count")).toHaveTextContent("1"))})}},B={render:()=>{const s="onfind-ignore-demo",t=".ignore-demo-item",e="ignore-demo-zone";let n=0,a=0;const o=()=>{const i=document.getElementById(`${s}-found-count`);i&&(i.textContent=String(n))};return b.ignore(`.${e}`),b(t,i=>{n++,o(),i.classList.add("ring-2","ring-success-500")}),f`
38
+ `},parameters:{docs:{description:{story:"Interactive example showing onFind detecting dynamically added elements. Elements are automatically highlighted when detected."}}},play:async({canvasElement:s,step:t})=>{const e=k(s);await t("Detects dynamically added element",async()=>{await r.click(e.getByTestId("add-item")),await u(()=>d(e.getByTestId("found-count")).toHaveTextContent("1"))}),await t("Detects multiple elements",async()=>{await r.click(e.getByTestId("add-item")),await r.click(e.getByTestId("add-item")),await u(()=>d(e.getByTestId("found-count")).toHaveTextContent("3"))}),await t("Clear resets counts",async()=>{await r.click(e.getByTestId("clear-items")),d(e.getByTestId("items-count")).toHaveTextContent("0"),d(e.getByTestId("found-count")).toHaveTextContent("0")}),await t("Detection resumes after clear",async()=>{await r.click(e.getByTestId("add-item")),await u(()=>d(e.getByTestId("found-count")).toHaveTextContent("1"))})}},B={render:()=>{const s="onfind-ignore-demo",t=".ignore-demo-item",e="ignore-demo-zone";let n=0,a=0;const o=()=>{const i=document.getElementById(`${s}-found-count`);i&&(i.textContent=String(n))};return p.ignore(`.${e}`),p(t,i=>{n++,o(),i.classList.add("ring-2","ring-success-500")}),f`
39
39
  <div class="space-y-4">
40
40
  <p class="text-base">
41
41
  Elements added inside the <strong>ignored zone</strong> are skipped by onFind callbacks. Elements added
@@ -80,7 +80,7 @@ import{x as f}from"./iframe-CufEXQ5F.js";import{l as P,o as b}from"./onFind-C7Wi
80
80
  </div>
81
81
  </div>
82
82
  </div>
83
- `},parameters:{docs:{description:{story:"Demonstrates `onFind.ignore()` — elements inside ignored containers are excluded from callback processing. Useful for skipping rich-text editors or other zones where DOM mutations should not trigger component initialization."}}},play:async({canvasElement:s,step:t})=>{const e=k(s);await t("Detects outside ignored zone",async()=>{await c.click(e.getByTestId("add-outside")),await u(()=>d(e.getByTestId("ignore-found-count")).toHaveTextContent("1"))}),await t("Skips inside ignored zone",async()=>{await c.click(e.getByTestId("add-inside")),await new Promise(n=>requestAnimationFrame(()=>requestAnimationFrame(n))),d(e.getByTestId("ignore-found-count")).toHaveTextContent("1")}),await t("Continues detecting outside",async()=>{await c.click(e.getByTestId("add-outside")),await u(()=>d(e.getByTestId("ignore-found-count")).toHaveTextContent("2"))})}},I={render:()=>{const s="onfind-pause-demo",t=".pause-demo-item";let e=0,n=0;const a=()=>{const i=document.getElementById(`${s}-found-count`);i&&(i.textContent=String(e))};b(t,i=>{e++,a(),i.classList.add("ring-2","ring-success-500")});const o=()=>{n++;const i=document.getElementById(`${s}-container`);if(i){const l=document.createElement("div");l.className=`${t.slice(1)} rounded border bg-white p-4`,l.textContent=`Item ${n}`,i.appendChild(l)}};let r=!1;return f`
83
+ `},parameters:{docs:{description:{story:"Demonstrates `onFind.ignore()` — elements inside ignored containers are excluded from callback processing. Useful for skipping rich-text editors or other zones where DOM mutations should not trigger component initialization."}}},play:async({canvasElement:s,step:t})=>{const e=k(s);await t("Detects outside ignored zone",async()=>{await r.click(e.getByTestId("add-outside")),await u(()=>d(e.getByTestId("ignore-found-count")).toHaveTextContent("1"))}),await t("Skips inside ignored zone",async()=>{await r.click(e.getByTestId("add-inside")),await new Promise(n=>requestAnimationFrame(()=>requestAnimationFrame(n))),d(e.getByTestId("ignore-found-count")).toHaveTextContent("1")}),await t("Continues detecting outside",async()=>{await r.click(e.getByTestId("add-outside")),await u(()=>d(e.getByTestId("ignore-found-count")).toHaveTextContent("2"))})}},I={render:()=>{const s="onfind-pause-demo",t=".pause-demo-item";let e=0,n=0;const a=()=>{const i=document.getElementById(`${s}-found-count`);i&&(i.textContent=String(e))};p(t,i=>{e++,a(),i.classList.add("ring-2","ring-success-500")});const o=()=>{n++;const i=document.getElementById(`${s}-container`);if(i){const l=document.createElement("div");l.className=`${t.slice(1)} rounded border bg-white p-4`,l.textContent=`Item ${n}`,i.appendChild(l)}};let c=!1;return f`
84
84
  <div class="space-y-4">
85
85
  <p class="text-base">
86
86
  Use <code>onFind.pause()</code> to temporarily stop detection and <code>onFind.resume()</code> to restart it.
@@ -91,7 +91,7 @@ import{x as f}from"./iframe-CufEXQ5F.js";import{l as P,o as b}from"./onFind-C7Wi
91
91
  <button data-testid="pause-add" @click=${o} class="btu-button btu-button-primary btu-button-sm">
92
92
  Add Item
93
93
  </button>
94
- <button data-testid="toggle-pause" @click=${()=>{r=!r,r?b.pause():b.resume();const i=document.querySelector('[data-testid="toggle-pause"]');i&&(i.textContent=r?"Resume":"Pause",i.className=r?"btu-button btu-button-success btu-button-sm":"btu-button btu-button-warning btu-button-sm")}} class="btu-button btu-button-warning btu-button-sm">
94
+ <button data-testid="toggle-pause" @click=${()=>{c=!c,c?p.pause():p.resume();const i=document.querySelector('[data-testid="toggle-pause"]');i&&(i.textContent=c?"Resume":"Pause",i.className=c?"btu-button btu-button-success btu-button-sm":"btu-button btu-button-warning btu-button-sm")}} class="btu-button btu-button-warning btu-button-sm">
95
95
  Pause
96
96
  </button>
97
97
  </div>
@@ -111,7 +111,7 @@ import{x as f}from"./iframe-CufEXQ5F.js";import{l as P,o as b}from"./onFind-C7Wi
111
111
  </div>
112
112
  </div>
113
113
  </div>
114
- `},parameters:{docs:{description:{story:"Demonstrates `onFind.pause()` and `onFind.resume()`. While paused, DOM mutations are queued and processed when resumed."}}},play:async({canvasElement:s,step:t})=>{const e=k(s);await t("Normal detection before pause",async()=>{await c.click(e.getByTestId("pause-add")),await u(()=>d(e.getByTestId("pause-found-count")).toHaveTextContent("1"))}),await t("Pause stops detection",async()=>{await c.click(e.getByTestId("toggle-pause")),await c.click(e.getByTestId("pause-add")),await new Promise(n=>setTimeout(n,200)),d(e.getByTestId("pause-found-count")).toHaveTextContent("1")}),await t("Resume triggers pending detection",async()=>{await c.click(e.getByTestId("toggle-pause")),await u(()=>d(e.getByTestId("pause-found-count")).toHaveTextContent("2"),{timeout:2e3})})}},w={render:()=>{const s=b,t=".singleton-item-a",e=".singleton-item-b";let n=0,a=0;const o=()=>{const g=document.getElementById("singleton-count-a"),h=document.getElementById("singleton-count-b");g&&(g.textContent=String(n)),h&&(h.textContent=String(a))};s.ignore(".singleton-ignored-zone"),s(t,g=>{n++,o(),g.classList.add("ring-2","ring-blue-500")}),m(e,g=>{a++,o(),g.classList.add("ring-2","ring-purple-500")});const r=(g,h,M)=>{const A=document.getElementById(M);if(A){const E=document.createElement("div");E.className=`${g.slice(1)} rounded border bg-white p-4`,E.textContent=h,A.appendChild(E)}};let p=!1;return f`
114
+ `},parameters:{docs:{description:{story:"Demonstrates `onFind.pause()` and `onFind.resume()`. While paused, DOM mutations are queued and processed when resumed."}}},play:async({canvasElement:s,step:t})=>{const e=k(s);await t("Normal detection before pause",async()=>{await r.click(e.getByTestId("pause-add")),await u(()=>d(e.getByTestId("pause-found-count")).toHaveTextContent("1"))}),await t("Pause stops detection",async()=>{await r.click(e.getByTestId("toggle-pause")),await r.click(e.getByTestId("pause-add")),await new Promise(n=>setTimeout(n,200)),d(e.getByTestId("pause-found-count")).toHaveTextContent("1")}),await t("Resume triggers pending detection",async()=>{await r.click(e.getByTestId("toggle-pause")),await u(()=>d(e.getByTestId("pause-found-count")).toHaveTextContent("2"),{timeout:2e3})})}},w={render:()=>{const s=p,t=".singleton-item-a",e=".singleton-item-b";let n=0,a=0;const o=()=>{const g=document.getElementById("singleton-count-a"),x=document.getElementById("singleton-count-b");g&&(g.textContent=String(n)),x&&(x.textContent=String(a))};s.ignore(".singleton-ignored-zone"),s(t,g=>{n++,o(),g.classList.add("ring-2","ring-blue-500")}),b(e,g=>{a++,o(),g.classList.add("ring-2","ring-purple-500")});const c=(g,x,M)=>{const A=document.getElementById(M);if(A){const E=document.createElement("div");E.className=`${g.slice(1)} rounded border bg-white p-4`,E.textContent=x,A.appendChild(E)}};let m=!1;return f`
115
115
  <div class="space-y-4">
116
116
  <p class="text-base">
117
117
  Two separate ES module instances of <code>onFind</code> (each with its own <code>_state</code> cache) share
@@ -121,7 +121,7 @@ import{x as f}from"./iframe-CufEXQ5F.js";import{l as P,o as b}from"./onFind-C7Wi
121
121
  <div class="flex items-center gap-4">
122
122
  <button
123
123
  data-testid="singleton-toggle-pause"
124
- @click=${()=>{p=!p,p?s.pause():s.resume();const g=document.querySelector('[data-testid="singleton-toggle-pause"]');g&&(g.textContent=p?"Resume":"Pause",g.className=p?"btu-button btu-button-success btu-button-sm":"btu-button btu-button-warning btu-button-sm")}}
124
+ @click=${()=>{m=!m,m?s.pause():s.resume();const g=document.querySelector('[data-testid="singleton-toggle-pause"]');g&&(g.textContent=m?"Resume":"Pause",g.className=m?"btu-button btu-button-success btu-button-sm":"btu-button btu-button-warning btu-button-sm")}}
125
125
  class="btu-button btu-button-warning btu-button-sm"
126
126
  >
127
127
  Pause
@@ -144,14 +144,14 @@ import{x as f}from"./iframe-CufEXQ5F.js";import{l as P,o as b}from"./onFind-C7Wi
144
144
  <div class="mb-2 flex gap-1">
145
145
  <button
146
146
  data-testid="singleton-add-a"
147
- @click=${()=>r(t,"Bundle A item","singleton-zone-a")}
147
+ @click=${()=>c(t,"Bundle A item","singleton-zone-a")}
148
148
  class="btu-button btu-button-primary btu-button-sm"
149
149
  >
150
150
  Add A
151
151
  </button>
152
152
  <button
153
153
  data-testid="singleton-zone-a-add-b"
154
- @click=${()=>r(e,"Bundle B item","singleton-zone-a")}
154
+ @click=${()=>c(e,"Bundle B item","singleton-zone-a")}
155
155
  class="btu-button btu-button-purple btu-button-sm"
156
156
  >
157
157
  Add B
@@ -166,14 +166,14 @@ import{x as f}from"./iframe-CufEXQ5F.js";import{l as P,o as b}from"./onFind-C7Wi
166
166
  <div class="mb-2 flex gap-1">
167
167
  <button
168
168
  data-testid="singleton-zone-b-add-a"
169
- @click=${()=>r(t,"Bundle A item","singleton-zone-b")}
169
+ @click=${()=>c(t,"Bundle A item","singleton-zone-b")}
170
170
  class="btu-button btu-button-primary btu-button-sm"
171
171
  >
172
172
  Add A
173
173
  </button>
174
174
  <button
175
175
  data-testid="singleton-add-b"
176
- @click=${()=>r(e,"Bundle B item","singleton-zone-b")}
176
+ @click=${()=>c(e,"Bundle B item","singleton-zone-b")}
177
177
  class="btu-button btu-button-purple btu-button-sm"
178
178
  >
179
179
  Add B
@@ -188,7 +188,7 @@ import{x as f}from"./iframe-CufEXQ5F.js";import{l as P,o as b}from"./onFind-C7Wi
188
188
  <div class="mb-2 flex gap-1">
189
189
  <button
190
190
  data-testid="singleton-add-ignored"
191
- @click=${()=>{r(t,"Ignored A","singleton-ignored"),r(e,"Ignored B","singleton-ignored")}}
191
+ @click=${()=>{c(t,"Ignored A","singleton-ignored"),c(e,"Ignored B","singleton-ignored")}}
192
192
  class="btu-button btu-button-gray btu-button-sm"
193
193
  >
194
194
  Add A & B
@@ -203,7 +203,7 @@ import{x as f}from"./iframe-CufEXQ5F.js";import{l as P,o as b}from"./onFind-C7Wi
203
203
  </div>
204
204
  </div>
205
205
  </div>
206
- `},parameters:{docs:{description:{story:"Two independent module instances of `onFind` (simulating separate bundles) share a single MutationObserver, ignore list, and pause/resume state through the `globalThis[Symbol.for()]` singleton pattern."}}},play:async({canvasElement:s,step:t})=>{const e=k(s);await t("Shared observer: Bundle A detects A items, Bundle B detects B items",async()=>{await c.click(e.getByTestId("singleton-add-a")),await u(()=>d(e.getByTestId("singleton-count-a")).toHaveTextContent("1")),await c.click(e.getByTestId("singleton-add-b")),await u(()=>d(e.getByTestId("singleton-count-b")).toHaveTextContent("1"))}),await t("Cross-zone detection fires correct callback",async()=>{await c.click(e.getByTestId("singleton-zone-a-add-b")),await u(()=>d(e.getByTestId("singleton-count-b")).toHaveTextContent("2")),d(e.getByTestId("singleton-count-a")).toHaveTextContent("1"),await c.click(e.getByTestId("singleton-zone-b-add-a")),await u(()=>d(e.getByTestId("singleton-count-a")).toHaveTextContent("2")),d(e.getByTestId("singleton-count-b")).toHaveTextContent("2")}),await t("Shared ignore list: Bundle A ignore() blocks Bundle B callbacks",async()=>{const n=e.getByTestId("singleton-count-a").textContent,a=e.getByTestId("singleton-count-b").textContent;await c.click(e.getByTestId("singleton-add-ignored")),await new Promise(o=>requestAnimationFrame(()=>requestAnimationFrame(o))),d(e.getByTestId("singleton-count-a")).toHaveTextContent(n),d(e.getByTestId("singleton-count-b")).toHaveTextContent(a)}),await t("Ignore lists are merged and deduped across bundles",async()=>{const n=globalThis[Symbol.for("brightspot.onFind")],a=n.blacklist.length;m.ignore(".singleton-ignored-zone"),d(n.blacklist.length).toBe(a),m.ignore(".bundle-b-ignored"),d(n.blacklist).toContain(".singleton-ignored-zone"),d(n.blacklist).toContain(".bundle-b-ignored"),d(n.blacklist.length).toBe(a+1)}),await t("Shared pause/resume: Bundle A pause() stops Bundle B detection",async()=>{await c.click(e.getByTestId("singleton-toggle-pause")),await c.click(e.getByTestId("singleton-add-a")),await c.click(e.getByTestId("singleton-add-b")),await new Promise(n=>setTimeout(n,200)),d(e.getByTestId("singleton-count-a")).toHaveTextContent("2"),d(e.getByTestId("singleton-count-b")).toHaveTextContent("2"),await c.click(e.getByTestId("singleton-toggle-pause")),await u(()=>d(e.getByTestId("singleton-count-a")).toHaveTextContent("3"),{timeout:2e3}),await u(()=>d(e.getByTestId("singleton-count-b")).toHaveTextContent("3"),{timeout:2e3})}),await t("No index collision on data-ofc attributes",async()=>{const n=s.querySelectorAll(".singleton-item-a, .singleton-item-b"),a=new Set;n.forEach(o=>{o.getAttributeNames().filter(r=>r.startsWith("data-ofc")).forEach(r=>a.add(r))}),d(a.size).toBeGreaterThanOrEqual(2)}),await t("Singleton state: both bundles share the same globalThis object",async()=>{const n=globalThis[Symbol.for("brightspot.onFind")];d(n).toBeDefined(),d(n.callbacks).toBeDefined(),d(Array.isArray(n.callbacks)).toBe(!0),d(n.initialized).toBe(!0),d(b.pause).not.toBe(m.pause),d(b.resume).not.toBe(m.resume)})}},T={render:()=>f`
206
+ `},parameters:{docs:{description:{story:"Two independent module instances of `onFind` (simulating separate bundles) share a single MutationObserver, ignore list, and pause/resume state through the `globalThis[Symbol.for()]` singleton pattern."}}},play:async({canvasElement:s,step:t})=>{const e=k(s);await t("Shared observer: Bundle A detects A items, Bundle B detects B items",async()=>{await r.click(e.getByTestId("singleton-add-a")),await u(()=>d(e.getByTestId("singleton-count-a")).toHaveTextContent("1")),await r.click(e.getByTestId("singleton-add-b")),await u(()=>d(e.getByTestId("singleton-count-b")).toHaveTextContent("1"))}),await t("Cross-zone detection fires correct callback",async()=>{await r.click(e.getByTestId("singleton-zone-a-add-b")),await u(()=>d(e.getByTestId("singleton-count-b")).toHaveTextContent("2")),d(e.getByTestId("singleton-count-a")).toHaveTextContent("1"),await r.click(e.getByTestId("singleton-zone-b-add-a")),await u(()=>d(e.getByTestId("singleton-count-a")).toHaveTextContent("2")),d(e.getByTestId("singleton-count-b")).toHaveTextContent("2")}),await t("Shared ignore list: Bundle A ignore() blocks Bundle B callbacks",async()=>{const n=e.getByTestId("singleton-count-a").textContent,a=e.getByTestId("singleton-count-b").textContent;await r.click(e.getByTestId("singleton-add-ignored")),await new Promise(o=>requestAnimationFrame(()=>requestAnimationFrame(o))),d(e.getByTestId("singleton-count-a")).toHaveTextContent(n),d(e.getByTestId("singleton-count-b")).toHaveTextContent(a)}),await t("Ignore lists are merged and deduped across bundles",async()=>{const n=globalThis[Symbol.for("brightspot.onFind")],a=n.blacklist.length;b.ignore(".singleton-ignored-zone"),d(n.blacklist.length).toBe(a),b.ignore(".bundle-b-ignored"),d(n.blacklist).toContain(".singleton-ignored-zone"),d(n.blacklist).toContain(".bundle-b-ignored"),d(n.blacklist.length).toBe(a+1)}),await t("Shared pause/resume: Bundle A pause() stops Bundle B detection",async()=>{await r.click(e.getByTestId("singleton-toggle-pause")),await r.click(e.getByTestId("singleton-add-a")),await r.click(e.getByTestId("singleton-add-b")),await new Promise(n=>setTimeout(n,200)),d(e.getByTestId("singleton-count-a")).toHaveTextContent("2"),d(e.getByTestId("singleton-count-b")).toHaveTextContent("2"),await r.click(e.getByTestId("singleton-toggle-pause")),await u(()=>d(e.getByTestId("singleton-count-a")).toHaveTextContent("3"),{timeout:2e3}),await u(()=>d(e.getByTestId("singleton-count-b")).toHaveTextContent("3"),{timeout:2e3})}),await t("No index collision on data-ofc attributes",async()=>{const n=s.querySelectorAll(".singleton-item-a, .singleton-item-b"),a=new Set;n.forEach(o=>{o.getAttributeNames().filter(c=>c.startsWith("data-ofc")).forEach(c=>a.add(c))}),d(a.size).toBeGreaterThanOrEqual(2)}),await t("Singleton state: both bundles share the same globalThis object",async()=>{const n=globalThis[Symbol.for("brightspot.onFind")];d(n).toBeDefined(),d(n.callbacks).toBeDefined(),d(Array.isArray(n.callbacks)).toBe(!0),d(n.initialized).toBe(!0),d(p.pause).not.toBe(b.pause),d(p.resume).not.toBe(b.resume)})}},T={render:()=>f`
207
207
  <div class="space-y-4 text-sm">
208
208
  <div>
209
209
  <h3 class="mb-2 font-bold">Basic Usage</h3>
@@ -336,7 +336,7 @@ onFind.ignore('.ProseMirror', '.RichTextEditor')
336
336
  </p>
337
337
  </div>
338
338
  </div>
339
- `,parameters:{docs:{description:{story:"Code examples and documentation for using the onFind utility."}}}};x.parameters={...x.parameters,docs:{...x.parameters?.docs,source:{originalSource:`{
339
+ `,parameters:{docs:{description:{story:"Code examples and documentation for using the onFind utility."}}}};h.parameters={...h.parameters,docs:{...h.parameters?.docs,source:{originalSource:`{
340
340
  render: args => {
341
341
  const instanceId = \`onfind-\${Math.random().toString(36).substring(2, 9)}\`;
342
342
  const uniqueSelector = \`.dynamic-item-\${instanceId}\`;
@@ -445,7 +445,7 @@ onFind.ignore('.ProseMirror', '.RichTextEditor')
445
445
  await waitFor(() => expect(canvas.getByTestId('found-count')).toHaveTextContent('1'));
446
446
  });
447
447
  }
448
- }`,...x.parameters?.docs?.source}}};B.parameters={...B.parameters,docs:{...B.parameters?.docs,source:{originalSource:`{
448
+ }`,...h.parameters?.docs?.source}}};B.parameters={...B.parameters,docs:{...B.parameters?.docs,source:{originalSource:`{
449
449
  render: () => {
450
450
  const instanceId = 'onfind-ignore-demo';
451
451
  const itemSelector = '.ignore-demo-item';
@@ -1042,4 +1042,4 @@ onFind.ignore('.ProseMirror', '.RichTextEditor')
1042
1042
  }
1043
1043
  }
1044
1044
  }
1045
- }`,...T.parameters?.docs?.source}}};const U=["Interactive","Ignore","PauseResume","Singleton","UsageExample"];export{B as Ignore,x as Interactive,I as PauseResume,w as Singleton,T as UsageExample,U as __namedExportsOrder,R as default};
1045
+ }`,...T.parameters?.docs?.source}}};const U=["Interactive","Ignore","PauseResume","Singleton","UsageExample"];export{B as Ignore,h as Interactive,I as PauseResume,w as Singleton,T as UsageExample,U as __namedExportsOrder,R as default};
@@ -1,4 +1,4 @@
1
- import{x as p}from"./iframe-CufEXQ5F.js";import"./preload-helper-PPVm8Dsz.js";let l=!1;function m(e,o){const s=new MutationObserver(r=>{for(const v of r)for(const n of v.removedNodes)n.contains(e)&&!l&&(s.disconnect(),o())});s.observe(document,{childList:!0,subtree:!0})}m.pause=()=>{l=!0};m.resume=()=>{l=!1};const h={title:"Utilities/onRemove",tags:["autodocs"],parameters:{docs:{subtitle:"The `onRemove` utility triggers a callback when a DOM element is removed from the document. Uses MutationObserver to watch for removals, with global pause/resume support."},controls:{expanded:!0}},argTypes:{selector:{control:{type:"text"},description:"CSS selector of element to watch"}},args:{selector:".watched-item"}},i={render:()=>{const e=`onremove-${Math.random().toString(36).substring(2,9)}`;let o=0,s=0;const r=()=>{const n=document.getElementById(`${e}-items-count`),t=document.getElementById(`${e}-removed-count`);n&&(n.textContent=String(o)),t&&(t.textContent=String(s))};return p`
1
+ import{x as p}from"./iframe-DNJdsh5L.js";import"./preload-helper-PPVm8Dsz.js";let l=!1;function m(e,o){const s=new MutationObserver(r=>{for(const v of r)for(const n of v.removedNodes)n.contains(e)&&!l&&(s.disconnect(),o())});s.observe(document,{childList:!0,subtree:!0})}m.pause=()=>{l=!0};m.resume=()=>{l=!1};const h={title:"Utilities/onRemove",tags:["autodocs"],parameters:{docs:{subtitle:"The `onRemove` utility triggers a callback when a DOM element is removed from the document. Uses MutationObserver to watch for removals, with global pause/resume support."},controls:{expanded:!0}},argTypes:{selector:{control:{type:"text"},description:"CSS selector of element to watch"}},args:{selector:".watched-item"}},i={render:()=>{const e=`onremove-${Math.random().toString(36).substring(2,9)}`;let o=0,s=0;const r=()=>{const n=document.getElementById(`${e}-items-count`),t=document.getElementById(`${e}-removed-count`);n&&(n.textContent=String(o)),t&&(t.textContent=String(s))};return p`
2
2
  <div class="space-y-4">
3
3
  <div class="text-base">
4
4
  <p class="mb-2">
@@ -1,4 +1,4 @@
1
- import{x as d}from"./iframe-CufEXQ5F.js";import{o as g}from"./onFind-C7Wi8jr6.js";import"./preload-helper-PPVm8Dsz.js";const b=Symbol.for("brightspot.onVisible");let t;function v(){return t||(t=globalThis[b],t||(t={calledIndex:0},globalThis[b]=t),t)}function h(i,r){const s=`_ovc${v().calledIndex++}`,n=new IntersectionObserver(e=>{for(const o of e)if(o.isIntersecting){const c=o.target,m=c.classList;m.contains(s)||(m.add(s),n.unobserve(c),r(c))}});g(i,e=>{n.observe(e)})}const f={title:"Utilities/onVisible",tags:["autodocs"],parameters:{docs:{subtitle:"The `onVisible` utility triggers a callback once when elements matching a selector become visible in the viewport. Combines `onFind` with `IntersectionObserver` for lazy initialization of dynamically added elements."},controls:{expanded:!0}},argTypes:{selector:{control:{type:"text"},description:"CSS selector to watch for visibility"}},args:{selector:".lazy-item"}},l={render:()=>{const i=`onvisible-${Math.random().toString(36).substring(2,9)}`,r=`.lazy-item-${i}`;let s=0;const n=()=>{const e=document.getElementById(`${i}-visible-count`);e&&(e.textContent=String(s))};return h(r,e=>{s++,n(),e.classList.remove("opacity-30"),e.classList.add("ring-2","ring-success-500","opacity-100"),e.textContent+=" — visible!"}),d`
1
+ import{x as d}from"./iframe-DNJdsh5L.js";import{o as g}from"./onFind-AbVF4rYD.js";import"./preload-helper-PPVm8Dsz.js";const b=Symbol.for("brightspot.onVisible");let t;function v(){return t||(t=globalThis[b],t||(t={calledIndex:0},globalThis[b]=t),t)}function h(i,r){const s=`_ovc${v().calledIndex++}`,n=new IntersectionObserver(e=>{for(const o of e)if(o.isIntersecting){const c=o.target,m=c.classList;m.contains(s)||(m.add(s),n.unobserve(c),r(c))}});g(i,e=>{n.observe(e)})}const f={title:"Utilities/onVisible",tags:["autodocs"],parameters:{docs:{subtitle:"The `onVisible` utility triggers a callback once when elements matching a selector become visible in the viewport. Combines `onFind` with `IntersectionObserver` for lazy initialization of dynamically added elements."},controls:{expanded:!0}},argTypes:{selector:{control:{type:"text"},description:"CSS selector to watch for visibility"}},args:{selector:".lazy-item"}},l={render:()=>{const i=`onvisible-${Math.random().toString(36).substring(2,9)}`,r=`.lazy-item-${i}`;let s=0;const n=()=>{const e=document.getElementById(`${i}-visible-count`);e&&(e.textContent=String(s))};return h(r,e=>{s++,n(),e.classList.remove("opacity-30"),e.classList.add("ring-2","ring-success-500","opacity-100"),e.textContent+=" — visible!"}),d`
2
2
  <div class="space-y-4">
3
3
  <div class="text-base">
4
4
  <p class="mb-2">
@@ -1 +1 @@
1
- import{e as l,ae as u,af as c,ag as a}from"./iframe-CufEXQ5F.js";const o="important",d=" !"+o,h=l(class extends u{constructor(s){if(super(s),s.type!==c.ATTRIBUTE||s.name!=="style"||s.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(s){return Object.keys(s).reduce(((n,t)=>{const e=s[t];return e==null?n:n+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${e};`}),"")}update(s,[n]){const{style:t}=s.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(n)),this.render(n);for(const e of this.ft)n[e]==null&&(this.ft.delete(e),e.includes("-")?t.removeProperty(e):t[e]=null);for(const e in n){const r=n[e];if(r!=null){this.ft.add(e);const i=typeof r=="string"&&r.endsWith(d);e.includes("-")||i?t.setProperty(e,i?r.slice(0,-11):r,i?o:""):t[e]=r}}return a}});export{h as o};
1
+ import{e as l,ae as u,af as c,ag as a}from"./iframe-DNJdsh5L.js";const o="important",d=" !"+o,h=l(class extends u{constructor(s){if(super(s),s.type!==c.ATTRIBUTE||s.name!=="style"||s.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(s){return Object.keys(s).reduce(((n,t)=>{const e=s[t];return e==null?n:n+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${e};`}),"")}update(s,[n]){const{style:t}=s.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(n)),this.render(n);for(const e of this.ft)n[e]==null&&(this.ft.delete(e),e.includes("-")?t.removeProperty(e):t[e]=null);for(const e in n){const r=n[e];if(r!=null){this.ft.add(e);const i=typeof r=="string"&&r.endsWith(d);e.includes("-")||i?t.setProperty(e,i?r.slice(0,-11):r,i?o:""):t[e]=r}}return a}});export{h as o};