@chassis-ui/docs 0.1.7 → 0.1.9
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/package.json +1 -1
- package/src/components/FeatureCard.astro +1 -1
- package/src/components/NavLink.astro +0 -2
- package/src/js/icon-loader.js +10 -1
- package/src/js/search.js +1 -6
- package/src/js/sidebar.js +0 -4
- package/src/layouts/DocsLayout.astro +2 -1
- package/src/layouts/footer/Scripts.astro +0 -2
- package/src/layouts/head/Head.astro +2 -3
- package/src/layouts/header/Navigation.astro +17 -7
- package/src/scss/_docsearch.scss +42 -18
- package/src/scss/_settings.scss +1 -0
package/package.json
CHANGED
|
@@ -27,7 +27,7 @@ const hasContent = Astro.slots.has('default')
|
|
|
27
27
|
const cardClasses = [
|
|
28
28
|
'feature-item bg-even d-flex flex-column rounded-large',
|
|
29
29
|
'p-medium p-large-xlarge gap-medium gap-medium-xlarge',
|
|
30
|
-
horizontal ? '
|
|
30
|
+
horizontal ? '' : 'h-100',
|
|
31
31
|
classes
|
|
32
32
|
]
|
|
33
33
|
.filter(Boolean)
|
package/src/js/icon-loader.js
CHANGED
|
@@ -102,7 +102,16 @@
|
|
|
102
102
|
container.id = 'chassis-icons-sprite'
|
|
103
103
|
container.style.display = 'none'
|
|
104
104
|
container.setAttribute('aria-hidden', 'true')
|
|
105
|
-
|
|
105
|
+
|
|
106
|
+
// Use DOMParser to safely parse SVG content instead of innerHTML
|
|
107
|
+
const parsed = new DOMParser().parseFromString(spriteContent, 'image/svg+xml')
|
|
108
|
+
const svgEl = parsed.querySelector('svg')
|
|
109
|
+
if (svgEl) {
|
|
110
|
+
container.appendChild(svgEl)
|
|
111
|
+
} else {
|
|
112
|
+
// Fallback: should not happen given fetchSprite validation
|
|
113
|
+
container.innerHTML = spriteContent
|
|
114
|
+
}
|
|
106
115
|
|
|
107
116
|
// Insert at the end of body
|
|
108
117
|
document.body.appendChild(container)
|
package/src/js/search.js
CHANGED
|
@@ -24,16 +24,11 @@ import docsearch from '@docsearch/js'
|
|
|
24
24
|
return
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
const siteDocsVersion = searchElement.getAttribute('data-cxd-docs-version')
|
|
28
|
-
|
|
29
27
|
docsearch({
|
|
30
28
|
apiKey: CONFIG.apiKey,
|
|
31
29
|
indexName: CONFIG.indexName,
|
|
32
30
|
appId: CONFIG.appId,
|
|
33
31
|
container: searchElement,
|
|
34
|
-
searchParameters: {
|
|
35
|
-
facetFilters: [`version:${siteDocsVersion}`]
|
|
36
|
-
},
|
|
37
32
|
transformItems(items) {
|
|
38
33
|
return items.map((item) => {
|
|
39
34
|
const liveUrl = 'https://chassis-ui.com/'
|
|
@@ -41,7 +36,7 @@ import docsearch from '@docsearch/js'
|
|
|
41
36
|
item.url = window.location.origin.startsWith(liveUrl)
|
|
42
37
|
? // On production, return the result as is
|
|
43
38
|
item.url
|
|
44
|
-
: // On development or
|
|
39
|
+
: // On development or Vercel, replace `item.url` with a trailing slash,
|
|
45
40
|
// so that the result link is relative to the server root
|
|
46
41
|
item.url.replace(liveUrl, '/')
|
|
47
42
|
|
package/src/js/sidebar.js
CHANGED
|
@@ -31,8 +31,9 @@ const parentDirectory = id.includes('/') ? id.split('/')[0] : ''
|
|
|
31
31
|
|
|
32
32
|
const bodyProps: LayoutOverridesHTMLAttributes<'body'> = {}
|
|
33
33
|
|
|
34
|
+
bodyProps['class'] = 'docs-body'
|
|
35
|
+
|
|
34
36
|
if (frontmatter.toc) {
|
|
35
|
-
bodyProps['class'] = 'docs-body'
|
|
36
37
|
bodyProps['data-cx-spy'] = 'scroll'
|
|
37
38
|
bodyProps['data-cx-target'] = '#TableOfContents'
|
|
38
39
|
}
|
|
@@ -35,7 +35,7 @@ const canonicalUrl = new URL(Astro.url.pathname, Astro.site)
|
|
|
35
35
|
const isHome = Astro.url.pathname === '/'
|
|
36
36
|
const pageTitle = isHome
|
|
37
37
|
? `${getConfig().title} · ${getConfig().subtitle}`
|
|
38
|
-
: `${title} · ${getConfig().title}
|
|
38
|
+
: `${title} · ${getConfig().title}`
|
|
39
39
|
---
|
|
40
40
|
|
|
41
41
|
<meta charset="UTF-8" />
|
|
@@ -46,11 +46,10 @@ const pageTitle = isHome
|
|
|
46
46
|
<meta name="author" content={getConfig().authors} />
|
|
47
47
|
<meta name="generator" content={Astro.generator} />
|
|
48
48
|
<meta name="docsearch:language" content="en" />
|
|
49
|
-
<meta name="docsearch:version" content={getConfig().docs_version} />
|
|
50
49
|
|
|
51
50
|
<link rel="canonical" href={canonicalUrl} />
|
|
52
51
|
|
|
53
|
-
<link rel="preconnect" href
|
|
52
|
+
<link rel="preconnect" href={`https://${getConfig().algolia.app_id}-dsn.algolia.net`} crossorigin />
|
|
54
53
|
|
|
55
54
|
<title>{pageTitle}</title>
|
|
56
55
|
|
|
@@ -18,6 +18,17 @@ interface Props {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
const { layout, title } = Astro.props
|
|
21
|
+
const { pathname } = Astro.url
|
|
22
|
+
const isActive = (path: string) => {
|
|
23
|
+
if (path === '/') {
|
|
24
|
+
return pathname === '/' || pathname === ''
|
|
25
|
+
}
|
|
26
|
+
// Remove trailing slashes for a cleaner comparison
|
|
27
|
+
const cleanPathname = pathname.endsWith('/') ? pathname.slice(0, -1) : pathname
|
|
28
|
+
const cleanLinkPath = path.endsWith('/') ? path.slice(0, -1) : path
|
|
29
|
+
|
|
30
|
+
return cleanPathname.startsWith(cleanLinkPath)
|
|
31
|
+
}
|
|
21
32
|
---
|
|
22
33
|
|
|
23
34
|
<header class="navbar navbar-expand-large cxd-navbar sticky-top">
|
|
@@ -48,7 +59,7 @@ const { layout, title } = Astro.props
|
|
|
48
59
|
</a>
|
|
49
60
|
|
|
50
61
|
<div class="d-flex">
|
|
51
|
-
<div class="cxd-search" id="docsearch"
|
|
62
|
+
<div class="cxd-search" id="docsearch"></div>
|
|
52
63
|
|
|
53
64
|
<button
|
|
54
65
|
class="navbar-toggler d-flex d-large-none order-3 p-xsmall"
|
|
@@ -81,12 +92,11 @@ const { layout, title } = Astro.props
|
|
|
81
92
|
<div class="offcanvas-body p-large pt-0 p-large-0">
|
|
82
93
|
<hr class="d-large-none text-white-50" />
|
|
83
94
|
<ul class="navbar-nav flex-row flex-wrap cxd-navbar-nav mx-0 mx-large-medium">
|
|
84
|
-
<NavLink active={
|
|
85
|
-
<NavLink active={
|
|
86
|
-
<NavLink active={
|
|
87
|
-
<NavLink active={
|
|
88
|
-
<NavLink active={
|
|
89
|
-
<NavLink active={title === 'CSS'} href="/css" track>CSS</NavLink>
|
|
95
|
+
<NavLink active={isActive('/tokens')} href="/tokens">Tokens</NavLink>
|
|
96
|
+
<NavLink active={isActive('/figma')} href="/figma">Figma</NavLink>
|
|
97
|
+
<NavLink active={isActive('/css')} href="/css">CSS</NavLink>
|
|
98
|
+
<NavLink active={isActive('/assets')} href="/assets">Assets</NavLink>
|
|
99
|
+
<NavLink active={isActive('/icons')} href="/icons">Icons</NavLink>
|
|
90
100
|
<li class="nav-item dropdown ms-medium">
|
|
91
101
|
<a
|
|
92
102
|
class="nav-link dropdown-toggle"
|
package/src/scss/_docsearch.scss
CHANGED
|
@@ -1,29 +1,53 @@
|
|
|
1
1
|
// stylelint-disable selector-class-pattern
|
|
2
2
|
|
|
3
3
|
:root {
|
|
4
|
-
--docsearch-primary-color: var(--
|
|
5
|
-
--docsearch-
|
|
4
|
+
--docsearch-primary-color: var(--cx-primary);
|
|
5
|
+
--docsearch-text-color: var(--cx-fg-main);
|
|
6
|
+
--docsearch-spacing: var(--cx-space-medium);
|
|
7
|
+
// --docsearch-icon-stroke-width: 1.4;
|
|
8
|
+
--docsearch-highlight-color: var(--cx-primary);
|
|
9
|
+
--docsearch-muted-color: var(--cx-fg-subtle);
|
|
10
|
+
--docsearch-container-background: var(--cx-black-dim-main);
|
|
11
|
+
--docsearch-logo-color: var(--cx-primary);
|
|
12
|
+
// --docsearch-modal-width: 560px;
|
|
13
|
+
// --docsearch-modal-height: 600px;
|
|
14
|
+
--docsearch-modal-background: var(--cx-bg-even);
|
|
15
|
+
--docsearch-modal-shadow: var(--cx-box-shadow-large); // inset 1px 1px 0 0 #2c2e40, 0 3px 8px 0 #000309;
|
|
16
|
+
// --docsearch-searchbox-height: 56px;
|
|
17
|
+
--docsearch-searchbox-background: var(--cx-bg-main);
|
|
18
|
+
--docsearch-searchbox-focus-background: var(--cx-bg-hover);
|
|
19
|
+
// --docsearch-searchbox-shadow: inset 0 0 0 2px var(--docsearch-primary-color);
|
|
20
|
+
// --docsearch-hit-height: 56px;
|
|
21
|
+
--docsearch-hit-color: var(--cx-fg-main);
|
|
22
|
+
--docsearch-hit-active-color: var(--cx-primary-fg-solid);
|
|
23
|
+
--docsearch-hit-background: var(--cx-bg-main);
|
|
24
|
+
--docsearch-hit-shadow: none;
|
|
25
|
+
// --docsearch-key-gradient: linear-gradient(-26.5deg, #565872, #31355b);
|
|
26
|
+
// --docsearch-key-shadow: inset 0 -2px 0 0 #282d55, inset 0 0 1px 1px #51577d, 0 2px 2px 0 rgba(3, 4, 9, .3);
|
|
27
|
+
// --docsearch-key-pressed-shadow: inset 0 -2px 0 0 #cdcde6, inset 0 0 1px 1px #fff, 0 1px 1px 0 rgba(30, 35, 90, .4);
|
|
28
|
+
// --docsearch-footer-height: 44px;
|
|
29
|
+
--docsearch-footer-background: var(--cx-bg-evident);
|
|
30
|
+
--docsearch-footer-shadow: none; // inset 0 1px 0 0 rgba(73, 76, 106, .5), 0 -4px 8px 0 rgba(0, 0, 0, .2);
|
|
6
31
|
}
|
|
7
32
|
|
|
8
33
|
@include color-mode(dark, true) {
|
|
9
34
|
// From here, the values are copied from https://cdn.jsdelivr.net/npm/@docsearch/css@3
|
|
10
35
|
// in html[data-theme="dark"] selector
|
|
11
36
|
// and are slightly modified for formatting purpose
|
|
12
|
-
--docsearch-text-color: var(--cx-fg-main);
|
|
13
|
-
--docsearch-container-background:
|
|
14
|
-
--docsearch-modal-background:
|
|
15
|
-
--docsearch-modal-shadow: inset 1px 1px 0 0 #2c2e40, 0 3px 8px 0 #000309;
|
|
16
|
-
--docsearch-searchbox-background: var(--cx-bg-main, #fc0);
|
|
17
|
-
--docsearch-searchbox-focus-background:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
--docsearch-hit-
|
|
21
|
-
--docsearch-
|
|
22
|
-
--docsearch-key-
|
|
23
|
-
--docsearch-
|
|
24
|
-
--docsearch-footer-
|
|
25
|
-
--docsearch-
|
|
26
|
-
--docsearch-muted-color: #7f8497;
|
|
37
|
+
// --docsearch-text-color: var(--cx-fg-main);
|
|
38
|
+
// --docsearch-container-background: var(--cx-dim-main);
|
|
39
|
+
// --docsearch-modal-background: var(--cx-bg-even);
|
|
40
|
+
// --docsearch-modal-shadow: var(--cx-box-shadow-large); // inset 1px 1px 0 0 #2c2e40, 0 3px 8px 0 #000309;
|
|
41
|
+
// --docsearch-searchbox-background: var(--cx-bg-main, #fc0);
|
|
42
|
+
// --docsearch-searchbox-focus-background: var(--cx-bg-hover, #fc0);
|
|
43
|
+
// --docsearch-hit-color: #bec3c9;
|
|
44
|
+
// --docsearch-hit-shadow: none;
|
|
45
|
+
// --docsearch-hit-background: #090a11;
|
|
46
|
+
// --docsearch-key-gradient: linear-gradient(-26.5deg, #565872, #31355b);
|
|
47
|
+
// --docsearch-key-shadow: inset 0 -2px 0 0 #282d55, inset 0 0 1px 1px #51577d, 0 2px 2px 0 rgba(3, 4, 9, .3);
|
|
48
|
+
// --docsearch-footer-background: #1e2136;
|
|
49
|
+
// --docsearch-footer-shadow: inset 0 1px 0 0 rgba(73, 76, 106, .5), 0 -4px 8px 0 rgba(0, 0, 0, .2);
|
|
50
|
+
// --docsearch-muted-color: #7f8497;
|
|
27
51
|
}
|
|
28
52
|
|
|
29
53
|
.cxd-search {
|
|
@@ -149,7 +173,7 @@
|
|
|
149
173
|
|
|
150
174
|
a {
|
|
151
175
|
@include border-radius(0);
|
|
152
|
-
border: solid var(--cx-border-
|
|
176
|
+
border: solid var(--cx-border-subtle);
|
|
153
177
|
border-width: 0 1px 1px;
|
|
154
178
|
}
|
|
155
179
|
|
package/src/scss/_settings.scss
CHANGED
|
@@ -12,6 +12,7 @@ $enable-cssgrid: true !default;
|
|
|
12
12
|
$enable-dark-mode: true !default;
|
|
13
13
|
$enable-deprecation-messages: true !default;
|
|
14
14
|
$enable-elevation-shadows: true !default;
|
|
15
|
+
$enable-exclude-strokes: true !default;
|
|
15
16
|
$enable-grid-classes: true !default;
|
|
16
17
|
$enable-important-utilities: true !default;
|
|
17
18
|
$enable-negative-margins: true !default;
|