superglue 2.0.0.alpha.2 → 2.0.0.alpha.8
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 +4 -4
- data/app/channels/superglue/streams/broadcasts.rb +3 -0
- data/app/channels/superglue/streams/stream_name.rb +3 -0
- data/app/channels/superglue/streams_channel.rb +3 -0
- data/app/controllers/concerns/superglue/request_id_tracking.rb +3 -0
- data/app/helpers/superglue/streams_helper.rb +4 -1
- data/app/jobs/superglue/streams/action_broadcast_job.rb +3 -0
- data/app/jobs/superglue/streams/broadcast_stream_job.rb +3 -0
- data/app/models/concerns/superglue/broadcastable.rb +4 -1
- data/app/models/superglue/debouncer.rb +3 -0
- data/app/models/superglue/thread_debouncer.rb +3 -0
- data/lib/generators/superglue/install/install_generator.rb +1 -1
- data/lib/generators/superglue/install/templates/application.json.props +2 -0
- data/lib/generators/superglue/install/templates/js/application.jsx +1 -1
- data/lib/generators/superglue/install/templates/js/application_visit.js +1 -1
- data/lib/generators/superglue/install/templates/js/store.js +3 -2
- data/lib/generators/superglue/install/templates/ts/application.tsx +10 -9
- data/lib/generators/superglue/install/templates/ts/application_visit.ts +1 -1
- data/lib/generators/superglue/install/templates/ts/store.ts +2 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3239bf29458613c97b65cba82454502a2f3aa7c7862b56fb6f7c35b93eaa52ae
|
4
|
+
data.tar.gz: c7a4f01902228e4509fcc53be51f5c242e4c4c8ee7d6fe8786220a920ce608a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 149bee1ac1801fef07d29e7cadecdb62a6c681e97b1711b0f33e9a196ea9cf8521803fdddf1dbeb1c8dfbd45224149dfe2451772846ba0fd22f5beacb6151148
|
7
|
+
data.tar.gz: 388e7ce6dbb46710b12011ea38bfd8367b9961e300524f3a86eea53bf9e29c581616eebb92683d1bb0d5672ebb426bade3168c8276b1bbf06a9ba942cff7c1bb
|
@@ -1,3 +1,6 @@
|
|
1
|
+
# This file was ported from the amazing folks at turbo-rails
|
2
|
+
# You can find its MIT License here: https://github.com/hotwired/turbo-rails/blob/main/MIT-LICENSE
|
3
|
+
|
1
4
|
module Superglue::Streams::Broadcasts
|
2
5
|
def broadcast_save_to(*streamables, **opts)
|
3
6
|
broadcast_action_to(*streamables, action: :save, **opts)
|
@@ -1,3 +1,6 @@
|
|
1
|
+
# This file was ported from the amazing folks at turbo-rails
|
2
|
+
# You can find its MIT License here: https://github.com/hotwired/turbo-rails/blob/main/MIT-LICENSE
|
3
|
+
|
1
4
|
module Superglue::Streams::StreamName
|
2
5
|
def verified_stream_name(signed_stream_name)
|
3
6
|
Superglue.signed_stream_verifier.verified signed_stream_name
|
@@ -1,3 +1,6 @@
|
|
1
|
+
# This file was ported from the amazing folks at turbo-rails
|
2
|
+
# You can find its MIT License here: https://github.com/hotwired/turbo-rails/blob/main/MIT-LICENSE
|
3
|
+
|
1
4
|
class Superglue::StreamsChannel < ActionCable::Channel::Base
|
2
5
|
extend Superglue::Streams::StreamName
|
3
6
|
extend Superglue::Streams::Broadcasts
|
@@ -1,3 +1,6 @@
|
|
1
|
+
# This file was ported from the amazing folks at turbo-rails
|
2
|
+
# You can find its MIT License here: https://github.com/hotwired/turbo-rails/blob/main/MIT-LICENSE
|
3
|
+
|
1
4
|
module Superglue::StreamsHelper
|
2
5
|
def stream_from_props(*streamables, **attributes)
|
3
6
|
raise ArgumentError, "streamables can't be blank" unless streamables.any?(&:present?)
|
@@ -33,7 +36,7 @@ module Superglue::StreamsHelper
|
|
33
36
|
broadcast_action_props(action: "append", model:, target:, options:, **rendering)
|
34
37
|
end
|
35
38
|
|
36
|
-
def broadcast_save_props(model: nil,
|
39
|
+
def broadcast_save_props(model: nil, target: nil, options: {}, **rendering)
|
37
40
|
if model && !target
|
38
41
|
target = fragment_id(model)
|
39
42
|
end
|
@@ -1,3 +1,6 @@
|
|
1
|
+
# This file was ported from the amazing folks at turbo-rails
|
2
|
+
# You can find its MIT License here: https://github.com/hotwired/turbo-rails/blob/main/MIT-LICENSE
|
3
|
+
|
1
4
|
class Superglue::Streams::ActionBroadcastJob < ActiveJob::Base
|
2
5
|
discard_on ActiveJob::DeserializationError
|
3
6
|
|
@@ -1,3 +1,6 @@
|
|
1
|
+
# This file was ported from the amazing folks at turbo-rails
|
2
|
+
# You can find its MIT License here: https://github.com/hotwired/turbo-rails/blob/main/MIT-LICENSE
|
3
|
+
|
1
4
|
class Superglue::Streams::BroadcastStreamJob < ActiveJob::Base
|
2
5
|
discard_on ActiveJob::DeserializationError
|
3
6
|
|
@@ -1,3 +1,6 @@
|
|
1
|
+
# This file was ported from the amazing folks at turbo-rails
|
2
|
+
# You can find its MIT License here: https://github.com/hotwired/turbo-rails/blob/main/MIT-LICENSE
|
3
|
+
|
1
4
|
module Superglue::Broadcastable
|
2
5
|
extend ActiveSupport::Concern
|
3
6
|
|
@@ -129,7 +132,7 @@ module Superglue::Broadcastable
|
|
129
132
|
def broadcast_target_default
|
130
133
|
self.class.broadcast_target_default
|
131
134
|
end
|
132
|
-
|
135
|
+
|
133
136
|
private
|
134
137
|
|
135
138
|
def extract_options_and_add_target(rendering = {}, target: broadcast_target_default)
|
@@ -40,7 +40,7 @@ module Superglue
|
|
40
40
|
insert_jsx_rendering_defaults
|
41
41
|
|
42
42
|
say "Installing Superglue and friends"
|
43
|
-
run "yarn add react react-dom @reduxjs/toolkit react-redux @thoughtbot/superglue@2.0.0-alpha.
|
43
|
+
run "yarn add react react-dom @reduxjs/toolkit react-redux @thoughtbot/superglue@2.0.0-alpha.8"
|
44
44
|
|
45
45
|
if use_typescript
|
46
46
|
run "yarn add -D @types/react-dom @types/react @types/node @thoughtbot/candy_wrapper"
|
@@ -5,7 +5,7 @@ import { buildVisitAndRemote } from "./application_visit"
|
|
5
5
|
import { pageIdentifierToPageComponent } from "./page_to_page_mapping"
|
6
6
|
import { store } from "./store"
|
7
7
|
|
8
|
-
if (typeof window !== "undefined") {
|
8
|
+
if (typeof window !== "undefined" && window.SUPERGLUE_INITIAL_PAGE_STATE) {
|
9
9
|
document.addEventListener("DOMContentLoaded", function() {
|
10
10
|
const appEl = document.getElementById("app")
|
11
11
|
const location = window.location
|
@@ -9,7 +9,7 @@ import { visit, remote } from "@thoughtbot/superglue/action_creators"
|
|
9
9
|
* bar. This file also adds support for data-sg-remote.
|
10
10
|
*/
|
11
11
|
export const buildVisitAndRemote = (ref, store) => {
|
12
|
-
const appRemote = (path, { dataset, ...options }) => {
|
12
|
+
const appRemote = (path, { dataset, ...options } = {}) => {
|
13
13
|
/**
|
14
14
|
* You can make use of `dataset` to add custom UJS options.
|
15
15
|
* If you are implementing a progress bar, you can selectively
|
@@ -8,7 +8,7 @@ import {
|
|
8
8
|
rootReducer
|
9
9
|
} from "@thoughtbot/superglue"
|
10
10
|
|
11
|
-
const { pages, superglue } = rootReducer
|
11
|
+
const { pages, superglue, fragments } = rootReducer
|
12
12
|
|
13
13
|
export const store = configureStore({
|
14
14
|
devTools: process.env.NODE_ENV !== "production",
|
@@ -21,7 +21,8 @@ export const store = configureStore({
|
|
21
21
|
reducer: {
|
22
22
|
superglue,
|
23
23
|
pages,
|
24
|
-
flash: flashSlice.reducer
|
24
|
+
flash: flashSlice.reducer,
|
25
|
+
fragments,
|
25
26
|
}
|
26
27
|
})
|
27
28
|
|
@@ -1,15 +1,17 @@
|
|
1
|
-
import React from
|
2
|
-
import { createRoot } from
|
3
|
-
import { Application,
|
4
|
-
import { buildVisitAndRemote } from
|
5
|
-
import { pageIdentifierToPageComponent } from
|
6
|
-
import { store } from
|
1
|
+
import React from "react";
|
2
|
+
import { createRoot } from "react-dom/client";
|
3
|
+
import { Application, SaveResponse } from "@thoughtbot/superglue";
|
4
|
+
import { buildVisitAndRemote } from "./application_visit";
|
5
|
+
import { pageIdentifierToPageComponent } from "./page_to_page_mapping";
|
6
|
+
import { store } from "./store";
|
7
7
|
|
8
8
|
declare global {
|
9
|
-
interface Window {
|
9
|
+
interface Window {
|
10
|
+
SUPERGLUE_INITIAL_PAGE_STATE: SaveResponse;
|
11
|
+
}
|
10
12
|
}
|
11
13
|
|
12
|
-
if (typeof window !== "undefined") {
|
14
|
+
if (typeof window !== "undefined" && window.SUPERGLUE_INITIAL_PAGE_STATE) {
|
13
15
|
document.addEventListener("DOMContentLoaded", function () {
|
14
16
|
const appEl = document.getElementById("app");
|
15
17
|
const location = window.location;
|
@@ -37,4 +39,3 @@ if (typeof window !== "undefined") {
|
|
37
39
|
}
|
38
40
|
});
|
39
41
|
}
|
40
|
-
|
@@ -18,7 +18,7 @@ export const buildVisitAndRemote: BuildVisitAndRemote = (
|
|
18
18
|
ref,
|
19
19
|
store: SuperglueStore
|
20
20
|
) => {
|
21
|
-
const appRemote: ApplicationRemote = (path, { dataset, ...options }) => {
|
21
|
+
const appRemote: ApplicationRemote = (path, { dataset, ...options } = {}) => {
|
22
22
|
/**
|
23
23
|
* You can make use of `dataset` to add custom UJS options.
|
24
24
|
* If you are implementing a progress bar, you can selectively
|
@@ -8,7 +8,7 @@ import {
|
|
8
8
|
rootReducer,
|
9
9
|
} from "@thoughtbot/superglue";
|
10
10
|
|
11
|
-
const { pages, superglue } = rootReducer;
|
11
|
+
const { pages, superglue, fragments } = rootReducer;
|
12
12
|
|
13
13
|
export const store = configureStore({
|
14
14
|
devTools: process.env.NODE_ENV !== "production",
|
@@ -22,6 +22,7 @@ export const store = configureStore({
|
|
22
22
|
superglue,
|
23
23
|
pages,
|
24
24
|
flash: flashSlice.reducer,
|
25
|
+
fragments,
|
25
26
|
},
|
26
27
|
});
|
27
28
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: superglue
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.alpha.
|
4
|
+
version: 2.0.0.alpha.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Johny Ho
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-08-
|
11
|
+
date: 2025-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|