coveragebook_components 0.8.1 → 0.8.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fdbe09266dbf8a7a17a2585b7f83689f98aceb444ecee4031b9a128f37633575
4
- data.tar.gz: ded7beda1c6a04f02c42812624853af0a712a6830dd65c67221ade64131fdeaa
3
+ metadata.gz: 9c4d98a2f5ee6a8ac4cb3586c96f1ce982dad432a39f93a8218111d3115ecf19
4
+ data.tar.gz: 2392dca1d2c0c4c6cf4958d6eca3f44a2cf3adcb077178cc6881dd6c2db2b32d
5
5
  SHA512:
6
- metadata.gz: 00330f49dcd5dd88fb63245160f6fed81301e6cbd2306bd40059e16f0afe784abbda8f0c8afee9337c04df46e28948e0d395ead20315567a933f23345c90e7ba
7
- data.tar.gz: 208d8d398553a052f759e093d831955467d618cac80e3205062d8fe307bb7db84ed5e79120805172a1798aad20feefab040a283a907f8f94259b0e7e414c7c33
6
+ metadata.gz: 18a5ca9258c9d1b260d61f5f58fb0ec79ae8911c2094a925ed17114ae824ab1238011a9af9e5e4fd38abc87f2cd6daf37a50d6f30bbf6a0efa0d7a529dc072c4
7
+ data.tar.gz: 7ba6f310985ec3b6f6d8339349c169280241622e210efb97ec4391561aa89e848eb4781d3416ad45e45388b75b1c9a435ba0013831f214c03eecaac1a2cc7086
@@ -14038,7 +14038,7 @@
14038
14038
  var package_default = {
14039
14039
  name: "coveragebook-components",
14040
14040
  type: "module",
14041
- version: "0.8.1",
14041
+ version: "0.8.2",
14042
14042
  main: "index.js",
14043
14043
  repository: "git@github.com:coveragebook/coco.git",
14044
14044
  author: "Mark Perkins <mark@coveragebook.com>",
@@ -23681,18 +23681,21 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
23681
23681
 
23682
23682
  // helpers/location.js
23683
23683
  function navigateTo(url, options = {}) {
23684
- if (window.Turbo && options.turbo === true) {
23685
- window.Turbo.visit(url, { action: options.action || "advance" });
23684
+ if (window.Turbo && options.turbo !== false) {
23685
+ delete options.turbo;
23686
+ turboOptions = Object.assign({ action: "advance" }, options);
23687
+ window.Turbo.visit(url, turboOptions);
23686
23688
  } else {
23687
23689
  location.assign(url);
23688
23690
  }
23689
23691
  }
23690
23692
 
23691
23693
  // app/setup.js
23692
- window.addEventListener("navigate", (event) => {
23693
- const { url, turbo, action } = event.detail;
23694
+ window.addEventListener("app:navigate", (event) => {
23695
+ const url = event.detail.url;
23694
23696
  if (url) {
23695
- navigateTo(url, { turbo, action });
23697
+ delete event.detail.url;
23698
+ navigateTo(url, event.detail);
23696
23699
  }
23697
23700
  });
23698
23701
  function setAppHeightProperty() {
@@ -24020,6 +24023,9 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
24020
24023
  if (this.$options.dismissable)
24021
24024
  this.hide();
24022
24025
  },
24026
+ visit(url) {
24027
+ navigateTo(url, { frame: this.frame.id });
24028
+ },
24023
24029
  scrollTo(pos) {
24024
24030
  setTimeout(() => {
24025
24031
  this.$root.scrollTop = pos + this.contentOffsetTop;
@@ -24230,6 +24236,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
24230
24236
  return {
24231
24237
  menu: null,
24232
24238
  init() {
24239
+ this.navigateTo = navigateTo;
24233
24240
  if (this.$refs.menu) {
24234
24241
  this.menu = tippy_default(this.$el, {
24235
24242
  theme: "coco-naked-dropdown",
@@ -15194,6 +15194,19 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
15194
15194
  __export(modal_exports, {
15195
15195
  default: () => modal_default
15196
15196
  });
15197
+
15198
+ // helpers/location.js
15199
+ function navigateTo(url, options = {}) {
15200
+ if (window.Turbo && options.turbo !== false) {
15201
+ delete options.turbo;
15202
+ turboOptions = Object.assign({ action: "advance" }, options);
15203
+ window.Turbo.visit(url, turboOptions);
15204
+ } else {
15205
+ location.assign(url);
15206
+ }
15207
+ }
15208
+
15209
+ // ../../components/coco/base/modal/modal.js
15197
15210
  var modal_default = CocoComponent("modal", () => {
15198
15211
  return {
15199
15212
  open: false,
@@ -15225,6 +15238,9 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
15225
15238
  if (this.$options.dismissable)
15226
15239
  this.hide();
15227
15240
  },
15241
+ visit(url) {
15242
+ navigateTo(url, { frame: this.frame.id });
15243
+ },
15228
15244
  scrollTo(pos) {
15229
15245
  setTimeout(() => {
15230
15246
  this.$root.scrollTop = pos + this.contentOffsetTop;
@@ -2,10 +2,11 @@ import { navigateTo } from "@helpers/location";
2
2
 
3
3
  // Global JS navigation handler.
4
4
  // Optionally uses Turbo for the page navigation.
5
- window.addEventListener("navigate", (event) => {
6
- const { url, turbo, action } = event.detail;
5
+ window.addEventListener("app:navigate", (event) => {
6
+ const url = event.detail.url;
7
7
  if (url) {
8
- navigateTo(url, { turbo, action });
8
+ delete event.detail.url;
9
+ navigateTo(url, event.detail);
9
10
  }
10
11
  });
11
12
 
@@ -1,6 +1,8 @@
1
1
  function navigateTo(url, options = {}) {
2
- if (window.Turbo && options.turbo === true) {
3
- window.Turbo.visit(url, { action: options.action || "advance" });
2
+ if (window.Turbo && options.turbo !== false) {
3
+ delete options.turbo;
4
+ turboOptions = Object.assign({ action: "advance" }, options);
5
+ window.Turbo.visit(url, turboOptions);
4
6
  } else {
5
7
  location.assign(url);
6
8
  }
@@ -25,7 +25,7 @@
25
25
  <select
26
26
  x-data
27
27
  class="sidebar-nav-menu-select"
28
- @change="$dispatch('navigate', {url: $el.value})">
28
+ @change="navigateTo($el.value)">
29
29
  <% if menu_select_placeholder.present? %>
30
30
  <option disabled="disabled" selected="selected"><%= menu_select_placeholder %></option>
31
31
  <% end %>
@@ -1,11 +1,14 @@
1
1
  import tippy from "@libs/tippy";
2
2
  import { CocoComponent } from "@js/coco";
3
+ import { navigateTo } from "@helpers/location";
3
4
 
4
5
  export default CocoComponent("appSidebarNavItem", () => {
5
6
  return {
6
7
  menu: null,
7
8
 
8
9
  init() {
10
+ this.navigateTo = navigateTo;
11
+
9
12
  if (this.$refs.menu) {
10
13
  this.menu = tippy(this.$el, {
11
14
  theme: "coco-naked-dropdown",
@@ -9,6 +9,7 @@
9
9
  data: x_data("modal"),
10
10
  bind: "root",
11
11
  cloak: true,
12
+ "@modal:visit": "modal.visit($event.detail.url)"
12
13
  },
13
14
  ) do %>
14
15
  <div class="modal-overlay" x-bind="overlay"></div>
@@ -1,5 +1,6 @@
1
1
  import { CocoComponent } from "@js/coco";
2
2
  import { hideAll } from "@libs/tippy";
3
+ import { navigateTo } from "@helpers/location";
3
4
 
4
5
  export default CocoComponent("modal", () => {
5
6
  return {
@@ -38,6 +39,10 @@ export default CocoComponent("modal", () => {
38
39
  if (this.$options.dismissable) this.hide();
39
40
  },
40
41
 
42
+ visit(url) {
43
+ navigateTo(url, { frame: this.frame.id });
44
+ },
45
+
41
46
  scrollTo(pos) {
42
47
  setTimeout(() => {
43
48
  this.$root.scrollTop = pos + this.contentOffsetTop;
data/lib/coco.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Coco
2
- VERSION = "0.8.1"
2
+ VERSION = "0.8.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coveragebook_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Perkins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-25 00:00:00.000000000 Z
11
+ date: 2023-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails