@shopware/unocss-design-tokens-layer 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/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # @shopware/unocss-design-tokens-layer
2
+
3
+ Nuxt layer that provides the shared Shopware Frontends UnoCSS setup, design tokens, reset stylesheet, and runtime support for resolving dynamic utility classes.
4
+
5
+ It is intended to be composed with layers such as `@shopware/cms-base-layer`, while allowing projects to keep design tokens separate from CMS functionality.
6
+
7
+ ## Usage
8
+
9
+ ```ts
10
+ export default defineNuxtConfig({
11
+ extends: [
12
+ "@shopware/composables/nuxt-layer",
13
+ "@shopware/cms-base-layer",
14
+ "@shopware/unocss-design-tokens-layer",
15
+ ],
16
+ modules: ["@shopware/nuxt-module", "@unocss/nuxt"],
17
+ css: ["@unocss/reset/tailwind-compat.css"],
18
+ unocss: {
19
+ nuxtLayers: true,
20
+ },
21
+ });
22
+ ```
23
+
24
+ ## Customization
25
+
26
+ Extend the generated base Uno config in your project:
27
+
28
+ ```ts
29
+ import { mergeConfigs } from "@unocss/core";
30
+ import baseConfig from "./.nuxt/uno.config.mjs";
31
+
32
+ export default mergeConfigs([baseConfig, {
33
+ theme: {
34
+ colors: {
35
+ "brand-primary": "#123456",
36
+ },
37
+ },
38
+ }]);
39
+ ```
package/app/.gitkeep ADDED
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,17 @@
1
+ import initUnocssRuntime from "@unocss/runtime";
2
+ import { defineNuxtPlugin, useAppConfig } from "#imports";
3
+ import config from "../../uno.config";
4
+
5
+ // Resolves UnoCSS utility classes at runtime via DOM MutationObserver.
6
+ // Needed when CMS content contains dynamic classes not known at build time,
7
+ // since extracting all CMS-used classes from the backend during build is impractical.
8
+ // Trade-off: may cause layout shift as styles are applied after hydration.
9
+ // Can be disabled via app.config.ts: { unocssRuntime: false }
10
+ // When disabled, CMS classes unknown at build time won't be resolved —
11
+ // add them to the UnoCSS safelist in uno.config.ts to ensure they are generated.
12
+ export default defineNuxtPlugin(() => {
13
+ const appConfig = useAppConfig();
14
+ if (!appConfig.unocssRuntime) return;
15
+
16
+ initUnocssRuntime({ defaults: config });
17
+ });
package/index.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ /// <reference types="@nuxt/schema" />
2
+
3
+ export * from "./.nuxt/imports";
4
+
5
+ declare module "nuxt/schema" {
6
+ interface AppConfig extends CmsBaseLayerAppConfig {}
7
+ interface AppConfigInput extends CmsBaseLayerAppConfig {}
8
+ }
9
+
10
+ declare module "@nuxt/schema" {
11
+ interface AppConfig extends CmsBaseLayerAppConfig {}
12
+ interface AppConfigInput extends CmsBaseLayerAppConfig {}
13
+ }
package/nuxt.config.ts ADDED
@@ -0,0 +1,15 @@
1
+ import type { NuxtConfig } from "@nuxt/schema";
2
+ import { defineNuxtConfig } from "nuxt/config";
3
+
4
+ const config: NuxtConfig = defineNuxtConfig({
5
+ telemetry: {
6
+ enabled: false,
7
+ },
8
+ modules: ["@unocss/nuxt"],
9
+ css: ["@unocss/reset/tailwind-compat.css"],
10
+ unocss: {
11
+ nuxtLayers: true,
12
+ },
13
+ });
14
+
15
+ export default config;
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@shopware/unocss-design-tokens-layer",
3
+ "version": "0.0.1",
4
+ "description": "Reusable Nuxt Layer for Shopware design tokens and UnoCSS configuration",
5
+ "author": "Shopware",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/shopware/frontends.git"
9
+ },
10
+ "publishConfig": {
11
+ "access": "public"
12
+ },
13
+ "homepage": "https://frontends.shopware.com/",
14
+ "keywords": ["Shopware", "UnoCSS", "Nuxt", "Layer", "Design Tokens"],
15
+ "bugs": {
16
+ "url": "https://github.com/shopware/frontends/issues"
17
+ },
18
+ "license": "MIT",
19
+ "type": "module",
20
+ "main": "./nuxt.config.ts",
21
+ "files": ["app", "nuxt.config.ts", "index.d.ts", "uno.config.ts"],
22
+ "scripts": {
23
+ "lint": "biome check .",
24
+ "lint:fix": "biome check . --write && pnpm run typecheck",
25
+ "typecheck": "pnpm nuxt prepare && tsgo --noEmit"
26
+ },
27
+ "dependencies": {
28
+ "@unocss/nuxt": "66.6.0",
29
+ "@unocss/core": "66.6.0",
30
+ "@unocss/preset-wind3": "66.6.0",
31
+ "@unocss/runtime": "66.6.0",
32
+ "unocss": "66.6.0"
33
+ },
34
+ "devDependencies": {
35
+ "@biomejs/biome": "1.8.3",
36
+ "@nuxt/schema": "4.2.2",
37
+ "@typescript/native-preview": "7.0.0-dev.20260205.1",
38
+ "nuxt": "4.2.2",
39
+ "tsconfig": "workspace:*",
40
+ "typescript": "5.9.3",
41
+ "unbuild": "2.0.0"
42
+ }
43
+ }
package/uno.config.ts ADDED
@@ -0,0 +1,93 @@
1
+ import type { ConfigBase } from "@unocss/core";
2
+ import { presetIcons, presetWind3 } from "unocss";
3
+
4
+ const templateConfig: ConfigBase = {
5
+ theme: {
6
+ colors: {
7
+ "brand-primary": "#543B95",
8
+ "surface-surface": "#FFFFFF",
9
+ "outline-outline": "#79747E",
10
+ "outline-outline-variant": "#CAC4D0",
11
+ "outline-outline-primary": "#543B95",
12
+ "outline-outline-disabled": "#9893A6",
13
+ "outline-outline-focus": "#1722F9",
14
+ "surface-on-surface": "#1D1B20",
15
+ "states-info": "#0288D1",
16
+ "states-info-hover": "#0275B4",
17
+ "states-info-pressed": "#0275B4",
18
+ "states-on-info": "#FFFFFF",
19
+ "states-info-container": "#BBE7FF",
20
+ "states-on-info-container": "#013957",
21
+ "surface-surface-variant": "#FBF6FF",
22
+ "states-success": "#15B31C",
23
+ "states-success-hover": "#108C16",
24
+ "surface-on-surface-variant": "#696470",
25
+ "surface-surface-disabled": "#E8E8E8",
26
+ "states-success-pressed": "#108C16",
27
+ "surface-on-surface-disabled": "#9893A6",
28
+ "states-on-success": "#FFFFFF",
29
+ "surface-surface-primary": "#D0BCFF",
30
+ "surface-on-surface-primary": "#3A276A",
31
+ "surface-inverse-surface": "#322F35",
32
+ "states-success-container": "#C9FFCB",
33
+ "states-on-success-container": "#09480C",
34
+ "surface-inverse-on-surface": "#FFFFFF",
35
+ "states-warning": "#F57C00",
36
+ "states-warning-hover": "#C26200",
37
+ "surface-surface-container-lowest": "#FFFFFF",
38
+ "states-warning-pressed": "#C26200",
39
+ "surface-surface-container-low": "#F7F2FA",
40
+ "surface-surface-container": "#F3EDF7",
41
+ "states-on-warning": "#FFFFFF",
42
+ "states-warning-container": "#FFE1C2",
43
+ "surface-surface-container-high": "#ECE6F0",
44
+ "states-on-warning-container": "#874400",
45
+ "surface-surface-container-highest": "#E6E0E9",
46
+ "surface-background": "#FFFFFF",
47
+ "surface-on-background": "#1D1B20",
48
+ "states-error": "#D12D24",
49
+ "states-error-hover": "#AB251D",
50
+ "states-error-pressed": "#AB251D",
51
+ "states-on-error": "#FFFFFF",
52
+ "states-error-container": "#F9DEDC",
53
+ "states-on-error-container": "#852221",
54
+ "brand-primary-hover": "#45317A",
55
+ "brand-primary-pressed": "#45317A",
56
+ "brand-on-primary": "#FFFFFF",
57
+ "brand-secondary": "#E1D5FF",
58
+ "brand-secondary-hover": "#D0BCFC",
59
+ "brand-secondary-pressed": "#D0BCFC",
60
+ "brand-on-secondary": "#3A276A",
61
+ "brand-tertiary": "#F1F1F1",
62
+ "brand-tertiary-hover": "#E3E3E3",
63
+ "brand-tertiary-pressed": "#E3E3E3",
64
+ "brand-on-tertiary": "#1D1B20",
65
+ "fixed-fixed-on-image": "#FFFFFF",
66
+ "other-sale": "#D12D24",
67
+ "other-shadow": "#000000",
68
+ "overlay-dark-highest": "rgba(0, 0, 0, 0.75)",
69
+ "overlay-dark-high": "rgba(0, 0, 0, 0.5)",
70
+ "overlay-dark": "rgba(0, 0, 0, 0.30000001192092896)",
71
+ "overlay-dark-low": "rgba(0, 0, 0, 0.11999999731779099)",
72
+ "overlay-dark-lowest": "rgba(0, 0, 0, 0.07999999821186066)",
73
+ "overlay-light-highest": "rgba(255, 255, 255, 0.75)",
74
+ "overlay-light-high": "rgba(255, 255, 255, 0.5)",
75
+ "overlay-light": "rgba(255, 255, 255, 0.25)",
76
+ "overlay-light-low": "rgba(255, 255, 255, 0.11999999731779099)",
77
+ "overlay-light-lowest": "rgba(255, 255, 255, 0.07999999821186066)",
78
+ },
79
+ },
80
+ presets: [
81
+ presetWind3(),
82
+ presetIcons({
83
+ collections: {
84
+ carbon: () =>
85
+ import("@iconify-json/carbon/icons.json", {
86
+ with: { type: "json" },
87
+ }).then((i) => i.default),
88
+ },
89
+ }),
90
+ ],
91
+ };
92
+
93
+ export default templateConfig;