@pimolu/core 0.0.0-stage → 0.1.0-beta.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
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.
package/README.fr.md ADDED
@@ -0,0 +1,29 @@
1
+ # @pimolu/core
2
+
3
+ Utilitaires de variantes de classes, indépendants du framework, utilisés par Pimolu UI.
4
+
5
+ > **0.1.0-beta.1** — version de prévisualisation.
6
+
7
+ ```bash
8
+ pnpm add @pimolu/core
9
+ ```
10
+
11
+ ```ts
12
+ import { createVariants, type VariantProps } from "@pimolu/core";
13
+
14
+ const button = createVariants({
15
+ base: "pimolu-button",
16
+ variants: {
17
+ size: { sm: "pimolu-button--sm", md: "pimolu-button--md" },
18
+ },
19
+ defaultVariants: { size: "md" },
20
+ });
21
+
22
+ button({ size: "sm" }); // "pimolu-button pimolu-button--sm"
23
+ ```
24
+
25
+ Le package est ESM uniquement et n'a aucune dépendance d'exécution.
26
+
27
+ Documentation : <https://github.com/pimoludev/ui>
28
+
29
+ MIT © Pimolu
package/README.md CHANGED
@@ -1,3 +1,29 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
1
+ # @pimolu/core
2
+
3
+ Framework-agnostic class variant utilities used by Pimolu UI.
4
+
5
+ > **0.1.0-beta.1** — preview release.
6
+
7
+ ```bash
8
+ pnpm add @pimolu/core
9
+ ```
10
+
11
+ ```ts
12
+ import { createVariants, type VariantProps } from "@pimolu/core";
13
+
14
+ const button = createVariants({
15
+ base: "pimolu-button",
16
+ variants: {
17
+ size: { sm: "pimolu-button--sm", md: "pimolu-button--md" },
18
+ },
19
+ defaultVariants: { size: "md" },
20
+ });
21
+
22
+ button({ size: "sm" }); // "pimolu-button pimolu-button--sm"
23
+ ```
24
+
25
+ The package is ESM-only and has no runtime dependency.
26
+
27
+ Documentation: <https://github.com/pimoludev/ui>
28
+
29
+ MIT © Pimolu
@@ -0,0 +1,12 @@
1
+ type VariantMap = Record<string, Record<string, string>>;
2
+ type VariantValues<T extends VariantMap> = {
3
+ [K in keyof T]?: keyof T[K];
4
+ };
5
+ export declare function createVariants<const T extends VariantMap>(config: {
6
+ base: string;
7
+ variants: T;
8
+ defaultVariants?: VariantValues<T>;
9
+ }): (options?: VariantValues<T>, className?: string) => string;
10
+ export type VariantProps<T extends (options?: any, className?: string) => string> = NonNullable<Parameters<T>[0]>;
11
+ export {};
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AACA,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAEzD,KAAK,aAAa,CAAC,CAAC,SAAS,UAAU,IAAI;KACxC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;CAC5B,CAAC;AAGF,wBAAgB,cAAc,CAAC,KAAK,CAAC,CAAC,SAAS,UAAU,EACvD,MAAM,EAAE;IACN,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,CAAC,CAAC;IACZ,eAAe,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;CACpC,IAGC,UAAS,aAAa,CAAC,CAAC,CAAM,EAC9B,kBAAc,YAmBjB;AAED,MAAM,MAAM,YAAY,CAAE,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,SAAS,CAAC,EAAE,MAAM,KAAK,MAAM,IAAI,WAAW,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,18 @@
1
+ // Generates CSS classes based on the selected variants.
2
+ export function createVariants(config) {
3
+ return (options = {}, className = "") => {
4
+ const classes = [config.base];
5
+ for (const key of Object.keys(config.variants)) {
6
+ const value = options[key] ?? config.defaultVariants?.[key];
7
+ if (value !== undefined) {
8
+ const cssClass = config.variants[key][value];
9
+ if (cssClass)
10
+ classes.push(cssClass);
11
+ }
12
+ }
13
+ if (className)
14
+ classes.push(className);
15
+ return classes.join(" ");
16
+ };
17
+ }
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAOA,wDAAwD;AACxD,MAAM,UAAU,cAAc,CAC5B,MAIC;IAED,OAAO,CACL,UAA4B,EAAE,EAC9B,SAAS,GAAG,EAAE,EACd,EAAE;QACF,MAAM,OAAO,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAE9B,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAmB,EAAE,CAAC;YACjE,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,eAAe,EAAE,CAAC,GAAG,CAAC,CAAC;YAE5D,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACxB,MAAM,QAAQ,GACZ,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,KAA4B,CAAC,CAAC;gBAErD,IAAI,QAAQ;oBAAE,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACvC,CAAC;QACH,CAAC;QAED,IAAI,SAAS;YAAE,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAEvC,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,34 @@
1
1
  {
2
2
  "name": "@pimolu/core",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0-beta.1",
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
+ "exports": {
21
+ ".": {
22
+ "types": "./dist/index.d.ts",
23
+ "import": "./dist/index.js",
24
+ "default": "./dist/index.js"
25
+ },
26
+ "./package.json": "./package.json"
27
+ },
28
+ "devDependencies": {
29
+ "typescript": "^6.0.3"
30
+ },
31
+ "scripts": {
32
+ "build": "tsc -p tsconfig.build.json"
33
+ }
6
34
  }