@navita/vitest 3.0.0-next.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/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Alexander Liljengård
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.md ADDED
@@ -0,0 +1,157 @@
1
+ ![Navita Logo](https://navita.style/navita.svg)
2
+
3
+ Navita is a powerful CSS-in-JS library
4
+ that brings type-safe compile-time Atomic CSS-in-JS with zero runtime to your projects.
5
+
6
+ It allows you to easily style your components and apply themes without the need for any additional runtime dependencies.
7
+
8
+ With Navita, you can write clean and maintainable CSS in JavaScript, without sacrificing runtime performance.
9
+
10
+
11
+ 🔥   All styles generated at build time — just like Sass, Less, etc.
12
+
13
+ ✨   Minimal abstraction over standard CSS.
14
+
15
+ 🦄   Works with any JS-based front-end framework — or even without one.
16
+
17
+ 🎨   High-level theme system with support for simultaneous themes.
18
+
19
+ 💪   Type-safe styles via [CSSType](https://github.com/frenic/csstype).
20
+
21
+ 🌳   Co-locate your styles with your components — if you want to.
22
+
23
+ 🛠   Integrations with popular bundlers such as Webpack, Vite, and Next.js.
24
+
25
+ ---
26
+ 🌐 [Check out the documentation site for setup guides, examples and API docs.](https://navita.style)
27
+
28
+ ---
29
+
30
+ ## Installation
31
+
32
+ To start using Navita in your project, simply follow these steps:
33
+
34
+ ### Install Navita using npm:
35
+
36
+ ```bash
37
+ npm install @navita/css --save
38
+ ```
39
+
40
+ You'll also need to install the Navita integration for your preferred bundler.
41
+ Navita currently supports Webpack, Vite, and Next.js.
42
+
43
+ ### Choose the integration for your preferred bundler:
44
+ #### If you are using Webpack, install the Webpack integration:
45
+
46
+ ```bash
47
+ npm install @navita/webpack-plugin mini-css-extract-plugin --save-dev
48
+ ```
49
+
50
+ Update your `webpack.config.js` file to include both MiniCssExtractPlugin and NavitaPlugin:
51
+
52
+ ```javascript
53
+ const { NavitaPlugin } = require('@navita/webpack-plugin');
54
+ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
55
+
56
+ module.exports = {
57
+ // Other webpack options,
58
+ plugins: [
59
+ new MiniCssExtractPlugin(),
60
+ new NavitaPlugin(),
61
+ ],
62
+ };
63
+ ```
64
+
65
+ Read more about the Webpack integration in the [Webpack documentation](https://navita.style/integrations/webpack).
66
+
67
+ #### If you are using Vite, install the Vite integration:
68
+
69
+ ```bash
70
+ npm install @navita/vite-plugin --save-dev
71
+ ```
72
+
73
+ And add it to your `vite.config.js` file:
74
+
75
+ ```typescript
76
+ import { defineConfig } from 'vite';
77
+ import { navita } from '@navita/vite-plugin';
78
+
79
+ export default defineConfig({
80
+ plugins: [
81
+ // Other plugins
82
+ navita(/* Additional options */)
83
+ ],
84
+ });
85
+ ```
86
+
87
+ Read more about the Vite integration in the [Vite documentation](https://navita.style/integrations/vite).
88
+
89
+ ##### If you are using Next.js, install the Next.js integration:
90
+
91
+ 🚀   React Server Components support!
92
+
93
+ ```bash
94
+ npm install @navita/next-plugin --save-dev
95
+ ```
96
+
97
+ And add it to your `next.config.js` file:
98
+
99
+ ```javascript
100
+ const { createNavitaStylePlugin } = require("@navita/next-plugin");
101
+
102
+ /** @type {import('next').NextConfig} */
103
+ const nextConfig = {};
104
+
105
+ module.exports = createNavitaStylePlugin({
106
+ // Additional options
107
+ })(nextConfig);
108
+ ```
109
+
110
+ Read more about the Next.js integration in the [Next.js documentation](https://navita.style/integrations/next).
111
+
112
+ ## Usage
113
+
114
+ The main entry point for Navita is the `style` function.
115
+ Make sure you read the reset of the documentation on
116
+ <https://navita.style> to learn more about the APIs.
117
+
118
+ ```typescript
119
+ import { style } from '@navita/css';
120
+
121
+ const container = style({
122
+ padding: '2rem',
123
+ background: 'hotpink',
124
+ color: 'white',
125
+ });
126
+
127
+ document.write(`
128
+ <div class="${container}">
129
+ Hello World!
130
+ </div>
131
+ `);
132
+ ```
133
+
134
+ That's it!
135
+
136
+ 💡 Only references to the classNames will be included in the bundle.
137
+
138
+ > Note: Navita doesn't require special file extensions for your styles.
139
+ You can co-locate your CSS styles with your components.
140
+
141
+ ## Documentation
142
+
143
+ For detailed documentation, examples, and usage guidelines,
144
+ please visit the official Navita website: <https://navita.style>
145
+
146
+ ## Contributing
147
+
148
+ We welcome contributions from the community to make Navita even better!
149
+
150
+ ## Thanks
151
+ * [Vanilla-Extract](https://vanilla-extract.style) and [Linaria](https://linaria.dev) for the inspiration and the great work on the CSS-in-JS ecosystem.
152
+ * [Fela](https://fela.js.org) for the fantastic work on Atomic css-in-js.
153
+ * [Eagerpatch](https://eagerpatch.com) for giving us the space to do interesting work.
154
+ ***
155
+
156
+ MIT Licensed—A project by [Eagerpatch](https://eagerpatch.com).\
157
+ Made with ❤️ by [zn4rk](https://github.com/zn4rk) and contributors.
package/index.cjs ADDED
@@ -0,0 +1,14 @@
1
+ let _navita_adapter = require("@navita/adapter");
2
+ let _navita_engine = require("@navita/engine");
3
+ //#region src/index.ts
4
+ (0, require("vitest").beforeEach)(() => {
5
+ const engine = new _navita_engine.Engine();
6
+ (0, _navita_adapter.setAdapter)({
7
+ generateIdentifier: (value) => engine.generateIdentifier(value),
8
+ addCss: (css) => engine.addStyle(css).toString(),
9
+ addStaticCss: (selector, css) => engine.addStatic(selector, css),
10
+ addFontFace: (fontFace) => engine.addFontFace(fontFace),
11
+ addKeyframe: (keyframe) => engine.addKeyframes(keyframe)
12
+ });
13
+ });
14
+ //#endregion
package/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export { };
package/index.mjs ADDED
@@ -0,0 +1,19 @@
1
+ import "node:path";
2
+ import "node:url";
3
+ import.meta.url;
4
+ import { setAdapter } from "@navita/adapter";
5
+ import { Engine } from "@navita/engine";
6
+ import { beforeEach } from "vitest";
7
+ //#region src/index.ts
8
+ beforeEach(() => {
9
+ const engine = new Engine();
10
+ setAdapter({
11
+ generateIdentifier: (value) => engine.generateIdentifier(value),
12
+ addCss: (css) => engine.addStyle(css).toString(),
13
+ addStaticCss: (selector, css) => engine.addStatic(selector, css),
14
+ addFontFace: (fontFace) => engine.addFontFace(fontFace),
15
+ addKeyframe: (keyframe) => engine.addKeyframes(keyframe)
16
+ });
17
+ });
18
+ //#endregion
19
+ export {};
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@navita/vitest",
3
+ "version": "3.0.0-next.0",
4
+ "description": "Vitest tools for Navita",
5
+ "keywords": [
6
+ "vitest",
7
+ "css-in-js",
8
+ "navita"
9
+ ],
10
+ "private": false,
11
+ "sideEffects": false,
12
+ "exports": {
13
+ ".": {
14
+ "import": "./index.mjs",
15
+ "require": "./index.cjs",
16
+ "types": "./index.d.ts"
17
+ }
18
+ },
19
+ "dependencies": {
20
+ "@navita/adapter": "3.0.0-next.0",
21
+ "@navita/engine": "3.0.0-next.0"
22
+ },
23
+ "peerDependencies": {
24
+ "vitest": "^3.0.0 || ^4.0.0"
25
+ },
26
+ "license": "MIT",
27
+ "author": "Eagerpatch",
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "https://github.com/eagerpatch/navita.git",
31
+ "directory": "packages/vitest"
32
+ }
33
+ }