@vitus-labs/core 2.0.0 → 2.2.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/lib/index.d.ts +19 -3
- package/lib/index.js +2 -2
- package/package.json +3 -3
package/lib/index.d.ts
CHANGED
|
@@ -135,6 +135,22 @@ type HTMLTextTags = (typeof HTML_TEXT_TAGS)[number];
|
|
|
135
135
|
type HTMLTagAttrsByTag<T extends HTMLTags> = T extends HTMLTags ? HTMLElementAttrs[T] : {};
|
|
136
136
|
//#endregion
|
|
137
137
|
//#region src/config.d.ts
|
|
138
|
+
/**
|
|
139
|
+
* Augmentable interface representing the result of the engine's `css`
|
|
140
|
+
* tagged template. Empty by default — each connector package narrows it
|
|
141
|
+
* via module declaration merging:
|
|
142
|
+
*
|
|
143
|
+
* ```ts
|
|
144
|
+
* // @vitus-labs/connector-styler
|
|
145
|
+
* declare module '@vitus-labs/core' {
|
|
146
|
+
* interface CSSEngineResult extends StylerCSSResult {}
|
|
147
|
+
* }
|
|
148
|
+
* ```
|
|
149
|
+
*
|
|
150
|
+
* Consumers' types automatically resolve to the engine they `init()`'d with,
|
|
151
|
+
* without core depending on any specific engine package.
|
|
152
|
+
*/
|
|
153
|
+
interface CSSEngineResult {}
|
|
138
154
|
/**
|
|
139
155
|
* Describes the shape of a CSS-in-JS engine connector.
|
|
140
156
|
* Packages like `@vitus-labs/connector-styler`, `@vitus-labs/connector-emotion`,
|
|
@@ -146,7 +162,7 @@ type HTMLTagAttrsByTag<T extends HTMLTags> = T extends HTMLTags ? HTMLElementAtt
|
|
|
146
162
|
*/
|
|
147
163
|
interface CSSEngineConnector {
|
|
148
164
|
/** Tagged template for composable CSS fragments. */
|
|
149
|
-
css: (strings: TemplateStringsArray, ...values: any[]) =>
|
|
165
|
+
css: (strings: TemplateStringsArray, ...values: any[]) => CSSEngineResult;
|
|
150
166
|
/** Component factory: `styled(tag)`\`...\`` → React component. */
|
|
151
167
|
styled: ((tag: any, options?: any) => (strings: TemplateStringsArray, ...values: any[]) => any) & Record<string, any>;
|
|
152
168
|
/** ThemeProvider component wrapping children with a theme context. */
|
|
@@ -199,7 +215,7 @@ declare class Configuration {
|
|
|
199
215
|
* When not (module load time before init), returns a thunk that resolves
|
|
200
216
|
* at render time — all CSS-in-JS engines treat functions as interpolations.
|
|
201
217
|
*/
|
|
202
|
-
css: (strings: TemplateStringsArray, ...values: any[]) =>
|
|
218
|
+
css: (strings: TemplateStringsArray, ...values: any[]) => CSSEngineResult;
|
|
203
219
|
/**
|
|
204
220
|
* Stable styled delegate (Proxy). Supports `styled(tag)` and `styled.div`.
|
|
205
221
|
* When the engine is not yet available, returns a lazy component
|
|
@@ -318,5 +334,5 @@ declare const throttle: <T extends (...args: any[]) => any>(fn: T, wait?: number
|
|
|
318
334
|
};
|
|
319
335
|
declare const merge: <T extends Record<string, any>>(target: T, ...sources: Record<string, any>[]) => T;
|
|
320
336
|
//#endregion
|
|
321
|
-
export { type BreakpointKeys, type Breakpoints, type CSSEngineConnector, type HTMLElementAttrs, type HTMLTagAttrsByTag, type HTMLTags, type HTMLTextTags, HTML_TAGS, HTML_TEXT_TAGS, type IsEmpty, Provider, type Render, compose, config, context, get, hoistNonReactStatics, init, isEmpty, isEqual, merge, omit, pick, render, set, throttle, useStableValue };
|
|
337
|
+
export { type BreakpointKeys, type Breakpoints, type CSSEngineConnector, type CSSEngineResult, type HTMLElementAttrs, type HTMLTagAttrsByTag, type HTMLTags, type HTMLTextTags, HTML_TAGS, HTML_TEXT_TAGS, type IsEmpty, Provider, type Render, compose, config, context, get, hoistNonReactStatics, init, isEmpty, isEqual, merge, omit, pick, render, set, throttle, useStableValue };
|
|
322
338
|
//# sourceMappingURL=index2.d.ts.map
|
package/lib/index.js
CHANGED
|
@@ -75,11 +75,11 @@ var Configuration = class {
|
|
|
75
75
|
*/
|
|
76
76
|
css = (strings, ...values) => {
|
|
77
77
|
if (this._css) return this._css(strings, ...values);
|
|
78
|
-
return () => {
|
|
78
|
+
return (() => {
|
|
79
79
|
const engine = this._css;
|
|
80
80
|
if (!engine) return notConfigured("css");
|
|
81
81
|
return engine(strings, ...values);
|
|
82
|
-
};
|
|
82
|
+
});
|
|
83
83
|
};
|
|
84
84
|
/**
|
|
85
85
|
* Stable styled delegate (Proxy). Supports `styled(tag)` and `styled.div`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitus-labs/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Vit Bokisch <vit@bokisch.cz>",
|
|
6
6
|
"maintainers": [
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"react-is": "^19.2.4"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@vitus-labs/tools-rolldown": "2.
|
|
63
|
-
"@vitus-labs/tools-typescript": "2.
|
|
62
|
+
"@vitus-labs/tools-rolldown": "2.3.0",
|
|
63
|
+
"@vitus-labs/tools-typescript": "2.3.0"
|
|
64
64
|
}
|
|
65
65
|
}
|