zss-engine 0.2.27 → 0.2.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/utils/inject-client-global-css.js +3 -3
- package/dist/esm/utils/inject-client-global-css.js +3 -3
- package/package.json +1 -1
- package/types/index.d.ts +4 -4
- package/types/types/common/css-properties.d.ts +3 -3
- package/types/types/main/create.d.ts +3 -3
- package/types/types/main/global.d.ts +12 -12
- package/types/types/main/vars.d.ts +2 -4
- package/types/utils/hash.d.ts +2 -2
- package/types/utils/inject-client-global-css.d.ts +1 -1
- package/types/utils/transpiler.d.ts +2 -2
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.injectClientGlobalCSS = injectClientGlobalCSS;
|
|
4
4
|
const index_js_1 = require("../index.js");
|
|
5
|
-
function injectClientGlobalCSS(sheet
|
|
5
|
+
function injectClientGlobalCSS(sheet) {
|
|
6
6
|
if (index_js_1.isServer)
|
|
7
7
|
return;
|
|
8
|
-
const existingStyleElement = document.querySelector(`[data-scope="
|
|
8
|
+
const existingStyleElement = document.querySelector(`[data-scope="global"]`);
|
|
9
9
|
if (existingStyleElement instanceof HTMLStyleElement) {
|
|
10
10
|
existingStyleElement.textContent += sheet;
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
13
|
const styleElement = document.createElement('style');
|
|
14
|
-
styleElement.setAttribute('data-scope',
|
|
14
|
+
styleElement.setAttribute('data-scope', 'global');
|
|
15
15
|
styleElement.setAttribute('type', 'text/css');
|
|
16
16
|
styleElement.textContent = sheet;
|
|
17
17
|
document.head.appendChild(styleElement);
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { isServer } from '../index.js';
|
|
2
|
-
export function injectClientGlobalCSS(sheet
|
|
2
|
+
export function injectClientGlobalCSS(sheet) {
|
|
3
3
|
if (isServer)
|
|
4
4
|
return;
|
|
5
|
-
const existingStyleElement = document.querySelector(`[data-scope="
|
|
5
|
+
const existingStyleElement = document.querySelector(`[data-scope="global"]`);
|
|
6
6
|
if (existingStyleElement instanceof HTMLStyleElement) {
|
|
7
7
|
existingStyleElement.textContent += sheet;
|
|
8
8
|
return;
|
|
9
9
|
}
|
|
10
10
|
const styleElement = document.createElement('style');
|
|
11
|
-
styleElement.setAttribute('data-scope',
|
|
11
|
+
styleElement.setAttribute('data-scope', 'global');
|
|
12
12
|
styleElement.setAttribute('type', 'text/css');
|
|
13
13
|
styleElement.textContent = sheet;
|
|
14
14
|
document.head.appendChild(styleElement);
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export type {
|
|
2
|
-
export type { CreateStyle,
|
|
3
|
-
export type {
|
|
4
|
-
export type {
|
|
1
|
+
export type { CSSProperties } from './types/common/css-properties';
|
|
2
|
+
export type { CreateStyle, ReturnType, ClassesStyle } from './types/main/create';
|
|
3
|
+
export type { CSSHTML, CreateKeframes } from './types/main/global';
|
|
4
|
+
export type { CreateVars, CreateTheme } from './types/main/vars';
|
|
5
5
|
export { isServer, isDevelopment, isDevAndTest } from './utils/helper.js';
|
|
6
6
|
export { genBase36Hash } from './utils/hash.js';
|
|
7
7
|
export { transpiler } from './utils/transpiler.js';
|
|
@@ -5,11 +5,11 @@ type CSSColorProperty = Exclude<ColorValue, SystemColorKeyword>;
|
|
|
5
5
|
type SystemColorKeyword = 'ActiveBorder' | 'ActiveCaption' | 'AppWorkspace' | 'Background' | 'ButtonFace' | 'ButtonHighlight' | 'ButtonShadow' | 'ButtonText' | 'CaptionText' | 'GrayText' | 'Highlight' | 'HighlightText' | 'InactiveBorder' | 'InactiveCaption' | 'InactiveCaptionText' | 'InfoBackground' | 'InfoText' | 'Menu' | 'MenuText' | 'Scrollbar' | 'ThreeDDarkShadow' | 'ThreeDFace' | 'ThreeDHighlight' | 'ThreeDLightShadow' | 'ThreeDShadow' | 'Window' | 'WindowFrame' | 'WindowText';
|
|
6
6
|
type ExcludeMozInitial<T> = Exclude<T, '-moz-initial'>;
|
|
7
7
|
type CSSTypeProperties = Properties<number | (string & {})>;
|
|
8
|
-
type
|
|
8
|
+
type CustomProperties = {
|
|
9
9
|
[K in keyof CSSTypeProperties]: ExcludeMozInitial<CSSTypeProperties[K]>;
|
|
10
10
|
};
|
|
11
11
|
type BaseCSSProperties = {
|
|
12
|
-
[K in keyof
|
|
12
|
+
[K in keyof CustomProperties]: CustomProperties[K] | CSSVariableValue;
|
|
13
13
|
};
|
|
14
14
|
interface CommonProperties extends BaseCSSProperties {
|
|
15
15
|
accentColor?: CSSColorProperty;
|
|
@@ -42,5 +42,5 @@ export type MediaQuery = `@media ${string}`;
|
|
|
42
42
|
type MediaQueryType = {
|
|
43
43
|
[K in MediaQuery]: CommonProperties | ColonType | AndStringType;
|
|
44
44
|
};
|
|
45
|
-
export type
|
|
45
|
+
export type CSSProperties = CommonProperties | ColonType | CSSVariableProperty | AndStringType | MediaQueryType;
|
|
46
46
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CSSProperties } from '../common/css-properties';
|
|
2
2
|
export type CreateStyle<T> = {
|
|
3
|
-
readonly [K in keyof T]: T[K] extends
|
|
3
|
+
readonly [K in keyof T]: T[K] extends CSSProperties ? CSSProperties : T[K];
|
|
4
4
|
};
|
|
5
5
|
export type ClassesStyle = {
|
|
6
|
-
[key: string]:
|
|
6
|
+
[key: string]: CSSProperties;
|
|
7
7
|
};
|
|
8
8
|
export type ReturnType<T> = {
|
|
9
9
|
[key in keyof T]: string;
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CSSProperties, MediaQuery } from '../common/css-properties';
|
|
2
2
|
type JSXType = keyof HTMLElementTagNameMap | '*' | ':root';
|
|
3
3
|
type HTMLType = {
|
|
4
|
-
[K in JSXType]:
|
|
4
|
+
[K in JSXType]: CSSProperties;
|
|
5
5
|
};
|
|
6
6
|
type ClassName = `.${string}`;
|
|
7
7
|
type ClassNameType = {
|
|
8
|
-
[K in ClassName]:
|
|
8
|
+
[K in ClassName]: CSSProperties;
|
|
9
9
|
};
|
|
10
10
|
type Attribute = `${string}[${string}]${string}`;
|
|
11
11
|
type AttributeType = {
|
|
12
|
-
[K in Attribute]:
|
|
12
|
+
[K in Attribute]: CSSProperties;
|
|
13
13
|
};
|
|
14
14
|
type Consecutive = `${JSXType} ${string}`;
|
|
15
15
|
type ConsecutiveType = {
|
|
16
|
-
[K in Consecutive]:
|
|
16
|
+
[K in Consecutive]: CSSProperties;
|
|
17
17
|
};
|
|
18
18
|
type PseudoClass = `${JSXType}:${string}`;
|
|
19
19
|
type PseudoClassType = {
|
|
20
|
-
[K in PseudoClass]:
|
|
20
|
+
[K in PseudoClass]: CSSProperties;
|
|
21
21
|
};
|
|
22
22
|
type PseudoElement = `::${string}`;
|
|
23
23
|
type PseudoElementType = {
|
|
24
|
-
[K in PseudoElement]:
|
|
24
|
+
[K in PseudoElement]: CSSProperties;
|
|
25
25
|
};
|
|
26
26
|
type KeyframeSelector = 'from' | 'to' | `${number}%`;
|
|
27
|
-
export type
|
|
28
|
-
[K in KeyframeSelector]?:
|
|
27
|
+
export type CreateKeframes = {
|
|
28
|
+
[K in KeyframeSelector]?: CSSProperties;
|
|
29
29
|
};
|
|
30
30
|
type KeyframesType = {
|
|
31
|
-
[K in `@keyframes ${string}`]:
|
|
31
|
+
[K in `@keyframes ${string}`]: CreateKeframes;
|
|
32
32
|
};
|
|
33
33
|
type MediaQueryHTMLType = {
|
|
34
|
-
[K in MediaQuery]:
|
|
34
|
+
[K in MediaQuery]: CSSHTML;
|
|
35
35
|
};
|
|
36
|
-
export type
|
|
36
|
+
export type CSSHTML = HTMLType | ClassNameType | AttributeType | ConsecutiveType | PseudoClassType | PseudoElementType | KeyframesType | MediaQueryHTMLType;
|
|
37
37
|
export {};
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
export type VarsDefinition = Record<string, string | number | Record<string, string | number>>;
|
|
2
1
|
type CSSVariableKey = `--${string}`;
|
|
3
2
|
export type CSSVariableValue = `var(${CSSVariableKey})`;
|
|
4
3
|
export type CSSVariableProperty = {
|
|
5
4
|
[key: CSSVariableKey]: string | number;
|
|
6
5
|
};
|
|
7
|
-
export type
|
|
8
|
-
|
|
9
|
-
};
|
|
6
|
+
export type CreateVars = Record<string, string | number>;
|
|
7
|
+
export type CreateTheme = Record<string, Record<string, string | number>>;
|
|
10
8
|
export {};
|
package/types/utils/hash.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ClassesStyle,
|
|
2
|
-
export declare function genBase36Hash(object: ClassesStyle |
|
|
1
|
+
import { ClassesStyle, CreateKeframes } from '../index.js';
|
|
2
|
+
export declare function genBase36Hash(object: ClassesStyle | CreateKeframes, n: number): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function injectClientGlobalCSS(sheet: string
|
|
1
|
+
export declare function injectClientGlobalCSS(sheet: string): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function transpiler(object:
|
|
1
|
+
import type { CSSHTML } from '../index.js';
|
|
2
|
+
export declare function transpiler(object: CSSHTML, base36Hash?: string, core?: string): {
|
|
3
3
|
styleSheet: string;
|
|
4
4
|
};
|