umberto 8.2.0 → 8.3.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/CHANGELOG.md CHANGED
@@ -1,6 +1,14 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ ## [8.3.0](https://github.com/cksource/umberto/compare/v8.2.0...v8.3.0) (September 2, 2025)
5
+
6
+ ### Features
7
+
8
+ * Added custom styling for the [Kapa.ai](https://www.kapa.ai/) service.
9
+ * The source script of the [Kapa.ai](https://www.kapa.ai/) service must be defined in the `kapa.widgetOptions.src` key in the Umberto configuration.
10
+
11
+
4
12
  ## [8.2.0](https://github.com/cksource/umberto/compare/v8.1.0...v8.2.0) (August 29, 2025)
5
13
 
6
14
  ### Features
@@ -36,23 +44,6 @@ Changelog
36
44
  * Changed from `overscroll-behavior: none` to `overscroll-behavior-y: none` on `<html>` and `<body>` elements to allow Mac trackpad swipe gestures for browser navigation.
37
45
  * Code blocks in API descriptions are no longer duplicated when there are multiple code blocks withing the same description.
38
46
 
39
-
40
- ## [8.0.1](https://github.com/cksource/umberto/compare/v8.0.0...v8.0.1) (July 28, 2025)
41
-
42
- ### Bug fixes
43
-
44
- * The performance of the building and the behavior of components have been improved. The most important changes are listed below:
45
-
46
- * Improved the performance of the `validate-links` task by processing links in parallel across multiple CPU cores, instead of a single core.
47
- * Enhanced the API filters behavior: now, when the `inherited` filter is unchecked while `internal` is selected, items tagged with both `inherited` and `internal` will be properly hidden from the results.
48
- * Added the Lato font for improved typography and visual consistency.
49
- * Restored the default selection color for content on the website to ensure a familiar and accessible user experience.
50
- * Added a footer snippet for consistent branding and navigation across all pages.
51
- * Improved the styling of `code` tags in API documentation for better readability and clarity.
52
- * Added a new `sparkles` icon to the icon set.
53
- * Fixed the project selection dropdown: after rebuilding, it now correctly displays all available projects instead of only one.
54
- * Optimized the performance of the navigation tree building process, resulting in faster page loads and smoother navigation.
55
-
56
47
  ---
57
48
 
58
49
  To see all releases, visit the [release page](https://github.com/cksource/umberto/releases).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "umberto",
3
- "version": "8.2.0",
3
+ "version": "8.3.0",
4
4
  "description": "CKSource Documentation builder",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -0,0 +1,29 @@
1
+ /* Style for the floating button. */
2
+ #kapa-button p {
3
+ position: relative;
4
+ top: 6px;
5
+ }
6
+
7
+ /* Style for hyperlinks inside the AI's answer. */
8
+ #kapa-modal-content
9
+ > div:nth-of-type(1)
10
+ > div:nth-of-type(1)
11
+ > div:nth-of-type(1)
12
+ > div:nth-of-type(2)
13
+ > div:nth-of-type(1)
14
+ a
15
+ {
16
+ font-weight: normal !important;
17
+ color: #743CCD !important;
18
+ text-decoration-line: underline !important;
19
+ text-decoration-color: #C4B1E6 !important;
20
+
21
+ &:hover {
22
+ text-decoration-color: #743CCD !important;
23
+ }
24
+
25
+ &:visited {
26
+ color: #582AA2 !important;
27
+ text-decoration-color: #582AA2 !important;
28
+ }
29
+ }
@@ -1,4 +1,4 @@
1
- mixin load-kapa-script(kapa)
1
+ mixin load-kapa-script( kapa )
2
2
  -
3
3
  const mainColor = '#743CCD';
4
4
  const textPrimaryColor = '#00091B';
@@ -11,7 +11,7 @@ mixin load-kapa-script(kapa)
11
11
  var attributes = {
12
12
  'async': true,
13
13
  'fetchpriority': 'low',
14
- 'src': 'https://widget.kapa.ai/kapa-widget.bundle.js',
14
+ 'src': kapa.widgetOptions.src,
15
15
  'data-website-id': kapa.widgetOptions.websiteId,
16
16
  'data-project-name': kapa.widgetOptions.projectName,
17
17
 
@@ -48,7 +48,7 @@ mixin load-kapa-script(kapa)
48
48
  // Modal question input.
49
49
  'data-query-input-text-color': textPrimaryColor,
50
50
  'data-query-input-placeholder-text-color': textSecondaryColor,
51
- 'data-modal-ask-ai-input-placeholder': 'Ask me a question about the project...',
51
+ 'data-modal-ask-ai-input-placeholder': 'Ask me a question about the project...',
52
52
 
53
53
  // Modal deep thinking button.
54
54
  'data-deep-thinking-button-text-color': textSecondaryColor,
@@ -75,24 +75,81 @@ mixin load-kapa-script(kapa)
75
75
  }
76
76
 
77
77
  const projectConfig = projectLocals && kapa[ projectLocals.projectSlug ];
78
- const modalTitle = projectConfig && projectConfig.modalTitle;
79
- const questionPlaceholder = projectConfig && projectConfig.questionPlaceholder;
80
- const exampleQuestions = projectConfig && projectConfig.exampleQuestions;
81
78
 
82
- if ( modalTitle ) {
83
- attributes[ 'data-modal-title' ] = modalTitle;
84
- }
79
+ function getModalTitle( projectConfig ) {
80
+ const defaultTitle = kapa.default.modalTitle;
85
81
 
86
- if ( questionPlaceholder ) {
87
- attributes[ 'data-modal-ask-ai-input-placeholder' ] = questionPlaceholder;
88
- }
82
+ if ( !projectConfig ) {
83
+ return defaultTitle;
84
+ }
85
+
86
+ if ( !projectConfig.modalTitle ) {
87
+ return defaultTitle;
88
+ }
89
+
90
+ return projectConfig.modalTitle;
91
+ };
92
+
93
+ function getQuestionPlaceholder() {
94
+ const defaultQuestionPlaceholder = kapa.default.questionPlaceholder;
95
+
96
+ if ( !projectConfig ) {
97
+ return defaultQuestionPlaceholder;
98
+ }
99
+
100
+ if ( !projectConfig.questionPlaceholder ) {
101
+ return defaultQuestionPlaceholder;
102
+ }
103
+
104
+ return projectConfig.questionPlaceholder;
105
+ };
106
+
107
+ function getExampleQuestions() {
108
+ const defaultExampleQuestions = kapa.default.exampleQuestions.join( ',' );
109
+
110
+ if ( !projectConfig ) {
111
+ return defaultExampleQuestions;
112
+ }
89
113
 
90
- if ( exampleQuestions && exampleQuestions.length ) {
91
- attributes[ 'data-modal-example-questions' ] = exampleQuestions.join( ',' );
114
+ if ( !projectConfig.exampleQuestions ) {
115
+ return defaultExampleQuestions;
116
+ }
117
+
118
+ if ( !projectConfig.exampleQuestions.length ) {
119
+ return defaultExampleQuestions;
120
+ }
121
+
122
+ return projectConfig.exampleQuestions.join( ',' );
92
123
  }
93
124
 
125
+ attributes[ 'data-modal-title' ] = getModalTitle( projectConfig );
126
+ attributes[ 'data-modal-ask-ai-input-placeholder' ] = getQuestionPlaceholder();
127
+ attributes[ 'data-modal-example-questions' ] = getExampleQuestions();
128
+
94
129
  script&attributes(attributes)
95
130
 
131
+ style#custom_kapa_styles
132
+ include custom_kapa_styles.css
133
+
134
+ script.
135
+ const mutationObserver = new MutationObserver( () => {
136
+ const container = document.querySelector( '#kapa-widget-container' );
137
+
138
+ if ( !container ) {
139
+ return;
140
+ }
141
+
142
+ mutationObserver.disconnect();
143
+
144
+ const customKapaStylesElement = document.querySelector( 'style#custom_kapa_styles' );
145
+ const injectedSheet = new CSSStyleSheet();
146
+ injectedSheet.replaceSync( customKapaStylesElement.innerText );
147
+ container.shadowRoot.adoptedStyleSheets.push( injectedSheet );
148
+ customKapaStylesElement.remove();
149
+ } );
150
+
151
+ mutationObserver.observe( document, { childList: true, subtree: true } );
152
+
96
153
  mixin kapa-button
97
154
  +button({
98
155
  label: 'Ask AI',