@pyreon/styler 0.11.8 → 0.11.10
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pyreon/styler",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.10",
|
|
4
4
|
"description": "Lightweight CSS-in-JS engine for Pyreon",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -41,12 +41,12 @@
|
|
|
41
41
|
"typecheck": "tsc --noEmit"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@pyreon/typescript": "^0.11.
|
|
44
|
+
"@pyreon/typescript": "^0.11.10",
|
|
45
45
|
"@vitus-labs/tools-rolldown": "^1.15.3"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@pyreon/core": "^0.11.
|
|
49
|
-
"@pyreon/reactivity": "^0.11.
|
|
48
|
+
"@pyreon/core": "^0.11.10",
|
|
49
|
+
"@pyreon/reactivity": "^0.11.10"
|
|
50
50
|
},
|
|
51
51
|
"engines": {
|
|
52
52
|
"node": ">= 22"
|
package/src/ThemeProvider.ts
CHANGED
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
import type { VNode, VNodeChild } from '@pyreon/core'
|
|
15
15
|
import { createContext, provide, useContext } from '@pyreon/core'
|
|
16
16
|
|
|
17
|
-
// biome-ignore lint/suspicious/noEmptyInterface: augmentable via module declaration merging
|
|
18
17
|
export interface DefaultTheme {}
|
|
19
18
|
|
|
20
19
|
type Theme = DefaultTheme & Record<string, unknown>
|
|
@@ -163,7 +163,6 @@ describe('resolve composition chain', () => {
|
|
|
163
163
|
}: {
|
|
164
164
|
theme: Record<string, any>
|
|
165
165
|
css: typeof css
|
|
166
|
-
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: complex logic is inherent to this function
|
|
167
166
|
}) => {
|
|
168
167
|
const fragments = [
|
|
169
168
|
t.position ? `position: ${t.position};` : '',
|
|
@@ -213,7 +213,6 @@ describe('StyleSheet -- at-rule splitting', () => {
|
|
|
213
213
|
expect(hasMediaRule).toBe(true)
|
|
214
214
|
})
|
|
215
215
|
|
|
216
|
-
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: complex logic is inherent to this function
|
|
217
216
|
it('boosted selector appears in both base and media rules', () => {
|
|
218
217
|
const s = createSheet()
|
|
219
218
|
const className = s.insert('color: red; @media (min-width: 768px){color: blue;}', true)
|
package/src/forward.ts
CHANGED
|
@@ -231,7 +231,6 @@ export const buildProps = (
|
|
|
231
231
|
generatedCls: string,
|
|
232
232
|
isDOM: boolean,
|
|
233
233
|
customFilter?: (prop: string) => boolean,
|
|
234
|
-
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: complex logic is inherent to this function
|
|
235
234
|
): Record<string, any> => {
|
|
236
235
|
const result: Record<string, any> = {}
|
|
237
236
|
|
package/src/resolve.ts
CHANGED
|
@@ -38,7 +38,6 @@ export const resolve = (
|
|
|
38
38
|
strings: TemplateStringsArray,
|
|
39
39
|
values: Interpolation[],
|
|
40
40
|
props: Record<string, any>,
|
|
41
|
-
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: complex logic is inherent to this function
|
|
42
41
|
): string => {
|
|
43
42
|
// Tagged templates guarantee strings.length === values.length + 1,
|
|
44
43
|
// so strings[0] and strings[i+1] are always defined — no ?? needed.
|
|
@@ -81,7 +80,6 @@ const normCache = new Map<string, string>()
|
|
|
81
80
|
/** Clear the normalizeCSS cache (called during HMR cleanup). */
|
|
82
81
|
export const clearNormCache = () => normCache.clear()
|
|
83
82
|
|
|
84
|
-
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: complex logic is inherent to this function
|
|
85
83
|
export const normalizeCSS = (css: string): string => {
|
|
86
84
|
const cached = normCache.get(css)
|
|
87
85
|
if (cached !== undefined) return cached
|
package/src/sheet.ts
CHANGED
|
@@ -67,7 +67,6 @@ export class StyleSheet {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
/** Parse existing rules from SSR-rendered <style> tag into cache. */
|
|
70
|
-
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: complex logic is inherent to this function
|
|
71
70
|
private hydrateFromTag(el: HTMLStyleElement) {
|
|
72
71
|
const sheet = el.sheet
|
|
73
72
|
if (!sheet) return
|
|
@@ -111,7 +110,6 @@ export class StyleSheet {
|
|
|
111
110
|
* Extract nested at-rules (@media, @supports, @container) from CSS text
|
|
112
111
|
* and wrap their content in the given selector as separate top-level rules.
|
|
113
112
|
*/
|
|
114
|
-
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: complex logic is inherent to this function
|
|
115
113
|
private splitAtRules(cssText: string, selector: string): { base: string; atRules: string[] } {
|
|
116
114
|
// Fast path: no at-rules to split
|
|
117
115
|
if (cssText.indexOf('@') === -1) return { base: cssText, atRules: [] }
|
|
@@ -182,7 +180,6 @@ export class StyleSheet {
|
|
|
182
180
|
* When `boost` is true, the selector is doubled (`.pyr-abc.pyr-abc`)
|
|
183
181
|
* to raise specificity from (0,1,0) to (0,2,0).
|
|
184
182
|
*/
|
|
185
|
-
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: complex logic is inherent to this function
|
|
186
183
|
insert(cssText: string, boost = false): string {
|
|
187
184
|
// Fast path: skip hash computation on repeated insertions of same CSS text
|
|
188
185
|
const icKey = boost ? `${cssText}\0` : cssText
|
|
@@ -222,7 +219,7 @@ export class StyleSheet {
|
|
|
222
219
|
this.sheet.insertRule(rule, this.sheet.cssRules.length)
|
|
223
220
|
} catch (_e) {
|
|
224
221
|
if (process.env.NODE_ENV !== 'production') {
|
|
225
|
-
//
|
|
222
|
+
// oxlint-disable-next-line no-console
|
|
226
223
|
console.warn('[styler] Failed to insert CSS rule:', rule, _e)
|
|
227
224
|
}
|
|
228
225
|
}
|
|
@@ -299,7 +296,7 @@ export class StyleSheet {
|
|
|
299
296
|
this.sheet.insertRule(rule, this.sheet.cssRules.length)
|
|
300
297
|
} catch (_e) {
|
|
301
298
|
if (process.env.NODE_ENV !== 'production') {
|
|
302
|
-
//
|
|
299
|
+
// oxlint-disable-next-line no-console
|
|
303
300
|
console.warn('[styler] Failed to insert global CSS rule:', rule, _e)
|
|
304
301
|
}
|
|
305
302
|
}
|
package/src/styled.tsx
CHANGED
|
@@ -56,7 +56,6 @@ const createStyledComponent = (
|
|
|
56
56
|
strings: TemplateStringsArray,
|
|
57
57
|
values: Interpolation[],
|
|
58
58
|
options?: StyledOptions,
|
|
59
|
-
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: complex logic is inherent to this function
|
|
60
59
|
): ComponentFn => {
|
|
61
60
|
// Ultra-fast hot cache: 3 reference comparisons → return immediately
|
|
62
61
|
if (values.length === 0 && !options) {
|