@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
@@ -1,117 +1,121 @@
1
- // stylelint-disable selector-max-type, selector-no-qualifying-type
1
+ @use "@chassis-ui/css/scss/mixins" as *;
2
2
 
3
- .cxd-toc {
4
- @include media-breakpoint-up(large) {
5
- position: sticky;
6
- top: 4rem;
7
- right: 0;
8
- z-index: 2;
9
- // height: subtract(100vh, 7rem);
10
- height: 100vh;
11
- padding: 1rem;
12
- padding-right: 0;
13
- overflow-y: auto;
14
- color: var(--cx-fg-subtle);
15
- // border-image: linear-gradient(var(--cx-border-subtle) 25%, var(--cx-transparent-color) 50%) 1;
16
- // border-width: 0;
17
- // border-style: solid;
18
- border-left: var(--cx-border-width) var(--cx-border-style) var(--cx-border-subtle);
19
- }
20
- @include media-breakpoint-between(medium, large) {
21
- padding: .5rem 1rem;
22
- margin-bottom: 1rem;
23
- background-color: var(--cx-bg-even);
24
- border: var(--cx-border-width) var(--cx-border-style) var(--cx-border-subtle);
25
- @include border-radius(var(--cx-border-radius));
26
- }
27
-
28
- nav {
29
- @include font-size(.875rem);
3
+ // stylelint-disable selector-max-type, selector-no-qualifying-type
4
+ @layer custom {
5
+
6
+ .cxd-toc {
7
+ @include media-breakpoint-up(large) {
8
+ position: sticky;
9
+ top: 4rem;
10
+ right: 0;
11
+ z-index: 2;
12
+ // height: subtract(100vh, 7rem);
13
+ height: calc(100vh - 4rem);
14
+ padding: 1rem;
15
+ padding-inline-end: 0;
16
+ overflow-y: auto;
17
+ color: var(--cx-fg-subtle);
18
+ // border-image: linear-gradient(var(--cx-border-subtle) 25%, var(--cx-transparent-color) 50%) 1;
19
+ // border-width: 0;
20
+ // border-style: solid;
21
+ border-inline-start: var(--cx-border-width) var(--cx-border-style) var(--cx-border-subtle);
22
+ }
23
+ @include media-breakpoint-between(medium, large) {
24
+ padding: .5rem 1rem;
25
+ margin-block-end: 1rem;
26
+ background-color: var(--cx-bg-even);
27
+ border: var(--cx-border-width) var(--cx-border-style) var(--cx-border-subtle);
28
+ @include border-radius(var(--cx-border-radius-medium));
29
+ }
30
30
 
31
- ul {
32
- padding-left: 0;
33
- margin-bottom: 0;
34
- list-style: none;
31
+ nav {
32
+ @include font-size(.875rem);
35
33
 
36
34
  ul {
37
- padding-left: 2rem;
38
- margin-left: -1rem;
39
- }
40
- }
35
+ padding-inline-start: 0;
36
+ margin-block-end: 0;
37
+ list-style: none;
41
38
 
42
- a {
43
- display: block;
44
- padding: .125rem 0 .125rem .5rem;
45
- color: inherit;
46
- text-decoration: none;
47
- border-left: .125rem solid transparent;
48
-
49
- @each $i in 1, 2, 3, 4, 5, 6 {
50
- &.level-#{$i} {
51
- padding-left: $i * 1rem;
52
- margin-left: $i * -1rem;
39
+ ul {
40
+ padding-inline-start: 2rem;
41
+ margin-inline-start: -1rem;
53
42
  }
54
43
  }
55
44
 
56
- &:hover,
57
- &.active {
58
- color: var(--cxd-toc-color);
59
- border-left-color: var(--cxd-toc-color);
60
- }
45
+ a {
46
+ display: block;
47
+ padding: .125rem 0 .125rem .5rem;
48
+ color: inherit;
49
+ text-decoration: none;
50
+ border-inline-start: .125rem solid transparent;
51
+
52
+ @each $i in 1, 2, 3, 4, 5, 6 {
53
+ &.level-#{$i} {
54
+ padding-inline-start: $i * 1rem;
55
+ margin-inline-start: $i * -1rem;
56
+ }
57
+ }
61
58
 
62
- &.active {
63
- font-weight: 500;
64
- }
59
+ &:hover,
60
+ &.active {
61
+ color: var(--cxd-toc-color);
62
+ border-left-color: var(--cxd-toc-color);
63
+ }
65
64
 
66
- code {
67
- font: inherit;
65
+ &.active {
66
+ font-weight: 500;
67
+ }
68
+
69
+ code {
70
+ font: inherit;
71
+ }
68
72
  }
69
73
  }
70
74
  }
71
- }
72
75
 
73
- .cxd-toc-toggle {
74
- box-sizing: border-box;
75
- display: flex;
76
- align-items: center;
77
-
78
- @include media-breakpoint-down(small) {
79
- justify-content: space-between;
80
- width: 100%;
81
- }
76
+ .cxd-toc-toggle {
77
+ box-sizing: border-box;
78
+ display: flex;
79
+ align-items: center;
82
80
 
83
- @include media-breakpoint-down(medium) {
84
- color: var(--cx-fg-color);
85
- border: var(--cx-border-width) var(--cx-border-style) var(--cx-border-color);
86
- @include border-radius(var(--cx-border-radius));
87
-
88
- &:hover,
89
- &:focus,
90
- &:active,
91
- &[aria-expanded="true"] {
92
- color: var(--cxd-subtle);
93
- background-color: var(--cx-bg-color);
94
- // border-color: var(--cxd-subtle);
81
+ @include media-breakpoint-down(small) {
82
+ justify-content: space-between;
83
+ width: 100%;
95
84
  }
96
85
 
97
- &:focus,
98
- &[aria-expanded="true"] {
99
- box-shadow: 0 0 0 3px rgba(var(--cxd-subtle-rgb), .25);
86
+ @include media-breakpoint-down(medium) {
87
+ color: var(--cx-fg-color);
88
+ border: var(--cx-border-width) var(--cx-border-style) var(--cx-border-color);
89
+ @include border-radius(var(--cx-border-radius-medium));
90
+
91
+ &:hover,
92
+ &:focus,
93
+ &:active,
94
+ &[aria-expanded="true"] {
95
+ color: var(--cxd-subtle);
96
+ background-color: var(--cx-bg-color);
97
+ // border-color: var(--cxd-subtle);
98
+ }
99
+
100
+ &:focus,
101
+ &[aria-expanded="true"] {
102
+ box-shadow: 0 0 0 3px #{to-opacity(var(--cxd-subtle), .25)};
103
+ }
100
104
  }
101
105
  }
102
- }
103
106
 
104
- .cxd-toc-collapse {
105
- @include media-breakpoint-down(medium) {
106
- nav {
107
- padding: 1.25rem 1.25rem 1.25rem 1rem;
108
- background-color: var(--cx-bg-even);
109
- border: var(--cx-border-width) solid var(--cx-border-subtle);
110
- @include border-radius(var(--cx-border-radius));
107
+ .cxd-toc-collapse {
108
+ @include media-breakpoint-down(medium) {
109
+ nav {
110
+ padding: 1.25rem 1.25rem 1.25rem 1rem;
111
+ background-color: var(--cx-bg-even);
112
+ border: var(--cx-border-width) solid var(--cx-border-subtle);
113
+ @include border-radius(var(--cx-border-radius-medium));
114
+ }
111
115
  }
112
- }
113
116
 
114
- @include media-breakpoint-up(medium) {
115
- display: block !important; // stylelint-disable-line declaration-no-important
117
+ @include media-breakpoint-up(medium) {
118
+ display: block;
119
+ }
116
120
  }
117
121
  }
@@ -0,0 +1,89 @@
1
+ // Local docs variables
2
+ @use "@chassis-ui/css/scss/functions" as *;
3
+ @use "@chassis-ui/css/scss/mixins" as *;
4
+
5
+ $aqua: #0cc !default;
6
+ $black: #000 !default;
7
+ $blue: #00f !default;
8
+ $cyan: #0cf !default;
9
+ $green: #090 !default;
10
+ $gray: #999 !default;
11
+ $graydark: #666 !default;
12
+ $fuchsia: #c0c !default;
13
+ $indigo: #639 !default;
14
+ $olive: #990 !default;
15
+ $orange: #f90 !default;
16
+ $red: #f00 !default;
17
+ $pink: #f39 !default;
18
+ $purple: #90f !default;
19
+ $teal: #099 !default;
20
+ $violet: #c3c !default;
21
+ $white: #fff !default;
22
+ $yellow: #fc0 !default;
23
+
24
+ $cxd-gutter-x: 2rem;
25
+ $cxd-callout-variants: info, warning, danger, default !default;
26
+
27
+ :root {
28
+ --cxd-code-color: var(--cx-secondary-fg-main);
29
+ --cxd-main: var(--cx-primary);
30
+ --cxd-subtle: light-dark(var(--cx-primary-40), var(--cx-primary-60));
31
+ --cxd-pink-rgb: #{to-rgb($pink)};
32
+ --cxd-teal-rgb: #{to-rgb($teal)};
33
+ --cxd-main-bg: var(--cxd-main);
34
+ --cxd-subtle-bg: var(--cxd-subtle);
35
+ --cxd-toc-color: var(--cxd-main);
36
+ --cxd-sidebar-link-bg: var(--cx-bg-highlight);
37
+ // --cxd-callout-link: #{to-color($blue-600)};
38
+ // --cxd-callout-code-color: var(--cx-base-color);
39
+ // --cxd-pre-bg: var(--cx-bg-even);
40
+ }
41
+
42
+
43
+ @layer custom {
44
+
45
+ // @if $enable-dark-mode {
46
+ // @include color-mode(dark, true) {
47
+ // // color-scheme: dark;
48
+ // // --cxd-toc-color: var(--cx-fg-subtle);
49
+ // --cxd-sidebar-link-bg: var(--cx-primary-40);
50
+ // // --cxd-callout-link: #{to-color($blue-300)};
51
+ // // --cxd-callout-code-color: #{to-color($pink-300)};
52
+ // //--cxd-pre-bg: #{adjust-color($gray-900, $lightness: -2.5%)}; // stylelint-disable-line scss/at-function-named-arguments
53
+ // // --cxd-pre-bg: var(--cx-bg-evident);
54
+ // }
55
+ // }
56
+
57
+ // @import "../../../tokens/default.scss";
58
+ // h1:not(.cxd-example h1),
59
+ // h2:not(.cxd-example h2),
60
+ // h3:not(.cxd-example h3),
61
+ // h4:not(.cxd-example h4),
62
+ // h5:not(.cxd-example h5),
63
+ // h6:not(.cxd-example h6) {
64
+ // & ~ p,
65
+ // & ~ ol,
66
+ // & ~ ul {
67
+ // font-family: var(--cx-font-family-display) !important;
68
+ // }
69
+ // }
70
+
71
+ // .cxd-intro h1 {
72
+ // line-height: 1.25em;
73
+ // }
74
+ // .cxd-intro h1,
75
+ // .cxd-content > h1,
76
+ // .cxd-content > h2,
77
+ // .cxd-content > h3,
78
+ // .cxd-content > h4 {
79
+ // font-family: var(--cx-font-family-display) !important;
80
+ // font-weight: var(--cx-font-weight-display-strong) !important;
81
+ // }
82
+ //
83
+ // .cxd-playground textarea {
84
+ // font-family: var(--cx-font-family-code) !important;
85
+ // //font-size: var(--cx-font-small) !important;
86
+ // background-color: var(--cx-default-bg-even) !important;
87
+ // border-color: var(--cx-default-border-subtle);
88
+ // }
89
+ }
@@ -1,102 +1,96 @@
1
- @import "settings";
1
+ @use "@chassis-ui/css/scss/mixins" as *;
2
2
 
3
- @import "colors";
4
- @import "variables";
5
- @import "fonts";
3
+ @forward "./fonts";
4
+ @forward "./navbar";
5
+ @forward "./content";
6
+ @forward "./skippy";
7
+ @forward "./sidebar";
8
+ @forward "./layout";
9
+ @forward "./toc";
10
+ @forward "./footer";
11
+ @forward "./snippets";
12
+ @forward "./callouts";
13
+ @forward "./placeholder-img";
14
+ @forward "./scrolling";
6
15
 
7
- @import "navbar";
8
- // @import "masthead";
9
- @import "content";
10
- @import "skippy";
11
- @import "sidebar";
12
- @import "layout";
13
- @import "toc";
14
- @import "footer";
15
- @import "buttons";
16
- @import "code";
17
- @import "callouts";
18
- @import "brand";
19
- @import "clipboard-js";
20
- @import "placeholder-img";
21
- @import "scrolling";
16
+ @forward "./shiki";
17
+ @forward "./anchor";
18
+ @forward "./search";
22
19
 
23
- @import "syntax";
24
- @import "anchor";
25
-
26
- @import "@docsearch/css/dist/style";
27
- @import "docsearch";
28
-
29
- /* Hide light-mode things when in dark mode */
30
- .visible-light {
31
- [data-cx-theme="dark"] &:not([data-cx-theme="dark"] [data-cx-theme="light"] &) {
32
- display: none;
20
+ @layer custom {
21
+ /* Hide light-mode things when in dark mode */
22
+ .visible-light {
23
+ [data-cx-theme="dark"] &:not([data-cx-theme="dark"] [data-cx-theme="light"] &) {
24
+ display: none;
25
+ }
33
26
  }
34
- }
35
27
 
36
- /* Hide dark-mode things when in light mode */
37
- .visible-dark {
38
- [data-cx-theme="light"] &:not([data-cx-theme="light"] [data-cx-theme="dark"] &) {
39
- display: none;
28
+ /* Hide dark-mode things when in light mode */
29
+ .visible-dark {
30
+ [data-cx-theme="light"] &:not([data-cx-theme="light"] [data-cx-theme="dark"] &) {
31
+ display: none;
32
+ }
40
33
  }
41
- }
42
34
 
43
- .docs-body .navbar,
44
- .docs-body .cxd-footer {
45
- .container-2xlarge {
46
- max-width: 100%;
35
+ .docs-body .navbar,
36
+ .docs-body .cxd-footer {
37
+ .container.#{\32 xlarge} {
38
+ max-width: 100%;
39
+ }
47
40
  }
48
- .cxd-search {
49
- @include media-breakpoint-up(2xlarge) {
50
- right: 12rem;
51
- left: auto;
41
+
42
+ code {
43
+ color: var(--cxd-code-color, var(--cx-code-color));
44
+ pre & {
45
+ color: inherit;
52
46
  }
53
47
  }
54
- }
55
48
 
56
- .home-section {
57
- overflow: hidden;
58
- }
49
+ .home-section {
50
+ overflow: hidden;
51
+ }
59
52
 
60
- .section-content:has(.gallery-image) > div {
61
- height: var(--gallery-image-height, 256px);
62
- border: var(--#{$prefix}border-width-medium) solid var(--#{$prefix}bg-evident);
63
- }
53
+ .section-content:has(.gallery-image) > div {
54
+ height: var(--gallery-image-height, 256px);
55
+ border: var(--cx-border-width-medium) solid var(--cx-bg-evident);
56
+ }
64
57
 
65
- .gallery-image {
66
- display: flex;
67
- align-items: center;
58
+ .gallery-image {
59
+ display: flex;
60
+ align-items: center;
68
61
 
69
- @include media-breakpoint-down(medium) {
70
- margin-top: -25%;
71
- }
62
+ @include media-breakpoint-down(medium) {
63
+ margin--block-start: -25%;
64
+ }
72
65
 
73
- > img {
74
- vertical-align: middle;
75
- zoom: 1.5;
76
- transform: rotate(30deg) skewX(-30deg) scaleY(.866);
66
+ > img {
67
+ vertical-align: middle;
68
+ zoom: 1.5;
69
+ transform: rotate(30deg) skewX(-30deg) scaleY(.866);
70
+ }
77
71
  }
78
- }
79
72
 
80
- .feature-item .cxd-code-snippet {
81
- --cxicon-color: var(--#{$prefix}fg-color);
82
- --cx-icon-size: 1em;
83
- margin-bottom: 0;
84
- background-color: var(--#{$prefix}bg-even);
85
- border: 0;
73
+ .feature-item .cxd-code-snippet {
74
+ --cx-icon-color: var(--cx-fg-color);
75
+ --cx-icon-size: 1em;
76
+ margin-block-end: 0;
77
+ background-color: var(--cx-bg-even);
78
+ border: 0;
86
79
 
87
- .highlight {
88
- padding: var(--#{$prefix}space-medium);
89
- background-color: var(--#{$prefix}bg-even);
90
- }
91
- pre {
92
- padding: 0;
93
- margin: 0;
94
- }
95
- > .cxd-clipboard {
96
- display: none;
97
- }
80
+ .cxd-code {
81
+ padding: var(--cx-space-medium);
82
+ background-color: var(--cx-bg-even);
83
+ }
84
+ pre {
85
+ padding: 0;
86
+ margin: 0;
87
+ }
88
+ > .cxd-clipboard {
89
+ display: none;
90
+ }
98
91
 
99
- .token.comment {
100
- color: var(--#{$prefix}fg-subtle);
92
+ .token.comment {
93
+ color: var(--cx-fg-subtle);
94
+ }
101
95
  }
102
96
  }