@forsakringskassan/vue-lib-template 1.6.1 → 1.6.3

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.
Files changed (31) hide show
  1. package/files/docs/guide/cat-info.md +3 -3
  2. package/files/docs/package.json +3 -3
  3. package/files/etc/lib.api.md +1 -1
  4. package/files/etc/selectors.api.md +1 -1
  5. package/files/package.json +28 -28
  6. package/files/project-guide/development.md +8 -8
  7. package/files/project-guide/documentation.md +8 -8
  8. package/files/project-guide/index.md +6 -6
  9. package/files/project-guide/testing.md +4 -4
  10. package/files/src/components/guide/README.md +1 -1
  11. package/files/src/components/guide/{FcCatInfo → cat-info}/cat-data.ts +1 -1
  12. package/files/src/components/guide/{FcCatInfo → cat-info}/cat-info-logic.ts +1 -1
  13. package/files/src/components/guide/{FcCatInfo/FcCatInfoComponent.cy.ts → cat-info/cat-info.cy.ts} +7 -7
  14. package/files/src/components/guide/{FcCatInfo/FcCatInfoComponent.vue → cat-info/cat-info.vue} +2 -2
  15. package/files/src/components/guide/{FcCatInfo/examples/FcCatInfoComponentExample.vue → cat-info/examples/cat-info-example.vue} +2 -2
  16. package/files/src/components/guide/{FcCatInfo/examples/FcCatInfoComponentLiveExample.vue → cat-info/examples/cat-info-live-example.vue} +4 -4
  17. package/files/src/components/guide/cat-info/index.ts +1 -0
  18. package/files/src/components/guide/index.ts +1 -1
  19. package/files/src/mocks/guide/cat-api.mock.mts +2 -2
  20. package/files/src/selectors/guide/{FcCatInfoComponent.selectors.spec.ts → cat-info.selectors.spec.ts} +15 -17
  21. package/files/src/selectors/guide/{FcCatInfoComponent.selectors.ts → cat-info.selectors.ts} +4 -4
  22. package/files/src/selectors/guide/index.ts +1 -1
  23. package/index.js +3 -1
  24. package/package.json +44 -17
  25. package/files/src/components/guide/FcCatInfo/index.ts +0 -1
  26. /package/files/src/components/guide/{FcCatInfo → cat-info}/cat-api.spec.ts +0 -0
  27. /package/files/src/components/guide/{FcCatInfo → cat-info}/cat-api.ts +0 -0
  28. /package/files/src/components/guide/{FcCatInfo/CatInfoEdit.vue → cat-info/cat-info-edit.vue} +0 -0
  29. /package/files/src/components/guide/{FcCatInfo → cat-info}/cat-info-logic.spec.ts +0 -0
  30. /package/files/src/components/guide/{FcCatInfo/CatInfoShow.vue → cat-info/cat-info-show.vue} +0 -0
  31. /package/files/src/components/guide/{FcCatInfo → cat-info}/cat-types.ts +0 -0
@@ -2,14 +2,14 @@
2
2
  title: Kattinformation
3
3
  status: Draft
4
4
  layout: component
5
- component: FcCatInfoComponent
5
+ component: FcCatInfo
6
6
  ---
7
7
 
8
8
  Komponenten kan visa kattdata i visningsläge eller i ett redigerbart läge.
9
9
  Den hämtar kattdata från ett mockat backend.
10
10
 
11
11
  ```import live-example
12
- FcCatInfoComponentLiveExample.vue
12
+ cat-info-live-example.vue
13
13
  ```
14
14
 
15
15
  ## Tänk på att
@@ -24,5 +24,5 @@ FcCatInfoComponentLiveExample.vue
24
24
  ## API
25
25
 
26
26
  ::: api
27
- vue:FcCatInfoComponent
27
+ vue:cat-info
28
28
  :::
@@ -10,10 +10,10 @@
10
10
  "start": "http-server public"
11
11
  },
12
12
  "devDependencies": {
13
- "@fkui/icon-lib-default": "6.60.0",
14
- "@fkui/vue": "6.60.0",
13
+ "@fkui/icon-lib-default": "6.61.0",
14
+ "@fkui/vue": "6.61.0",
15
15
  "@forsakringskassan/apimock-express": "4.2.1",
16
- "@forsakringskassan/docs-generator": "3.15.0",
16
+ "@forsakringskassan/docs-generator": "3.18.0",
17
17
  "@tsconfig/node24": "24.0.5",
18
18
  "@tsconfig/recommended": "1.0.13",
19
19
  "http-server": "14.1.1",
@@ -12,7 +12,7 @@ import { PublicProps } from 'vue';
12
12
  // Warning: (ae-forgotten-export) The symbol "__VLS_export" needs to be exported by the entry point index.d.ts
13
13
  //
14
14
  // @public (undocumented)
15
- export const FcCatInfoComponent: typeof __VLS_export;
15
+ export const FcCatInfo: typeof __VLS_export;
16
16
 
17
17
  // (No @packageDocumentation comment for this package)
18
18
 
@@ -5,7 +5,7 @@
5
5
  ```ts
6
6
 
7
7
  // @public
8
- export function FcCatInfoComponentSelectors(selector?: string): Readonly<{
8
+ export function FcCatInfoSelectors(selector?: string): Readonly<{
9
9
  readonly selector: string;
10
10
  loadingContainer(): string;
11
11
  viewContainer(): string;
@@ -86,52 +86,52 @@
86
86
  "devDependencies": {
87
87
  "@babel/core": "7.29.7",
88
88
  "@babel/preset-env": "7.29.7",
89
- "@fkui/design": "6.60.0",
90
- "@fkui/font-default": "6.60.0",
91
- "@fkui/icon-lib-default": "6.60.0",
92
- "@fkui/logic": "6.60.0",
93
- "@fkui/test-utils": "6.60.0",
94
- "@fkui/theme-default": "6.60.0",
95
- "@fkui/vue": "6.60.0",
89
+ "@fkui/design": "6.61.0",
90
+ "@fkui/font-default": "6.61.0",
91
+ "@fkui/icon-lib-default": "6.61.0",
92
+ "@fkui/logic": "6.61.0",
93
+ "@fkui/test-utils": "6.61.0",
94
+ "@fkui/theme-default": "6.61.0",
95
+ "@fkui/vue": "6.61.0",
96
96
  "@forsakringskassan/apimock-express": "4.2.1",
97
97
  "@forsakringskassan/commitlint-config": "4.2.8",
98
98
  "@forsakringskassan/cypress-config": "1.10.0",
99
99
  "@forsakringskassan/cypress-visual-regression": "5.2.0",
100
- "@forsakringskassan/docs-generator": "3.15.0",
101
- "@forsakringskassan/docs-live-example": "3.0.2",
102
- "@forsakringskassan/eslint-config": "15.11.4",
103
- "@forsakringskassan/eslint-config-cli": "15.11.0",
104
- "@forsakringskassan/eslint-config-cypress": "15.11.0",
100
+ "@forsakringskassan/docs-generator": "3.18.0",
101
+ "@forsakringskassan/docs-live-example": "3.0.3",
102
+ "@forsakringskassan/eslint-config": "15.11.12",
103
+ "@forsakringskassan/eslint-config-cli": "15.11.11",
104
+ "@forsakringskassan/eslint-config-cypress": "15.11.10",
105
105
  "@forsakringskassan/eslint-config-jest": "15.11.1",
106
- "@forsakringskassan/eslint-config-typescript": "15.11.2",
107
- "@forsakringskassan/eslint-config-typescript-typeinfo": "15.11.2",
108
- "@forsakringskassan/eslint-config-vitest": "15.11.0",
109
- "@forsakringskassan/eslint-config-vue": "15.11.5",
106
+ "@forsakringskassan/eslint-config-typescript": "15.11.10",
107
+ "@forsakringskassan/eslint-config-typescript-typeinfo": "15.11.7",
108
+ "@forsakringskassan/eslint-config-vitest": "15.11.11",
109
+ "@forsakringskassan/eslint-config-vue": "15.11.11",
110
110
  "@forsakringskassan/prettier-config": "3.7.11",
111
- "@forsakringskassan/stylelint-config": "3.5.0",
112
- "@forsakringskassan/vite-lib-config": "5.12.5",
113
- "@forsakringskassan/vitest-config-jsdom": "5.0.0",
114
- "@forsakringskassan/vue-lib-template": "1.6.1",
111
+ "@forsakringskassan/stylelint-config": "3.5.1",
112
+ "@forsakringskassan/vite-lib-config": "5.13.0",
113
+ "@forsakringskassan/vitest-config-jsdom": "5.0.1",
114
+ "@forsakringskassan/vue-lib-template": "1.6.3",
115
115
  "@html-validate/release-scripts": "7.6.12",
116
- "@types/node": "24.19.0",
116
+ "@types/node": "24.19.1",
117
117
  "@typescript/native": "npm:typescript@7.0.2",
118
118
  "@vue/server-renderer": "3.5.43",
119
119
  "@vue/test-utils": "2.5.1",
120
- "cloneman": "1.26.0",
120
+ "cloneman": "1.27.1",
121
121
  "core-js": "3.50.0",
122
- "cypress": "16.1.0",
123
- "html-validate": "11.16.1",
122
+ "cypress": "16.1.1",
123
+ "html-validate": "11.16.2",
124
124
  "html-validate-markdown": "6.0.0",
125
125
  "html-validate-vue": "9.3.1",
126
126
  "mocha-junit-reporter": "2.2.1",
127
- "npm-pkg-lint": "5.3.1",
127
+ "npm-pkg-lint": "5.4.0",
128
128
  "npm-run-all2": "9.0.3",
129
129
  "rimraf": "6.1.3",
130
130
  "typescript": "npm:@typescript/typescript6@6.0.2",
131
- "vite": "8.3.1",
132
- "vitest": "5.0.2",
131
+ "vite": "8.3.2",
132
+ "vitest": "5.0.3",
133
133
  "vue": "3.5.43",
134
- "vue-tsc": "3.3.11"
134
+ "vue-tsc": "3.3.12"
135
135
  },
136
136
  "peerDependencies": {
137
137
  "@fkui/design": "^6.0.0",
@@ -11,24 +11,24 @@ To get up and running quickly:
11
11
 
12
12
  ## Architecture: Three Layers
13
13
 
14
- We recommend separating Appearance, Logic, and Types into three distinct layers to keep the codebase maintainable. You can find an example component, [`FcCatInfoComponent`](https://github.com/Forsakringskassan/vue-lib-template/blob/main/src/components/guide/FcCatInfo/FcCatInfoComponent.vue), which demonstrates how this structure can be applied in practice:
14
+ We recommend separating Appearance, Logic, and Types into three distinct layers to keep the codebase maintainable. You can find an example component, [`FcCatInfo`](https://github.com/Forsakringskassan/vue-lib-template/blob/main/src/components/guide/cat-info/cat-info.vue), which demonstrates how this structure can be applied in practice:
15
15
 
16
16
  ### 1. Type Layer
17
17
 
18
- In the example [cat-types.ts](https://github.com/Forsakringskassan/vue-lib-template/blob/main/src/components/guide/FcCatInfo/cat-types.ts), we define _what_ the data is using TypeScript interfaces.
18
+ In the example [cat-types.ts](https://github.com/Forsakringskassan/vue-lib-template/blob/main/src/components/guide/cat-info/cat-types.ts), we define _what_ the data is using TypeScript interfaces.
19
19
 
20
20
  - **Why?** It ensures that both the logic and the component know exactly which fields (e.g., `name`, `age`) exist.
21
21
 
22
22
  ### 2. Logic Layer
23
23
 
24
- In the example [cat-info-logic.ts](https://github.com/Forsakringskassan/vue-lib-template/blob/main/src/components/guide/FcCatInfo/cat-info-logic.ts), we create a so-called "composable" (a function that starts with `use...`, e.g., `useCatInfo`).
24
+ In the example [cat-info-logic.ts](https://github.com/Forsakringskassan/vue-lib-template/blob/main/src/components/guide/cat-info/cat-info-logic.ts), we create a so-called "composable" (a function that starts with `use...`, e.g., `useCatInfo`).
25
25
 
26
26
  - This is where we handle API calls, state (loading, error), and calculations.
27
27
  - **Why?** It makes the logic easy to test with Vitest without needing to start a full browser.
28
28
 
29
29
  ### 3. UI Layer
30
30
 
31
- Refer to [FcCatInfoComponent.vue](https://github.com/Forsakringskassan/vue-lib-template/blob/main/src/components/guide/FcCatInfo/FcCatInfoComponent.vue) for the actual Vue component. This should be "thin".
31
+ Refer to [cat-info.vue](https://github.com/Forsakringskassan/vue-lib-template/blob/main/src/components/guide/cat-info/cat-info.vue) for the actual Vue component. This should be "thin".
32
32
 
33
33
  - It imports the logic from `useCatInfo`.
34
34
  - It uses components from `@fkui/vue` (such as `FCard` or `FLoader`) to follow the design system.
@@ -36,19 +36,19 @@ Refer to [FcCatInfoComponent.vue](https://github.com/Forsakringskassan/vue-lib-t
36
36
 
37
37
  ## Implementation Flow
38
38
 
39
- 1. **Create the files**: Create `MyComponent.vue`, `my-component-logic.ts`, and `my-component-types.ts`.
39
+ 1. **Create the files**: Create `my-component.vue`, `my-component-logic.ts`, and `my-component-types.ts`.
40
40
  2. **Implement logic**: Create your `useMyComponent` function and export it.
41
41
  3. **Build UI**: Import the logic into the `.vue` file and connect variables to the template.
42
42
  4. **Export**: Open `src/components/index.ts` and add:
43
43
 
44
44
  ```typescript
45
- export { default as MyComponent } from "./MyComponent.vue";
45
+ export { default as FcMyComponent } from "./my-component.vue";
46
46
  ```
47
47
 
48
48
  ## Styling
49
49
 
50
50
  - For small amounts of styling, it is perfectly fine to use `<style lang="scss"></style>` directly within the `.vue` file.
51
- - For more extensive styles, create a dedicated SCSS file for the component (e.g., `MyComponent.scss`) and import it in the `.vue` file.
51
+ - For more extensive styles, create a dedicated SCSS file for the component (e.g., `my-component.scss`) and import it in the `.vue` file.
52
52
  - Use `style.scss` for styles that should apply to the entire library.
53
53
 
54
54
  ## Common commands
@@ -82,7 +82,7 @@ You can run a specific example file directly by passing a name to the start comm
82
82
  npm start catinfo
83
83
  ```
84
84
 
85
- This uses fuzzy search to find and start the best matching file in `src/examples/` (e.g., `CatInfoExample.vue`).
85
+ This uses fuzzy search to find and start the best matching file in `src/examples/` (e.g., `cat-info-example.vue`).
86
86
 
87
87
  ## API URL configuration
88
88
 
@@ -15,7 +15,7 @@ Put the component page in `docs/components/` and give it the same base name as t
15
15
  title: Cat information
16
16
  status: Draft
17
17
  layout: component
18
- component: FcCatInfoComponent
18
+ component: FcCatInfo
19
19
  ---
20
20
  ```
21
21
 
@@ -29,21 +29,21 @@ A standard runnable example is included with an `import` fence:
29
29
 
30
30
  ````md
31
31
  ```import
32
- CatInfoExample.vue
32
+ my-component-example.vue
33
33
  ```
34
34
  ````
35
35
 
36
- The corresponding example is [`FcCatInfoComponentExample.vue`](https://github.com/Forsakringskassan/vue-lib-template/blob/main/src/components/guide/FcCatInfo/examples/FcCatInfoComponentExample.vue). Keep the example focused on a realistic use case and make its initial state useful without extra setup.
36
+ The corresponding example is [`cat-info-example.vue`](https://github.com/Forsakringskassan/vue-lib-template/blob/main/src/components/guide/cat-info/examples/cat-info-example.vue). Keep the example focused on a realistic use case and make its initial state useful without extra setup.
37
37
 
38
- Prefer a live example when the documentation needs interactive controls or a richer demonstration. Include a file ending in `LiveExample.vue` with the `live-example` variant:
38
+ Prefer a live example when the documentation needs interactive controls or a richer demonstration. Include a kebab-case file ending in `-live-example.vue` with the `live-example` variant:
39
39
 
40
40
  ````md
41
41
  ```import live-example
42
- FcCatInfoComponentLiveExample.vue
42
+ cat-info-live-example.vue
43
43
  ```
44
44
  ````
45
45
 
46
- The reference implementation shows this pattern in [FcCatInfoComponentLiveExample.vue](https://github.com/Forsakringskassan/vue-lib-template/blob/main/src/components/guide/FcCatInfo/examples/FcCatInfoComponentLiveExample.vue) and its [documentation page](https://github.com/Forsakringskassan/vue-lib-template/blob/main/docs/guide/index.md).
46
+ The reference implementation shows this pattern in [cat-info-live-example.vue](https://github.com/Forsakringskassan/vue-lib-template/blob/main/src/components/guide/cat-info/examples/cat-info-live-example.vue) and its [documentation page](https://github.com/Forsakringskassan/vue-lib-template/blob/main/docs/guide/cat-info.md).
47
47
 
48
48
  See the [docs-live-example README](https://github.com/Forsakringskassan/docs-live-example/blob/main/README.md) for the implementation details behind interactive examples.
49
49
 
@@ -70,10 +70,10 @@ Add the Vue API block for every component page:
70
70
  ## API
71
71
 
72
72
  ::: api
73
- vue:FcCatInfoComponent
73
+ vue:cat-info
74
74
  :::
75
75
  ```
76
76
 
77
- The component name must match the Vue component passed to the generator. Public props, events, slots, and documented types are extracted from the component source and its declarations. Keep public API comments accurate because they are part of the generated documentation.
77
+ The component name must match the Vue SFC's base filename. Public props, events, slots, and documented types are extracted from the component source and its declarations. Keep public API comments accurate because they are part of the generated documentation.
78
78
 
79
79
  If the component has translation keys, add the corresponding translation API block. Do not add empty sections for features the component does not use.
@@ -31,12 +31,12 @@ Here are the most important locations you need to know:
31
31
 
32
32
  The `vue-lib-template` template repository, which this component library is based on, contains a small cat information component that demonstrates the recommended structure. It is useful as a starting point when creating a new component:
33
33
 
34
- - [Component](https://github.com/Forsakringskassan/vue-lib-template/blob/main/src/components/guide/FcCatInfo/FcCatInfoComponent.vue)
35
- - [Runnable example](https://github.com/Forsakringskassan/vue-lib-template/blob/main/src/components/guide/FcCatInfo/examples/FcCatInfoComponentExample.vue)
36
- - [Live-example](https://github.com/Forsakringskassan/vue-lib-template/blob/main/src/components/guide/FcCatInfo/examples/FcCatInfoComponentLiveExample.vue)
37
- - [Unit tests](https://github.com/Forsakringskassan/vue-lib-template/blob/main/src/components/guide/FcCatInfo/cat-info-logic.spec.ts)
38
- - [Cypress component tests](https://github.com/Forsakringskassan/vue-lib-template/blob/main/src/components/guide/FcCatInfo/FcCatInfoComponent.cy.ts)
39
- - [Cypress selectors](https://github.com/Forsakringskassan/vue-lib-template/blob/main/src/selectors/guide/FcCatInfoComponent.selectors.ts)
34
+ - [Component](https://github.com/Forsakringskassan/vue-lib-template/blob/main/src/components/guide/cat-info/cat-info.vue)
35
+ - [Runnable example](https://github.com/Forsakringskassan/vue-lib-template/blob/main/src/components/guide/cat-info/examples/cat-info-example.vue)
36
+ - [Live example](https://github.com/Forsakringskassan/vue-lib-template/blob/main/src/components/guide/cat-info/examples/cat-info-live-example.vue)
37
+ - [Unit tests](https://github.com/Forsakringskassan/vue-lib-template/blob/main/src/components/guide/cat-info/cat-info-logic.spec.ts)
38
+ - [Cypress component tests](https://github.com/Forsakringskassan/vue-lib-template/blob/main/src/components/guide/cat-info/cat-info.cy.ts)
39
+ - [Cypress selectors](https://github.com/Forsakringskassan/vue-lib-template/blob/main/src/selectors/guide/cat-info.selectors.ts)
40
40
  - [API mock](https://github.com/Forsakringskassan/vue-lib-template/blob/main/src/mocks/guide/cat-api.mock.mts)
41
41
  - [Mock registration](https://github.com/Forsakringskassan/vue-lib-template/blob/main/src/mocks/index.mts)
42
42
 
@@ -10,7 +10,7 @@ Use Vitest for composables, business rules, data transformations. Keep these tes
10
10
 
11
11
  Run tests with `npm run unit`.
12
12
 
13
- The cat information logic is tested in [`cat-info-logic.spec.ts`](https://github.com/Forsakringskassan/vue-lib-template/blob/main/src/components/guide/FcCatInfo/cat-info-logic.spec.ts). It mocks the API module and verifies loading, successful data, errors, and updates:
13
+ The cat information logic is tested in [`cat-info-logic.spec.ts`](https://github.com/Forsakringskassan/vue-lib-template/blob/main/src/components/guide/cat-info/cat-info-logic.spec.ts). It mocks the API module and verifies loading, successful data, errors, and updates:
14
14
 
15
15
  ```ts
16
16
  import { expect, it, vi } from "vitest";
@@ -71,7 +71,7 @@ See the [apimock-express README](https://github.com/Forsakringskassan/apimock-ex
71
71
 
72
72
  ## Cypress component tests
73
73
 
74
- Use Cypress for user-visible component behavior: rendering, loading states, form interaction, emitted actions, error states, and accessibility-related behavior. The current example is [`FcCatInfoComponent.cy.ts`](https://github.com/Forsakringskassan/vue-lib-template/blob/main/src/components/guide/FcCatInfo/FcCatInfoComponent.cy.ts).
74
+ Use Cypress for user-visible component behavior: rendering, loading states, form interaction, emitted actions, error states, and accessibility-related behavior. The current example is [`cat-info.cy.ts`](https://github.com/Forsakringskassan/vue-lib-template/blob/main/src/components/guide/cat-info/cat-info.cy.ts).
75
75
 
76
76
  The current package does not define a dedicated Cypress npm script, so run Cypress through `npx`:
77
77
 
@@ -81,7 +81,7 @@ The current package does not define a dedicated Cypress npm script, so run Cypre
81
81
  Mount the component with realistic props and wait for state changes through visible behavior:
82
82
 
83
83
  ```ts
84
- cy.mount(FcCatInfoComponent, {
84
+ cy.mount(FcCatInfo, {
85
85
  props: {
86
86
  catId: testCat.id,
87
87
  isEditable: false,
@@ -96,7 +96,7 @@ Do not use arbitrary timeouts to wait for the API. Assert on a loading element,
96
96
 
97
97
  ### Selectors
98
98
 
99
- Keep reusable selectors in a `selectors/` file instead of scattering CSS selectors through specs. The [`FcCatInfoComponent` selector helper](https://github.com/Forsakringskassan/vue-lib-template/blob/main/src/selectors/guide/FcCatInfoComponent.selectors.ts) uses [`data-test`](https://designsystem.forsakringskassan.se/latest/functions/plugins/testplugin.html) attributes and supports scoping a component instance.
99
+ Keep reusable selectors in a `selectors/` file instead of scattering CSS selectors through specs. The [`FcCatInfoSelectors` helper](https://github.com/Forsakringskassan/vue-lib-template/blob/main/src/selectors/guide/cat-info.selectors.ts) uses [`data-test`](https://designsystem.forsakringskassan.se/latest/functions/plugins/testplugin.html) attributes and supports scoping a component instance.
100
100
 
101
101
  Selectors should describe stable test targets.
102
102
 
@@ -1,6 +1,6 @@
1
1
  # Component guide
2
2
 
3
- This directory contains an example component, `FcCatInfoComponent`, that demonstrates the setup and conventions used by this template.
3
+ This directory contains an example component, `FcCatInfo`, that demonstrates the setup and conventions used by this template.
4
4
  It includes the component, selectors, tests, mock data, related support files, and belonging documentation in `docs/guide`.
5
5
 
6
6
  This guide will stay in sync when you update to later versions of your template,
@@ -1,7 +1,7 @@
1
1
  import type { Cat } from "./cat-types";
2
2
 
3
3
  /**
4
- * Mock cat data for the FcCatInfoComponent
4
+ * Mock cat data for the FcCatInfo
5
5
  */
6
6
 
7
7
  export const cats: Cat[] = [
@@ -4,7 +4,7 @@ import { catGetById } from "./cat-api";
4
4
  import type { Cat } from "./cat-types";
5
5
 
6
6
  /**
7
- * Business logic for the FcCatInfoComponent.
7
+ * Business logic for the FcCatInfo.
8
8
  * Manages fetching and updating cat information from mock backend.
9
9
  */
10
10
  export function useCatInfo(): {
@@ -1,15 +1,15 @@
1
1
  import { FLoaderSelectors } from "@fkui/vue/selectors";
2
- import { FcCatInfoComponentSelectors } from "../../../selectors/guide/FcCatInfoComponent.selectors";
3
- import FcCatInfoComponent from "./FcCatInfoComponent.vue";
2
+ import { FcCatInfoSelectors } from "../../../selectors/guide/cat-info.selectors";
4
3
  import { cats } from "./cat-data";
4
+ import FcCatInfo from "./cat-info.vue";
5
5
 
6
- describe("FcCatInfoComponent", () => {
6
+ describe("FcCatInfo", () => {
7
7
  const testCat = cats[0];
8
- const catInfoSelectors = FcCatInfoComponentSelectors();
8
+ const catInfoSelectors = FcCatInfoSelectors();
9
9
  const loaderSelectors = FLoaderSelectors();
10
10
 
11
11
  it("verifies loading text", () => {
12
- cy.mount(FcCatInfoComponent, {
12
+ cy.mount(FcCatInfo, {
13
13
  props: {
14
14
  catId: testCat.id,
15
15
  },
@@ -23,7 +23,7 @@ describe("FcCatInfoComponent", () => {
23
23
  });
24
24
 
25
25
  it("verifies all fields in view mode have correct data", () => {
26
- cy.mount(FcCatInfoComponent, {
26
+ cy.mount(FcCatInfo, {
27
27
  props: {
28
28
  catId: testCat.id,
29
29
  isEditable: false,
@@ -44,7 +44,7 @@ describe("FcCatInfoComponent", () => {
44
44
  });
45
45
 
46
46
  it("verifies all fields in edit mode have correct data", () => {
47
- cy.mount(FcCatInfoComponent, {
47
+ cy.mount(FcCatInfo, {
48
48
  props: {
49
49
  catId: testCat.id,
50
50
  isEditable: true,
@@ -1,9 +1,9 @@
1
1
  <script setup lang="ts">
2
2
  import { ref, watch } from "vue";
3
3
  import { FCard, FLoader } from "@fkui/vue";
4
- import CatInfoEdit from "./CatInfoEdit.vue";
5
- import CatInfoShow from "./CatInfoShow.vue";
4
+ import CatInfoEdit from "./cat-info-edit.vue";
6
5
  import { useCatInfo } from "./cat-info-logic.js";
6
+ import CatInfoShow from "./cat-info-show.vue";
7
7
  import { type Cat } from "./cat-types.js";
8
8
 
9
9
  interface Props {
@@ -1,6 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { ref } from "vue";
3
- import FcCatInfoComponent from "../FcCatInfoComponent.vue";
3
+ import FcCatInfo from "../cat-info.vue";
4
4
 
5
5
  const selectedCatId = ref("whiskers-001");
6
6
  const isEditable = ref(false);
@@ -8,7 +8,7 @@ const isEditable = ref(false);
8
8
 
9
9
  <template>
10
10
  <div class="cat-example__component">
11
- <fc-cat-info-component :cat-id="selectedCatId" :is-editable />
11
+ <fc-cat-info :cat-id="selectedCatId" :is-editable />
12
12
  </div>
13
13
  </template>
14
14
 
@@ -2,11 +2,11 @@
2
2
  import { defineComponent } from "vue";
3
3
  import { FCheckboxField, FSelectField } from "@fkui/vue";
4
4
  import { LiveExample } from "@forsakringskassan/docs-live-example";
5
- import FcCatInfoComponent from "../FcCatInfoComponent.vue";
6
5
  import { getCatIds } from "../cat-data.js";
6
+ import FcCatInfo from "../cat-info.vue";
7
7
 
8
8
  export default defineComponent({
9
- name: "FcCatInfoComponentLiveExample",
9
+ name: "FcCatInfoLiveExample",
10
10
  components: { LiveExample, FSelectField, FCheckboxField },
11
11
  data() {
12
12
  return {
@@ -17,14 +17,14 @@ export default defineComponent({
17
17
  },
18
18
  computed: {
19
19
  components(): object {
20
- return { FcCatInfoComponent };
20
+ return { FcCatInfo };
21
21
  },
22
22
  editableAttr(): string {
23
23
  return this.isEditable ? " is-editable" : "";
24
24
  },
25
25
  template(): string {
26
26
  return /* HTML */ `
27
- <fc-cat-info-component cat-id="${this.selectedCatId}" ${this.editableAttr} />
27
+ <fc-cat-info cat-id="${this.selectedCatId}" ${this.editableAttr} />
28
28
  `;
29
29
  },
30
30
  },
@@ -0,0 +1 @@
1
+ export { default as FcCatInfo } from "./cat-info.vue";
@@ -1 +1 @@
1
- export { FcCatInfoComponent } from "./FcCatInfo";
1
+ export { FcCatInfo } from "./cat-info";
@@ -1,6 +1,6 @@
1
1
  import { defineMock } from "@forsakringskassan/apimock-express/helpers";
2
- import { cats } from "../../components/guide/FcCatInfo/cat-data.ts";
3
- import type { Cat } from "../../components/guide/FcCatInfo/cat-types.ts";
2
+ import { cats } from "../../components/guide/cat-info/cat-data.ts";
3
+ import type { Cat } from "../../components/guide/cat-info/cat-types.ts";
4
4
 
5
5
  export default defineMock<Cat | { error: string }>({
6
6
  meta: {
@@ -1,12 +1,12 @@
1
1
  import { TestPlugin, ValidationPlugin } from "@fkui/vue";
2
2
  import { mount } from "@vue/test-utils";
3
3
  import { beforeEach, expect, it, vi } from "vitest";
4
- import FcCatInfoComponent from "../../components/guide/FcCatInfo/FcCatInfoComponent.vue";
5
- import { catGetById } from "../../components/guide/FcCatInfo/cat-api";
6
- import { cats } from "../../components/guide/FcCatInfo/cat-data";
7
- import { FcCatInfoComponentSelectors } from "./FcCatInfoComponent.selectors";
4
+ import { catGetById } from "../../components/guide/cat-info/cat-api";
5
+ import { cats } from "../../components/guide/cat-info/cat-data";
6
+ import FcCatInfo from "../../components/guide/cat-info/cat-info.vue";
7
+ import { FcCatInfoSelectors } from "./cat-info.selectors";
8
8
 
9
- vi.mock(import("../../components/guide/FcCatInfo/cat-api"));
9
+ vi.mock(import("../../components/guide/cat-info/cat-api"));
10
10
 
11
11
  beforeEach(() => {
12
12
  vi.mocked(catGetById).mockResolvedValue(cats[0]);
@@ -14,10 +14,10 @@ beforeEach(() => {
14
14
 
15
15
  it("should use the default selector", () => {
16
16
  expect.assertions(2);
17
- const wrapper = mount(FcCatInfoComponent, {
17
+ const wrapper = mount(FcCatInfo, {
18
18
  props: { catId: cats[0].id },
19
19
  });
20
- const { selector } = FcCatInfoComponentSelectors();
20
+ const { selector } = FcCatInfoSelectors();
21
21
 
22
22
  expect(selector).toBe(":scope");
23
23
  expect(wrapper.find(selector).exists()).toBe(true);
@@ -25,13 +25,11 @@ it("should use the default selector", () => {
25
25
 
26
26
  it("should find the component with an explicit selector", () => {
27
27
  expect.assertions(2);
28
- const wrapper = mount(FcCatInfoComponent, {
28
+ const wrapper = mount(FcCatInfo, {
29
29
  attrs: { "data-test": "my-cat-info" },
30
30
  props: { catId: cats[0].id },
31
31
  });
32
- const { selector } = FcCatInfoComponentSelectors(
33
- '[data-test="my-cat-info"]',
34
- );
32
+ const { selector } = FcCatInfoSelectors('[data-test="my-cat-info"]');
35
33
 
36
34
  expect(selector).toBe('[data-test="my-cat-info"]');
37
35
  expect(wrapper.find(selector).exists()).toBe(true);
@@ -39,10 +37,10 @@ it("should find the component with an explicit selector", () => {
39
37
 
40
38
  it("should find the loading container", () => {
41
39
  expect.assertions(1);
42
- const wrapper = mount(FcCatInfoComponent, {
40
+ const wrapper = mount(FcCatInfo, {
43
41
  props: { catId: cats[0].id },
44
42
  });
45
- const { loadingContainer } = FcCatInfoComponentSelectors();
43
+ const { loadingContainer } = FcCatInfoSelectors();
46
44
 
47
45
  expect(wrapper.get(loadingContainer()).text()).toContain(
48
46
  "Hämtar kattinformation...",
@@ -51,10 +49,10 @@ it("should find the loading container", () => {
51
49
 
52
50
  it("should find all view mode elements", async () => {
53
51
  expect.assertions(5);
54
- const wrapper = mount(FcCatInfoComponent, {
52
+ const wrapper = mount(FcCatInfo, {
55
53
  props: { catId: cats[0].id, isEditable: false },
56
54
  });
57
- const selectors = FcCatInfoComponentSelectors();
55
+ const selectors = FcCatInfoSelectors();
58
56
 
59
57
  await vi.waitFor(() => {
60
58
  if (!wrapper.find(selectors.viewContainer()).exists()) {
@@ -72,13 +70,13 @@ it("should find all view mode elements", async () => {
72
70
 
73
71
  it("should find all edit mode inputs", async () => {
74
72
  expect.assertions(6);
75
- const wrapper = mount(FcCatInfoComponent, {
73
+ const wrapper = mount(FcCatInfo, {
76
74
  props: { catId: cats[0].id, isEditable: true },
77
75
  global: {
78
76
  plugins: [TestPlugin, ValidationPlugin],
79
77
  },
80
78
  });
81
- const selectors = FcCatInfoComponentSelectors();
79
+ const selectors = FcCatInfoSelectors();
82
80
 
83
81
  await vi.waitFor(() => {
84
82
  if (!wrapper.find(selectors.editContainer()).exists()) {
@@ -1,11 +1,11 @@
1
1
  /**
2
- * Selectors for `FcCatInfoComponent`.
2
+ * Selectors for `FcCatInfo`.
3
3
  *
4
4
  * @public
5
- * @param selector - The selector for the FcCatInfoComponent.
6
- * @returns An object with selector methods for the FcCatInfoComponent.
5
+ * @param selector - The selector for the FcCatInfo.
6
+ * @returns An object with selector methods for the FcCatInfo.
7
7
  */
8
- export function FcCatInfoComponentSelectors(selector: string = ":scope") {
8
+ export function FcCatInfoSelectors(selector: string = ":scope") {
9
9
  return Object.freeze({
10
10
  /**
11
11
  * The base selector for the component.
@@ -1 +1 @@
1
- export { FcCatInfoComponentSelectors } from "./FcCatInfoComponent.selectors";
1
+ export { FcCatInfoSelectors } from "./cat-info.selectors";
package/index.js CHANGED
@@ -7,7 +7,9 @@
7
7
 
8
8
  const options = {
9
9
  ...packageJson.cloneman,
10
- fileHash: "39a7dd9881d3b98fbcef96ca841b1f279216253ae4198de7f1cd3974c578d14f",
10
+ fileHash: "508323bd62b79aa3dcf33161c2d4c393059955f05f43dfc88eb4676b1a9b16b2",
11
+ apiVersion: 0,
12
+ clonemanVersion: "1.27.0",
11
13
  filesDir: path.join(import.meta.dirname, "files"),
12
14
  hooksDir: path.join(import.meta.dirname, "hooks"),
13
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forsakringskassan/vue-lib-template",
3
- "version": "1.6.1",
3
+ "version": "1.6.3",
4
4
  "description": "Vue library template based on Cloneman",
5
5
  "keywords": [
6
6
  "template",
@@ -72,19 +72,19 @@
72
72
  "project-guide/testing.md",
73
73
  "README.md",
74
74
  "renovate.json",
75
- "src/components/guide/FcCatInfo/cat-api.spec.ts",
76
- "src/components/guide/FcCatInfo/cat-api.ts",
77
- "src/components/guide/FcCatInfo/cat-data.ts",
78
- "src/components/guide/FcCatInfo/cat-info-logic.spec.ts",
79
- "src/components/guide/FcCatInfo/cat-info-logic.ts",
80
- "src/components/guide/FcCatInfo/cat-types.ts",
81
- "src/components/guide/FcCatInfo/CatInfoEdit.vue",
82
- "src/components/guide/FcCatInfo/CatInfoShow.vue",
83
- "src/components/guide/FcCatInfo/examples/FcCatInfoComponentExample.vue",
84
- "src/components/guide/FcCatInfo/examples/FcCatInfoComponentLiveExample.vue",
85
- "src/components/guide/FcCatInfo/FcCatInfoComponent.cy.ts",
86
- "src/components/guide/FcCatInfo/FcCatInfoComponent.vue",
87
- "src/components/guide/FcCatInfo/index.ts",
75
+ "src/components/guide/cat-info/cat-api.spec.ts",
76
+ "src/components/guide/cat-info/cat-api.ts",
77
+ "src/components/guide/cat-info/cat-data.ts",
78
+ "src/components/guide/cat-info/cat-info-edit.vue",
79
+ "src/components/guide/cat-info/cat-info-logic.spec.ts",
80
+ "src/components/guide/cat-info/cat-info-logic.ts",
81
+ "src/components/guide/cat-info/cat-info-show.vue",
82
+ "src/components/guide/cat-info/cat-info.cy.ts",
83
+ "src/components/guide/cat-info/cat-info.vue",
84
+ "src/components/guide/cat-info/cat-types.ts",
85
+ "src/components/guide/cat-info/examples/cat-info-example.vue",
86
+ "src/components/guide/cat-info/examples/cat-info-live-example.vue",
87
+ "src/components/guide/cat-info/index.ts",
88
88
  "src/components/guide/index.ts",
89
89
  "src/components/guide/README.md",
90
90
  "src/components/index.ts",
@@ -95,8 +95,8 @@
95
95
  "src/mocks/guide/cat-api.mock.mts",
96
96
  "src/mocks/guide/index.mts",
97
97
  "src/mocks/index.mts",
98
- "src/selectors/guide/FcCatInfoComponent.selectors.spec.ts",
99
- "src/selectors/guide/FcCatInfoComponent.selectors.ts",
98
+ "src/selectors/guide/cat-info.selectors.spec.ts",
99
+ "src/selectors/guide/cat-info.selectors.ts",
100
100
  "src/selectors/guide/index.ts",
101
101
  "src/selectors/index.ts",
102
102
  "src/style.scss",
@@ -127,6 +127,8 @@
127
127
  "cypress/tsconfig.json",
128
128
  "cypress/types/mocha.d.ts",
129
129
  "docs/build.mts",
130
+ "docs/guide/cat-info.md",
131
+ "docs/guide/index.md",
130
132
  "docs/package.json",
131
133
  "docs/src/bundle-mocks.ts",
132
134
  "docs/src/global.d.ts",
@@ -140,6 +142,27 @@
140
142
  "LICENSE.md",
141
143
  "README.md",
142
144
  "renovate.json",
145
+ "src/components/guide/cat-info/cat-api.spec.ts",
146
+ "src/components/guide/cat-info/cat-api.ts",
147
+ "src/components/guide/cat-info/cat-data.ts",
148
+ "src/components/guide/cat-info/cat-info-edit.vue",
149
+ "src/components/guide/cat-info/cat-info-logic.spec.ts",
150
+ "src/components/guide/cat-info/cat-info-logic.ts",
151
+ "src/components/guide/cat-info/cat-info-show.vue",
152
+ "src/components/guide/cat-info/cat-info.cy.ts",
153
+ "src/components/guide/cat-info/cat-info.vue",
154
+ "src/components/guide/cat-info/cat-types.ts",
155
+ "src/components/guide/cat-info/examples/cat-info-example.vue",
156
+ "src/components/guide/cat-info/examples/cat-info-live-example.vue",
157
+ "src/components/guide/cat-info/index.ts",
158
+ "src/components/guide/index.ts",
159
+ "src/components/guide/README.md",
160
+ "src/mocks/guide/cat-api-mock.spec.ts",
161
+ "src/mocks/guide/cat-api.mock.mts",
162
+ "src/mocks/guide/index.mts",
163
+ "src/selectors/guide/cat-info.selectors.spec.ts",
164
+ "src/selectors/guide/cat-info.selectors.ts",
165
+ "src/selectors/guide/index.ts",
143
166
  "tsconfig.cypress.json",
144
167
  "tsconfig.json",
145
168
  "tsconfig.lib.json",
@@ -191,7 +214,11 @@
191
214
  "src/AwesomeComponent.cy.ts",
192
215
  "src/AwesomeComponent.vue",
193
216
  "src/AwesomeComponentLogic.spec.ts",
194
- "src/awesome-component-logic.ts"
217
+ "src/awesome-component-logic.ts",
218
+ "docs/guide/**",
219
+ "src/components/guide/**",
220
+ "src/mocks/guide/**",
221
+ "src/selectors/guide/**"
195
222
  ],
196
223
  "uninstallDependencies": [
197
224
  "@forsakringskassan/cypress-axe",
@@ -1 +0,0 @@
1
- export { default as FcCatInfoComponent } from "./FcCatInfoComponent.vue";