@tenphi/tasty 0.13.1 → 0.14.0
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/README.md +117 -28
- package/dist/config.d.ts +13 -1
- package/dist/config.js +5 -1
- package/dist/config.js.map +1 -1
- package/dist/core/index.d.ts +5 -3
- package/dist/core/index.js +4 -3
- package/dist/debug.d.ts +26 -141
- package/dist/debug.js +356 -635
- package/dist/debug.js.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.js +4 -3
- package/dist/parser/classify.js +2 -1
- package/dist/parser/classify.js.map +1 -1
- package/dist/parser/parser.js +1 -1
- package/dist/plugins/okhsl-plugin.js +2 -275
- package/dist/plugins/okhsl-plugin.js.map +1 -1
- package/dist/plugins/types.d.ts +1 -1
- package/dist/properties/index.js +2 -15
- package/dist/properties/index.js.map +1 -1
- package/dist/ssr/format-property.js +9 -7
- package/dist/ssr/format-property.js.map +1 -1
- package/dist/styles/color.js +9 -5
- package/dist/styles/color.js.map +1 -1
- package/dist/styles/createStyle.js +24 -21
- package/dist/styles/createStyle.js.map +1 -1
- package/dist/styles/index.js +1 -1
- package/dist/styles/predefined.js +1 -1
- package/dist/styles/predefined.js.map +1 -1
- package/dist/styles/types.d.ts +1 -1
- package/dist/tasty.d.ts +6 -6
- package/dist/tasty.js +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/utils/color-math.d.ts +46 -0
- package/dist/utils/color-math.js +749 -0
- package/dist/utils/color-math.js.map +1 -0
- package/dist/utils/color-space.d.ts +5 -0
- package/dist/utils/color-space.js +229 -0
- package/dist/utils/color-space.js.map +1 -0
- package/dist/utils/colors.js +3 -1
- package/dist/utils/colors.js.map +1 -1
- package/dist/utils/mod-attrs.js +1 -1
- package/dist/utils/mod-attrs.js.map +1 -1
- package/dist/utils/process-tokens.d.ts +3 -13
- package/dist/utils/process-tokens.js +18 -98
- package/dist/utils/process-tokens.js.map +1 -1
- package/dist/utils/styles.d.ts +2 -15
- package/dist/utils/styles.js +22 -217
- package/dist/utils/styles.js.map +1 -1
- package/docs/PIPELINE.md +519 -0
- package/docs/README.md +30 -0
- package/docs/adoption.md +10 -2
- package/docs/comparison.md +11 -6
- package/docs/configuration.md +26 -3
- package/docs/debug.md +152 -339
- package/docs/dsl.md +3 -1
- package/docs/getting-started.md +21 -7
- package/docs/injector.md +2 -2
- package/docs/runtime.md +59 -9
- package/docs/ssr.md +2 -2
- package/docs/styles.md +1 -1
- package/docs/tasty-static.md +13 -2
- package/package.json +4 -3
- package/dist/utils/hsl-to-rgb.js +0 -38
- package/dist/utils/hsl-to-rgb.js.map +0 -1
- package/dist/utils/okhsl-to-rgb.js +0 -296
- package/dist/utils/okhsl-to-rgb.js.map +0 -1
package/dist/debug.d.ts
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
|
+
import { CacheMetrics } from "./injector/types.js";
|
|
2
|
+
|
|
1
3
|
//#region src/debug.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* Debug utilities for inspecting tasty-generated CSS at runtime
|
|
4
|
-
*/
|
|
5
4
|
declare global {
|
|
6
5
|
interface Window {
|
|
7
6
|
tastyDebug?: typeof tastyDebug;
|
|
8
7
|
}
|
|
9
8
|
}
|
|
10
9
|
type CSSTarget = 'all' | 'global' | 'active' | 'unused' | 'page' | string | string[] | Element;
|
|
11
|
-
interface
|
|
10
|
+
interface DebugOptions {
|
|
12
11
|
root?: Document | ShadowRoot;
|
|
12
|
+
/** Suppress console logging and return data only (default: false) */
|
|
13
|
+
raw?: boolean;
|
|
14
|
+
}
|
|
15
|
+
interface CssOptions extends DebugOptions {
|
|
13
16
|
prettify?: boolean;
|
|
14
|
-
|
|
17
|
+
/** Read from stored source CSS (dev-mode only) instead of live CSSOM */
|
|
18
|
+
source?: boolean;
|
|
15
19
|
}
|
|
16
20
|
interface ChunkInfo {
|
|
17
21
|
className: string;
|
|
@@ -25,22 +29,6 @@ interface InspectResult {
|
|
|
25
29
|
size: number;
|
|
26
30
|
rules: number;
|
|
27
31
|
}
|
|
28
|
-
interface CacheMetrics {
|
|
29
|
-
hits: number;
|
|
30
|
-
misses: number;
|
|
31
|
-
bulkCleanups: number;
|
|
32
|
-
totalInsertions: number;
|
|
33
|
-
totalUnused: number;
|
|
34
|
-
stylesCleanedUp: number;
|
|
35
|
-
cleanupHistory: {
|
|
36
|
-
timestamp: number;
|
|
37
|
-
classesDeleted: number;
|
|
38
|
-
cssSize: number;
|
|
39
|
-
rulesDeleted: number;
|
|
40
|
-
}[];
|
|
41
|
-
startTime: number;
|
|
42
|
-
unusedHits?: number;
|
|
43
|
-
}
|
|
44
32
|
interface CacheStatus {
|
|
45
33
|
classes: {
|
|
46
34
|
active: string[];
|
|
@@ -49,17 +37,14 @@ interface CacheStatus {
|
|
|
49
37
|
};
|
|
50
38
|
metrics: CacheMetrics | null;
|
|
51
39
|
}
|
|
52
|
-
interface
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
root?: Document | ShadowRoot;
|
|
61
|
-
log?: boolean;
|
|
62
|
-
includePageCSS?: false | true | 'all';
|
|
40
|
+
interface ChunkBreakdown {
|
|
41
|
+
byChunk: Record<string, {
|
|
42
|
+
classes: string[];
|
|
43
|
+
cssSize: number;
|
|
44
|
+
ruleCount: number;
|
|
45
|
+
}>;
|
|
46
|
+
totalChunkTypes: number;
|
|
47
|
+
totalClasses: number;
|
|
63
48
|
}
|
|
64
49
|
interface Summary {
|
|
65
50
|
activeClasses: string[];
|
|
@@ -72,132 +57,32 @@ interface Summary {
|
|
|
72
57
|
keyframesCSSSize: number;
|
|
73
58
|
propertyCSSSize: number;
|
|
74
59
|
totalCSSSize: number;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
globalCSS: string;
|
|
78
|
-
rawCSS: string;
|
|
79
|
-
keyframesCSS: string;
|
|
80
|
-
propertyCSS: string;
|
|
81
|
-
allCSS: string;
|
|
60
|
+
activeRuleCount: number;
|
|
61
|
+
unusedRuleCount: number;
|
|
82
62
|
globalRuleCount: number;
|
|
83
63
|
rawRuleCount: number;
|
|
84
64
|
keyframesRuleCount: number;
|
|
85
65
|
propertyRuleCount: number;
|
|
86
|
-
|
|
87
|
-
css?: string;
|
|
88
|
-
cssSize: number;
|
|
89
|
-
ruleCount: number;
|
|
90
|
-
stylesheetCount: number;
|
|
91
|
-
skippedStylesheets: number;
|
|
92
|
-
};
|
|
66
|
+
totalRuleCount: number;
|
|
93
67
|
metrics: CacheMetrics | null;
|
|
94
68
|
definedProperties: string[];
|
|
95
69
|
definedKeyframes: {
|
|
96
70
|
name: string;
|
|
97
71
|
refCount: number;
|
|
98
72
|
}[];
|
|
99
|
-
|
|
100
|
-
keyframeCount: number;
|
|
101
|
-
cleanupSummary: {
|
|
102
|
-
enabled: boolean;
|
|
103
|
-
totalCleanups: number;
|
|
104
|
-
totalClassesDeleted: number;
|
|
105
|
-
totalCssDeleted: number;
|
|
106
|
-
totalRulesDeleted: number;
|
|
107
|
-
averageClassesPerCleanup: number;
|
|
108
|
-
averageCssPerCleanup: number;
|
|
109
|
-
averageRulesPerCleanup: number;
|
|
110
|
-
lastCleanup?: {
|
|
111
|
-
timestamp: number;
|
|
112
|
-
date: string;
|
|
113
|
-
classesDeleted: number;
|
|
114
|
-
cssSize: number;
|
|
115
|
-
rulesDeleted: number;
|
|
116
|
-
};
|
|
117
|
-
};
|
|
118
|
-
chunkBreakdown: {
|
|
119
|
-
byChunk: Record<string, {
|
|
120
|
-
classes: string[];
|
|
121
|
-
cssSize: number;
|
|
122
|
-
ruleCount: number;
|
|
123
|
-
}>;
|
|
124
|
-
totalChunkTypes: number;
|
|
125
|
-
};
|
|
73
|
+
chunkBreakdown: ChunkBreakdown;
|
|
126
74
|
}
|
|
127
|
-
/**
|
|
128
|
-
* Concise tastyDebug API for inspecting styles at runtime
|
|
129
|
-
*/
|
|
130
75
|
declare const tastyDebug: {
|
|
131
76
|
css(target: CSSTarget, opts?: CssOptions): string;
|
|
132
|
-
inspect(target: string | Element, opts?:
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
cache(opts?:
|
|
136
|
-
root?: Document | ShadowRoot;
|
|
137
|
-
includeHistory?: boolean;
|
|
138
|
-
}): CacheStatus;
|
|
77
|
+
inspect(target: string | Element, opts?: DebugOptions): InspectResult;
|
|
78
|
+
summary(opts?: DebugOptions): Summary;
|
|
79
|
+
chunks(opts?: DebugOptions): ChunkBreakdown;
|
|
80
|
+
cache(opts?: DebugOptions): CacheStatus;
|
|
139
81
|
cleanup(opts?: {
|
|
140
82
|
root?: Document | ShadowRoot;
|
|
141
83
|
}): void;
|
|
142
|
-
metrics(opts?: {
|
|
143
|
-
root?: Document | ShadowRoot;
|
|
144
|
-
}): CacheMetrics | null;
|
|
145
|
-
resetMetrics(opts?: {
|
|
146
|
-
root?: Document | ShadowRoot;
|
|
147
|
-
}): void;
|
|
148
|
-
/**
|
|
149
|
-
* Get breakdown of styles by chunk type.
|
|
150
|
-
*
|
|
151
|
-
* With style chunking enabled, styles are split into logical chunks
|
|
152
|
-
* (appearance, font, dimension, container, etc.) for better caching
|
|
153
|
-
* and CSS reuse.
|
|
154
|
-
*
|
|
155
|
-
* @param opts - Options including root document/shadow root
|
|
156
|
-
* @returns Breakdown by chunk type with class counts and CSS sizes
|
|
157
|
-
*/
|
|
158
|
-
chunks(opts?: {
|
|
159
|
-
root?: Document | ShadowRoot;
|
|
160
|
-
log?: boolean;
|
|
161
|
-
}): {
|
|
162
|
-
byChunk: Record<string, {
|
|
163
|
-
classes: string[];
|
|
164
|
-
cssSize: number;
|
|
165
|
-
ruleCount: number;
|
|
166
|
-
}>;
|
|
167
|
-
totalChunkTypes: number;
|
|
168
|
-
totalClasses: number;
|
|
169
|
-
};
|
|
170
|
-
getGlobalTypeCSS(type: "global" | "raw" | "keyframes" | "property", opts?: {
|
|
171
|
-
root?: Document | ShadowRoot;
|
|
172
|
-
}): {
|
|
173
|
-
css: string;
|
|
174
|
-
ruleCount: number;
|
|
175
|
-
size: number;
|
|
176
|
-
};
|
|
177
|
-
defs(opts?: {
|
|
178
|
-
root?: Document | ShadowRoot;
|
|
179
|
-
}): Definitions;
|
|
180
|
-
summary(opts?: SummaryOptions): Summary;
|
|
181
|
-
pageCSS(opts?: {
|
|
182
|
-
root?: Document | ShadowRoot;
|
|
183
|
-
prettify?: boolean;
|
|
184
|
-
log?: boolean;
|
|
185
|
-
includeCrossOrigin?: boolean;
|
|
186
|
-
}): string;
|
|
187
|
-
pageStats(opts?: {
|
|
188
|
-
root?: Document | ShadowRoot;
|
|
189
|
-
includeCrossOrigin?: boolean;
|
|
190
|
-
}): {
|
|
191
|
-
cssSize: number;
|
|
192
|
-
ruleCount: number;
|
|
193
|
-
stylesheetCount: number;
|
|
194
|
-
skippedStylesheets: number;
|
|
195
|
-
};
|
|
196
|
-
install(): void;
|
|
197
|
-
log(target: CSSTarget, opts?: CssOptions & {
|
|
198
|
-
title?: string;
|
|
199
|
-
}): void;
|
|
200
84
|
help(): void;
|
|
85
|
+
install(): void;
|
|
201
86
|
};
|
|
202
87
|
//#endregion
|
|
203
88
|
export { tastyDebug };
|