🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@griffel/core

Package Overview
Dependencies
Maintainers
6
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@griffel/core - npm Package Compare versions

Comparing version

to
1.14.3

runtime/utils/trimSelector.cjs.js

2

package.json
{
"name": "@griffel/core",
"version": "1.14.2",
"version": "1.14.3",
"description": "DOM implementation of Atomic CSS-in-JS",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -21,2 +21,3 @@ 'use strict';

var hashPropertyKey = require('./utils/hashPropertyKey.cjs.js');
var trimSelector = require('./utils/trimSelector.cjs.js');
var warnAboutUnresolvedRule = require('./warnings/warnAboutUnresolvedRule.cjs.js');

@@ -73,4 +74,5 @@ var warnAboutUnsupportedProperties = require('./warnings/warnAboutUnsupportedProperties.cjs.js');

if (typeof value === 'string' || typeof value === 'number') {
const selector = trimSelector.trimSelector(selectors.join(''));
// uniq key based on a hash of property & selector, used for merging later
const key = hashPropertyKey.hashPropertyKey(selectors, container, media, support, property);
const key = hashPropertyKey.hashPropertyKey(selector, container, media, support, property);
const className = hashClassName.hashClassName({

@@ -82,3 +84,3 @@ container,

support,
selectors,
selector,
property

@@ -95,3 +97,3 @@ });

property: rtlDefinition.key,
selectors,
selector,
media,

@@ -157,3 +159,4 @@ layer,

}
const key = hashPropertyKey.hashPropertyKey(selectors, container, media, support, property);
const selector = trimSelector.trimSelector(selectors.join(''));
const key = hashPropertyKey.hashPropertyKey(selector, container, media, support, property);
const className = hashClassName.hashClassName({

@@ -165,3 +168,3 @@ container,

support,
selectors,
selector,
property

@@ -185,3 +188,3 @@ });

property: rtlDefinitions[0].key,
selectors,
selector,
layer,

@@ -188,0 +191,0 @@ media,

@@ -17,2 +17,3 @@ import hashString from '@emotion/hash';

import { hashPropertyKey } from './utils/hashPropertyKey.esm.js';
import { trimSelector } from './utils/trimSelector.esm.js';
import { warnAboutUnresolvedRule } from './warnings/warnAboutUnresolvedRule.esm.js';

@@ -65,4 +66,5 @@ import { warnAboutUnsupportedProperties } from './warnings/warnAboutUnsupportedProperties.esm.js';

if (typeof value === 'string' || typeof value === 'number') {
const selector = trimSelector(selectors.join(''));
// uniq key based on a hash of property & selector, used for merging later
const key = hashPropertyKey(selectors, container, media, support, property);
const key = hashPropertyKey(selector, container, media, support, property);
const className = hashClassName({

@@ -74,3 +76,3 @@ container,

support,
selectors,
selector,
property

@@ -87,3 +89,3 @@ });

property: rtlDefinition.key,
selectors,
selector,
media,

@@ -149,3 +151,4 @@ layer,

}
const key = hashPropertyKey(selectors, container, media, support, property);
const selector = trimSelector(selectors.join(''));
const key = hashPropertyKey(selector, container, media, support, property);
const className = hashClassName({

@@ -157,3 +160,3 @@ container,

support,
selectors,
selector,
property

@@ -177,3 +180,3 @@ });

property: rtlDefinitions[0].key,
selectors,
selector,
layer,

@@ -180,0 +183,0 @@ media,

@@ -17,8 +17,9 @@ 'use strict';

property,
selectors,
selector,
support,
value
}) {
const classNameHash = hashString__default["default"](selector + container + media + layer + support + property +
// Trimming of value is required to generate consistent hashes
const classNameHash = hashString__default["default"](selectors.join('') + container + media + layer + support + property + value.trim());
value.trim());
return constants.HASH_PREFIX + classNameHash;

@@ -25,0 +26,0 @@ }

@@ -9,8 +9,9 @@ import hashString from '@emotion/hash';

property,
selectors,
selector,
support,
value
}) {
const classNameHash = hashString(selector + container + media + layer + support + property +
// Trimming of value is required to generate consistent hashes
const classNameHash = hashString(selectors.join('') + container + media + layer + support + property + value.trim());
value.trim());
return HASH_PREFIX + classNameHash;

@@ -17,0 +18,0 @@ }

@@ -11,5 +11,5 @@ 'use strict';

function hashPropertyKey(selectors, container, media, support, property) {
function hashPropertyKey(selector, container, media, support, property) {
// uniq key based on property & selector, used for merging later
const computedKey = selectors.join('') + container + media + support + property;
const computedKey = selector + container + media + support + property;
// "key" can be really long as it includes selectors, we use hashes to reduce sizes of keys

@@ -27,3 +27,3 @@ // ".foo :hover" => "abcd"

if (startsWithNumber) {
return String.fromCharCode(firstCharCode + 17) + hashedKey.substr(1);
return String.fromCharCode(firstCharCode + 17) + hashedKey.slice(1);
}

@@ -30,0 +30,0 @@ return hashedKey;

import hashString from '@emotion/hash';
function hashPropertyKey(selectors, container, media, support, property) {
function hashPropertyKey(selector, container, media, support, property) {
// uniq key based on property & selector, used for merging later
const computedKey = selectors.join('') + container + media + support + property;
const computedKey = selector + container + media + support + property;
// "key" can be really long as it includes selectors, we use hashes to reduce sizes of keys

@@ -18,3 +18,3 @@ // ".foo :hover" => "abcd"

if (startsWithNumber) {
return String.fromCharCode(firstCharCode + 17) + hashedKey.substr(1);
return String.fromCharCode(firstCharCode + 17) + hashedKey.slice(1);
}

@@ -21,0 +21,0 @@ return hashedKey;

interface HashedClassNameParts {
property: string;
value: string;
selectors: string[];
selector: string;
media: string;

@@ -10,3 +10,3 @@ layer: string;

}
export declare function hashClassName({ container, media, layer, property, selectors, support, value, }: HashedClassNameParts): string;
export declare function hashClassName({ container, media, layer, property, selector, support, value, }: HashedClassNameParts): string;
export {};
import { PropertyHash } from '../../types';
export declare function hashPropertyKey(selectors: string[], container: string, media: string, support: string, property: string): PropertyHash;
export declare function hashPropertyKey(selector: string, container: string, media: string, support: string, property: string): PropertyHash;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet