Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@github/text-expander-element

Package Overview
Dependencies
Maintainers
15
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@github/text-expander-element - npm Package Compare versions

Comparing version 2.5.0 to 2.6.0

30

dist/bundle.js

@@ -322,2 +322,23 @@ const ctrlBindings = !!navigator.userAgent.match(/Macintosh/);

const states = new WeakMap();
function isTopLayer(el) {
try {
if (el.matches(':popover-open'))
return true;
}
catch (_a) {
}
try {
if (el.matches('dialog:modal'))
return true;
}
catch (_b) {
}
try {
if (el.matches(':fullscreen'))
return true;
}
catch (_c) {
}
return false;
}
class TextExpander {

@@ -366,3 +387,9 @@ constructor(expander, input) {

this.combobox = new Combobox(this.input, menu);
const { top, left } = textFieldSelectionPosition(this.input, match.position);
this.expander.dispatchEvent(new Event('text-expander-activate'));
let { top, left } = textFieldSelectionPosition(this.input, match.position);
if (isTopLayer(menu)) {
const rect = this.input.getBoundingClientRect();
top += rect.top;
left += rect.left;
}
menu.style.top = `${top}px`;

@@ -379,2 +406,3 @@ menu.style.left = `${left}px`;

return false;
this.expander.dispatchEvent(new Event('text-expander-deactivate'));
this.menu = null;

@@ -381,0 +409,0 @@ menu.removeEventListener('combobox-commit', this.oncommit);

@@ -152,2 +152,23 @@ import Combobox from '@github/combobox-nav';

const states = new WeakMap();
function isTopLayer(el) {
try {
if (el.matches(':popover-open'))
return true;
}
catch (_a) {
}
try {
if (el.matches('dialog:modal'))
return true;
}
catch (_b) {
}
try {
if (el.matches(':fullscreen'))
return true;
}
catch (_c) {
}
return false;
}
class TextExpander {

@@ -196,3 +217,9 @@ constructor(expander, input) {

this.combobox = new Combobox(this.input, menu);
const { top, left } = textFieldSelectionPosition(this.input, match.position);
this.expander.dispatchEvent(new Event('text-expander-activate'));
let { top, left } = textFieldSelectionPosition(this.input, match.position);
if (isTopLayer(menu)) {
const rect = this.input.getBoundingClientRect();
top += rect.top;
left += rect.left;
}
menu.style.top = `${top}px`;

@@ -209,2 +236,3 @@ menu.style.left = `${left}px`;

return false;
this.expander.dispatchEvent(new Event('text-expander-deactivate'));
this.menu = null;

@@ -211,0 +239,0 @@ menu.removeEventListener('combobox-commit', this.oncommit);

@@ -5,2 +5,23 @@ import Combobox from '@github/combobox-nav';

const states = new WeakMap();
function isTopLayer(el) {
try {
if (el.matches(':popover-open'))
return true;
}
catch (_a) {
}
try {
if (el.matches('dialog:modal'))
return true;
}
catch (_b) {
}
try {
if (el.matches(':fullscreen'))
return true;
}
catch (_c) {
}
return false;
}
class TextExpander {

@@ -49,3 +70,9 @@ constructor(expander, input) {

this.combobox = new Combobox(this.input, menu);
const { top, left } = textFieldSelectionPosition(this.input, match.position);
this.expander.dispatchEvent(new Event('text-expander-activate'));
let { top, left } = textFieldSelectionPosition(this.input, match.position);
if (isTopLayer(menu)) {
const rect = this.input.getBoundingClientRect();
top += rect.top;
left += rect.left;
}
menu.style.top = `${top}px`;

@@ -62,2 +89,3 @@ menu.style.left = `${left}px`;

return false;
this.expander.dispatchEvent(new Event('text-expander-deactivate'));
this.menu = null;

@@ -64,0 +92,0 @@ menu.removeEventListener('combobox-commit', this.oncommit);

2

package.json
{
"name": "@github/text-expander-element",
"version": "2.5.0",
"version": "2.6.0",
"description": "Activates a suggestion menu to expand text snippets as you type.",

@@ -5,0 +5,0 @@ "repository": "github/text-expander-element",

@@ -108,2 +108,6 @@ # <text-expander> element

**`text-expander-activate`** is fired just after the menu has been assigned and appended to the DOM, and just before it is about to be positioned near the text to expand. This is useful for assigning classes or calling imperative methods to show the menu, such as `.showPopover()`.
**`text-expander-dectivate`** is fired just before the menu is goind to be unassigned and removed from the DOM. This is useful for removing classes or running cleanup like removing from caches.
## Browser support

@@ -110,0 +114,0 @@

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