@human-synthesis/norns-core 0.0.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 +27 -0
- package/README.md +62 -0
- package/package.json +38 -0
- package/src/index.js +2 -0
- package/src/preprocess.js +15 -0
- package/src/uno.js +22 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Human Synthesis
|
|
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.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
This package is part of the Norns framework, which builds on Svelte
|
|
26
|
+
(https://github.com/sveltejs/svelte), Copyright (c) 2016-2025 Svelte
|
|
27
|
+
Contributors, MIT licensed.
|
package/README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# @human-synthesis/norns-core
|
|
2
|
+
|
|
3
|
+
Svelte with CoffeeScript, Pug, and UnoCSS preconfigured.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
pnpm add -D @human-synthesis/norns-core svelte unocss vite
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
`svelte.config.js`:
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
import { nornsPreprocess } from '@human-synthesis/norns-core/preprocess';
|
|
17
|
+
|
|
18
|
+
export default {
|
|
19
|
+
preprocess: nornsPreprocess()
|
|
20
|
+
};
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
`vite.config.js`:
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
import { defineConfig } from 'vite';
|
|
27
|
+
import { svelte } from '@sveltejs/vite-plugin-svelte';
|
|
28
|
+
import { nornsUno } from '@human-synthesis/norns-core/uno';
|
|
29
|
+
|
|
30
|
+
export default defineConfig({
|
|
31
|
+
plugins: [nornsUno(), svelte()]
|
|
32
|
+
});
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Writing components
|
|
36
|
+
|
|
37
|
+
```svelte
|
|
38
|
+
<template lang="pug">
|
|
39
|
+
h1.text-3xl.font-bold Hello {name}
|
|
40
|
+
button(on:click="{increment}") count is {count}
|
|
41
|
+
</template>
|
|
42
|
+
|
|
43
|
+
<script lang="coffee">
|
|
44
|
+
export let name = 'world'
|
|
45
|
+
count = 0
|
|
46
|
+
increment = -> count++
|
|
47
|
+
</script>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Why this exists
|
|
51
|
+
|
|
52
|
+
Norns wraps Svelte with the language and styling defaults we like:
|
|
53
|
+
|
|
54
|
+
- **CoffeeScript** in `<script lang="coffee">` blocks
|
|
55
|
+
- **Pug** in `<template lang="pug">` blocks
|
|
56
|
+
- **UnoCSS** with `presetUno`, `presetAttributify`, `presetIcons`, `presetTypography` enabled
|
|
57
|
+
|
|
58
|
+
The wrapper is intentionally thin — under the hood it's just `svelte-preprocess` and `unocss/vite` with reasonable defaults. Override anything by passing options.
|
|
59
|
+
|
|
60
|
+
## License & attribution
|
|
61
|
+
|
|
62
|
+
MIT © Human Synthesis. Built on top of [Svelte](https://github.com/sveltejs/svelte) © Svelte Contributors, MIT licensed.
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@human-synthesis/norns-core",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Norns core — Svelte with CoffeeScript, Pug, and UnoCSS preconfigured",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Human Synthesis",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/human-synthesis/norns-core.git"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"src",
|
|
14
|
+
"README.md"
|
|
15
|
+
],
|
|
16
|
+
"exports": {
|
|
17
|
+
".": "./src/index.js",
|
|
18
|
+
"./preprocess": "./src/preprocess.js",
|
|
19
|
+
"./uno": "./src/uno.js",
|
|
20
|
+
"./package.json": "./package.json"
|
|
21
|
+
},
|
|
22
|
+
"peerDependencies": {
|
|
23
|
+
"svelte": "^5.0.0",
|
|
24
|
+
"unocss": "^0.65.0",
|
|
25
|
+
"vite": "^5.0.0 || ^6.0.0"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"coffeescript": "^2.7.0",
|
|
29
|
+
"pug": "^3.0.3",
|
|
30
|
+
"svelte-preprocess": "^6.0.3"
|
|
31
|
+
},
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=18"
|
|
34
|
+
},
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"access": "public"
|
|
37
|
+
}
|
|
38
|
+
}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { sveltePreprocess } from 'svelte-preprocess';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Norns preprocessor: Svelte with CoffeeScript and Pug enabled by default.
|
|
5
|
+
*
|
|
6
|
+
* @param {import('svelte-preprocess').AutoPreprocessOptions} [options]
|
|
7
|
+
* @returns {import('svelte/compiler').PreprocessorGroup}
|
|
8
|
+
*/
|
|
9
|
+
export function nornsPreprocess(options = {}) {
|
|
10
|
+
return sveltePreprocess({
|
|
11
|
+
coffeescript: { bare: true },
|
|
12
|
+
pug: {},
|
|
13
|
+
...options
|
|
14
|
+
});
|
|
15
|
+
}
|
package/src/uno.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import UnoCSS from 'unocss/vite';
|
|
2
|
+
import { presetUno, presetAttributify, presetIcons, presetTypography } from 'unocss';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Norns UnoCSS Vite plugin with a sensible preset stack.
|
|
6
|
+
* Pass overrides to merge with the defaults.
|
|
7
|
+
*
|
|
8
|
+
* @param {import('unocss/vite').VitePluginConfig} [options]
|
|
9
|
+
*/
|
|
10
|
+
export function nornsUno(options = {}) {
|
|
11
|
+
const { presets = [], ...rest } = options;
|
|
12
|
+
return UnoCSS({
|
|
13
|
+
presets: [
|
|
14
|
+
presetUno(),
|
|
15
|
+
presetAttributify(),
|
|
16
|
+
presetIcons(),
|
|
17
|
+
presetTypography(),
|
|
18
|
+
...presets
|
|
19
|
+
],
|
|
20
|
+
...rest
|
|
21
|
+
});
|
|
22
|
+
}
|