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