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

@rambler-tech/dom

Package Overview
Dependencies
Maintainers
0
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rambler-tech/dom - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

4

CHANGELOG.md

@@ -6,2 +6,6 @@ # Change Log

## [0.2.1](https://github.com/rambler-digital-solutions/rambler-common/compare/@rambler-tech/dom@0.2.0...@rambler-tech/dom@0.2.1) (2024-09-27)
**Note:** Version bump only for package @rambler-tech/dom
# [0.2.0](https://github.com/rambler-digital-solutions/rambler-common/compare/@rambler-tech/dom@0.1.0...@rambler-tech/dom@0.2.0) (2024-09-06)

@@ -8,0 +12,0 @@

18

dist/index.js

@@ -1,7 +0,4 @@

"use strict";
/* eslint-disable import/no-unused-modules */
Object.defineProperty(exports, "__esModule", { value: true });
exports.loadScript = exports.loadStyleSheet = exports.injectStyleSheet = void 0;
/** Inject style sheet to DOM */
function injectStyleSheet(cssText, attributes = {}) {
export function injectStyleSheet(cssText, attributes = {}) {
const style = document.createElement('style');

@@ -16,10 +13,8 @@ style.textContent = cssText;

}
exports.injectStyleSheet = injectStyleSheet;
const REGISTRY = '__ASSETS_REGISTRY__';
globalThis[REGISTRY] = {};
/** Load style sheet */
function loadStyleSheet(source) {
export function loadStyleSheet(source) {
var _a;
var _b;
(_a = (_b = globalThis[REGISTRY])[source]) !== null && _a !== void 0 ? _a : (_b[source] = new Promise((resolve, reject) => {
(_a = globalThis[REGISTRY])[source] ?? (_a[source] = new Promise((resolve, reject) => {
const link = document.createElement('link');

@@ -38,8 +33,6 @@ link.rel = 'stylesheet';

}
exports.loadStyleSheet = loadStyleSheet;
/** Load script */
function loadScript(source, attributes = {}) {
export function loadScript(source, attributes = {}) {
var _a;
var _b;
(_a = (_b = globalThis[REGISTRY])[source]) !== null && _a !== void 0 ? _a : (_b[source] = new Promise((resolve, reject) => {
(_a = globalThis[REGISTRY])[source] ?? (_a[source] = new Promise((resolve, reject) => {
const script = document.createElement('script');

@@ -64,2 +57,1 @@ script.src = source;

}
exports.loadScript = loadScript;

@@ -1,4 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const _1 = require(".");
import { injectStyleSheet } from '.';
test('inject style', () => {

@@ -9,3 +7,3 @@ const button = document.createElement('button');

expect(window.getComputedStyle(button).display).toBe('inline-block');
(0, _1.injectStyleSheet)('.test-button {display: flex;}');
injectStyleSheet('.test-button {display: flex;}');
expect(window.getComputedStyle(button).display).toBe('flex');

@@ -18,3 +16,3 @@ });

expect(window.getComputedStyle(button).display).toBe('inline-block');
const style = (0, _1.injectStyleSheet)('.test-button-2 {display: flex;}', {
const style = injectStyleSheet('.test-button-2 {display: flex;}', {
'data-scope': 'button'

@@ -21,0 +19,0 @@ });

{
"name": "@rambler-tech/dom",
"version": "0.2.0",
"version": "0.2.1",
"main": "dist",

@@ -12,3 +12,3 @@ "module": "dist",

},
"gitHead": "1fc7adc5c9141ed10da6c7e3f74d9f6ff3a41457"
"gitHead": "c051bf08ebfeb3f2541548469c3280dcb9fa4a2e"
}
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