ultimate_turbo_modal 1.7.0 → 2.0.1
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/.tool-versions +2 -2
- data/CHANGELOG.md +11 -0
- data/Gemfile.lock +159 -156
- data/LICENSE.txt +1 -1
- data/README.md +24 -98
- data/VERSION +1 -0
- data/javascript/index.js +37 -0
- data/javascript/modal_controller.js +108 -0
- data/javascript/package-lock.json +1114 -0
- data/javascript/package.json +47 -0
- data/javascript/rollup.config.js +24 -0
- data/javascript/scripts/release-npm.sh +35 -0
- data/javascript/scripts/update-version.js +21 -0
- data/javascript/styles/vanilla.css +179 -0
- data/javascript/yarn.lock +611 -0
- data/lib/generators/ultimate_turbo_modal/install_generator.rb +224 -0
- data/lib/generators/ultimate_turbo_modal/templates/flavors/custom.rb +22 -0
- data/lib/{ultimate_turbo_modal → generators/ultimate_turbo_modal/templates}/flavors/tailwind.rb +5 -4
- data/lib/generators/ultimate_turbo_modal/templates/flavors/tailwind3.rb +21 -0
- data/lib/{ultimate_turbo_modal → generators/ultimate_turbo_modal/templates}/flavors/vanilla.rb +2 -1
- data/lib/generators/ultimate_turbo_modal/templates/ultimate_turbo_modal.rb +12 -0
- data/lib/phlex/deferred_render_with_main_content.rb +1 -1
- data/lib/ultimate_turbo_modal/base.rb +8 -0
- data/lib/ultimate_turbo_modal/railtie.rb +1 -1
- data/lib/ultimate_turbo_modal/version.rb +1 -1
- data/lib/ultimate_turbo_modal.rb +3 -3
- data/script/build_and_release.sh +39 -0
- data/yarn.lock +4 -0
- metadata +25 -18
@@ -0,0 +1,47 @@
|
|
1
|
+
{
|
2
|
+
"name": "ultimate_turbo_modal",
|
3
|
+
"version": "2.0.0",
|
4
|
+
"description": "The ultimate Turbo / Stimulus / Hotwire modal window for Rails",
|
5
|
+
"main": "dist/ultimate_turbo_modal.min.js",
|
6
|
+
"module": "dist/ultimate_turbo_modal.min.js",
|
7
|
+
"files": [
|
8
|
+
"dist"
|
9
|
+
],
|
10
|
+
"scripts": {
|
11
|
+
"update-version": "node scripts/update-version.js",
|
12
|
+
"build": "yarn install && rollup -c",
|
13
|
+
"release": "bash scripts/release-npm.sh"
|
14
|
+
},
|
15
|
+
"repository": {
|
16
|
+
"type": "git",
|
17
|
+
"url": "git+https://github.com/cmer/ultimate_turbo_modal.git"
|
18
|
+
},
|
19
|
+
"keywords": [
|
20
|
+
"hotwire",
|
21
|
+
"turbo",
|
22
|
+
"stimulus",
|
23
|
+
"tailwind",
|
24
|
+
"modal",
|
25
|
+
"rubyonrails",
|
26
|
+
"rails"
|
27
|
+
],
|
28
|
+
"author": "Carl Mercier",
|
29
|
+
"license": "MIT",
|
30
|
+
"bugs": {
|
31
|
+
"url": "https://github.com/cmer/ultimate_turbo_modal/issues"
|
32
|
+
},
|
33
|
+
"homepage": "https://github.com/cmer/ultimate_turbo_modal#readme",
|
34
|
+
"dependencies": {
|
35
|
+
"@hotwired/stimulus": "^3.2.2",
|
36
|
+
"@hotwired/turbo-rails": "^8.0.0",
|
37
|
+
"el-transition": "^0.0.7",
|
38
|
+
"idiomorph": "^0.7.3"
|
39
|
+
},
|
40
|
+
"devDependencies": {
|
41
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
42
|
+
"rollup": "^2.79.1",
|
43
|
+
"rollup-plugin-copy": "^3.5.0",
|
44
|
+
"rollup-plugin-css-only": "^4.3.0",
|
45
|
+
"rollup-plugin-terser": "^7.0.2"
|
46
|
+
}
|
47
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import resolve from '@rollup/plugin-node-resolve';
|
2
|
+
import css from 'rollup-plugin-css-only';
|
3
|
+
import { terser } from 'rollup-plugin-terser';
|
4
|
+
|
5
|
+
export default {
|
6
|
+
input: './index.js',
|
7
|
+
output: [
|
8
|
+
{
|
9
|
+
file: 'dist/ultimate_turbo_modal.js',
|
10
|
+
format: 'esm'
|
11
|
+
},
|
12
|
+
{
|
13
|
+
file: 'dist/ultimate_turbo_modal.min.js',
|
14
|
+
format: 'esm',
|
15
|
+
plugins: [terser()]
|
16
|
+
}
|
17
|
+
],
|
18
|
+
external: ['@hotwired/stimulus'],
|
19
|
+
inlineDynamicImports: true,
|
20
|
+
plugins: [
|
21
|
+
resolve(),
|
22
|
+
css({ output: 'vanilla.css' })
|
23
|
+
]
|
24
|
+
};
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
set -e
|
3
|
+
|
4
|
+
# Check for uncommitted changes
|
5
|
+
if ! git diff --quiet; then
|
6
|
+
echo "There are uncommitted changes. Aborting."
|
7
|
+
exit 1
|
8
|
+
fi
|
9
|
+
|
10
|
+
# Update version
|
11
|
+
echo "Updating version in package.json..."
|
12
|
+
npm run update-version
|
13
|
+
|
14
|
+
# Install dependencies
|
15
|
+
echo "Installing dependencies..."
|
16
|
+
npm install
|
17
|
+
|
18
|
+
# Build project
|
19
|
+
echo "Building project..."
|
20
|
+
npm run build
|
21
|
+
|
22
|
+
# Add, commit, and push changes
|
23
|
+
VERSION=$(cat ../VERSION)
|
24
|
+
echo "Adding changes to git..."
|
25
|
+
git add .
|
26
|
+
echo "Committing changes (Release NPM v$VERSION)..."
|
27
|
+
git commit -m "Release NPM v$VERSION"
|
28
|
+
echo "Pushing changes..."
|
29
|
+
git push
|
30
|
+
|
31
|
+
# Publish to npm
|
32
|
+
echo "Publishing to npm..."
|
33
|
+
npm publish
|
34
|
+
|
35
|
+
echo "Release complete!"
|
@@ -0,0 +1,21 @@
|
|
1
|
+
const fs = require('fs');
|
2
|
+
const path = require('path');
|
3
|
+
|
4
|
+
const versionFilePath = path.resolve(__dirname, '..', '..', 'VERSION');
|
5
|
+
const packageJsonPath = path.resolve(__dirname, '..', 'package.json');
|
6
|
+
|
7
|
+
// Read version from VERSION file
|
8
|
+
const version = fs.readFileSync(versionFilePath, 'utf8').trim();
|
9
|
+
|
10
|
+
// Read package.json
|
11
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
12
|
+
|
13
|
+
// Update version if it's different
|
14
|
+
if (packageJson.version !== version) {
|
15
|
+
packageJson.version = version;
|
16
|
+
// Write updated package.json, preserving indentation (2 spaces)
|
17
|
+
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n');
|
18
|
+
console.log(`Updated package.json version to ${version}`);
|
19
|
+
} else {
|
20
|
+
console.log(`package.json version (${packageJson.version}) is already up to date.`);
|
21
|
+
}
|
@@ -0,0 +1,179 @@
|
|
1
|
+
.dark {
|
2
|
+
.modal-overlay {
|
3
|
+
background-color: rgba(17, 24, 39, 0.8)
|
4
|
+
}
|
5
|
+
|
6
|
+
.modal-header,
|
7
|
+
.modal-footer {
|
8
|
+
border-color: #4B5563;
|
9
|
+
}
|
10
|
+
|
11
|
+
.modal-content {
|
12
|
+
background-color: #1F2937;
|
13
|
+
color: #ffffff;
|
14
|
+
}
|
15
|
+
|
16
|
+
.modal-close-button:hover,
|
17
|
+
.modal-close-icon:hover {
|
18
|
+
background-color: #6B7280;
|
19
|
+
color: #ffffff;
|
20
|
+
}
|
21
|
+
}
|
22
|
+
|
23
|
+
:not(.dark) {
|
24
|
+
|
25
|
+
.modal-close-button,
|
26
|
+
.modal-close-icon {
|
27
|
+
color: #9CA3AF;
|
28
|
+
|
29
|
+
&:hover {
|
30
|
+
color: #111827;
|
31
|
+
background-color: #E5E7EB;
|
32
|
+
}
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
.modal-container {
|
37
|
+
position: relative;
|
38
|
+
|
39
|
+
&[data-header="false"] .modal-header {
|
40
|
+
position: absolute;
|
41
|
+
}
|
42
|
+
|
43
|
+
&[data-header-divider="true"] .modal-header {
|
44
|
+
border-bottom-width: 1px;
|
45
|
+
}
|
46
|
+
|
47
|
+
&[data-footer-divider="true"] .modal-footer {
|
48
|
+
border-top-width: 1px;
|
49
|
+
}
|
50
|
+
|
51
|
+
&[data-padding="true"] .modal-main {
|
52
|
+
padding: 1rem;
|
53
|
+
padding-top: 0.5rem;
|
54
|
+
}
|
55
|
+
|
56
|
+
&[data-title="false"] .modal-title-h {
|
57
|
+
display: none;
|
58
|
+
}
|
59
|
+
|
60
|
+
&[data-close-button="false"] .modal-close {
|
61
|
+
display: none;
|
62
|
+
}
|
63
|
+
|
64
|
+
.sr-only {
|
65
|
+
position: absolute;
|
66
|
+
width: 1px;
|
67
|
+
height: 1px;
|
68
|
+
padding: 0;
|
69
|
+
margin: -1px;
|
70
|
+
overflow: hidden;
|
71
|
+
clip: rect(0, 0, 0, 0);
|
72
|
+
white-space: nowrap;
|
73
|
+
border-width: 0;
|
74
|
+
}
|
75
|
+
}
|
76
|
+
|
77
|
+
.modal-overlay {
|
78
|
+
position: fixed;
|
79
|
+
top: 0;
|
80
|
+
right: 0;
|
81
|
+
bottom: 0;
|
82
|
+
left: 0;
|
83
|
+
z-index: 40;
|
84
|
+
background-color: rgba(17, 24, 39, 0.7);
|
85
|
+
transition-property: opacity;
|
86
|
+
}
|
87
|
+
|
88
|
+
.modal-outer {
|
89
|
+
overflow-y: auto;
|
90
|
+
position: fixed;
|
91
|
+
top: 0;
|
92
|
+
right: 0;
|
93
|
+
bottom: 0;
|
94
|
+
left: 0;
|
95
|
+
z-index: 50;
|
96
|
+
margin: 1rem;
|
97
|
+
|
98
|
+
@media (min-width: 640px) {
|
99
|
+
margin-left: auto;
|
100
|
+
margin-right: auto;
|
101
|
+
}
|
102
|
+
|
103
|
+
@media (min-width: 768px) {
|
104
|
+
max-width: 48rem;
|
105
|
+
}
|
106
|
+
}
|
107
|
+
|
108
|
+
.modal-inner {
|
109
|
+
display: flex;
|
110
|
+
padding: 0.25rem;
|
111
|
+
justify-content: center;
|
112
|
+
align-items: center;
|
113
|
+
min-height: 100%;
|
114
|
+
|
115
|
+
@media (min-width: 640px) {
|
116
|
+
padding: 1rem;
|
117
|
+
}
|
118
|
+
}
|
119
|
+
|
120
|
+
.modal-content {
|
121
|
+
overflow: hidden;
|
122
|
+
position: relative;
|
123
|
+
background-color: #ffffff;
|
124
|
+
transition-property: all;
|
125
|
+
text-align: left;
|
126
|
+
border-radius: 0.5rem;
|
127
|
+
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
|
128
|
+
|
129
|
+
@media (min-width: 640px) {
|
130
|
+
margin-top: 2rem;
|
131
|
+
margin-bottom: 2rem;
|
132
|
+
max-width: 48rem;
|
133
|
+
}
|
134
|
+
}
|
135
|
+
|
136
|
+
.modal-header {
|
137
|
+
display: flex;
|
138
|
+
padding-top: 1rem;
|
139
|
+
padding-bottom: 1rem;
|
140
|
+
justify-content: space-between;
|
141
|
+
align-items: center;
|
142
|
+
width: 100%;
|
143
|
+
border-top-left-radius: 0.25rem;
|
144
|
+
border-top-right-radius: 0.25rem;
|
145
|
+
}
|
146
|
+
|
147
|
+
.modal-title {
|
148
|
+
line-height: 1.75rem;
|
149
|
+
font-weight: 600;
|
150
|
+
padding-left: 1rem;
|
151
|
+
}
|
152
|
+
|
153
|
+
.modal-footer {
|
154
|
+
display: flex;
|
155
|
+
padding: 1rem;
|
156
|
+
border-bottom-right-radius: 0.25rem;
|
157
|
+
border-bottom-left-radius: 0.25rem;
|
158
|
+
border-top-width: 1px;
|
159
|
+
}
|
160
|
+
|
161
|
+
.modal-close {
|
162
|
+
margin-right: 1rem;
|
163
|
+
}
|
164
|
+
|
165
|
+
.modal-close-button {
|
166
|
+
display: inline-flex;
|
167
|
+
padding: 0.375rem;
|
168
|
+
margin-left: auto;
|
169
|
+
background-color: transparent;
|
170
|
+
font-size: 0.875rem;
|
171
|
+
line-height: 1.25rem;
|
172
|
+
align-items: center;
|
173
|
+
border-radius: 0.5rem;
|
174
|
+
}
|
175
|
+
|
176
|
+
.modal-close-icon {
|
177
|
+
width: 1.25rem;
|
178
|
+
height: 1.25rem;
|
179
|
+
}
|