@bysages/nuxt 0.1.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 +21 -0
- package/README.md +55 -0
- package/dist/module.d.mts +15 -0
- package/dist/module.json +9 -0
- package/dist/module.mjs +49 -0
- package/dist/runtime/plugin.d.ts +7 -0
- package/dist/runtime/plugin.js +7 -0
- package/dist/types.d.mts +9 -0
- package/package.json +65 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 By Sages
|
|
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,55 @@
|
|
|
1
|
+
# @bysages/nuxt
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
> The Nuxt module for By Sages Elements — registers every `@bysages/vue` family as an auto-imported component and ships the whole core style layer as one build-time stylesheet.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- 🧩 **Every family, auto-imported** — all 90+ `@bysages/vue` families register as Nuxt components; use `<Button>`, `<Dialog.Root>`, `<DataTable>` with no import lines
|
|
12
|
+
- 🖥️ **Styled SSR out of the box** — the core style layer compiles into the build as a single stylesheet, so server-rendered pages carry styled HTML and the first paint never waits on runtime injection
|
|
13
|
+
- 🌗 **Theme before mount** — an optional `theme` option applies mode, accent, scene, density, and contrast on the client before the app mounts
|
|
14
|
+
- 🔤 **Prefixed names on demand** — a `prefix` option namespaces the registrations (`<BsButton>`) when they must not collide
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# pnpm
|
|
20
|
+
pnpm add @bysages/nuxt
|
|
21
|
+
|
|
22
|
+
# npm
|
|
23
|
+
npm install @bysages/nuxt
|
|
24
|
+
|
|
25
|
+
# yarn
|
|
26
|
+
yarn add @bysages/nuxt
|
|
27
|
+
|
|
28
|
+
# bun
|
|
29
|
+
bun add @bysages/nuxt
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Quick Start
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
// nuxt.config.ts
|
|
36
|
+
export default defineNuxtConfig({
|
|
37
|
+
modules: ["@bysages/nuxt"],
|
|
38
|
+
bsElements: {
|
|
39
|
+
theme: { mode: "system", accent: "ink" },
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
```vue
|
|
45
|
+
<!-- app.vue -->
|
|
46
|
+
<template>
|
|
47
|
+
<Button tone="ink">Publish</Button>
|
|
48
|
+
</template>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The module wraps the [Vue package](../vue/README.md) — every family and prop documented there works here, and the token stylesheet is handled for you.
|
|
52
|
+
|
|
53
|
+
## License
|
|
54
|
+
|
|
55
|
+
- [MIT](../../LICENSE) © [By Sages](https://www.bysages.com/)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
+
import { ApplyThemeOptions } from '@bysages/core';
|
|
3
|
+
|
|
4
|
+
interface BsElementsOptions {
|
|
5
|
+
/** Prefix for the auto-imported components — "Bs" renders `<BsButton>`.
|
|
6
|
+
* Empty by default. */
|
|
7
|
+
prefix?: string;
|
|
8
|
+
/** Theme applied on the client before the app mounts: mode, accent,
|
|
9
|
+
* scene, density, contrast — anything `applyTheme` accepts. */
|
|
10
|
+
theme?: ApplyThemeOptions;
|
|
11
|
+
}
|
|
12
|
+
declare const _default: _nuxt_schema.NuxtModule<BsElementsOptions, BsElementsOptions, false>;
|
|
13
|
+
|
|
14
|
+
export { _default as default };
|
|
15
|
+
export type { BsElementsOptions };
|
package/dist/module.json
ADDED
package/dist/module.mjs
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { tokensCss, componentStyles } from '@bysages/core';
|
|
2
|
+
import { defineNuxtModule, createResolver, addComponent, addTemplate, addPlugin } from '@nuxt/kit';
|
|
3
|
+
|
|
4
|
+
function isComponentExport(value) {
|
|
5
|
+
if (typeof value === "function") return true;
|
|
6
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
|
|
7
|
+
if ("render" in value || "setup" in value) return true;
|
|
8
|
+
return Object.values(value).some(
|
|
9
|
+
(member) => typeof member === "function" || typeof member === "object" && member !== null && ("render" in member || "setup" in member)
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
const RESERVED = /* @__PURE__ */ new Set(["Icon"]);
|
|
13
|
+
const module$1 = defineNuxtModule({
|
|
14
|
+
meta: {
|
|
15
|
+
name: "@bysages/nuxt",
|
|
16
|
+
configKey: "bsElements"
|
|
17
|
+
},
|
|
18
|
+
defaults: {
|
|
19
|
+
prefix: ""
|
|
20
|
+
},
|
|
21
|
+
async setup(options, nuxt) {
|
|
22
|
+
const resolver = createResolver(import.meta.url);
|
|
23
|
+
const families = await import('@bysages/vue');
|
|
24
|
+
for (const name of Object.keys(families)) {
|
|
25
|
+
if (!/^[A-Z]/.test(name) || !isComponentExport(families[name])) continue;
|
|
26
|
+
if (RESERVED.has(name)) continue;
|
|
27
|
+
addComponent({
|
|
28
|
+
name: options.prefix + name,
|
|
29
|
+
export: name,
|
|
30
|
+
filePath: "@bysages/vue"
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
nuxt.options.build.transpile.push("@bysages/nuxt", "@bysages/vue", "@bysages/core");
|
|
34
|
+
nuxt.options.runtimeConfig.public.bsElements = {
|
|
35
|
+
theme: options.theme ?? null
|
|
36
|
+
};
|
|
37
|
+
const styles = addTemplate({
|
|
38
|
+
filename: "bs-styles/core.css",
|
|
39
|
+
getContents: () => tokensCss + Object.values(componentStyles).join("\n"),
|
|
40
|
+
write: true
|
|
41
|
+
});
|
|
42
|
+
nuxt.options.css.push(styles.dst);
|
|
43
|
+
nuxt.options.app.head.meta ||= [];
|
|
44
|
+
nuxt.options.app.head.meta.push({ name: "bs-styles-shipped", content: "build" });
|
|
45
|
+
addPlugin(resolver.resolve("./runtime/plugin"));
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
export { module$1 as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Applies the theme configured through module options on the client.
|
|
2
|
+
* The wrappers' own injection already stands down against the build-time
|
|
3
|
+
* stylesheet via the head marker the module plants. Published modules
|
|
4
|
+
* cannot lean on the application's auto-imports — the Nuxt APIs come
|
|
5
|
+
* in explicitly from `#imports`, which the consuming build resolves. */
|
|
6
|
+
declare const _default: any;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { applyTheme } from "@bysages/core";
|
|
2
|
+
import { defineNuxtPlugin, useRuntimeConfig } from "#imports";
|
|
3
|
+
export default defineNuxtPlugin(() => {
|
|
4
|
+
if (import.meta.server) return;
|
|
5
|
+
const { theme } = useRuntimeConfig().public.bsElements;
|
|
6
|
+
if (theme) applyTheme(theme);
|
|
7
|
+
});
|
package/dist/types.d.mts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { NuxtModule } from '@nuxt/schema'
|
|
2
|
+
|
|
3
|
+
import type { default as Module } from './module.mjs'
|
|
4
|
+
|
|
5
|
+
export type ModuleOptions = typeof Module extends NuxtModule<infer O> ? Partial<O> : Record<string, any>
|
|
6
|
+
|
|
7
|
+
export { default } from './module.mjs'
|
|
8
|
+
|
|
9
|
+
export { type BsElementsOptions } from './module.mjs'
|
package/package.json
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bysages/nuxt",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Nuxt module for By Sages Elements — auto-imports the paper-and-ink Vue components and applies the theme",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"components",
|
|
7
|
+
"design-system",
|
|
8
|
+
"design-tokens",
|
|
9
|
+
"nuxt",
|
|
10
|
+
"nuxt-module",
|
|
11
|
+
"theming",
|
|
12
|
+
"ui",
|
|
13
|
+
"vue"
|
|
14
|
+
],
|
|
15
|
+
"homepage": "https://github.com/bysages/elements#readme",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/bysages/elements/issues"
|
|
18
|
+
},
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"author": {
|
|
21
|
+
"name": "By Sages",
|
|
22
|
+
"email": "contact@bysages.com",
|
|
23
|
+
"url": "https://www.bysages.com/"
|
|
24
|
+
},
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "git+https://github.com/bysages/elements"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"dist"
|
|
31
|
+
],
|
|
32
|
+
"type": "module",
|
|
33
|
+
"main": "./dist/module.mjs",
|
|
34
|
+
"typesVersions": {
|
|
35
|
+
"*": {
|
|
36
|
+
".": [
|
|
37
|
+
"./dist/types.d.mts"
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"exports": {
|
|
42
|
+
".": {
|
|
43
|
+
"types": "./dist/types.d.mts",
|
|
44
|
+
"import": "./dist/module.mjs"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"@nuxt/kit": "^4.5.2",
|
|
49
|
+
"@bysages/vue": "0.1.1",
|
|
50
|
+
"@bysages/core": "0.1.1"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@nuxt/module-builder": "1.0.3",
|
|
54
|
+
"nuxt": "4.5.2"
|
|
55
|
+
},
|
|
56
|
+
"peerDependencies": {
|
|
57
|
+
"nuxt": "^4.0.0",
|
|
58
|
+
"vue": "^3.5"
|
|
59
|
+
},
|
|
60
|
+
"scripts": {
|
|
61
|
+
"dev": "nuxt-module-build build --stub",
|
|
62
|
+
"build": "nuxt-module-build build",
|
|
63
|
+
"release": "basis publish"
|
|
64
|
+
}
|
|
65
|
+
}
|