playbook_ui 13.6.0 → 13.7.0.pre.alpha.play845allkitsbytypes1231

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Playbook
3
+ module PlaybookWebsite
4
4
  module PbDocHelper
5
5
  def pb_kit_title(title)
6
6
  title.remove("pb_").titleize.tr("_", " ")
@@ -27,33 +27,56 @@ module Playbook
27
27
 
28
28
  # Deal with lists of kits, used in Playbook doc and Externally
29
29
  # rubocop:disable Style/StringConcatenation
30
- def pb_kits(type: "rails", limit_examples: false, dark_mode: false, method: get_kits)
30
+ def pb_kits(type: "rails", limit_examples: false, dark_mode: false)
31
31
  display_kits = []
32
- kits = method
32
+ kits = get_kits(type)
33
33
  kits.each do |kit|
34
- if kit.is_a?(Hash)
35
- nav_hash_array(kit).each do |sub_kit|
36
- display_kits << render_pb_doc_kit(sub_kit, type, limit_examples, false, dark_mode)
37
- end
38
- else
39
- display_kits << render_pb_doc_kit(kit, type, limit_examples, false, dark_mode)
34
+ nav_array = nav_hash_array(kit)
35
+ next unless nav_array.is_a?(Array)
36
+
37
+ nav_array.each do |sub_kit|
38
+ display_kits << render_pb_doc_kit(sub_kit, type, limit_examples, false, dark_mode)
40
39
  end
41
40
  end
42
41
  raw("<div class='pb--docItem'>" + display_kits.join("</div><div class='pb--docItem'>") + "</div>")
43
42
  end
44
43
  # rubocop:enable Style/StringConcatenation
45
44
 
46
- # rubocop:disable Naming/AccessorMethodName
47
- def get_kits
48
- menu = YAML.load_file(Playbook::Engine.root.join("dist/menu.yml"))
49
- menu["kits"]
45
+ def get_kits(type = "rails")
46
+ MENU["kits"][type]
50
47
  end
51
48
 
52
- def get_kits_pb_website
53
- menu = YAML.load_file(Rails.root.join("config/menu.yml"))
54
- menu["kits"]
49
+ def aggregate_kits
50
+ all_kits = []
51
+
52
+ # Loop over each type (rails, react, swift, etc.)
53
+ MENU["kits"].each do |_type, kits|
54
+ kits.each do |kit|
55
+ case kit
56
+ when Hash
57
+ kit_name = kit.keys.first
58
+ existing_kit = all_kits.find { |k| k.is_a?(Hash) && k.keys.first == kit_name }
59
+
60
+ if existing_kit
61
+ existing_kit[kit_name] += kit[kit_name] unless kit[kit_name].nil?
62
+ existing_kit[kit_name].uniq!
63
+ existing_kit[kit_name].sort!
64
+ else
65
+ all_kits << { kit_name => kit[kit_name] }
66
+ end
67
+ when String
68
+ all_kits << kit unless all_kits.include?(kit)
69
+ end
70
+ end
71
+ end
72
+
73
+ # Sort the top-level entries
74
+ all_kits.sort_by! do |kit|
75
+ kit.is_a?(Hash) ? kit.keys.first : kit
76
+ end
77
+
78
+ all_kits
55
79
  end
56
- # rubocop:enable Naming/AccessorMethodName
57
80
 
58
81
  # rubocop:disable Style/OptionalBooleanParameter
59
82
  def render_pb_doc_kit(kit, type, limit_examples, code = true, dark_mode = false)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Playbook
4
- PREVIOUS_VERSION = "13.5.0"
5
- VERSION = "13.6.0"
4
+ PREVIOUS_VERSION = "13.7.0"
5
+ VERSION = "13.7.0.pre.alpha.play845allkitsbytypes1231"
6
6
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: playbook_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 13.6.0
4
+ version: 13.7.0.pre.alpha.play845allkitsbytypes1231
5
5
  platform: ruby
6
6
  authors:
7
7
  - Power UX
8
8
  - Power Devs
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-09-19 00:00:00.000000000 Z
12
+ date: 2023-09-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -398,6 +398,9 @@ files:
398
398
  - app/pb_kits/playbook/pb_body/docs/_body_styled.html.erb
399
399
  - app/pb_kits/playbook/pb_body/docs/_body_styled.jsx
400
400
  - app/pb_kits/playbook/pb_body/docs/_body_styled.md
401
+ - app/pb_kits/playbook/pb_body/docs/_body_truncate.html.erb
402
+ - app/pb_kits/playbook/pb_body/docs/_body_truncate.jsx
403
+ - app/pb_kits/playbook/pb_body/docs/_body_truncate.md
401
404
  - app/pb_kits/playbook/pb_body/docs/_description.md
402
405
  - app/pb_kits/playbook/pb_body/docs/_footer.md
403
406
  - app/pb_kits/playbook/pb_body/docs/example.yml
@@ -2281,6 +2284,9 @@ files:
2281
2284
  - app/pb_kits/playbook/pb_title/docs/_title_responsive.html.erb
2282
2285
  - app/pb_kits/playbook/pb_title/docs/_title_responsive.jsx
2283
2286
  - app/pb_kits/playbook/pb_title/docs/_title_responsive.md
2287
+ - app/pb_kits/playbook/pb_title/docs/_title_truncate.html.erb
2288
+ - app/pb_kits/playbook/pb_title/docs/_title_truncate.jsx
2289
+ - app/pb_kits/playbook/pb_title/docs/_title_truncate.md
2284
2290
  - app/pb_kits/playbook/pb_title/docs/example.yml
2285
2291
  - app/pb_kits/playbook/pb_title/docs/index.js
2286
2292
  - app/pb_kits/playbook/pb_title/title.html.erb
@@ -2629,7 +2635,7 @@ homepage: https://playbook.powerapp.cloud/
2629
2635
  licenses:
2630
2636
  - ISC
2631
2637
  metadata: {}
2632
- post_install_message:
2638
+ post_install_message:
2633
2639
  rdoc_options: []
2634
2640
  require_paths:
2635
2641
  - lib
@@ -2640,12 +2646,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
2640
2646
  version: '0'
2641
2647
  required_rubygems_version: !ruby/object:Gem::Requirement
2642
2648
  requirements:
2643
- - - ">="
2649
+ - - ">"
2644
2650
  - !ruby/object:Gem::Version
2645
- version: '0'
2651
+ version: 1.3.1
2646
2652
  requirements: []
2647
2653
  rubygems_version: 3.3.7
2648
- signing_key:
2654
+ signing_key:
2649
2655
  specification_version: 4
2650
2656
  summary: Playbook Design System
2651
2657
  test_files: []