ultimate_turbo_modal 2.0.1 → 2.0.3
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/CHANGELOG.md +5 -1
- data/Gemfile.lock +1 -1
- data/VERSION +1 -1
- data/javascript/modal_controller.js +21 -0
- data/javascript/package.json +2 -1
- data/javascript/rollup.config.js +12 -1
- data/javascript/scripts/release-npm.sh +4 -4
- data/javascript/yarn.lock +16 -1
- data/lib/ultimate_turbo_modal/base.rb +27 -21
- data/script/build_and_release.sh +9 -0
- metadata +1 -2
- data/javascript/package-lock.json +0 -1114
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 774a6e86a2192eb41f8846c91b0fb73ac2b8a47c2811813e62e64bc25fdb35c6
|
4
|
+
data.tar.gz: 76902c6b109986fc96bfdc9dddb3750d90a46a083e9b1ac16e7ba81ebb062005
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1e0a2edf44c64902f10c945b869ba033898208f139420589e1a5647eba929d4c33767142061b9ec5c653798d3bc80ae9e36d3115765e8d0dad7998bbc283a10
|
7
|
+
data.tar.gz: b0664d14275e26d6866a3772d6972c8a9229fce8f4226f56ece6471b12824e22365f85f361bca3ee16bcef0915f9813e2630df54bcf151f23d2203fa12fa4dad
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.
|
1
|
+
2.0.3
|
@@ -1,6 +1,9 @@
|
|
1
1
|
import { Controller } from '@hotwired/stimulus';
|
2
2
|
import { enter, leave } from 'el-transition';
|
3
3
|
|
4
|
+
// This placeholder will be replaced by rollup
|
5
|
+
const PACKAGE_VERSION = '__PACKAGE_VERSION__';
|
6
|
+
|
4
7
|
export default class extends Controller {
|
5
8
|
static targets = ["container", "content"]
|
6
9
|
static values = {
|
@@ -10,6 +13,9 @@ export default class extends Controller {
|
|
10
13
|
|
11
14
|
connect() {
|
12
15
|
let _this = this;
|
16
|
+
|
17
|
+
this.#checkVersions();
|
18
|
+
|
13
19
|
this.showModal();
|
14
20
|
|
15
21
|
this.turboFrame = this.element.closest('turbo-frame');
|
@@ -105,4 +111,19 @@ export default class extends Controller {
|
|
105
111
|
#resetHistoryAdvanced() {
|
106
112
|
document.body.removeAttribute("data-turbo-modal-history-advanced");
|
107
113
|
}
|
114
|
+
|
115
|
+
#checkVersions() {
|
116
|
+
const gemVersion = this.element.dataset.utmrVersion;
|
117
|
+
|
118
|
+
if (!gemVersion) {
|
119
|
+
// If the attribute isn't set (e.g., in production), skip the check.
|
120
|
+
return;
|
121
|
+
}
|
122
|
+
|
123
|
+
if (gemVersion !== PACKAGE_VERSION) {
|
124
|
+
console.warn(
|
125
|
+
`[UltimateTurboModal] Version Mismatch!\n\nGem Version: ${gemVersion}\nJS Version: ${PACKAGE_VERSION}\n\nPlease ensure both the 'ultimate_turbo_modal' gem and the 'ultimate-turbo-modal' npm package are updated to the same version.\nElement:`, this.element
|
126
|
+
);
|
127
|
+
}
|
128
|
+
}
|
108
129
|
}
|
data/javascript/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "ultimate_turbo_modal",
|
3
|
-
"version": "2.0.
|
3
|
+
"version": "2.0.2",
|
4
4
|
"description": "The ultimate Turbo / Stimulus / Hotwire modal window for Rails",
|
5
5
|
"main": "dist/ultimate_turbo_modal.min.js",
|
6
6
|
"module": "dist/ultimate_turbo_modal.min.js",
|
@@ -39,6 +39,7 @@
|
|
39
39
|
},
|
40
40
|
"devDependencies": {
|
41
41
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
42
|
+
"@rollup/plugin-replace": "^6.0.2",
|
42
43
|
"rollup": "^2.79.1",
|
43
44
|
"rollup-plugin-copy": "^3.5.0",
|
44
45
|
"rollup-plugin-css-only": "^4.3.0",
|
data/javascript/rollup.config.js
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
import resolve from '@rollup/plugin-node-resolve';
|
2
2
|
import css from 'rollup-plugin-css-only';
|
3
3
|
import { terser } from 'rollup-plugin-terser';
|
4
|
+
import replace from '@rollup/plugin-replace';
|
5
|
+
import { readFileSync } from 'fs';
|
6
|
+
|
7
|
+
const pkg = JSON.parse(readFileSync('./package.json', 'utf8'));
|
8
|
+
const packageVersion = pkg.version;
|
4
9
|
|
5
10
|
export default {
|
6
11
|
input: './index.js',
|
@@ -19,6 +24,12 @@ export default {
|
|
19
24
|
inlineDynamicImports: true,
|
20
25
|
plugins: [
|
21
26
|
resolve(),
|
22
|
-
css({ output: 'vanilla.css' })
|
27
|
+
css({ output: 'vanilla.css' }),
|
28
|
+
replace({
|
29
|
+
preventAssignment: true,
|
30
|
+
values: {
|
31
|
+
'__PACKAGE_VERSION__': packageVersion
|
32
|
+
}
|
33
|
+
})
|
23
34
|
]
|
24
35
|
};
|
@@ -9,15 +9,15 @@ fi
|
|
9
9
|
|
10
10
|
# Update version
|
11
11
|
echo "Updating version in package.json..."
|
12
|
-
|
12
|
+
yarn update-version
|
13
13
|
|
14
14
|
# Install dependencies
|
15
15
|
echo "Installing dependencies..."
|
16
|
-
|
16
|
+
yarn install
|
17
17
|
|
18
18
|
# Build project
|
19
19
|
echo "Building project..."
|
20
|
-
|
20
|
+
yarn build
|
21
21
|
|
22
22
|
# Add, commit, and push changes
|
23
23
|
VERSION=$(cat ../VERSION)
|
@@ -30,6 +30,6 @@ git push
|
|
30
30
|
|
31
31
|
# Publish to npm
|
32
32
|
echo "Publishing to npm..."
|
33
|
-
|
33
|
+
yarn publish
|
34
34
|
|
35
35
|
echo "Release complete!"
|
data/javascript/yarn.lock
CHANGED
@@ -61,7 +61,7 @@
|
|
61
61
|
"@jridgewell/gen-mapping" "^0.3.5"
|
62
62
|
"@jridgewell/trace-mapping" "^0.3.25"
|
63
63
|
|
64
|
-
"@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14":
|
64
|
+
"@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14", "@jridgewell/sourcemap-codec@^1.5.0":
|
65
65
|
version "1.5.0"
|
66
66
|
resolved "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz"
|
67
67
|
integrity sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==
|
@@ -111,6 +111,14 @@
|
|
111
111
|
is-module "^1.0.0"
|
112
112
|
resolve "^1.22.1"
|
113
113
|
|
114
|
+
"@rollup/plugin-replace@^6.0.2":
|
115
|
+
version "6.0.2"
|
116
|
+
resolved "https://registry.npmjs.org/@rollup/plugin-replace/-/plugin-replace-6.0.2.tgz"
|
117
|
+
integrity sha512-7QaYCf8bqF04dOy7w/eHmJeNExxTYwvKAmlSAH/EaWWUzbT0h5sbF6bktFoX/0F/0qwng5/dWFMyf3gzaM8DsQ==
|
118
|
+
dependencies:
|
119
|
+
"@rollup/pluginutils" "^5.0.1"
|
120
|
+
magic-string "^0.30.3"
|
121
|
+
|
114
122
|
"@rollup/pluginutils@5", "@rollup/pluginutils@^5.0.1":
|
115
123
|
version "5.1.4"
|
116
124
|
resolved "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.1.4.tgz"
|
@@ -406,6 +414,13 @@ jsonfile@^4.0.0:
|
|
406
414
|
optionalDependencies:
|
407
415
|
graceful-fs "^4.1.6"
|
408
416
|
|
417
|
+
magic-string@^0.30.3:
|
418
|
+
version "0.30.17"
|
419
|
+
resolved "https://registry.npmjs.org/magic-string/-/magic-string-0.30.17.tgz"
|
420
|
+
integrity sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==
|
421
|
+
dependencies:
|
422
|
+
"@jridgewell/sourcemap-codec" "^1.5.0"
|
423
|
+
|
409
424
|
merge-stream@^2.0.0:
|
410
425
|
version "2.0.0"
|
411
426
|
resolved "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz"
|
@@ -138,32 +138,38 @@ class UltimateTurboModal::Base < Phlex::HTML
|
|
138
138
|
end
|
139
139
|
|
140
140
|
def div_dialog(&block)
|
141
|
+
data_attributes = {
|
142
|
+
controller: "modal",
|
143
|
+
modal_target: "container",
|
144
|
+
modal_advance_url_value: advance_url,
|
145
|
+
modal_allowed_click_outside_selector_value: allowed_click_outside_selector,
|
146
|
+
action: "turbo:submit-end->modal#submitEnd keyup@window->modal#closeWithKeyboard click@window->modal#outsideModalClicked click->modal#outsideModalClicked",
|
147
|
+
transition_enter: "ease-out duration-100",
|
148
|
+
transition_enter_start: "opacity-0",
|
149
|
+
transition_enter_end: "opacity-100",
|
150
|
+
transition_leave: "ease-in duration-50",
|
151
|
+
transition_leave_start: "opacity-100",
|
152
|
+
transition_leave_end: "opacity-0",
|
153
|
+
padding: padding?.to_s,
|
154
|
+
title: title?.to_s,
|
155
|
+
header: header?.to_s,
|
156
|
+
close_button: close_button?.to_s,
|
157
|
+
header_divider: header_divider?.to_s,
|
158
|
+
footer_divider: footer_divider?.to_s
|
159
|
+
}
|
160
|
+
|
161
|
+
if defined?(Rails) && (Rails.env.development? || Rails.env.test?)
|
162
|
+
data_attributes[:utmr_version] = UltimateTurboModal::VERSION
|
163
|
+
end
|
164
|
+
|
141
165
|
div(id: "modal-container",
|
142
166
|
class: self.class::DIV_DIALOG_CLASSES,
|
143
167
|
role: "dialog",
|
144
168
|
aria: {
|
145
|
-
|
146
|
-
|
169
|
+
modal: true,
|
170
|
+
labelledby: "modal-title-h"
|
147
171
|
},
|
148
|
-
data:
|
149
|
-
controller: "modal",
|
150
|
-
modal_target: "container",
|
151
|
-
modal_advance_url_value: advance_url,
|
152
|
-
modal_allowed_click_outside_selector_value: allowed_click_outside_selector,
|
153
|
-
action: "turbo:submit-end->modal#submitEnd keyup@window->modal#closeWithKeyboard click@window->modal#outsideModalClicked click->modal#outsideModalClicked",
|
154
|
-
transition_enter: "ease-out duration-100",
|
155
|
-
transition_enter_start: "opacity-0",
|
156
|
-
transition_enter_end: "opacity-100",
|
157
|
-
transition_leave: "ease-in duration-50",
|
158
|
-
transition_leave_start: "opacity-100",
|
159
|
-
transition_leave_end: "opacity-0",
|
160
|
-
padding: padding?.to_s,
|
161
|
-
title: title?.to_s,
|
162
|
-
header: header?.to_s,
|
163
|
-
close_button: close_button?.to_s,
|
164
|
-
header_divider: header_divider?.to_s,
|
165
|
-
footer_divider: footer_divider?.to_s
|
166
|
-
}, &block)
|
172
|
+
data: data_attributes, &block)
|
167
173
|
end
|
168
174
|
|
169
175
|
def div_overlay
|
data/script/build_and_release.sh
CHANGED
@@ -22,6 +22,15 @@ fi
|
|
22
22
|
if [ "$1" != "--skip-gem" ]; then
|
23
23
|
echo "Building and releasing gem..."
|
24
24
|
bundle exec rake build
|
25
|
+
|
26
|
+
# Check if Gemfile.lock is git dirty
|
27
|
+
if ! git diff --quiet Gemfile.lock; then
|
28
|
+
echo "Gemfile.lock is dirty. Adding, committing, and pushing."
|
29
|
+
git add Gemfile.lock
|
30
|
+
git commit -m "Update Gemfile.lock"
|
31
|
+
bundle exec rake build
|
32
|
+
fi
|
33
|
+
|
25
34
|
bundle exec rake release
|
26
35
|
else
|
27
36
|
echo "Skipping gem build and release..."
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ultimate_turbo_modal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carl Mercier
|
@@ -86,7 +86,6 @@ files:
|
|
86
86
|
- VERSION
|
87
87
|
- javascript/index.js
|
88
88
|
- javascript/modal_controller.js
|
89
|
-
- javascript/package-lock.json
|
90
89
|
- javascript/package.json
|
91
90
|
- javascript/rollup.config.js
|
92
91
|
- javascript/scripts/release-npm.sh
|