@bauer-group/accessibility-widget-nuxt 1.1.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/README.md +73 -0
- package/package.json +46 -0
- package/src/plugin.client.ts +86 -0
package/README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# @bauer-group/accessibility-widget-nuxt
|
|
2
|
+
|
|
3
|
+
<a id="english"></a>
|
|
4
|
+
|
|
5
|
+
> Nuxt 3 client plugin for the BAUER GROUP Accessibility Widget.
|
|
6
|
+
|
|
7
|
+
**🇬🇧 English** · [🇩🇪 Deutsch](#-deutsch)
|
|
8
|
+
|
|
9
|
+
## Setup
|
|
10
|
+
|
|
11
|
+
1. Copy the widget assets to `public/accessibility-widget/*`.
|
|
12
|
+
2. Copy the plugin file:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
cp node_modules/@bauer-group/accessibility-widget-nuxt/src/plugin.client.ts plugins/accessibility-widget.client.ts
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
3. In `nuxt.config.ts`:
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
export default defineNuxtConfig({
|
|
22
|
+
runtimeConfig: {
|
|
23
|
+
public: {
|
|
24
|
+
accessibilityWidget: {
|
|
25
|
+
loaderSrc: '/accessibility-widget/accessibility-widget-loader.min.js',
|
|
26
|
+
config: { locale: 'auto' },
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## License
|
|
34
|
+
|
|
35
|
+
MIT · © 2026 BAUER GROUP — the widget loaded at runtime is separately licensed (AGPL-3.0-only or commercial).
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
<a id="-deutsch"></a>
|
|
40
|
+
|
|
41
|
+
## 🇩🇪 Deutsch
|
|
42
|
+
|
|
43
|
+
> Nuxt-3-Client-Plugin für das BAUER GROUP Accessibility Widget.
|
|
44
|
+
|
|
45
|
+
[🇬🇧 English](#english) · **🇩🇪 Deutsch**
|
|
46
|
+
|
|
47
|
+
### Einrichtung
|
|
48
|
+
|
|
49
|
+
1. Widget-Assets nach `public/accessibility-widget/*` kopieren.
|
|
50
|
+
2. Plugin-Datei kopieren:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
cp node_modules/@bauer-group/accessibility-widget-nuxt/src/plugin.client.ts plugins/accessibility-widget.client.ts
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
3. In `nuxt.config.ts`:
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
export default defineNuxtConfig({
|
|
60
|
+
runtimeConfig: {
|
|
61
|
+
public: {
|
|
62
|
+
accessibilityWidget: {
|
|
63
|
+
loaderSrc: '/accessibility-widget/accessibility-widget-loader.min.js',
|
|
64
|
+
config: { locale: 'auto' },
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Lizenz
|
|
72
|
+
|
|
73
|
+
MIT · © 2026 BAUER GROUP — the widget loaded at runtime is separately licensed (AGPL-3.0-only or commercial).
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bauer-group/accessibility-widget-nuxt",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Nuxt Plugin für das BAUER GROUP Accessibility Widget.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "BAUER GROUP <info@ge.bauer-group.com>",
|
|
7
|
+
"homepage": "https://github.com/bauer-group/SaaS-AccessibilityWidgetIntegrations/tree/main/packages/js/nuxt",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/bauer-group/SaaS-AccessibilityWidgetIntegrations.git",
|
|
11
|
+
"directory": "packages/js/nuxt"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/bauer-group/SaaS-AccessibilityWidgetIntegrations/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"nuxt",
|
|
18
|
+
"vue",
|
|
19
|
+
"accessibility",
|
|
20
|
+
"a11y",
|
|
21
|
+
"wcag",
|
|
22
|
+
"bfsg",
|
|
23
|
+
"en301549",
|
|
24
|
+
"widget",
|
|
25
|
+
"bauer-group"
|
|
26
|
+
],
|
|
27
|
+
"type": "module",
|
|
28
|
+
"main": "./src/plugin.client.ts",
|
|
29
|
+
"files": [
|
|
30
|
+
"src",
|
|
31
|
+
"README.md"
|
|
32
|
+
],
|
|
33
|
+
"scripts": {
|
|
34
|
+
"typecheck": "tsc --noEmit"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"nuxt": ">=3.10"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"typescript": "^5.8.0"
|
|
41
|
+
},
|
|
42
|
+
"sideEffects": false,
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default CDN origin — the floating `v1` (major) tag. The widget stays current
|
|
3
|
+
* automatically. Override via runtimeConfig only to self-host/mirror.
|
|
4
|
+
*/
|
|
5
|
+
const CDN_V1 = 'https://widgets.professional-hosting.com/accessibility-widget/v1';
|
|
6
|
+
const DEFAULT_LOADER_SRC = `${CDN_V1}/accessibility-widget-loader.min.js`;
|
|
7
|
+
const DEFAULT_CORE_SRC = `${CDN_V1}/accessibility-widget-core.min.js`;
|
|
8
|
+
const DEFAULT_CSS_HREF = `${CDN_V1}/accessibility-widget.min.css`;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Subset of the widget's runtime configuration. Declared locally so this MIT
|
|
12
|
+
* wrapper carries no dependency on the (AGPL) widget package; unknown keys pass through.
|
|
13
|
+
*/
|
|
14
|
+
export interface WidgetConfig {
|
|
15
|
+
corePath?: string;
|
|
16
|
+
cssPath?: string;
|
|
17
|
+
position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
|
|
18
|
+
locale?: string;
|
|
19
|
+
primaryColor?: string;
|
|
20
|
+
[key: string]: unknown;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Nuxt client-only plugin. Copy this file to `plugins/accessibility-widget.client.ts`
|
|
25
|
+
* in your Nuxt app. By default the widget loads from the CDN `v1` tag — no config
|
|
26
|
+
* needed. To self-host/mirror, override via `runtimeConfig.public.accessibilityWidget`
|
|
27
|
+
* in nuxt.config.ts:
|
|
28
|
+
*
|
|
29
|
+
* export default defineNuxtConfig({
|
|
30
|
+
* runtimeConfig: {
|
|
31
|
+
* public: {
|
|
32
|
+
* accessibilityWidget: {
|
|
33
|
+
* loaderSrc: '/accessibility-widget/accessibility-widget-loader.min.js',
|
|
34
|
+
* coreSrc: '/accessibility-widget/accessibility-widget-core.min.js',
|
|
35
|
+
* cssHref: '/accessibility-widget/accessibility-widget.min.css',
|
|
36
|
+
* config: { locale: 'auto' },
|
|
37
|
+
* },
|
|
38
|
+
* },
|
|
39
|
+
* },
|
|
40
|
+
* });
|
|
41
|
+
*/
|
|
42
|
+
interface NuxtRuntime {
|
|
43
|
+
public: {
|
|
44
|
+
accessibilityWidget?: {
|
|
45
|
+
loaderSrc?: string;
|
|
46
|
+
coreSrc?: string;
|
|
47
|
+
cssHref?: string;
|
|
48
|
+
config?: WidgetConfig;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
declare function defineNuxtPlugin(fn: () => void): unknown;
|
|
54
|
+
declare function useRuntimeConfig(): NuxtRuntime;
|
|
55
|
+
|
|
56
|
+
export default defineNuxtPlugin(() => {
|
|
57
|
+
if (typeof window === 'undefined') return;
|
|
58
|
+
const cfg = useRuntimeConfig().public.accessibilityWidget ?? {};
|
|
59
|
+
const loaderSrc = cfg.loaderSrc ?? DEFAULT_LOADER_SRC;
|
|
60
|
+
const coreSrc = cfg.coreSrc ?? DEFAULT_CORE_SRC;
|
|
61
|
+
const cssHref = cfg.cssHref ?? DEFAULT_CSS_HREF;
|
|
62
|
+
|
|
63
|
+
const w = window as unknown as { AccessibilityWidgetConfig?: WidgetConfig };
|
|
64
|
+
// The loader can't derive core/CSS from its own <script src>; pin them here.
|
|
65
|
+
w.AccessibilityWidgetConfig = {
|
|
66
|
+
...(w.AccessibilityWidgetConfig ?? {}),
|
|
67
|
+
corePath: coreSrc,
|
|
68
|
+
cssPath: cssHref,
|
|
69
|
+
...(cfg.config ?? {}),
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
if (cssHref && !document.querySelector('link[data-aw-css]')) {
|
|
73
|
+
const link = document.createElement('link');
|
|
74
|
+
link.rel = 'stylesheet';
|
|
75
|
+
link.href = cssHref;
|
|
76
|
+
link.setAttribute('data-aw-css', '1');
|
|
77
|
+
document.head.appendChild(link);
|
|
78
|
+
}
|
|
79
|
+
if (loaderSrc && !document.querySelector('script[data-aw-loader]')) {
|
|
80
|
+
const s = document.createElement('script');
|
|
81
|
+
s.src = loaderSrc;
|
|
82
|
+
s.defer = true;
|
|
83
|
+
s.setAttribute('data-aw-loader', '1');
|
|
84
|
+
document.head.appendChild(s);
|
|
85
|
+
}
|
|
86
|
+
});
|