coupdoeil 1.0.0.pre.beta.1 → 1.0.0.pre.beta.2

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 (66) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +3 -0
  3. data/README.md +21 -21
  4. data/app/assets/javascripts/coupdoeil.js +132 -132
  5. data/app/assets/javascripts/coupdoeil.min.js +1 -1
  6. data/app/assets/javascripts/coupdoeil.min.js.map +1 -1
  7. data/app/assets/stylesheets/coupdoeil/popover-animation.css +44 -0
  8. data/app/assets/stylesheets/coupdoeil/popover-arrow.css +39 -0
  9. data/app/assets/stylesheets/coupdoeil/popover.css +84 -0
  10. data/app/controllers/coupdoeil/{hovercards_controller.rb → popovers_controller.rb} +13 -13
  11. data/app/helpers/coupdoeil/application_helper.rb +4 -4
  12. data/app/javascript/coupdoeil/elements/coupdoeil_element.js +13 -13
  13. data/app/javascript/coupdoeil/events/onclick.js +36 -36
  14. data/app/javascript/coupdoeil/events/onmouseover.js +52 -52
  15. data/app/javascript/coupdoeil/events.js +4 -4
  16. data/app/javascript/coupdoeil/index.js +1 -1
  17. data/app/javascript/coupdoeil/{hovercard → popover}/attributes.js +3 -3
  18. data/app/javascript/coupdoeil/popover/cache.js +22 -0
  19. data/app/javascript/coupdoeil/{hovercard → popover}/closing.js +18 -18
  20. data/app/javascript/coupdoeil/{hovercard → popover}/config.js +6 -6
  21. data/app/javascript/coupdoeil/popover/controller.js +20 -0
  22. data/app/javascript/coupdoeil/popover/current.js +13 -0
  23. data/app/javascript/coupdoeil/{hovercard → popover}/opening.js +26 -26
  24. data/app/javascript/coupdoeil/{hovercard → popover}/optionsParser.js +5 -5
  25. data/app/javascript/coupdoeil/{hovercard → popover}/positioning.js +2 -2
  26. data/app/javascript/coupdoeil/popover/state_check.js +12 -0
  27. data/app/models/coupdoeil/params.rb +4 -4
  28. data/app/models/coupdoeil/{hovercard → popover}/option/animation.rb +2 -2
  29. data/app/models/coupdoeil/{hovercard → popover}/option/cache.rb +2 -2
  30. data/app/models/coupdoeil/{hovercard → popover}/option/loading.rb +2 -2
  31. data/app/models/coupdoeil/{hovercard → popover}/option/offset.rb +2 -2
  32. data/app/models/coupdoeil/{hovercard → popover}/option/opening_delay.rb +2 -2
  33. data/app/models/coupdoeil/{hovercard → popover}/option/placement.rb +2 -2
  34. data/app/models/coupdoeil/{hovercard → popover}/option/trigger.rb +2 -2
  35. data/app/models/coupdoeil/{hovercard → popover}/option.rb +1 -1
  36. data/app/models/coupdoeil/{hovercard → popover}/options_set.rb +1 -1
  37. data/app/models/coupdoeil/{hovercard → popover}/registry.rb +2 -2
  38. data/app/models/coupdoeil/{hovercard → popover}/setup.rb +2 -2
  39. data/app/models/coupdoeil/{hovercard → popover}/view_context_delegation.rb +3 -3
  40. data/app/models/coupdoeil/{hovercard.rb → popover.rb} +8 -8
  41. data/app/models/coupdoeil/tag.rb +15 -15
  42. data/app/style/{hovercard-animation.scss → popover-animation.scss} +7 -7
  43. data/app/style/popover-arrow.scss +40 -0
  44. data/app/style/popover.scss +2 -0
  45. data/config/routes.rb +1 -1
  46. data/lib/coupdoeil/engine.rb +8 -8
  47. data/lib/coupdoeil/version.rb +1 -1
  48. data/lib/generators/coupdoeil/install/install_generator.rb +8 -8
  49. data/lib/generators/coupdoeil/install/templates/layout.html.erb.tt +1 -1
  50. data/lib/generators/coupdoeil/popover/USAGE +15 -0
  51. data/lib/generators/coupdoeil/popover/popover_generator.rb +22 -0
  52. data/lib/generators/coupdoeil/{hovercard/templates/hovercard.rb.tt → popover/templates/popover.rb.tt} +1 -1
  53. metadata +39 -39
  54. data/app/assets/stylesheets/coupdoeil/hovercard-animation.css +0 -44
  55. data/app/assets/stylesheets/coupdoeil/hovercard-arrow.css +0 -39
  56. data/app/assets/stylesheets/coupdoeil/hovercard.css +0 -84
  57. data/app/javascript/coupdoeil/hovercard/cache.js +0 -22
  58. data/app/javascript/coupdoeil/hovercard/controller.js +0 -20
  59. data/app/javascript/coupdoeil/hovercard/current.js +0 -13
  60. data/app/javascript/coupdoeil/hovercard/state_check.js +0 -12
  61. data/app/style/hovercard-arrow.scss +0 -40
  62. data/app/style/hovercard.scss +0 -2
  63. data/lib/generators/coupdoeil/hovercard/USAGE +0 -15
  64. data/lib/generators/coupdoeil/hovercard/hovercard_generator.rb +0 -22
  65. /data/app/javascript/coupdoeil/{hovercard → popover}/actions.js +0 -0
  66. /data/app/javascript/coupdoeil/{hovercard.js → popover.js} +0 -0
@@ -2,20 +2,20 @@
2
2
 
3
3
  module Coupdoeil
4
4
  class Tag
5
- def initialize(hovercard:, hovercard_options:, attributes:)
6
- @hovercard_setup = hovercard
5
+ def initialize(popover:, popover_options:, attributes:)
6
+ @popover_setup = popover
7
7
  @attributes = attributes
8
- hovercard_options = Hovercard::OptionsSet.new(hovercard_options)
9
- @hovercard_options_set = hovercard_setup.default_options.merge(hovercard_options)
10
- @hovercard_options_set.validate!
8
+ popover_options = Popover::OptionsSet.new(popover_options)
9
+ @popover_options_set = popover_setup.default_options.merge(popover_options)
10
+ @popover_options_set.validate!
11
11
  end
12
12
 
13
13
  def render_in(view_context, &block)
14
14
  ActiveSupport::Notifications.instrument("render_tag.coupdoeil") do
15
15
  content = view_context.capture(&block) if block_given?
16
- view_context.content_tag("coup-doeil", **@attributes.merge(hovercard_attributes)) do
17
- if hovercard_options_set.preload?
18
- view_context.tag.template(view_context.render(hovercard_setup), class: "hovercard-content") + content
16
+ view_context.content_tag("coup-doeil", **@attributes.merge(popover_attributes)) do
17
+ if popover_options_set.preload?
18
+ view_context.tag.template(view_context.render(popover_setup), class: "popover-content") + content
19
19
  else
20
20
  content
21
21
  end
@@ -25,18 +25,18 @@ module Coupdoeil
25
25
 
26
26
  private
27
27
 
28
- attr_reader :hovercard_options_set, :hovercard_setup
28
+ attr_reader :popover_options_set, :popover_setup
29
29
 
30
- def hovercard_attributes
31
- attributes = { hc: hovercard_options_set.to_base36 }
30
+ def popover_attributes
31
+ attributes = { "popover-options": popover_options_set.to_base36 }
32
32
 
33
- unless hovercard_options_set.preload?
34
- params = Params.serialize(hovercard_setup.params).sole.presence&.to_json
35
- attributes.merge!("hc-type" => hovercard_setup.identifier, "hc-params" => params)
33
+ unless popover_options_set.preload?
34
+ params = Params.serialize(popover_setup.params).sole.presence&.to_json
35
+ attributes.merge!("popover-type" => popover_setup.identifier, "popover-params" => params)
36
36
  end
37
37
 
38
38
  if Rails.env.local?
39
- attributes.merge!(hovercard_options_set.to_h.transform_keys { "hovercard-#{_1}" })
39
+ attributes.merge!(popover_options_set.to_h.transform_keys { "popover-#{_1}" })
40
40
  end
41
41
 
42
42
  attributes
@@ -1,26 +1,26 @@
1
- .coupdoeil--hovercard.hidden {
1
+ .coupdoeil--popover.hidden {
2
2
  display: none
3
3
  }
4
4
 
5
- .coupdoeil--hovercard[data-animation] {
6
- &.hovercard-enter {
5
+ .coupdoeil--popover[data-animation] {
6
+ &.popover-enter {
7
7
  transition-timing-function: cubic-bezier(0.4, 0, 1, 1);
8
8
  }
9
- &.hovercard-leave {
9
+ &.popover-leave {
10
10
  transition-timing-function: cubic-bezier(0, 0, 0.2, 1);
11
11
  }
12
- &.hovercard-enter, &.hovercard-leave {
12
+ &.popover-enter, &.popover-leave {
13
13
  transition-property: opacity, transform;
14
14
  transition-duration: 150ms;
15
15
  }
16
16
 
17
- &.hovercard-enter-end, &.hovercard-leave-start {
17
+ &.popover-enter-end, &.popover-leave-start {
18
18
  &[data-animation="fade-in"], &[data-animation="slide-in"], &[data-animation="slide-out"] {
19
19
  opacity: 1;
20
20
  }
21
21
  }
22
22
 
23
- &.hovercard-enter-start, &.hovercard-leave-end {
23
+ &.popover-enter-start, &.popover-leave-end {
24
24
  &[data-animation="fade-in"], &[data-animation="slide-in"], &[data-animation="slide-out"] {
25
25
  opacity: 0;
26
26
  }
@@ -0,0 +1,40 @@
1
+ @use 'sass:list';
2
+
3
+ .coupdoeil--popover {
4
+ & [data-popover-arrow] {
5
+ --co-popover--color: white;
6
+ --co-popover--border-color: rgb(209 213 219);
7
+ --co-popover-border-size: 1px;
8
+ --co-popover-border-style: solid;
9
+ --co-popover--size-ratio: 1;
10
+ --co-popover--height: 0.75rem;
11
+ --co-popover--width: calc(var(--co-popover--height) / var(--co-popover--size-ratio));
12
+
13
+ position: absolute;
14
+ height: var(--co-popover--height);
15
+ width: var(--co-popover--height);
16
+
17
+ &::after, &::before {
18
+ content: "";
19
+ width: 0;
20
+ height: 0;
21
+ position: absolute;
22
+ bottom: 0;
23
+ border: var(--co-popover--base-border-width) var(--co-popover-border-style) transparent;
24
+ }
25
+
26
+ &::after {
27
+ --co-popover--base-border-width: var(--co-popover--width);
28
+ border-bottom-color: var(--co-popover--color);
29
+ left: calc(50% - var(--co-popover--width));
30
+ }
31
+ &::before {
32
+ --co-popover--base-border-width: calc(var(--co-popover--height) + var(--co-popover-border-size));
33
+ border-bottom-color: var(--co-popover--border-color);
34
+ left: calc(50% - var(--co-popover--width) - var(--co-popover-border-size));
35
+ }
36
+ }
37
+ &[data-placement|="top"] [data-popover-arrow] { transform: rotate(180deg); }
38
+ &[data-placement|="right"] [data-popover-arrow] { transform: rotate(-90deg); }
39
+ &[data-placement|="left"] [data-popover-arrow] { transform: rotate(90deg); }
40
+ }
@@ -0,0 +1,2 @@
1
+ @use "popover-animation";
2
+ @use "popover-arrow";
data/config/routes.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  Coupdoeil::Engine.routes.draw do
2
- resource :hovercard, only: :create
2
+ resource :popover, only: :create
3
3
  end
@@ -22,15 +22,15 @@ module Coupdoeil
22
22
  # If you just want to remove specific css:
23
23
  #
24
24
  # config.after_initialize do
25
- # config.assets.precompile -= %w[coupdoeil/hovercard-arrow.css]
25
+ # config.assets.precompile -= %w[coupdoeil/popover-arrow.css]
26
26
  # end
27
27
  PRECOMPILE_ASSETS = %w[
28
28
  coupdoeil.js
29
29
  coupdoeil.min.js
30
30
  coupdoeil.min.js.map
31
- coupdoeil/hovercard.css
32
- coupdoeil/hovercard-arrow.css
33
- coupdoeil/hovercard-animation.css
31
+ coupdoeil/popover.css
32
+ coupdoeil/popover-arrow.css
33
+ coupdoeil/popover-animation.css
34
34
  ]
35
35
 
36
36
  initializer "coupdoeil.assets" do
@@ -55,15 +55,15 @@ module Coupdoeil
55
55
  initializer "coupdoeil.view_paths" do
56
56
  config.to_prepare do
57
57
  views = Rails.application.config.paths["app/views"].existent
58
- views += Rails.application.config.paths.add("app/hovercards").existent
59
- views += Rails.application.config.paths.add("app/hovercards/layouts").existent
60
- Coupdoeil::Hovercard.prepend_view_path(views)
58
+ views += Rails.application.config.paths.add("app/popovers").existent
59
+ views += Rails.application.config.paths.add("app/popovers/layouts").existent
60
+ Coupdoeil::Popover.prepend_view_path(views)
61
61
  end
62
62
  end
63
63
 
64
64
  initializer "coupdoeil.routes" do |app|
65
65
  app.routes.append do
66
- post "coupdoeil/hovercard", to: "coupdoeil/hovercards#create"
66
+ post "coupdoeil/popover", to: "coupdoeil/popovers#create"
67
67
  end
68
68
  end
69
69
  end
@@ -1,3 +1,3 @@
1
1
  module Coupdoeil
2
- VERSION = "1.0.0-beta.1"
2
+ VERSION = "1.0.0-beta.2"
3
3
  end
@@ -1,17 +1,17 @@
1
1
  class Coupdoeil::InstallGenerator < Rails::Generators::Base
2
2
  Coupdoeil::InstallGenerator.source_root Coupdoeil::Engine.root.join("lib/generators/coupdoeil/install/templates")
3
3
 
4
- desc "Create base class for hovercards and default layout."
4
+ desc "Create base class for popovers and default layout."
5
5
 
6
6
  def create_base_class
7
- create_file "app/hovercards/application_hovercard.rb", <<~RUBY
8
- class ApplicationHovercard < Coupdoeil::Hovercard
7
+ create_file "app/popovers/application_popover.rb", <<~RUBY
8
+ class ApplicationPopover < Coupdoeil::Popover
9
9
  end
10
10
  RUBY
11
11
  end
12
12
 
13
13
  def insert_default_layout
14
- template "layout.html.erb.tt", "app/hovercards/layouts/hovercard.html.erb"
14
+ template "layout.html.erb.tt", "app/popovers/layouts/popover.html.erb"
15
15
  end
16
16
 
17
17
  def install_javascripts
@@ -55,17 +55,17 @@ class Coupdoeil::InstallGenerator < Rails::Generators::Base
55
55
  end
56
56
 
57
57
  def import_stylesheet
58
- puts "To use Coupdoeil hovercard style, add to your layout's head:"
58
+ puts "To use Coupdoeil popover style, add to your layout's head:"
59
59
  puts ""
60
60
  puts <<-ERB
61
- <%= stylesheet_link_tag "coupdoeil/hovercard" %>
61
+ <%= stylesheet_link_tag "coupdoeil/popover" %>
62
62
  ERB
63
63
  puts ""
64
64
  puts "Or one of two:"
65
65
  puts ""
66
66
  puts <<-ERB
67
- <%= stylesheet_link_tag "coupdoeil/hovercard-arrow" %>
68
- <%= stylesheet_link_tag "coupdoeil/hovercard-animation" %>
67
+ <%= stylesheet_link_tag "coupdoeil/popover-arrow" %>
68
+ <%= stylesheet_link_tag "coupdoeil/popover-animation" %>
69
69
  ERB
70
70
  end
71
71
 
@@ -8,6 +8,6 @@
8
8
  border-radius: 0.25rem;
9
9
  "
10
10
  >
11
- <div data-hovercard-arrow></div>
11
+ <div data-popover-arrow></div>
12
12
  <%%= yield %>
13
13
  </div>
@@ -0,0 +1,15 @@
1
+ Description:
2
+ Create Popover class and views files.
3
+
4
+ Example:
5
+ bin/rails generate popover Contact details from_project
6
+
7
+ creates the following files:
8
+ app/popovers/contact_popover.rb
9
+ app/views/contact_popover/details.html.erb
10
+ app/views/contact_popover/from_project.html.erb
11
+
12
+ bin/rails generate popover Contact details from_project --skip-views
13
+
14
+ creates only the class file:
15
+ app/popovers/contact_popover.rb
@@ -0,0 +1,22 @@
1
+ class Coupdoeil::PopoverGenerator < Rails::Generators::NamedBase
2
+ source_root File.expand_path("templates", __dir__)
3
+
4
+ check_class_collision suffix: "Popover"
5
+
6
+ class_option :skip_views, type: :boolean, desc: "Skip view files", default: false
7
+
8
+ argument :action_names, type: :array, default: []
9
+
10
+ def create_popover_file
11
+ template "popover.rb",
12
+ File.join("app/popovers", class_path, "#{file_name}_popover.rb")
13
+ unless options.skip_views?
14
+ action_names.each do |action_name|
15
+ path = [*class_path, file_name].join('/')
16
+ create_file "app/popovers/#{path}_popover/#{action_name}.html.erb", <<~ERB
17
+ <p>Hello from #{class_name}Popover##{action_name}</p>
18
+ ERB
19
+ end
20
+ end
21
+ end
22
+ end
@@ -1,5 +1,5 @@
1
1
  <% module_namespacing do -%>
2
- class <%= class_name %>Hovercard < ApplicationHovercard
2
+ class <%= class_name %>Popover < ApplicationPopover
3
3
  <% action_names.each do |action_name| -%>
4
4
  def <%= action_name %>
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coupdoeil
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre.beta.1
4
+ version: 1.0.0.pre.beta.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - PageHey
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-05-27 00:00:00.000000000 Z
10
+ date: 2025-06-13 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: actionpack
@@ -127,7 +127,7 @@ dependencies:
127
127
  - - ">="
128
128
  - !ruby/object:Gem::Version
129
129
  version: '0'
130
- description: Easy and powerful hovercard system for Ruby On Rails.
130
+ description: Easy and powerful popover system for Ruby On Rails.
131
131
  email:
132
132
  - pagehey@pm.me
133
133
  executables: []
@@ -143,56 +143,56 @@ files:
143
143
  - app/assets/javascripts/coupdoeil.min.js
144
144
  - app/assets/javascripts/coupdoeil.min.js.map
145
145
  - app/assets/stylesheets/coupdoeil/application.css
146
- - app/assets/stylesheets/coupdoeil/hovercard-animation.css
147
- - app/assets/stylesheets/coupdoeil/hovercard-arrow.css
148
- - app/assets/stylesheets/coupdoeil/hovercard.css
149
- - app/controllers/coupdoeil/hovercards_controller.rb
146
+ - app/assets/stylesheets/coupdoeil/popover-animation.css
147
+ - app/assets/stylesheets/coupdoeil/popover-arrow.css
148
+ - app/assets/stylesheets/coupdoeil/popover.css
149
+ - app/controllers/coupdoeil/popovers_controller.rb
150
150
  - app/helpers/coupdoeil/application_helper.rb
151
151
  - app/javascript/coupdoeil/elements/coupdoeil_element.js
152
152
  - app/javascript/coupdoeil/events.js
153
153
  - app/javascript/coupdoeil/events/onclick.js
154
154
  - app/javascript/coupdoeil/events/onmouseover.js
155
- - app/javascript/coupdoeil/hovercard.js
156
- - app/javascript/coupdoeil/hovercard/actions.js
157
- - app/javascript/coupdoeil/hovercard/attributes.js
158
- - app/javascript/coupdoeil/hovercard/cache.js
159
- - app/javascript/coupdoeil/hovercard/closing.js
160
- - app/javascript/coupdoeil/hovercard/config.js
161
- - app/javascript/coupdoeil/hovercard/controller.js
162
- - app/javascript/coupdoeil/hovercard/current.js
163
- - app/javascript/coupdoeil/hovercard/opening.js
164
- - app/javascript/coupdoeil/hovercard/optionsParser.js
165
- - app/javascript/coupdoeil/hovercard/positioning.js
166
- - app/javascript/coupdoeil/hovercard/state_check.js
167
155
  - app/javascript/coupdoeil/index.js
168
- - app/models/coupdoeil/hovercard.rb
169
- - app/models/coupdoeil/hovercard/option.rb
170
- - app/models/coupdoeil/hovercard/option/animation.rb
171
- - app/models/coupdoeil/hovercard/option/cache.rb
172
- - app/models/coupdoeil/hovercard/option/loading.rb
173
- - app/models/coupdoeil/hovercard/option/offset.rb
174
- - app/models/coupdoeil/hovercard/option/opening_delay.rb
175
- - app/models/coupdoeil/hovercard/option/placement.rb
176
- - app/models/coupdoeil/hovercard/option/trigger.rb
177
- - app/models/coupdoeil/hovercard/options_set.rb
178
- - app/models/coupdoeil/hovercard/registry.rb
179
- - app/models/coupdoeil/hovercard/setup.rb
180
- - app/models/coupdoeil/hovercard/view_context_delegation.rb
156
+ - app/javascript/coupdoeil/popover.js
157
+ - app/javascript/coupdoeil/popover/actions.js
158
+ - app/javascript/coupdoeil/popover/attributes.js
159
+ - app/javascript/coupdoeil/popover/cache.js
160
+ - app/javascript/coupdoeil/popover/closing.js
161
+ - app/javascript/coupdoeil/popover/config.js
162
+ - app/javascript/coupdoeil/popover/controller.js
163
+ - app/javascript/coupdoeil/popover/current.js
164
+ - app/javascript/coupdoeil/popover/opening.js
165
+ - app/javascript/coupdoeil/popover/optionsParser.js
166
+ - app/javascript/coupdoeil/popover/positioning.js
167
+ - app/javascript/coupdoeil/popover/state_check.js
181
168
  - app/models/coupdoeil/params.rb
169
+ - app/models/coupdoeil/popover.rb
170
+ - app/models/coupdoeil/popover/option.rb
171
+ - app/models/coupdoeil/popover/option/animation.rb
172
+ - app/models/coupdoeil/popover/option/cache.rb
173
+ - app/models/coupdoeil/popover/option/loading.rb
174
+ - app/models/coupdoeil/popover/option/offset.rb
175
+ - app/models/coupdoeil/popover/option/opening_delay.rb
176
+ - app/models/coupdoeil/popover/option/placement.rb
177
+ - app/models/coupdoeil/popover/option/trigger.rb
178
+ - app/models/coupdoeil/popover/options_set.rb
179
+ - app/models/coupdoeil/popover/registry.rb
180
+ - app/models/coupdoeil/popover/setup.rb
181
+ - app/models/coupdoeil/popover/view_context_delegation.rb
182
182
  - app/models/coupdoeil/tag.rb
183
- - app/style/hovercard-animation.scss
184
- - app/style/hovercard-arrow.scss
185
- - app/style/hovercard.scss
183
+ - app/style/popover-animation.scss
184
+ - app/style/popover-arrow.scss
185
+ - app/style/popover.scss
186
186
  - app/views/layouts/coupdoeil/application.html.erb
187
187
  - config/routes.rb
188
188
  - lib/coupdoeil.rb
189
189
  - lib/coupdoeil/engine.rb
190
190
  - lib/coupdoeil/version.rb
191
- - lib/generators/coupdoeil/hovercard/USAGE
192
- - lib/generators/coupdoeil/hovercard/hovercard_generator.rb
193
- - lib/generators/coupdoeil/hovercard/templates/hovercard.rb.tt
194
191
  - lib/generators/coupdoeil/install/install_generator.rb
195
192
  - lib/generators/coupdoeil/install/templates/layout.html.erb.tt
193
+ - lib/generators/coupdoeil/popover/USAGE
194
+ - lib/generators/coupdoeil/popover/popover_generator.rb
195
+ - lib/generators/coupdoeil/popover/templates/popover.rb.tt
196
196
  - lib/tasks/coupdoeil_tasks.rake
197
197
  homepage: https://coupdoeil.org
198
198
  licenses:
@@ -217,5 +217,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
217
217
  requirements: []
218
218
  rubygems_version: 3.6.2
219
219
  specification_version: 4
220
- summary: A framework to easily handle hovercards.
220
+ summary: A framework to easily create popovers.
221
221
  test_files: []
@@ -1,44 +0,0 @@
1
- .coupdoeil--hovercard.hidden {
2
- display: none;
3
- }
4
-
5
- .coupdoeil--hovercard[data-animation].hovercard-enter {
6
- transition-timing-function: cubic-bezier(0.4, 0, 1, 1);
7
- }
8
- .coupdoeil--hovercard[data-animation].hovercard-leave {
9
- transition-timing-function: cubic-bezier(0, 0, 0.2, 1);
10
- }
11
- .coupdoeil--hovercard[data-animation].hovercard-enter, .coupdoeil--hovercard[data-animation].hovercard-leave {
12
- transition-property: opacity, transform;
13
- transition-duration: 150ms;
14
- }
15
- .coupdoeil--hovercard[data-animation].hovercard-enter-end[data-animation=fade-in], .coupdoeil--hovercard[data-animation].hovercard-enter-end[data-animation=slide-in], .coupdoeil--hovercard[data-animation].hovercard-enter-end[data-animation=slide-out], .coupdoeil--hovercard[data-animation].hovercard-leave-start[data-animation=fade-in], .coupdoeil--hovercard[data-animation].hovercard-leave-start[data-animation=slide-in], .coupdoeil--hovercard[data-animation].hovercard-leave-start[data-animation=slide-out] {
16
- opacity: 1;
17
- }
18
- .coupdoeil--hovercard[data-animation].hovercard-enter-start[data-animation=fade-in], .coupdoeil--hovercard[data-animation].hovercard-enter-start[data-animation=slide-in], .coupdoeil--hovercard[data-animation].hovercard-enter-start[data-animation=slide-out], .coupdoeil--hovercard[data-animation].hovercard-leave-end[data-animation=fade-in], .coupdoeil--hovercard[data-animation].hovercard-leave-end[data-animation=slide-in], .coupdoeil--hovercard[data-animation].hovercard-leave-end[data-animation=slide-out] {
19
- opacity: 0;
20
- }
21
- .coupdoeil--hovercard[data-animation].hovercard-enter-start[data-placement|=right][data-animation=slide-in], .coupdoeil--hovercard[data-animation].hovercard-leave-end[data-placement|=right][data-animation=slide-in] {
22
- transform: translateX(1rem);
23
- }
24
- .coupdoeil--hovercard[data-animation].hovercard-enter-start[data-placement|=right][data-animation=slide-out], .coupdoeil--hovercard[data-animation].hovercard-leave-end[data-placement|=right][data-animation=slide-out] {
25
- transform: translateX(-1rem);
26
- }
27
- .coupdoeil--hovercard[data-animation].hovercard-enter-start[data-placement|=left][data-animation=slide-in], .coupdoeil--hovercard[data-animation].hovercard-leave-end[data-placement|=left][data-animation=slide-in] {
28
- transform: translateX(-1rem);
29
- }
30
- .coupdoeil--hovercard[data-animation].hovercard-enter-start[data-placement|=left][data-animation=slide-out], .coupdoeil--hovercard[data-animation].hovercard-leave-end[data-placement|=left][data-animation=slide-out] {
31
- transform: translateX(1rem);
32
- }
33
- .coupdoeil--hovercard[data-animation].hovercard-enter-start[data-placement|=top][data-animation=slide-in], .coupdoeil--hovercard[data-animation].hovercard-leave-end[data-placement|=top][data-animation=slide-in] {
34
- transform: translateY(-1rem);
35
- }
36
- .coupdoeil--hovercard[data-animation].hovercard-enter-start[data-placement|=top][data-animation=slide-out], .coupdoeil--hovercard[data-animation].hovercard-leave-end[data-placement|=top][data-animation=slide-out] {
37
- transform: translateY(1rem);
38
- }
39
- .coupdoeil--hovercard[data-animation].hovercard-enter-start[data-placement|=bottom][data-animation=slide-in], .coupdoeil--hovercard[data-animation].hovercard-leave-end[data-placement|=bottom][data-animation=slide-in] {
40
- transform: translateY(1rem);
41
- }
42
- .coupdoeil--hovercard[data-animation].hovercard-enter-start[data-placement|=bottom][data-animation=slide-out], .coupdoeil--hovercard[data-animation].hovercard-leave-end[data-placement|=bottom][data-animation=slide-out] {
43
- transform: translateY(-1rem);
44
- }
@@ -1,39 +0,0 @@
1
- .coupdoeil--hovercard [data-hovercard-arrow] {
2
- --co-hovercard--color: white;
3
- --co-hovercard--border-color: rgb(209 213 219);
4
- --co-hovercard-border-size: 1px;
5
- --co-hovercard-border-style: solid;
6
- --co-hovercard--size-ratio: 1;
7
- --co-hovercard--height: 0.75rem;
8
- --co-hovercard--width: calc(var(--co-hovercard--height) / var(--co-hovercard--size-ratio));
9
- position: absolute;
10
- height: var(--co-hovercard--height);
11
- width: var(--co-hovercard--height);
12
- }
13
- .coupdoeil--hovercard [data-hovercard-arrow]::after, .coupdoeil--hovercard [data-hovercard-arrow]::before {
14
- content: "";
15
- width: 0;
16
- height: 0;
17
- position: absolute;
18
- bottom: 0;
19
- border: var(--co-hovercard--base-border-width) var(--co-hovercard-border-style) transparent;
20
- }
21
- .coupdoeil--hovercard [data-hovercard-arrow]::after {
22
- --co-hovercard--base-border-width: var(--co-hovercard--width);
23
- border-bottom-color: var(--co-hovercard--color);
24
- left: calc(50% - var(--co-hovercard--width));
25
- }
26
- .coupdoeil--hovercard [data-hovercard-arrow]::before {
27
- --co-hovercard--base-border-width: calc(var(--co-hovercard--height) + var(--co-hovercard-border-size));
28
- border-bottom-color: var(--co-hovercard--border-color);
29
- left: calc(50% - var(--co-hovercard--width) - var(--co-hovercard-border-size));
30
- }
31
- .coupdoeil--hovercard[data-placement|=top] [data-hovercard-arrow] {
32
- transform: rotate(180deg);
33
- }
34
- .coupdoeil--hovercard[data-placement|=right] [data-hovercard-arrow] {
35
- transform: rotate(-90deg);
36
- }
37
- .coupdoeil--hovercard[data-placement|=left] [data-hovercard-arrow] {
38
- transform: rotate(90deg);
39
- }
@@ -1,84 +0,0 @@
1
- .coupdoeil--hovercard.hidden {
2
- display: none;
3
- }
4
-
5
- .coupdoeil--hovercard[data-animation].hovercard-enter {
6
- transition-timing-function: cubic-bezier(0.4, 0, 1, 1);
7
- }
8
- .coupdoeil--hovercard[data-animation].hovercard-leave {
9
- transition-timing-function: cubic-bezier(0, 0, 0.2, 1);
10
- }
11
- .coupdoeil--hovercard[data-animation].hovercard-enter, .coupdoeil--hovercard[data-animation].hovercard-leave {
12
- transition-property: opacity, transform;
13
- transition-duration: 150ms;
14
- }
15
- .coupdoeil--hovercard[data-animation].hovercard-enter-end[data-animation=fade-in], .coupdoeil--hovercard[data-animation].hovercard-enter-end[data-animation=slide-in], .coupdoeil--hovercard[data-animation].hovercard-enter-end[data-animation=slide-out], .coupdoeil--hovercard[data-animation].hovercard-leave-start[data-animation=fade-in], .coupdoeil--hovercard[data-animation].hovercard-leave-start[data-animation=slide-in], .coupdoeil--hovercard[data-animation].hovercard-leave-start[data-animation=slide-out] {
16
- opacity: 1;
17
- }
18
- .coupdoeil--hovercard[data-animation].hovercard-enter-start[data-animation=fade-in], .coupdoeil--hovercard[data-animation].hovercard-enter-start[data-animation=slide-in], .coupdoeil--hovercard[data-animation].hovercard-enter-start[data-animation=slide-out], .coupdoeil--hovercard[data-animation].hovercard-leave-end[data-animation=fade-in], .coupdoeil--hovercard[data-animation].hovercard-leave-end[data-animation=slide-in], .coupdoeil--hovercard[data-animation].hovercard-leave-end[data-animation=slide-out] {
19
- opacity: 0;
20
- }
21
- .coupdoeil--hovercard[data-animation].hovercard-enter-start[data-placement|=right][data-animation=slide-in], .coupdoeil--hovercard[data-animation].hovercard-leave-end[data-placement|=right][data-animation=slide-in] {
22
- transform: translateX(1rem);
23
- }
24
- .coupdoeil--hovercard[data-animation].hovercard-enter-start[data-placement|=right][data-animation=slide-out], .coupdoeil--hovercard[data-animation].hovercard-leave-end[data-placement|=right][data-animation=slide-out] {
25
- transform: translateX(-1rem);
26
- }
27
- .coupdoeil--hovercard[data-animation].hovercard-enter-start[data-placement|=left][data-animation=slide-in], .coupdoeil--hovercard[data-animation].hovercard-leave-end[data-placement|=left][data-animation=slide-in] {
28
- transform: translateX(-1rem);
29
- }
30
- .coupdoeil--hovercard[data-animation].hovercard-enter-start[data-placement|=left][data-animation=slide-out], .coupdoeil--hovercard[data-animation].hovercard-leave-end[data-placement|=left][data-animation=slide-out] {
31
- transform: translateX(1rem);
32
- }
33
- .coupdoeil--hovercard[data-animation].hovercard-enter-start[data-placement|=top][data-animation=slide-in], .coupdoeil--hovercard[data-animation].hovercard-leave-end[data-placement|=top][data-animation=slide-in] {
34
- transform: translateY(-1rem);
35
- }
36
- .coupdoeil--hovercard[data-animation].hovercard-enter-start[data-placement|=top][data-animation=slide-out], .coupdoeil--hovercard[data-animation].hovercard-leave-end[data-placement|=top][data-animation=slide-out] {
37
- transform: translateY(1rem);
38
- }
39
- .coupdoeil--hovercard[data-animation].hovercard-enter-start[data-placement|=bottom][data-animation=slide-in], .coupdoeil--hovercard[data-animation].hovercard-leave-end[data-placement|=bottom][data-animation=slide-in] {
40
- transform: translateY(1rem);
41
- }
42
- .coupdoeil--hovercard[data-animation].hovercard-enter-start[data-placement|=bottom][data-animation=slide-out], .coupdoeil--hovercard[data-animation].hovercard-leave-end[data-placement|=bottom][data-animation=slide-out] {
43
- transform: translateY(-1rem);
44
- }
45
-
46
- .coupdoeil--hovercard [data-hovercard-arrow] {
47
- --co-hovercard--color: white;
48
- --co-hovercard--border-color: rgb(209 213 219);
49
- --co-hovercard-border-size: 1px;
50
- --co-hovercard-border-style: solid;
51
- --co-hovercard--size-ratio: 1;
52
- --co-hovercard--height: 0.75rem;
53
- --co-hovercard--width: calc(var(--co-hovercard--height) / var(--co-hovercard--size-ratio));
54
- position: absolute;
55
- height: var(--co-hovercard--height);
56
- width: var(--co-hovercard--height);
57
- }
58
- .coupdoeil--hovercard [data-hovercard-arrow]::after, .coupdoeil--hovercard [data-hovercard-arrow]::before {
59
- content: "";
60
- width: 0;
61
- height: 0;
62
- position: absolute;
63
- bottom: 0;
64
- border: var(--co-hovercard--base-border-width) var(--co-hovercard-border-style) transparent;
65
- }
66
- .coupdoeil--hovercard [data-hovercard-arrow]::after {
67
- --co-hovercard--base-border-width: var(--co-hovercard--width);
68
- border-bottom-color: var(--co-hovercard--color);
69
- left: calc(50% - var(--co-hovercard--width));
70
- }
71
- .coupdoeil--hovercard [data-hovercard-arrow]::before {
72
- --co-hovercard--base-border-width: calc(var(--co-hovercard--height) + var(--co-hovercard-border-size));
73
- border-bottom-color: var(--co-hovercard--border-color);
74
- left: calc(50% - var(--co-hovercard--width) - var(--co-hovercard-border-size));
75
- }
76
- .coupdoeil--hovercard[data-placement|=top] [data-hovercard-arrow] {
77
- transform: rotate(180deg);
78
- }
79
- .coupdoeil--hovercard[data-placement|=right] [data-hovercard-arrow] {
80
- transform: rotate(-90deg);
81
- }
82
- .coupdoeil--hovercard[data-placement|=left] [data-hovercard-arrow] {
83
- transform: rotate(90deg);
84
- }
@@ -1,22 +0,0 @@
1
- import {getParams, getType, preloadedContentElement} from './attributes'
2
-
3
- export const hovercardContentHTMLMap = new Map()
4
-
5
- function cacheMapKey(controller) {
6
- if (preloadedContentElement(controller)) {
7
- return controller.coupdoeilElement.uniqueId
8
- }
9
- return getType(controller) + getParams(controller)
10
- }
11
-
12
- export function getHovercardContentHTML(controller) {
13
- return hovercardContentHTMLMap.get(cacheMapKey(controller))
14
- }
15
-
16
- export function setHovercardContentHTML(controller, value) {
17
- hovercardContentHTMLMap.set(cacheMapKey(controller), value)
18
- }
19
-
20
- export function clearHovercardContentCache() {
21
- hovercardContentHTMLMap.clear()
22
- }
@@ -1,20 +0,0 @@
1
- export class HovercardController {
2
- constructor(coupdoeilElement) {
3
- this.coupdoeilElement = coupdoeilElement
4
-
5
- this.card = null // can go on coupdoeil element, renamed 'hovercardElement'
6
-
7
- this.children = new Set() // can go on hovercardElement
8
- this.parent = null // can go on hovercardElement
9
-
10
- this.closingRequest = null // can go on coupdoeil element
11
- }
12
-
13
- get isOpen() {
14
- return !!this.coupdoeilElement.dataset.hovercardOpen
15
- }
16
-
17
- get isClosed() {
18
- return !this.isOpen
19
- }
20
- }
@@ -1,13 +0,0 @@
1
- export const CURRENT_HOVERCARDS_BY_ID = new Map()
2
-
3
- export function currentHovercardsById() {
4
- return CURRENT_HOVERCARDS_BY_ID
5
- }
6
-
7
- export function addToCurrents(coupdoeilElement) {
8
- CURRENT_HOVERCARDS_BY_ID.set(coupdoeilElement.uniqueId, coupdoeilElement)
9
- }
10
-
11
- export function removeFromCurrents(coupdoeilElement) {
12
- CURRENT_HOVERCARDS_BY_ID.delete(coupdoeilElement.uniqueId)
13
- }