sun-sword 0.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.
Files changed (57) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/.rubocop.yml +1141 -0
  4. data/CHANGELOG.md +5 -0
  5. data/LICENSE.txt +21 -0
  6. data/README.md +96 -0
  7. data/Rakefile +12 -0
  8. data/lib/generators/sun_sword/USAGE +9 -0
  9. data/lib/generators/sun_sword/frontend_generator.rb +148 -0
  10. data/lib/generators/sun_sword/scaffold_generator.rb +97 -0
  11. data/lib/generators/sun_sword/templates_frontend/Procfile.dev +1 -0
  12. data/lib/generators/sun_sword/templates_frontend/assets/config/manifest.js +1 -0
  13. data/lib/generators/sun_sword/templates_frontend/bin/watch +3 -0
  14. data/lib/generators/sun_sword/templates_frontend/config/database.yml +21 -0
  15. data/lib/generators/sun_sword/templates_frontend/config/vite.json +17 -0
  16. data/lib/generators/sun_sword/templates_frontend/controllers/application_controller.rb.tt +36 -0
  17. data/lib/generators/sun_sword/templates_frontend/controllers/dashboard/site_controller.rb +6 -0
  18. data/lib/generators/sun_sword/templates_frontend/controllers/site_controller.rb +15 -0
  19. data/lib/generators/sun_sword/templates_frontend/env.development +14 -0
  20. data/lib/generators/sun_sword/templates_frontend/frontend/assets/images/.keep +0 -0
  21. data/lib/generators/sun_sword/templates_frontend/frontend/assets/images/kotaro.ico +0 -0
  22. data/lib/generators/sun_sword/templates_frontend/frontend/assets/images/logo.svg +16 -0
  23. data/lib/generators/sun_sword/templates_frontend/frontend/assets/images/profile.jpeg +0 -0
  24. data/lib/generators/sun_sword/templates_frontend/frontend/entrypoints/application.js +17 -0
  25. data/lib/generators/sun_sword/templates_frontend/frontend/entrypoints/stimulus.js +9 -0
  26. data/lib/generators/sun_sword/templates_frontend/frontend/pages/stimulus.js +10 -0
  27. data/lib/generators/sun_sword/templates_frontend/frontend/pages/web.js +122 -0
  28. data/lib/generators/sun_sword/templates_frontend/frontend/stylesheets/application.scss +198 -0
  29. data/lib/generators/sun_sword/templates_frontend/helpers/application_helper.rb +5 -0
  30. data/lib/generators/sun_sword/templates_frontend/package.json +7 -0
  31. data/lib/generators/sun_sword/templates_frontend/postcss.config.js +6 -0
  32. data/lib/generators/sun_sword/templates_frontend/rubocop.yml.tt +1141 -0
  33. data/lib/generators/sun_sword/templates_frontend/tailwind.config.js +39 -0
  34. data/lib/generators/sun_sword/templates_frontend/views/components/_action_destroy.html.erb.tt +48 -0
  35. data/lib/generators/sun_sword/templates_frontend/views/components/_action_edit.html.erb.tt +7 -0
  36. data/lib/generators/sun_sword/templates_frontend/views/components/_action_show.html.erb.tt +8 -0
  37. data/lib/generators/sun_sword/templates_frontend/views/components/_alert.html.erb.tt +66 -0
  38. data/lib/generators/sun_sword/templates_frontend/views/components/_error_form_submit.html.erb.tt +20 -0
  39. data/lib/generators/sun_sword/templates_frontend/views/components/_link_action.html.erb.tt +9 -0
  40. data/lib/generators/sun_sword/templates_frontend/views/components/layouts/_sidebar_logo.html.erb +18 -0
  41. data/lib/generators/sun_sword/templates_frontend/views/layouts/application.html.erb.tt +42 -0
  42. data/lib/generators/sun_sword/templates_frontend/views/layouts/dashboard/_sidebar.html.erb.tt +60 -0
  43. data/lib/generators/sun_sword/templates_frontend/views/layouts/dashboard/application.html.erb.tt +71 -0
  44. data/lib/generators/sun_sword/templates_frontend/views/site/_comment.html.erb.tt +3 -0
  45. data/lib/generators/sun_sword/templates_frontend/views/site/stimulus.html.erb.tt +26 -0
  46. data/lib/generators/sun_sword/templates_frontend/vite.config.ts.tt +27 -0
  47. data/lib/generators/sun_sword/templates_scaffold/controllers/controller.rb.tt +90 -0
  48. data/lib/generators/sun_sword/templates_scaffold/example.rb.tt +2 -0
  49. data/lib/generators/sun_sword/templates_scaffold/views/_form.html.erb.tt +22 -0
  50. data/lib/generators/sun_sword/templates_scaffold/views/components/menu/link.html.erb.tt +1 -0
  51. data/lib/generators/sun_sword/templates_scaffold/views/edit.html.erb.tt +10 -0
  52. data/lib/generators/sun_sword/templates_scaffold/views/index.html.erb.tt +50 -0
  53. data/lib/generators/sun_sword/templates_scaffold/views/new.html.erb.tt +10 -0
  54. data/lib/generators/sun_sword/templates_scaffold/views/show.html.erb.tt +26 -0
  55. data/lib/sun-sword.rb +7 -0
  56. data/lib/sun_sword/version.rb +6 -0
  57. metadata +141 -0
@@ -0,0 +1,122 @@
1
+ import {Controller} from "@hotwired/stimulus"
2
+ import anime from "animejs";
3
+
4
+ export default class extends Controller {
5
+ confirmationDestroy(event) {
6
+ const chooseTypes = document.querySelectorAll(".confirmation-destroy-" + event.params.id);
7
+ chooseTypes.forEach((element) => {
8
+ element.classList.remove('hidden');
9
+ })
10
+ }
11
+
12
+ confirmationDestroyCancel(event) {
13
+ const chooseTypes = document.querySelectorAll(".confirmation-destroy-" + event.params.id);
14
+ chooseTypes.forEach((element) => {
15
+ element.classList.add('hidden');
16
+ })
17
+ }
18
+
19
+ profileSetting(event) {
20
+ console.log('Profile');
21
+ const profileSettingBrowser = document.querySelector(".profile-browser");
22
+ const profileSettingMobile = document.querySelector(".profile-mobile");
23
+ if (profileSettingBrowser.classList.contains('hidden')) {
24
+ profileSettingBrowser.classList.remove('hidden');
25
+ console.log('show');
26
+ } else {
27
+ console.log('hide');
28
+ profileSettingBrowser.classList.add('hidden');
29
+ }
30
+ if (profileSettingMobile.classList.contains('hidden')) {
31
+ profileSettingMobile.classList.remove('hidden');
32
+ console.log('show');
33
+ } else {
34
+ console.log('hide');
35
+ profileSettingMobile.classList.add('hidden');
36
+ }
37
+ }
38
+
39
+ sidebarToggle(event) {
40
+ const toggleClose = document.querySelector(".sidebar-toggle-close");
41
+ const toggeleOpen = document.querySelector(".sidebar-toggle-open");
42
+ const backdropActive = document.querySelector(".backdrop-active");
43
+ const sidebar = document.querySelector(".sidebar");
44
+ if (sidebar.classList.contains('side_hide')) {
45
+ toggleClose.classList.remove('hidden');
46
+ toggeleOpen.classList.add('hidden');
47
+ sidebar.classList.remove('side_hide');
48
+ backdropActive.classList.remove('hidden');
49
+ anime({
50
+ targets: ".backdrop-active",
51
+ translateX: 0,
52
+ opacity: [0, 0.6],
53
+ easing: 'easeInOutSine',
54
+ complete: function (anim) {
55
+ console.log('Backdrop Active');
56
+ }
57
+ })
58
+ anime({
59
+ targets: '.sidebar',
60
+ translateX: 300,
61
+ duration: 1000,
62
+ easing: 'easeInOutExpo',
63
+ complete: function (anim) {
64
+ console.log('Sidebar show!');
65
+ }
66
+ });
67
+ } else {
68
+ toggleClose.classList.add('hidden');
69
+ toggeleOpen.classList.remove('hidden');
70
+ sidebar.classList.add('side_hide');
71
+ anime({
72
+ targets: '.sidebar',
73
+ easing: 'easeInOutExpo',
74
+ translateX: -300,
75
+ duration: 1000,
76
+ complete: function (anim) {
77
+ console.log('Sidebar Close!');
78
+ }
79
+ });
80
+ anime({
81
+ targets: ".backdrop-active",
82
+ translateX: 0,
83
+ opacity: [0.6, 0],
84
+ easing: 'easeInOutSine',
85
+ complete: function (anim) {
86
+ backdropActive.classList.add('hidden');
87
+ }
88
+ })
89
+ }
90
+ }
91
+
92
+ onSidebarClick(event) {
93
+ event.preventDefault()
94
+ const url = event.target.href;
95
+ const backdropActive = document.querySelector(".backdrop-active");
96
+ const sidebar = document.querySelector(".sidebar");
97
+ if (url !== undefined) {
98
+ sidebar.classList.add('side_hide');
99
+ anime({
100
+ targets: '.sidebar',
101
+ easing: 'easeInOutExpo',
102
+ translateX: -300,
103
+ duration: 1000,
104
+ complete: function (anim) {
105
+ console.log('Sidebar Close!');
106
+ }
107
+ });
108
+ anime({
109
+ targets: ".backdrop-active",
110
+ translateX: 0,
111
+ opacity: [0.6, 0],
112
+ easing: 'easeInOutSine',
113
+ complete: function (anim) {
114
+ console.log('opacity');
115
+ backdropActive.classList.add('hidden');
116
+ Turbo.visit(url);
117
+ }
118
+ })
119
+ }
120
+ }
121
+ }
122
+
@@ -0,0 +1,198 @@
1
+ @use "tailwindcss/base";
2
+ @use "tailwindcss/components";
3
+ @use "tailwindcss/utilities";
4
+
5
+ @layer base {
6
+ * {
7
+ box-sizing: border-box;
8
+ }
9
+
10
+ *:before,
11
+ *:after {
12
+ box-sizing: border-box;
13
+ }
14
+
15
+ html {
16
+ -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
17
+ }
18
+
19
+ body {
20
+ font-family: "Open Sans", sans-serif;
21
+ font-size: 1.6rem;
22
+ line-height: 1.75;
23
+ font-weight: 300;
24
+ color: #303030;
25
+ letter-spacing: 0.045em;
26
+ background-color: #fbfbfb;
27
+ }
28
+
29
+ .tooltip {
30
+ position: relative;
31
+ }
32
+
33
+ strong {
34
+ font-weight: 500;
35
+ }
36
+
37
+ .tooltip::before {
38
+ content: "";
39
+ position: absolute;
40
+ top: -6px;
41
+ left: 50%;
42
+ transform: translateX(-50%);
43
+ border-width: 4px 6px 0 6px;
44
+ border-style: solid;
45
+ border-color: rgba(0, 0, 0, 0.7) transparent transparent transparent;
46
+ z-index: 99;
47
+ opacity: 0;
48
+ transition: .3s opacity;
49
+ }
50
+
51
+ [tooltip-position='left']::before {
52
+ left: 0%;
53
+ top: 50%;
54
+ margin-left: -12px;
55
+ transform: translatey(-50%) rotate(-90deg)
56
+ }
57
+
58
+ [tooltip-position='top']::before {
59
+ left: 50%;
60
+ }
61
+
62
+ [tooltip-position='buttom']::before {
63
+ top: 100%;
64
+ margin-top: 8px;
65
+ transform: translateX(-50%) translatey(-100%) rotate(-180deg)
66
+ }
67
+
68
+ [tooltip-position='right']::before {
69
+ left: 100%;
70
+ top: 50%;
71
+ margin-left: 1px;
72
+ transform: translatey(-50%) rotate(90deg)
73
+ }
74
+
75
+ .tooltip::after {
76
+ content: attr(data-text);
77
+ position: absolute;
78
+ min-width: 10rem;
79
+ left: 50%;
80
+ top: -6px;
81
+ transform: translateX(-50%) translateY(-100%);
82
+ background: rgba(0, 0, 0, 0.7);
83
+ text-align: center;
84
+ color: #fff;
85
+ font-size: 12px;
86
+ border-radius: 5px;
87
+ pointer-events: none;
88
+ padding: 4px 4px;
89
+ z-index: 99;
90
+ opacity: 0;
91
+ transition: .3s opacity;
92
+ }
93
+
94
+ [tooltip-position='left']::after {
95
+ left: 0;
96
+ top: 50%;
97
+ margin-left: -8px;
98
+ transform: translateX(-100%) translateY(-50%);
99
+ }
100
+
101
+ [tooltip-position='top']::after {
102
+ left: 50%;
103
+ }
104
+
105
+ [tooltip-position='buttom']::after {
106
+ top: 100%;
107
+ margin-top: 8px;
108
+ transform: translateX(-50%) translateY(0%);
109
+ }
110
+
111
+ [tooltip-position='right']::after {
112
+ left: 100%;
113
+ top: 50%;
114
+ margin-left: 8px;
115
+ transform: translateX(0%) translateY(-50%);
116
+ }
117
+
118
+ .tooltip:hover::after, .tooltip:hover::before {
119
+ opacity: 1
120
+ }
121
+
122
+
123
+ pre {
124
+ white-space: pre-wrap;
125
+ word-wrap: break-word;
126
+ }
127
+
128
+ //#------------
129
+ h1 {
130
+ @apply text-2xl;
131
+ }
132
+
133
+ h2 {
134
+ @apply text-xl;
135
+ }
136
+
137
+ h3 {
138
+ @apply text-lg;
139
+ }
140
+
141
+ .class-button {
142
+ @apply rounded-md px-3 py-2 text-center text-sm font-semibold text-white shadow-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2;
143
+ @apply focus-visible:outline-gray-500 bg-gray-500 hover:bg-white hover:text-gray-500 hover:border-gray-50 hover:outline;
144
+ }
145
+
146
+ .class-button-outline {
147
+ @apply rounded-md px-3 py-2 text-center text-sm font-semibold text-gray-500 shadow-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2;
148
+ @apply outline outline-1 border-gray-500 focus-visible:outline-gray-500 bg-white hover:bg-gray-500 hover:text-white hover:border-gray-500 hover:outline;
149
+ }
150
+
151
+ .class-label {
152
+ @apply text-sm font-semibold leading-6 text-gray-900;
153
+ }
154
+
155
+ .class-text-field {
156
+ @apply block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6;
157
+ }
158
+
159
+ .class-card-container {
160
+ @apply overflow-hidden bg-white shadow sm:rounded-lg p-5
161
+ }
162
+
163
+ .class-input {
164
+ @apply sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:py-6 pl-2
165
+ }
166
+
167
+ .class-tr {
168
+ @apply top-0 z-10 border-b border-gray-300 bg-white bg-opacity-75 px-3 py-3.5 text-left text-sm font-semibold text-gray-900 lg:table-cell
169
+ }
170
+
171
+ .class-td {
172
+ @apply whitespace-nowrap px-3 py-5 text-sm text-gray-500
173
+ }
174
+
175
+ .class-menu-link {
176
+ @apply hover:font-semibold hover:text-gray-500 block rounded-md py-2 pr-2 pl-9 text-sm leading-6 text-gray-700
177
+ }
178
+
179
+ .class-text-link {
180
+ @apply hover:font-semibold hover:text-gray-500 block rounded-md text-sm leading-6 text-gray-700
181
+ }
182
+
183
+ .class-menu-active-link {
184
+ @apply font-semibold block rounded-md py-2 pr-2 pl-9 text-sm leading-6 text-gray-700
185
+ }
186
+ }
187
+
188
+ @layer utilities {
189
+ /* Chrome, Safari and Opera */
190
+ .no-scrollbar::-webkit-scrollbar {
191
+ display: none;
192
+ }
193
+
194
+ .no-scrollbar {
195
+ -ms-overflow-style: none; /* IE and Edge */
196
+ scrollbar-width: none; /* Firefox */
197
+ }
198
+ }
@@ -0,0 +1,5 @@
1
+ module ApplicationHelper
2
+ def flash_type(flash)
3
+ flash.map { |type, msg| type }[0]
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "sun_sword",
3
+ "private": "true",
4
+ "type": "module",
5
+ "author": "kotarominami <kotaroisme@gmail.com>",
6
+ "license": "MIT"
7
+ }
@@ -0,0 +1,6 @@
1
+ export default {
2
+ plugins: {
3
+ tailwindcss: {},
4
+ autoprefixer: {},
5
+ },
6
+ }