@chassis-ui/docs 0.2.0 → 0.3.1

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 +25 -11
  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,212 +0,0 @@
1
- // stylelint-disable selector-class-pattern
2
-
3
- :root {
4
- /* Colors */
5
- --docsearch-primary-color: var(--cx-primary);
6
- --docsearch-soft-primary-color: var(--cx-primary-fg-subtle);
7
- --docsearch-subtle-color: var(--cx-border-subtle);
8
- --docsearch-text-color: var(--cx-fg-main);
9
- --docsearch-error-color: var(--cx-danger-fg-main);
10
- --docsearch-success-color: var(--cx-success-fg-main);
11
- --docsearch-secondary-text-color: var(--cx-fg-subtle);
12
- --docsearch-background-color: var(--cx-bg-main);
13
- --docsearch-icon-color: var(--cx-fg-subtle);
14
- --docsearch-container-background: var(--cx-black-dim-main);
15
- --docsearch-logo-color: var(--cx-primary);
16
- --docsearch-muted-color: var(--cx-fg-subtle);
17
- --docsearch-muted-color-darker: var(--cx-fg-slight);
18
-
19
- /* Spacing & Layout */
20
- --docsearch-spacing: var(--cx-space-medium);
21
- --docsearch-border-radius: var(--cx-border-radius-medium);
22
- --docsearch-icon-stroke-width: var(--cx-border-width-medium);
23
-
24
- /* Highlights & Focus */
25
- --docsearch-focus-color: var(--cx-primary);
26
- --docsearch-highlight-color: var(--cx-primary);
27
-
28
- /* Button */
29
- --docsearch-search-button-background: var(--cx-bg-main);
30
- --docsearch-search-button-text-color: var(--cx-fg-subtle);
31
-
32
- /* Modal */
33
- --docsearch-modal-width: 640px;
34
- // --docsearch-modal-height: 600px;
35
- // --docsearch-modal-variable-height: 60dvh;
36
- --docsearch-modal-background: var(--cx-bg-even);
37
- --docsearch-modal-shadow: var(--cx-box-shadow-large);
38
-
39
- /* Searchbox */
40
- // --docsearch-searchbox-height: 56px;
41
- // --docsearch-searchbox-initial-height: 56px;
42
- --docsearch-searchbox-background: var(--cx-bg-even);
43
- --docsearch-searchbox-focus-background: var(--cx-bg-main);
44
- // --docsearch-actions-width: 99px;
45
- // --docsearch-actions-height: 44px;
46
-
47
- /* Hit */
48
- // --docsearch-hit-height: 56px;
49
- --docsearch-hit-color: var(--cx-fg-main);
50
- --docsearch-hit-highlight-color: var(--cx-bg-highlight);
51
- --docsearch-hit-background: var(--cx-bg-main);
52
-
53
- /* Key */
54
- --docsearch-key-background: var(--cx-bg-main);
55
- --docsearch-key-color: var(--cx-fg-subtle);
56
- --docsearch-key-pressed-shadow: var(--cx-box-shadow-small);
57
-
58
- /* Footer */
59
- --docsearch-footer-height: 52px;
60
- --docsearch-footer-background: var(--cx-bg-evident);
61
- --docsearch-footer-shadow: var(--cx-box-shadow-small);
62
-
63
- /* Dropdown Menu */
64
- --docsearch-dropdown-menu-background: var(--docsearch-hit-background);
65
- --docsearch-dropdown-menu-item-hover-background: var(--docsearch-modal-background);
66
- }
67
-
68
- .cxd-search {
69
- position: relative;
70
-
71
- @include media-breakpoint-up(large) {
72
- position: absolute;
73
- top: 20%;
74
- right: 12rem;
75
- width: 200px;
76
- }
77
- @include media-breakpoint-up(2xlarge) {
78
- left: 50%;
79
- margin-left: 16rem;
80
- }
81
- }
82
-
83
- .DocSearch-Container {
84
- position: fixed;
85
- z-index: 2000; // Make sure to be over all components showcased in the documentation
86
- cursor: auto; // Needed because of [role="button"] in Algolia search modal. Remove once https://github.com/algolia/docsearch/issues/1370 is tackled.
87
-
88
- @include media-breakpoint-up(large) {
89
- padding-top: 4rem;
90
- }
91
- }
92
-
93
- .DocSearch-Button {
94
- width: 100%;
95
- height: 38px; // Match Chassis inputs
96
- margin: 0;
97
- border: var(--cx-border-width-medium) solid var(--cx-border-subtle);
98
- @include border-radius(var(--cx-border-radius-medium));
99
-
100
- .DocSearch-Search-Icon {
101
- opacity: .65;
102
- }
103
-
104
- &:active,
105
- &:focus,
106
- &:hover {
107
- .DocSearch-Search-Icon {
108
- opacity: 1;
109
- }
110
- }
111
-
112
- @include media-breakpoint-down(large) {
113
- &,
114
- &:hover,
115
- &:focus {
116
- background: transparent;
117
- border: 0;
118
- box-shadow: none;
119
- }
120
- &:focus {
121
- box-shadow: var(--docsearch-searchbox-shadow);
122
- }
123
- }
124
- }
125
-
126
- .DocSearch-Button-Keys,
127
- .DocSearch-Button-Placeholder {
128
- @include media-breakpoint-down(large) {
129
- display: none;
130
- }
131
- }
132
-
133
- .DocSearch-Button-Keys {
134
- min-width: 0;
135
- padding: .125rem .5rem;
136
- background: var(--cx-bg-evident);
137
- @include border-radius(var(--cx-border-radius-small));
138
- }
139
-
140
- .DocSearch-Button-Key {
141
- top: 0;
142
- width: auto;
143
- padding: 0;
144
- @include font-size(.875rem);
145
- background: none;
146
- border: 0;
147
- box-shadow: none;
148
- }
149
-
150
- .DocSearch-Commands-Key {
151
- width: 16px;
152
- height: 16px;
153
- padding: 0;
154
- color: var(--cx-icon-subtle);
155
- background: none;
156
- box-shadow: none;
157
- @include border-radius(var(--cx-border-radius-small));
158
- .DocSearch-Escape-Key {
159
- @include font-size(var(--cx-font-size-xsmall));
160
- }
161
- }
162
-
163
- .DocSearch-Action:hover,
164
- .DocSearch-AskAi-Return:hover {
165
- background: none;
166
- }
167
-
168
- .DocSearch-Hit {
169
- padding-bottom: 0;
170
- @include border-radius(0);
171
-
172
- a {
173
- @include border-radius(0);
174
- border: solid var(--cx-border-subtle);
175
- border-width: 0 var(--cx-border-width) var(--cx-border-width);
176
- }
177
-
178
- &:first-child a {
179
- @include border-top-radius(var(--cx-border-radius));
180
- border-top-width: var(--cx-border-width);
181
- }
182
- &:last-child a {
183
- @include border-bottom-radius(var(--cx-border-radius));
184
- }
185
- }
186
-
187
- .DocSearch-Hit-icon {
188
- display: flex;
189
- align-items: center;
190
- margin-right: var(--cx-space-xsmall);
191
- }
192
-
193
- .DocSearch-Hit-content-wrapper {
194
- gap: 0;
195
- }
196
-
197
- .DocSearch-Hit-action-button:focus,
198
- .DocSearch-Hit-action-button:hover {
199
- color: var(--cx-primary-fg-main);
200
- background: none;
201
- }
202
-
203
- .DocSearch-Hit-action-button:focus path,
204
- .DocSearch-Hit-action-button:hover path {
205
- fill: none;
206
- }
207
-
208
- // Fix --docsearch-logo-color that doesn't do anything
209
- .DocSearch-Logo svg .cls-1,
210
- .DocSearch-Logo svg .cls-2 {
211
- fill: var(--docsearch-logo-color);
212
- }
@@ -1,29 +0,0 @@
1
- $prefix: cx- !default;
2
-
3
- $color-mode-type: data !default; // `data` or `media-query`
4
-
5
- $enable-accordion-sizes: true !default;
6
- $enable-accordion-contexts: true !default;
7
- $enable-button-pointers: true !default;
8
- $enable-component-gradients: false !default;
9
- $enable-component-shadows: false !default;
10
- $enable-container-classes: true !default;
11
- $enable-cssgrid: true !default;
12
- $enable-dark-mode: true !default;
13
- $enable-deprecation-messages: true !default;
14
- $enable-elevation-shadows: true !default;
15
- $enable-exclude-strokes: true !default;
16
- $enable-grid-classes: true !default;
17
- $enable-important-utilities: true !default;
18
- $enable-negative-margins: true !default;
19
- $enable-padding-box: true !default;
20
- $enable-reduced-motion: true !default;
21
- $enable-rfs: false !default;
22
- $enable-rounded-borders: true !default;
23
- $enable-smooth-scroll: true !default;
24
- $enable-table-active-border: true !default;
25
- $enable-table-border-radius: true !default;
26
- $enable-table-font-tokens: true !default;
27
- $enable-transitions: true !default;
28
- $enable-validation-icons: true !default;
29
- $enable-visited-links: false !default;
@@ -1,160 +0,0 @@
1
- :root,
2
- [data-cx-theme="light"] {
3
- // GitHub Light Theme
4
- --base00: #fff;
5
- --base01: #f6f8fa;
6
- --base02: #e1e4e8;
7
- --base03: #6a737d; // Comments
8
- --base04: #586069;
9
- --base05: #24292e; // Default text
10
- --base06: #24292e;
11
- --base07: #22863a; // Tags/Classes
12
- --base08: #d73a49; // Keywords/Important
13
- --base09: #005cc5; // Numbers/Properties
14
- --base0A: #005cc5; // Variables
15
- --base0B: #6f42c1; // Functions
16
- --base0C: #032f62; // Strings
17
- --base0D: #6f42c1; // Attributes
18
- --base0E: #d73a49; // Keywords
19
- --base0F: #e36209; // References
20
- }
21
-
22
- @include color-mode(dark, true) {
23
- // GitHub Dark Theme
24
- --base00: #0d1117;
25
- --base01: #161b22;
26
- --base02: #21262d;
27
- --base03: #8b949e; // Comments
28
- --base04: #6e7681;
29
- --base05: #c9d1d9; // Default text
30
- --base06: #c9d1d9;
31
- --base07: #7ee787; // Tags/Classes
32
- --base08: #ff7b72; // Keywords/Important
33
- --base09: #79c0ff; // Numbers/Properties
34
- --base0A: #79c0ff; // Variables
35
- --base0B: #d2a8ff; // Functions
36
- --base0C: #a5d6ff; // Strings
37
- --base0D: #d2a8ff; // Attributes
38
- --base0E: #ff7b72; // Keywords
39
- --base0F: #ffa657; // References
40
- }
41
-
42
- // Shell prompts
43
- .language-bash .line::before,
44
- .language-sh .line::before {
45
- display: inline-block;
46
- color: var(--base03);
47
- content: "$ ";
48
- user-select: none;
49
- }
50
-
51
- .language-powershell .line::before {
52
- display: inline-block;
53
- color: var(--base0C);
54
- content: "PM> ";
55
- user-select: none;
56
- }
57
-
58
- // Token styles
59
- .token {
60
- &.comment,
61
- &.prolog,
62
- &.doctype,
63
- &.cdata {
64
- color: var(--base03);
65
- }
66
-
67
- &.punctuation {
68
- color: var(--base05);
69
- }
70
-
71
- &.property {
72
- color: var(--base0A);
73
- }
74
-
75
- &.tag {
76
- color: var(--base08);
77
- }
78
-
79
- &.boolean,
80
- &.number {
81
- color: var(--base09);
82
- }
83
-
84
- &.constant,
85
- &.symbol,
86
- &.deleted {
87
- color: var(--base08);
88
- }
89
-
90
- &.attr-name,
91
- &.string,
92
- &.char,
93
- &.builtin,
94
- &.inserted {
95
- color: var(--base0C);
96
- }
97
-
98
- &.operator,
99
- &.entity,
100
- &.url {
101
- color: var(--base05);
102
- }
103
-
104
- &.atrule,
105
- &.attr-value,
106
- &.keyword {
107
- color: var(--base0E);
108
- }
109
-
110
- &.function {
111
- color: var(--base0B);
112
- }
113
-
114
- &.selector,
115
- &.class-name {
116
- color: var(--base07);
117
- }
118
-
119
- &.regex,
120
- &.important {
121
- color: var(--base0A);
122
- }
123
-
124
- &.variable {
125
- color: var(--base08);
126
- }
127
-
128
- &.important,
129
- &.bold {
130
- font-weight: $font-weight-bold;
131
- }
132
-
133
- &.italic {
134
- font-style: italic;
135
- }
136
-
137
- &.entity {
138
- cursor: help;
139
- }
140
- }
141
-
142
- .language-diff {
143
- .token {
144
- &.deleted {
145
- color: $red-400;
146
- background-color: transparent;
147
- }
148
- &.inserted {
149
- color: $green-400;
150
- background-color: transparent;
151
- }
152
- }
153
- }
154
-
155
- .language-bash,
156
- .language-sh {
157
- .token.comment {
158
- color: var(--base03);
159
- }
160
- }
@@ -1,73 +0,0 @@
1
- // Local docs variables
2
- // $cxd-main: $primary-base-color;
3
- // $cxd-subtle: lighten(saturate($cxd-main, 5%), 15%); // stylelint-disable-line function-disallowed-list
4
- // $cxd-main-light: lighten(saturate($cxd-main, 5%), 45%); // stylelint-disable-line function-disallowed-list
5
- $cxd-main: var(--cx-primary-base-color);
6
- $cxd-subtle: var(--cx-primary-40);
7
- $cxd-main-light: var(--cx-primary-fg-main);
8
- $cxd-accent: var(--cx-primary-base-color);
9
-
10
- $cxd-gutter-x: 2rem;
11
- $cxd-callout-variants: info, warning, danger, default !default;
12
-
13
- :root,
14
- [data-cx-theme="light"] {
15
- --cxd-main: #{$cxd-main};
16
- --cxd-subtle: #{$cxd-subtle};
17
- --cxd-pink-rgb: #{to-rgb($pink-500)};
18
- --cxd-teal-rgb: #{to-rgb($teal-500)};
19
- --cxd-main-bg: var(--cxd-main);
20
- --cxd-subtle-bg: var(--cxd-subtle);
21
- --cxd-toc-color: var(--cxd-main);
22
- --cxd-sidebar-link-bg: var(--cx-bg-highlight);
23
- --cxd-callout-link: #{to-color($blue-600)};
24
- --cxd-callout-code-color: #{to-color($pink-600)};
25
- // --cxd-pre-bg: var(--cx-bg-even);
26
- }
27
-
28
- @if $enable-dark-mode {
29
- @include color-mode(dark, true) {
30
- color-scheme: dark;
31
- --cxd-subtle: var(--cx-primary-60);
32
- --cxd-subtle-bg: #{$cxd-subtle};
33
- // --cxd-toc-color: var(--#{$prefix}fg-subtle);
34
- --cxd-sidebar-link-bg: var(--cx-primary-40);
35
- --cxd-callout-link: #{to-color($blue-300)};
36
- --cxd-callout-code-color: #{to-color($pink-300)};
37
- //--cxd-pre-bg: #{adjust-color($gray-900, $lightness: -2.5%)}; // stylelint-disable-line scss/at-function-named-arguments
38
- --cxd-pre-bg: var(--cx-bg-evident);
39
- }
40
- }
41
-
42
- // @import "../../../tokens/default.scss";
43
- // h1:not(.cxd-example h1),
44
- // h2:not(.cxd-example h2),
45
- // h3:not(.cxd-example h3),
46
- // h4:not(.cxd-example h4),
47
- // h5:not(.cxd-example h5),
48
- // h6:not(.cxd-example h6) {
49
- // & ~ p,
50
- // & ~ ol,
51
- // & ~ ul {
52
- // font-family: var(--cx-font-family-display) !important;
53
- // }
54
- // }
55
-
56
- // .cxd-intro h1 {
57
- // line-height: 1.25em;
58
- // }
59
- // .cxd-intro h1,
60
- // .cxd-content > h1,
61
- // .cxd-content > h2,
62
- // .cxd-content > h3,
63
- // .cxd-content > h4 {
64
- // font-family: var(--cx-font-family-display) !important;
65
- // font-weight: var(--cx-font-weight-display-strong) !important;
66
- // }
67
- //
68
- // .cxd-playground textarea {
69
- // font-family: var(--cx-font-family-code) !important;
70
- // //font-size: var(--cx-font-small) !important;
71
- // background-color: var(--cx-default-bg-even) !important;
72
- // border-color: var(--cx-default-border-subtle);
73
- // }