@chassis-ui/docs 0.1.10 → 0.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.
Files changed (79) hide show
  1. package/README.md +16 -16
  2. package/index.ts +6 -1
  3. package/package.json +20 -8
  4. package/src/components/DocsSidebar.astro +63 -23
  5. package/src/components/FeatureCard.astro +8 -8
  6. package/src/components/NavLink.astro +1 -1
  7. package/src/components/TableOfContents.astro +8 -7
  8. package/src/components/ThemeToggler.astro +16 -37
  9. package/src/components/shortcodes/Blockquote.astro +31 -0
  10. package/src/components/shortcodes/CSSOnly.astro +22 -0
  11. package/src/components/shortcodes/Callout.astro +6 -2
  12. package/src/components/shortcodes/Code.astro +289 -0
  13. package/src/components/shortcodes/DeprecatedIn.astro +18 -0
  14. package/src/components/shortcodes/Example.astro +132 -0
  15. package/src/components/shortcodes/Icon.astro +57 -0
  16. package/src/components/shortcodes/InFigma.astro +26 -0
  17. package/src/components/shortcodes/JsDocs.astro +64 -0
  18. package/src/components/shortcodes/Placeholder.astro +28 -0
  19. package/src/components/shortcodes/ResizableExample.astro +126 -0
  20. package/src/components/shortcodes/ScssDocs.astro +108 -0
  21. package/src/components/shortcodes/ScssDocsSimple.astro +66 -0
  22. package/src/js/color-modes.js +3 -3
  23. package/src/js/example-mode.js +75 -0
  24. package/src/js/search.js +501 -39
  25. package/src/js/theme-color.js +1 -1
  26. package/src/layouts/DocsLayout.astro +18 -21
  27. package/src/layouts/RedirectLayout.astro +1 -0
  28. package/src/layouts/SingleLayout.astro +3 -3
  29. package/src/layouts/footer/Footer.astro +5 -5
  30. package/src/layouts/footer/Scripts.astro +14 -7
  31. package/src/layouts/head/Analytics.astro +12 -6
  32. package/src/layouts/head/Favicons.astro +0 -2
  33. package/src/layouts/head/Head.astro +2 -7
  34. package/src/layouts/head/Stylesheet.astro +18 -11
  35. package/src/layouts/header/Header.astro +2 -5
  36. package/src/layouts/header/Navigation.astro +40 -42
  37. package/src/layouts/header/SearchDialog.astro +74 -0
  38. package/src/layouts/header/SearchTrigger.astro +41 -0
  39. package/src/layouts/header/Skippy.astro +1 -1
  40. package/src/libs/highlight.ts +91 -0
  41. package/src/libs/icon.ts +75 -0
  42. package/src/libs/image.ts +12 -1
  43. package/src/libs/layout.ts +18 -0
  44. package/src/libs/markdown.ts +128 -0
  45. package/src/libs/placeholder.ts +250 -0
  46. package/src/libs/rehype.ts +0 -17
  47. package/src/libs/shortcodes.ts +129 -0
  48. package/src/libs/site.ts +95 -0
  49. package/src/libs/toc.ts +40 -6
  50. package/src/libs/utils.ts +34 -82
  51. package/src/libs/vite.ts +45 -0
  52. package/src/scss/_anchor.scss +20 -16
  53. package/src/scss/_callouts.scss +29 -28
  54. package/src/scss/_content.scss +72 -103
  55. package/src/scss/_footer.scss +18 -19
  56. package/src/scss/_layout.scss +56 -61
  57. package/src/scss/_navbar.scss +19 -126
  58. package/src/scss/_placeholder-img.scss +11 -7
  59. package/src/scss/_scrolling.scss +14 -12
  60. package/src/scss/_search.scss +418 -0
  61. package/src/scss/_shiki.scss +120 -0
  62. package/src/scss/_sidebar.scss +137 -132
  63. package/src/scss/_skippy.scss +6 -4
  64. package/src/scss/_snippets.scss +181 -0
  65. package/src/scss/_toc.scss +97 -93
  66. package/src/scss/_vars.scss +89 -0
  67. package/src/scss/main.scss +75 -81
  68. package/src/js/icon-loader.js +0 -229
  69. package/src/libs/chassis.ts +0 -38
  70. package/src/scss/_brand.scss +0 -59
  71. package/src/scss/_buttons.scss +0 -33
  72. package/src/scss/_clipboard-js.scss +0 -63
  73. package/src/scss/_code.scss +0 -116
  74. package/src/scss/_colors.scss +0 -140
  75. package/src/scss/_docsearch.scss +0 -212
  76. package/src/scss/_masthead.scss +0 -124
  77. package/src/scss/_settings.scss +0 -29
  78. package/src/scss/_syntax.scss +0 -160
  79. package/src/scss/_variables.scss +0 -78
@@ -2,28 +2,27 @@
2
2
  // Footer
3
3
  //
4
4
 
5
- .cxd-footer {
6
- // margin-top: 0 !important;
7
- // margin-top: 4rem;
8
- --cx-fg-color: var(--cx-fg-subtle);
9
- background-color: var(--cx-bg-evident);
10
- // border-top: var(--cx-border-width) var(--cx-border-style) var(--cx-border-subtle);
11
- .nav {
12
- display: block;
13
- > li {
14
- display: list-item;
15
- margin-bottom: var(--cx-space-xsmall);
5
+ @layer custom {
6
+ .cxd-footer {
7
+ --cx-fg-color: var(--cx-fg-subtle);
8
+ background-color: var(--cx-bg-evident);
9
+ .nav {
10
+ display: block;
11
+ > li {
12
+ display: list-item;
13
+ margin-block-end: var(--cx-space-xsmall);
14
+ }
16
15
  }
17
- }
18
16
 
19
- a {
20
- color: var(--cx-fg-color);
21
- text-decoration: none;
17
+ a {
18
+ color: var(--cx-fg-color);
19
+ text-decoration: none;
22
20
 
23
- &:hover,
24
- &:focus {
25
- color: var(--cx-hover-color);
26
- text-decoration: underline;
21
+ &:hover,
22
+ &:focus {
23
+ color: var(--cx-hover-color);
24
+ text-decoration: underline;
25
+ }
27
26
  }
28
27
  }
29
28
  }
@@ -1,75 +1,70 @@
1
- .cxd-gutter {
2
- --cx-gutter-x: #{$cxd-gutter-x};
3
- }
1
+ @use "./vars" as *;
2
+ @use "@chassis-ui/css/scss/mixins" as *;
4
3
 
5
- .cxd-layout {
6
- // padding: 1rem !important;
4
+ @layer custom {
5
+ .cxd-gutter {
6
+ --cx-gutter-x: #{$cxd-gutter-x};
7
+ }
7
8
 
8
- @include media-breakpoint-up(large) {
9
- display: grid;
10
- grid-template-areas: "sidebar main";
11
- // grid-template-columns: 1.5fr 6.5fr;
12
- grid-template-columns: 14rem auto;
13
- // gap: $grid-gutter-width;
14
- gap: $cxd-gutter-x;
15
- padding: 0 1rem !important; // stylelint-disable-line declaration-no-important
16
- margin: 0 auto;
9
+ .cxd-layout {
10
+ @include media-breakpoint-up(large) {
11
+ display: grid;
12
+ grid-template-areas: "sidebar main";
13
+ grid-template-columns: 14rem auto;
14
+ gap: $cxd-gutter-x;
15
+ padding: 0 1rem;
16
+ margin: 0 auto;
17
+ }
17
18
  }
18
- }
19
19
 
20
- .cxd-sidebar {
21
- grid-area: sidebar;
22
- }
20
+ .cxd-sidebar {
21
+ grid-area: sidebar;
22
+ }
23
23
 
24
- .cxd-intro {
25
- grid-area: intro;
26
- max-width: 960px;
27
- margin: 2rem auto 0;
28
- }
24
+ .cxd-intro {
25
+ grid-area: intro;
26
+ width: 100%;
27
+ max-width: 960px;
28
+ margin: 2rem auto 0;
29
+ }
29
30
 
30
- .cxd-main {
31
- grid-area: main;
32
- order: 1;
31
+ .cxd-main {
32
+ grid-area: main;
33
+ order: 1;
33
34
 
34
- @include media-breakpoint-down(large) {
35
- // max-width: 760px;
36
- margin-inline: auto;
37
- }
35
+ @include media-breakpoint-down(large) {
36
+ margin-inline: auto;
37
+ }
38
+
39
+ @include media-breakpoint-up(medium) {
40
+ display: grid;
41
+ grid-template-areas:
42
+ "intro"
43
+ "toc"
44
+ "content";
45
+ grid-template-rows: auto auto 1fr;
46
+ gap: inherit;
47
+ }
38
48
 
39
- @include media-breakpoint-up(medium) {
40
- display: grid;
41
- grid-template-areas:
42
- "intro"
43
- "toc"
44
- "content";
45
- grid-template-rows: auto auto 1fr;
46
- gap: inherit;
49
+ @include media-breakpoint-up(large) {
50
+ grid-template-areas:
51
+ "intro toc"
52
+ "content toc";
53
+ grid-template-rows: auto 1fr;
54
+ grid-template-columns: auto 14rem;
55
+ }
47
56
  }
48
57
 
49
- @include media-breakpoint-up(large) {
50
- grid-template-areas:
51
- "intro toc"
52
- "content toc";
53
- grid-template-rows: auto 1fr;
54
- grid-template-columns: auto 14rem;
58
+ .cxd-toc {
59
+ grid-area: toc;
55
60
  }
56
- }
57
61
 
58
- .cxd-toc {
59
- grid-area: toc;
60
- }
62
+ .cxd-content {
63
+ grid-area: content;
64
+ justify-self: center;
65
+ width: 100%;
66
+ min-width: 1px; // Fix width when cxd-content contains a `<pre>` https://github.com/chassis-ui/css/issues/25410
67
+ max-width: 960px;
68
+ }
61
69
 
62
- .cxd-content {
63
- grid-area: content;
64
- min-width: 1px; // Fix width when cxd-content contains a `<pre>` https://github.com/chassis-ui/css/issues/25410
65
- max-width: 960px;
66
- margin: 0 auto;
67
70
  }
68
-
69
- // .cxd-content,
70
- // .cxd-intro {
71
- // width: 100%;
72
- // max-width: 960px;
73
- // margin-right: auto;
74
- // margin-left: auto;
75
- // }
@@ -1,138 +1,31 @@
1
- .cxd-navbar {
2
- // box-shadow: 0 .5rem 1rem rgba($black, .15), inset 0 -1px 0 rgba($white, .15);
3
- padding: 0;
4
- // padding: .75rem 0;
5
- background-color: rgba(var(--cx-bg-main-rgb), var(--cx-opacity-dim-main));
6
- backdrop-filter: blur(24px);
7
- border-bottom: var(--cx-border-width-medium) solid var(--cx-border-subtle);
1
+ @use "@chassis-ui/css/scss/mixins" as *;
8
2
 
9
- // @media (forced-colors) {
10
- // background-color: Canvas;
11
- // }
12
-
13
- &::after {
14
- position: absolute;
15
- inset: 0;
16
- z-index: -1;
17
- display: block;
18
- content: "";
19
- // background-image: linear-gradient(rgba(var(--cxd-subtle-rgb), 1), rgba(var(--cxd-subtle-rgb), .95));
20
- }
21
-
22
- .cxd-navbar-toggle {
23
- @include media-breakpoint-down(large) {
24
- width: 4.25rem;
25
- }
26
- }
27
-
28
- .navbar-toggler {
3
+ @layer custom {
4
+ .cxd-navbar {
29
5
  padding: 0;
30
- margin-right: -.5rem;
31
- border: 0;
32
-
33
- &:first-child {
34
- margin-left: -.5rem;
35
- }
36
-
37
- .bi {
38
- width: 1.5rem;
39
- height: 1.5rem;
40
- }
6
+ border-block-end: var(--cx-border-width-medium) solid var(--cx-border-subtle);
41
7
 
42
- &:focus {
43
- box-shadow: none;
44
- }
45
- }
46
-
47
- .navbar-brand {
48
- color: $white;
49
- @include transition(transform .2s ease-in-out);
50
-
51
- // &:hover {
52
- // transform: rotate(-5deg) scale(1.1);
53
- // }
54
- }
55
-
56
- .navbar-toggler,
57
- .nav-link {
58
- --cx-caret-color: var(--cx-fg-color);
59
- @include font-size(var(--cx-font-size-small));
60
- font-weight: var(--cx-font-weight-strong);
61
- // line-height: 1.75em;
62
- text-transform: uppercase;
63
- .icon {
64
- --cx-icon-color: var(--cx-fg-color);
65
- height: 24px;
66
- vertical-align: -.275em;
8
+ > .container {
9
+ position: relative;
67
10
  }
68
11
 
69
- @include media-breakpoint-up(large) {
70
- padding: var(--cx-space-large);
71
- &.active {
72
- padding-bottom: var(--cx-space-medium);
73
- border-bottom: var(--cx-border-width-2xlarge) solid var(--cx-primary-cue-main);
12
+ .navbar-toggler,
13
+ .nav-link {
14
+ --cx-caret-color: var(--cx-fg-color);
15
+ @include font-size(var(--cx-font-size-small));
16
+ font-weight: var(--cx-font-weight-strong);
17
+ text-transform: uppercase;
18
+ .icon {
19
+ --cx-icon-color: var(--cx-fg-color);
74
20
  }
75
- }
76
-
77
- }
78
21
 
79
- .navbar-nav-svg {
80
- display: inline-block;
81
- vertical-align: -.125rem;
82
- }
83
-
84
- .offcanvas-large {
85
- background-color: var(--cxd-subtle-bg);
86
- border-left: 0;
87
-
88
- @include media-breakpoint-down(large) {
89
- height: 100vh;
90
- box-shadow: var(--cx-box-shadow-large);
91
- }
92
- }
93
-
94
- .dropdown-toggle {
95
- &:focus:not(:focus-visible) {
96
- outline: 0;
97
- }
98
- }
99
-
100
- .dropdown-menu {
101
- --cx-dropdown-min-width: 12rem;
102
- --cx-dropdown-padding-x: .25rem;
103
- --cx-dropdown-padding-y: .25rem;
104
- --cx-dropdown-link-hover-bg: rgba(var(--cxd-subtle-rgb), .1);
105
- --cx-dropdown-link-active-bg: rgba(var(--cxd-subtle-rgb), 1);
106
- @include rfs(.875rem, --cx-dropdown-font-size);
107
- @include font-size(.875rem);
108
- @include border-radius(.5rem);
109
- position: absolute;
110
- box-shadow: $dropdown-box-shadow;
111
-
112
- li + li {
113
- margin-top: .125rem;
114
- }
115
-
116
- .dropdown-item {
117
- @include border-radius(.25rem);
118
-
119
- &:active {
120
- .icon {
121
- color: inherit !important; // stylelint-disable-line declaration-no-important
22
+ @include media-breakpoint-up(large) {
23
+ padding: var(--cx-space-large) var(--cx-space-xsmall);
24
+ &.active {
25
+ padding-block-end: var(--cx-space-medium);
26
+ border-block-end: var(--cx-border-width-2xlarge) solid var(--cx-primary-cue-main);
122
27
  }
123
28
  }
124
29
  }
125
-
126
- .active {
127
- font-weight: 600;
128
-
129
- .icon {
130
- display: block !important; // stylelint-disable-line declaration-no-important
131
- }
132
- }
133
- }
134
-
135
- .dropdown-menu-end {
136
- --cx-dropdown-min-width: 8rem;
137
30
  }
138
31
  }
@@ -1,15 +1,19 @@
1
+ @use "@chassis-ui/css/scss/mixins" as *;
2
+
1
3
  //
2
4
  // Placeholder svg used in the docs.
3
5
  //
4
6
 
5
7
  // Remember to update `site/_layouts/examples.html` too if this changes!
6
8
 
7
- .cxd-placeholder-image {
8
- @include font-size(1.125rem);
9
- user-select: none;
10
- text-anchor: middle;
11
- }
9
+ @layer custom {
10
+ .cxd-placeholder-image {
11
+ @include font-size(1.125rem);
12
+ user-select: none;
13
+ text-anchor: middle;
14
+ }
12
15
 
13
- .cxd-placeholder-image-large {
14
- @include font-size(3.5rem);
16
+ .cxd-placeholder-image-large {
17
+ @include font-size(3.5rem);
18
+ }
15
19
  }
@@ -1,16 +1,18 @@
1
1
  // When navigating with the keyboard, prevent focus from landing behind the sticky header
2
2
 
3
- main {
4
- a,
5
- button,
6
- input,
7
- select,
8
- textarea,
9
- h2,
10
- h3,
11
- h4,
12
- [tabindex="0"] {
13
- scroll-margin-top: 80px;
14
- scroll-margin-bottom: 100px;
3
+ @layer custom {
4
+ main {
5
+ a,
6
+ button,
7
+ input,
8
+ select,
9
+ textarea,
10
+ h2,
11
+ h3,
12
+ h4,
13
+ [tabindex="0"] {
14
+ scroll-margin-block-start: 80px;
15
+ scroll-margin-block-end: 100px;
16
+ }
15
17
  }
16
18
  }