openproject-primer_view_components 0.6.3 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +50 -0
- data/README.md +13 -1
- data/app/assets/javascripts/primer_view_components.js +1 -1
- data/app/assets/javascripts/primer_view_components.js.map +1 -1
- data/app/assets/styles/primer_view_components.css +1 -1
- data/app/assets/styles/primer_view_components.css.map +1 -1
- data/app/components/primer/alpha/action_bar.rb +0 -7
- data/app/components/primer/alpha/action_list.css +1 -1
- data/app/components/primer/alpha/action_list.css.json +1 -0
- data/app/components/primer/alpha/action_list.css.map +1 -1
- data/app/components/primer/alpha/action_list.pcss +6 -0
- data/app/components/primer/alpha/action_menu/action_menu_element.js +37 -6
- data/app/components/primer/alpha/action_menu/action_menu_element.ts +39 -5
- data/app/components/primer/alpha/action_menu.rb +0 -269
- data/app/components/primer/alpha/auto_complete/item.rb +0 -12
- data/app/components/primer/alpha/auto_complete.css +1 -1
- data/app/components/primer/alpha/auto_complete.css.map +1 -1
- data/app/components/primer/alpha/auto_complete.rb +0 -47
- data/app/components/primer/alpha/banner.css +1 -1
- data/app/components/primer/alpha/banner.css.map +1 -1
- data/app/components/primer/alpha/banner.rb +0 -31
- data/app/components/primer/alpha/button_marketing.rb +0 -12
- data/app/components/primer/alpha/dialog.css +1 -1
- data/app/components/primer/alpha/dialog.css.map +1 -1
- data/app/components/primer/alpha/dialog.rb +2 -18
- data/app/components/primer/alpha/dropdown.css +1 -1
- data/app/components/primer/alpha/dropdown.css.map +1 -1
- data/app/components/primer/alpha/dropdown.rb +0 -105
- data/app/components/primer/alpha/form_control.rb +0 -11
- data/app/components/primer/alpha/hellip_button.rb +0 -9
- data/app/components/primer/alpha/hidden_text_expander.rb +0 -9
- data/app/components/primer/alpha/image.rb +0 -16
- data/app/components/primer/alpha/image_crop.rb +0 -11
- data/app/components/primer/alpha/layout.css +1 -1
- data/app/components/primer/alpha/layout.css.map +1 -1
- data/app/components/primer/alpha/layout.pcss +1 -1
- data/app/components/primer/alpha/layout.rb +0 -118
- data/app/components/primer/alpha/menu.css +1 -1
- data/app/components/primer/alpha/menu.css.map +1 -1
- data/app/components/primer/alpha/menu.rb +0 -19
- data/app/components/primer/alpha/multi_input.rb +0 -33
- data/app/components/primer/alpha/nav_list.rb +0 -69
- data/app/components/primer/alpha/navigation/tab.rb +0 -35
- data/app/components/primer/alpha/octicon_symbols.rb +0 -6
- data/app/components/primer/alpha/overlay.rb +0 -14
- data/app/components/primer/alpha/segmented_control.css +1 -1
- data/app/components/primer/alpha/segmented_control.css.map +1 -1
- data/app/components/primer/alpha/segmented_control.rb +0 -61
- data/app/components/primer/alpha/tab_container.rb +0 -18
- data/app/components/primer/alpha/tab_nav.css +1 -1
- data/app/components/primer/alpha/tab_nav.css.map +1 -1
- data/app/components/primer/alpha/tab_nav.rb +0 -63
- data/app/components/primer/alpha/tab_panels.rb +0 -16
- data/app/components/primer/alpha/text_field.css +1 -1
- data/app/components/primer/alpha/text_field.css.map +1 -1
- data/app/components/primer/alpha/text_field.rb +0 -68
- data/app/components/primer/alpha/toggle_switch.css +1 -1
- data/app/components/primer/alpha/toggle_switch.css.map +1 -1
- data/app/components/primer/alpha/toggle_switch.rb +0 -18
- data/app/components/primer/alpha/tooltip.rb +1 -69
- data/app/components/primer/alpha/underline_nav.css +1 -1
- data/app/components/primer/alpha/underline_nav.css.map +1 -1
- data/app/components/primer/alpha/underline_nav.rb +0 -61
- data/app/components/primer/alpha/underline_panels.rb +0 -19
- data/app/components/primer/beta/auto_complete/item.rb +0 -8
- data/app/components/primer/beta/auto_complete.rb +0 -56
- data/app/components/primer/beta/avatar.css +1 -1
- data/app/components/primer/beta/avatar.css.map +1 -1
- data/app/components/primer/beta/avatar.rb +0 -18
- data/app/components/primer/beta/avatar_stack.css +1 -1
- data/app/components/primer/beta/avatar_stack.css.map +1 -1
- data/app/components/primer/beta/avatar_stack.rb +0 -21
- data/app/components/primer/beta/base_button.rb +0 -4
- data/app/components/primer/beta/blankslate.css +1 -1
- data/app/components/primer/beta/blankslate.css.map +1 -1
- data/app/components/primer/beta/blankslate.rb +0 -104
- data/app/components/primer/beta/border_box/header.rb +4 -11
- data/app/components/primer/beta/border_box.css +1 -1
- data/app/components/primer/beta/border_box.css.map +1 -1
- data/app/components/primer/beta/border_box.html.erb +2 -2
- data/app/components/primer/beta/border_box.rb +11 -55
- data/app/components/primer/beta/breadcrumbs.rb +0 -7
- data/app/components/primer/beta/button.css +1 -1
- data/app/components/primer/beta/button.css.json +1 -0
- data/app/components/primer/beta/button.css.map +1 -1
- data/app/components/primer/beta/button.pcss +6 -2
- data/app/components/primer/beta/button.rb +6 -43
- data/app/components/primer/beta/button_group.css +1 -1
- data/app/components/primer/beta/button_group.css.map +1 -1
- data/app/components/primer/beta/button_group.rb +0 -16
- data/app/components/primer/beta/clipboard_copy.rb +0 -12
- data/app/components/primer/beta/close_button.rb +0 -3
- data/app/components/primer/beta/counter.rb +0 -8
- data/app/components/primer/beta/details.rb +0 -11
- data/app/components/primer/beta/flash.css +1 -1
- data/app/components/primer/beta/flash.css.map +1 -1
- data/app/components/primer/beta/flash.html.erb +1 -3
- data/app/components/primer/beta/flash.pcss +1 -2
- data/app/components/primer/beta/flash.rb +1 -23
- data/app/components/primer/beta/heading.rb +0 -8
- data/app/components/primer/beta/icon_button.rb +0 -21
- data/app/components/primer/beta/label.css +1 -1
- data/app/components/primer/beta/label.css.map +1 -1
- data/app/components/primer/beta/label.rb +0 -20
- data/app/components/primer/beta/link.rb +0 -22
- data/app/components/primer/beta/markdown.rb +1 -262
- data/app/components/primer/beta/octicon.rb +0 -10
- data/app/components/primer/beta/popover.css +1 -1
- data/app/components/primer/beta/popover.css.map +1 -1
- data/app/components/primer/beta/popover.rb +0 -43
- data/app/components/primer/beta/progress_bar.rb +1 -22
- data/app/components/primer/beta/relative_time.rb +0 -9
- data/app/components/primer/beta/spinner.rb +2 -10
- data/app/components/primer/beta/state.rb +0 -13
- data/app/components/primer/beta/subhead.rb +0 -55
- data/app/components/primer/beta/text.rb +0 -4
- data/app/components/primer/beta/timeline_item.css +1 -1
- data/app/components/primer/beta/timeline_item.css.map +1 -1
- data/app/components/primer/beta/timeline_item.rb +0 -9
- data/app/components/primer/beta/truncate.rb +0 -50
- data/app/components/primer/blankslate_component.rb +0 -76
- data/app/components/primer/box.rb +0 -6
- data/app/components/primer/button_component.rb +0 -49
- data/app/components/primer/component.rb +1 -1
- data/app/components/primer/conditional_wrapper.rb +2 -17
- data/app/components/primer/icon_button.rb +0 -30
- data/app/components/primer/layout_component.rb +0 -12
- data/app/components/primer/tooltip.rb +0 -27
- data/app/components/primer/truncate.rb +0 -19
- data/app/lib/primer/fetch_or_fallback_helper.rb +1 -1
- data/lib/primer/accessibility.rb +1 -1
- data/lib/primer/deprecations.yml +3 -3
- data/lib/primer/forms/dsl/input.rb +1 -0
- data/lib/primer/view_components/linters/details_menu_migration.rb +1 -1
- data/lib/primer/view_components/linters/migrations/truncate_component.rb +45 -0
- data/lib/primer/view_components/linters/tooltipped_migration.rb +1 -1
- data/lib/primer/view_components/linters.rb +1 -0
- data/lib/primer/view_components/version.rb +2 -2
- data/lib/primer/view_components.rb +18 -0
- data/lib/primer/yard.rb +8 -9
- data/previews/primer/beta/button_preview/leading_visual.html.erb +2 -2
- data/previews/primer/beta/button_preview/leading_visual_svg.html.erb +12 -0
- data/previews/primer/beta/button_preview/trailing_counter.html.erb +1 -1
- data/previews/primer/beta/button_preview/trailing_visual.html.erb +1 -1
- data/previews/primer/beta/button_preview.rb +22 -0
- data/static/arguments.json +12 -1
- data/static/info_arch.json +32 -2
- data/static/previews.json +13 -0
- metadata +4 -3
- data/lib/primer/yard/legacy_gatsby_backend.rb +0 -233
data/static/arguments.json
CHANGED
@@ -4248,7 +4248,18 @@
|
|
4248
4248
|
"source": "https://github.com/primer/view_components/tree/main/app/components/primer/conditional_wrapper.rb",
|
4249
4249
|
"lookbook": "https://primer.style/view-components/lookbook/inspect/primer/conditional_wrapper/default/",
|
4250
4250
|
"parameters": [
|
4251
|
-
|
4251
|
+
{
|
4252
|
+
"name": "condition",
|
4253
|
+
"type": "Boolean",
|
4254
|
+
"default": "N/A",
|
4255
|
+
"description": "Whether or not to wrap the content in a `Primer::BaseComponent`."
|
4256
|
+
},
|
4257
|
+
{
|
4258
|
+
"name": "base_component_arguments",
|
4259
|
+
"type": "Hash",
|
4260
|
+
"default": "N/A",
|
4261
|
+
"description": "The arguments to pass to `Primer::BaseComponent`."
|
4262
|
+
}
|
4252
4263
|
]
|
4253
4264
|
},
|
4254
4265
|
{
|
data/static/info_arch.json
CHANGED
@@ -10271,7 +10271,13 @@
|
|
10271
10271
|
}
|
10272
10272
|
],
|
10273
10273
|
"methods": [
|
10274
|
+
{
|
10275
|
+
"name": "id",
|
10276
|
+
"description": "Returns the value of attribute id.",
|
10277
|
+
"parameters": [
|
10274
10278
|
|
10279
|
+
]
|
10280
|
+
}
|
10275
10281
|
],
|
10276
10282
|
"previews": [
|
10277
10283
|
|
@@ -10489,7 +10495,7 @@
|
|
10489
10495
|
"slots": [
|
10490
10496
|
{
|
10491
10497
|
"name": "leading_visual",
|
10492
|
-
"description": "Leading visuals appear to the left of the button text.\n\nUse:\n\n- `leading_visual_icon` for a {{#link_to_component}}Primer::Beta::Octicon{{/link_to_component}}.",
|
10498
|
+
"description": "Leading visuals appear to the left of the button text.\n\nUse:\n\n- `leading_visual_icon` for a {{#link_to_component}}Primer::Beta::Octicon{{/link_to_component}}.\n\n- `leading_visual_svg` to render a SVG.",
|
10493
10499
|
"parameters": [
|
10494
10500
|
{
|
10495
10501
|
"name": "system_arguments",
|
@@ -10702,6 +10708,19 @@
|
|
10702
10708
|
]
|
10703
10709
|
}
|
10704
10710
|
},
|
10711
|
+
{
|
10712
|
+
"preview_path": "primer/beta/button/leading_visual_svg",
|
10713
|
+
"name": "leading_visual_svg",
|
10714
|
+
"snapshot": "true",
|
10715
|
+
"skip_rules": {
|
10716
|
+
"wont_fix": [
|
10717
|
+
"region"
|
10718
|
+
],
|
10719
|
+
"will_fix": [
|
10720
|
+
"color-contrast"
|
10721
|
+
]
|
10722
|
+
}
|
10723
|
+
},
|
10705
10724
|
{
|
10706
10725
|
"preview_path": "primer/beta/button/trailing_action",
|
10707
10726
|
"name": "trailing_action",
|
@@ -14016,7 +14035,18 @@
|
|
14016
14035
|
"source": "https://github.com/primer/view_components/tree/main/app/components/primer/conditional_wrapper.rb",
|
14017
14036
|
"lookbook": "https://primer.style/view-components/lookbook/inspect/primer/conditional_wrapper/default/",
|
14018
14037
|
"parameters": [
|
14019
|
-
|
14038
|
+
{
|
14039
|
+
"name": "condition",
|
14040
|
+
"type": "Boolean",
|
14041
|
+
"default": "N/A",
|
14042
|
+
"description": "Whether or not to wrap the content in a `Primer::BaseComponent`."
|
14043
|
+
},
|
14044
|
+
{
|
14045
|
+
"name": "base_component_arguments",
|
14046
|
+
"type": "Hash",
|
14047
|
+
"default": "N/A",
|
14048
|
+
"description": "The arguments to pass to `Primer::BaseComponent`."
|
14049
|
+
}
|
14020
14050
|
],
|
14021
14051
|
"slots": [
|
14022
14052
|
|
data/static/previews.json
CHANGED
@@ -2046,6 +2046,19 @@
|
|
2046
2046
|
]
|
2047
2047
|
}
|
2048
2048
|
},
|
2049
|
+
{
|
2050
|
+
"preview_path": "primer/beta/button/leading_visual_svg",
|
2051
|
+
"name": "leading_visual_svg",
|
2052
|
+
"snapshot": "true",
|
2053
|
+
"skip_rules": {
|
2054
|
+
"wont_fix": [
|
2055
|
+
"region"
|
2056
|
+
],
|
2057
|
+
"will_fix": [
|
2058
|
+
"color-contrast"
|
2059
|
+
]
|
2060
|
+
}
|
2061
|
+
},
|
2049
2062
|
{
|
2050
2063
|
"preview_path": "primer/beta/button/trailing_action",
|
2051
2064
|
"name": "trailing_action",
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openproject-primer_view_components
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitHub Open Source
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-
|
12
|
+
date: 2023-09-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionview
|
@@ -935,6 +935,7 @@ files:
|
|
935
935
|
- lib/primer/view_components/linters/helpers/rule_helpers.rb
|
936
936
|
- lib/primer/view_components/linters/label_component_migration_counter.rb
|
937
937
|
- lib/primer/view_components/linters/migrate_deprecated_flash_arguments.rb
|
938
|
+
- lib/primer/view_components/linters/migrations/truncate_component.rb
|
938
939
|
- lib/primer/view_components/linters/severity_schema.rb
|
939
940
|
- lib/primer/view_components/linters/subhead_component_migration_counter.rb
|
940
941
|
- lib/primer/view_components/linters/super_in_component_templates.rb
|
@@ -949,7 +950,6 @@ files:
|
|
949
950
|
- lib/primer/yard/component_ref.rb
|
950
951
|
- lib/primer/yard/docs_helper.rb
|
951
952
|
- lib/primer/yard/info_arch_docs_helper.rb
|
952
|
-
- lib/primer/yard/legacy_gatsby_backend.rb
|
953
953
|
- lib/primer/yard/lookbook_docs_helper.rb
|
954
954
|
- lib/primer/yard/lookbook_pages_backend.rb
|
955
955
|
- lib/primer/yard/registry.rb
|
@@ -1062,6 +1062,7 @@ files:
|
|
1062
1062
|
- previews/primer/beta/button_preview/all_schemes.html.erb
|
1063
1063
|
- previews/primer/beta/button_preview/invisible_all_visuals.html.erb
|
1064
1064
|
- previews/primer/beta/button_preview/leading_visual.html.erb
|
1065
|
+
- previews/primer/beta/button_preview/leading_visual_svg.html.erb
|
1065
1066
|
- previews/primer/beta/button_preview/trailing_action.html.erb
|
1066
1067
|
- previews/primer/beta/button_preview/trailing_counter.html.erb
|
1067
1068
|
- previews/primer/beta/button_preview/trailing_visual.html.erb
|
@@ -1,233 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# rubocop:disable Naming/MethodParameterName
|
4
|
-
|
5
|
-
# :nocov:
|
6
|
-
module Primer
|
7
|
-
module Yard
|
8
|
-
# Backend that generates documentation for the legacy, Gatsby-powered PVC docsite.
|
9
|
-
class LegacyGatsbyBackend < Backend
|
10
|
-
class << self
|
11
|
-
def parse_example_tag(tag)
|
12
|
-
name = tag.name
|
13
|
-
description = nil
|
14
|
-
code = nil
|
15
|
-
|
16
|
-
if tag.text.include?("@description")
|
17
|
-
splitted = tag.text.split(/@description|@code/)
|
18
|
-
description = splitted.second.gsub(/^[ \t]{2}/, "").strip
|
19
|
-
code = splitted.last.gsub(/^[ \t]{2}/, "").strip
|
20
|
-
else
|
21
|
-
code = tag.text
|
22
|
-
end
|
23
|
-
|
24
|
-
[name, description, code]
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
attr_reader :registry, :manifest
|
29
|
-
|
30
|
-
def initialize(registry, manifest)
|
31
|
-
@registry = registry
|
32
|
-
@manifest = manifest
|
33
|
-
end
|
34
|
-
|
35
|
-
def generate
|
36
|
-
errors = []
|
37
|
-
|
38
|
-
each_component do |component_ref|
|
39
|
-
component = component_ref.klass
|
40
|
-
docs = registry.find(component)
|
41
|
-
status_path = docs.status_module.nil? ? "" : "#{docs.status_module}/"
|
42
|
-
|
43
|
-
metadata = docs.metadata.merge(
|
44
|
-
source: component_ref.source_url,
|
45
|
-
lookbook: component_ref.lookbook_url,
|
46
|
-
path: "docs/content/components/#{status_path}#{docs.short_name.downcase}.md",
|
47
|
-
example_path: example_path(component),
|
48
|
-
require_js_path: require_js_path(component)
|
49
|
-
)
|
50
|
-
|
51
|
-
path = Pathname.new(metadata[:path])
|
52
|
-
path.dirname.mkpath unless path.dirname.exist?
|
53
|
-
|
54
|
-
File.open(path, "w") do |f|
|
55
|
-
f.puts("---")
|
56
|
-
f.puts("title: #{metadata[:title]}")
|
57
|
-
f.puts("componentId: #{metadata[:component_id]}")
|
58
|
-
f.puts("status: #{metadata[:status]}")
|
59
|
-
f.puts("source: #{metadata[:source]}")
|
60
|
-
f.puts("a11yReviewed: #{metadata[:a11y_reviewed]}")
|
61
|
-
f.puts("lookbook: #{metadata[:lookbook]}") if preview_exists?(component)
|
62
|
-
f.puts("---")
|
63
|
-
f.puts
|
64
|
-
f.puts("import Example from '#{metadata[:example_path]}'")
|
65
|
-
|
66
|
-
if component_ref.requires_js?
|
67
|
-
f.puts("import RequiresJSFlash from '#{metadata[:require_js_path]}'")
|
68
|
-
f.puts
|
69
|
-
f.puts("<RequiresJSFlash />")
|
70
|
-
end
|
71
|
-
|
72
|
-
f.puts
|
73
|
-
f.puts("<!-- Warning: AUTO-GENERATED file, do not edit. Add code comments to your Ruby instead <3 -->")
|
74
|
-
f.puts
|
75
|
-
f.puts(view_context.render(inline: docs.base_docstring))
|
76
|
-
|
77
|
-
if docs.tags(:deprecated).any?
|
78
|
-
f.puts
|
79
|
-
f.puts("## Deprecation")
|
80
|
-
docs.tags(:deprecated).each do |tag|
|
81
|
-
f.puts
|
82
|
-
f.puts view_context.render(inline: tag.text)
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
if docs.tags(:accessibility).any?
|
87
|
-
f.puts
|
88
|
-
f.puts("## Accessibility")
|
89
|
-
docs.tags(:accessibility).each do |tag|
|
90
|
-
f.puts
|
91
|
-
f.puts view_context.render(inline: tag.text)
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
errors << { component.name => { arguments: "No argument documentation found" } } unless docs.params.any?
|
96
|
-
|
97
|
-
f.puts
|
98
|
-
f.puts("## Arguments")
|
99
|
-
f.puts
|
100
|
-
f.puts("| Name | Type | Default | Description |")
|
101
|
-
f.puts("| :- | :- | :- | :- |")
|
102
|
-
|
103
|
-
documented_params = docs.params.map(&:name)
|
104
|
-
component_params = component.instance_method(:initialize).parameters.map { |p| p.last.to_s }
|
105
|
-
|
106
|
-
if (documented_params & component_params).size != component_params.size
|
107
|
-
err = { arguments: {} }
|
108
|
-
(component_params - documented_params).each do |arg|
|
109
|
-
err[:arguments][arg] = "Not documented"
|
110
|
-
end
|
111
|
-
|
112
|
-
errors << { component.name => err }
|
113
|
-
end
|
114
|
-
|
115
|
-
docs.params.each do |tag|
|
116
|
-
default_value = pretty_default_value(tag, component)
|
117
|
-
f.puts("| `#{tag.name}` | `#{tag.types.join(', ')}` | #{default_value} | #{view_context.render(inline: tag.text.squish)} |")
|
118
|
-
end
|
119
|
-
|
120
|
-
if docs.slot_methods.any?
|
121
|
-
f.puts
|
122
|
-
f.puts("## Slots")
|
123
|
-
|
124
|
-
docs.slot_methods.each do |slot_docs|
|
125
|
-
emit_method(slot_docs, component, f)
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
example_tags = docs.constructor.tags(:example)
|
130
|
-
|
131
|
-
if example_tags.any?
|
132
|
-
f.puts
|
133
|
-
f.puts("## Examples")
|
134
|
-
|
135
|
-
example_tags.each do |tag|
|
136
|
-
name, description, code = parse_example_tag(tag)
|
137
|
-
f.puts
|
138
|
-
f.puts("### #{name}")
|
139
|
-
if description
|
140
|
-
f.puts
|
141
|
-
f.puts(view_context.render(inline: description.squish))
|
142
|
-
end
|
143
|
-
f.puts
|
144
|
-
html = view_context.render(inline: code)
|
145
|
-
f.puts("<Example src=\"#{html.tr('"', "\'").delete("\n")}\" />")
|
146
|
-
f.puts
|
147
|
-
f.puts("```erb")
|
148
|
-
f.puts(code.to_s)
|
149
|
-
f.puts("```")
|
150
|
-
end
|
151
|
-
elsif component_ref.should_have_examples?
|
152
|
-
errors << { component.name => { example: "No examples found" } }
|
153
|
-
end
|
154
|
-
end
|
155
|
-
end
|
156
|
-
|
157
|
-
# Build system arguments docs from BaseComponent
|
158
|
-
system_args_docs = registry.find(Primer::BaseComponent)
|
159
|
-
|
160
|
-
File.open("docs/content/system-arguments.md", "w") do |f|
|
161
|
-
f.puts("---")
|
162
|
-
f.puts("title: System arguments")
|
163
|
-
f.puts("---")
|
164
|
-
f.puts
|
165
|
-
f.puts("<!-- Warning: AUTO-GENERATED file, do not edit. Add code comments to your Ruby instead <3 -->")
|
166
|
-
f.puts
|
167
|
-
f.puts(system_args_docs.base_docstring)
|
168
|
-
f.puts
|
169
|
-
|
170
|
-
f.puts(view_context.render(inline: system_args_docs.constructor.base_docstring))
|
171
|
-
end
|
172
|
-
|
173
|
-
errors
|
174
|
-
end
|
175
|
-
|
176
|
-
private
|
177
|
-
|
178
|
-
def emit_method(method_docs, component, f)
|
179
|
-
f.puts
|
180
|
-
f.puts("### `#{method_docs.name}`")
|
181
|
-
|
182
|
-
if method_docs.base_docstring.to_s.present?
|
183
|
-
f.puts
|
184
|
-
f.puts(view_context.render(inline: method_docs.base_docstring))
|
185
|
-
end
|
186
|
-
|
187
|
-
param_tags = method_docs.tags(:param)
|
188
|
-
if param_tags.any?
|
189
|
-
f.puts
|
190
|
-
f.puts("| Name | Type | Default | Description |")
|
191
|
-
f.puts("| :- | :- | :- | :- |")
|
192
|
-
end
|
193
|
-
|
194
|
-
param_tags.each do |tag|
|
195
|
-
f.puts("| `#{tag.name}` | `#{tag.types.join(', ')}` | #{pretty_default_value(tag, component)} | #{view_context.render(inline: tag.text)} |")
|
196
|
-
end
|
197
|
-
end
|
198
|
-
|
199
|
-
def each_component(&block)
|
200
|
-
manifest.each(&block)
|
201
|
-
end
|
202
|
-
|
203
|
-
def example_path(component)
|
204
|
-
example_path = "../../src/@primer/gatsby-theme-doctocat/components/example"
|
205
|
-
example_path = "../#{example_path}" if status_module?(component)
|
206
|
-
example_path
|
207
|
-
end
|
208
|
-
|
209
|
-
def require_js_path(component)
|
210
|
-
require_js_path = "../../src/@primer/gatsby-theme-doctocat/components/requires-js-flash"
|
211
|
-
require_js_path = "../#{require_js_path}" if status_module?(component)
|
212
|
-
require_js_path
|
213
|
-
end
|
214
|
-
|
215
|
-
def preview_exists?(component)
|
216
|
-
path = component.name.underscore
|
217
|
-
|
218
|
-
File.exist?("previews/#{path}_preview.rb")
|
219
|
-
end
|
220
|
-
|
221
|
-
def status_module?(component)
|
222
|
-
(%w[Alpha Beta] & component.name.split("::")).any?
|
223
|
-
end
|
224
|
-
|
225
|
-
def parse_example_tag(tag)
|
226
|
-
self.class.parse_example_tag(tag)
|
227
|
-
end
|
228
|
-
end
|
229
|
-
end
|
230
|
-
end
|
231
|
-
# :nocov:
|
232
|
-
|
233
|
-
# rubocop:enable Naming/MethodParameterName
|