docyard 0.8.0 → 0.9.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 (69) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +24 -1
  3. data/lib/docyard/components/aliases.rb +12 -0
  4. data/lib/docyard/components/processors/abbreviation_processor.rb +72 -0
  5. data/lib/docyard/components/processors/accordion_processor.rb +81 -0
  6. data/lib/docyard/components/processors/badge_processor.rb +72 -0
  7. data/lib/docyard/components/processors/callout_processor.rb +8 -2
  8. data/lib/docyard/components/processors/cards_processor.rb +100 -0
  9. data/lib/docyard/components/processors/code_block_options_preprocessor.rb +23 -2
  10. data/lib/docyard/components/processors/code_block_processor.rb +6 -0
  11. data/lib/docyard/components/processors/code_group_processor.rb +198 -0
  12. data/lib/docyard/components/processors/code_snippet_import_preprocessor.rb +6 -1
  13. data/lib/docyard/components/processors/custom_anchor_processor.rb +42 -0
  14. data/lib/docyard/components/processors/file_tree_processor.rb +151 -0
  15. data/lib/docyard/components/processors/image_caption_processor.rb +96 -0
  16. data/lib/docyard/components/processors/include_processor.rb +86 -0
  17. data/lib/docyard/components/processors/steps_processor.rb +89 -0
  18. data/lib/docyard/components/processors/tabs_processor.rb +9 -1
  19. data/lib/docyard/components/processors/tooltip_processor.rb +57 -0
  20. data/lib/docyard/components/processors/video_embed_processor.rb +196 -0
  21. data/lib/docyard/components/support/code_group/html_builder.rb +122 -0
  22. data/lib/docyard/components/support/markdown_code_block_helper.rb +56 -0
  23. data/lib/docyard/config/branding_resolver.rb +30 -35
  24. data/lib/docyard/config/logo_detector.rb +39 -0
  25. data/lib/docyard/config.rb +6 -1
  26. data/lib/docyard/navigation/sidebar/file_resolver.rb +16 -4
  27. data/lib/docyard/navigation/sidebar/item.rb +6 -1
  28. data/lib/docyard/navigation/sidebar/metadata_extractor.rb +4 -2
  29. data/lib/docyard/navigation/sidebar/metadata_reader.rb +8 -4
  30. data/lib/docyard/navigation/sidebar/renderer.rb +6 -2
  31. data/lib/docyard/navigation/sidebar/tree_builder.rb +2 -1
  32. data/lib/docyard/rendering/icons/phosphor.rb +3 -0
  33. data/lib/docyard/rendering/markdown.rb +24 -1
  34. data/lib/docyard/rendering/renderer.rb +2 -1
  35. data/lib/docyard/server/asset_handler.rb +1 -0
  36. data/lib/docyard/templates/assets/css/components/abbreviation.css +86 -0
  37. data/lib/docyard/templates/assets/css/components/accordion.css +138 -0
  38. data/lib/docyard/templates/assets/css/components/badges.css +47 -0
  39. data/lib/docyard/templates/assets/css/components/banner.css +202 -0
  40. data/lib/docyard/templates/assets/css/components/cards.css +100 -0
  41. data/lib/docyard/templates/assets/css/components/code-block.css +10 -0
  42. data/lib/docyard/templates/assets/css/components/code-group.css +281 -0
  43. data/lib/docyard/templates/assets/css/components/figure.css +22 -0
  44. data/lib/docyard/templates/assets/css/components/file-tree.css +124 -0
  45. data/lib/docyard/templates/assets/css/components/heading-anchor.css +21 -13
  46. data/lib/docyard/templates/assets/css/components/lightbox.css +65 -0
  47. data/lib/docyard/templates/assets/css/components/navigation.css +7 -0
  48. data/lib/docyard/templates/assets/css/components/prev-next.css +9 -18
  49. data/lib/docyard/templates/assets/css/components/steps.css +122 -0
  50. data/lib/docyard/templates/assets/css/components/tabs.css +1 -1
  51. data/lib/docyard/templates/assets/css/components/tooltip.css +113 -0
  52. data/lib/docyard/templates/assets/css/components/video.css +41 -0
  53. data/lib/docyard/templates/assets/css/markdown.css +5 -3
  54. data/lib/docyard/templates/assets/js/components/abbreviation.js +85 -0
  55. data/lib/docyard/templates/assets/js/components/banner.js +81 -0
  56. data/lib/docyard/templates/assets/js/components/code-group.js +283 -0
  57. data/lib/docyard/templates/assets/js/components/file-tree.js +39 -0
  58. data/lib/docyard/templates/assets/js/components/lightbox.js +72 -0
  59. data/lib/docyard/templates/assets/js/components/tooltip.js +118 -0
  60. data/lib/docyard/templates/layouts/default.html.erb +1 -0
  61. data/lib/docyard/templates/layouts/splash.html.erb +1 -0
  62. data/lib/docyard/templates/partials/_accordion.html.erb +9 -0
  63. data/lib/docyard/templates/partials/_banner.html.erb +27 -0
  64. data/lib/docyard/templates/partials/_card.html.erb +23 -0
  65. data/lib/docyard/templates/partials/_nav_group.html.erb +6 -0
  66. data/lib/docyard/templates/partials/_nav_leaf.html.erb +3 -0
  67. data/lib/docyard/templates/partials/_step.html.erb +14 -0
  68. data/lib/docyard/version.rb +1 -1
  69. metadata +38 -1
@@ -23,12 +23,14 @@ module Docyard
23
23
  end
24
24
 
25
25
  def extract_frontmatter_metadata(file_path)
26
- return { text: nil, icon: nil } unless File.exist?(file_path)
26
+ return { text: nil, icon: nil, badge: nil, badge_type: nil } unless File.exist?(file_path)
27
27
 
28
28
  markdown = Markdown.new(File.read(file_path))
29
29
  {
30
30
  text: markdown.sidebar_text || markdown.title,
31
- icon: markdown.sidebar_icon
31
+ icon: markdown.sidebar_icon,
32
+ badge: markdown.sidebar_badge,
33
+ badge_type: markdown.sidebar_badge_type
32
34
  }
33
35
  end
34
36
 
@@ -12,7 +12,9 @@ module Docyard
12
12
  title: markdown.sidebar_text || markdown.title,
13
13
  icon: markdown.sidebar_icon,
14
14
  collapsed: markdown.sidebar_collapsed,
15
- order: markdown.sidebar_order
15
+ order: markdown.sidebar_order,
16
+ badge: markdown.sidebar_badge,
17
+ badge_type: markdown.sidebar_badge_type
16
18
  }
17
19
  rescue StandardError
18
20
  empty_file_metadata
@@ -27,7 +29,9 @@ module Docyard
27
29
  sidebar_text: markdown.sidebar_text,
28
30
  icon: markdown.sidebar_icon,
29
31
  collapsed: markdown.sidebar_collapsed,
30
- order: markdown.sidebar_order
32
+ order: markdown.sidebar_order,
33
+ badge: markdown.sidebar_badge,
34
+ badge_type: markdown.sidebar_badge_type
31
35
  }
32
36
  rescue StandardError
33
37
  empty_index_metadata
@@ -36,11 +40,11 @@ module Docyard
36
40
  private
37
41
 
38
42
  def empty_file_metadata
39
- { title: nil, icon: nil, collapsed: nil, order: nil }
43
+ { title: nil, icon: nil, collapsed: nil, order: nil, badge: nil, badge_type: nil }
40
44
  end
41
45
 
42
46
  def empty_index_metadata
43
- { sidebar_text: nil, icon: nil, collapsed: nil, order: nil }
47
+ { sidebar_text: nil, icon: nil, collapsed: nil, order: nil, badge: nil, badge_type: nil }
44
48
  end
45
49
  end
46
50
  end
@@ -112,7 +112,9 @@ module Docyard
112
112
  title: item[:title],
113
113
  active: item[:active],
114
114
  icon: item[:icon],
115
- target: item[:target]
115
+ target: item[:target],
116
+ badge: item[:badge],
117
+ badge_type: item[:badge_type]
116
118
  )
117
119
  end
118
120
 
@@ -136,7 +138,9 @@ module Docyard
136
138
  children_html: children_html,
137
139
  icon: item[:icon],
138
140
  collapsed: item[:collapsed],
139
- has_index: item[:has_index]
141
+ has_index: item[:has_index],
142
+ badge: item[:badge],
143
+ badge_type: item[:badge_type]
140
144
  )
141
145
  end
142
146
  end
@@ -132,7 +132,8 @@ module Docyard
132
132
 
133
133
  { title: metadata[:title] || title_extractor.extract(full_file_path),
134
134
  path: url_path, icon: metadata[:icon], active: current_path == url_path,
135
- type: :file, order: metadata[:order], children: [] }
135
+ type: :file, order: metadata[:order], badge: metadata[:badge],
136
+ badge_type: metadata[:badge_type], children: [] }
136
137
  end
137
138
  end
138
139
  end
@@ -8,6 +8,9 @@ module Docyard
8
8
  # Licensed under MIT License (see LICENSE.phosphor)
9
9
  PHOSPHOR = {
10
10
  "regular" => {
11
+ "folder" => '<path d="M216,72H131.31L104,44.69A15.86,15.86,0,0,0,92.69,40H40A16,16,0,0,0,24,56V200.62A15.4,15.4,0,0,0,39.38,216H216.89A15.13,15.13,0,0,0,232,200.89V88A16,16,0,0,0,216,72ZM40,56H92.69l16,16H40ZM216,200H40V88H216Z"/>',
12
+ "folder-open" => '<path d="M245,110.64A16,16,0,0,0,232,104H216V88a16,16,0,0,0-16-16H130.67L102.94,51.2a16.14,16.14,0,0,0-9.6-3.2H40A16,16,0,0,0,24,64V208h0a8,8,0,0,0,8,8H211.1a8,8,0,0,0,7.59-5.47l28.49-85.47A16.05,16.05,0,0,0,245,110.64ZM93.34,64,123.2,86.4A8,8,0,0,0,128,88h72v16H69.77a16,16,0,0,0-15.18,10.94L40,158.7V64Zm112,136H43.1l26.67-80H232Z"/>',
13
+ "file-text" => '<path d="M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM200,216H56V40h88V88a8,8,0,0,0,8,8h48V216Zm-32-80a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,136Zm0,32a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,168Z"/>',
11
14
  "heart" => '<path d="M178,40c-20.65,0-38.73,8.88-50,23.89C116.73,48.88,98.65,40,78,40a62.07,62.07,0,0,0-62,62c0,70,103.79,126.66,108.21,129a8,8,0,0,0,7.58,0C136.21,228.66,240,172,240,102A62.07,62.07,0,0,0,178,40ZM128,214.8C109.74,204.16,32,155.69,32,102A46.06,46.06,0,0,1,78,56c19.45,0,35.78,10.36,42.6,27a8,8,0,0,0,14.8,0c6.82-16.67,23.15-27,42.6-27a46.06,46.06,0,0,1,46,46C224,155.61,146.24,204.15,128,214.8Z"/>',
12
15
  "arrow-right" => '<path d="M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z"/>',
13
16
  "arrow-left" => '<path d="M224,128a8,8,0,0,1-8,8H59.31l58.35,58.34a8,8,0,0,1-11.32,11.32l-72-72a8,8,0,0,1,0-11.32l72-72a8,8,0,0,1,11.32,11.32L59.31,120H216A8,8,0,0,1,224,128Z"/>',
@@ -6,15 +6,27 @@ require "yaml"
6
6
  require_relative "../components/registry"
7
7
  require_relative "../components/base_processor"
8
8
  require_relative "../components/processors/callout_processor"
9
+ require_relative "../components/processors/accordion_processor"
10
+ require_relative "../components/processors/badge_processor"
11
+ require_relative "../components/processors/steps_processor"
12
+ require_relative "../components/processors/cards_processor"
9
13
  require_relative "../components/processors/tabs_processor"
14
+ require_relative "../components/processors/code_group_processor"
10
15
  require_relative "../components/processors/icon_processor"
11
16
  require_relative "../components/processors/code_block_processor"
12
17
  require_relative "../components/processors/code_snippet_import_preprocessor"
18
+ require_relative "../components/processors/include_processor"
13
19
  require_relative "../components/processors/code_block_options_preprocessor"
14
20
  require_relative "../components/processors/code_block_diff_preprocessor"
15
21
  require_relative "../components/processors/code_block_focus_preprocessor"
16
22
  require_relative "../components/processors/table_wrapper_processor"
17
23
  require_relative "../components/processors/heading_anchor_processor"
24
+ require_relative "../components/processors/custom_anchor_processor"
25
+ require_relative "../components/processors/image_caption_processor"
26
+ require_relative "../components/processors/video_embed_processor"
27
+ require_relative "../components/processors/file_tree_processor"
28
+ require_relative "../components/processors/abbreviation_processor"
29
+ require_relative "../components/processors/tooltip_processor"
18
30
  require_relative "../components/processors/table_of_contents_processor"
19
31
  require_relative "../components/aliases"
20
32
 
@@ -24,9 +36,10 @@ module Docyard
24
36
 
25
37
  attr_reader :raw, :config
26
38
 
27
- def initialize(raw, config: nil)
39
+ def initialize(raw, config: nil, file_path: nil)
28
40
  @raw = raw.freeze
29
41
  @config = config
42
+ @file_path = file_path
30
43
  @context = {}
31
44
  end
32
45
 
@@ -66,6 +79,14 @@ module Docyard
66
79
  frontmatter.dig("sidebar", "order")
67
80
  end
68
81
 
82
+ def sidebar_badge
83
+ frontmatter.dig("sidebar", "badge")
84
+ end
85
+
86
+ def sidebar_badge_type
87
+ frontmatter.dig("sidebar", "badge_type")
88
+ end
89
+
69
90
  def toc
70
91
  @context[:toc] || []
71
92
  end
@@ -87,6 +108,8 @@ module Docyard
87
108
 
88
109
  def render_html
89
110
  @context[:config] = config&.data
111
+ @context[:current_file] = @file_path
112
+ @context[:docs_root] = "docs"
90
113
 
91
114
  preprocessed_content = Components::Registry.run_preprocessors(content, @context)
92
115
 
@@ -23,7 +23,7 @@ module Docyard
23
23
 
24
24
  def render_file(file_path, sidebar_html: "", prev_next_html: "", breadcrumbs: nil, branding: {},
25
25
  template_options: {}, current_path: "/")
26
- markdown = Markdown.new(File.read(file_path), config: config)
26
+ markdown = Markdown.new(File.read(file_path), config: config, file_path: file_path)
27
27
 
28
28
  render(
29
29
  content: strip_md_from_links(markdown.html),
@@ -120,6 +120,7 @@ module Docyard
120
120
  @copyright = branding[:copyright]
121
121
  @social = branding[:social] || []
122
122
  @header_ctas = branding[:header_ctas] || []
123
+ @announcement = branding[:announcement]
123
124
  end
124
125
 
125
126
  def assign_tabs(branding, current_path)
@@ -12,6 +12,7 @@ module Docyard
12
12
  ".jpeg" => "image/jpeg",
13
13
  ".gif" => "image/gif",
14
14
  ".webp" => "image/webp",
15
+ ".avif" => "image/avif",
15
16
  ".svg" => "image/svg+xml",
16
17
  ".woff" => "font/woff",
17
18
  ".woff2" => "font/woff2",
@@ -0,0 +1,86 @@
1
+ .docyard-abbr {
2
+ text-decoration: underline;
3
+ text-decoration-style: dotted;
4
+ text-decoration-color: var(--muted-foreground);
5
+ text-underline-offset: 3px;
6
+ cursor: help;
7
+ position: relative;
8
+ }
9
+
10
+ .docyard-abbr:hover {
11
+ text-decoration-color: var(--primary);
12
+ }
13
+
14
+ .docyard-abbr-popover {
15
+ position: absolute;
16
+ z-index: 1000;
17
+ width: max-content;
18
+ max-width: 280px;
19
+ padding: var(--spacing-3) var(--spacing-4);
20
+ background: var(--background);
21
+ border: 1px solid var(--border);
22
+ border-radius: var(--radius-lg);
23
+ box-shadow:
24
+ 0 4px 6px -1px oklch(from var(--foreground) l c h / 8%),
25
+ 0 2px 4px -2px oklch(from var(--foreground) l c h / 6%);
26
+ pointer-events: none;
27
+ opacity: 0;
28
+ transform: translateY(-4px) scale(0.96);
29
+ transition:
30
+ opacity 0.15s ease,
31
+ transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
32
+ }
33
+
34
+ .docyard-abbr-popover.is-visible {
35
+ opacity: 1;
36
+ transform: translateY(0) scale(1);
37
+ }
38
+
39
+ .docyard-abbr-popover::after {
40
+ content: "";
41
+ position: absolute;
42
+ bottom: -6px;
43
+ left: var(--arrow-left, 16px);
44
+ width: 10px;
45
+ height: 10px;
46
+ background: var(--background);
47
+ border-bottom: 1px solid var(--border);
48
+ border-right: 1px solid var(--border);
49
+ transform: rotate(45deg);
50
+ }
51
+
52
+ .docyard-abbr-popover.is-below::after {
53
+ top: -6px;
54
+ bottom: auto;
55
+ border-bottom: none;
56
+ border-right: none;
57
+ border-top: 1px solid var(--border);
58
+ border-left: 1px solid var(--border);
59
+ }
60
+
61
+ .docyard-abbr-popover__term {
62
+ display: block;
63
+ font-weight: var(--font-semibold);
64
+ font-size: var(--text-sm);
65
+ color: var(--foreground);
66
+ margin-bottom: var(--spacing-1);
67
+ }
68
+
69
+ .docyard-abbr-popover__definition {
70
+ display: block;
71
+ font-size: var(--text-sm);
72
+ color: var(--muted-foreground);
73
+ line-height: var(--leading-relaxed);
74
+ }
75
+
76
+ @media (max-width: 640px) {
77
+ .docyard-abbr-popover {
78
+ max-width: 240px;
79
+ padding: var(--spacing-2) var(--spacing-3);
80
+ }
81
+
82
+ .docyard-abbr-popover__term,
83
+ .docyard-abbr-popover__definition {
84
+ font-size: var(--text-xs);
85
+ }
86
+ }
@@ -0,0 +1,138 @@
1
+ .docyard-accordion {
2
+ margin: var(--spacing-4) 0;
3
+ border: 1px solid var(--border);
4
+ border-radius: var(--radius-xl);
5
+ background-color: var(--card);
6
+ }
7
+
8
+ .docyard-accordion__summary {
9
+ display: flex;
10
+ align-items: center;
11
+ gap: var(--spacing-3);
12
+ padding: var(--spacing-3) var(--spacing-4);
13
+ cursor: pointer;
14
+ user-select: none;
15
+ font-weight: var(--font-medium);
16
+ font-size: var(--text-sm);
17
+ color: var(--foreground);
18
+ list-style: none;
19
+ transition: background-color var(--transition-fast);
20
+ border-radius: var(--radius-xl);
21
+ }
22
+
23
+ .docyard-accordion__summary::-webkit-details-marker {
24
+ display: none;
25
+ }
26
+
27
+ .docyard-accordion__summary::marker {
28
+ display: none;
29
+ content: "";
30
+ }
31
+
32
+ .docyard-accordion__summary:hover {
33
+ background-color: var(--accent);
34
+ }
35
+
36
+ .docyard-accordion__summary:focus-visible {
37
+ outline: 2px solid var(--ring);
38
+ outline-offset: -2px;
39
+ }
40
+
41
+ .docyard-accordion[open] .docyard-accordion__summary {
42
+ border-bottom-left-radius: 0;
43
+ border-bottom-right-radius: 0;
44
+ }
45
+
46
+ .docyard-accordion__icon {
47
+ flex-shrink: 0;
48
+ width: 1rem;
49
+ height: 1rem;
50
+ display: flex;
51
+ align-items: center;
52
+ justify-content: center;
53
+ color: var(--muted-foreground);
54
+ transition: transform var(--transition-fast);
55
+ }
56
+
57
+ .docyard-accordion__icon svg {
58
+ width: 100%;
59
+ height: 100%;
60
+ }
61
+
62
+ .docyard-accordion[open] .docyard-accordion__icon {
63
+ transform: rotate(90deg);
64
+ }
65
+
66
+ .docyard-accordion__title {
67
+ flex: 1;
68
+ }
69
+
70
+ .docyard-accordion__content {
71
+ padding: var(--spacing-4);
72
+ font-size: var(--text-sm);
73
+ color: var(--foreground);
74
+ line-height: var(--leading-relaxed);
75
+ border-top: 1px solid var(--border);
76
+ }
77
+
78
+ .docyard-accordion__content > *:first-child {
79
+ margin-top: 0;
80
+ }
81
+
82
+ .docyard-accordion__content > *:last-child {
83
+ margin-bottom: 0;
84
+ }
85
+
86
+ .docyard-accordion__content a {
87
+ color: var(--primary);
88
+ text-decoration: underline;
89
+ text-underline-offset: 3px;
90
+ }
91
+
92
+ .docyard-accordion__content a:hover {
93
+ color: var(--foreground);
94
+ }
95
+
96
+ .docyard-accordion__content pre {
97
+ margin: var(--spacing-4) 0;
98
+ border-radius: var(--radius-lg);
99
+ }
100
+
101
+ .docyard-accordion__content :not(pre) > code {
102
+ background-color: var(--muted);
103
+ padding: 0.125rem 0.375rem;
104
+ border-radius: var(--radius-sm);
105
+ font-size: 0.875em;
106
+ }
107
+
108
+ .docyard-accordion + .docyard-accordion {
109
+ margin-top: -1px;
110
+ border-top-left-radius: 0;
111
+ border-top-right-radius: 0;
112
+ }
113
+
114
+ .docyard-accordion + .docyard-accordion .docyard-accordion__summary {
115
+ border-top-left-radius: 0;
116
+ border-top-right-radius: 0;
117
+ }
118
+
119
+ .docyard-accordion:has(+ .docyard-accordion) {
120
+ border-bottom-left-radius: 0;
121
+ border-bottom-right-radius: 0;
122
+ margin-bottom: 0;
123
+ }
124
+
125
+ .docyard-accordion:has(+ .docyard-accordion) .docyard-accordion__summary {
126
+ border-bottom-left-radius: 0;
127
+ border-bottom-right-radius: 0;
128
+ }
129
+
130
+ @media (prefers-reduced-motion: reduce) {
131
+ .docyard-accordion__icon {
132
+ transition: none;
133
+ }
134
+
135
+ .docyard-accordion__summary {
136
+ transition: none;
137
+ }
138
+ }
@@ -0,0 +1,47 @@
1
+ .docyard-badge {
2
+ display: inline-flex;
3
+ align-items: center;
4
+ padding: 0.125rem 0.5rem;
5
+ font-size: var(--text-xs);
6
+ font-weight: var(--font-medium);
7
+ line-height: var(--leading-normal);
8
+ border-radius: var(--radius-4xl);
9
+ white-space: nowrap;
10
+ vertical-align: middle;
11
+ }
12
+
13
+ .docyard-badge--default {
14
+ background-color: var(--muted);
15
+ color: var(--muted-foreground);
16
+ }
17
+
18
+ .docyard-badge--success {
19
+ background-color: var(--callout-tip-background);
20
+ color: var(--callout-tip-foreground);
21
+ border: 1px solid var(--callout-tip-border);
22
+ }
23
+
24
+ .docyard-badge--warning {
25
+ background-color: var(--callout-warning-background);
26
+ color: var(--callout-warning-foreground);
27
+ border: 1px solid var(--callout-warning-border);
28
+ }
29
+
30
+ .docyard-badge--danger {
31
+ background-color: var(--callout-danger-background);
32
+ color: var(--callout-danger-foreground);
33
+ border: 1px solid var(--callout-danger-border);
34
+ }
35
+
36
+ h1 .docyard-badge,
37
+ h2 .docyard-badge,
38
+ h3 .docyard-badge,
39
+ h4 .docyard-badge,
40
+ h5 .docyard-badge,
41
+ h6 .docyard-badge {
42
+ margin-left: var(--spacing-2);
43
+ font-size: var(--text-xs);
44
+ vertical-align: middle;
45
+ position: relative;
46
+ top: -0.1em;
47
+ }
@@ -0,0 +1,202 @@
1
+ .docyard-announcement {
2
+ position: fixed;
3
+ top: 0;
4
+ left: 0;
5
+ right: 0;
6
+ display: flex;
7
+ align-items: center;
8
+ justify-content: center;
9
+ padding: 0.4rem 3rem;
10
+ background: linear-gradient(135deg, oklch(0.68 0.13 215) 0%, var(--primary) 15%, var(--primary) 85%, oklch(0.52 0.10 225) 100%);
11
+ color: white;
12
+ font-size: var(--text-sm);
13
+ z-index: 9999;
14
+ }
15
+
16
+ .docyard-announcement.is-dismissed {
17
+ animation: docyard-announcement-exit 0.35s cubic-bezier(0.4, 0, 1, 1) forwards;
18
+ }
19
+
20
+ @keyframes docyard-announcement-exit {
21
+ from {
22
+ transform: translateY(0);
23
+ opacity: 1;
24
+ }
25
+ to {
26
+ transform: translateY(-100%);
27
+ opacity: 0;
28
+ }
29
+ }
30
+
31
+ body.has-announcement {
32
+ --announcement-height: 2rem;
33
+ }
34
+
35
+ body.has-announcement .header {
36
+ top: var(--announcement-height);
37
+ }
38
+
39
+ body.has-announcement .tab-bar {
40
+ top: calc(var(--header-height) + var(--announcement-height));
41
+ }
42
+
43
+ body.has-announcement .sidebar {
44
+ top: calc(var(--header-height) + var(--tab-bar-height) + var(--announcement-height));
45
+ height: calc(100vh - var(--header-height) - var(--tab-bar-height) - var(--announcement-height));
46
+ }
47
+
48
+ body.has-announcement .doc-aside {
49
+ top: calc(var(--header-height) + var(--tab-bar-height) + var(--announcement-height));
50
+ }
51
+
52
+ body.has-announcement .secondary-header {
53
+ top: calc(var(--header-height) + var(--tab-bar-height) + var(--announcement-height));
54
+ }
55
+
56
+ body.has-announcement .layout {
57
+ padding-top: calc(var(--header-height) + var(--tab-bar-height) + var(--announcement-height));
58
+ }
59
+
60
+ body.has-announcement:not(.has-tabs) .sidebar {
61
+ top: calc(var(--header-height) + var(--announcement-height));
62
+ height: calc(100vh - var(--header-height) - var(--announcement-height));
63
+ }
64
+
65
+ body.has-announcement:not(.has-tabs) .doc-aside {
66
+ top: calc(var(--header-height) + var(--announcement-height));
67
+ }
68
+
69
+ body.has-announcement:not(.has-tabs) .layout {
70
+ padding-top: calc(var(--header-height) + var(--announcement-height));
71
+ }
72
+
73
+ .docyard-announcement__content {
74
+ display: flex;
75
+ align-items: center;
76
+ justify-content: center;
77
+ gap: 0.75rem;
78
+ min-width: 0;
79
+ overflow: hidden;
80
+ }
81
+
82
+ .docyard-announcement__text {
83
+ font-weight: 500;
84
+ letter-spacing: -0.01em;
85
+ white-space: nowrap;
86
+ overflow: hidden;
87
+ text-overflow: ellipsis;
88
+ }
89
+
90
+ .docyard-announcement__link {
91
+ display: inline-flex;
92
+ align-items: center;
93
+ gap: 0.375rem;
94
+ color: white;
95
+ text-decoration: none;
96
+ min-width: 0;
97
+ transition: gap 0.2s cubic-bezier(0.16, 1, 0.3, 1);
98
+ }
99
+
100
+ .docyard-announcement__link:hover {
101
+ gap: 0.5rem;
102
+ color: white;
103
+ }
104
+
105
+ .docyard-announcement__link .icon {
106
+ width: 1rem;
107
+ height: 1rem;
108
+ flex-shrink: 0;
109
+ transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
110
+ }
111
+
112
+ .docyard-announcement__link:hover .icon {
113
+ transform: translateX(2px);
114
+ }
115
+
116
+ .docyard-announcement[data-has-button="true"] .docyard-announcement__link .icon {
117
+ display: none;
118
+ }
119
+
120
+ .docyard-announcement__button {
121
+ display: inline-flex;
122
+ align-items: center;
123
+ flex-shrink: 0;
124
+ padding: 0.175rem 0.625rem;
125
+ background: rgba(255, 255, 255, 0.15);
126
+ border: 1px solid rgba(255, 255, 255, 0.25);
127
+ border-radius: 9999px;
128
+ color: white;
129
+ font-size: var(--text-xs);
130
+ font-weight: 600;
131
+ text-decoration: none;
132
+ backdrop-filter: blur(4px);
133
+ transition:
134
+ transform 0.5s cubic-bezier(0.16, 1, 0.3, 1),
135
+ background 0.2s cubic-bezier(0.16, 1, 0.3, 1),
136
+ border-color 0.2s cubic-bezier(0.16, 1, 0.3, 1);
137
+ }
138
+
139
+ .docyard-announcement__button:hover {
140
+ background: rgba(255, 255, 255, 0.25);
141
+ border-color: rgba(255, 255, 255, 0.4);
142
+ color: white;
143
+ }
144
+
145
+ .docyard-announcement__button:active {
146
+ transform: scale(0.95);
147
+ transition: transform 0.1s cubic-bezier(0.4, 0, 1, 1);
148
+ }
149
+
150
+ .docyard-announcement__dismiss {
151
+ position: absolute;
152
+ right: 0.75rem;
153
+ display: flex;
154
+ align-items: center;
155
+ justify-content: center;
156
+ width: 1.5rem;
157
+ height: 1.5rem;
158
+ padding: 0;
159
+ background: transparent;
160
+ border: none;
161
+ border-radius: var(--radius-4xl);
162
+ color: white;
163
+ cursor: pointer;
164
+ transition: background-color var(--transition-fast), color var(--transition-fast);
165
+ }
166
+
167
+ .docyard-announcement__dismiss:hover {
168
+ color: white;
169
+ background-color: rgba(255, 255, 255, 0.15);
170
+ }
171
+
172
+ .docyard-announcement__dismiss .icon {
173
+ width: 0.875rem;
174
+ height: 0.875rem;
175
+ }
176
+
177
+ @media (max-width: 768px) {
178
+ .docyard-announcement {
179
+ padding: 0.4rem 2.5rem;
180
+ font-size: var(--text-xs);
181
+ }
182
+
183
+ .docyard-announcement__content {
184
+ gap: 0.5rem;
185
+ }
186
+
187
+ .docyard-announcement[data-has-button="true"] .docyard-announcement__link .icon {
188
+ display: inline-flex;
189
+ }
190
+
191
+ .docyard-announcement__button {
192
+ display: none;
193
+ }
194
+
195
+ .docyard-announcement__dismiss {
196
+ right: 0.5rem;
197
+ }
198
+ }
199
+
200
+ .dark .docyard-announcement {
201
+ background: linear-gradient(135deg, oklch(0.78 0.14 210) 0%, var(--primary) 15%, var(--primary) 85%, oklch(0.58 0.11 225) 100%);
202
+ }