trek 0.1.16 → 0.1.17

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dc939de6d6cc669e8faa27134dd868b9523bafa0236e1cf025673e0abb84d833
4
- data.tar.gz: 6abb5b7e49ee16d38619f6831d62dda2a05871b09a81f9ea8d44021254a91774
3
+ metadata.gz: 8ce09d92a68c4819bcee3c5161b1fd0b94cc70c5b9f0b2b27078d2dd25304f0a
4
+ data.tar.gz: ac8267f5c9835457b0ba96d64efc70bf07dd33b5d0e35d0e3e17187ea5820ea7
5
5
  SHA512:
6
- metadata.gz: 69f4c70a9471eb21966c377cb419e98a314ecac4aeac31dc1f78501e8241450870de557ab77eadc2acc11fa5532193b8db3646406b8dbdee7780355c1e255483
7
- data.tar.gz: 0c71c307f076c1c601ac37a1b016cc2508fcc78b56fbd114fd7769dce928581ff0daffb22c2f62c011e85fb6a9b8cf6445616c7d47b793538af516f15d01f781
6
+ metadata.gz: 1e5b14288cf402157249b544f6931253594f1fce504d40a20af920ae3c116f339a877a11db59c34371cce3fb9d689b9153c165d60194783a72c4bae5e539aa65
7
+ data.tar.gz: 8b98e40d589b12ff0debc7d5b822aaaefe525427d24c08c9c178194ab9aa988a7df96ef919e1cd21d788146a72c0a166a2d71e04f2e8e7f981e7a0d144d22b9f
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- trek (0.1.16)
4
+ trek (0.1.17)
5
5
  action_policy (~> 0.6)
6
6
  actioncable
7
7
  acts_as_list (~> 1.1)
data/README.md CHANGED
@@ -192,7 +192,7 @@ Then, whenever you change the files in Trek, you'll have to restart the Rails se
192
192
 
193
193
  When you're done, disable the local version:
194
194
 
195
- bundle config --delete local.trek
195
+ bundle config unset --local local.trek
196
196
 
197
197
  Don't forget to revert to a released verion in your `Gemfile`:
198
198
 
@@ -33,12 +33,12 @@ table .root {
33
33
  --icon-size: 1.6rem;
34
34
 
35
35
  align-items: center;
36
+ aspect-ratio: 16/9;
36
37
  background-color: var(--slate-3);
37
38
  border: 1px solid var(--slate-a3);
38
39
  border-radius: 0.2rem;
39
40
  color: var(--slate-8);
40
41
  display: flex;
41
- aspect-ratio: 16/9;
42
42
  justify-content: center;
43
43
  margin-right: 2rem;
44
44
  overflow: hidden;
@@ -2,6 +2,7 @@
2
2
  .root {
3
3
  align-items: center;
4
4
  display: flex;
5
+ margin-bottom: 2.4rem;
5
6
  }
6
7
 
7
8
  .label {
@@ -14,6 +15,7 @@
14
15
  border-radius: 0.8rem;
15
16
  display: flex;
16
17
  transition: border-color 0.2s ease-in-out;
18
+ width: 36rem;
17
19
  }
18
20
 
19
21
  .wrapper:focus-within {
@@ -25,8 +27,10 @@
25
27
  background: transparent;
26
28
  border: 0;
27
29
  color: var(--slate-11);
30
+ flex-grow: 1;
28
31
  font-size: 1.6rem;
29
32
  font-weight: var(--regular);
33
+ margin-right: 1rem;
30
34
  padding: 1rem 2rem;
31
35
  transition: color 0.2s ease-in-out;
32
36
  }
@@ -42,15 +46,14 @@
42
46
  appearance: none;
43
47
  background-color: transparent;
44
48
  border: none;
45
- border-radius: 0.8rem;
49
+ border-radius: 0 0.8rem 0.8rem 0;
46
50
  color: var(--slate-11);
47
51
  cursor: pointer;
48
52
  display: inline-flex;
49
53
  font-size: 1.6rem;
50
54
  font-weight: var(--regular);
51
55
  line-height: 1.25;
52
- margin-left: 1rem;
53
- padding: 1rem 2rem;
56
+ padding: 1rem 1.4rem;
54
57
  text-decoration: none;
55
58
  transition: background-color 0.2s ease-in-out, border-color 0.2s ease-in-out,
56
59
  color 0.2s ease-in-out;
@@ -59,4 +62,26 @@
59
62
  .button:hover {
60
63
  background-color: var(--accent-3);
61
64
  border-color: var(--accent-5);
65
+ color: var(--accent-11);
66
+ }
67
+
68
+ .reset {
69
+ --icon-size: 1.6rem;
70
+
71
+ align-items: center;
72
+ appearance: none;
73
+ background-color: transparent;
74
+ border: none;
75
+ border-radius: 0;
76
+ color: var(--slate-11);
77
+ cursor: pointer;
78
+ display: inline-flex;
79
+ padding: 1rem 1.4rem;
80
+ text-decoration: none;
81
+ transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
82
+ }
83
+
84
+ .reset:hover {
85
+ background-color: var(--accent-3);
86
+ color: var(--accent-11);
62
87
  }
@@ -7,5 +7,8 @@
7
7
  value=value
8
8
  class=class_for("input")
9
9
  )
10
+ - if value.present?
11
+ = link_to action, class: class_for("reset"), title: t(".reset")
12
+ = render Trek::IconComponent.new("trek/close")
10
13
  button(class=class_for("button") type="submit" title=t(".search"))
11
14
  = render Trek::IconComponent.new("trek/search")
@@ -229,6 +229,7 @@ en:
229
229
  list_component:
230
230
  empty: No item.
231
231
  search_component:
232
+ reset: Reset search
232
233
  search: Search
233
234
  user:
234
235
  locale:
@@ -233,6 +233,7 @@ fr:
233
233
  list_component:
234
234
  empty: Aucun élément
235
235
  search_component:
236
+ reset: Réinitialiser la recherche
236
237
  search: Rechercher
237
238
  user:
238
239
  locale:
@@ -1,16 +1,18 @@
1
1
  module Trek
2
- # `TypographyFormatter` formats strings to enforce typography rules.
3
- # For now, only French typography rules about non-breaking spaces
4
- # and ellipsis are implemented.
2
+ # `TypographyFormatter` formats strings to enforce French typography rules.
5
3
  #
6
4
  # Supports both plain strings and ProseMirror JSONB hashes. When given
7
5
  # a Hash, it walks the node tree and formats only `text` node values
8
6
  # in place, leaving the structure intact.
9
7
  class TypographyFormatter
10
8
  NBSP = [160].pack("U*").freeze
11
- NBSP_BEFORE_CHARS = %w[: ; % \$ °C °F » ! \? –].freeze
12
- NBSP_AFTER_CHARS = %w[«].freeze
13
- NBSP_BEFORE_UNITS = %w[g h ha kg km Ko ko kW L l m min ml Mo mo s].freeze
9
+ NNBSP = [8239].pack("U*").freeze # U+202F narrow no-break space
10
+ SPACE_BEFORE_CHARS = [
11
+ [NBSP, %w[: % \$ » ]],
12
+ [NNBSP, %w[; ! \?]]
13
+ ].freeze
14
+ NBSP_AFTER_CHARS = %w[« – —].freeze
15
+ NBSP_BEFORE_UNITS = %w[°C °F g h ha kg km Ko ko kW L l m min ml Mo mo s].freeze
14
16
 
15
17
  def initialize(input)
16
18
  @source = input
@@ -36,6 +38,8 @@ module Trek
36
38
  remove_double_spaces
37
39
  add_nbsp
38
40
  replace_ellipsis
41
+ replace_apostrophes
42
+ remove_spaces_before_attached_punctuation
39
43
  end
40
44
 
41
45
  def format_prosemirror_node(node)
@@ -62,15 +66,19 @@ module Trek
62
66
  end
63
67
 
64
68
  def add_nbsp
65
- add_nbsp_before_chars
69
+ add_nbsp_after_numero
66
70
  add_nbsp_before_units
71
+ add_nbsp_before_degree
72
+ add_space_before_chars
67
73
  add_nbsp_after_chars
68
74
  add_nbsp_between_digits
69
75
  end
70
76
 
71
- def add_nbsp_before_chars
72
- regexp = /(?<=\S)(\p{Zs}?(#{NBSP_BEFORE_CHARS.join("|")}))/
73
- @output.gsub!(regexp, "#{NBSP}\\2")
77
+ def add_space_before_chars
78
+ SPACE_BEFORE_CHARS.each do |space, chars|
79
+ regexp = /(?<=\S)(\p{Zs}?(#{chars.join("|")}))/
80
+ @output.gsub!(regexp, "#{space}\\2")
81
+ end
74
82
  end
75
83
 
76
84
  def add_nbsp_before_units
@@ -79,10 +87,18 @@ module Trek
79
87
  end
80
88
 
81
89
  def add_nbsp_after_chars
82
- regexp = /((#{NBSP_AFTER_CHARS.join("|")})\p{Zs}?)\b/
90
+ regexp = /((#{NBSP_AFTER_CHARS.join("|")})\p{Zs}?)(?=\w)/
83
91
  @output.gsub!(regexp, "\\2#{NBSP}")
84
92
  end
85
93
 
94
+ def add_nbsp_before_degree
95
+ @output.gsub!(/(\d)\p{Zs}?(°)(?!\w)/, "\\1#{NBSP}\\2")
96
+ end
97
+
98
+ def add_nbsp_after_numero
99
+ @output.gsub!(/(?i)(n°)\p{Zs}?(?=\d)/, "\\1#{NBSP}")
100
+ end
101
+
86
102
  def add_nbsp_between_digits
87
103
  regexp = /(\d)\p{Zs}(\d)/
88
104
  @output.gsub!(regexp, "\\1#{NBSP}\\2")
@@ -91,5 +107,13 @@ module Trek
91
107
  def replace_ellipsis
92
108
  @output.gsub!("...", "…")
93
109
  end
110
+
111
+ def replace_apostrophes
112
+ @output.gsub!(/(?<=\w)'(?=\w)/, "\u2019")
113
+ end
114
+
115
+ def remove_spaces_before_attached_punctuation
116
+ @output.gsub!(/\p{Zs}+([.,])/, "\\1")
117
+ end
94
118
  end
95
119
  end
data/lib/trek/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Trek
4
- VERSION = "0.1.16"
4
+ VERSION = "0.1.17"
5
5
  end
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etaminstudio/trek",
3
- "version": "0.1.16",
3
+ "version": "0.1.17",
4
4
  "description": "A modern CMS for Ruby on Rails",
5
5
  "main": "app/javascript/trek.js",
6
6
  "repository": {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trek
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.16
4
+ version: 0.1.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mohamed Bengrich