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

@suid/css

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@suid/css - npm Package Compare versions

Comparing version 0.1.7 to 0.2.0

utils/array.d.ts

9

createStyleObject.d.ts

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

export declare type StyleObject = {
export type StyleObject = {
id: string;

@@ -7,8 +7,9 @@ name: string;

};
export declare type StyleObjectCache = Map<string, StyleObject>;
export declare type StyleProps = Record<string, any> | string | (Record<string, any> | string)[] | (() => Record<string, any> | string | (Record<string, any> | string)[]);
export declare type StyleObjectOptions = {
export type StyleObjectCache = Map<string, StyleObject>;
export type StyleProps = Record<string, any> | string | (Record<string, any> | string)[] | (() => Record<string, any> | string | (Record<string, any> | string)[]);
export type StyleObjectOptions = {
name: string;
props: StyleProps;
extraProperties?: Record<string, (value: any) => any>;
createId?: () => string;
cache?: StyleObjectCache;

@@ -15,0 +16,0 @@ };

import render from "./render";
import randomString from "@suid/utils/randomString";
import resolveFunction from "@suid/utils/resolveFunction";
import toArray from "@suid/utils/toArray";
function create(name, rules) {
const id = randomString().slice(0, 6);
import { toArray } from "./utils/array";
import { resolveFunction } from "./utils/function";
import { randomString } from "./utils/string";
function create(name, rules, id) {
return {
id,
name: name,
name,
className: `${name}-${id}`,

@@ -24,3 +23,4 @@ rules: rules.replaceAll(`$id`, `${id}`),

.join("\n");
const styleObject = options.cache?.get(rules) || create(options.name, rules);
const styleObject = options.cache?.get(rules) ||
create(options.name, rules, options.createId ? options.createId() : randomString().slice(0, 6));
if (options.cache)

@@ -27,0 +27,0 @@ options.cache.set(rules, styleObject);

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

declare function appendStyleElement(css: string | string[], attributes?: Record<string, any>): HTMLStyleElement;
declare function appendStyleElement(css: string | string[], attributes?: Record<string, any>, injectFirst?: boolean): HTMLStyleElement;
export default appendStyleElement;
//# sourceMappingURL=appendStyleElement.d.ts.map
import createStyleElement from "./createStyleElement";
import registerStyleElementUsage from "./registerStyleElementUsage";
import setStyleElementText from "./setStyleElementText";
function appendStyleElement(css, attributes) {
const placeholderId = "suid-injectFirst";
function appendStyleElement(css, attributes, injectFirst) {
if (Array.isArray(css))

@@ -20,3 +21,14 @@ css = css.join("\n");

registerStyleElementUsage(element);
head.appendChild(element);
if (injectFirst) {
let placeholderElement = head.querySelector(`#${placeholderId}`);
if (!placeholderElement) {
placeholderElement = document.createElement("style");
placeholderElement.setAttribute("id", placeholderId);
head.prepend(placeholderElement);
}
head.insertBefore(element, placeholderElement);
}
else {
head.appendChild(element);
}
return element;

@@ -23,0 +35,0 @@ }

{
"name": "@suid/css",
"version": "0.1.7",
"version": "0.2.0",
"description": "CSS render in JS.",

@@ -10,5 +10,2 @@ "keywords": [

],
"dependencies": {
"@suid/utils": "0.6.0"
},
"bugs": {

@@ -15,0 +12,0 @@ "url": "https://github.com/swordev/suid/issues"

# @suid/css
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/swordev/suid/CI) ![npm (scoped)](https://img.shields.io/npm/v/@suid/css?label=@suid/css)
[![workflow-badge]](https://github.com/swordev/suid/actions/workflows/ci.yaml) [![npm-badge]](https://www.npmjs.com/package/@suid/css)
[workflow-badge]: https://img.shields.io/github/actions/workflow/status/swordev/suid/ci.yaml?branch=main
[npm-badge]: https://img.shields.io/npm/v/@suid/css?label=@suid/css
## Installation

@@ -6,0 +9,0 @@

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

declare type RenderOptions = {
type RenderOptions = {
sublevel?: boolean;

@@ -3,0 +3,0 @@ extraProperties?: {

import { isGlobalSelector, isKeyframes, isMediaQuery, isSelector, isVar, isPrivateVar, } from "./assert";
import snakeCase from "@suid/utils/snakeCase";
import { snakeCase } from "./utils/string";
function renderSelector(propKey, propValue, selectors = [], options = {}) {

@@ -4,0 +4,0 @@ const subselectors = propKey.split(",").map((v) => {

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

export declare type MediaQueryComparatorType = {
export type MediaQueryComparatorType = {
up: number;

@@ -3,0 +3,0 @@ down: number;

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