katalyst-kpop 3.4.0 → 4.0.0.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 (47) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +92 -74
  3. data/app/assets/builds/katalyst/kpop.esm.js +463 -457
  4. data/app/assets/builds/katalyst/kpop.js +463 -457
  5. data/app/assets/builds/katalyst/kpop.min.js +1 -1
  6. data/app/assets/builds/katalyst/kpop.min.js.map +1 -1
  7. data/app/assets/stylesheets/katalyst/kpop.css +69 -0
  8. data/app/components/kpop/frame_component.html.erb +3 -14
  9. data/app/components/kpop/frame_component.rb +15 -11
  10. data/app/components/kpop/modal_component.html.erb +7 -6
  11. data/app/components/kpop/modal_component.rb +12 -31
  12. data/app/controllers/concerns/katalyst/kpop/frame_request.rb +67 -8
  13. data/app/javascript/kpop/application.js +68 -7
  14. data/app/javascript/kpop/controllers/frame_controller.js +96 -66
  15. data/app/javascript/kpop/modals/content_modal.js +2 -58
  16. data/app/javascript/kpop/modals/frame_modal.js +19 -76
  17. data/app/javascript/kpop/modals/modal.js +96 -49
  18. data/app/javascript/kpop/modals/stream_modal.js +11 -62
  19. data/app/javascript/kpop/utils/debug.js +22 -0
  20. data/app/javascript/kpop/utils/link_observer.js +151 -0
  21. data/app/javascript/kpop/utils/ruleset.js +43 -0
  22. data/app/javascript/kpop/utils/stream_actions.js +21 -0
  23. data/app/views/layouts/kpop/frame.html.erb +3 -1
  24. data/app/views/layouts/kpop/stream.html.erb +3 -0
  25. data/lib/katalyst/kpop/engine.rb +1 -8
  26. data/lib/katalyst/kpop/matchers/modal_matcher.rb +1 -1
  27. data/lib/katalyst/kpop/matchers/src_matcher.rb +33 -0
  28. data/lib/katalyst/kpop/matchers.rb +11 -40
  29. metadata +8 -19
  30. data/app/assets/stylesheets/katalyst/kpop/_frame.scss +0 -90
  31. data/app/assets/stylesheets/katalyst/kpop/_modal.scss +0 -88
  32. data/app/assets/stylesheets/katalyst/kpop/_scrim.scss +0 -46
  33. data/app/assets/stylesheets/katalyst/kpop/_side_panel.scss +0 -64
  34. data/app/assets/stylesheets/katalyst/kpop/_variables.scss +0 -24
  35. data/app/assets/stylesheets/katalyst/kpop.scss +0 -6
  36. data/app/components/kpop/modal/footer_component.rb +0 -21
  37. data/app/components/kpop/modal/header_component.rb +0 -21
  38. data/app/components/kpop/modal/title_component.html.erb +0 -6
  39. data/app/components/kpop/modal/title_component.rb +0 -28
  40. data/app/components/scrim_component.rb +0 -32
  41. data/app/helpers/kpop_helper.rb +0 -32
  42. data/app/javascript/kpop/controllers/modal_controller.js +0 -30
  43. data/app/javascript/kpop/controllers/scrim_controller.js +0 -159
  44. data/app/javascript/kpop/debug.js +0 -3
  45. data/app/javascript/kpop/turbo_actions.js +0 -46
  46. data/app/javascript/kpop/utils/stream_renderer.js +0 -15
  47. data/lib/katalyst/kpop/turbo.rb +0 -49
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: katalyst-kpop
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.0
4
+ version: 4.0.0.beta.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katalyst Interactive
@@ -63,35 +63,24 @@ files:
63
63
  - app/assets/builds/katalyst/kpop.min.js
64
64
  - app/assets/builds/katalyst/kpop.min.js.map
65
65
  - app/assets/config/katalyst-kpop.js
66
- - app/assets/stylesheets/katalyst/kpop.scss
67
- - app/assets/stylesheets/katalyst/kpop/_frame.scss
68
- - app/assets/stylesheets/katalyst/kpop/_modal.scss
69
- - app/assets/stylesheets/katalyst/kpop/_scrim.scss
70
- - app/assets/stylesheets/katalyst/kpop/_side_panel.scss
71
- - app/assets/stylesheets/katalyst/kpop/_variables.scss
66
+ - app/assets/stylesheets/katalyst/kpop.css
72
67
  - app/components/kpop/frame_component.html.erb
73
68
  - app/components/kpop/frame_component.rb
74
- - app/components/kpop/modal/footer_component.rb
75
- - app/components/kpop/modal/header_component.rb
76
- - app/components/kpop/modal/title_component.html.erb
77
- - app/components/kpop/modal/title_component.rb
78
69
  - app/components/kpop/modal_component.html.erb
79
70
  - app/components/kpop/modal_component.rb
80
- - app/components/scrim_component.rb
81
71
  - app/controllers/concerns/katalyst/kpop/frame_request.rb
82
- - app/helpers/kpop_helper.rb
83
72
  - app/javascript/kpop/application.js
84
73
  - app/javascript/kpop/controllers/frame_controller.js
85
- - app/javascript/kpop/controllers/modal_controller.js
86
- - app/javascript/kpop/controllers/scrim_controller.js
87
- - app/javascript/kpop/debug.js
88
74
  - app/javascript/kpop/modals/content_modal.js
89
75
  - app/javascript/kpop/modals/frame_modal.js
90
76
  - app/javascript/kpop/modals/modal.js
91
77
  - app/javascript/kpop/modals/stream_modal.js
92
- - app/javascript/kpop/turbo_actions.js
93
- - app/javascript/kpop/utils/stream_renderer.js
78
+ - app/javascript/kpop/utils/debug.js
79
+ - app/javascript/kpop/utils/link_observer.js
80
+ - app/javascript/kpop/utils/ruleset.js
81
+ - app/javascript/kpop/utils/stream_actions.js
94
82
  - app/views/layouts/kpop/frame.html.erb
83
+ - app/views/layouts/kpop/stream.html.erb
95
84
  - config/importmap.rb
96
85
  - lib/katalyst/kpop.rb
97
86
  - lib/katalyst/kpop/engine.rb
@@ -104,10 +93,10 @@ files:
104
93
  - lib/katalyst/kpop/matchers/modal_matcher.rb
105
94
  - lib/katalyst/kpop/matchers/redirect_matcher.rb
106
95
  - lib/katalyst/kpop/matchers/response_matcher.rb
96
+ - lib/katalyst/kpop/matchers/src_matcher.rb
107
97
  - lib/katalyst/kpop/matchers/stream_matcher.rb
108
98
  - lib/katalyst/kpop/matchers/title_finder.rb
109
99
  - lib/katalyst/kpop/matchers/title_matcher.rb
110
- - lib/katalyst/kpop/turbo.rb
111
100
  homepage: https://github.com/katalyst/kpop
112
101
  licenses:
113
102
  - MIT
@@ -1,90 +0,0 @@
1
- @use "variables" as *;
2
-
3
- .kpop--container {
4
- display: none;
5
-
6
- position: fixed;
7
- left: 0;
8
- top: 0;
9
- right: 0;
10
- bottom: 0;
11
-
12
- align-items: center;
13
- z-index: 100;
14
- pointer-events: none;
15
-
16
- > * {
17
- pointer-events: auto;
18
- }
19
- }
20
-
21
- .kpop--frame {
22
- --opening-animation: slide-in-up;
23
- --closing-animation: slide-out-down;
24
-
25
- position: relative;
26
- display: grid;
27
- margin: 0 auto;
28
-
29
- --min-width: #{$min-width};
30
- --max-width: #{$max-width};
31
- --min-height: #{$min-height};
32
- --max-height: #{$max-height};
33
-
34
- min-width: var(--min-width);
35
- max-width: var(--max-width);
36
- min-height: var(--min-height);
37
- max-height: var(--max-height);
38
-
39
- grid-template-columns: min(var(--max-width), max(var(--min-width), 100%));
40
- grid-template-rows: min(var(--max-height), max(var(--min-height), 100%));
41
- }
42
-
43
- @media (max-width: $mobile-width), (max-height: $mobile-height) {
44
- .kpop--frame {
45
- --min-width: 100dvw;
46
- --max-width: 100dvw;
47
- --min-height: 30dvh;
48
- --max-height: calc(100dvh - 1.5rem);
49
- }
50
- }
51
-
52
- .scrim[data-scrim-open-value="false"] + .kpop--container .kpop--frame {
53
- display: none;
54
- }
55
-
56
- .scrim[data-hide-animating]
57
- + .kpop--container
58
- .kpop--frame[data-kpop--frame-open-value="true"] {
59
- animation: var(--closing-animation);
60
- animation-duration: $duration;
61
- animation-fill-mode: forwards;
62
- }
63
-
64
- .scrim[data-show-animating] + .kpop--container .kpop--frame {
65
- animation: var(--opening-animation);
66
- animation-duration: $duration;
67
- animation-fill-mode: forwards;
68
- }
69
-
70
- @keyframes slide-in-up {
71
- 0% {
72
- transform: translateY(10%);
73
- opacity: 0;
74
- }
75
- 100% {
76
- transform: translateY(0%);
77
- opacity: 1;
78
- }
79
- }
80
-
81
- @keyframes slide-out-down {
82
- 0% {
83
- transform: translateY(0%);
84
- opacity: 1;
85
- }
86
- 100% {
87
- transform: translateY(10%);
88
- opacity: 0;
89
- }
90
- }
@@ -1,88 +0,0 @@
1
- @use "variables" as *;
2
-
3
- .kpop-modal {
4
- display: grid;
5
- grid-template-areas:
6
- "title-bar"
7
- "header"
8
- "content"
9
- "footer";
10
- grid-template-rows: auto auto 1fr auto;
11
-
12
- background-color: white;
13
- border-radius: $border-radius;
14
- overflow: hidden;
15
- max-height: var(--max-height);
16
- box-shadow:
17
- rgb(0 0 0 / 25%) 0 1px 2px,
18
- rgb(0 0 0 / 31%) 0 0 5px;
19
-
20
- .kpop-title-bar {
21
- grid-area: title-bar;
22
- display: grid;
23
- grid-template-areas: "close title empty";
24
- grid-template-columns: 3.5rem auto 3.5rem;
25
- border-bottom: 1px solid $keyline-color;
26
- min-height: 3.5rem;
27
- align-items: center;
28
- }
29
-
30
- .kpop-header {
31
- grid-area: header;
32
- }
33
-
34
- .kpop-content {
35
- grid-area: content;
36
- display: flex;
37
- flex-direction: column;
38
- overflow: auto;
39
- }
40
-
41
- .kpop-footer {
42
- grid-area: footer;
43
- border-top: 1px solid $keyline-color;
44
- padding: $default-padding;
45
- }
46
-
47
- .kpop-title {
48
- grid-area: title;
49
- font-weight: bold;
50
- text-align: center;
51
- white-space: nowrap;
52
- overflow: hidden;
53
- text-overflow: ellipsis;
54
- line-height: 3.5rem;
55
- }
56
-
57
- .kpop-close {
58
- grid-area: close;
59
- text-align: center;
60
- background: none;
61
- border: none;
62
- display: block;
63
- font-size: 2rem;
64
- font-weight: 300;
65
- text-decoration: none;
66
- line-height: 3.5rem;
67
- }
68
-
69
- .button-set {
70
- display: flex;
71
- gap: var(--gap, 0.5rem);
72
- justify-content: flex-end;
73
- align-items: baseline;
74
- }
75
-
76
- &.iframe {
77
- .kpop-content {
78
- overflow: unset;
79
- }
80
-
81
- iframe {
82
- height: var(--max-height);
83
- width: var(--max-width);
84
- flex-grow: 1;
85
- overflow: scroll;
86
- }
87
- }
88
- }
@@ -1,46 +0,0 @@
1
- @use "variables" as *;
2
-
3
- .scrim {
4
- position: fixed;
5
- top: 0;
6
- bottom: 0;
7
- left: 0;
8
- right: 0;
9
- background: $scrim-background;
10
- z-index: -1;
11
- opacity: 0;
12
-
13
- &[data-hide-animating] {
14
- animation: fade-out;
15
- animation-duration: $duration;
16
- animation-fill-mode: forwards;
17
- }
18
-
19
- &[data-show-animating] {
20
- animation: fade-in;
21
- animation-duration: $duration;
22
- animation-fill-mode: forwards;
23
- }
24
- }
25
-
26
- .scrim[data-scrim-open-value="true"] {
27
- opacity: 1;
28
- }
29
-
30
- @keyframes fade-in {
31
- 0% {
32
- opacity: 0;
33
- }
34
- 100% {
35
- opacity: 1;
36
- }
37
- }
38
-
39
- @keyframes fade-out {
40
- 0% {
41
- opacity: 1;
42
- }
43
- 100% {
44
- opacity: 0;
45
- }
46
- }
@@ -1,64 +0,0 @@
1
- @use "variables" as *;
2
-
3
- .kpop--frame.side-panel {
4
- --opening-animation: slide-in-right;
5
- --closing-animation: slide-out-right;
6
- --min-width: 35dvw;
7
- --max-width: calc(100dvw - 4rem);
8
- --min-height: 100dvh;
9
- --max-height: 100dvh;
10
-
11
- margin-inline: auto 0;
12
- align-self: flex-end;
13
-
14
- @include mobile {
15
- & {
16
- --opening-animation: slide-in-bottom;
17
- --closing-animation: slide-out-bottom;
18
- --min-width: 100dvw;
19
- --max-width: 100dvw;
20
- --min-height: 50dvh;
21
- --max-height: calc(100dvh - 1.5rem);
22
- }
23
- }
24
-
25
- .kpop-modal {
26
- border-radius: 0;
27
- }
28
- }
29
-
30
- @keyframes slide-in-right {
31
- 0% {
32
- transform: translateX(100%);
33
- }
34
- 100% {
35
- transform: translateX(0%);
36
- }
37
- }
38
-
39
- @keyframes slide-out-right {
40
- 0% {
41
- transform: translateX(0%);
42
- }
43
- 100% {
44
- transform: translateX(100%);
45
- }
46
- }
47
-
48
- @keyframes slide-in-bottom {
49
- 0% {
50
- transform: translateY(100%);
51
- }
52
- 100% {
53
- transform: translateY(0%);
54
- }
55
- }
56
-
57
- @keyframes slide-out-bottom {
58
- 0% {
59
- transform: translateY(0%);
60
- }
61
- 100% {
62
- transform: translateY(100%);
63
- }
64
- }
@@ -1,24 +0,0 @@
1
- // frame variables
2
- $min-width: 35rem !default;
3
- $max-width: 52rem !default;
4
- $min-height: 0 !default;
5
- $max-height: 80dvh !default;
6
- $duration: 0.2s !default;
7
-
8
- // breakpoints
9
- $mobile-width: 600px !default;
10
- $mobile-height: 400px !default;
11
-
12
- @mixin mobile {
13
- @media (max-width: $mobile-width), (max-height: $mobile-height) {
14
- @content;
15
- }
16
- }
17
-
18
- // modal variables
19
- $border-radius: 0.5rem !default;
20
- $default-padding: 1rem 1.5rem !default;
21
- $keyline-color: #e0e0e0 !default;
22
-
23
- // scrim variables
24
- $scrim-background: rgba(0, 0, 0, 0.6) !default;
@@ -1,6 +0,0 @@
1
- @forward "kpop/variables";
2
-
3
- @use "kpop/scrim";
4
- @use "kpop/frame";
5
- @use "kpop/side_panel";
6
- @use "kpop/modal";
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Kpop
4
- module Modal
5
- class FooterComponent < ViewComponent::Base
6
- include Katalyst::HtmlAttributes
7
-
8
- def call
9
- tag.div(content, **html_attributes)
10
- end
11
-
12
- def inspect
13
- "#<#{self.class.name}>"
14
- end
15
-
16
- def default_html_attributes
17
- { class: "kpop-footer" }
18
- end
19
- end
20
- end
21
- end
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Kpop
4
- module Modal
5
- class HeaderComponent < ViewComponent::Base
6
- include Katalyst::HtmlAttributes
7
-
8
- def call
9
- tag.div(content, **html_attributes)
10
- end
11
-
12
- def inspect
13
- "#<#{self.class.name}>"
14
- end
15
-
16
- def default_html_attributes
17
- { class: "kpop-header" }
18
- end
19
- end
20
- end
21
- end
@@ -1,6 +0,0 @@
1
- <%= tag.div(class: "kpop-title-bar", **html_attributes) do %>
2
- <span class="kpop-title"><%= title %></span>
3
- <% unless captive? %>
4
- <button class="kpop-close" data-action="click->kpop--frame#dismiss:prevent">×</button>
5
- <% end %>
6
- <% end %>
@@ -1,28 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Kpop
4
- module Modal
5
- class TitleComponent < ViewComponent::Base
6
- include Katalyst::HtmlAttributes
7
-
8
- def initialize(title: nil, captive: false, **)
9
- super(**)
10
-
11
- @title = title
12
- @captive = captive
13
- end
14
-
15
- def title
16
- content? ? content : @title
17
- end
18
-
19
- def captive?
20
- @captive
21
- end
22
-
23
- def inspect
24
- "#<#{self.class.name} title: #{title.inspect}>"
25
- end
26
- end
27
- end
28
- end
@@ -1,32 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class ScrimComponent < ViewComponent::Base
4
- attr_reader :id, :z_index
5
-
6
- ACTIONS = %w[
7
- click->scrim#dismiss
8
- keyup@window->scrim#escape
9
- ].freeze
10
-
11
- def initialize(id: "scrim", z_index: 40)
12
- super()
13
-
14
- @id = id
15
- @z_index = z_index
16
- end
17
-
18
- def call
19
- tag.div(id:,
20
- class: "scrim",
21
- data: {
22
- controller: "scrim",
23
- scrim_z_index_value: z_index,
24
- turbo_permanent: "",
25
- action: ACTIONS.join(" "),
26
- })
27
- end
28
-
29
- def inspect
30
- "#<#{self.class.name} id: #{id.inspect}>"
31
- end
32
- end
@@ -1,32 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module KpopHelper
4
- using HTMLAttributesUtils
5
-
6
- # Renders a link that will navigate the kpop turbo frame to the given URL.
7
- # The URL should render a modal response inside a kpop frame tag.
8
- def kpop_link_to(name = nil, options = nil, html_attributes = nil, &block)
9
- default_html_attributes = { data: { turbo_frame: "kpop" } }
10
- if block
11
- # Param[name] is the path for the link
12
- link_to(name, default_html_attributes.deep_merge_html_attributes(options || {}), &block)
13
- else
14
- link_to(name, options, default_html_attributes.deep_merge_html_attributes(html_attributes || {}))
15
- end
16
- end
17
-
18
- # Renders a button that will navigate the kpop turbo frame to the given URL.
19
- # The URL should render a modal response inside a kpop frame tag.
20
- def kpop_button_to(name = nil, options = nil, html_attributes = nil, &)
21
- default_html_attributes = {
22
- form: { data: { turbo_frame: "kpop" } },
23
- }
24
- button_to(name, options, default_html_attributes.deep_merge_html_attributes(html_attributes || {}), &)
25
- end
26
-
27
- # Renders a button that will close the current kpop modal, if any.
28
- def kpop_button_close(content = nil, **, &block)
29
- content = capture(yield) if block
30
- tag.button(content, data: { action: "click->kpop--frame#dismiss:prevent" }, **)
31
- end
32
- end
@@ -1,30 +0,0 @@
1
- import { Controller } from "@hotwired/stimulus";
2
-
3
- import DEBUG from "../debug";
4
-
5
- export default class Kpop__ModalController extends Controller {
6
- static values = {
7
- fallback_location: String,
8
- layout: String,
9
- };
10
-
11
- connect() {
12
- this.debug("connect");
13
-
14
- if (this.layoutValue) {
15
- document.querySelector("#kpop").classList.toggle(this.layoutValue, true);
16
- }
17
- }
18
-
19
- disconnect() {
20
- this.debug("disconnect");
21
-
22
- if (this.layoutValue) {
23
- document.querySelector("#kpop").classList.toggle(this.layoutValue, false);
24
- }
25
- }
26
-
27
- debug(event, ...args) {
28
- if (DEBUG) console.debug(`ModalController:${event}`, ...args);
29
- }
30
- }