@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,161 +1,166 @@
1
- .cxd-sidebar {
2
- --#{$prefix}cue-main: var(--cx-secondary-cue-main);
3
- --#{$prefix}bg-active: var(--cx-secondary-bg-solid);
4
- --#{$prefix}fg-active: var(--cx-secondary-fg-solid);
5
- --#{$prefix}bg-highlight: var(--cx-default-bg-highlight);
6
- --#{$prefix}fg-highlight: var(--cx-fg-main);
7
-
8
- @include media-breakpoint-up(large) {
9
- position: sticky;
10
- top: 4rem;
11
- // background-color: var(--cx-bg-main);
12
- // Override collapse behaviors
13
- // stylelint-disable-next-line declaration-no-important
14
- display: block !important;
15
- height: subtract(100vh, 3rem);
16
- padding: 1.5rem 0;
17
- padding-right: .5rem;
18
- overflow-x: visible;
19
- // Prevent focus styles to be cut off:
20
- overflow-y: auto;
21
- border-right: var(--cx-border-width) solid var(--cx-border-subtle);
22
- }
1
+ @use "@chassis-ui/css/scss/config" as *;
2
+ @use "@chassis-ui/css/scss/mixins" as *;
3
+
4
+ @layer custom {
5
+ .cxd-sidebar {
6
+ --cx-cue-main: var(--cx-secondary-cue-main);
7
+ --cx-bg-active: var(--cx-secondary-bg-solid);
8
+ --cx-fg-active: var(--cx-secondary-fg-solid);
9
+ --cx-bg-highlight: var(--cx-default-bg-highlight);
10
+ --cx-fg-highlight: var(--cx-fg-main);
11
+
12
+ @include media-breakpoint-up(large) {
13
+ position: sticky;
14
+ top: 4rem;
15
+ display: block;
16
+ max-height: #{calc(100vh - 3rem)};
17
+ padding: 1.5rem 0;
18
+ padding-inline-end: .5rem;
19
+ overflow-x: visible;
20
+ // Prevent focus styles to be cut off:
21
+ overflow-y: auto;
22
+ border-inline-end: var(--cx-border-width) solid var(--cx-border-subtle);
23
+ }
23
24
 
24
- @include media-breakpoint-down(large) {
25
- .offcanvas-large {
26
- border-right-color: var(--cx-border-color);
27
- box-shadow: var(--cx-box-shadow-large);
25
+ @include media-breakpoint-down(large) {
26
+ .#{large-down\:}drawer {
27
+ border-right-color: var(--cx-border-color);
28
+ box-shadow: var(--cx-box-shadow-large);
29
+ }
28
30
  }
29
31
  }
30
- }
31
32
 
32
- .cxd-links {
33
- position: relative;
34
- }
35
-
36
- .cxd-links-group {
37
- // @include border-radius(var(--cx-border-radius));
38
- padding: 0;
39
- margin: 0;
40
- margin-bottom: 1.5rem;
41
- list-style: none;
42
-
43
- &.active {
44
- padding-right: .5rem;
45
- margin-right: -.5rem;
46
- // background-color: var(--cx-secondary-bg-main);
47
- // border-right: var(--cx-indicator-size) var(--cx-border-style) var(--cx-cue-main);
33
+ .cxd-links {
34
+ position: relative;
48
35
  }
49
36
 
50
- ul {
37
+ .cxd-links-group {
51
38
  padding: 0;
52
- margin: .25rem 0;
39
+ margin: 0;
40
+ margin-block-end: 1rem;
53
41
  list-style: none;
54
- }
55
42
 
56
- @include media-breakpoint-up(large) {
57
- li:has(.active) {
58
- // --#{$prefix}cue-main: var(--cx-secondary-fg-main);
59
- }
60
- li::before {
61
- position: absolute;
62
- width: 1px;
63
- height: 2em;
64
- // margin-top: -.25rem;
65
- margin-left: .4rem;
66
- // content: "\F1AB";
67
- font-family: var(--cx-font-family-icon);
68
- content: " ";
69
- background-color: var(--cx-cue-main);
43
+ &.active {
44
+ padding-inline-end: .5rem;
45
+ margin-inline-end: -.5rem;
70
46
  }
71
47
 
72
- li:first-child::before {
73
- height: 2em;
74
- margin-top: .8em;
48
+ ul {
49
+ padding: 0;
50
+ margin: .25rem 0;
51
+ list-style: none;
75
52
  }
76
53
 
77
- li:last-child::before {
78
- height: .8em;
79
- }
80
-
81
- li:only-child::before {
82
- height: .8em;
83
- margin-top: .4em;
84
- }
85
-
86
- li::after {
87
- //border-left: 8px var(--cx-border-style) var(--cx-secondary-base-color);
88
- position: absolute;
89
- left: 0;
90
- width: .5rem;
91
- height: 1px;
92
- margin-top: .8em;
93
- content: " ";
94
- background-color: var(--cx-cue-main);
95
- @include border-radius(50%);
54
+ @include media-breakpoint-up(large) {
55
+ li:has(.active) {
56
+ // --cx-cue-main: var(--cx-secondary-contrast-color);
57
+ }
58
+ li:not(.cxd-links-subgroup)::before {
59
+ position: absolute;
60
+ width: 1px;
61
+ height: 2em;
62
+ margin-inline-start: .4rem;
63
+ font-family: var(--cx-font-family-icon);
64
+ content: "";
65
+ background-color: var(--cx-cue-main);
66
+ }
67
+
68
+ li:not(.cxd-links-subgroup):first-child::before,
69
+ .cxd-links-subgroup + li::before {
70
+ height: 2em;
71
+ margin-block-start: .8em;
72
+ }
73
+
74
+ li:last-child::before,
75
+ li:has(+ .cxd-links-subgroup)::before {
76
+ height: .8em;
77
+ }
78
+
79
+ li:only-child::before {
80
+ height: .8em;
81
+ margin-block-start: .4em;
82
+ }
83
+
84
+ li:not(.cxd-links-subgroup)::after {
85
+ position: absolute;
86
+ left: 0;
87
+ width: .5rem;
88
+ height: 1px;
89
+ margin-block-start: .8em;
90
+ content: "";
91
+ background-color: var(--cx-cue-main);
92
+ @include border-radius(50%);
93
+ [dir="rtl"] & {
94
+ right: 0;
95
+ left: auto;
96
+ }
97
+ }
96
98
  }
97
99
  }
98
- }
99
-
100
- .cxd-links-heading {
101
- --cx-icon-color: var(--cx-fg-main);
102
- --cx-icon-size: var(--cx-icon-xsmall);
103
- display: flex;
104
- gap: var(--cx-space-xsmall);
105
- align-items: center;
106
- color: var(--cx-fg-main);
107
- }
108
100
 
101
+ .cxd-links-heading {
102
+ --cx-icon-color: var(--cx-fg-main);
103
+ --cx-icon-size: var(--cx-icon-xsmall);
104
+ display: flex;
105
+ gap: var(--cx-space-xsmall);
106
+ align-items: center;
107
+ color: var(--cx-fg-main);
108
+ }
109
109
 
110
- .cxd-links-nav {
111
- @include media-breakpoint-down(large) {
112
- @include font-size(.875rem);
110
+ .cxd-links-subgroup {
111
+ @include font-size(var(--cx-font-size-small));
112
+ @include line-height(var(--cx-line-height-small));
113
+ --cx-icon-size: var(--cx-icon-xsmall);
114
+ padding-inline-start: .5em;
115
+ margin-block: .5em .25em;
116
+ font-weight: var(--cx-font-weight-strong);
113
117
  }
114
118
 
115
- @include media-breakpoint-between(xsmall, large) {
116
- column-count: 2;
117
- column-gap: 1.5rem;
118
119
 
119
- .cxd-links-group {
120
- break-inside: avoid;
120
+ .cxd-links-nav {
121
+ @include media-breakpoint-down(large) {
122
+ @include font-size(.875rem);
121
123
  }
122
124
 
123
- .cxd-links-span-all {
124
- column-span: all;
125
- }
126
- }
127
- }
125
+ @include media-breakpoint-between(xsmall, large) {
126
+ column-count: 2;
127
+ column-gap: 1.5rem;
128
128
 
129
- .cxd-links-link {
130
- display: inline-block;
131
- width: 100%;
132
- padding: .15rem .5rem;
133
- padding-left: 1.5rem;
134
- margin-left: 0;
135
- //margin-left: 1.125rem;
136
- color: var(--cx-fg-color);
137
- text-decoration: if($link-decoration == none, null, none);
138
- @include font-size(var(--cx-font-size-small));
139
- @include border-radius(var(--cx-border-radius));
140
-
141
- &:hover,
142
- &:focus {
143
- color: var(--cx-fg-highlight);
144
- //text-decoration: if($link-hover-decoration == underline, none, null);
145
- background-color: var(--cx-bg-highlight);
146
- }
129
+ .cxd-links-group {
130
+ break-inside: avoid;
131
+ }
147
132
 
148
- &.active {
149
- font-weight: 600;
150
- color: var(--cx-fg-active);
151
- background-color: var(--cx-bg-active);
133
+ .cxd-links-span-all {
134
+ column-span: all;
135
+ }
136
+ }
152
137
  }
153
- // .active &:not(.active):hover {
154
- // color: var(--cx-fg-color);
155
- // background-color: var(--cx-dim-slight);
156
- // }
157
138
 
158
- &:visited:not(.active):not(:hover):not(:focus) {
139
+ .cxd-links-link {
140
+ display: inline-block;
141
+ width: 100%;
142
+ padding: .15rem .5rem;
143
+ padding-inline-start: 1.5rem;
144
+ margin-inline-start: 0;
159
145
  color: var(--cx-fg-color);
146
+ text-decoration: if(sass($link-decoration == none): null; else: none);
147
+ @include font-size(var(--cx-font-size-small));
148
+ @include border-radius(var(--cx-border-radius-medium));
149
+
150
+ &:hover,
151
+ &:focus {
152
+ color: var(--cx-fg-highlight);
153
+ background-color: var(--cx-bg-highlight);
154
+ }
155
+
156
+ &.active {
157
+ font-weight: 600;
158
+ color: var(--cx-fg-active);
159
+ background-color: var(--cx-bg-active);
160
+ }
161
+
162
+ &:visited:not(.active):not(:hover):not(:focus) {
163
+ color: var(--cx-fg-color);
164
+ }
160
165
  }
161
166
  }
@@ -1,7 +1,9 @@
1
- .skippy {
2
- background-color: $cxd-main;
1
+ @layer custom {
2
+ .skippy {
3
+ background-color: var(--cx-primary-base-color);
3
4
 
4
- a {
5
- color: $white;
5
+ a {
6
+ color: var(--cx-primary-contrast-color);
7
+ }
6
8
  }
7
9
  }
@@ -0,0 +1,181 @@
1
+ @use "./vars" as *;
2
+ @use "@chassis-ui/css/scss/mixins" as *;
3
+
4
+ //
5
+ // Docs examples
6
+ //
7
+
8
+ @layer custom {
9
+ .cxd-code-snippet {
10
+ //background-color: var(--cx-bg-evident);
11
+ position: relative;
12
+ margin: 0 ($cxd-gutter-x * -.5) 1rem;
13
+ border: solid var(--cx-border-subtle);
14
+ border-width: 1px 0;
15
+
16
+ @include media-breakpoint-up(medium) {
17
+ margin-inline: 0;
18
+ border-width: 1px;
19
+ @include border-radius(var(--cx-border-radius-medium));
20
+ }
21
+ }
22
+
23
+ .cxd-example {
24
+ --cxd-example-padding: 1rem;
25
+ position: relative;
26
+ display: flow-root;
27
+ padding: var(--cxd-example-padding);
28
+ margin: 0 ($cxd-gutter-x * -.5) 1rem;
29
+ background-color: var(--cx-bg-main);
30
+ border: solid var(--cx-border-subtle);
31
+ border-width: 1px 0;
32
+ // @include clearfix();
33
+
34
+ @include media-breakpoint-up(medium) {
35
+ --cxd-example-padding: 1.5rem;
36
+ margin-inline: 0;
37
+ border-width: 1px;
38
+ @include border-radius(var(--cx-border-radius-medium));
39
+ &:has(~ .cxd-snippet-toolbar) {
40
+ @include border-bottom-radius(0);
41
+ }
42
+ }
43
+
44
+ + p {
45
+ margin-block-start: 2rem;
46
+ }
47
+ }
48
+
49
+ .cxd-pattern-dots {
50
+ // background-color: var(--cx-bg-even);
51
+ background-image: radial-gradient(var(--cx-dim-slight) 2px, transparent 2px);
52
+ background-size: 12px 12px;
53
+ }
54
+
55
+ .cxd-pattern-diagonal {
56
+ // background-color: var(--cx-bg-even);
57
+ background-image: repeating-linear-gradient(-45deg, var(--cx-border-subtle) 0 1px, transparent 0 50%);
58
+ background-clip: padding-box;
59
+ background-size: 8px 8px;
60
+ }
61
+
62
+
63
+ //
64
+ // Code snippets
65
+ //
66
+
67
+ .cxd-code {
68
+ --cxd-code-padding: 1.25rem;
69
+ position: relative;
70
+ background-color: var(--cxd-pre-bg, var(--cx-bg-even));
71
+
72
+ @include media-breakpoint-up(medium) {
73
+ @include border-radius(calc(var(--cx-border-radius-medium) - 1px));
74
+ }
75
+
76
+ .cxd-clipboard ~ & {
77
+ padding-inline-end: 3rem;
78
+ }
79
+
80
+ pre {
81
+ padding: var(--cxd-code-padding);
82
+ margin-block-end: 0;
83
+ overflow: overlay;
84
+ @include font-size(var(--cx-font-size-code-small));
85
+ line-height: var(--cx-line-height-code-small);
86
+ white-space: pre;
87
+ background-color: transparent;
88
+ border: 0;
89
+ }
90
+
91
+ pre code {
92
+ color: var(--cx-fg-color); // Effectively the base text color
93
+ word-wrap: normal;
94
+ }
95
+ }
96
+
97
+ .cxd-example-snippet .cxd-code pre {
98
+ margin-inline-end: 0;
99
+ }
100
+
101
+ .cxd-snippet-toolbar {
102
+ display: flex;
103
+ gap: var(--cx-space-xsmall);
104
+ align-items: center;
105
+ padding-block: var(--cx-space-2xsmall);
106
+ padding-inline: var(--cx-space-small) var(--cx-space-xsmall);
107
+ background-color: var(--cxd-pre-bg, var(--cx-bg-even));
108
+ border-block-end: var(--cx-border-width) var(--cx-border-style) var(--cx-border-subtle);
109
+ .cxd-example ~ & {
110
+ border-block-start: var(--cx-border-width) var(--cx-border-style) var(--cx-border-subtle);
111
+ }
112
+
113
+ + .cxd-code {
114
+ @include border-top-radius(0);
115
+ }
116
+
117
+ > a {
118
+ @include font-size(var(--cx-font-size-small));
119
+ }
120
+ }
121
+
122
+ .cxd-file-ref {
123
+ .cxd-snippet-toolbar {
124
+ border-block-start: 0;
125
+ @include media-breakpoint-up(medium) {
126
+ @include border-top-radius(calc(var(--cx-border-radius-medium) - 1px));
127
+ }
128
+ }
129
+ }
130
+
131
+ .cxd-content .cxd-code-snippet {
132
+ margin-block-end: 1rem;
133
+ }
134
+
135
+ //
136
+ // Snippet buttons
137
+ //
138
+ .cxd-clipboard,
139
+ .cxd-edit,
140
+ .cxd-mode {
141
+ position: absolute;
142
+ inset-block-start: 1rem;
143
+ inset-inline-end: .75rem;
144
+ z-index: 3;
145
+ display: block;
146
+ }
147
+ .cxd-mode {
148
+ inset-block-start: .75rem;
149
+ &:not(.cxd-example:hover &) {
150
+ display: none;
151
+ }
152
+ }
153
+
154
+ .button-mode,
155
+ .button-clipboard,
156
+ .button-edit {
157
+ --cx-icon-color: var(--cx-fg-subtle);
158
+ --cx-icon-size: var(--cx-icon-small);
159
+ display: block;
160
+ padding: .25em;
161
+ line-height: 1;
162
+ background-color: transparent;
163
+ border: 0;
164
+ @include border-radius(.25rem);
165
+
166
+ &:hover {
167
+ color: var(--cx-hover-color);
168
+ }
169
+
170
+ &:focus {
171
+ z-index: 3;
172
+ }
173
+ }
174
+
175
+ .button-mode,
176
+ .button-clipboard {
177
+ position: relative;
178
+ z-index: 2;
179
+ }
180
+
181
+ }