pre-installations and preparations

This commit is contained in:
MuhammadKhalilzadeh committed 2024-05-05 11:21:00 +03:30
1 parent 3e5a0329cb
commit 201d621ac3
6977 files changed
+742826

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) Emotion team and other contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+1
View File
@@ -0,0 +1 @@
export * from '../types'
+59
View File
@@ -0,0 +1,59 @@
// Definitions by: Junyoung Clare Jang <https://github.com/Ailrun>
// TypeScript Version: 2.2
export interface RegisteredCache {
[key: string]: string
}
export interface StyleSheet {
container: HTMLElement
nonce?: string
key: string
insert(rule: string): void
flush(): void
tags: Array<HTMLStyleElement>
}
export interface EmotionCache {
inserted: {
[key: string]: string | true
}
registered: RegisteredCache
sheet: StyleSheet
key: string
compat?: true
nonce?: string
insert(
selector: string,
serialized: SerializedStyles,
sheet: StyleSheet,
shouldCache: boolean
): string | void
}
export interface SerializedStyles {
name: string
styles: string
map?: string
next?: SerializedStyles
}
export const isBrowser: boolean
export function getRegisteredStyles(
registered: RegisteredCache,
registeredStyles: Array<string>,
classNames: string
): string
export function registerStyles(
cache: EmotionCache,
serialized: SerializedStyles,
isStringTag: boolean
): void
export function insertStyles(
cache: EmotionCache,
serialized: SerializedStyles,
isStringTag: boolean
): string | void
+44
View File
@@ -0,0 +1,44 @@
var isBrowser = "object" !== 'undefined';
function getRegisteredStyles(registered, registeredStyles, classNames) {
var rawClassName = '';
classNames.split(' ').forEach(function (className) {
if (registered[className] !== undefined) {
registeredStyles.push(registered[className] + ";");
} else {
rawClassName += className + " ";
}
});
return rawClassName;
}
var registerStyles = function registerStyles(cache, serialized, isStringTag) {
var className = cache.key + "-" + serialized.name;
if ( // we only need to add the styles to the registered cache if the
// class name could be used further down
// the tree but if it's a string tag, we know it won't
// so we don't have to add it to registered cache.
// this improves memory usage since we can avoid storing the whole style string
(isStringTag === false || // we need to always store it if we're in compat mode and
// in node since emotion-server relies on whether a style is in
// the registered cache to know whether a style is global or not
// also, note that this check will be dead code eliminated in the browser
isBrowser === false ) && cache.registered[className] === undefined) {
cache.registered[className] = serialized.styles;
}
};
var insertStyles = function insertStyles(cache, serialized, isStringTag) {
registerStyles(cache, serialized, isStringTag);
var className = cache.key + "-" + serialized.name;
if (cache.inserted[serialized.name] === undefined) {
var current = serialized;
do {
cache.insert(serialized === current ? "." + className : '', current, cache.sheet, true);
current = current.next;
} while (current !== undefined);
}
};
export { getRegisteredStyles, insertStyles, registerStyles };
+2
View File
@@ -0,0 +1,2 @@
export * from "./declarations/src/index.js";
//# sourceMappingURL=emotion-utils.cjs.d.mts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"emotion-utils.cjs.d.mts","sourceRoot":"","sources":["./declarations/src/index.d.ts"],"names":[],"mappings":"AAAA"}
+2
View File
@@ -0,0 +1,2 @@
export * from "./declarations/src/index";
//# sourceMappingURL=emotion-utils.cjs.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"emotion-utils.cjs.d.ts","sourceRoot":"","sources":["./declarations/src/index.d.ts"],"names":[],"mappings":"AAAA"}
+59
View File
@@ -0,0 +1,59 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var isBrowser = typeof document !== 'undefined';
function getRegisteredStyles(registered, registeredStyles, classNames) {
var rawClassName = '';
classNames.split(' ').forEach(function (className) {
if (registered[className] !== undefined) {
registeredStyles.push(registered[className] + ";");
} else {
rawClassName += className + " ";
}
});
return rawClassName;
}
var registerStyles = function registerStyles(cache, serialized, isStringTag) {
var className = cache.key + "-" + serialized.name;
if ( // we only need to add the styles to the registered cache if the
// class name could be used further down
// the tree but if it's a string tag, we know it won't
// so we don't have to add it to registered cache.
// this improves memory usage since we can avoid storing the whole style string
(isStringTag === false || // we need to always store it if we're in compat mode and
// in node since emotion-server relies on whether a style is in
// the registered cache to know whether a style is global or not
// also, note that this check will be dead code eliminated in the browser
isBrowser === false && cache.compat !== undefined) && cache.registered[className] === undefined) {
cache.registered[className] = serialized.styles;
}
};
var insertStyles = function insertStyles(cache, serialized, isStringTag) {
registerStyles(cache, serialized, isStringTag);
var className = cache.key + "-" + serialized.name;
if (cache.inserted[serialized.name] === undefined) {
var stylesForSSR = '';
var current = serialized;
do {
var maybeStyles = cache.insert(serialized === current ? "." + className : '', current, cache.sheet, true);
if (!isBrowser && maybeStyles !== undefined) {
stylesForSSR += maybeStyles;
}
current = current.next;
} while (current !== undefined);
if (!isBrowser && stylesForSSR.length !== 0) {
return stylesForSSR;
}
}
};
exports.getRegisteredStyles = getRegisteredStyles;
exports.insertStyles = insertStyles;
exports.registerStyles = registerStyles;
+7
View File
@@ -0,0 +1,7 @@
'use strict';
if (process.env.NODE_ENV === "production") {
module.exports = require("./emotion-utils.cjs.prod.js");
} else {
module.exports = require("./emotion-utils.cjs.dev.js");
}
+2
View File
@@ -0,0 +1,2 @@
// @flow
export * from "../src/index.js";
+5
View File
@@ -0,0 +1,5 @@
export {
getRegisteredStyles,
insertStyles,
registerStyles
} from "./emotion-utils.cjs.js";
+59
View File
@@ -0,0 +1,59 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var isBrowser = typeof document !== 'undefined';
function getRegisteredStyles(registered, registeredStyles, classNames) {
var rawClassName = '';
classNames.split(' ').forEach(function (className) {
if (registered[className] !== undefined) {
registeredStyles.push(registered[className] + ";");
} else {
rawClassName += className + " ";
}
});
return rawClassName;
}
var registerStyles = function registerStyles(cache, serialized, isStringTag) {
var className = cache.key + "-" + serialized.name;
if ( // we only need to add the styles to the registered cache if the
// class name could be used further down
// the tree but if it's a string tag, we know it won't
// so we don't have to add it to registered cache.
// this improves memory usage since we can avoid storing the whole style string
(isStringTag === false || // we need to always store it if we're in compat mode and
// in node since emotion-server relies on whether a style is in
// the registered cache to know whether a style is global or not
// also, note that this check will be dead code eliminated in the browser
isBrowser === false && cache.compat !== undefined) && cache.registered[className] === undefined) {
cache.registered[className] = serialized.styles;
}
};
var insertStyles = function insertStyles(cache, serialized, isStringTag) {
registerStyles(cache, serialized, isStringTag);
var className = cache.key + "-" + serialized.name;
if (cache.inserted[serialized.name] === undefined) {
var stylesForSSR = '';
var current = serialized;
do {
var maybeStyles = cache.insert(serialized === current ? "." + className : '', current, cache.sheet, true);
if (!isBrowser && maybeStyles !== undefined) {
stylesForSSR += maybeStyles;
}
current = current.next;
} while (current !== undefined);
if (!isBrowser && stylesForSSR.length !== 0) {
return stylesForSSR;
}
}
};
exports.getRegisteredStyles = getRegisteredStyles;
exports.insertStyles = insertStyles;
exports.registerStyles = registerStyles;
+53
View File
@@ -0,0 +1,53 @@
var isBrowser = typeof document !== 'undefined';
function getRegisteredStyles(registered, registeredStyles, classNames) {
var rawClassName = '';
classNames.split(' ').forEach(function (className) {
if (registered[className] !== undefined) {
registeredStyles.push(registered[className] + ";");
} else {
rawClassName += className + " ";
}
});
return rawClassName;
}
var registerStyles = function registerStyles(cache, serialized, isStringTag) {
var className = cache.key + "-" + serialized.name;
if ( // we only need to add the styles to the registered cache if the
// class name could be used further down
// the tree but if it's a string tag, we know it won't
// so we don't have to add it to registered cache.
// this improves memory usage since we can avoid storing the whole style string
(isStringTag === false || // we need to always store it if we're in compat mode and
// in node since emotion-server relies on whether a style is in
// the registered cache to know whether a style is global or not
// also, note that this check will be dead code eliminated in the browser
isBrowser === false && cache.compat !== undefined) && cache.registered[className] === undefined) {
cache.registered[className] = serialized.styles;
}
};
var insertStyles = function insertStyles(cache, serialized, isStringTag) {
registerStyles(cache, serialized, isStringTag);
var className = cache.key + "-" + serialized.name;
if (cache.inserted[serialized.name] === undefined) {
var stylesForSSR = '';
var current = serialized;
do {
var maybeStyles = cache.insert(serialized === current ? "." + className : '', current, cache.sheet, true);
if (!isBrowser && maybeStyles !== undefined) {
stylesForSSR += maybeStyles;
}
current = current.next;
} while (current !== undefined);
if (!isBrowser && stylesForSSR.length !== 0) {
return stylesForSSR;
}
}
};
export { getRegisteredStyles, insertStyles, registerStyles };
+52
View File
@@ -0,0 +1,52 @@
function getRegisteredStyles(registered, registeredStyles, classNames) {
var rawClassName = '';
classNames.split(' ').forEach(function (className) {
if (registered[className] !== undefined) {
registeredStyles.push(registered[className] + ";");
} else {
rawClassName += className + " ";
}
});
return rawClassName;
}
var registerStyles = function registerStyles(cache, serialized, isStringTag) {
var className = cache.key + "-" + serialized.name;
if ( // we only need to add the styles to the registered cache if the
// class name could be used further down
// the tree but if it's a string tag, we know it won't
// so we don't have to add it to registered cache.
// this improves memory usage since we can avoid storing the whole style string
(isStringTag === false || // we need to always store it if we're in compat mode and
// in node since emotion-server relies on whether a style is in
// the registered cache to know whether a style is global or not
// also, note that this check will be dead code eliminated in the browser
cache.compat !== undefined) && cache.registered[className] === undefined) {
cache.registered[className] = serialized.styles;
}
};
var insertStyles = function insertStyles(cache, serialized, isStringTag) {
registerStyles(cache, serialized, isStringTag);
var className = cache.key + "-" + serialized.name;
if (cache.inserted[serialized.name] === undefined) {
var stylesForSSR = '';
var current = serialized;
do {
var maybeStyles = cache.insert(serialized === current ? "." + className : '', current, cache.sheet, true);
if (maybeStyles !== undefined) {
stylesForSSR += maybeStyles;
}
current = current.next;
} while (current !== undefined);
if (stylesForSSR.length !== 0) {
return stylesForSSR;
}
}
};
export { getRegisteredStyles, insertStyles, registerStyles };
+48
View File
@@ -0,0 +1,48 @@
{
"name": "@emotion/utils",
"version": "1.2.1",
"description": "internal utils for emotion",
"main": "dist/emotion-utils.cjs.js",
"module": "dist/emotion-utils.esm.js",
"browser": {
"./dist/emotion-utils.esm.js": "./dist/emotion-utils.browser.esm.js"
},
"exports": {
".": {
"module": {
"worker": "./dist/emotion-utils.worker.esm.js",
"browser": "./dist/emotion-utils.browser.esm.js",
"default": "./dist/emotion-utils.esm.js"
},
"import": "./dist/emotion-utils.cjs.mjs",
"default": "./dist/emotion-utils.cjs.js"
},
"./package.json": "./package.json"
},
"types": "types/index.d.ts",
"license": "MIT",
"scripts": {
"test:typescript": "dtslint types"
},
"repository": "https://github.com/emotion-js/emotion/tree/main/packages/utils",
"publishConfig": {
"access": "public"
},
"files": [
"src",
"dist",
"types/*.d.ts"
],
"devDependencies": {
"@definitelytyped/dtslint": "0.0.112",
"typescript": "^4.5.5"
},
"preconstruct": {
"exports": {
"envConditions": [
"browser",
"worker"
]
}
}
}
+1
View File
@@ -0,0 +1 @@
export * from '../types'
+77
View File
@@ -0,0 +1,77 @@
// @flow
import type { RegisteredCache, EmotionCache, SerializedStyles } from './types'
const isBrowser = typeof document !== 'undefined'
export function getRegisteredStyles(
registered: RegisteredCache,
registeredStyles: string[],
classNames: string
) {
let rawClassName = ''
classNames.split(' ').forEach(className => {
if (registered[className] !== undefined) {
registeredStyles.push(`${registered[className]};`)
} else {
rawClassName += `${className} `
}
})
return rawClassName
}
export const registerStyles = (
cache: EmotionCache,
serialized: SerializedStyles,
isStringTag: boolean
) => {
let className = `${cache.key}-${serialized.name}`
if (
// we only need to add the styles to the registered cache if the
// class name could be used further down
// the tree but if it's a string tag, we know it won't
// so we don't have to add it to registered cache.
// this improves memory usage since we can avoid storing the whole style string
(isStringTag === false ||
// we need to always store it if we're in compat mode and
// in node since emotion-server relies on whether a style is in
// the registered cache to know whether a style is global or not
// also, note that this check will be dead code eliminated in the browser
(isBrowser === false && cache.compat !== undefined)) &&
cache.registered[className] === undefined
) {
cache.registered[className] = serialized.styles
}
}
export const insertStyles = (
cache: EmotionCache,
serialized: SerializedStyles,
isStringTag: boolean
) => {
registerStyles(cache, serialized, isStringTag)
let className = `${cache.key}-${serialized.name}`
if (cache.inserted[serialized.name] === undefined) {
let stylesForSSR = ''
let current = serialized
do {
let maybeStyles = cache.insert(
serialized === current ? `.${className}` : '',
current,
cache.sheet,
true
)
if (!isBrowser && maybeStyles !== undefined) {
stylesForSSR += maybeStyles
}
current = current.next
} while (current !== undefined)
if (!isBrowser && stylesForSSR.length !== 0) {
return stylesForSSR
}
}
}
export * from './types'
+28
View File
@@ -0,0 +1,28 @@
// @flow
import type { StyleSheet } from '@emotion/sheet'
export type RegisteredCache = { [string]: string }
export type Interpolation = any
export type SerializedStyles = {|
name: string,
styles: string,
map?: string,
next?: SerializedStyles
|}
export type EmotionCache = {
inserted: { [string]: string | true },
registered: RegisteredCache,
sheet: StyleSheet,
key: string,
compat?: true,
nonce?: string,
insert: (
selector: string,
serialized: SerializedStyles,
sheet: StyleSheet,
shouldCache: boolean
) => string | void
}
+59
View File
@@ -0,0 +1,59 @@
// Definitions by: Junyoung Clare Jang <https://github.com/Ailrun>
// TypeScript Version: 2.2
export interface RegisteredCache {
[key: string]: string
}
export interface StyleSheet {
container: HTMLElement
nonce?: string
key: string
insert(rule: string): void
flush(): void
tags: Array<HTMLStyleElement>
}
export interface EmotionCache {
inserted: {
[key: string]: string | true
}
registered: RegisteredCache
sheet: StyleSheet
key: string
compat?: true
nonce?: string
insert(
selector: string,
serialized: SerializedStyles,
sheet: StyleSheet,
shouldCache: boolean
): string | void
}
export interface SerializedStyles {
name: string
styles: string
map?: string
next?: SerializedStyles
}
export const isBrowser: boolean
export function getRegisteredStyles(
registered: RegisteredCache,
registeredStyles: Array<string>,
classNames: string
): string
export function registerStyles(
cache: EmotionCache,
serialized: SerializedStyles,
isStringTag: boolean
): void
export function insertStyles(
cache: EmotionCache,
serialized: SerializedStyles,
isStringTag: boolean
): string | void