@pimolu/core 0.1.0-beta.1 → 0.1.0-beta.2
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.fr.md +21 -8
- package/README.md +21 -8
- package/package.json +35 -34
- package/LICENSE +0 -21
package/README.fr.md
CHANGED
|
@@ -1,29 +1,42 @@
|
|
|
1
1
|
# @pimolu/core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Un petit utilitaire indépendant du framework pour composer des classes CSS à partir de variantes nommées. Il permet d'obtenir des noms de classes prévisibles sans runtime CSS-in-JS.
|
|
4
4
|
|
|
5
|
-
> **0.1.0-beta.
|
|
5
|
+
> **0.1.0-beta.2** est une version de prévisualisation.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
6
8
|
|
|
7
9
|
```bash
|
|
8
|
-
pnpm add @pimolu/core
|
|
10
|
+
pnpm add @pimolu/core@beta
|
|
9
11
|
```
|
|
10
12
|
|
|
13
|
+
## Utilisation
|
|
14
|
+
|
|
11
15
|
```ts
|
|
12
16
|
import { createVariants, type VariantProps } from "@pimolu/core";
|
|
13
17
|
|
|
14
|
-
const
|
|
18
|
+
const buttonClass = createVariants({
|
|
15
19
|
base: "pimolu-button",
|
|
16
20
|
variants: {
|
|
17
|
-
size: {
|
|
21
|
+
size: {
|
|
22
|
+
sm: "pimolu-button--sm",
|
|
23
|
+
md: "pimolu-button--md",
|
|
24
|
+
},
|
|
18
25
|
},
|
|
19
26
|
defaultVariants: { size: "md" },
|
|
20
27
|
});
|
|
21
28
|
|
|
22
|
-
|
|
29
|
+
type ButtonVariants = VariantProps<typeof buttonClass>;
|
|
30
|
+
|
|
31
|
+
const options: ButtonVariants = { size: "sm" };
|
|
32
|
+
buttonClass(options); // "pimolu-button pimolu-button--sm"
|
|
33
|
+
buttonClass({}, "my-class"); // "pimolu-button pimolu-button--md my-class"
|
|
23
34
|
```
|
|
24
35
|
|
|
25
|
-
|
|
36
|
+
`createVariants` renvoie une chaîne de classes. Le package n'a aucune dépendance d'exécution et ne génère pas de CSS : fournissez les styles correspondants ou utilisez les styles publiés avec les composants Pimolu.
|
|
37
|
+
|
|
38
|
+
## Liens
|
|
26
39
|
|
|
27
|
-
Documentation
|
|
40
|
+
[Documentation des composants](https://pimolu.com/components) · [Tous les packages npm](https://www.npmjs.com/org/pimolu) · [Code source](https://github.com/pimoludev/ui/tree/main/packages/core)
|
|
28
41
|
|
|
29
42
|
MIT © Pimolu
|
package/README.md
CHANGED
|
@@ -1,29 +1,42 @@
|
|
|
1
1
|
# @pimolu/core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A small, framework-independent utility for composing CSS classes from named variants. It is useful when your components need predictable class names without a CSS-in-JS runtime.
|
|
4
4
|
|
|
5
|
-
> **0.1.0-beta.
|
|
5
|
+
> **0.1.0-beta.2** is a preview release.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
6
8
|
|
|
7
9
|
```bash
|
|
8
|
-
pnpm add @pimolu/core
|
|
10
|
+
pnpm add @pimolu/core@beta
|
|
9
11
|
```
|
|
10
12
|
|
|
13
|
+
## Use
|
|
14
|
+
|
|
11
15
|
```ts
|
|
12
16
|
import { createVariants, type VariantProps } from "@pimolu/core";
|
|
13
17
|
|
|
14
|
-
const
|
|
18
|
+
const buttonClass = createVariants({
|
|
15
19
|
base: "pimolu-button",
|
|
16
20
|
variants: {
|
|
17
|
-
size: {
|
|
21
|
+
size: {
|
|
22
|
+
sm: "pimolu-button--sm",
|
|
23
|
+
md: "pimolu-button--md",
|
|
24
|
+
},
|
|
18
25
|
},
|
|
19
26
|
defaultVariants: { size: "md" },
|
|
20
27
|
});
|
|
21
28
|
|
|
22
|
-
|
|
29
|
+
type ButtonVariants = VariantProps<typeof buttonClass>;
|
|
30
|
+
|
|
31
|
+
const options: ButtonVariants = { size: "sm" };
|
|
32
|
+
buttonClass(options); // "pimolu-button pimolu-button--sm"
|
|
33
|
+
buttonClass({}, "my-class"); // "pimolu-button pimolu-button--md my-class"
|
|
23
34
|
```
|
|
24
35
|
|
|
25
|
-
|
|
36
|
+
`createVariants` returns a class-name string. It has no runtime dependencies and does not generate CSS: provide the matching styles yourself, or use Pimolu's published styles with Pimolu components.
|
|
37
|
+
|
|
38
|
+
## Links
|
|
26
39
|
|
|
27
|
-
|
|
40
|
+
[Component documentation](https://pimolu.com/components) · [All npm packages](https://www.npmjs.com/org/pimolu) · [Source](https://github.com/pimoludev/ui/tree/main/packages/core)
|
|
28
41
|
|
|
29
42
|
MIT © Pimolu
|
package/package.json
CHANGED
|
@@ -1,34 +1,35 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@pimolu/core",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
4
|
-
"description": "Framework-agnostic Pimolu UI class variant utilities.",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"repository": {
|
|
7
|
-
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/pimoludev/ui.git",
|
|
9
|
-
"directory": "packages/core"
|
|
10
|
-
},
|
|
11
|
-
"publishConfig": {
|
|
12
|
-
"access": "public"
|
|
13
|
-
},
|
|
14
|
-
"type": "module",
|
|
15
|
-
"main": "./dist/index.js",
|
|
16
|
-
"types": "./dist/index.d.ts",
|
|
17
|
-
"files": [
|
|
18
|
-
"dist"
|
|
19
|
-
],
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@pimolu/core",
|
|
3
|
+
"version": "0.1.0-beta.2",
|
|
4
|
+
"description": "Framework-agnostic Pimolu UI class variant utilities.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/pimoludev/ui.git",
|
|
9
|
+
"directory": "packages/core"
|
|
10
|
+
},
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public"
|
|
13
|
+
},
|
|
14
|
+
"type": "module",
|
|
15
|
+
"main": "./dist/index.js",
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsc -p tsconfig.build.json",
|
|
22
|
+
"prepack": "pnpm build"
|
|
23
|
+
},
|
|
24
|
+
"exports": {
|
|
25
|
+
".": {
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"import": "./dist/index.js",
|
|
28
|
+
"default": "./dist/index.js"
|
|
29
|
+
},
|
|
30
|
+
"./package.json": "./package.json"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"typescript": "^6.0.3"
|
|
34
|
+
}
|
|
35
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 pimoludev
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|