New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@blueprintui/typewriter

Package Overview
Dependencies
Maintainers
1
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blueprintui/typewriter - npm Package Compare versions

Comparing version 1.0.3 to 1.1.0

2

internals/controllers/keynav.controller.js

@@ -1,1 +0,1 @@

import{getFlattenedFocusableItems as t}from"../utils/traversal.js";import{validKeyNavigationCode as e,getNextKeyGridItem as i}from"../utils/keynav.js";import{initializeKeyListItems as s,simpleFocusable as o,getActiveElement as n,setActiveKeyListItem as l,focusElement as h}from"../utils/focus.js";import{contextMenuClick as r}from"../utils/dom.js";import{onFirstInteraction as a,onChildListMutation as c}from"../utils/events.js";function d(t){return e=>e.addInitializer((e=>new f(e,t)))}class f{host;fn;#t=[];get#e(){return this.#i.host||this.host}get#s(){return this.#i.grid}get#o(){return Array.from(this.#s.flat())}get#n(){return Array.from(this.#o).find((t=>0===t.tabIndex))}get#i(){return{manageFocus:!0,manageTabindex:!0,loop:!1,lazy:!1,...this.fn(this.host)}}constructor(t,e){this.host=t,this.fn=e,this.host.addController(this)}async hostConnected(){await this.host.updateComplete,await(this.#i.lazy?a(this.#e):new Promise((t=>setTimeout((()=>t(null)),0)))),this.#l(),this.#e.addEventListener("pointerup",(t=>this.#h(t))),this.#e.addEventListener("keydown",(t=>this.#r(t))),this.#e.addEventListener("keyup",(t=>this.#a(t))),this.#t.push(c(this.#e,(()=>this.#l())))}hostDisconnected(){this.#t.forEach((t=>t.disconnect()))}#l(){this.#i.manageFocus&&this.#i.manageTabindex&&s(this.#o)}#h(t){if(!r(t)){const e=t.composedPath().find((t=>this.#o.find((e=>e===t))));e&&this.#c(t,e)}}#r(t){if(e(t)&&o(n())){const{x:e,y:s}=i(this.#s,{code:t.code,loop:this.#i.loop,ctrlKey:t.ctrlKey,dir:this.#e.dir});this.#c(t,this.#s[s][e]),t.preventDefault()}}#c(e,i){if(this.#i.manageFocus){this.#i.manageTabindex&&l(this.#o,i);const s=t(i).filter((t=>!t.hidden&&!t.ariaHidden)),n=s.filter((t=>o(t)));1===n.length&&1===s.length?h(n[0]):h(i),"pointerup"!==e.type&&e.preventDefault()}i.dispatchEvent(new CustomEvent("bpKeyChange",{bubbles:!0,detail:{code:e.code,shiftKey:e.shiftKey,metaKey:e.ctrlKey||e.metaKey,activeItem:i}}))}#a(e){"Escape"===e.code&&this.#n?.focus(),"Enter"===e.code&&this.#n===e.composedPath()[0]&&t(this.#n)[0]?.focus()}}export{f as KeynavController,d as keynav};
import{getFlattenedFocusableItems as t}from"../utils/traversal.js";import{validKeyNavigationCode as e,getNextKeyGridItem as i}from"../utils/keynav.js";import{initializeKeyListItems as s,simpleFocusable as o,getActiveElement as n,setActiveKeyListItem as l,focusElement as h}from"../utils/focus.js";import{contextMenuClick as r}from"../utils/dom.js";import{onFirstInteraction as a,onChildListMutation as c}from"../utils/events.js";function d(t){return e=>e.addInitializer((e=>new f(e,t)))}class f{host;fn;#t=[];get#e(){return this.#i.host||this.host}get#s(){return this.#i.grid}get#o(){return Array.from(this.#s.flat())}get#n(){return Array.from(this.#o).find((t=>0===t.tabIndex))}get#i(){return{manageFocus:!0,manageTabindex:!0,loop:!1,lazy:!1,...this.fn(this.host)}}constructor(t,e){this.host=t,this.fn=e,this.host.addController(this)}async hostConnected(){await this.host.updateComplete,await(this.#i.lazy?a(this.#e):new Promise((t=>setTimeout((()=>t(null)),0)))),this.#l(),this.#e.addEventListener("pointerup",(t=>this.#h(t))),this.#e.addEventListener("keydown",(t=>this.#r(t))),this.#e.addEventListener("keyup",(t=>this.#a(t))),this.#t.push(c(this.#e,(()=>this.#l())))}hostDisconnected(){this.#t.forEach((t=>t.disconnect()))}#l(){this.#i.manageFocus&&this.#i.manageTabindex&&s(this.#o)}#h(t){if(!r(t)){const e=t.composedPath().find((t=>this.#o.find((e=>e===t))));e&&this.#c(t,e)}}#r(t){if(e(t)&&o(n())){const{x:e,y:s}=i(this.#s,{code:t.code,loop:this.#i.loop,ctrlKey:t.ctrlKey,dir:this.#e.dir});this.#c(t,this.#s[s][e]),t.preventDefault()}}#c(e,i){if(this.#i.manageFocus){this.#i.manageTabindex&&l(this.#o,i);const s=t(i).filter((t=>!t.hidden&&!t.ariaHidden)),n=s.filter((t=>o(t)));1===n.length&&1===s.length?h(n[0]):h(i),"pointerup"!==e.type&&e.preventDefault()}i.dispatchEvent(new CustomEvent("bp-keychange",{bubbles:!0,detail:{code:e.code,shiftKey:e.shiftKey,metaKey:e.ctrlKey||e.metaKey,activeItem:i}}))}#a(e){"Escape"===e.code&&this.#n?.focus(),"Enter"===e.code&&this.#n===e.composedPath()[0]&&t(this.#n)[0]?.focus()}}export{f as KeynavController,d as keynav};
{
"name": "@blueprintui/typewriter",
"version": "1.0.3",
"version": "1.1.0",
"type": "module",

@@ -5,0 +5,0 @@ "types": "./index.d.ts",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc