@sp-days-framework/slidev-theme-sykehuspartner 1.1.0-beta2 → 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.
@@ -19,15 +19,25 @@ All packages within `@sp-days-framework` use the same version number. In some ca
19
19
 
20
20
  ---
21
21
 
22
- ## Version 1.1.0-beta2 ![Sync](https://img.shields.io/badge/sync-version--bump-lightgrey)
22
+ ## Version 1.1.0 ![Release](https://img.shields.io/badge/release-production-blue)
23
23
 
24
- Version bump to match other packages in the framework with minor documentation improvements
24
+ Bug fixes for VSCode icons and layout improvements
25
25
 
26
- ---
26
+ <details>
27
+ <summary><strong>Details</strong> (2026 January 07)</summary>
28
+
29
+ ### Bug Fixes
27
30
 
28
- ## Version 1.1.0-beta1 ![Sync](https://img.shields.io/badge/sync-version--bump-lightgrey)
31
+ - **uno.config.ts**: Fixed codeblock icon scanning to work correctly when the theme is installed as a dependency in other projects
32
+ - **uno.config.ts**: Fixed VSCode icons not appearing when built through `docusaurus-plugin-slidev` by adding support for `SLIDEV_ORIGINAL_SOURCE` and `SLIDEV_ORIGINAL_SOURCE_DIR` environment variables
33
+ - **two-cols-header**: Fixed h2 and h3 heading margins to be consistent with other layouts
34
+ - **end layout**: Fixed text centering so content is properly horizontally centered
29
35
 
30
- Version bump to match other packages in the framework. Documentation is now bundled with the npm package for easier reference during development.
36
+ ### Improvements
37
+
38
+ - **Package Documentation**: Documentation is now bundled with the npm package for easier reference during development
39
+
40
+ </details>
31
41
 
32
42
  ---
33
43
 
package/layouts/end.vue CHANGED
@@ -34,6 +34,7 @@ const showBanner = computed(() => {
34
34
  flex-direction: column;
35
35
  align-items: center;
36
36
  justify-content: center;
37
+ text-align: center;
37
38
  }
38
39
 
39
40
  .banner-container {
@@ -63,6 +63,12 @@ const contentAlignmentStyle = computed(() => {
63
63
  margin-bottom: 1rem;
64
64
  }
65
65
 
66
+ :deep(h1),
67
+ :deep(h2),
68
+ :deep(h3) {
69
+ margin-bottom: 0.5rem;
70
+ }
71
+
66
72
  .cols-container {
67
73
  display: flex;
68
74
  flex-grow: 1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sp-days-framework/slidev-theme-sykehuspartner",
3
- "version": "1.1.0-beta2",
3
+ "version": "1.1.0",
4
4
  "description": "A Slidev theme for Sykehuspartner presentations.",
5
5
  "type": "module",
6
6
  "repository": {
@@ -37,6 +37,7 @@
37
37
  "@slidev/types": "^52.9.1"
38
38
  },
39
39
  "peerDependencies": {
40
+ "@iconify-json/vscode-icons": "^1.2.0",
40
41
  "@slidev/cli": ">=52.0.0",
41
42
  "@slidev/types": ">=52.0.0"
42
43
  },
@@ -6,7 +6,15 @@
6
6
  */
7
7
 
8
8
  module.exports = {
9
- id: 'sykehuspartner-theme-docs',
10
- path: require('path').join(__dirname, 'docs'),
11
- routeBasePath: 'package-docs/sykehuspartner-theme',
9
+ id: "sykehuspartner-theme-docs",
10
+ path: require("path").join(__dirname, "docs"),
11
+ editUrl: function (params) {
12
+ // Remove node_modules/@sp-days-framework/slidev-theme-sykehuspartner/docs from the path
13
+ const cleanPath = params.docPath.replace(
14
+ /^.*node_modules\/@sp-days-framework\/slidev-theme-sykehuspartner\/docs\//,
15
+ "",
16
+ );
17
+ return `https://github.com/helse-sorost/sp-days-framework/edit/main/slidev-theme-sykehuspartner/docs/${cleanPath}`;
18
+ },
19
+ routeBasePath: "package-docs/sykehuspartner-theme",
12
20
  };
package/uno.config.ts CHANGED
@@ -1,47 +1,117 @@
1
1
  import { defineConfig } from 'unocss'
2
2
  import fs from 'fs'
3
+ import path from 'path'
3
4
  import { globSync } from 'glob'
4
5
 
5
- // Function to scan files for icon patterns
6
- function scanFilesForIcons() {
6
+ /**
7
+ * Scans markdown files for VSCode icon patterns used in code blocks.
8
+ * Icons are referenced with syntax: ~i-vscode-icons:file-type-name~
9
+ *
10
+ * When built through docusaurus-plugin-slidev, uses environment variables:
11
+ * - SLIDEV_ORIGINAL_SOURCE: Path to the original markdown file
12
+ * - SLIDEV_ORIGINAL_SOURCE_DIR: Directory containing the source file
13
+ * - SLIDEV_SITE_DIR: The Docusaurus site directory
14
+ */
15
+ function scanFilesForIcons(): string[] {
7
16
  try {
8
- // Find all markdown files in the project directory and all subdirectories
9
- const slideFiles = globSync('**/*.md', { absolute: true })
17
+ // Try multiple strategies to find markdown files
18
+ const searchRoots: string[] = [
19
+ process.cwd(),
20
+ path.resolve(process.cwd(), 'slidev'),
21
+ path.resolve(process.cwd(), '..'),
22
+ path.resolve(process.cwd(), '.docusaurus'),
23
+ ]
24
+
25
+ // Add paths from docusaurus-plugin-slidev environment variables
26
+ if (process.env.SLIDEV_ORIGINAL_SOURCE_DIR) {
27
+ searchRoots.push(process.env.SLIDEV_ORIGINAL_SOURCE_DIR)
28
+ }
29
+ if (process.env.SLIDEV_SITE_DIR) {
30
+ searchRoots.push(process.env.SLIDEV_SITE_DIR)
31
+ searchRoots.push(path.resolve(process.env.SLIDEV_SITE_DIR, 'slidev'))
32
+ }
10
33
 
11
34
  // Pattern to match icon references like ~i-vscode-icons:file-type-ansible~
12
35
  const iconPattern = /~(i-[a-zA-Z0-9-]+:[a-zA-Z0-9-]+)~/g
13
36
 
14
- // Set to store unique icons
15
- const icons = new Set(['i-vscode-icons:file-type-docker']) // Include default icon
37
+ // Set to store unique icons - include common defaults
38
+ const icons = new Set([
39
+ 'i-vscode-icons:file-type-docker',
40
+ 'i-vscode-icons:file-type-python',
41
+ 'i-vscode-icons:file-type-typescript-official',
42
+ 'i-vscode-icons:file-type-js-official',
43
+ 'i-vscode-icons:file-type-yaml',
44
+ 'i-vscode-icons:file-type-json',
45
+ 'i-vscode-icons:file-type-markdown',
46
+ 'i-vscode-icons:file-type-vue',
47
+ 'i-vscode-icons:file-type-html',
48
+ 'i-vscode-icons:file-type-css',
49
+ 'i-vscode-icons:file-type-shell',
50
+ 'i-vscode-icons:file-type-powershell',
51
+ 'i-vscode-icons:file-type-git',
52
+ 'i-vscode-icons:file-type-ansible',
53
+ 'i-vscode-icons:file-type-terraform',
54
+ 'i-vscode-icons:file-type-kubernetes',
55
+ ])
16
56
 
17
- // Scan each file for icon patterns
18
- slideFiles.forEach((file: string) => {
57
+ // Read the original source file directly if available (from docusaurus-plugin-slidev)
58
+ if (process.env.SLIDEV_ORIGINAL_SOURCE && fs.existsSync(process.env.SLIDEV_ORIGINAL_SOURCE)) {
19
59
  try {
20
- const content = fs.readFileSync(file, 'utf-8')
60
+ const content = fs.readFileSync(process.env.SLIDEV_ORIGINAL_SOURCE, 'utf-8')
21
61
  let match
22
62
  while ((match = iconPattern.exec(content)) !== null) {
23
63
  if (match[1]) {
24
64
  icons.add(match[1])
25
65
  }
26
66
  }
27
- } catch (err) {
28
- console.warn(`Error reading file ${file}:`, err)
67
+ } catch {
68
+ // Silently ignore read errors
69
+ }
70
+ }
71
+
72
+ // Scan from each root
73
+ for (const searchRoot of searchRoots) {
74
+ try {
75
+ if (!fs.existsSync(searchRoot)) continue
76
+
77
+ // Find all markdown files, excluding node_modules but INCLUDE .docusaurus
78
+ const slideFiles = globSync('**/*.md', {
79
+ absolute: true,
80
+ cwd: searchRoot,
81
+ ignore: ['**/node_modules/**', '**/dist/**', '**/build/**'],
82
+ dot: true
83
+ })
84
+
85
+ // Scan each file for icon patterns
86
+ slideFiles.forEach((file: string) => {
87
+ try {
88
+ const content = fs.readFileSync(file, 'utf-8')
89
+ let match
90
+ while ((match = iconPattern.exec(content)) !== null) {
91
+ if (match[1]) {
92
+ icons.add(match[1])
93
+ }
94
+ }
95
+ } catch {
96
+ // Silently ignore read errors
97
+ }
98
+ })
99
+ } catch {
100
+ // Silently ignore scan errors
29
101
  }
30
- })
102
+ }
31
103
 
32
- return Array.from(icons)
33
- } catch (err) {
34
- console.warn('Error scanning files for icons:', err)
35
- return ['i-vscode-icons:file-type-docker'] // Fallback to default icon
104
+ return Array.from(icons) as string[]
105
+ } catch {
106
+ // Return default icon on error
107
+ return ['i-vscode-icons:file-type-docker']
36
108
  }
37
109
  }
38
110
 
39
111
  export default defineConfig({
40
112
  safelist: [
41
- // Static icons that should always be included
42
- 'i-vscode-icons:file-type-docker',
43
-
44
113
  // Dynamically scan for icons in slide files
45
- () => scanFilesForIcons()
114
+ // This returns an array of icon class names that should be included
115
+ ...scanFilesForIcons()
46
116
  ],
47
117
  })