ebt-vue3 2.34.0 → 2.35.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.
@@ -0,0 +1,8 @@
1
+ node_modules
2
+ dist
3
+ local
4
+ *.min.js
5
+ *.min.css
6
+ package-lock.json
7
+ yarn.lock
8
+ pnpm-lock.yaml
@@ -0,0 +1,11 @@
1
+ {
2
+ "semi": false,
3
+ "singleQuote": true,
4
+ "tabWidth": 2,
5
+ "useTabs": false,
6
+ "trailingComma": "es5",
7
+ "printWidth": 100,
8
+ "endOfLine": "lf",
9
+ "vueIndentScriptAndStyle": false,
10
+ "htmlWhitespaceSensitivity": "ignore"
11
+ }
package/eslint.config.js CHANGED
@@ -1,7 +1,42 @@
1
- module.exports = [{
2
- languageOptions: {
3
- globals: {
4
- xit: true,
5
- }
6
- }
7
- }];
1
+ import js from '@eslint/js'
2
+ import vue from 'eslint-plugin-vue'
3
+ import globals from 'globals'
4
+
5
+ export default [
6
+ js.configs.recommended,
7
+ ...vue.configs['flat/recommended'],
8
+ {
9
+ languageOptions: {
10
+ globals: {
11
+ ...globals.browser,
12
+ ...globals.node,
13
+ xit: true,
14
+ },
15
+ ecmaVersion: 2022,
16
+ sourceType: 'module',
17
+ },
18
+ plugins: {
19
+ vue,
20
+ },
21
+ rules: {
22
+ 'vue/multi-word-component-names': 'off',
23
+ 'vue/no-unused-vars': 'error',
24
+ 'no-unused-vars': 'error',
25
+ 'no-console': 'warn',
26
+ 'prefer-const': 'error',
27
+ 'no-var': 'error',
28
+ },
29
+ },
30
+ {
31
+ files: ['**/*.vue'],
32
+ languageOptions: {
33
+ parser: vue.parser,
34
+ parserOptions: {
35
+ parser: '@babel/eslint-parser',
36
+ requireConfigFile: false,
37
+ ecmaVersion: 2022,
38
+ sourceType: 'module',
39
+ },
40
+ },
41
+ },
42
+ ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ebt-vue3",
3
- "version": "2.34.0",
3
+ "version": "2.35.0",
4
4
  "description": "Vue3 Library for SuttaCentral Voice EBT-Sites",
5
5
  "author": "Karl Lew",
6
6
  "scripts": {
@@ -10,7 +10,12 @@
10
10
  "build:html": "scripts/app-html.sh",
11
11
  "build:messages": "node scripts/build-messages.mjs > src/auto/messages.mjs",
12
12
  "dev": "vite",
13
- "eslint": "eslint",
13
+ "dev:host": "vite --host",
14
+ "eslint": "eslint . --ext .js,.mjs,.vue",
15
+ "eslint:fix": "eslint . --ext .js,.mjs,.vue --fix",
16
+ "format": "prettier --write .",
17
+ "format:check": "prettier --check .",
18
+ "type-check": "vue-tsc --noEmit",
14
19
  "gh-pages": "scripts/gh-pages.sh",
15
20
  "git:commit": "scripts/git-commit.sh",
16
21
  "preview": "vite preview",
@@ -22,9 +27,13 @@
22
27
  "test:test": "mocha --config test/mocha-config.json -g TESTTEST",
23
28
  "test:verbose": "mocha --inline-diffs",
24
29
  "test:watch": "mocha -w --inline-diffs",
30
+ "test:debug": "mocha --inline-diffs --timeout 10000",
31
+ "test:coverage": "echo 'Coverage not configured yet'",
25
32
  "version": "scripts/version.sh",
26
33
  "vite": "vite",
27
- "vite:build": "vite build"
34
+ "vite:build": "vite build",
35
+ "lint": "npm run eslint && npm run format:check",
36
+ "lint:fix": "npm run eslint:fix && npm run format"
28
37
  },
29
38
  "main": "src/index.mjs",
30
39
  "module": "index.mjs",
@@ -48,12 +57,17 @@
48
57
  "webfontloader": "^1.0.0"
49
58
  },
50
59
  "devDependencies": {
60
+ "@babel/eslint-parser": "^7.24.0",
61
+ "@eslint/js": "^9.16.0",
51
62
  "@vitejs/plugin-vue": "^5.0.4",
63
+ "@vue/tsconfig": "^0.5.1",
52
64
  "ebt-deepl": "^1.58.0",
53
65
  "eslint": "^9.16.0",
66
+ "eslint-plugin-vue": "^9.28.0",
54
67
  "esm": "^3.2.25",
55
68
  "execa": "^6.1.0",
56
69
  "fake-indexeddb": "^4.0.0",
70
+ "globals": "^15.12.0",
57
71
  "json": "^11.0.0",
58
72
  "markdown-it": "^13.0.1",
59
73
  "markdown-it-footnote": "^3.0.3",
@@ -61,12 +75,15 @@
61
75
  "mocha": "^10.0.0",
62
76
  "mock-local-storage": "^1.0.4",
63
77
  "node-fetch": "^3.2.10",
78
+ "prettier": "^3.3.3",
64
79
  "scv-bilara": "^3.171.4",
65
80
  "should": "^13.2.3",
66
81
  "supertest": "^7.0.0",
67
82
  "ts-import": "^4.0.0-beta.6",
83
+ "typescript": "^5.6.3",
68
84
  "vite": "^6.3.5",
69
- "vue-cli-plugin-vuetify": "~2.5.1"
85
+ "vue-cli-plugin-vuetify": "~2.5.1",
86
+ "vue-tsc": "^2.1.10"
70
87
  },
71
88
  "bin": {},
72
89
  "directories": {
@@ -0,0 +1,23 @@
1
+ declare module '*.vue' {
2
+ import type { DefineComponent } from 'vue'
3
+ const component: DefineComponent<{}, {}, any>
4
+ export default component
5
+ }
6
+
7
+ declare module '*.mjs' {
8
+ const content: any
9
+ export default content
10
+ }
11
+
12
+ declare module '*.cjs' {
13
+ const content: any
14
+ export default content
15
+ }
16
+
17
+ declare module '*.json' {
18
+ const content: any
19
+ export default content
20
+ }
21
+
22
+ // Global variables
23
+ declare const xit: any
@@ -1,10 +1,11 @@
1
1
  import { default as EbtSettings } from "../src/ebt-settings.mjs";
2
2
  import { default as EbtCard } from "../src/ebt-card.mjs";
3
3
  import should from "should";
4
+ import { mockNavigator } from "./test-utils.mjs";
4
5
 
5
6
  (typeof describe === 'function') && describe("ebt-settings.mjs", function () {
6
7
  it("default ctor en", async () => {
7
- global.navigator = { languages: ['en-US'] };
8
+ mockNavigator(['en-US']);
8
9
  var ebt = new EbtSettings();
9
10
  should(ebt).properties({
10
11
  audio: EbtSettings.AUDIO.OGG,
@@ -42,7 +43,7 @@ import should from "should";
42
43
  });
43
44
  it("default ctor de-de", async () => {
44
45
  try {
45
- global.navigator = { languages: ['de-de'] };
46
+ mockNavigator(['de-de']);
46
47
  should(global.navigator.languages[0]).equal('de-de');
47
48
  let ebt = new EbtSettings();
48
49
  should(ebt).properties({
@@ -65,7 +66,7 @@ import should from "should";
65
66
  vnameTrans: 'Vicki',
66
67
  });
67
68
  } finally {
68
- global.navigator = { languages: ['en-us'] };
69
+ mockNavigator(['en-us']);
69
70
  }
70
71
  });
71
72
  it("INITIAL_STATE", async () => {
@@ -8,5 +8,8 @@
8
8
  "node_modules",
9
9
  ".git",
10
10
  "local"
11
+ ],
12
+ "require": [
13
+ "test/test-setup.mjs"
11
14
  ]
12
15
  }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Global test setup for ebt-vue3
3
+ * This file is automatically loaded by mocha before running tests
4
+ */
5
+
6
+ import { setupTestEnvironment } from './test-utils.mjs';
7
+
8
+ // Setup global test environment
9
+ setupTestEnvironment();
10
+
11
+ // Mock fetch if not available
12
+ if (!global.fetch) {
13
+ global.fetch = require('node-fetch');
14
+ }
15
+
16
+ // Set default log level to reduce noise during tests
17
+ if (typeof process !== 'undefined' && process.env.LOG_LEVEL) {
18
+ // Log level can be overridden via environment variable
19
+ } else {
20
+ // Default to warn level to reduce test noise
21
+ process.env.LOG_LEVEL = 'warn';
22
+ }
23
+
24
+ console.log('Test environment setup complete');
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Test utilities for ebt-vue3
3
+ * Provides common mocking functions and setup helpers
4
+ */
5
+
6
+ /**
7
+ * Mock the navigator object for Node.js environment
8
+ * @param {string[]} languages - Array of language codes
9
+ */
10
+ export const mockNavigator = (languages) => {
11
+ // Remove existing navigator if it exists
12
+ if (global.navigator) {
13
+ delete global.navigator;
14
+ }
15
+
16
+ // Create a new navigator object
17
+ Object.defineProperty(global, 'navigator', {
18
+ value: { languages },
19
+ writable: true,
20
+ configurable: true
21
+ });
22
+ };
23
+
24
+ /**
25
+ * Mock localStorage for Node.js environment
26
+ */
27
+ export const mockLocalStorage = () => {
28
+ if (global.localStorage) {
29
+ return;
30
+ }
31
+
32
+ // Simple localStorage mock
33
+ const store = {};
34
+ global.localStorage = {
35
+ getItem: (key) => store[key] || null,
36
+ setItem: (key, value) => { store[key] = value; },
37
+ removeItem: (key) => { delete store[key]; },
38
+ clear: () => { Object.keys(store).forEach(key => delete store[key]); },
39
+ length: 0,
40
+ key: (index) => Object.keys(store)[index] || null
41
+ };
42
+ };
43
+
44
+ /**
45
+ * Mock window object for Node.js environment
46
+ */
47
+ export const mockWindow = () => {
48
+ if (!global.window) {
49
+ global.window = {};
50
+ }
51
+
52
+ // Add localStorage to window if not present
53
+ if (!global.window.localStorage && global.localStorage) {
54
+ global.window.localStorage = global.localStorage;
55
+ }
56
+ };
57
+
58
+ /**
59
+ * Setup common test environment
60
+ * @param {object} options - Configuration options
61
+ * @param {string[]} options.navigatorLanguages - Languages for navigator mock
62
+ */
63
+ export const setupTestEnvironment = (options = {}) => {
64
+ const { navigatorLanguages = ['en-US'] } = options;
65
+
66
+ mockNavigator(navigatorLanguages);
67
+ mockLocalStorage();
68
+ mockWindow();
69
+ };
package/tsconfig.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
5
+ "module": "ESNext",
6
+ "skipLibCheck": true,
7
+ "moduleResolution": "bundler",
8
+ "allowImportingTsExtensions": true,
9
+ "resolveJsonModule": true,
10
+ "isolatedModules": true,
11
+ "noEmit": true,
12
+ "jsx": "preserve",
13
+ "strict": true,
14
+ "noUnusedLocals": true,
15
+ "noUnusedParameters": true,
16
+ "noFallthroughCasesInSwitch": true,
17
+ "baseUrl": ".",
18
+ "paths": {
19
+ "@/*": ["src/*"]
20
+ }
21
+ },
22
+ "include": [
23
+ "src/**/*.ts",
24
+ "src/**/*.d.ts",
25
+ "src/**/*.tsx",
26
+ "src/**/*.vue",
27
+ "src/**/*.js",
28
+ "src/**/*.mjs"
29
+ ],
30
+ "exclude": [
31
+ "node_modules",
32
+ "dist",
33
+ "local"
34
+ ]
35
+ }