@pimolu/core 0.1.0-beta.1 → 0.1.0-beta.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/README.fr.md +98 -29
- package/README.md +98 -29
- package/package.json +35 -34
- package/LICENSE +0 -21
package/README.fr.md
CHANGED
|
@@ -1,29 +1,98 @@
|
|
|
1
|
-
# @pimolu/core
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
1
|
+
# @pimolu/core
|
|
2
|
+
|
|
3
|
+
**Des noms de classes prévisibles, sans runtime.**
|
|
4
|
+
|
|
5
|
+
Un petit utilitaire indépendant du framework pour composer des noms de classes à partir de variantes nommées. `createVariants` renvoie une chaîne. Il ne génère pas de CSS, n'injecte pas de styles et ne nécessite pas React.
|
|
6
|
+
|
|
7
|
+
[Source](https://github.com/pimoludev/ui/tree/main/packages/core) · [Composants](https://pimolu.com/components)
|
|
8
|
+
|
|
9
|
+
> **Bêta :** `0.1.0-beta.10` est une prévisualisation.
|
|
10
|
+
|
|
11
|
+
## Pourquoi @pimolu/core ?
|
|
12
|
+
|
|
13
|
+
- **Zéro dépendance.** Un petit utilitaire sans runtime, sans CSS-in-JS et sans couplage au build.
|
|
14
|
+
- **Variantes typées.** Déduisez un type `VariantProps` directement depuis la définition des variantes.
|
|
15
|
+
- **Sortie déterministe.** L'ordre des classes est prévisible et une classe supplémentaire est ajoutée en dernier.
|
|
16
|
+
- **Utilisable au-delà de Pimolu.** Employez-le avec n'importe quelle architecture CSS qui veut des variantes nommées sans runtime de style.
|
|
17
|
+
- **La base des composants Pimolu.** Le même utilitaire alimente les variantes React de Pimolu.
|
|
18
|
+
|
|
19
|
+
## En bref
|
|
20
|
+
|
|
21
|
+
| | |
|
|
22
|
+
| --- | --- |
|
|
23
|
+
| Export | `createVariants` |
|
|
24
|
+
| Types | `VariantProps` |
|
|
25
|
+
| Dépendances runtime | Aucune |
|
|
26
|
+
| Génération CSS | Aucune |
|
|
27
|
+
| React requis | Non |
|
|
28
|
+
| Distribution | ESM + déclarations TypeScript |
|
|
29
|
+
|
|
30
|
+
## Installation
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
pnpm add @pimolu/core@latest
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Utilisation
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
import { createVariants, type VariantProps } from "@pimolu/core";
|
|
40
|
+
|
|
41
|
+
const button = createVariants({
|
|
42
|
+
base: "button",
|
|
43
|
+
variants: {
|
|
44
|
+
size: {
|
|
45
|
+
sm: "button--sm",
|
|
46
|
+
md: "button--md",
|
|
47
|
+
},
|
|
48
|
+
tone: {
|
|
49
|
+
neutral: "button--neutral",
|
|
50
|
+
primary: "button--primary",
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
defaultVariants: {
|
|
54
|
+
size: "md",
|
|
55
|
+
tone: "neutral",
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
type ButtonVariants = VariantProps<typeof button>;
|
|
60
|
+
|
|
61
|
+
const options: ButtonVariants = { size: "sm", tone: "primary" };
|
|
62
|
+
|
|
63
|
+
button(options);
|
|
64
|
+
// "button button--sm button--primary"
|
|
65
|
+
|
|
66
|
+
button({}, "checkout-button");
|
|
67
|
+
// "button button--md button--neutral checkout-button"
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
`createVariants` accepte :
|
|
71
|
+
|
|
72
|
+
| Option | Rôle |
|
|
73
|
+
| --- | --- |
|
|
74
|
+
| `base` | Classes toujours appliquées |
|
|
75
|
+
| `variants` | Groupes nommés de classes conditionnelles |
|
|
76
|
+
| `defaultVariants` | Valeurs de repli quand une variante est omise |
|
|
77
|
+
| second argument | Classes supplémentaires ajoutées au résultat |
|
|
78
|
+
|
|
79
|
+
L'utilitaire ne connaît pas le CSS. Fournissez les sélecteurs correspondants dans votre feuille, ou utilisez-le avec les styles publiés de Pimolu.
|
|
80
|
+
|
|
81
|
+
## La famille de packages
|
|
82
|
+
|
|
83
|
+
| Package | Rôle |
|
|
84
|
+
| --- | --- |
|
|
85
|
+
| [`@pimolu/react`](https://www.npmjs.com/package/@pimolu/react) | Composants, hooks et layouts React |
|
|
86
|
+
| [`@pimolu/web-styles`](https://www.npmjs.com/package/@pimolu/web-styles) | CSS complet, entrée en couches et CSS par composant |
|
|
87
|
+
| [`@pimolu/themes`](https://www.npmjs.com/package/@pimolu/themes) | Thèmes clair/sombre, sept presets et données visuelles |
|
|
88
|
+
| [`@pimolu/design-tokens`](https://www.npmjs.com/package/@pimolu/design-tokens) | Tokens primitifs en CSS et JSON |
|
|
89
|
+
| [`@pimolu/core`](https://www.npmjs.com/package/@pimolu/core) | Utilitaire de classes de variantes indépendant du framework |
|
|
90
|
+
|
|
91
|
+
## Documentation et état
|
|
92
|
+
|
|
93
|
+
- [Catalogue de composants](https://pimolu.com/components)
|
|
94
|
+
- [Source et issues](https://github.com/pimoludev/ui)
|
|
95
|
+
|
|
96
|
+
Pimolu UI est en bêta. Le registre React est implémenté ; les registres native, Angular et web components sont des directions futures. L'utilitaire core est volontairement petit et sans comportement runtime spécifique à Pimolu.
|
|
97
|
+
|
|
98
|
+
MIT © Pimolu
|
package/README.md
CHANGED
|
@@ -1,29 +1,98 @@
|
|
|
1
|
-
# @pimolu/core
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
1
|
+
# @pimolu/core
|
|
2
|
+
|
|
3
|
+
**Predictable class names, without a runtime.**
|
|
4
|
+
|
|
5
|
+
A tiny, framework-independent utility for composing class names from named variants. `createVariants` returns a string. It does not generate CSS, inject styles or require React.
|
|
6
|
+
|
|
7
|
+
[Source](https://github.com/pimoludev/ui/tree/main/packages/core) · [Component docs](https://pimolu.com/components)
|
|
8
|
+
|
|
9
|
+
> **Beta:** `0.1.0-beta.10` is a preview.
|
|
10
|
+
|
|
11
|
+
## Why @pimolu/core?
|
|
12
|
+
|
|
13
|
+
- **Zero dependencies.** A small utility with no runtime, no CSS-in-JS and no build-time coupling.
|
|
14
|
+
- **Typed variants.** Infer a `VariantProps` type directly from the variant definition.
|
|
15
|
+
- **Deterministic output.** Class order is predictable, and an optional extra class is appended last.
|
|
16
|
+
- **Works beyond Pimolu.** Use it for any CSS architecture that wants named variants without a styling runtime.
|
|
17
|
+
- **The base of Pimolu components.** The same utility powers Pimolu's React variants.
|
|
18
|
+
|
|
19
|
+
## At a glance
|
|
20
|
+
|
|
21
|
+
| | |
|
|
22
|
+
| --- | --- |
|
|
23
|
+
| Export | `createVariants` |
|
|
24
|
+
| Types | `VariantProps` |
|
|
25
|
+
| Runtime dependencies | None |
|
|
26
|
+
| CSS generation | None |
|
|
27
|
+
| React required | No |
|
|
28
|
+
| Distribution | ESM + TypeScript declarations |
|
|
29
|
+
|
|
30
|
+
## Install
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
pnpm add @pimolu/core@latest
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Use
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
import { createVariants, type VariantProps } from "@pimolu/core";
|
|
40
|
+
|
|
41
|
+
const button = createVariants({
|
|
42
|
+
base: "button",
|
|
43
|
+
variants: {
|
|
44
|
+
size: {
|
|
45
|
+
sm: "button--sm",
|
|
46
|
+
md: "button--md",
|
|
47
|
+
},
|
|
48
|
+
tone: {
|
|
49
|
+
neutral: "button--neutral",
|
|
50
|
+
primary: "button--primary",
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
defaultVariants: {
|
|
54
|
+
size: "md",
|
|
55
|
+
tone: "neutral",
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
type ButtonVariants = VariantProps<typeof button>;
|
|
60
|
+
|
|
61
|
+
const options: ButtonVariants = { size: "sm", tone: "primary" };
|
|
62
|
+
|
|
63
|
+
button(options);
|
|
64
|
+
// "button button--sm button--primary"
|
|
65
|
+
|
|
66
|
+
button({}, "checkout-button");
|
|
67
|
+
// "button button--md button--neutral checkout-button"
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
`createVariants` accepts:
|
|
71
|
+
|
|
72
|
+
| Option | Purpose |
|
|
73
|
+
| --- | --- |
|
|
74
|
+
| `base` | Always-applied class names |
|
|
75
|
+
| `variants` | Named groups of conditional classes |
|
|
76
|
+
| `defaultVariants` | Fallbacks when a variant is omitted |
|
|
77
|
+
| second argument | Extra class names appended to the result |
|
|
78
|
+
|
|
79
|
+
The utility does not know about CSS. Provide matching selectors in your own stylesheet, or use it alongside Pimolu's published styles.
|
|
80
|
+
|
|
81
|
+
## The package family
|
|
82
|
+
|
|
83
|
+
| Package | Role |
|
|
84
|
+
| --- | --- |
|
|
85
|
+
| [`@pimolu/react`](https://www.npmjs.com/package/@pimolu/react) | React components, hooks and layouts |
|
|
86
|
+
| [`@pimolu/web-styles`](https://www.npmjs.com/package/@pimolu/web-styles) | Plain CSS bundle, layered entry and per-component CSS |
|
|
87
|
+
| [`@pimolu/themes`](https://www.npmjs.com/package/@pimolu/themes) | Light/dark themes, seven presets and visual data |
|
|
88
|
+
| [`@pimolu/design-tokens`](https://www.npmjs.com/package/@pimolu/design-tokens) | Primitive tokens in CSS and JSON |
|
|
89
|
+
| [`@pimolu/core`](https://www.npmjs.com/package/@pimolu/core) | Framework-independent variant class utility |
|
|
90
|
+
|
|
91
|
+
## Documentation and status
|
|
92
|
+
|
|
93
|
+
- [Component catalogue](https://pimolu.com/components)
|
|
94
|
+
- [Source and issues](https://github.com/pimoludev/ui)
|
|
95
|
+
|
|
96
|
+
Pimolu UI is a beta. The React registry is implemented; native, Angular and web-component registries are future directions. The core utility is intentionally small and has no Pimolu-specific runtime behavior.
|
|
97
|
+
|
|
98
|
+
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.10",
|
|
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.
|