super 0.0.0 → 0.0.5
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/.yardopts +10 -0
- data/LICENSE +165 -0
- data/README.md +66 -18
- data/Rakefile +3 -1
- data/app/assets/config/super_manifest.js +2 -0
- data/app/assets/javascripts/super/application.js +3618 -0
- data/app/assets/stylesheets/super/application.css +98584 -0
- data/app/controllers/super/application_controller.rb +103 -0
- data/app/helpers/super/application_helper.rb +32 -0
- data/app/views/layouts/super/application.html.erb +39 -0
- data/app/views/super/application/_flash.html.erb +17 -0
- data/app/views/super/application/_form.html.erb +17 -0
- data/app/views/super/application/_form_field__destroy.html.erb +9 -0
- data/app/views/super/application/_form_field_select.html.erb +23 -0
- data/app/views/super/application/_form_field_text.html.erb +13 -0
- data/app/views/super/application/_form_fieldset.html.erb +8 -0
- data/app/views/super/application/_form_has_many.html.erb +21 -0
- data/app/views/super/application/_form_has_one.html.erb +11 -0
- data/app/views/super/application/_form_inline_errors.html.erb +10 -0
- data/app/views/super/application/_index.html.erb +45 -0
- data/app/views/super/application/_resource_header.html.erb +16 -0
- data/app/views/super/application/_resources_header.html.erb +16 -0
- data/app/views/super/application/_show.html.erb +10 -0
- data/app/views/super/application/_super_layout.html.erb +34 -0
- data/app/views/super/application/_super_panel.html.erb +11 -0
- data/app/views/super/application/edit.html.erb +6 -0
- data/app/views/super/application/index.html.erb +6 -0
- data/app/views/super/application/new.html.erb +6 -0
- data/app/views/super/application/nothing.html.erb +0 -0
- data/app/views/super/application/show.html.erb +6 -0
- data/app/views/super/feather/README.md +32 -0
- data/app/views/super/feather/_chevron_down.svg +1 -0
- data/docs/README.md +6 -0
- data/docs/controls.md +39 -0
- data/docs/faq.md +44 -0
- data/docs/quick_start.md +45 -0
- data/docs/webpacker.md +17 -0
- data/docs/yard_customizations.rb +41 -0
- data/frontend/super-frontend/build.js +36 -0
- data/frontend/super-frontend/dist/application.css +98584 -0
- data/frontend/super-frontend/dist/application.js +3618 -0
- data/frontend/super-frontend/package.json +21 -0
- data/frontend/super-frontend/postcss.config.js +6 -0
- data/frontend/super-frontend/src/javascripts/super/application.ts +18 -0
- data/frontend/super-frontend/src/javascripts/super/apply_template_controller.ts +21 -0
- data/frontend/super-frontend/src/javascripts/super/rails__ujs.d.ts +1 -0
- data/frontend/super-frontend/src/javascripts/super/toggle_pending_destruction_controller.ts +15 -0
- data/frontend/super-frontend/src/stylesheets/super/application.css +77 -0
- data/frontend/super-frontend/tailwind.config.js +9 -0
- data/frontend/super-frontend/tsconfig.json +13 -0
- data/frontend/super-frontend/yarn.lock +5540 -0
- data/lib/generators/super/install/USAGE +34 -0
- data/lib/generators/super/install/install_generator.rb +46 -0
- data/lib/generators/super/install/templates/base_controller.rb.tt +2 -0
- data/lib/generators/super/install/templates/initializer.rb.tt +5 -0
- data/lib/generators/super/resource/USAGE +8 -0
- data/lib/generators/super/resource/resource_generator.rb +52 -0
- data/lib/generators/super/resource/templates/resources_controller.rb.tt +45 -0
- data/lib/generators/super/webpacker/USAGE +14 -0
- data/lib/generators/super/webpacker/templates/pack_super_application.js.erb.tt +2 -0
- data/lib/generators/super/webpacker/webpacker_generator.rb +25 -0
- data/lib/super.rb +22 -4
- data/lib/super/action_inquirer.rb +101 -0
- data/lib/super/assets.rb +63 -0
- data/lib/super/compatibility.rb +13 -0
- data/lib/super/configuration.rb +103 -0
- data/lib/super/controls.rb +120 -0
- data/lib/super/display.rb +9 -0
- data/lib/super/display/schema_types.rb +40 -0
- data/lib/super/engine.rb +6 -0
- data/lib/super/error.rb +18 -0
- data/lib/super/form/schema_types.rb +115 -0
- data/lib/super/layout.rb +19 -0
- data/lib/super/link.rb +87 -0
- data/lib/super/navigation/automatic.rb +71 -0
- data/lib/super/pagination.rb +70 -0
- data/lib/super/panel.rb +17 -0
- data/lib/super/partial.rb +11 -0
- data/lib/super/plugin.rb +89 -0
- data/lib/super/schema.rb +73 -0
- data/lib/super/step.rb +36 -0
- data/lib/super/version.rb +1 -1
- data/lib/super/view_helper.rb +43 -0
- metadata +215 -14
- data/LICENSE.txt +0 -40
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b59b4010b17c09a380b5aff7b71a7f3f17c8406553c24349454ed8bc2e80028
|
4
|
+
data.tar.gz: 6854ff2172e6c70ce60b64718133b71970e84d60db0e5a15296ba5bcf9b7a981
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c243fa381ef6be45965a63a77d6684206b9e12e6a392059cca8dfcc4e7fec57bd8b14da4f26a8af05bf2c65aeeae8791aaa39801fe684c03df1e099f2ea3dff6
|
7
|
+
data.tar.gz: c7c4e6312ad9bd301effddf4363c1cea2e01d1e4221f113160b6571dd0e07b4709d7dbc0da87660960147a9a81c79a0da812cccc10fa81231cbcd8700e5b9c0b
|
data/.yardopts
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,165 @@
|
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
2
|
+
Version 3, 29 June 2007
|
3
|
+
|
4
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
5
|
+
Everyone is permitted to copy and distribute verbatim copies
|
6
|
+
of this license document, but changing it is not allowed.
|
7
|
+
|
8
|
+
|
9
|
+
This version of the GNU Lesser General Public License incorporates
|
10
|
+
the terms and conditions of version 3 of the GNU General Public
|
11
|
+
License, supplemented by the additional permissions listed below.
|
12
|
+
|
13
|
+
0. Additional Definitions.
|
14
|
+
|
15
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
16
|
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
17
|
+
General Public License.
|
18
|
+
|
19
|
+
"The Library" refers to a covered work governed by this License,
|
20
|
+
other than an Application or a Combined Work as defined below.
|
21
|
+
|
22
|
+
An "Application" is any work that makes use of an interface provided
|
23
|
+
by the Library, but which is not otherwise based on the Library.
|
24
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
25
|
+
of using an interface provided by the Library.
|
26
|
+
|
27
|
+
A "Combined Work" is a work produced by combining or linking an
|
28
|
+
Application with the Library. The particular version of the Library
|
29
|
+
with which the Combined Work was made is also called the "Linked
|
30
|
+
Version".
|
31
|
+
|
32
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
33
|
+
Corresponding Source for the Combined Work, excluding any source code
|
34
|
+
for portions of the Combined Work that, considered in isolation, are
|
35
|
+
based on the Application, and not on the Linked Version.
|
36
|
+
|
37
|
+
The "Corresponding Application Code" for a Combined Work means the
|
38
|
+
object code and/or source code for the Application, including any data
|
39
|
+
and utility programs needed for reproducing the Combined Work from the
|
40
|
+
Application, but excluding the System Libraries of the Combined Work.
|
41
|
+
|
42
|
+
1. Exception to Section 3 of the GNU GPL.
|
43
|
+
|
44
|
+
You may convey a covered work under sections 3 and 4 of this License
|
45
|
+
without being bound by section 3 of the GNU GPL.
|
46
|
+
|
47
|
+
2. Conveying Modified Versions.
|
48
|
+
|
49
|
+
If you modify a copy of the Library, and, in your modifications, a
|
50
|
+
facility refers to a function or data to be supplied by an Application
|
51
|
+
that uses the facility (other than as an argument passed when the
|
52
|
+
facility is invoked), then you may convey a copy of the modified
|
53
|
+
version:
|
54
|
+
|
55
|
+
a) under this License, provided that you make a good faith effort to
|
56
|
+
ensure that, in the event an Application does not supply the
|
57
|
+
function or data, the facility still operates, and performs
|
58
|
+
whatever part of its purpose remains meaningful, or
|
59
|
+
|
60
|
+
b) under the GNU GPL, with none of the additional permissions of
|
61
|
+
this License applicable to that copy.
|
62
|
+
|
63
|
+
3. Object Code Incorporating Material from Library Header Files.
|
64
|
+
|
65
|
+
The object code form of an Application may incorporate material from
|
66
|
+
a header file that is part of the Library. You may convey such object
|
67
|
+
code under terms of your choice, provided that, if the incorporated
|
68
|
+
material is not limited to numerical parameters, data structure
|
69
|
+
layouts and accessors, or small macros, inline functions and templates
|
70
|
+
(ten or fewer lines in length), you do both of the following:
|
71
|
+
|
72
|
+
a) Give prominent notice with each copy of the object code that the
|
73
|
+
Library is used in it and that the Library and its use are
|
74
|
+
covered by this License.
|
75
|
+
|
76
|
+
b) Accompany the object code with a copy of the GNU GPL and this license
|
77
|
+
document.
|
78
|
+
|
79
|
+
4. Combined Works.
|
80
|
+
|
81
|
+
You may convey a Combined Work under terms of your choice that,
|
82
|
+
taken together, effectively do not restrict modification of the
|
83
|
+
portions of the Library contained in the Combined Work and reverse
|
84
|
+
engineering for debugging such modifications, if you also do each of
|
85
|
+
the following:
|
86
|
+
|
87
|
+
a) Give prominent notice with each copy of the Combined Work that
|
88
|
+
the Library is used in it and that the Library and its use are
|
89
|
+
covered by this License.
|
90
|
+
|
91
|
+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
92
|
+
document.
|
93
|
+
|
94
|
+
c) For a Combined Work that displays copyright notices during
|
95
|
+
execution, include the copyright notice for the Library among
|
96
|
+
these notices, as well as a reference directing the user to the
|
97
|
+
copies of the GNU GPL and this license document.
|
98
|
+
|
99
|
+
d) Do one of the following:
|
100
|
+
|
101
|
+
0) Convey the Minimal Corresponding Source under the terms of this
|
102
|
+
License, and the Corresponding Application Code in a form
|
103
|
+
suitable for, and under terms that permit, the user to
|
104
|
+
recombine or relink the Application with a modified version of
|
105
|
+
the Linked Version to produce a modified Combined Work, in the
|
106
|
+
manner specified by section 6 of the GNU GPL for conveying
|
107
|
+
Corresponding Source.
|
108
|
+
|
109
|
+
1) Use a suitable shared library mechanism for linking with the
|
110
|
+
Library. A suitable mechanism is one that (a) uses at run time
|
111
|
+
a copy of the Library already present on the user's computer
|
112
|
+
system, and (b) will operate properly with a modified version
|
113
|
+
of the Library that is interface-compatible with the Linked
|
114
|
+
Version.
|
115
|
+
|
116
|
+
e) Provide Installation Information, but only if you would otherwise
|
117
|
+
be required to provide such information under section 6 of the
|
118
|
+
GNU GPL, and only to the extent that such information is
|
119
|
+
necessary to install and execute a modified version of the
|
120
|
+
Combined Work produced by recombining or relinking the
|
121
|
+
Application with a modified version of the Linked Version. (If
|
122
|
+
you use option 4d0, the Installation Information must accompany
|
123
|
+
the Minimal Corresponding Source and Corresponding Application
|
124
|
+
Code. If you use option 4d1, you must provide the Installation
|
125
|
+
Information in the manner specified by section 6 of the GNU GPL
|
126
|
+
for conveying Corresponding Source.)
|
127
|
+
|
128
|
+
5. Combined Libraries.
|
129
|
+
|
130
|
+
You may place library facilities that are a work based on the
|
131
|
+
Library side by side in a single library together with other library
|
132
|
+
facilities that are not Applications and are not covered by this
|
133
|
+
License, and convey such a combined library under terms of your
|
134
|
+
choice, if you do both of the following:
|
135
|
+
|
136
|
+
a) Accompany the combined library with a copy of the same work based
|
137
|
+
on the Library, uncombined with any other library facilities,
|
138
|
+
conveyed under the terms of this License.
|
139
|
+
|
140
|
+
b) Give prominent notice with the combined library that part of it
|
141
|
+
is a work based on the Library, and explaining where to find the
|
142
|
+
accompanying uncombined form of the same work.
|
143
|
+
|
144
|
+
6. Revised Versions of the GNU Lesser General Public License.
|
145
|
+
|
146
|
+
The Free Software Foundation may publish revised and/or new versions
|
147
|
+
of the GNU Lesser General Public License from time to time. Such new
|
148
|
+
versions will be similar in spirit to the present version, but may
|
149
|
+
differ in detail to address new problems or concerns.
|
150
|
+
|
151
|
+
Each version is given a distinguishing version number. If the
|
152
|
+
Library as you received it specifies that a certain numbered version
|
153
|
+
of the GNU Lesser General Public License "or any later version"
|
154
|
+
applies to it, you have the option of following the terms and
|
155
|
+
conditions either of that published version or of any later version
|
156
|
+
published by the Free Software Foundation. If the Library as you
|
157
|
+
received it does not specify a version number of the GNU Lesser
|
158
|
+
General Public License, you may choose any version of the GNU Lesser
|
159
|
+
General Public License ever published by the Free Software Foundation.
|
160
|
+
|
161
|
+
If the Library as you received it specifies that a proxy can decide
|
162
|
+
whether future versions of the GNU Lesser General Public License shall
|
163
|
+
apply, that proxy's public statement of acceptance of any version is
|
164
|
+
permanent authorization for you to choose that version for the
|
165
|
+
Library.
|
data/README.md
CHANGED
@@ -1,28 +1,76 @@
|
|
1
1
|
# Super
|
2
|
-
Short description and motivation.
|
3
2
|
|
4
|
-
|
5
|
-
How to use my plugin.
|
3
|
+
Super is a zero dependency admin framework for Ruby on Rails applications.
|
6
4
|
|
7
|
-
|
8
|
-
|
5
|
+
Super is made for developers. They will find it easy to build and modify admin
|
6
|
+
pages. It builds on top of Rails controllers and views, so it's straightforward
|
7
|
+
to customize. It's fully configurable without a DSL.
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
Super is made for admins. Power users and casual users alike will find the admin
|
10
|
+
pages simple and efficient. And the Professional add-on can make it even more
|
11
|
+
powerful.
|
13
12
|
|
14
|
-
And then execute:
|
15
|
-
```bash
|
16
|
-
$ bundle
|
17
|
-
```
|
18
13
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
14
|
+
## Features
|
15
|
+
|
16
|
+
* Sprockets and Webpacker compatibility
|
17
|
+
* Note: Webpacker support depends on one additional NPM package for parsing
|
18
|
+
ERB
|
19
|
+
* Pagination
|
20
|
+
* Configurable forms (new and edit forms)
|
21
|
+
* Configurable display (index and show tables)
|
22
|
+
* Supports Rails 5.0+, Ruby 2.3+
|
23
|
+
* Configurable without a DSL
|
24
|
+
* Looks reasonably nice and modern
|
25
|
+
* Pre-built frontend assets (doesn't require Sass, PostCSS, Babel, etc)
|
26
|
+
* Vendored assets include
|
27
|
+
* Stimulus JS
|
28
|
+
* Tailwind CSS
|
29
|
+
* Feather icons
|
30
|
+
|
31
|
+
Super was inspired in part by the admin frameworks [ActiveAdmin][activeadmin]
|
32
|
+
and [Administrate][administrate]. If Super doesn't quite fit your requirements
|
33
|
+
at this moment, one of those might meet your needs better.
|
34
|
+
|
35
|
+
|
36
|
+
## Professional edition
|
37
|
+
|
38
|
+
Super Professional is a paid add-on and provides additional benefits:
|
39
|
+
|
40
|
+
* Feature: Filtering by column values
|
41
|
+
* Priority email support
|
42
|
+
* Supporting long term development of Super
|
43
|
+
* An LGPL exemption
|
44
|
+
|
45
|
+
It will be available soon. Subscribe to the [newsletter][newsletter] to be
|
46
|
+
notified of its availability or for brief, occasional updates.
|
47
|
+
|
48
|
+
|
49
|
+
## Demos
|
50
|
+
|
51
|
+
* [Super Demo][super_demo]
|
52
|
+
* [Super Demo source][super_demo_source]
|
53
|
+
* [Super Professional Demo][super_professional]
|
54
|
+
|
55
|
+
|
56
|
+
## Installation and Usage
|
57
|
+
|
58
|
+
See [Quick start](./docs/quick_start.md)
|
59
|
+
|
23
60
|
|
24
61
|
## Contributing
|
25
|
-
|
62
|
+
|
63
|
+
See [CONTRIBUTING](./CONTRIBUTING.md)
|
64
|
+
|
26
65
|
|
27
66
|
## License
|
28
|
-
|
67
|
+
|
68
|
+
The gem is available under the terms of the [GNU LGPLv3](./LICENSE).
|
69
|
+
|
70
|
+
|
71
|
+
[administrate]: https://github.com/thoughtbot/administrate
|
72
|
+
[activeadmin]: https://github.com/activeadmin/activeadmin
|
73
|
+
[newsletter]: https://tinyletter.com/zachahn
|
74
|
+
[super_demo]: https://demo-super.herokuapp.com/admin/members
|
75
|
+
[super_demo_source]: https://github.com/zachahn/super_demo
|
76
|
+
[super_professional]: https://demo-super-professional.herokuapp.com/admin/members
|
data/Rakefile
CHANGED
@@ -14,7 +14,9 @@ RDoc::Task.new(:rdoc) do |rdoc|
|
|
14
14
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
15
|
end
|
16
16
|
|
17
|
-
|
17
|
+
require_relative "dummy_path"
|
18
|
+
|
19
|
+
APP_RAKEFILE = File.expand_path("#{SUPER_DUMMY_PATH}/Rakefile", __dir__)
|
18
20
|
load 'rails/tasks/engine.rake'
|
19
21
|
|
20
22
|
load 'rails/tasks/statistics.rake'
|
@@ -0,0 +1,3618 @@
|
|
1
|
+
// modules are defined as an array
|
2
|
+
// [ module function, map of requires ]
|
3
|
+
//
|
4
|
+
// map of requires is short require name -> numeric require
|
5
|
+
//
|
6
|
+
// anything defined in a previous bundle is accessed via the
|
7
|
+
// orig method which is the require for previous bundles
|
8
|
+
parcelRequire = (function (modules, cache, entry, globalName) {
|
9
|
+
// Save the require from previous bundle to this closure if any
|
10
|
+
var previousRequire = typeof parcelRequire === 'function' && parcelRequire;
|
11
|
+
var nodeRequire = typeof require === 'function' && require;
|
12
|
+
|
13
|
+
function newRequire(name, jumped) {
|
14
|
+
if (!cache[name]) {
|
15
|
+
if (!modules[name]) {
|
16
|
+
// if we cannot find the module within our internal map or
|
17
|
+
// cache jump to the current global require ie. the last bundle
|
18
|
+
// that was added to the page.
|
19
|
+
var currentRequire = typeof parcelRequire === 'function' && parcelRequire;
|
20
|
+
if (!jumped && currentRequire) {
|
21
|
+
return currentRequire(name, true);
|
22
|
+
}
|
23
|
+
|
24
|
+
// If there are other bundles on this page the require from the
|
25
|
+
// previous one is saved to 'previousRequire'. Repeat this as
|
26
|
+
// many times as there are bundles until the module is found or
|
27
|
+
// we exhaust the require chain.
|
28
|
+
if (previousRequire) {
|
29
|
+
return previousRequire(name, true);
|
30
|
+
}
|
31
|
+
|
32
|
+
// Try the node require function if it exists.
|
33
|
+
if (nodeRequire && typeof name === 'string') {
|
34
|
+
return nodeRequire(name);
|
35
|
+
}
|
36
|
+
|
37
|
+
var err = new Error('Cannot find module \'' + name + '\'');
|
38
|
+
err.code = 'MODULE_NOT_FOUND';
|
39
|
+
throw err;
|
40
|
+
}
|
41
|
+
|
42
|
+
localRequire.resolve = resolve;
|
43
|
+
localRequire.cache = {};
|
44
|
+
|
45
|
+
var module = cache[name] = new newRequire.Module(name);
|
46
|
+
|
47
|
+
modules[name][0].call(module.exports, localRequire, module, module.exports, this);
|
48
|
+
}
|
49
|
+
|
50
|
+
return cache[name].exports;
|
51
|
+
|
52
|
+
function localRequire(x){
|
53
|
+
return newRequire(localRequire.resolve(x));
|
54
|
+
}
|
55
|
+
|
56
|
+
function resolve(x){
|
57
|
+
return modules[name][1][x] || x;
|
58
|
+
}
|
59
|
+
}
|
60
|
+
|
61
|
+
function Module(moduleName) {
|
62
|
+
this.id = moduleName;
|
63
|
+
this.bundle = newRequire;
|
64
|
+
this.exports = {};
|
65
|
+
}
|
66
|
+
|
67
|
+
newRequire.isParcelRequire = true;
|
68
|
+
newRequire.Module = Module;
|
69
|
+
newRequire.modules = modules;
|
70
|
+
newRequire.cache = cache;
|
71
|
+
newRequire.parent = previousRequire;
|
72
|
+
newRequire.register = function (id, exports) {
|
73
|
+
modules[id] = [function (require, module) {
|
74
|
+
module.exports = exports;
|
75
|
+
}, {}];
|
76
|
+
};
|
77
|
+
|
78
|
+
var error;
|
79
|
+
for (var i = 0; i < entry.length; i++) {
|
80
|
+
try {
|
81
|
+
newRequire(entry[i]);
|
82
|
+
} catch (e) {
|
83
|
+
// Save first error but execute all entries
|
84
|
+
if (!error) {
|
85
|
+
error = e;
|
86
|
+
}
|
87
|
+
}
|
88
|
+
}
|
89
|
+
|
90
|
+
if (entry.length) {
|
91
|
+
// Expose entry point to Node, AMD or browser globals
|
92
|
+
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
|
93
|
+
var mainExports = newRequire(entry[entry.length - 1]);
|
94
|
+
|
95
|
+
// CommonJS
|
96
|
+
if (typeof exports === "object" && typeof module !== "undefined") {
|
97
|
+
module.exports = mainExports;
|
98
|
+
|
99
|
+
// RequireJS
|
100
|
+
} else if (typeof define === "function" && define.amd) {
|
101
|
+
define(function () {
|
102
|
+
return mainExports;
|
103
|
+
});
|
104
|
+
|
105
|
+
// <script>
|
106
|
+
} else if (globalName) {
|
107
|
+
this[globalName] = mainExports;
|
108
|
+
}
|
109
|
+
}
|
110
|
+
|
111
|
+
// Override the current require with this new one
|
112
|
+
parcelRequire = newRequire;
|
113
|
+
|
114
|
+
if (error) {
|
115
|
+
// throw error from earlier, _after updating parcelRequire_
|
116
|
+
throw error;
|
117
|
+
}
|
118
|
+
|
119
|
+
return newRequire;
|
120
|
+
})({"../node_modules/@rails/ujs/lib/assets/compiled/rails-ujs.js":[function(require,module,exports) {
|
121
|
+
var define;
|
122
|
+
/*
|
123
|
+
Unobtrusive JavaScript
|
124
|
+
https://github.com/rails/rails/blob/master/actionview/app/assets/javascripts
|
125
|
+
Released under the MIT license
|
126
|
+
*/;
|
127
|
+
|
128
|
+
(function() {
|
129
|
+
var context = this;
|
130
|
+
|
131
|
+
(function() {
|
132
|
+
(function() {
|
133
|
+
this.Rails = {
|
134
|
+
linkClickSelector: 'a[data-confirm], a[data-method], a[data-remote]:not([disabled]), a[data-disable-with], a[data-disable]',
|
135
|
+
buttonClickSelector: {
|
136
|
+
selector: 'button[data-remote]:not([form]), button[data-confirm]:not([form])',
|
137
|
+
exclude: 'form button'
|
138
|
+
},
|
139
|
+
inputChangeSelector: 'select[data-remote], input[data-remote], textarea[data-remote]',
|
140
|
+
formSubmitSelector: 'form',
|
141
|
+
formInputClickSelector: 'form input[type=submit], form input[type=image], form button[type=submit], form button:not([type]), input[type=submit][form], input[type=image][form], button[type=submit][form], button[form]:not([type])',
|
142
|
+
formDisableSelector: 'input[data-disable-with]:enabled, button[data-disable-with]:enabled, textarea[data-disable-with]:enabled, input[data-disable]:enabled, button[data-disable]:enabled, textarea[data-disable]:enabled',
|
143
|
+
formEnableSelector: 'input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled, input[data-disable]:disabled, button[data-disable]:disabled, textarea[data-disable]:disabled',
|
144
|
+
fileInputSelector: 'input[name][type=file]:not([disabled])',
|
145
|
+
linkDisableSelector: 'a[data-disable-with], a[data-disable]',
|
146
|
+
buttonDisableSelector: 'button[data-remote][data-disable-with], button[data-remote][data-disable]'
|
147
|
+
};
|
148
|
+
|
149
|
+
}).call(this);
|
150
|
+
}).call(context);
|
151
|
+
|
152
|
+
var Rails = context.Rails;
|
153
|
+
|
154
|
+
(function() {
|
155
|
+
(function() {
|
156
|
+
var nonce;
|
157
|
+
|
158
|
+
nonce = null;
|
159
|
+
|
160
|
+
Rails.loadCSPNonce = function() {
|
161
|
+
var ref;
|
162
|
+
return nonce = (ref = document.querySelector("meta[name=csp-nonce]")) != null ? ref.content : void 0;
|
163
|
+
};
|
164
|
+
|
165
|
+
Rails.cspNonce = function() {
|
166
|
+
return nonce != null ? nonce : Rails.loadCSPNonce();
|
167
|
+
};
|
168
|
+
|
169
|
+
}).call(this);
|
170
|
+
(function() {
|
171
|
+
var expando, m;
|
172
|
+
|
173
|
+
m = Element.prototype.matches || Element.prototype.matchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.webkitMatchesSelector;
|
174
|
+
|
175
|
+
Rails.matches = function(element, selector) {
|
176
|
+
if (selector.exclude != null) {
|
177
|
+
return m.call(element, selector.selector) && !m.call(element, selector.exclude);
|
178
|
+
} else {
|
179
|
+
return m.call(element, selector);
|
180
|
+
}
|
181
|
+
};
|
182
|
+
|
183
|
+
expando = '_ujsData';
|
184
|
+
|
185
|
+
Rails.getData = function(element, key) {
|
186
|
+
var ref;
|
187
|
+
return (ref = element[expando]) != null ? ref[key] : void 0;
|
188
|
+
};
|
189
|
+
|
190
|
+
Rails.setData = function(element, key, value) {
|
191
|
+
if (element[expando] == null) {
|
192
|
+
element[expando] = {};
|
193
|
+
}
|
194
|
+
return element[expando][key] = value;
|
195
|
+
};
|
196
|
+
|
197
|
+
Rails.$ = function(selector) {
|
198
|
+
return Array.prototype.slice.call(document.querySelectorAll(selector));
|
199
|
+
};
|
200
|
+
|
201
|
+
}).call(this);
|
202
|
+
(function() {
|
203
|
+
var $, csrfParam, csrfToken;
|
204
|
+
|
205
|
+
$ = Rails.$;
|
206
|
+
|
207
|
+
csrfToken = Rails.csrfToken = function() {
|
208
|
+
var meta;
|
209
|
+
meta = document.querySelector('meta[name=csrf-token]');
|
210
|
+
return meta && meta.content;
|
211
|
+
};
|
212
|
+
|
213
|
+
csrfParam = Rails.csrfParam = function() {
|
214
|
+
var meta;
|
215
|
+
meta = document.querySelector('meta[name=csrf-param]');
|
216
|
+
return meta && meta.content;
|
217
|
+
};
|
218
|
+
|
219
|
+
Rails.CSRFProtection = function(xhr) {
|
220
|
+
var token;
|
221
|
+
token = csrfToken();
|
222
|
+
if (token != null) {
|
223
|
+
return xhr.setRequestHeader('X-CSRF-Token', token);
|
224
|
+
}
|
225
|
+
};
|
226
|
+
|
227
|
+
Rails.refreshCSRFTokens = function() {
|
228
|
+
var param, token;
|
229
|
+
token = csrfToken();
|
230
|
+
param = csrfParam();
|
231
|
+
if ((token != null) && (param != null)) {
|
232
|
+
return $('form input[name="' + param + '"]').forEach(function(input) {
|
233
|
+
return input.value = token;
|
234
|
+
});
|
235
|
+
}
|
236
|
+
};
|
237
|
+
|
238
|
+
}).call(this);
|
239
|
+
(function() {
|
240
|
+
var CustomEvent, fire, matches, preventDefault;
|
241
|
+
|
242
|
+
matches = Rails.matches;
|
243
|
+
|
244
|
+
CustomEvent = window.CustomEvent;
|
245
|
+
|
246
|
+
if (typeof CustomEvent !== 'function') {
|
247
|
+
CustomEvent = function(event, params) {
|
248
|
+
var evt;
|
249
|
+
evt = document.createEvent('CustomEvent');
|
250
|
+
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
|
251
|
+
return evt;
|
252
|
+
};
|
253
|
+
CustomEvent.prototype = window.Event.prototype;
|
254
|
+
preventDefault = CustomEvent.prototype.preventDefault;
|
255
|
+
CustomEvent.prototype.preventDefault = function() {
|
256
|
+
var result;
|
257
|
+
result = preventDefault.call(this);
|
258
|
+
if (this.cancelable && !this.defaultPrevented) {
|
259
|
+
Object.defineProperty(this, 'defaultPrevented', {
|
260
|
+
get: function() {
|
261
|
+
return true;
|
262
|
+
}
|
263
|
+
});
|
264
|
+
}
|
265
|
+
return result;
|
266
|
+
};
|
267
|
+
}
|
268
|
+
|
269
|
+
fire = Rails.fire = function(obj, name, data) {
|
270
|
+
var event;
|
271
|
+
event = new CustomEvent(name, {
|
272
|
+
bubbles: true,
|
273
|
+
cancelable: true,
|
274
|
+
detail: data
|
275
|
+
});
|
276
|
+
obj.dispatchEvent(event);
|
277
|
+
return !event.defaultPrevented;
|
278
|
+
};
|
279
|
+
|
280
|
+
Rails.stopEverything = function(e) {
|
281
|
+
fire(e.target, 'ujs:everythingStopped');
|
282
|
+
e.preventDefault();
|
283
|
+
e.stopPropagation();
|
284
|
+
return e.stopImmediatePropagation();
|
285
|
+
};
|
286
|
+
|
287
|
+
Rails.delegate = function(element, selector, eventType, handler) {
|
288
|
+
return element.addEventListener(eventType, function(e) {
|
289
|
+
var target;
|
290
|
+
target = e.target;
|
291
|
+
while (!(!(target instanceof Element) || matches(target, selector))) {
|
292
|
+
target = target.parentNode;
|
293
|
+
}
|
294
|
+
if (target instanceof Element && handler.call(target, e) === false) {
|
295
|
+
e.preventDefault();
|
296
|
+
return e.stopPropagation();
|
297
|
+
}
|
298
|
+
});
|
299
|
+
};
|
300
|
+
|
301
|
+
}).call(this);
|
302
|
+
(function() {
|
303
|
+
var AcceptHeaders, CSRFProtection, createXHR, cspNonce, fire, prepareOptions, processResponse;
|
304
|
+
|
305
|
+
cspNonce = Rails.cspNonce, CSRFProtection = Rails.CSRFProtection, fire = Rails.fire;
|
306
|
+
|
307
|
+
AcceptHeaders = {
|
308
|
+
'*': '*/*',
|
309
|
+
text: 'text/plain',
|
310
|
+
html: 'text/html',
|
311
|
+
xml: 'application/xml, text/xml',
|
312
|
+
json: 'application/json, text/javascript',
|
313
|
+
script: 'text/javascript, application/javascript, application/ecmascript, application/x-ecmascript'
|
314
|
+
};
|
315
|
+
|
316
|
+
Rails.ajax = function(options) {
|
317
|
+
var xhr;
|
318
|
+
options = prepareOptions(options);
|
319
|
+
xhr = createXHR(options, function() {
|
320
|
+
var ref, response;
|
321
|
+
response = processResponse((ref = xhr.response) != null ? ref : xhr.responseText, xhr.getResponseHeader('Content-Type'));
|
322
|
+
if (Math.floor(xhr.status / 100) === 2) {
|
323
|
+
if (typeof options.success === "function") {
|
324
|
+
options.success(response, xhr.statusText, xhr);
|
325
|
+
}
|
326
|
+
} else {
|
327
|
+
if (typeof options.error === "function") {
|
328
|
+
options.error(response, xhr.statusText, xhr);
|
329
|
+
}
|
330
|
+
}
|
331
|
+
return typeof options.complete === "function" ? options.complete(xhr, xhr.statusText) : void 0;
|
332
|
+
});
|
333
|
+
if ((options.beforeSend != null) && !options.beforeSend(xhr, options)) {
|
334
|
+
return false;
|
335
|
+
}
|
336
|
+
if (xhr.readyState === XMLHttpRequest.OPENED) {
|
337
|
+
return xhr.send(options.data);
|
338
|
+
}
|
339
|
+
};
|
340
|
+
|
341
|
+
prepareOptions = function(options) {
|
342
|
+
options.url = options.url || location.href;
|
343
|
+
options.type = options.type.toUpperCase();
|
344
|
+
if (options.type === 'GET' && options.data) {
|
345
|
+
if (options.url.indexOf('?') < 0) {
|
346
|
+
options.url += '?' + options.data;
|
347
|
+
} else {
|
348
|
+
options.url += '&' + options.data;
|
349
|
+
}
|
350
|
+
}
|
351
|
+
if (AcceptHeaders[options.dataType] == null) {
|
352
|
+
options.dataType = '*';
|
353
|
+
}
|
354
|
+
options.accept = AcceptHeaders[options.dataType];
|
355
|
+
if (options.dataType !== '*') {
|
356
|
+
options.accept += ', */*; q=0.01';
|
357
|
+
}
|
358
|
+
return options;
|
359
|
+
};
|
360
|
+
|
361
|
+
createXHR = function(options, done) {
|
362
|
+
var xhr;
|
363
|
+
xhr = new XMLHttpRequest();
|
364
|
+
xhr.open(options.type, options.url, true);
|
365
|
+
xhr.setRequestHeader('Accept', options.accept);
|
366
|
+
if (typeof options.data === 'string') {
|
367
|
+
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
|
368
|
+
}
|
369
|
+
if (!options.crossDomain) {
|
370
|
+
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
371
|
+
}
|
372
|
+
CSRFProtection(xhr);
|
373
|
+
xhr.withCredentials = !!options.withCredentials;
|
374
|
+
xhr.onreadystatechange = function() {
|
375
|
+
if (xhr.readyState === XMLHttpRequest.DONE) {
|
376
|
+
return done(xhr);
|
377
|
+
}
|
378
|
+
};
|
379
|
+
return xhr;
|
380
|
+
};
|
381
|
+
|
382
|
+
processResponse = function(response, type) {
|
383
|
+
var parser, script;
|
384
|
+
if (typeof response === 'string' && typeof type === 'string') {
|
385
|
+
if (type.match(/\bjson\b/)) {
|
386
|
+
try {
|
387
|
+
response = JSON.parse(response);
|
388
|
+
} catch (error) {}
|
389
|
+
} else if (type.match(/\b(?:java|ecma)script\b/)) {
|
390
|
+
script = document.createElement('script');
|
391
|
+
script.setAttribute('nonce', cspNonce());
|
392
|
+
script.text = response;
|
393
|
+
document.head.appendChild(script).parentNode.removeChild(script);
|
394
|
+
} else if (type.match(/\b(xml|html|svg)\b/)) {
|
395
|
+
parser = new DOMParser();
|
396
|
+
type = type.replace(/;.+/, '');
|
397
|
+
try {
|
398
|
+
response = parser.parseFromString(response, type);
|
399
|
+
} catch (error) {}
|
400
|
+
}
|
401
|
+
}
|
402
|
+
return response;
|
403
|
+
};
|
404
|
+
|
405
|
+
Rails.href = function(element) {
|
406
|
+
return element.href;
|
407
|
+
};
|
408
|
+
|
409
|
+
Rails.isCrossDomain = function(url) {
|
410
|
+
var e, originAnchor, urlAnchor;
|
411
|
+
originAnchor = document.createElement('a');
|
412
|
+
originAnchor.href = location.href;
|
413
|
+
urlAnchor = document.createElement('a');
|
414
|
+
try {
|
415
|
+
urlAnchor.href = url;
|
416
|
+
return !(((!urlAnchor.protocol || urlAnchor.protocol === ':') && !urlAnchor.host) || (originAnchor.protocol + '//' + originAnchor.host === urlAnchor.protocol + '//' + urlAnchor.host));
|
417
|
+
} catch (error) {
|
418
|
+
e = error;
|
419
|
+
return true;
|
420
|
+
}
|
421
|
+
};
|
422
|
+
|
423
|
+
}).call(this);
|
424
|
+
(function() {
|
425
|
+
var matches, toArray;
|
426
|
+
|
427
|
+
matches = Rails.matches;
|
428
|
+
|
429
|
+
toArray = function(e) {
|
430
|
+
return Array.prototype.slice.call(e);
|
431
|
+
};
|
432
|
+
|
433
|
+
Rails.serializeElement = function(element, additionalParam) {
|
434
|
+
var inputs, params;
|
435
|
+
inputs = [element];
|
436
|
+
if (matches(element, 'form')) {
|
437
|
+
inputs = toArray(element.elements);
|
438
|
+
}
|
439
|
+
params = [];
|
440
|
+
inputs.forEach(function(input) {
|
441
|
+
if (!input.name || input.disabled) {
|
442
|
+
return;
|
443
|
+
}
|
444
|
+
if (matches(input, 'fieldset[disabled] *')) {
|
445
|
+
return;
|
446
|
+
}
|
447
|
+
if (matches(input, 'select')) {
|
448
|
+
return toArray(input.options).forEach(function(option) {
|
449
|
+
if (option.selected) {
|
450
|
+
return params.push({
|
451
|
+
name: input.name,
|
452
|
+
value: option.value
|
453
|
+
});
|
454
|
+
}
|
455
|
+
});
|
456
|
+
} else if (input.checked || ['radio', 'checkbox', 'submit'].indexOf(input.type) === -1) {
|
457
|
+
return params.push({
|
458
|
+
name: input.name,
|
459
|
+
value: input.value
|
460
|
+
});
|
461
|
+
}
|
462
|
+
});
|
463
|
+
if (additionalParam) {
|
464
|
+
params.push(additionalParam);
|
465
|
+
}
|
466
|
+
return params.map(function(param) {
|
467
|
+
if (param.name != null) {
|
468
|
+
return (encodeURIComponent(param.name)) + "=" + (encodeURIComponent(param.value));
|
469
|
+
} else {
|
470
|
+
return param;
|
471
|
+
}
|
472
|
+
}).join('&');
|
473
|
+
};
|
474
|
+
|
475
|
+
Rails.formElements = function(form, selector) {
|
476
|
+
if (matches(form, 'form')) {
|
477
|
+
return toArray(form.elements).filter(function(el) {
|
478
|
+
return matches(el, selector);
|
479
|
+
});
|
480
|
+
} else {
|
481
|
+
return toArray(form.querySelectorAll(selector));
|
482
|
+
}
|
483
|
+
};
|
484
|
+
|
485
|
+
}).call(this);
|
486
|
+
(function() {
|
487
|
+
var allowAction, fire, stopEverything;
|
488
|
+
|
489
|
+
fire = Rails.fire, stopEverything = Rails.stopEverything;
|
490
|
+
|
491
|
+
Rails.handleConfirm = function(e) {
|
492
|
+
if (!allowAction(this)) {
|
493
|
+
return stopEverything(e);
|
494
|
+
}
|
495
|
+
};
|
496
|
+
|
497
|
+
Rails.confirm = function(message, element) {
|
498
|
+
return confirm(message);
|
499
|
+
};
|
500
|
+
|
501
|
+
allowAction = function(element) {
|
502
|
+
var answer, callback, message;
|
503
|
+
message = element.getAttribute('data-confirm');
|
504
|
+
if (!message) {
|
505
|
+
return true;
|
506
|
+
}
|
507
|
+
answer = false;
|
508
|
+
if (fire(element, 'confirm')) {
|
509
|
+
try {
|
510
|
+
answer = Rails.confirm(message, element);
|
511
|
+
} catch (error) {}
|
512
|
+
callback = fire(element, 'confirm:complete', [answer]);
|
513
|
+
}
|
514
|
+
return answer && callback;
|
515
|
+
};
|
516
|
+
|
517
|
+
}).call(this);
|
518
|
+
(function() {
|
519
|
+
var disableFormElement, disableFormElements, disableLinkElement, enableFormElement, enableFormElements, enableLinkElement, formElements, getData, isXhrRedirect, matches, setData, stopEverything;
|
520
|
+
|
521
|
+
matches = Rails.matches, getData = Rails.getData, setData = Rails.setData, stopEverything = Rails.stopEverything, formElements = Rails.formElements;
|
522
|
+
|
523
|
+
Rails.handleDisabledElement = function(e) {
|
524
|
+
var element;
|
525
|
+
element = this;
|
526
|
+
if (element.disabled) {
|
527
|
+
return stopEverything(e);
|
528
|
+
}
|
529
|
+
};
|
530
|
+
|
531
|
+
Rails.enableElement = function(e) {
|
532
|
+
var element;
|
533
|
+
if (e instanceof Event) {
|
534
|
+
if (isXhrRedirect(e)) {
|
535
|
+
return;
|
536
|
+
}
|
537
|
+
element = e.target;
|
538
|
+
} else {
|
539
|
+
element = e;
|
540
|
+
}
|
541
|
+
if (matches(element, Rails.linkDisableSelector)) {
|
542
|
+
return enableLinkElement(element);
|
543
|
+
} else if (matches(element, Rails.buttonDisableSelector) || matches(element, Rails.formEnableSelector)) {
|
544
|
+
return enableFormElement(element);
|
545
|
+
} else if (matches(element, Rails.formSubmitSelector)) {
|
546
|
+
return enableFormElements(element);
|
547
|
+
}
|
548
|
+
};
|
549
|
+
|
550
|
+
Rails.disableElement = function(e) {
|
551
|
+
var element;
|
552
|
+
element = e instanceof Event ? e.target : e;
|
553
|
+
if (matches(element, Rails.linkDisableSelector)) {
|
554
|
+
return disableLinkElement(element);
|
555
|
+
} else if (matches(element, Rails.buttonDisableSelector) || matches(element, Rails.formDisableSelector)) {
|
556
|
+
return disableFormElement(element);
|
557
|
+
} else if (matches(element, Rails.formSubmitSelector)) {
|
558
|
+
return disableFormElements(element);
|
559
|
+
}
|
560
|
+
};
|
561
|
+
|
562
|
+
disableLinkElement = function(element) {
|
563
|
+
var replacement;
|
564
|
+
if (getData(element, 'ujs:disabled')) {
|
565
|
+
return;
|
566
|
+
}
|
567
|
+
replacement = element.getAttribute('data-disable-with');
|
568
|
+
if (replacement != null) {
|
569
|
+
setData(element, 'ujs:enable-with', element.innerHTML);
|
570
|
+
element.innerHTML = replacement;
|
571
|
+
}
|
572
|
+
element.addEventListener('click', stopEverything);
|
573
|
+
return setData(element, 'ujs:disabled', true);
|
574
|
+
};
|
575
|
+
|
576
|
+
enableLinkElement = function(element) {
|
577
|
+
var originalText;
|
578
|
+
originalText = getData(element, 'ujs:enable-with');
|
579
|
+
if (originalText != null) {
|
580
|
+
element.innerHTML = originalText;
|
581
|
+
setData(element, 'ujs:enable-with', null);
|
582
|
+
}
|
583
|
+
element.removeEventListener('click', stopEverything);
|
584
|
+
return setData(element, 'ujs:disabled', null);
|
585
|
+
};
|
586
|
+
|
587
|
+
disableFormElements = function(form) {
|
588
|
+
return formElements(form, Rails.formDisableSelector).forEach(disableFormElement);
|
589
|
+
};
|
590
|
+
|
591
|
+
disableFormElement = function(element) {
|
592
|
+
var replacement;
|
593
|
+
if (getData(element, 'ujs:disabled')) {
|
594
|
+
return;
|
595
|
+
}
|
596
|
+
replacement = element.getAttribute('data-disable-with');
|
597
|
+
if (replacement != null) {
|
598
|
+
if (matches(element, 'button')) {
|
599
|
+
setData(element, 'ujs:enable-with', element.innerHTML);
|
600
|
+
element.innerHTML = replacement;
|
601
|
+
} else {
|
602
|
+
setData(element, 'ujs:enable-with', element.value);
|
603
|
+
element.value = replacement;
|
604
|
+
}
|
605
|
+
}
|
606
|
+
element.disabled = true;
|
607
|
+
return setData(element, 'ujs:disabled', true);
|
608
|
+
};
|
609
|
+
|
610
|
+
enableFormElements = function(form) {
|
611
|
+
return formElements(form, Rails.formEnableSelector).forEach(enableFormElement);
|
612
|
+
};
|
613
|
+
|
614
|
+
enableFormElement = function(element) {
|
615
|
+
var originalText;
|
616
|
+
originalText = getData(element, 'ujs:enable-with');
|
617
|
+
if (originalText != null) {
|
618
|
+
if (matches(element, 'button')) {
|
619
|
+
element.innerHTML = originalText;
|
620
|
+
} else {
|
621
|
+
element.value = originalText;
|
622
|
+
}
|
623
|
+
setData(element, 'ujs:enable-with', null);
|
624
|
+
}
|
625
|
+
element.disabled = false;
|
626
|
+
return setData(element, 'ujs:disabled', null);
|
627
|
+
};
|
628
|
+
|
629
|
+
isXhrRedirect = function(event) {
|
630
|
+
var ref, xhr;
|
631
|
+
xhr = (ref = event.detail) != null ? ref[0] : void 0;
|
632
|
+
return (xhr != null ? xhr.getResponseHeader("X-Xhr-Redirect") : void 0) != null;
|
633
|
+
};
|
634
|
+
|
635
|
+
}).call(this);
|
636
|
+
(function() {
|
637
|
+
var stopEverything;
|
638
|
+
|
639
|
+
stopEverything = Rails.stopEverything;
|
640
|
+
|
641
|
+
Rails.handleMethod = function(e) {
|
642
|
+
var csrfParam, csrfToken, form, formContent, href, link, method;
|
643
|
+
link = this;
|
644
|
+
method = link.getAttribute('data-method');
|
645
|
+
if (!method) {
|
646
|
+
return;
|
647
|
+
}
|
648
|
+
href = Rails.href(link);
|
649
|
+
csrfToken = Rails.csrfToken();
|
650
|
+
csrfParam = Rails.csrfParam();
|
651
|
+
form = document.createElement('form');
|
652
|
+
formContent = "<input name='_method' value='" + method + "' type='hidden' />";
|
653
|
+
if ((csrfParam != null) && (csrfToken != null) && !Rails.isCrossDomain(href)) {
|
654
|
+
formContent += "<input name='" + csrfParam + "' value='" + csrfToken + "' type='hidden' />";
|
655
|
+
}
|
656
|
+
formContent += '<input type="submit" />';
|
657
|
+
form.method = 'post';
|
658
|
+
form.action = href;
|
659
|
+
form.target = link.target;
|
660
|
+
form.innerHTML = formContent;
|
661
|
+
form.style.display = 'none';
|
662
|
+
document.body.appendChild(form);
|
663
|
+
form.querySelector('[type="submit"]').click();
|
664
|
+
return stopEverything(e);
|
665
|
+
};
|
666
|
+
|
667
|
+
}).call(this);
|
668
|
+
(function() {
|
669
|
+
var ajax, fire, getData, isCrossDomain, isRemote, matches, serializeElement, setData, stopEverything,
|
670
|
+
slice = [].slice;
|
671
|
+
|
672
|
+
matches = Rails.matches, getData = Rails.getData, setData = Rails.setData, fire = Rails.fire, stopEverything = Rails.stopEverything, ajax = Rails.ajax, isCrossDomain = Rails.isCrossDomain, serializeElement = Rails.serializeElement;
|
673
|
+
|
674
|
+
isRemote = function(element) {
|
675
|
+
var value;
|
676
|
+
value = element.getAttribute('data-remote');
|
677
|
+
return (value != null) && value !== 'false';
|
678
|
+
};
|
679
|
+
|
680
|
+
Rails.handleRemote = function(e) {
|
681
|
+
var button, data, dataType, element, method, url, withCredentials;
|
682
|
+
element = this;
|
683
|
+
if (!isRemote(element)) {
|
684
|
+
return true;
|
685
|
+
}
|
686
|
+
if (!fire(element, 'ajax:before')) {
|
687
|
+
fire(element, 'ajax:stopped');
|
688
|
+
return false;
|
689
|
+
}
|
690
|
+
withCredentials = element.getAttribute('data-with-credentials');
|
691
|
+
dataType = element.getAttribute('data-type') || 'script';
|
692
|
+
if (matches(element, Rails.formSubmitSelector)) {
|
693
|
+
button = getData(element, 'ujs:submit-button');
|
694
|
+
method = getData(element, 'ujs:submit-button-formmethod') || element.method;
|
695
|
+
url = getData(element, 'ujs:submit-button-formaction') || element.getAttribute('action') || location.href;
|
696
|
+
if (method.toUpperCase() === 'GET') {
|
697
|
+
url = url.replace(/\?.*$/, '');
|
698
|
+
}
|
699
|
+
if (element.enctype === 'multipart/form-data') {
|
700
|
+
data = new FormData(element);
|
701
|
+
if (button != null) {
|
702
|
+
data.append(button.name, button.value);
|
703
|
+
}
|
704
|
+
} else {
|
705
|
+
data = serializeElement(element, button);
|
706
|
+
}
|
707
|
+
setData(element, 'ujs:submit-button', null);
|
708
|
+
setData(element, 'ujs:submit-button-formmethod', null);
|
709
|
+
setData(element, 'ujs:submit-button-formaction', null);
|
710
|
+
} else if (matches(element, Rails.buttonClickSelector) || matches(element, Rails.inputChangeSelector)) {
|
711
|
+
method = element.getAttribute('data-method');
|
712
|
+
url = element.getAttribute('data-url');
|
713
|
+
data = serializeElement(element, element.getAttribute('data-params'));
|
714
|
+
} else {
|
715
|
+
method = element.getAttribute('data-method');
|
716
|
+
url = Rails.href(element);
|
717
|
+
data = element.getAttribute('data-params');
|
718
|
+
}
|
719
|
+
ajax({
|
720
|
+
type: method || 'GET',
|
721
|
+
url: url,
|
722
|
+
data: data,
|
723
|
+
dataType: dataType,
|
724
|
+
beforeSend: function(xhr, options) {
|
725
|
+
if (fire(element, 'ajax:beforeSend', [xhr, options])) {
|
726
|
+
return fire(element, 'ajax:send', [xhr]);
|
727
|
+
} else {
|
728
|
+
fire(element, 'ajax:stopped');
|
729
|
+
return false;
|
730
|
+
}
|
731
|
+
},
|
732
|
+
success: function() {
|
733
|
+
var args;
|
734
|
+
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
735
|
+
return fire(element, 'ajax:success', args);
|
736
|
+
},
|
737
|
+
error: function() {
|
738
|
+
var args;
|
739
|
+
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
740
|
+
return fire(element, 'ajax:error', args);
|
741
|
+
},
|
742
|
+
complete: function() {
|
743
|
+
var args;
|
744
|
+
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
745
|
+
return fire(element, 'ajax:complete', args);
|
746
|
+
},
|
747
|
+
crossDomain: isCrossDomain(url),
|
748
|
+
withCredentials: (withCredentials != null) && withCredentials !== 'false'
|
749
|
+
});
|
750
|
+
return stopEverything(e);
|
751
|
+
};
|
752
|
+
|
753
|
+
Rails.formSubmitButtonClick = function(e) {
|
754
|
+
var button, form;
|
755
|
+
button = this;
|
756
|
+
form = button.form;
|
757
|
+
if (!form) {
|
758
|
+
return;
|
759
|
+
}
|
760
|
+
if (button.name) {
|
761
|
+
setData(form, 'ujs:submit-button', {
|
762
|
+
name: button.name,
|
763
|
+
value: button.value
|
764
|
+
});
|
765
|
+
}
|
766
|
+
setData(form, 'ujs:formnovalidate-button', button.formNoValidate);
|
767
|
+
setData(form, 'ujs:submit-button-formaction', button.getAttribute('formaction'));
|
768
|
+
return setData(form, 'ujs:submit-button-formmethod', button.getAttribute('formmethod'));
|
769
|
+
};
|
770
|
+
|
771
|
+
Rails.preventInsignificantClick = function(e) {
|
772
|
+
var data, insignificantMetaClick, link, metaClick, method, nonPrimaryMouseClick;
|
773
|
+
link = this;
|
774
|
+
method = (link.getAttribute('data-method') || 'GET').toUpperCase();
|
775
|
+
data = link.getAttribute('data-params');
|
776
|
+
metaClick = e.metaKey || e.ctrlKey;
|
777
|
+
insignificantMetaClick = metaClick && method === 'GET' && !data;
|
778
|
+
nonPrimaryMouseClick = (e.button != null) && e.button !== 0;
|
779
|
+
if (nonPrimaryMouseClick || insignificantMetaClick) {
|
780
|
+
return e.stopImmediatePropagation();
|
781
|
+
}
|
782
|
+
};
|
783
|
+
|
784
|
+
}).call(this);
|
785
|
+
(function() {
|
786
|
+
var $, CSRFProtection, delegate, disableElement, enableElement, fire, formSubmitButtonClick, getData, handleConfirm, handleDisabledElement, handleMethod, handleRemote, loadCSPNonce, preventInsignificantClick, refreshCSRFTokens;
|
787
|
+
|
788
|
+
fire = Rails.fire, delegate = Rails.delegate, getData = Rails.getData, $ = Rails.$, refreshCSRFTokens = Rails.refreshCSRFTokens, CSRFProtection = Rails.CSRFProtection, loadCSPNonce = Rails.loadCSPNonce, enableElement = Rails.enableElement, disableElement = Rails.disableElement, handleDisabledElement = Rails.handleDisabledElement, handleConfirm = Rails.handleConfirm, preventInsignificantClick = Rails.preventInsignificantClick, handleRemote = Rails.handleRemote, formSubmitButtonClick = Rails.formSubmitButtonClick, handleMethod = Rails.handleMethod;
|
789
|
+
|
790
|
+
if ((typeof jQuery !== "undefined" && jQuery !== null) && (jQuery.ajax != null)) {
|
791
|
+
if (jQuery.rails) {
|
792
|
+
throw new Error('If you load both jquery_ujs and rails-ujs, use rails-ujs only.');
|
793
|
+
}
|
794
|
+
jQuery.rails = Rails;
|
795
|
+
jQuery.ajaxPrefilter(function(options, originalOptions, xhr) {
|
796
|
+
if (!options.crossDomain) {
|
797
|
+
return CSRFProtection(xhr);
|
798
|
+
}
|
799
|
+
});
|
800
|
+
}
|
801
|
+
|
802
|
+
Rails.start = function() {
|
803
|
+
if (window._rails_loaded) {
|
804
|
+
throw new Error('rails-ujs has already been loaded!');
|
805
|
+
}
|
806
|
+
window.addEventListener('pageshow', function() {
|
807
|
+
$(Rails.formEnableSelector).forEach(function(el) {
|
808
|
+
if (getData(el, 'ujs:disabled')) {
|
809
|
+
return enableElement(el);
|
810
|
+
}
|
811
|
+
});
|
812
|
+
return $(Rails.linkDisableSelector).forEach(function(el) {
|
813
|
+
if (getData(el, 'ujs:disabled')) {
|
814
|
+
return enableElement(el);
|
815
|
+
}
|
816
|
+
});
|
817
|
+
});
|
818
|
+
delegate(document, Rails.linkDisableSelector, 'ajax:complete', enableElement);
|
819
|
+
delegate(document, Rails.linkDisableSelector, 'ajax:stopped', enableElement);
|
820
|
+
delegate(document, Rails.buttonDisableSelector, 'ajax:complete', enableElement);
|
821
|
+
delegate(document, Rails.buttonDisableSelector, 'ajax:stopped', enableElement);
|
822
|
+
delegate(document, Rails.linkClickSelector, 'click', preventInsignificantClick);
|
823
|
+
delegate(document, Rails.linkClickSelector, 'click', handleDisabledElement);
|
824
|
+
delegate(document, Rails.linkClickSelector, 'click', handleConfirm);
|
825
|
+
delegate(document, Rails.linkClickSelector, 'click', disableElement);
|
826
|
+
delegate(document, Rails.linkClickSelector, 'click', handleRemote);
|
827
|
+
delegate(document, Rails.linkClickSelector, 'click', handleMethod);
|
828
|
+
delegate(document, Rails.buttonClickSelector, 'click', preventInsignificantClick);
|
829
|
+
delegate(document, Rails.buttonClickSelector, 'click', handleDisabledElement);
|
830
|
+
delegate(document, Rails.buttonClickSelector, 'click', handleConfirm);
|
831
|
+
delegate(document, Rails.buttonClickSelector, 'click', disableElement);
|
832
|
+
delegate(document, Rails.buttonClickSelector, 'click', handleRemote);
|
833
|
+
delegate(document, Rails.inputChangeSelector, 'change', handleDisabledElement);
|
834
|
+
delegate(document, Rails.inputChangeSelector, 'change', handleConfirm);
|
835
|
+
delegate(document, Rails.inputChangeSelector, 'change', handleRemote);
|
836
|
+
delegate(document, Rails.formSubmitSelector, 'submit', handleDisabledElement);
|
837
|
+
delegate(document, Rails.formSubmitSelector, 'submit', handleConfirm);
|
838
|
+
delegate(document, Rails.formSubmitSelector, 'submit', handleRemote);
|
839
|
+
delegate(document, Rails.formSubmitSelector, 'submit', function(e) {
|
840
|
+
return setTimeout((function() {
|
841
|
+
return disableElement(e);
|
842
|
+
}), 13);
|
843
|
+
});
|
844
|
+
delegate(document, Rails.formSubmitSelector, 'ajax:send', disableElement);
|
845
|
+
delegate(document, Rails.formSubmitSelector, 'ajax:complete', enableElement);
|
846
|
+
delegate(document, Rails.formInputClickSelector, 'click', preventInsignificantClick);
|
847
|
+
delegate(document, Rails.formInputClickSelector, 'click', handleDisabledElement);
|
848
|
+
delegate(document, Rails.formInputClickSelector, 'click', handleConfirm);
|
849
|
+
delegate(document, Rails.formInputClickSelector, 'click', formSubmitButtonClick);
|
850
|
+
document.addEventListener('DOMContentLoaded', refreshCSRFTokens);
|
851
|
+
document.addEventListener('DOMContentLoaded', loadCSPNonce);
|
852
|
+
return window._rails_loaded = true;
|
853
|
+
};
|
854
|
+
|
855
|
+
if (window.Rails === Rails && fire(document, 'rails:attachBindings')) {
|
856
|
+
Rails.start();
|
857
|
+
}
|
858
|
+
|
859
|
+
}).call(this);
|
860
|
+
}).call(this);
|
861
|
+
|
862
|
+
if (typeof module === "object" && module.exports) {
|
863
|
+
module.exports = Rails;
|
864
|
+
} else if (typeof define === "function" && define.amd) {
|
865
|
+
define(Rails);
|
866
|
+
}
|
867
|
+
}).call(this);
|
868
|
+
|
869
|
+
},{}],"../node_modules/@stimulus/core/dist/src/event_listener.js":[function(require,module,exports) {
|
870
|
+
"use strict";
|
871
|
+
|
872
|
+
Object.defineProperty(exports, "__esModule", {
|
873
|
+
value: true
|
874
|
+
});
|
875
|
+
exports.EventListener = void 0;
|
876
|
+
|
877
|
+
var EventListener =
|
878
|
+
/** @class */
|
879
|
+
function () {
|
880
|
+
function EventListener(eventTarget, eventName) {
|
881
|
+
this.eventTarget = eventTarget;
|
882
|
+
this.eventName = eventName;
|
883
|
+
this.unorderedBindings = new Set();
|
884
|
+
}
|
885
|
+
|
886
|
+
EventListener.prototype.connect = function () {
|
887
|
+
this.eventTarget.addEventListener(this.eventName, this, false);
|
888
|
+
};
|
889
|
+
|
890
|
+
EventListener.prototype.disconnect = function () {
|
891
|
+
this.eventTarget.removeEventListener(this.eventName, this, false);
|
892
|
+
}; // Binding observer delegate
|
893
|
+
|
894
|
+
/** @hidden */
|
895
|
+
|
896
|
+
|
897
|
+
EventListener.prototype.bindingConnected = function (binding) {
|
898
|
+
this.unorderedBindings.add(binding);
|
899
|
+
};
|
900
|
+
/** @hidden */
|
901
|
+
|
902
|
+
|
903
|
+
EventListener.prototype.bindingDisconnected = function (binding) {
|
904
|
+
this.unorderedBindings.delete(binding);
|
905
|
+
};
|
906
|
+
|
907
|
+
EventListener.prototype.handleEvent = function (event) {
|
908
|
+
var extendedEvent = extendEvent(event);
|
909
|
+
|
910
|
+
for (var _i = 0, _a = this.bindings; _i < _a.length; _i++) {
|
911
|
+
var binding = _a[_i];
|
912
|
+
|
913
|
+
if (extendedEvent.immediatePropagationStopped) {
|
914
|
+
break;
|
915
|
+
} else {
|
916
|
+
binding.handleEvent(extendedEvent);
|
917
|
+
}
|
918
|
+
}
|
919
|
+
};
|
920
|
+
|
921
|
+
Object.defineProperty(EventListener.prototype, "bindings", {
|
922
|
+
get: function () {
|
923
|
+
return Array.from(this.unorderedBindings).sort(function (left, right) {
|
924
|
+
var leftIndex = left.index,
|
925
|
+
rightIndex = right.index;
|
926
|
+
return leftIndex < rightIndex ? -1 : leftIndex > rightIndex ? 1 : 0;
|
927
|
+
});
|
928
|
+
},
|
929
|
+
enumerable: true,
|
930
|
+
configurable: true
|
931
|
+
});
|
932
|
+
return EventListener;
|
933
|
+
}();
|
934
|
+
|
935
|
+
exports.EventListener = EventListener;
|
936
|
+
|
937
|
+
function extendEvent(event) {
|
938
|
+
if ("immediatePropagationStopped" in event) {
|
939
|
+
return event;
|
940
|
+
} else {
|
941
|
+
var stopImmediatePropagation_1 = event.stopImmediatePropagation;
|
942
|
+
return Object.assign(event, {
|
943
|
+
immediatePropagationStopped: false,
|
944
|
+
stopImmediatePropagation: function () {
|
945
|
+
this.immediatePropagationStopped = true;
|
946
|
+
stopImmediatePropagation_1.call(this);
|
947
|
+
}
|
948
|
+
});
|
949
|
+
}
|
950
|
+
}
|
951
|
+
},{}],"../node_modules/@stimulus/core/dist/src/dispatcher.js":[function(require,module,exports) {
|
952
|
+
"use strict";
|
953
|
+
|
954
|
+
Object.defineProperty(exports, "__esModule", {
|
955
|
+
value: true
|
956
|
+
});
|
957
|
+
exports.Dispatcher = void 0;
|
958
|
+
|
959
|
+
var _event_listener = require("./event_listener");
|
960
|
+
|
961
|
+
var Dispatcher =
|
962
|
+
/** @class */
|
963
|
+
function () {
|
964
|
+
function Dispatcher(application) {
|
965
|
+
this.application = application;
|
966
|
+
this.eventListenerMaps = new Map();
|
967
|
+
this.started = false;
|
968
|
+
}
|
969
|
+
|
970
|
+
Dispatcher.prototype.start = function () {
|
971
|
+
if (!this.started) {
|
972
|
+
this.started = true;
|
973
|
+
this.eventListeners.forEach(function (eventListener) {
|
974
|
+
return eventListener.connect();
|
975
|
+
});
|
976
|
+
}
|
977
|
+
};
|
978
|
+
|
979
|
+
Dispatcher.prototype.stop = function () {
|
980
|
+
if (this.started) {
|
981
|
+
this.started = false;
|
982
|
+
this.eventListeners.forEach(function (eventListener) {
|
983
|
+
return eventListener.disconnect();
|
984
|
+
});
|
985
|
+
}
|
986
|
+
};
|
987
|
+
|
988
|
+
Object.defineProperty(Dispatcher.prototype, "eventListeners", {
|
989
|
+
get: function () {
|
990
|
+
return Array.from(this.eventListenerMaps.values()).reduce(function (listeners, map) {
|
991
|
+
return listeners.concat(Array.from(map.values()));
|
992
|
+
}, []);
|
993
|
+
},
|
994
|
+
enumerable: true,
|
995
|
+
configurable: true
|
996
|
+
}); // Binding observer delegate
|
997
|
+
|
998
|
+
/** @hidden */
|
999
|
+
|
1000
|
+
Dispatcher.prototype.bindingConnected = function (binding) {
|
1001
|
+
this.fetchEventListenerForBinding(binding).bindingConnected(binding);
|
1002
|
+
};
|
1003
|
+
/** @hidden */
|
1004
|
+
|
1005
|
+
|
1006
|
+
Dispatcher.prototype.bindingDisconnected = function (binding) {
|
1007
|
+
this.fetchEventListenerForBinding(binding).bindingDisconnected(binding);
|
1008
|
+
}; // Error handling
|
1009
|
+
|
1010
|
+
|
1011
|
+
Dispatcher.prototype.handleError = function (error, message, detail) {
|
1012
|
+
if (detail === void 0) {
|
1013
|
+
detail = {};
|
1014
|
+
}
|
1015
|
+
|
1016
|
+
this.application.handleError(error, "Error " + message, detail);
|
1017
|
+
};
|
1018
|
+
|
1019
|
+
Dispatcher.prototype.fetchEventListenerForBinding = function (binding) {
|
1020
|
+
var eventTarget = binding.eventTarget,
|
1021
|
+
eventName = binding.eventName;
|
1022
|
+
return this.fetchEventListener(eventTarget, eventName);
|
1023
|
+
};
|
1024
|
+
|
1025
|
+
Dispatcher.prototype.fetchEventListener = function (eventTarget, eventName) {
|
1026
|
+
var eventListenerMap = this.fetchEventListenerMapForEventTarget(eventTarget);
|
1027
|
+
var eventListener = eventListenerMap.get(eventName);
|
1028
|
+
|
1029
|
+
if (!eventListener) {
|
1030
|
+
eventListener = this.createEventListener(eventTarget, eventName);
|
1031
|
+
eventListenerMap.set(eventName, eventListener);
|
1032
|
+
}
|
1033
|
+
|
1034
|
+
return eventListener;
|
1035
|
+
};
|
1036
|
+
|
1037
|
+
Dispatcher.prototype.createEventListener = function (eventTarget, eventName) {
|
1038
|
+
var eventListener = new _event_listener.EventListener(eventTarget, eventName);
|
1039
|
+
|
1040
|
+
if (this.started) {
|
1041
|
+
eventListener.connect();
|
1042
|
+
}
|
1043
|
+
|
1044
|
+
return eventListener;
|
1045
|
+
};
|
1046
|
+
|
1047
|
+
Dispatcher.prototype.fetchEventListenerMapForEventTarget = function (eventTarget) {
|
1048
|
+
var eventListenerMap = this.eventListenerMaps.get(eventTarget);
|
1049
|
+
|
1050
|
+
if (!eventListenerMap) {
|
1051
|
+
eventListenerMap = new Map();
|
1052
|
+
this.eventListenerMaps.set(eventTarget, eventListenerMap);
|
1053
|
+
}
|
1054
|
+
|
1055
|
+
return eventListenerMap;
|
1056
|
+
};
|
1057
|
+
|
1058
|
+
return Dispatcher;
|
1059
|
+
}();
|
1060
|
+
|
1061
|
+
exports.Dispatcher = Dispatcher;
|
1062
|
+
},{"./event_listener":"../node_modules/@stimulus/core/dist/src/event_listener.js"}],"../node_modules/@stimulus/core/dist/src/action_descriptor.js":[function(require,module,exports) {
|
1063
|
+
"use strict";
|
1064
|
+
|
1065
|
+
Object.defineProperty(exports, "__esModule", {
|
1066
|
+
value: true
|
1067
|
+
});
|
1068
|
+
exports.parseDescriptorString = parseDescriptorString;
|
1069
|
+
exports.stringifyEventTarget = stringifyEventTarget;
|
1070
|
+
// capture nos.: 12 23 4 43 1 5 56 7 76
|
1071
|
+
var descriptorPattern = /^((.+?)(@(window|document))?->)?(.+?)(#(.+))?$/;
|
1072
|
+
|
1073
|
+
function parseDescriptorString(descriptorString) {
|
1074
|
+
var source = descriptorString.trim();
|
1075
|
+
var matches = source.match(descriptorPattern) || [];
|
1076
|
+
return {
|
1077
|
+
eventTarget: parseEventTarget(matches[4]),
|
1078
|
+
eventName: matches[2],
|
1079
|
+
identifier: matches[5],
|
1080
|
+
methodName: matches[7]
|
1081
|
+
};
|
1082
|
+
}
|
1083
|
+
|
1084
|
+
function parseEventTarget(eventTargetName) {
|
1085
|
+
if (eventTargetName == "window") {
|
1086
|
+
return window;
|
1087
|
+
} else if (eventTargetName == "document") {
|
1088
|
+
return document;
|
1089
|
+
}
|
1090
|
+
}
|
1091
|
+
|
1092
|
+
function stringifyEventTarget(eventTarget) {
|
1093
|
+
if (eventTarget == window) {
|
1094
|
+
return "window";
|
1095
|
+
} else if (eventTarget == document) {
|
1096
|
+
return "document";
|
1097
|
+
}
|
1098
|
+
}
|
1099
|
+
},{}],"../node_modules/@stimulus/core/dist/src/action.js":[function(require,module,exports) {
|
1100
|
+
"use strict";
|
1101
|
+
|
1102
|
+
Object.defineProperty(exports, "__esModule", {
|
1103
|
+
value: true
|
1104
|
+
});
|
1105
|
+
exports.getDefaultEventNameForElement = getDefaultEventNameForElement;
|
1106
|
+
exports.Action = void 0;
|
1107
|
+
|
1108
|
+
var _action_descriptor = require("./action_descriptor");
|
1109
|
+
|
1110
|
+
var Action =
|
1111
|
+
/** @class */
|
1112
|
+
function () {
|
1113
|
+
function Action(element, index, descriptor) {
|
1114
|
+
this.element = element;
|
1115
|
+
this.index = index;
|
1116
|
+
this.eventTarget = descriptor.eventTarget || element;
|
1117
|
+
this.eventName = descriptor.eventName || getDefaultEventNameForElement(element) || error("missing event name");
|
1118
|
+
this.identifier = descriptor.identifier || error("missing identifier");
|
1119
|
+
this.methodName = descriptor.methodName || error("missing method name");
|
1120
|
+
}
|
1121
|
+
|
1122
|
+
Action.forToken = function (token) {
|
1123
|
+
return new this(token.element, token.index, (0, _action_descriptor.parseDescriptorString)(token.content));
|
1124
|
+
};
|
1125
|
+
|
1126
|
+
Action.prototype.toString = function () {
|
1127
|
+
var eventNameSuffix = this.eventTargetName ? "@" + this.eventTargetName : "";
|
1128
|
+
return "" + this.eventName + eventNameSuffix + "->" + this.identifier + "#" + this.methodName;
|
1129
|
+
};
|
1130
|
+
|
1131
|
+
Object.defineProperty(Action.prototype, "eventTargetName", {
|
1132
|
+
get: function () {
|
1133
|
+
return (0, _action_descriptor.stringifyEventTarget)(this.eventTarget);
|
1134
|
+
},
|
1135
|
+
enumerable: true,
|
1136
|
+
configurable: true
|
1137
|
+
});
|
1138
|
+
return Action;
|
1139
|
+
}();
|
1140
|
+
|
1141
|
+
exports.Action = Action;
|
1142
|
+
var defaultEventNames = {
|
1143
|
+
"a": function (e) {
|
1144
|
+
return "click";
|
1145
|
+
},
|
1146
|
+
"button": function (e) {
|
1147
|
+
return "click";
|
1148
|
+
},
|
1149
|
+
"form": function (e) {
|
1150
|
+
return "submit";
|
1151
|
+
},
|
1152
|
+
"input": function (e) {
|
1153
|
+
return e.getAttribute("type") == "submit" ? "click" : "change";
|
1154
|
+
},
|
1155
|
+
"select": function (e) {
|
1156
|
+
return "change";
|
1157
|
+
},
|
1158
|
+
"textarea": function (e) {
|
1159
|
+
return "change";
|
1160
|
+
}
|
1161
|
+
};
|
1162
|
+
|
1163
|
+
function getDefaultEventNameForElement(element) {
|
1164
|
+
var tagName = element.tagName.toLowerCase();
|
1165
|
+
|
1166
|
+
if (tagName in defaultEventNames) {
|
1167
|
+
return defaultEventNames[tagName](element);
|
1168
|
+
}
|
1169
|
+
}
|
1170
|
+
|
1171
|
+
function error(message) {
|
1172
|
+
throw new Error(message);
|
1173
|
+
}
|
1174
|
+
},{"./action_descriptor":"../node_modules/@stimulus/core/dist/src/action_descriptor.js"}],"../node_modules/@stimulus/core/dist/src/binding.js":[function(require,module,exports) {
|
1175
|
+
"use strict";
|
1176
|
+
|
1177
|
+
Object.defineProperty(exports, "__esModule", {
|
1178
|
+
value: true
|
1179
|
+
});
|
1180
|
+
exports.Binding = void 0;
|
1181
|
+
|
1182
|
+
var Binding =
|
1183
|
+
/** @class */
|
1184
|
+
function () {
|
1185
|
+
function Binding(context, action) {
|
1186
|
+
this.context = context;
|
1187
|
+
this.action = action;
|
1188
|
+
}
|
1189
|
+
|
1190
|
+
Object.defineProperty(Binding.prototype, "index", {
|
1191
|
+
get: function () {
|
1192
|
+
return this.action.index;
|
1193
|
+
},
|
1194
|
+
enumerable: true,
|
1195
|
+
configurable: true
|
1196
|
+
});
|
1197
|
+
Object.defineProperty(Binding.prototype, "eventTarget", {
|
1198
|
+
get: function () {
|
1199
|
+
return this.action.eventTarget;
|
1200
|
+
},
|
1201
|
+
enumerable: true,
|
1202
|
+
configurable: true
|
1203
|
+
});
|
1204
|
+
Object.defineProperty(Binding.prototype, "identifier", {
|
1205
|
+
get: function () {
|
1206
|
+
return this.context.identifier;
|
1207
|
+
},
|
1208
|
+
enumerable: true,
|
1209
|
+
configurable: true
|
1210
|
+
});
|
1211
|
+
|
1212
|
+
Binding.prototype.handleEvent = function (event) {
|
1213
|
+
if (this.willBeInvokedByEvent(event)) {
|
1214
|
+
this.invokeWithEvent(event);
|
1215
|
+
}
|
1216
|
+
};
|
1217
|
+
|
1218
|
+
Object.defineProperty(Binding.prototype, "eventName", {
|
1219
|
+
get: function () {
|
1220
|
+
return this.action.eventName;
|
1221
|
+
},
|
1222
|
+
enumerable: true,
|
1223
|
+
configurable: true
|
1224
|
+
});
|
1225
|
+
Object.defineProperty(Binding.prototype, "method", {
|
1226
|
+
get: function () {
|
1227
|
+
var method = this.controller[this.methodName];
|
1228
|
+
|
1229
|
+
if (typeof method == "function") {
|
1230
|
+
return method;
|
1231
|
+
}
|
1232
|
+
|
1233
|
+
throw new Error("Action \"" + this.action + "\" references undefined method \"" + this.methodName + "\"");
|
1234
|
+
},
|
1235
|
+
enumerable: true,
|
1236
|
+
configurable: true
|
1237
|
+
});
|
1238
|
+
|
1239
|
+
Binding.prototype.invokeWithEvent = function (event) {
|
1240
|
+
try {
|
1241
|
+
this.method.call(this.controller, event);
|
1242
|
+
} catch (error) {
|
1243
|
+
var _a = this,
|
1244
|
+
identifier = _a.identifier,
|
1245
|
+
controller = _a.controller,
|
1246
|
+
element = _a.element,
|
1247
|
+
index = _a.index;
|
1248
|
+
|
1249
|
+
var detail = {
|
1250
|
+
identifier: identifier,
|
1251
|
+
controller: controller,
|
1252
|
+
element: element,
|
1253
|
+
index: index,
|
1254
|
+
event: event
|
1255
|
+
};
|
1256
|
+
this.context.handleError(error, "invoking action \"" + this.action + "\"", detail);
|
1257
|
+
}
|
1258
|
+
};
|
1259
|
+
|
1260
|
+
Binding.prototype.willBeInvokedByEvent = function (event) {
|
1261
|
+
var eventTarget = event.target;
|
1262
|
+
|
1263
|
+
if (this.element === eventTarget) {
|
1264
|
+
return true;
|
1265
|
+
} else if (eventTarget instanceof Element && this.element.contains(eventTarget)) {
|
1266
|
+
return this.scope.containsElement(eventTarget);
|
1267
|
+
} else {
|
1268
|
+
return true;
|
1269
|
+
}
|
1270
|
+
};
|
1271
|
+
|
1272
|
+
Object.defineProperty(Binding.prototype, "controller", {
|
1273
|
+
get: function () {
|
1274
|
+
return this.context.controller;
|
1275
|
+
},
|
1276
|
+
enumerable: true,
|
1277
|
+
configurable: true
|
1278
|
+
});
|
1279
|
+
Object.defineProperty(Binding.prototype, "methodName", {
|
1280
|
+
get: function () {
|
1281
|
+
return this.action.methodName;
|
1282
|
+
},
|
1283
|
+
enumerable: true,
|
1284
|
+
configurable: true
|
1285
|
+
});
|
1286
|
+
Object.defineProperty(Binding.prototype, "element", {
|
1287
|
+
get: function () {
|
1288
|
+
return this.scope.element;
|
1289
|
+
},
|
1290
|
+
enumerable: true,
|
1291
|
+
configurable: true
|
1292
|
+
});
|
1293
|
+
Object.defineProperty(Binding.prototype, "scope", {
|
1294
|
+
get: function () {
|
1295
|
+
return this.context.scope;
|
1296
|
+
},
|
1297
|
+
enumerable: true,
|
1298
|
+
configurable: true
|
1299
|
+
});
|
1300
|
+
return Binding;
|
1301
|
+
}();
|
1302
|
+
|
1303
|
+
exports.Binding = Binding;
|
1304
|
+
},{}],"../node_modules/@stimulus/mutation-observers/dist/src/element_observer.js":[function(require,module,exports) {
|
1305
|
+
"use strict";
|
1306
|
+
|
1307
|
+
Object.defineProperty(exports, "__esModule", {
|
1308
|
+
value: true
|
1309
|
+
});
|
1310
|
+
exports.ElementObserver = void 0;
|
1311
|
+
|
1312
|
+
var ElementObserver =
|
1313
|
+
/** @class */
|
1314
|
+
function () {
|
1315
|
+
function ElementObserver(element, delegate) {
|
1316
|
+
var _this = this;
|
1317
|
+
|
1318
|
+
this.element = element;
|
1319
|
+
this.started = false;
|
1320
|
+
this.delegate = delegate;
|
1321
|
+
this.elements = new Set();
|
1322
|
+
this.mutationObserver = new MutationObserver(function (mutations) {
|
1323
|
+
return _this.processMutations(mutations);
|
1324
|
+
});
|
1325
|
+
}
|
1326
|
+
|
1327
|
+
ElementObserver.prototype.start = function () {
|
1328
|
+
if (!this.started) {
|
1329
|
+
this.started = true;
|
1330
|
+
this.mutationObserver.observe(this.element, {
|
1331
|
+
attributes: true,
|
1332
|
+
childList: true,
|
1333
|
+
subtree: true
|
1334
|
+
});
|
1335
|
+
this.refresh();
|
1336
|
+
}
|
1337
|
+
};
|
1338
|
+
|
1339
|
+
ElementObserver.prototype.stop = function () {
|
1340
|
+
if (this.started) {
|
1341
|
+
this.mutationObserver.takeRecords();
|
1342
|
+
this.mutationObserver.disconnect();
|
1343
|
+
this.started = false;
|
1344
|
+
}
|
1345
|
+
};
|
1346
|
+
|
1347
|
+
ElementObserver.prototype.refresh = function () {
|
1348
|
+
if (this.started) {
|
1349
|
+
var matches = new Set(this.matchElementsInTree());
|
1350
|
+
|
1351
|
+
for (var _i = 0, _a = Array.from(this.elements); _i < _a.length; _i++) {
|
1352
|
+
var element = _a[_i];
|
1353
|
+
|
1354
|
+
if (!matches.has(element)) {
|
1355
|
+
this.removeElement(element);
|
1356
|
+
}
|
1357
|
+
}
|
1358
|
+
|
1359
|
+
for (var _b = 0, _c = Array.from(matches); _b < _c.length; _b++) {
|
1360
|
+
var element = _c[_b];
|
1361
|
+
this.addElement(element);
|
1362
|
+
}
|
1363
|
+
}
|
1364
|
+
}; // Mutation record processing
|
1365
|
+
|
1366
|
+
|
1367
|
+
ElementObserver.prototype.processMutations = function (mutations) {
|
1368
|
+
if (this.started) {
|
1369
|
+
for (var _i = 0, mutations_1 = mutations; _i < mutations_1.length; _i++) {
|
1370
|
+
var mutation = mutations_1[_i];
|
1371
|
+
this.processMutation(mutation);
|
1372
|
+
}
|
1373
|
+
}
|
1374
|
+
};
|
1375
|
+
|
1376
|
+
ElementObserver.prototype.processMutation = function (mutation) {
|
1377
|
+
if (mutation.type == "attributes") {
|
1378
|
+
this.processAttributeChange(mutation.target, mutation.attributeName);
|
1379
|
+
} else if (mutation.type == "childList") {
|
1380
|
+
this.processRemovedNodes(mutation.removedNodes);
|
1381
|
+
this.processAddedNodes(mutation.addedNodes);
|
1382
|
+
}
|
1383
|
+
};
|
1384
|
+
|
1385
|
+
ElementObserver.prototype.processAttributeChange = function (node, attributeName) {
|
1386
|
+
var element = node;
|
1387
|
+
|
1388
|
+
if (this.elements.has(element)) {
|
1389
|
+
if (this.delegate.elementAttributeChanged && this.matchElement(element)) {
|
1390
|
+
this.delegate.elementAttributeChanged(element, attributeName);
|
1391
|
+
} else {
|
1392
|
+
this.removeElement(element);
|
1393
|
+
}
|
1394
|
+
} else if (this.matchElement(element)) {
|
1395
|
+
this.addElement(element);
|
1396
|
+
}
|
1397
|
+
};
|
1398
|
+
|
1399
|
+
ElementObserver.prototype.processRemovedNodes = function (nodes) {
|
1400
|
+
for (var _i = 0, _a = Array.from(nodes); _i < _a.length; _i++) {
|
1401
|
+
var node = _a[_i];
|
1402
|
+
var element = this.elementFromNode(node);
|
1403
|
+
|
1404
|
+
if (element) {
|
1405
|
+
this.processTree(element, this.removeElement);
|
1406
|
+
}
|
1407
|
+
}
|
1408
|
+
};
|
1409
|
+
|
1410
|
+
ElementObserver.prototype.processAddedNodes = function (nodes) {
|
1411
|
+
for (var _i = 0, _a = Array.from(nodes); _i < _a.length; _i++) {
|
1412
|
+
var node = _a[_i];
|
1413
|
+
var element = this.elementFromNode(node);
|
1414
|
+
|
1415
|
+
if (element && this.elementIsActive(element)) {
|
1416
|
+
this.processTree(element, this.addElement);
|
1417
|
+
}
|
1418
|
+
}
|
1419
|
+
}; // Element matching
|
1420
|
+
|
1421
|
+
|
1422
|
+
ElementObserver.prototype.matchElement = function (element) {
|
1423
|
+
return this.delegate.matchElement(element);
|
1424
|
+
};
|
1425
|
+
|
1426
|
+
ElementObserver.prototype.matchElementsInTree = function (tree) {
|
1427
|
+
if (tree === void 0) {
|
1428
|
+
tree = this.element;
|
1429
|
+
}
|
1430
|
+
|
1431
|
+
return this.delegate.matchElementsInTree(tree);
|
1432
|
+
};
|
1433
|
+
|
1434
|
+
ElementObserver.prototype.processTree = function (tree, processor) {
|
1435
|
+
for (var _i = 0, _a = this.matchElementsInTree(tree); _i < _a.length; _i++) {
|
1436
|
+
var element = _a[_i];
|
1437
|
+
processor.call(this, element);
|
1438
|
+
}
|
1439
|
+
};
|
1440
|
+
|
1441
|
+
ElementObserver.prototype.elementFromNode = function (node) {
|
1442
|
+
if (node.nodeType == Node.ELEMENT_NODE) {
|
1443
|
+
return node;
|
1444
|
+
}
|
1445
|
+
};
|
1446
|
+
|
1447
|
+
ElementObserver.prototype.elementIsActive = function (element) {
|
1448
|
+
if (element.isConnected != this.element.isConnected) {
|
1449
|
+
return false;
|
1450
|
+
} else {
|
1451
|
+
return this.element.contains(element);
|
1452
|
+
}
|
1453
|
+
}; // Element tracking
|
1454
|
+
|
1455
|
+
|
1456
|
+
ElementObserver.prototype.addElement = function (element) {
|
1457
|
+
if (!this.elements.has(element)) {
|
1458
|
+
if (this.elementIsActive(element)) {
|
1459
|
+
this.elements.add(element);
|
1460
|
+
|
1461
|
+
if (this.delegate.elementMatched) {
|
1462
|
+
this.delegate.elementMatched(element);
|
1463
|
+
}
|
1464
|
+
}
|
1465
|
+
}
|
1466
|
+
};
|
1467
|
+
|
1468
|
+
ElementObserver.prototype.removeElement = function (element) {
|
1469
|
+
if (this.elements.has(element)) {
|
1470
|
+
this.elements.delete(element);
|
1471
|
+
|
1472
|
+
if (this.delegate.elementUnmatched) {
|
1473
|
+
this.delegate.elementUnmatched(element);
|
1474
|
+
}
|
1475
|
+
}
|
1476
|
+
};
|
1477
|
+
|
1478
|
+
return ElementObserver;
|
1479
|
+
}();
|
1480
|
+
|
1481
|
+
exports.ElementObserver = ElementObserver;
|
1482
|
+
},{}],"../node_modules/@stimulus/mutation-observers/dist/src/attribute_observer.js":[function(require,module,exports) {
|
1483
|
+
"use strict";
|
1484
|
+
|
1485
|
+
Object.defineProperty(exports, "__esModule", {
|
1486
|
+
value: true
|
1487
|
+
});
|
1488
|
+
exports.AttributeObserver = void 0;
|
1489
|
+
|
1490
|
+
var _element_observer = require("./element_observer");
|
1491
|
+
|
1492
|
+
var AttributeObserver =
|
1493
|
+
/** @class */
|
1494
|
+
function () {
|
1495
|
+
function AttributeObserver(element, attributeName, delegate) {
|
1496
|
+
this.attributeName = attributeName;
|
1497
|
+
this.delegate = delegate;
|
1498
|
+
this.elementObserver = new _element_observer.ElementObserver(element, this);
|
1499
|
+
}
|
1500
|
+
|
1501
|
+
Object.defineProperty(AttributeObserver.prototype, "element", {
|
1502
|
+
get: function () {
|
1503
|
+
return this.elementObserver.element;
|
1504
|
+
},
|
1505
|
+
enumerable: true,
|
1506
|
+
configurable: true
|
1507
|
+
});
|
1508
|
+
Object.defineProperty(AttributeObserver.prototype, "selector", {
|
1509
|
+
get: function () {
|
1510
|
+
return "[" + this.attributeName + "]";
|
1511
|
+
},
|
1512
|
+
enumerable: true,
|
1513
|
+
configurable: true
|
1514
|
+
});
|
1515
|
+
|
1516
|
+
AttributeObserver.prototype.start = function () {
|
1517
|
+
this.elementObserver.start();
|
1518
|
+
};
|
1519
|
+
|
1520
|
+
AttributeObserver.prototype.stop = function () {
|
1521
|
+
this.elementObserver.stop();
|
1522
|
+
};
|
1523
|
+
|
1524
|
+
AttributeObserver.prototype.refresh = function () {
|
1525
|
+
this.elementObserver.refresh();
|
1526
|
+
};
|
1527
|
+
|
1528
|
+
Object.defineProperty(AttributeObserver.prototype, "started", {
|
1529
|
+
get: function () {
|
1530
|
+
return this.elementObserver.started;
|
1531
|
+
},
|
1532
|
+
enumerable: true,
|
1533
|
+
configurable: true
|
1534
|
+
}); // Element observer delegate
|
1535
|
+
|
1536
|
+
AttributeObserver.prototype.matchElement = function (element) {
|
1537
|
+
return element.hasAttribute(this.attributeName);
|
1538
|
+
};
|
1539
|
+
|
1540
|
+
AttributeObserver.prototype.matchElementsInTree = function (tree) {
|
1541
|
+
var match = this.matchElement(tree) ? [tree] : [];
|
1542
|
+
var matches = Array.from(tree.querySelectorAll(this.selector));
|
1543
|
+
return match.concat(matches);
|
1544
|
+
};
|
1545
|
+
|
1546
|
+
AttributeObserver.prototype.elementMatched = function (element) {
|
1547
|
+
if (this.delegate.elementMatchedAttribute) {
|
1548
|
+
this.delegate.elementMatchedAttribute(element, this.attributeName);
|
1549
|
+
}
|
1550
|
+
};
|
1551
|
+
|
1552
|
+
AttributeObserver.prototype.elementUnmatched = function (element) {
|
1553
|
+
if (this.delegate.elementUnmatchedAttribute) {
|
1554
|
+
this.delegate.elementUnmatchedAttribute(element, this.attributeName);
|
1555
|
+
}
|
1556
|
+
};
|
1557
|
+
|
1558
|
+
AttributeObserver.prototype.elementAttributeChanged = function (element, attributeName) {
|
1559
|
+
if (this.delegate.elementAttributeValueChanged && this.attributeName == attributeName) {
|
1560
|
+
this.delegate.elementAttributeValueChanged(element, attributeName);
|
1561
|
+
}
|
1562
|
+
};
|
1563
|
+
|
1564
|
+
return AttributeObserver;
|
1565
|
+
}();
|
1566
|
+
|
1567
|
+
exports.AttributeObserver = AttributeObserver;
|
1568
|
+
},{"./element_observer":"../node_modules/@stimulus/mutation-observers/dist/src/element_observer.js"}],"../node_modules/@stimulus/multimap/dist/src/set_operations.js":[function(require,module,exports) {
|
1569
|
+
"use strict";
|
1570
|
+
|
1571
|
+
Object.defineProperty(exports, "__esModule", {
|
1572
|
+
value: true
|
1573
|
+
});
|
1574
|
+
exports.add = add;
|
1575
|
+
exports.del = del;
|
1576
|
+
exports.fetch = fetch;
|
1577
|
+
exports.prune = prune;
|
1578
|
+
|
1579
|
+
function add(map, key, value) {
|
1580
|
+
fetch(map, key).add(value);
|
1581
|
+
}
|
1582
|
+
|
1583
|
+
function del(map, key, value) {
|
1584
|
+
fetch(map, key).delete(value);
|
1585
|
+
prune(map, key);
|
1586
|
+
}
|
1587
|
+
|
1588
|
+
function fetch(map, key) {
|
1589
|
+
var values = map.get(key);
|
1590
|
+
|
1591
|
+
if (!values) {
|
1592
|
+
values = new Set();
|
1593
|
+
map.set(key, values);
|
1594
|
+
}
|
1595
|
+
|
1596
|
+
return values;
|
1597
|
+
}
|
1598
|
+
|
1599
|
+
function prune(map, key) {
|
1600
|
+
var values = map.get(key);
|
1601
|
+
|
1602
|
+
if (values != null && values.size == 0) {
|
1603
|
+
map.delete(key);
|
1604
|
+
}
|
1605
|
+
}
|
1606
|
+
},{}],"../node_modules/@stimulus/multimap/dist/src/multimap.js":[function(require,module,exports) {
|
1607
|
+
"use strict";
|
1608
|
+
|
1609
|
+
Object.defineProperty(exports, "__esModule", {
|
1610
|
+
value: true
|
1611
|
+
});
|
1612
|
+
exports.Multimap = void 0;
|
1613
|
+
|
1614
|
+
var _set_operations = require("./set_operations");
|
1615
|
+
|
1616
|
+
var Multimap =
|
1617
|
+
/** @class */
|
1618
|
+
function () {
|
1619
|
+
function Multimap() {
|
1620
|
+
this.valuesByKey = new Map();
|
1621
|
+
}
|
1622
|
+
|
1623
|
+
Object.defineProperty(Multimap.prototype, "values", {
|
1624
|
+
get: function () {
|
1625
|
+
var sets = Array.from(this.valuesByKey.values());
|
1626
|
+
return sets.reduce(function (values, set) {
|
1627
|
+
return values.concat(Array.from(set));
|
1628
|
+
}, []);
|
1629
|
+
},
|
1630
|
+
enumerable: true,
|
1631
|
+
configurable: true
|
1632
|
+
});
|
1633
|
+
Object.defineProperty(Multimap.prototype, "size", {
|
1634
|
+
get: function () {
|
1635
|
+
var sets = Array.from(this.valuesByKey.values());
|
1636
|
+
return sets.reduce(function (size, set) {
|
1637
|
+
return size + set.size;
|
1638
|
+
}, 0);
|
1639
|
+
},
|
1640
|
+
enumerable: true,
|
1641
|
+
configurable: true
|
1642
|
+
});
|
1643
|
+
|
1644
|
+
Multimap.prototype.add = function (key, value) {
|
1645
|
+
(0, _set_operations.add)(this.valuesByKey, key, value);
|
1646
|
+
};
|
1647
|
+
|
1648
|
+
Multimap.prototype.delete = function (key, value) {
|
1649
|
+
(0, _set_operations.del)(this.valuesByKey, key, value);
|
1650
|
+
};
|
1651
|
+
|
1652
|
+
Multimap.prototype.has = function (key, value) {
|
1653
|
+
var values = this.valuesByKey.get(key);
|
1654
|
+
return values != null && values.has(value);
|
1655
|
+
};
|
1656
|
+
|
1657
|
+
Multimap.prototype.hasKey = function (key) {
|
1658
|
+
return this.valuesByKey.has(key);
|
1659
|
+
};
|
1660
|
+
|
1661
|
+
Multimap.prototype.hasValue = function (value) {
|
1662
|
+
var sets = Array.from(this.valuesByKey.values());
|
1663
|
+
return sets.some(function (set) {
|
1664
|
+
return set.has(value);
|
1665
|
+
});
|
1666
|
+
};
|
1667
|
+
|
1668
|
+
Multimap.prototype.getValuesForKey = function (key) {
|
1669
|
+
var values = this.valuesByKey.get(key);
|
1670
|
+
return values ? Array.from(values) : [];
|
1671
|
+
};
|
1672
|
+
|
1673
|
+
Multimap.prototype.getKeysForValue = function (value) {
|
1674
|
+
return Array.from(this.valuesByKey).filter(function (_a) {
|
1675
|
+
var key = _a[0],
|
1676
|
+
values = _a[1];
|
1677
|
+
return values.has(value);
|
1678
|
+
}).map(function (_a) {
|
1679
|
+
var key = _a[0],
|
1680
|
+
values = _a[1];
|
1681
|
+
return key;
|
1682
|
+
});
|
1683
|
+
};
|
1684
|
+
|
1685
|
+
return Multimap;
|
1686
|
+
}();
|
1687
|
+
|
1688
|
+
exports.Multimap = Multimap;
|
1689
|
+
},{"./set_operations":"../node_modules/@stimulus/multimap/dist/src/set_operations.js"}],"../node_modules/@stimulus/multimap/dist/src/indexed_multimap.js":[function(require,module,exports) {
|
1690
|
+
"use strict";
|
1691
|
+
|
1692
|
+
Object.defineProperty(exports, "__esModule", {
|
1693
|
+
value: true
|
1694
|
+
});
|
1695
|
+
exports.IndexedMultimap = void 0;
|
1696
|
+
|
1697
|
+
var _multimap = require("./multimap");
|
1698
|
+
|
1699
|
+
var _set_operations = require("./set_operations");
|
1700
|
+
|
1701
|
+
var __extends = void 0 && (void 0).__extends || function () {
|
1702
|
+
var extendStatics = Object.setPrototypeOf || {
|
1703
|
+
__proto__: []
|
1704
|
+
} instanceof Array && function (d, b) {
|
1705
|
+
d.__proto__ = b;
|
1706
|
+
} || function (d, b) {
|
1707
|
+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
1708
|
+
};
|
1709
|
+
|
1710
|
+
return function (d, b) {
|
1711
|
+
extendStatics(d, b);
|
1712
|
+
|
1713
|
+
function __() {
|
1714
|
+
this.constructor = d;
|
1715
|
+
}
|
1716
|
+
|
1717
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
1718
|
+
};
|
1719
|
+
}();
|
1720
|
+
|
1721
|
+
var IndexedMultimap =
|
1722
|
+
/** @class */
|
1723
|
+
function (_super) {
|
1724
|
+
__extends(IndexedMultimap, _super);
|
1725
|
+
|
1726
|
+
function IndexedMultimap() {
|
1727
|
+
var _this = _super.call(this) || this;
|
1728
|
+
|
1729
|
+
_this.keysByValue = new Map();
|
1730
|
+
return _this;
|
1731
|
+
}
|
1732
|
+
|
1733
|
+
Object.defineProperty(IndexedMultimap.prototype, "values", {
|
1734
|
+
get: function () {
|
1735
|
+
return Array.from(this.keysByValue.keys());
|
1736
|
+
},
|
1737
|
+
enumerable: true,
|
1738
|
+
configurable: true
|
1739
|
+
});
|
1740
|
+
|
1741
|
+
IndexedMultimap.prototype.add = function (key, value) {
|
1742
|
+
_super.prototype.add.call(this, key, value);
|
1743
|
+
|
1744
|
+
(0, _set_operations.add)(this.keysByValue, value, key);
|
1745
|
+
};
|
1746
|
+
|
1747
|
+
IndexedMultimap.prototype.delete = function (key, value) {
|
1748
|
+
_super.prototype.delete.call(this, key, value);
|
1749
|
+
|
1750
|
+
(0, _set_operations.del)(this.keysByValue, value, key);
|
1751
|
+
};
|
1752
|
+
|
1753
|
+
IndexedMultimap.prototype.hasValue = function (value) {
|
1754
|
+
return this.keysByValue.has(value);
|
1755
|
+
};
|
1756
|
+
|
1757
|
+
IndexedMultimap.prototype.getKeysForValue = function (value) {
|
1758
|
+
var set = this.keysByValue.get(value);
|
1759
|
+
return set ? Array.from(set) : [];
|
1760
|
+
};
|
1761
|
+
|
1762
|
+
return IndexedMultimap;
|
1763
|
+
}(_multimap.Multimap);
|
1764
|
+
|
1765
|
+
exports.IndexedMultimap = IndexedMultimap;
|
1766
|
+
},{"./multimap":"../node_modules/@stimulus/multimap/dist/src/multimap.js","./set_operations":"../node_modules/@stimulus/multimap/dist/src/set_operations.js"}],"../node_modules/@stimulus/multimap/dist/index.js":[function(require,module,exports) {
|
1767
|
+
"use strict";
|
1768
|
+
|
1769
|
+
Object.defineProperty(exports, "__esModule", {
|
1770
|
+
value: true
|
1771
|
+
});
|
1772
|
+
|
1773
|
+
var _multimap = require("./src/multimap");
|
1774
|
+
|
1775
|
+
Object.keys(_multimap).forEach(function (key) {
|
1776
|
+
if (key === "default" || key === "__esModule") return;
|
1777
|
+
Object.defineProperty(exports, key, {
|
1778
|
+
enumerable: true,
|
1779
|
+
get: function () {
|
1780
|
+
return _multimap[key];
|
1781
|
+
}
|
1782
|
+
});
|
1783
|
+
});
|
1784
|
+
|
1785
|
+
var _indexed_multimap = require("./src/indexed_multimap");
|
1786
|
+
|
1787
|
+
Object.keys(_indexed_multimap).forEach(function (key) {
|
1788
|
+
if (key === "default" || key === "__esModule") return;
|
1789
|
+
Object.defineProperty(exports, key, {
|
1790
|
+
enumerable: true,
|
1791
|
+
get: function () {
|
1792
|
+
return _indexed_multimap[key];
|
1793
|
+
}
|
1794
|
+
});
|
1795
|
+
});
|
1796
|
+
},{"./src/multimap":"../node_modules/@stimulus/multimap/dist/src/multimap.js","./src/indexed_multimap":"../node_modules/@stimulus/multimap/dist/src/indexed_multimap.js"}],"../node_modules/@stimulus/mutation-observers/dist/src/token_list_observer.js":[function(require,module,exports) {
|
1797
|
+
"use strict";
|
1798
|
+
|
1799
|
+
Object.defineProperty(exports, "__esModule", {
|
1800
|
+
value: true
|
1801
|
+
});
|
1802
|
+
exports.TokenListObserver = void 0;
|
1803
|
+
|
1804
|
+
var _attribute_observer = require("./attribute_observer");
|
1805
|
+
|
1806
|
+
var _multimap = require("@stimulus/multimap");
|
1807
|
+
|
1808
|
+
var TokenListObserver =
|
1809
|
+
/** @class */
|
1810
|
+
function () {
|
1811
|
+
function TokenListObserver(element, attributeName, delegate) {
|
1812
|
+
this.attributeObserver = new _attribute_observer.AttributeObserver(element, attributeName, this);
|
1813
|
+
this.delegate = delegate;
|
1814
|
+
this.tokensByElement = new _multimap.Multimap();
|
1815
|
+
}
|
1816
|
+
|
1817
|
+
Object.defineProperty(TokenListObserver.prototype, "started", {
|
1818
|
+
get: function () {
|
1819
|
+
return this.attributeObserver.started;
|
1820
|
+
},
|
1821
|
+
enumerable: true,
|
1822
|
+
configurable: true
|
1823
|
+
});
|
1824
|
+
|
1825
|
+
TokenListObserver.prototype.start = function () {
|
1826
|
+
this.attributeObserver.start();
|
1827
|
+
};
|
1828
|
+
|
1829
|
+
TokenListObserver.prototype.stop = function () {
|
1830
|
+
this.attributeObserver.stop();
|
1831
|
+
};
|
1832
|
+
|
1833
|
+
TokenListObserver.prototype.refresh = function () {
|
1834
|
+
this.attributeObserver.refresh();
|
1835
|
+
};
|
1836
|
+
|
1837
|
+
Object.defineProperty(TokenListObserver.prototype, "element", {
|
1838
|
+
get: function () {
|
1839
|
+
return this.attributeObserver.element;
|
1840
|
+
},
|
1841
|
+
enumerable: true,
|
1842
|
+
configurable: true
|
1843
|
+
});
|
1844
|
+
Object.defineProperty(TokenListObserver.prototype, "attributeName", {
|
1845
|
+
get: function () {
|
1846
|
+
return this.attributeObserver.attributeName;
|
1847
|
+
},
|
1848
|
+
enumerable: true,
|
1849
|
+
configurable: true
|
1850
|
+
}); // Attribute observer delegate
|
1851
|
+
|
1852
|
+
TokenListObserver.prototype.elementMatchedAttribute = function (element) {
|
1853
|
+
this.tokensMatched(this.readTokensForElement(element));
|
1854
|
+
};
|
1855
|
+
|
1856
|
+
TokenListObserver.prototype.elementAttributeValueChanged = function (element) {
|
1857
|
+
var _a = this.refreshTokensForElement(element),
|
1858
|
+
unmatchedTokens = _a[0],
|
1859
|
+
matchedTokens = _a[1];
|
1860
|
+
|
1861
|
+
this.tokensUnmatched(unmatchedTokens);
|
1862
|
+
this.tokensMatched(matchedTokens);
|
1863
|
+
};
|
1864
|
+
|
1865
|
+
TokenListObserver.prototype.elementUnmatchedAttribute = function (element) {
|
1866
|
+
this.tokensUnmatched(this.tokensByElement.getValuesForKey(element));
|
1867
|
+
};
|
1868
|
+
|
1869
|
+
TokenListObserver.prototype.tokensMatched = function (tokens) {
|
1870
|
+
var _this = this;
|
1871
|
+
|
1872
|
+
tokens.forEach(function (token) {
|
1873
|
+
return _this.tokenMatched(token);
|
1874
|
+
});
|
1875
|
+
};
|
1876
|
+
|
1877
|
+
TokenListObserver.prototype.tokensUnmatched = function (tokens) {
|
1878
|
+
var _this = this;
|
1879
|
+
|
1880
|
+
tokens.forEach(function (token) {
|
1881
|
+
return _this.tokenUnmatched(token);
|
1882
|
+
});
|
1883
|
+
};
|
1884
|
+
|
1885
|
+
TokenListObserver.prototype.tokenMatched = function (token) {
|
1886
|
+
this.delegate.tokenMatched(token);
|
1887
|
+
this.tokensByElement.add(token.element, token);
|
1888
|
+
};
|
1889
|
+
|
1890
|
+
TokenListObserver.prototype.tokenUnmatched = function (token) {
|
1891
|
+
this.delegate.tokenUnmatched(token);
|
1892
|
+
this.tokensByElement.delete(token.element, token);
|
1893
|
+
};
|
1894
|
+
|
1895
|
+
TokenListObserver.prototype.refreshTokensForElement = function (element) {
|
1896
|
+
var previousTokens = this.tokensByElement.getValuesForKey(element);
|
1897
|
+
var currentTokens = this.readTokensForElement(element);
|
1898
|
+
var firstDifferingIndex = zip(previousTokens, currentTokens).findIndex(function (_a) {
|
1899
|
+
var previousToken = _a[0],
|
1900
|
+
currentToken = _a[1];
|
1901
|
+
return !tokensAreEqual(previousToken, currentToken);
|
1902
|
+
});
|
1903
|
+
|
1904
|
+
if (firstDifferingIndex == -1) {
|
1905
|
+
return [[], []];
|
1906
|
+
} else {
|
1907
|
+
return [previousTokens.slice(firstDifferingIndex), currentTokens.slice(firstDifferingIndex)];
|
1908
|
+
}
|
1909
|
+
};
|
1910
|
+
|
1911
|
+
TokenListObserver.prototype.readTokensForElement = function (element) {
|
1912
|
+
var attributeName = this.attributeName;
|
1913
|
+
var tokenString = element.getAttribute(attributeName) || "";
|
1914
|
+
return parseTokenString(tokenString, element, attributeName);
|
1915
|
+
};
|
1916
|
+
|
1917
|
+
return TokenListObserver;
|
1918
|
+
}();
|
1919
|
+
|
1920
|
+
exports.TokenListObserver = TokenListObserver;
|
1921
|
+
|
1922
|
+
function parseTokenString(tokenString, element, attributeName) {
|
1923
|
+
return tokenString.trim().split(/\s+/).filter(function (content) {
|
1924
|
+
return content.length;
|
1925
|
+
}).map(function (content, index) {
|
1926
|
+
return {
|
1927
|
+
element: element,
|
1928
|
+
attributeName: attributeName,
|
1929
|
+
content: content,
|
1930
|
+
index: index
|
1931
|
+
};
|
1932
|
+
});
|
1933
|
+
}
|
1934
|
+
|
1935
|
+
function zip(left, right) {
|
1936
|
+
var length = Math.max(left.length, right.length);
|
1937
|
+
return Array.from({
|
1938
|
+
length: length
|
1939
|
+
}, function (_, index) {
|
1940
|
+
return [left[index], right[index]];
|
1941
|
+
});
|
1942
|
+
}
|
1943
|
+
|
1944
|
+
function tokensAreEqual(left, right) {
|
1945
|
+
return left && right && left.index == right.index && left.content == right.content;
|
1946
|
+
}
|
1947
|
+
},{"./attribute_observer":"../node_modules/@stimulus/mutation-observers/dist/src/attribute_observer.js","@stimulus/multimap":"../node_modules/@stimulus/multimap/dist/index.js"}],"../node_modules/@stimulus/mutation-observers/dist/src/value_list_observer.js":[function(require,module,exports) {
|
1948
|
+
"use strict";
|
1949
|
+
|
1950
|
+
Object.defineProperty(exports, "__esModule", {
|
1951
|
+
value: true
|
1952
|
+
});
|
1953
|
+
exports.ValueListObserver = void 0;
|
1954
|
+
|
1955
|
+
var _token_list_observer = require("./token_list_observer");
|
1956
|
+
|
1957
|
+
var ValueListObserver =
|
1958
|
+
/** @class */
|
1959
|
+
function () {
|
1960
|
+
function ValueListObserver(element, attributeName, delegate) {
|
1961
|
+
this.tokenListObserver = new _token_list_observer.TokenListObserver(element, attributeName, this);
|
1962
|
+
this.delegate = delegate;
|
1963
|
+
this.parseResultsByToken = new WeakMap();
|
1964
|
+
this.valuesByTokenByElement = new WeakMap();
|
1965
|
+
}
|
1966
|
+
|
1967
|
+
Object.defineProperty(ValueListObserver.prototype, "started", {
|
1968
|
+
get: function () {
|
1969
|
+
return this.tokenListObserver.started;
|
1970
|
+
},
|
1971
|
+
enumerable: true,
|
1972
|
+
configurable: true
|
1973
|
+
});
|
1974
|
+
|
1975
|
+
ValueListObserver.prototype.start = function () {
|
1976
|
+
this.tokenListObserver.start();
|
1977
|
+
};
|
1978
|
+
|
1979
|
+
ValueListObserver.prototype.stop = function () {
|
1980
|
+
this.tokenListObserver.stop();
|
1981
|
+
};
|
1982
|
+
|
1983
|
+
ValueListObserver.prototype.refresh = function () {
|
1984
|
+
this.tokenListObserver.refresh();
|
1985
|
+
};
|
1986
|
+
|
1987
|
+
Object.defineProperty(ValueListObserver.prototype, "element", {
|
1988
|
+
get: function () {
|
1989
|
+
return this.tokenListObserver.element;
|
1990
|
+
},
|
1991
|
+
enumerable: true,
|
1992
|
+
configurable: true
|
1993
|
+
});
|
1994
|
+
Object.defineProperty(ValueListObserver.prototype, "attributeName", {
|
1995
|
+
get: function () {
|
1996
|
+
return this.tokenListObserver.attributeName;
|
1997
|
+
},
|
1998
|
+
enumerable: true,
|
1999
|
+
configurable: true
|
2000
|
+
});
|
2001
|
+
|
2002
|
+
ValueListObserver.prototype.tokenMatched = function (token) {
|
2003
|
+
var element = token.element;
|
2004
|
+
var value = this.fetchParseResultForToken(token).value;
|
2005
|
+
|
2006
|
+
if (value) {
|
2007
|
+
this.fetchValuesByTokenForElement(element).set(token, value);
|
2008
|
+
this.delegate.elementMatchedValue(element, value);
|
2009
|
+
}
|
2010
|
+
};
|
2011
|
+
|
2012
|
+
ValueListObserver.prototype.tokenUnmatched = function (token) {
|
2013
|
+
var element = token.element;
|
2014
|
+
var value = this.fetchParseResultForToken(token).value;
|
2015
|
+
|
2016
|
+
if (value) {
|
2017
|
+
this.fetchValuesByTokenForElement(element).delete(token);
|
2018
|
+
this.delegate.elementUnmatchedValue(element, value);
|
2019
|
+
}
|
2020
|
+
};
|
2021
|
+
|
2022
|
+
ValueListObserver.prototype.fetchParseResultForToken = function (token) {
|
2023
|
+
var parseResult = this.parseResultsByToken.get(token);
|
2024
|
+
|
2025
|
+
if (!parseResult) {
|
2026
|
+
parseResult = this.parseToken(token);
|
2027
|
+
this.parseResultsByToken.set(token, parseResult);
|
2028
|
+
}
|
2029
|
+
|
2030
|
+
return parseResult;
|
2031
|
+
};
|
2032
|
+
|
2033
|
+
ValueListObserver.prototype.fetchValuesByTokenForElement = function (element) {
|
2034
|
+
var valuesByToken = this.valuesByTokenByElement.get(element);
|
2035
|
+
|
2036
|
+
if (!valuesByToken) {
|
2037
|
+
valuesByToken = new Map();
|
2038
|
+
this.valuesByTokenByElement.set(element, valuesByToken);
|
2039
|
+
}
|
2040
|
+
|
2041
|
+
return valuesByToken;
|
2042
|
+
};
|
2043
|
+
|
2044
|
+
ValueListObserver.prototype.parseToken = function (token) {
|
2045
|
+
try {
|
2046
|
+
var value = this.delegate.parseValueForToken(token);
|
2047
|
+
return {
|
2048
|
+
value: value
|
2049
|
+
};
|
2050
|
+
} catch (error) {
|
2051
|
+
return {
|
2052
|
+
error: error
|
2053
|
+
};
|
2054
|
+
}
|
2055
|
+
};
|
2056
|
+
|
2057
|
+
return ValueListObserver;
|
2058
|
+
}();
|
2059
|
+
|
2060
|
+
exports.ValueListObserver = ValueListObserver;
|
2061
|
+
},{"./token_list_observer":"../node_modules/@stimulus/mutation-observers/dist/src/token_list_observer.js"}],"../node_modules/@stimulus/mutation-observers/dist/index.js":[function(require,module,exports) {
|
2062
|
+
"use strict";
|
2063
|
+
|
2064
|
+
Object.defineProperty(exports, "__esModule", {
|
2065
|
+
value: true
|
2066
|
+
});
|
2067
|
+
|
2068
|
+
var _attribute_observer = require("./src/attribute_observer");
|
2069
|
+
|
2070
|
+
Object.keys(_attribute_observer).forEach(function (key) {
|
2071
|
+
if (key === "default" || key === "__esModule") return;
|
2072
|
+
Object.defineProperty(exports, key, {
|
2073
|
+
enumerable: true,
|
2074
|
+
get: function () {
|
2075
|
+
return _attribute_observer[key];
|
2076
|
+
}
|
2077
|
+
});
|
2078
|
+
});
|
2079
|
+
|
2080
|
+
var _element_observer = require("./src/element_observer");
|
2081
|
+
|
2082
|
+
Object.keys(_element_observer).forEach(function (key) {
|
2083
|
+
if (key === "default" || key === "__esModule") return;
|
2084
|
+
Object.defineProperty(exports, key, {
|
2085
|
+
enumerable: true,
|
2086
|
+
get: function () {
|
2087
|
+
return _element_observer[key];
|
2088
|
+
}
|
2089
|
+
});
|
2090
|
+
});
|
2091
|
+
|
2092
|
+
var _token_list_observer = require("./src/token_list_observer");
|
2093
|
+
|
2094
|
+
Object.keys(_token_list_observer).forEach(function (key) {
|
2095
|
+
if (key === "default" || key === "__esModule") return;
|
2096
|
+
Object.defineProperty(exports, key, {
|
2097
|
+
enumerable: true,
|
2098
|
+
get: function () {
|
2099
|
+
return _token_list_observer[key];
|
2100
|
+
}
|
2101
|
+
});
|
2102
|
+
});
|
2103
|
+
|
2104
|
+
var _value_list_observer = require("./src/value_list_observer");
|
2105
|
+
|
2106
|
+
Object.keys(_value_list_observer).forEach(function (key) {
|
2107
|
+
if (key === "default" || key === "__esModule") return;
|
2108
|
+
Object.defineProperty(exports, key, {
|
2109
|
+
enumerable: true,
|
2110
|
+
get: function () {
|
2111
|
+
return _value_list_observer[key];
|
2112
|
+
}
|
2113
|
+
});
|
2114
|
+
});
|
2115
|
+
},{"./src/attribute_observer":"../node_modules/@stimulus/mutation-observers/dist/src/attribute_observer.js","./src/element_observer":"../node_modules/@stimulus/mutation-observers/dist/src/element_observer.js","./src/token_list_observer":"../node_modules/@stimulus/mutation-observers/dist/src/token_list_observer.js","./src/value_list_observer":"../node_modules/@stimulus/mutation-observers/dist/src/value_list_observer.js"}],"../node_modules/@stimulus/core/dist/src/binding_observer.js":[function(require,module,exports) {
|
2116
|
+
"use strict";
|
2117
|
+
|
2118
|
+
Object.defineProperty(exports, "__esModule", {
|
2119
|
+
value: true
|
2120
|
+
});
|
2121
|
+
exports.BindingObserver = void 0;
|
2122
|
+
|
2123
|
+
var _action = require("./action");
|
2124
|
+
|
2125
|
+
var _binding = require("./binding");
|
2126
|
+
|
2127
|
+
var _mutationObservers = require("@stimulus/mutation-observers");
|
2128
|
+
|
2129
|
+
var BindingObserver =
|
2130
|
+
/** @class */
|
2131
|
+
function () {
|
2132
|
+
function BindingObserver(context, delegate) {
|
2133
|
+
this.context = context;
|
2134
|
+
this.delegate = delegate;
|
2135
|
+
this.bindingsByAction = new Map();
|
2136
|
+
}
|
2137
|
+
|
2138
|
+
BindingObserver.prototype.start = function () {
|
2139
|
+
if (!this.valueListObserver) {
|
2140
|
+
this.valueListObserver = new _mutationObservers.ValueListObserver(this.element, this.actionAttribute, this);
|
2141
|
+
this.valueListObserver.start();
|
2142
|
+
}
|
2143
|
+
};
|
2144
|
+
|
2145
|
+
BindingObserver.prototype.stop = function () {
|
2146
|
+
if (this.valueListObserver) {
|
2147
|
+
this.valueListObserver.stop();
|
2148
|
+
delete this.valueListObserver;
|
2149
|
+
this.disconnectAllActions();
|
2150
|
+
}
|
2151
|
+
};
|
2152
|
+
|
2153
|
+
Object.defineProperty(BindingObserver.prototype, "element", {
|
2154
|
+
get: function () {
|
2155
|
+
return this.context.element;
|
2156
|
+
},
|
2157
|
+
enumerable: true,
|
2158
|
+
configurable: true
|
2159
|
+
});
|
2160
|
+
Object.defineProperty(BindingObserver.prototype, "identifier", {
|
2161
|
+
get: function () {
|
2162
|
+
return this.context.identifier;
|
2163
|
+
},
|
2164
|
+
enumerable: true,
|
2165
|
+
configurable: true
|
2166
|
+
});
|
2167
|
+
Object.defineProperty(BindingObserver.prototype, "actionAttribute", {
|
2168
|
+
get: function () {
|
2169
|
+
return this.schema.actionAttribute;
|
2170
|
+
},
|
2171
|
+
enumerable: true,
|
2172
|
+
configurable: true
|
2173
|
+
});
|
2174
|
+
Object.defineProperty(BindingObserver.prototype, "schema", {
|
2175
|
+
get: function () {
|
2176
|
+
return this.context.schema;
|
2177
|
+
},
|
2178
|
+
enumerable: true,
|
2179
|
+
configurable: true
|
2180
|
+
});
|
2181
|
+
Object.defineProperty(BindingObserver.prototype, "bindings", {
|
2182
|
+
get: function () {
|
2183
|
+
return Array.from(this.bindingsByAction.values());
|
2184
|
+
},
|
2185
|
+
enumerable: true,
|
2186
|
+
configurable: true
|
2187
|
+
});
|
2188
|
+
|
2189
|
+
BindingObserver.prototype.connectAction = function (action) {
|
2190
|
+
var binding = new _binding.Binding(this.context, action);
|
2191
|
+
this.bindingsByAction.set(action, binding);
|
2192
|
+
this.delegate.bindingConnected(binding);
|
2193
|
+
};
|
2194
|
+
|
2195
|
+
BindingObserver.prototype.disconnectAction = function (action) {
|
2196
|
+
var binding = this.bindingsByAction.get(action);
|
2197
|
+
|
2198
|
+
if (binding) {
|
2199
|
+
this.bindingsByAction.delete(action);
|
2200
|
+
this.delegate.bindingDisconnected(binding);
|
2201
|
+
}
|
2202
|
+
};
|
2203
|
+
|
2204
|
+
BindingObserver.prototype.disconnectAllActions = function () {
|
2205
|
+
var _this = this;
|
2206
|
+
|
2207
|
+
this.bindings.forEach(function (binding) {
|
2208
|
+
return _this.delegate.bindingDisconnected(binding);
|
2209
|
+
});
|
2210
|
+
this.bindingsByAction.clear();
|
2211
|
+
}; // Value observer delegate
|
2212
|
+
|
2213
|
+
|
2214
|
+
BindingObserver.prototype.parseValueForToken = function (token) {
|
2215
|
+
var action = _action.Action.forToken(token);
|
2216
|
+
|
2217
|
+
if (action.identifier == this.identifier) {
|
2218
|
+
return action;
|
2219
|
+
}
|
2220
|
+
};
|
2221
|
+
|
2222
|
+
BindingObserver.prototype.elementMatchedValue = function (element, action) {
|
2223
|
+
this.connectAction(action);
|
2224
|
+
};
|
2225
|
+
|
2226
|
+
BindingObserver.prototype.elementUnmatchedValue = function (element, action) {
|
2227
|
+
this.disconnectAction(action);
|
2228
|
+
};
|
2229
|
+
|
2230
|
+
return BindingObserver;
|
2231
|
+
}();
|
2232
|
+
|
2233
|
+
exports.BindingObserver = BindingObserver;
|
2234
|
+
},{"./action":"../node_modules/@stimulus/core/dist/src/action.js","./binding":"../node_modules/@stimulus/core/dist/src/binding.js","@stimulus/mutation-observers":"../node_modules/@stimulus/mutation-observers/dist/index.js"}],"../node_modules/@stimulus/core/dist/src/context.js":[function(require,module,exports) {
|
2235
|
+
"use strict";
|
2236
|
+
|
2237
|
+
Object.defineProperty(exports, "__esModule", {
|
2238
|
+
value: true
|
2239
|
+
});
|
2240
|
+
exports.Context = void 0;
|
2241
|
+
|
2242
|
+
var _binding_observer = require("./binding_observer");
|
2243
|
+
|
2244
|
+
var Context =
|
2245
|
+
/** @class */
|
2246
|
+
function () {
|
2247
|
+
function Context(module, scope) {
|
2248
|
+
this.module = module;
|
2249
|
+
this.scope = scope;
|
2250
|
+
this.controller = new module.controllerConstructor(this);
|
2251
|
+
this.bindingObserver = new _binding_observer.BindingObserver(this, this.dispatcher);
|
2252
|
+
|
2253
|
+
try {
|
2254
|
+
this.controller.initialize();
|
2255
|
+
} catch (error) {
|
2256
|
+
this.handleError(error, "initializing controller");
|
2257
|
+
}
|
2258
|
+
}
|
2259
|
+
|
2260
|
+
Context.prototype.connect = function () {
|
2261
|
+
this.bindingObserver.start();
|
2262
|
+
|
2263
|
+
try {
|
2264
|
+
this.controller.connect();
|
2265
|
+
} catch (error) {
|
2266
|
+
this.handleError(error, "connecting controller");
|
2267
|
+
}
|
2268
|
+
};
|
2269
|
+
|
2270
|
+
Context.prototype.disconnect = function () {
|
2271
|
+
try {
|
2272
|
+
this.controller.disconnect();
|
2273
|
+
} catch (error) {
|
2274
|
+
this.handleError(error, "disconnecting controller");
|
2275
|
+
}
|
2276
|
+
|
2277
|
+
this.bindingObserver.stop();
|
2278
|
+
};
|
2279
|
+
|
2280
|
+
Object.defineProperty(Context.prototype, "application", {
|
2281
|
+
get: function () {
|
2282
|
+
return this.module.application;
|
2283
|
+
},
|
2284
|
+
enumerable: true,
|
2285
|
+
configurable: true
|
2286
|
+
});
|
2287
|
+
Object.defineProperty(Context.prototype, "identifier", {
|
2288
|
+
get: function () {
|
2289
|
+
return this.module.identifier;
|
2290
|
+
},
|
2291
|
+
enumerable: true,
|
2292
|
+
configurable: true
|
2293
|
+
});
|
2294
|
+
Object.defineProperty(Context.prototype, "schema", {
|
2295
|
+
get: function () {
|
2296
|
+
return this.application.schema;
|
2297
|
+
},
|
2298
|
+
enumerable: true,
|
2299
|
+
configurable: true
|
2300
|
+
});
|
2301
|
+
Object.defineProperty(Context.prototype, "dispatcher", {
|
2302
|
+
get: function () {
|
2303
|
+
return this.application.dispatcher;
|
2304
|
+
},
|
2305
|
+
enumerable: true,
|
2306
|
+
configurable: true
|
2307
|
+
});
|
2308
|
+
Object.defineProperty(Context.prototype, "element", {
|
2309
|
+
get: function () {
|
2310
|
+
return this.scope.element;
|
2311
|
+
},
|
2312
|
+
enumerable: true,
|
2313
|
+
configurable: true
|
2314
|
+
});
|
2315
|
+
Object.defineProperty(Context.prototype, "parentElement", {
|
2316
|
+
get: function () {
|
2317
|
+
return this.element.parentElement;
|
2318
|
+
},
|
2319
|
+
enumerable: true,
|
2320
|
+
configurable: true
|
2321
|
+
}); // Error handling
|
2322
|
+
|
2323
|
+
Context.prototype.handleError = function (error, message, detail) {
|
2324
|
+
if (detail === void 0) {
|
2325
|
+
detail = {};
|
2326
|
+
}
|
2327
|
+
|
2328
|
+
var _a = this,
|
2329
|
+
identifier = _a.identifier,
|
2330
|
+
controller = _a.controller,
|
2331
|
+
element = _a.element;
|
2332
|
+
|
2333
|
+
detail = Object.assign({
|
2334
|
+
identifier: identifier,
|
2335
|
+
controller: controller,
|
2336
|
+
element: element
|
2337
|
+
}, detail);
|
2338
|
+
this.application.handleError(error, "Error " + message, detail);
|
2339
|
+
};
|
2340
|
+
|
2341
|
+
return Context;
|
2342
|
+
}();
|
2343
|
+
|
2344
|
+
exports.Context = Context;
|
2345
|
+
},{"./binding_observer":"../node_modules/@stimulus/core/dist/src/binding_observer.js"}],"../node_modules/@stimulus/core/dist/src/definition.js":[function(require,module,exports) {
|
2346
|
+
"use strict";
|
2347
|
+
|
2348
|
+
Object.defineProperty(exports, "__esModule", {
|
2349
|
+
value: true
|
2350
|
+
});
|
2351
|
+
exports.blessDefinition = blessDefinition;
|
2352
|
+
|
2353
|
+
var __extends = void 0 && (void 0).__extends || function () {
|
2354
|
+
var extendStatics = Object.setPrototypeOf || {
|
2355
|
+
__proto__: []
|
2356
|
+
} instanceof Array && function (d, b) {
|
2357
|
+
d.__proto__ = b;
|
2358
|
+
} || function (d, b) {
|
2359
|
+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
2360
|
+
};
|
2361
|
+
|
2362
|
+
return function (d, b) {
|
2363
|
+
extendStatics(d, b);
|
2364
|
+
|
2365
|
+
function __() {
|
2366
|
+
this.constructor = d;
|
2367
|
+
}
|
2368
|
+
|
2369
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
2370
|
+
};
|
2371
|
+
}();
|
2372
|
+
/** @hidden */
|
2373
|
+
|
2374
|
+
|
2375
|
+
function blessDefinition(definition) {
|
2376
|
+
return {
|
2377
|
+
identifier: definition.identifier,
|
2378
|
+
controllerConstructor: blessControllerConstructor(definition.controllerConstructor)
|
2379
|
+
};
|
2380
|
+
}
|
2381
|
+
|
2382
|
+
function blessControllerConstructor(controllerConstructor) {
|
2383
|
+
var constructor = extend(controllerConstructor);
|
2384
|
+
constructor.bless();
|
2385
|
+
return constructor;
|
2386
|
+
}
|
2387
|
+
|
2388
|
+
var extend = function () {
|
2389
|
+
function extendWithReflect(constructor) {
|
2390
|
+
function Controller() {
|
2391
|
+
var _newTarget = this && this instanceof Controller ? this.constructor : void 0;
|
2392
|
+
|
2393
|
+
return Reflect.construct(constructor, arguments, _newTarget);
|
2394
|
+
}
|
2395
|
+
|
2396
|
+
Controller.prototype = Object.create(constructor.prototype, {
|
2397
|
+
constructor: {
|
2398
|
+
value: Controller
|
2399
|
+
}
|
2400
|
+
});
|
2401
|
+
Reflect.setPrototypeOf(Controller, constructor);
|
2402
|
+
return Controller;
|
2403
|
+
}
|
2404
|
+
|
2405
|
+
function testReflectExtension() {
|
2406
|
+
var a = function () {
|
2407
|
+
this.a.call(this);
|
2408
|
+
};
|
2409
|
+
|
2410
|
+
var b = extendWithReflect(a);
|
2411
|
+
|
2412
|
+
b.prototype.a = function () {};
|
2413
|
+
|
2414
|
+
return new b();
|
2415
|
+
}
|
2416
|
+
|
2417
|
+
try {
|
2418
|
+
testReflectExtension();
|
2419
|
+
return extendWithReflect;
|
2420
|
+
} catch (error) {
|
2421
|
+
return function (constructor) {
|
2422
|
+
return (
|
2423
|
+
/** @class */
|
2424
|
+
function (_super) {
|
2425
|
+
__extends(Controller, _super);
|
2426
|
+
|
2427
|
+
function Controller() {
|
2428
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
2429
|
+
}
|
2430
|
+
|
2431
|
+
return Controller;
|
2432
|
+
}(constructor)
|
2433
|
+
);
|
2434
|
+
};
|
2435
|
+
}
|
2436
|
+
}();
|
2437
|
+
},{}],"../node_modules/@stimulus/core/dist/src/module.js":[function(require,module,exports) {
|
2438
|
+
"use strict";
|
2439
|
+
|
2440
|
+
Object.defineProperty(exports, "__esModule", {
|
2441
|
+
value: true
|
2442
|
+
});
|
2443
|
+
exports.Module = void 0;
|
2444
|
+
|
2445
|
+
var _context = require("./context");
|
2446
|
+
|
2447
|
+
var _definition = require("./definition");
|
2448
|
+
|
2449
|
+
var Module =
|
2450
|
+
/** @class */
|
2451
|
+
function () {
|
2452
|
+
function Module(application, definition) {
|
2453
|
+
this.application = application;
|
2454
|
+
this.definition = (0, _definition.blessDefinition)(definition);
|
2455
|
+
this.contextsByScope = new WeakMap();
|
2456
|
+
this.connectedContexts = new Set();
|
2457
|
+
}
|
2458
|
+
|
2459
|
+
Object.defineProperty(Module.prototype, "identifier", {
|
2460
|
+
get: function () {
|
2461
|
+
return this.definition.identifier;
|
2462
|
+
},
|
2463
|
+
enumerable: true,
|
2464
|
+
configurable: true
|
2465
|
+
});
|
2466
|
+
Object.defineProperty(Module.prototype, "controllerConstructor", {
|
2467
|
+
get: function () {
|
2468
|
+
return this.definition.controllerConstructor;
|
2469
|
+
},
|
2470
|
+
enumerable: true,
|
2471
|
+
configurable: true
|
2472
|
+
});
|
2473
|
+
Object.defineProperty(Module.prototype, "contexts", {
|
2474
|
+
get: function () {
|
2475
|
+
return Array.from(this.connectedContexts);
|
2476
|
+
},
|
2477
|
+
enumerable: true,
|
2478
|
+
configurable: true
|
2479
|
+
});
|
2480
|
+
|
2481
|
+
Module.prototype.connectContextForScope = function (scope) {
|
2482
|
+
var context = this.fetchContextForScope(scope);
|
2483
|
+
this.connectedContexts.add(context);
|
2484
|
+
context.connect();
|
2485
|
+
};
|
2486
|
+
|
2487
|
+
Module.prototype.disconnectContextForScope = function (scope) {
|
2488
|
+
var context = this.contextsByScope.get(scope);
|
2489
|
+
|
2490
|
+
if (context) {
|
2491
|
+
this.connectedContexts.delete(context);
|
2492
|
+
context.disconnect();
|
2493
|
+
}
|
2494
|
+
};
|
2495
|
+
|
2496
|
+
Module.prototype.fetchContextForScope = function (scope) {
|
2497
|
+
var context = this.contextsByScope.get(scope);
|
2498
|
+
|
2499
|
+
if (!context) {
|
2500
|
+
context = new _context.Context(this, scope);
|
2501
|
+
this.contextsByScope.set(scope, context);
|
2502
|
+
}
|
2503
|
+
|
2504
|
+
return context;
|
2505
|
+
};
|
2506
|
+
|
2507
|
+
return Module;
|
2508
|
+
}();
|
2509
|
+
|
2510
|
+
exports.Module = Module;
|
2511
|
+
},{"./context":"../node_modules/@stimulus/core/dist/src/context.js","./definition":"../node_modules/@stimulus/core/dist/src/definition.js"}],"../node_modules/@stimulus/core/dist/src/data_map.js":[function(require,module,exports) {
|
2512
|
+
"use strict";
|
2513
|
+
|
2514
|
+
Object.defineProperty(exports, "__esModule", {
|
2515
|
+
value: true
|
2516
|
+
});
|
2517
|
+
exports.DataMap = void 0;
|
2518
|
+
|
2519
|
+
var DataMap =
|
2520
|
+
/** @class */
|
2521
|
+
function () {
|
2522
|
+
function DataMap(scope) {
|
2523
|
+
this.scope = scope;
|
2524
|
+
}
|
2525
|
+
|
2526
|
+
Object.defineProperty(DataMap.prototype, "element", {
|
2527
|
+
get: function () {
|
2528
|
+
return this.scope.element;
|
2529
|
+
},
|
2530
|
+
enumerable: true,
|
2531
|
+
configurable: true
|
2532
|
+
});
|
2533
|
+
Object.defineProperty(DataMap.prototype, "identifier", {
|
2534
|
+
get: function () {
|
2535
|
+
return this.scope.identifier;
|
2536
|
+
},
|
2537
|
+
enumerable: true,
|
2538
|
+
configurable: true
|
2539
|
+
});
|
2540
|
+
|
2541
|
+
DataMap.prototype.get = function (key) {
|
2542
|
+
key = this.getFormattedKey(key);
|
2543
|
+
return this.element.getAttribute(key);
|
2544
|
+
};
|
2545
|
+
|
2546
|
+
DataMap.prototype.set = function (key, value) {
|
2547
|
+
key = this.getFormattedKey(key);
|
2548
|
+
this.element.setAttribute(key, value);
|
2549
|
+
return this.get(key);
|
2550
|
+
};
|
2551
|
+
|
2552
|
+
DataMap.prototype.has = function (key) {
|
2553
|
+
key = this.getFormattedKey(key);
|
2554
|
+
return this.element.hasAttribute(key);
|
2555
|
+
};
|
2556
|
+
|
2557
|
+
DataMap.prototype.delete = function (key) {
|
2558
|
+
if (this.has(key)) {
|
2559
|
+
key = this.getFormattedKey(key);
|
2560
|
+
this.element.removeAttribute(key);
|
2561
|
+
return true;
|
2562
|
+
} else {
|
2563
|
+
return false;
|
2564
|
+
}
|
2565
|
+
};
|
2566
|
+
|
2567
|
+
DataMap.prototype.getFormattedKey = function (key) {
|
2568
|
+
return "data-" + this.identifier + "-" + dasherize(key);
|
2569
|
+
};
|
2570
|
+
|
2571
|
+
return DataMap;
|
2572
|
+
}();
|
2573
|
+
|
2574
|
+
exports.DataMap = DataMap;
|
2575
|
+
|
2576
|
+
function dasherize(value) {
|
2577
|
+
return value.replace(/([A-Z])/g, function (_, char) {
|
2578
|
+
return "-" + char.toLowerCase();
|
2579
|
+
});
|
2580
|
+
}
|
2581
|
+
},{}],"../node_modules/@stimulus/core/dist/src/selectors.js":[function(require,module,exports) {
|
2582
|
+
"use strict";
|
2583
|
+
|
2584
|
+
Object.defineProperty(exports, "__esModule", {
|
2585
|
+
value: true
|
2586
|
+
});
|
2587
|
+
exports.attributeValueContainsToken = attributeValueContainsToken;
|
2588
|
+
|
2589
|
+
/** @hidden */
|
2590
|
+
function attributeValueContainsToken(attributeName, token) {
|
2591
|
+
return "[" + attributeName + "~=\"" + token + "\"]";
|
2592
|
+
}
|
2593
|
+
},{}],"../node_modules/@stimulus/core/dist/src/target_set.js":[function(require,module,exports) {
|
2594
|
+
"use strict";
|
2595
|
+
|
2596
|
+
Object.defineProperty(exports, "__esModule", {
|
2597
|
+
value: true
|
2598
|
+
});
|
2599
|
+
exports.TargetSet = void 0;
|
2600
|
+
|
2601
|
+
var _selectors = require("./selectors");
|
2602
|
+
|
2603
|
+
var TargetSet =
|
2604
|
+
/** @class */
|
2605
|
+
function () {
|
2606
|
+
function TargetSet(scope) {
|
2607
|
+
this.scope = scope;
|
2608
|
+
}
|
2609
|
+
|
2610
|
+
Object.defineProperty(TargetSet.prototype, "element", {
|
2611
|
+
get: function () {
|
2612
|
+
return this.scope.element;
|
2613
|
+
},
|
2614
|
+
enumerable: true,
|
2615
|
+
configurable: true
|
2616
|
+
});
|
2617
|
+
Object.defineProperty(TargetSet.prototype, "identifier", {
|
2618
|
+
get: function () {
|
2619
|
+
return this.scope.identifier;
|
2620
|
+
},
|
2621
|
+
enumerable: true,
|
2622
|
+
configurable: true
|
2623
|
+
});
|
2624
|
+
Object.defineProperty(TargetSet.prototype, "schema", {
|
2625
|
+
get: function () {
|
2626
|
+
return this.scope.schema;
|
2627
|
+
},
|
2628
|
+
enumerable: true,
|
2629
|
+
configurable: true
|
2630
|
+
});
|
2631
|
+
|
2632
|
+
TargetSet.prototype.has = function (targetName) {
|
2633
|
+
return this.find(targetName) != null;
|
2634
|
+
};
|
2635
|
+
|
2636
|
+
TargetSet.prototype.find = function () {
|
2637
|
+
var targetNames = [];
|
2638
|
+
|
2639
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
2640
|
+
targetNames[_i] = arguments[_i];
|
2641
|
+
}
|
2642
|
+
|
2643
|
+
var selector = this.getSelectorForTargetNames(targetNames);
|
2644
|
+
return this.scope.findElement(selector);
|
2645
|
+
};
|
2646
|
+
|
2647
|
+
TargetSet.prototype.findAll = function () {
|
2648
|
+
var targetNames = [];
|
2649
|
+
|
2650
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
2651
|
+
targetNames[_i] = arguments[_i];
|
2652
|
+
}
|
2653
|
+
|
2654
|
+
var selector = this.getSelectorForTargetNames(targetNames);
|
2655
|
+
return this.scope.findAllElements(selector);
|
2656
|
+
};
|
2657
|
+
|
2658
|
+
TargetSet.prototype.getSelectorForTargetNames = function (targetNames) {
|
2659
|
+
var _this = this;
|
2660
|
+
|
2661
|
+
return targetNames.map(function (targetName) {
|
2662
|
+
return _this.getSelectorForTargetName(targetName);
|
2663
|
+
}).join(", ");
|
2664
|
+
};
|
2665
|
+
|
2666
|
+
TargetSet.prototype.getSelectorForTargetName = function (targetName) {
|
2667
|
+
var targetDescriptor = this.identifier + "." + targetName;
|
2668
|
+
return (0, _selectors.attributeValueContainsToken)(this.schema.targetAttribute, targetDescriptor);
|
2669
|
+
};
|
2670
|
+
|
2671
|
+
return TargetSet;
|
2672
|
+
}();
|
2673
|
+
|
2674
|
+
exports.TargetSet = TargetSet;
|
2675
|
+
},{"./selectors":"../node_modules/@stimulus/core/dist/src/selectors.js"}],"../node_modules/@stimulus/core/dist/src/scope.js":[function(require,module,exports) {
|
2676
|
+
"use strict";
|
2677
|
+
|
2678
|
+
Object.defineProperty(exports, "__esModule", {
|
2679
|
+
value: true
|
2680
|
+
});
|
2681
|
+
exports.Scope = void 0;
|
2682
|
+
|
2683
|
+
var _data_map = require("./data_map");
|
2684
|
+
|
2685
|
+
var _target_set = require("./target_set");
|
2686
|
+
|
2687
|
+
var _selectors = require("./selectors");
|
2688
|
+
|
2689
|
+
var Scope =
|
2690
|
+
/** @class */
|
2691
|
+
function () {
|
2692
|
+
function Scope(schema, identifier, element) {
|
2693
|
+
this.schema = schema;
|
2694
|
+
this.identifier = identifier;
|
2695
|
+
this.element = element;
|
2696
|
+
this.targets = new _target_set.TargetSet(this);
|
2697
|
+
this.data = new _data_map.DataMap(this);
|
2698
|
+
}
|
2699
|
+
|
2700
|
+
Scope.prototype.findElement = function (selector) {
|
2701
|
+
return this.findAllElements(selector)[0];
|
2702
|
+
};
|
2703
|
+
|
2704
|
+
Scope.prototype.findAllElements = function (selector) {
|
2705
|
+
var head = this.element.matches(selector) ? [this.element] : [];
|
2706
|
+
var tail = this.filterElements(Array.from(this.element.querySelectorAll(selector)));
|
2707
|
+
return head.concat(tail);
|
2708
|
+
};
|
2709
|
+
|
2710
|
+
Scope.prototype.filterElements = function (elements) {
|
2711
|
+
var _this = this;
|
2712
|
+
|
2713
|
+
return elements.filter(function (element) {
|
2714
|
+
return _this.containsElement(element);
|
2715
|
+
});
|
2716
|
+
};
|
2717
|
+
|
2718
|
+
Scope.prototype.containsElement = function (element) {
|
2719
|
+
return element.closest(this.controllerSelector) === this.element;
|
2720
|
+
};
|
2721
|
+
|
2722
|
+
Object.defineProperty(Scope.prototype, "controllerSelector", {
|
2723
|
+
get: function () {
|
2724
|
+
return (0, _selectors.attributeValueContainsToken)(this.schema.controllerAttribute, this.identifier);
|
2725
|
+
},
|
2726
|
+
enumerable: true,
|
2727
|
+
configurable: true
|
2728
|
+
});
|
2729
|
+
return Scope;
|
2730
|
+
}();
|
2731
|
+
|
2732
|
+
exports.Scope = Scope;
|
2733
|
+
},{"./data_map":"../node_modules/@stimulus/core/dist/src/data_map.js","./target_set":"../node_modules/@stimulus/core/dist/src/target_set.js","./selectors":"../node_modules/@stimulus/core/dist/src/selectors.js"}],"../node_modules/@stimulus/core/dist/src/scope_observer.js":[function(require,module,exports) {
|
2734
|
+
"use strict";
|
2735
|
+
|
2736
|
+
Object.defineProperty(exports, "__esModule", {
|
2737
|
+
value: true
|
2738
|
+
});
|
2739
|
+
exports.ScopeObserver = void 0;
|
2740
|
+
|
2741
|
+
var _scope = require("./scope");
|
2742
|
+
|
2743
|
+
var _mutationObservers = require("@stimulus/mutation-observers");
|
2744
|
+
|
2745
|
+
var ScopeObserver =
|
2746
|
+
/** @class */
|
2747
|
+
function () {
|
2748
|
+
function ScopeObserver(element, schema, delegate) {
|
2749
|
+
this.element = element;
|
2750
|
+
this.schema = schema;
|
2751
|
+
this.delegate = delegate;
|
2752
|
+
this.valueListObserver = new _mutationObservers.ValueListObserver(this.element, this.controllerAttribute, this);
|
2753
|
+
this.scopesByIdentifierByElement = new WeakMap();
|
2754
|
+
this.scopeReferenceCounts = new WeakMap();
|
2755
|
+
}
|
2756
|
+
|
2757
|
+
ScopeObserver.prototype.start = function () {
|
2758
|
+
this.valueListObserver.start();
|
2759
|
+
};
|
2760
|
+
|
2761
|
+
ScopeObserver.prototype.stop = function () {
|
2762
|
+
this.valueListObserver.stop();
|
2763
|
+
};
|
2764
|
+
|
2765
|
+
Object.defineProperty(ScopeObserver.prototype, "controllerAttribute", {
|
2766
|
+
get: function () {
|
2767
|
+
return this.schema.controllerAttribute;
|
2768
|
+
},
|
2769
|
+
enumerable: true,
|
2770
|
+
configurable: true
|
2771
|
+
}); // Value observer delegate
|
2772
|
+
|
2773
|
+
/** @hidden */
|
2774
|
+
|
2775
|
+
ScopeObserver.prototype.parseValueForToken = function (token) {
|
2776
|
+
var element = token.element,
|
2777
|
+
identifier = token.content;
|
2778
|
+
var scopesByIdentifier = this.fetchScopesByIdentifierForElement(element);
|
2779
|
+
var scope = scopesByIdentifier.get(identifier);
|
2780
|
+
|
2781
|
+
if (!scope) {
|
2782
|
+
scope = new _scope.Scope(this.schema, identifier, element);
|
2783
|
+
scopesByIdentifier.set(identifier, scope);
|
2784
|
+
}
|
2785
|
+
|
2786
|
+
return scope;
|
2787
|
+
};
|
2788
|
+
/** @hidden */
|
2789
|
+
|
2790
|
+
|
2791
|
+
ScopeObserver.prototype.elementMatchedValue = function (element, value) {
|
2792
|
+
var referenceCount = (this.scopeReferenceCounts.get(value) || 0) + 1;
|
2793
|
+
this.scopeReferenceCounts.set(value, referenceCount);
|
2794
|
+
|
2795
|
+
if (referenceCount == 1) {
|
2796
|
+
this.delegate.scopeConnected(value);
|
2797
|
+
}
|
2798
|
+
};
|
2799
|
+
/** @hidden */
|
2800
|
+
|
2801
|
+
|
2802
|
+
ScopeObserver.prototype.elementUnmatchedValue = function (element, value) {
|
2803
|
+
var referenceCount = this.scopeReferenceCounts.get(value);
|
2804
|
+
|
2805
|
+
if (referenceCount) {
|
2806
|
+
this.scopeReferenceCounts.set(value, referenceCount - 1);
|
2807
|
+
|
2808
|
+
if (referenceCount == 1) {
|
2809
|
+
this.delegate.scopeDisconnected(value);
|
2810
|
+
}
|
2811
|
+
}
|
2812
|
+
};
|
2813
|
+
|
2814
|
+
ScopeObserver.prototype.fetchScopesByIdentifierForElement = function (element) {
|
2815
|
+
var scopesByIdentifier = this.scopesByIdentifierByElement.get(element);
|
2816
|
+
|
2817
|
+
if (!scopesByIdentifier) {
|
2818
|
+
scopesByIdentifier = new Map();
|
2819
|
+
this.scopesByIdentifierByElement.set(element, scopesByIdentifier);
|
2820
|
+
}
|
2821
|
+
|
2822
|
+
return scopesByIdentifier;
|
2823
|
+
};
|
2824
|
+
|
2825
|
+
return ScopeObserver;
|
2826
|
+
}();
|
2827
|
+
|
2828
|
+
exports.ScopeObserver = ScopeObserver;
|
2829
|
+
},{"./scope":"../node_modules/@stimulus/core/dist/src/scope.js","@stimulus/mutation-observers":"../node_modules/@stimulus/mutation-observers/dist/index.js"}],"../node_modules/@stimulus/core/dist/src/router.js":[function(require,module,exports) {
|
2830
|
+
"use strict";
|
2831
|
+
|
2832
|
+
Object.defineProperty(exports, "__esModule", {
|
2833
|
+
value: true
|
2834
|
+
});
|
2835
|
+
exports.Router = void 0;
|
2836
|
+
|
2837
|
+
var _module = require("./module");
|
2838
|
+
|
2839
|
+
var _multimap = require("@stimulus/multimap");
|
2840
|
+
|
2841
|
+
var _scope_observer = require("./scope_observer");
|
2842
|
+
|
2843
|
+
var Router =
|
2844
|
+
/** @class */
|
2845
|
+
function () {
|
2846
|
+
function Router(application) {
|
2847
|
+
this.application = application;
|
2848
|
+
this.scopeObserver = new _scope_observer.ScopeObserver(this.element, this.schema, this);
|
2849
|
+
this.scopesByIdentifier = new _multimap.Multimap();
|
2850
|
+
this.modulesByIdentifier = new Map();
|
2851
|
+
}
|
2852
|
+
|
2853
|
+
Object.defineProperty(Router.prototype, "element", {
|
2854
|
+
get: function () {
|
2855
|
+
return this.application.element;
|
2856
|
+
},
|
2857
|
+
enumerable: true,
|
2858
|
+
configurable: true
|
2859
|
+
});
|
2860
|
+
Object.defineProperty(Router.prototype, "schema", {
|
2861
|
+
get: function () {
|
2862
|
+
return this.application.schema;
|
2863
|
+
},
|
2864
|
+
enumerable: true,
|
2865
|
+
configurable: true
|
2866
|
+
});
|
2867
|
+
Object.defineProperty(Router.prototype, "controllerAttribute", {
|
2868
|
+
get: function () {
|
2869
|
+
return this.schema.controllerAttribute;
|
2870
|
+
},
|
2871
|
+
enumerable: true,
|
2872
|
+
configurable: true
|
2873
|
+
});
|
2874
|
+
Object.defineProperty(Router.prototype, "modules", {
|
2875
|
+
get: function () {
|
2876
|
+
return Array.from(this.modulesByIdentifier.values());
|
2877
|
+
},
|
2878
|
+
enumerable: true,
|
2879
|
+
configurable: true
|
2880
|
+
});
|
2881
|
+
Object.defineProperty(Router.prototype, "contexts", {
|
2882
|
+
get: function () {
|
2883
|
+
return this.modules.reduce(function (contexts, module) {
|
2884
|
+
return contexts.concat(module.contexts);
|
2885
|
+
}, []);
|
2886
|
+
},
|
2887
|
+
enumerable: true,
|
2888
|
+
configurable: true
|
2889
|
+
});
|
2890
|
+
|
2891
|
+
Router.prototype.start = function () {
|
2892
|
+
this.scopeObserver.start();
|
2893
|
+
};
|
2894
|
+
|
2895
|
+
Router.prototype.stop = function () {
|
2896
|
+
this.scopeObserver.stop();
|
2897
|
+
};
|
2898
|
+
|
2899
|
+
Router.prototype.loadDefinition = function (definition) {
|
2900
|
+
this.unloadIdentifier(definition.identifier);
|
2901
|
+
var module = new _module.Module(this.application, definition);
|
2902
|
+
this.connectModule(module);
|
2903
|
+
};
|
2904
|
+
|
2905
|
+
Router.prototype.unloadIdentifier = function (identifier) {
|
2906
|
+
var module = this.modulesByIdentifier.get(identifier);
|
2907
|
+
|
2908
|
+
if (module) {
|
2909
|
+
this.disconnectModule(module);
|
2910
|
+
}
|
2911
|
+
};
|
2912
|
+
|
2913
|
+
Router.prototype.getContextForElementAndIdentifier = function (element, identifier) {
|
2914
|
+
var module = this.modulesByIdentifier.get(identifier);
|
2915
|
+
|
2916
|
+
if (module) {
|
2917
|
+
return module.contexts.find(function (context) {
|
2918
|
+
return context.element == element;
|
2919
|
+
});
|
2920
|
+
}
|
2921
|
+
}; // Error handler delegate
|
2922
|
+
|
2923
|
+
/** @hidden */
|
2924
|
+
|
2925
|
+
|
2926
|
+
Router.prototype.handleError = function (error, message, detail) {
|
2927
|
+
this.application.handleError(error, message, detail);
|
2928
|
+
}; // Scope observer delegate
|
2929
|
+
|
2930
|
+
/** @hidden */
|
2931
|
+
|
2932
|
+
|
2933
|
+
Router.prototype.scopeConnected = function (scope) {
|
2934
|
+
this.scopesByIdentifier.add(scope.identifier, scope);
|
2935
|
+
var module = this.modulesByIdentifier.get(scope.identifier);
|
2936
|
+
|
2937
|
+
if (module) {
|
2938
|
+
module.connectContextForScope(scope);
|
2939
|
+
}
|
2940
|
+
};
|
2941
|
+
/** @hidden */
|
2942
|
+
|
2943
|
+
|
2944
|
+
Router.prototype.scopeDisconnected = function (scope) {
|
2945
|
+
this.scopesByIdentifier.delete(scope.identifier, scope);
|
2946
|
+
var module = this.modulesByIdentifier.get(scope.identifier);
|
2947
|
+
|
2948
|
+
if (module) {
|
2949
|
+
module.disconnectContextForScope(scope);
|
2950
|
+
}
|
2951
|
+
}; // Modules
|
2952
|
+
|
2953
|
+
|
2954
|
+
Router.prototype.connectModule = function (module) {
|
2955
|
+
this.modulesByIdentifier.set(module.identifier, module);
|
2956
|
+
var scopes = this.scopesByIdentifier.getValuesForKey(module.identifier);
|
2957
|
+
scopes.forEach(function (scope) {
|
2958
|
+
return module.connectContextForScope(scope);
|
2959
|
+
});
|
2960
|
+
};
|
2961
|
+
|
2962
|
+
Router.prototype.disconnectModule = function (module) {
|
2963
|
+
this.modulesByIdentifier.delete(module.identifier);
|
2964
|
+
var scopes = this.scopesByIdentifier.getValuesForKey(module.identifier);
|
2965
|
+
scopes.forEach(function (scope) {
|
2966
|
+
return module.disconnectContextForScope(scope);
|
2967
|
+
});
|
2968
|
+
};
|
2969
|
+
|
2970
|
+
return Router;
|
2971
|
+
}();
|
2972
|
+
|
2973
|
+
exports.Router = Router;
|
2974
|
+
},{"./module":"../node_modules/@stimulus/core/dist/src/module.js","@stimulus/multimap":"../node_modules/@stimulus/multimap/dist/index.js","./scope_observer":"../node_modules/@stimulus/core/dist/src/scope_observer.js"}],"../node_modules/@stimulus/core/dist/src/schema.js":[function(require,module,exports) {
|
2975
|
+
"use strict";
|
2976
|
+
|
2977
|
+
Object.defineProperty(exports, "__esModule", {
|
2978
|
+
value: true
|
2979
|
+
});
|
2980
|
+
exports.defaultSchema = void 0;
|
2981
|
+
var defaultSchema = {
|
2982
|
+
controllerAttribute: "data-controller",
|
2983
|
+
actionAttribute: "data-action",
|
2984
|
+
targetAttribute: "data-target"
|
2985
|
+
};
|
2986
|
+
exports.defaultSchema = defaultSchema;
|
2987
|
+
},{}],"../node_modules/@stimulus/core/dist/src/application.js":[function(require,module,exports) {
|
2988
|
+
"use strict";
|
2989
|
+
|
2990
|
+
Object.defineProperty(exports, "__esModule", {
|
2991
|
+
value: true
|
2992
|
+
});
|
2993
|
+
exports.Application = void 0;
|
2994
|
+
|
2995
|
+
var _dispatcher = require("./dispatcher");
|
2996
|
+
|
2997
|
+
var _router = require("./router");
|
2998
|
+
|
2999
|
+
var _schema = require("./schema");
|
3000
|
+
|
3001
|
+
var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
|
3002
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
3003
|
+
function fulfilled(value) {
|
3004
|
+
try {
|
3005
|
+
step(generator.next(value));
|
3006
|
+
} catch (e) {
|
3007
|
+
reject(e);
|
3008
|
+
}
|
3009
|
+
}
|
3010
|
+
|
3011
|
+
function rejected(value) {
|
3012
|
+
try {
|
3013
|
+
step(generator["throw"](value));
|
3014
|
+
} catch (e) {
|
3015
|
+
reject(e);
|
3016
|
+
}
|
3017
|
+
}
|
3018
|
+
|
3019
|
+
function step(result) {
|
3020
|
+
result.done ? resolve(result.value) : new P(function (resolve) {
|
3021
|
+
resolve(result.value);
|
3022
|
+
}).then(fulfilled, rejected);
|
3023
|
+
}
|
3024
|
+
|
3025
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
3026
|
+
});
|
3027
|
+
};
|
3028
|
+
|
3029
|
+
var __generator = void 0 && (void 0).__generator || function (thisArg, body) {
|
3030
|
+
var _ = {
|
3031
|
+
label: 0,
|
3032
|
+
sent: function () {
|
3033
|
+
if (t[0] & 1) throw t[1];
|
3034
|
+
return t[1];
|
3035
|
+
},
|
3036
|
+
trys: [],
|
3037
|
+
ops: []
|
3038
|
+
},
|
3039
|
+
f,
|
3040
|
+
y,
|
3041
|
+
t,
|
3042
|
+
g;
|
3043
|
+
return g = {
|
3044
|
+
next: verb(0),
|
3045
|
+
"throw": verb(1),
|
3046
|
+
"return": verb(2)
|
3047
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
3048
|
+
return this;
|
3049
|
+
}), g;
|
3050
|
+
|
3051
|
+
function verb(n) {
|
3052
|
+
return function (v) {
|
3053
|
+
return step([n, v]);
|
3054
|
+
};
|
3055
|
+
}
|
3056
|
+
|
3057
|
+
function step(op) {
|
3058
|
+
if (f) throw new TypeError("Generator is already executing.");
|
3059
|
+
|
3060
|
+
while (_) try {
|
3061
|
+
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
|
3062
|
+
if (y = 0, t) op = [0, t.value];
|
3063
|
+
|
3064
|
+
switch (op[0]) {
|
3065
|
+
case 0:
|
3066
|
+
case 1:
|
3067
|
+
t = op;
|
3068
|
+
break;
|
3069
|
+
|
3070
|
+
case 4:
|
3071
|
+
_.label++;
|
3072
|
+
return {
|
3073
|
+
value: op[1],
|
3074
|
+
done: false
|
3075
|
+
};
|
3076
|
+
|
3077
|
+
case 5:
|
3078
|
+
_.label++;
|
3079
|
+
y = op[1];
|
3080
|
+
op = [0];
|
3081
|
+
continue;
|
3082
|
+
|
3083
|
+
case 7:
|
3084
|
+
op = _.ops.pop();
|
3085
|
+
|
3086
|
+
_.trys.pop();
|
3087
|
+
|
3088
|
+
continue;
|
3089
|
+
|
3090
|
+
default:
|
3091
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
3092
|
+
_ = 0;
|
3093
|
+
continue;
|
3094
|
+
}
|
3095
|
+
|
3096
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
3097
|
+
_.label = op[1];
|
3098
|
+
break;
|
3099
|
+
}
|
3100
|
+
|
3101
|
+
if (op[0] === 6 && _.label < t[1]) {
|
3102
|
+
_.label = t[1];
|
3103
|
+
t = op;
|
3104
|
+
break;
|
3105
|
+
}
|
3106
|
+
|
3107
|
+
if (t && _.label < t[2]) {
|
3108
|
+
_.label = t[2];
|
3109
|
+
|
3110
|
+
_.ops.push(op);
|
3111
|
+
|
3112
|
+
break;
|
3113
|
+
}
|
3114
|
+
|
3115
|
+
if (t[2]) _.ops.pop();
|
3116
|
+
|
3117
|
+
_.trys.pop();
|
3118
|
+
|
3119
|
+
continue;
|
3120
|
+
}
|
3121
|
+
|
3122
|
+
op = body.call(thisArg, _);
|
3123
|
+
} catch (e) {
|
3124
|
+
op = [6, e];
|
3125
|
+
y = 0;
|
3126
|
+
} finally {
|
3127
|
+
f = t = 0;
|
3128
|
+
}
|
3129
|
+
|
3130
|
+
if (op[0] & 5) throw op[1];
|
3131
|
+
return {
|
3132
|
+
value: op[0] ? op[1] : void 0,
|
3133
|
+
done: true
|
3134
|
+
};
|
3135
|
+
}
|
3136
|
+
};
|
3137
|
+
|
3138
|
+
var Application =
|
3139
|
+
/** @class */
|
3140
|
+
function () {
|
3141
|
+
function Application(element, schema) {
|
3142
|
+
if (element === void 0) {
|
3143
|
+
element = document.documentElement;
|
3144
|
+
}
|
3145
|
+
|
3146
|
+
if (schema === void 0) {
|
3147
|
+
schema = _schema.defaultSchema;
|
3148
|
+
}
|
3149
|
+
|
3150
|
+
this.element = element;
|
3151
|
+
this.schema = schema;
|
3152
|
+
this.dispatcher = new _dispatcher.Dispatcher(this);
|
3153
|
+
this.router = new _router.Router(this);
|
3154
|
+
}
|
3155
|
+
|
3156
|
+
Application.start = function (element, schema) {
|
3157
|
+
var application = new Application(element, schema);
|
3158
|
+
application.start();
|
3159
|
+
return application;
|
3160
|
+
};
|
3161
|
+
|
3162
|
+
Application.prototype.start = function () {
|
3163
|
+
return __awaiter(this, void 0, void 0, function () {
|
3164
|
+
return __generator(this, function (_a) {
|
3165
|
+
switch (_a.label) {
|
3166
|
+
case 0:
|
3167
|
+
return [4
|
3168
|
+
/*yield*/
|
3169
|
+
, domReady()];
|
3170
|
+
|
3171
|
+
case 1:
|
3172
|
+
_a.sent();
|
3173
|
+
|
3174
|
+
this.router.start();
|
3175
|
+
this.dispatcher.start();
|
3176
|
+
return [2
|
3177
|
+
/*return*/
|
3178
|
+
];
|
3179
|
+
}
|
3180
|
+
});
|
3181
|
+
});
|
3182
|
+
};
|
3183
|
+
|
3184
|
+
Application.prototype.stop = function () {
|
3185
|
+
this.router.stop();
|
3186
|
+
this.dispatcher.stop();
|
3187
|
+
};
|
3188
|
+
|
3189
|
+
Application.prototype.register = function (identifier, controllerConstructor) {
|
3190
|
+
this.load({
|
3191
|
+
identifier: identifier,
|
3192
|
+
controllerConstructor: controllerConstructor
|
3193
|
+
});
|
3194
|
+
};
|
3195
|
+
|
3196
|
+
Application.prototype.load = function (head) {
|
3197
|
+
var _this = this;
|
3198
|
+
|
3199
|
+
var rest = [];
|
3200
|
+
|
3201
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
3202
|
+
rest[_i - 1] = arguments[_i];
|
3203
|
+
}
|
3204
|
+
|
3205
|
+
var definitions = Array.isArray(head) ? head : [head].concat(rest);
|
3206
|
+
definitions.forEach(function (definition) {
|
3207
|
+
return _this.router.loadDefinition(definition);
|
3208
|
+
});
|
3209
|
+
};
|
3210
|
+
|
3211
|
+
Application.prototype.unload = function (head) {
|
3212
|
+
var _this = this;
|
3213
|
+
|
3214
|
+
var rest = [];
|
3215
|
+
|
3216
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
3217
|
+
rest[_i - 1] = arguments[_i];
|
3218
|
+
}
|
3219
|
+
|
3220
|
+
var identifiers = Array.isArray(head) ? head : [head].concat(rest);
|
3221
|
+
identifiers.forEach(function (identifier) {
|
3222
|
+
return _this.router.unloadIdentifier(identifier);
|
3223
|
+
});
|
3224
|
+
};
|
3225
|
+
|
3226
|
+
Object.defineProperty(Application.prototype, "controllers", {
|
3227
|
+
// Controllers
|
3228
|
+
get: function () {
|
3229
|
+
return this.router.contexts.map(function (context) {
|
3230
|
+
return context.controller;
|
3231
|
+
});
|
3232
|
+
},
|
3233
|
+
enumerable: true,
|
3234
|
+
configurable: true
|
3235
|
+
});
|
3236
|
+
|
3237
|
+
Application.prototype.getControllerForElementAndIdentifier = function (element, identifier) {
|
3238
|
+
var context = this.router.getContextForElementAndIdentifier(element, identifier);
|
3239
|
+
return context ? context.controller : null;
|
3240
|
+
}; // Error handling
|
3241
|
+
|
3242
|
+
|
3243
|
+
Application.prototype.handleError = function (error, message, detail) {
|
3244
|
+
console.error("%s\n\n%o\n\n%o", message, error, detail);
|
3245
|
+
};
|
3246
|
+
|
3247
|
+
return Application;
|
3248
|
+
}();
|
3249
|
+
|
3250
|
+
exports.Application = Application;
|
3251
|
+
|
3252
|
+
function domReady() {
|
3253
|
+
return new Promise(function (resolve) {
|
3254
|
+
if (document.readyState == "loading") {
|
3255
|
+
document.addEventListener("DOMContentLoaded", resolve);
|
3256
|
+
} else {
|
3257
|
+
resolve();
|
3258
|
+
}
|
3259
|
+
});
|
3260
|
+
}
|
3261
|
+
},{"./dispatcher":"../node_modules/@stimulus/core/dist/src/dispatcher.js","./router":"../node_modules/@stimulus/core/dist/src/router.js","./schema":"../node_modules/@stimulus/core/dist/src/schema.js"}],"../node_modules/@stimulus/core/dist/src/target_properties.js":[function(require,module,exports) {
|
3262
|
+
"use strict";
|
3263
|
+
|
3264
|
+
Object.defineProperty(exports, "__esModule", {
|
3265
|
+
value: true
|
3266
|
+
});
|
3267
|
+
exports.defineTargetProperties = defineTargetProperties;
|
3268
|
+
|
3269
|
+
/** @hidden */
|
3270
|
+
function defineTargetProperties(constructor) {
|
3271
|
+
var prototype = constructor.prototype;
|
3272
|
+
var targetNames = getTargetNamesForConstructor(constructor);
|
3273
|
+
targetNames.forEach(function (name) {
|
3274
|
+
var _a;
|
3275
|
+
|
3276
|
+
return defineLinkedProperties(prototype, (_a = {}, _a[name + "Target"] = {
|
3277
|
+
get: function () {
|
3278
|
+
var target = this.targets.find(name);
|
3279
|
+
|
3280
|
+
if (target) {
|
3281
|
+
return target;
|
3282
|
+
} else {
|
3283
|
+
throw new Error("Missing target element \"" + this.identifier + "." + name + "\"");
|
3284
|
+
}
|
3285
|
+
}
|
3286
|
+
}, _a[name + "Targets"] = {
|
3287
|
+
get: function () {
|
3288
|
+
return this.targets.findAll(name);
|
3289
|
+
}
|
3290
|
+
}, _a["has" + capitalize(name) + "Target"] = {
|
3291
|
+
get: function () {
|
3292
|
+
return this.targets.has(name);
|
3293
|
+
}
|
3294
|
+
}, _a));
|
3295
|
+
});
|
3296
|
+
}
|
3297
|
+
|
3298
|
+
function getTargetNamesForConstructor(constructor) {
|
3299
|
+
var ancestors = getAncestorsForConstructor(constructor);
|
3300
|
+
return Array.from(ancestors.reduce(function (targetNames, constructor) {
|
3301
|
+
getOwnTargetNamesForConstructor(constructor).forEach(function (name) {
|
3302
|
+
return targetNames.add(name);
|
3303
|
+
});
|
3304
|
+
return targetNames;
|
3305
|
+
}, new Set()));
|
3306
|
+
}
|
3307
|
+
|
3308
|
+
function getAncestorsForConstructor(constructor) {
|
3309
|
+
var ancestors = [];
|
3310
|
+
|
3311
|
+
while (constructor) {
|
3312
|
+
ancestors.push(constructor);
|
3313
|
+
constructor = Object.getPrototypeOf(constructor);
|
3314
|
+
}
|
3315
|
+
|
3316
|
+
return ancestors;
|
3317
|
+
}
|
3318
|
+
|
3319
|
+
function getOwnTargetNamesForConstructor(constructor) {
|
3320
|
+
var definition = constructor["targets"];
|
3321
|
+
return Array.isArray(definition) ? definition : [];
|
3322
|
+
}
|
3323
|
+
|
3324
|
+
function defineLinkedProperties(object, properties) {
|
3325
|
+
Object.keys(properties).forEach(function (name) {
|
3326
|
+
if (!(name in object)) {
|
3327
|
+
var descriptor = properties[name];
|
3328
|
+
Object.defineProperty(object, name, descriptor);
|
3329
|
+
}
|
3330
|
+
});
|
3331
|
+
}
|
3332
|
+
|
3333
|
+
function capitalize(name) {
|
3334
|
+
return name.charAt(0).toUpperCase() + name.slice(1);
|
3335
|
+
}
|
3336
|
+
},{}],"../node_modules/@stimulus/core/dist/src/controller.js":[function(require,module,exports) {
|
3337
|
+
"use strict";
|
3338
|
+
|
3339
|
+
Object.defineProperty(exports, "__esModule", {
|
3340
|
+
value: true
|
3341
|
+
});
|
3342
|
+
exports.Controller = void 0;
|
3343
|
+
|
3344
|
+
var _target_properties = require("./target_properties");
|
3345
|
+
|
3346
|
+
var Controller =
|
3347
|
+
/** @class */
|
3348
|
+
function () {
|
3349
|
+
function Controller(context) {
|
3350
|
+
this.context = context;
|
3351
|
+
}
|
3352
|
+
|
3353
|
+
Controller.bless = function () {
|
3354
|
+
(0, _target_properties.defineTargetProperties)(this);
|
3355
|
+
};
|
3356
|
+
|
3357
|
+
Object.defineProperty(Controller.prototype, "application", {
|
3358
|
+
get: function () {
|
3359
|
+
return this.context.application;
|
3360
|
+
},
|
3361
|
+
enumerable: true,
|
3362
|
+
configurable: true
|
3363
|
+
});
|
3364
|
+
Object.defineProperty(Controller.prototype, "scope", {
|
3365
|
+
get: function () {
|
3366
|
+
return this.context.scope;
|
3367
|
+
},
|
3368
|
+
enumerable: true,
|
3369
|
+
configurable: true
|
3370
|
+
});
|
3371
|
+
Object.defineProperty(Controller.prototype, "element", {
|
3372
|
+
get: function () {
|
3373
|
+
return this.scope.element;
|
3374
|
+
},
|
3375
|
+
enumerable: true,
|
3376
|
+
configurable: true
|
3377
|
+
});
|
3378
|
+
Object.defineProperty(Controller.prototype, "identifier", {
|
3379
|
+
get: function () {
|
3380
|
+
return this.scope.identifier;
|
3381
|
+
},
|
3382
|
+
enumerable: true,
|
3383
|
+
configurable: true
|
3384
|
+
});
|
3385
|
+
Object.defineProperty(Controller.prototype, "targets", {
|
3386
|
+
get: function () {
|
3387
|
+
return this.scope.targets;
|
3388
|
+
},
|
3389
|
+
enumerable: true,
|
3390
|
+
configurable: true
|
3391
|
+
});
|
3392
|
+
Object.defineProperty(Controller.prototype, "data", {
|
3393
|
+
get: function () {
|
3394
|
+
return this.scope.data;
|
3395
|
+
},
|
3396
|
+
enumerable: true,
|
3397
|
+
configurable: true
|
3398
|
+
});
|
3399
|
+
|
3400
|
+
Controller.prototype.initialize = function () {// Override in your subclass to set up initial controller state
|
3401
|
+
};
|
3402
|
+
|
3403
|
+
Controller.prototype.connect = function () {// Override in your subclass to respond when the controller is connected to the DOM
|
3404
|
+
};
|
3405
|
+
|
3406
|
+
Controller.prototype.disconnect = function () {// Override in your subclass to respond when the controller is disconnected from the DOM
|
3407
|
+
};
|
3408
|
+
|
3409
|
+
Controller.targets = [];
|
3410
|
+
return Controller;
|
3411
|
+
}();
|
3412
|
+
|
3413
|
+
exports.Controller = Controller;
|
3414
|
+
},{"./target_properties":"../node_modules/@stimulus/core/dist/src/target_properties.js"}],"../node_modules/@stimulus/core/dist/index.js":[function(require,module,exports) {
|
3415
|
+
"use strict";
|
3416
|
+
|
3417
|
+
Object.defineProperty(exports, "__esModule", {
|
3418
|
+
value: true
|
3419
|
+
});
|
3420
|
+
Object.defineProperty(exports, "Application", {
|
3421
|
+
enumerable: true,
|
3422
|
+
get: function () {
|
3423
|
+
return _application.Application;
|
3424
|
+
}
|
3425
|
+
});
|
3426
|
+
Object.defineProperty(exports, "Context", {
|
3427
|
+
enumerable: true,
|
3428
|
+
get: function () {
|
3429
|
+
return _context.Context;
|
3430
|
+
}
|
3431
|
+
});
|
3432
|
+
Object.defineProperty(exports, "Controller", {
|
3433
|
+
enumerable: true,
|
3434
|
+
get: function () {
|
3435
|
+
return _controller.Controller;
|
3436
|
+
}
|
3437
|
+
});
|
3438
|
+
Object.defineProperty(exports, "defaultSchema", {
|
3439
|
+
enumerable: true,
|
3440
|
+
get: function () {
|
3441
|
+
return _schema.defaultSchema;
|
3442
|
+
}
|
3443
|
+
});
|
3444
|
+
|
3445
|
+
var _application = require("./src/application");
|
3446
|
+
|
3447
|
+
var _context = require("./src/context");
|
3448
|
+
|
3449
|
+
var _controller = require("./src/controller");
|
3450
|
+
|
3451
|
+
var _schema = require("./src/schema");
|
3452
|
+
},{"./src/application":"../node_modules/@stimulus/core/dist/src/application.js","./src/context":"../node_modules/@stimulus/core/dist/src/context.js","./src/controller":"../node_modules/@stimulus/core/dist/src/controller.js","./src/schema":"../node_modules/@stimulus/core/dist/src/schema.js"}],"../node_modules/stimulus/index.js":[function(require,module,exports) {
|
3453
|
+
"use strict";
|
3454
|
+
|
3455
|
+
Object.defineProperty(exports, "__esModule", {
|
3456
|
+
value: true
|
3457
|
+
});
|
3458
|
+
|
3459
|
+
var _core = require("@stimulus/core");
|
3460
|
+
|
3461
|
+
Object.keys(_core).forEach(function (key) {
|
3462
|
+
if (key === "default" || key === "__esModule") return;
|
3463
|
+
Object.defineProperty(exports, key, {
|
3464
|
+
enumerable: true,
|
3465
|
+
get: function () {
|
3466
|
+
return _core[key];
|
3467
|
+
}
|
3468
|
+
});
|
3469
|
+
});
|
3470
|
+
},{"@stimulus/core":"../node_modules/@stimulus/core/dist/index.js"}],"javascripts/super/apply_template_controller.ts":[function(require,module,exports) {
|
3471
|
+
"use strict";
|
3472
|
+
|
3473
|
+
var __extends = this && this.__extends || function () {
|
3474
|
+
var _extendStatics = function extendStatics(d, b) {
|
3475
|
+
_extendStatics = Object.setPrototypeOf || {
|
3476
|
+
__proto__: []
|
3477
|
+
} instanceof Array && function (d, b) {
|
3478
|
+
d.__proto__ = b;
|
3479
|
+
} || function (d, b) {
|
3480
|
+
for (var p in b) {
|
3481
|
+
if (b.hasOwnProperty(p)) d[p] = b[p];
|
3482
|
+
}
|
3483
|
+
};
|
3484
|
+
|
3485
|
+
return _extendStatics(d, b);
|
3486
|
+
};
|
3487
|
+
|
3488
|
+
return function (d, b) {
|
3489
|
+
_extendStatics(d, b);
|
3490
|
+
|
3491
|
+
function __() {
|
3492
|
+
this.constructor = d;
|
3493
|
+
}
|
3494
|
+
|
3495
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
3496
|
+
};
|
3497
|
+
}();
|
3498
|
+
|
3499
|
+
Object.defineProperty(exports, "__esModule", {
|
3500
|
+
value: true
|
3501
|
+
});
|
3502
|
+
|
3503
|
+
var stimulus_1 = require("stimulus");
|
3504
|
+
|
3505
|
+
var default_1 =
|
3506
|
+
/** @class */
|
3507
|
+
function (_super) {
|
3508
|
+
__extends(default_1, _super);
|
3509
|
+
|
3510
|
+
function default_1() {
|
3511
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
3512
|
+
}
|
3513
|
+
|
3514
|
+
default_1.prototype.call = function (event) {
|
3515
|
+
event.preventDefault();
|
3516
|
+
|
3517
|
+
if (this.templateTarget) {
|
3518
|
+
var unixtime = new Date().getTime();
|
3519
|
+
var content = this.templateTarget.innerHTML.replace(/TEMPLATEINDEX/g, unixtime.toString());
|
3520
|
+
this.templateTarget.insertAdjacentHTML("beforebegin", content);
|
3521
|
+
}
|
3522
|
+
};
|
3523
|
+
|
3524
|
+
default_1.targets = ["template"];
|
3525
|
+
return default_1;
|
3526
|
+
}(stimulus_1.Controller);
|
3527
|
+
|
3528
|
+
exports.default = default_1;
|
3529
|
+
},{"stimulus":"../node_modules/stimulus/index.js"}],"javascripts/super/toggle_pending_destruction_controller.ts":[function(require,module,exports) {
|
3530
|
+
"use strict";
|
3531
|
+
|
3532
|
+
var __extends = this && this.__extends || function () {
|
3533
|
+
var _extendStatics = function extendStatics(d, b) {
|
3534
|
+
_extendStatics = Object.setPrototypeOf || {
|
3535
|
+
__proto__: []
|
3536
|
+
} instanceof Array && function (d, b) {
|
3537
|
+
d.__proto__ = b;
|
3538
|
+
} || function (d, b) {
|
3539
|
+
for (var p in b) {
|
3540
|
+
if (b.hasOwnProperty(p)) d[p] = b[p];
|
3541
|
+
}
|
3542
|
+
};
|
3543
|
+
|
3544
|
+
return _extendStatics(d, b);
|
3545
|
+
};
|
3546
|
+
|
3547
|
+
return function (d, b) {
|
3548
|
+
_extendStatics(d, b);
|
3549
|
+
|
3550
|
+
function __() {
|
3551
|
+
this.constructor = d;
|
3552
|
+
}
|
3553
|
+
|
3554
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
3555
|
+
};
|
3556
|
+
}();
|
3557
|
+
|
3558
|
+
Object.defineProperty(exports, "__esModule", {
|
3559
|
+
value: true
|
3560
|
+
});
|
3561
|
+
|
3562
|
+
var stimulus_1 = require("stimulus");
|
3563
|
+
|
3564
|
+
var default_1 =
|
3565
|
+
/** @class */
|
3566
|
+
function (_super) {
|
3567
|
+
__extends(default_1, _super);
|
3568
|
+
|
3569
|
+
function default_1() {
|
3570
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
3571
|
+
}
|
3572
|
+
|
3573
|
+
default_1.prototype.call = function (event) {
|
3574
|
+
var target = event.target;
|
3575
|
+
|
3576
|
+
if (target) {
|
3577
|
+
if (target.checked) {
|
3578
|
+
this.element.classList.add("opacity-75", "bg-gray-100");
|
3579
|
+
} else {
|
3580
|
+
this.element.classList.remove("opacity-75", "bg-gray-100");
|
3581
|
+
}
|
3582
|
+
}
|
3583
|
+
};
|
3584
|
+
|
3585
|
+
return default_1;
|
3586
|
+
}(stimulus_1.Controller);
|
3587
|
+
|
3588
|
+
exports.default = default_1;
|
3589
|
+
},{"stimulus":"../node_modules/stimulus/index.js"}],"javascripts/super/application.ts":[function(require,module,exports) {
|
3590
|
+
"use strict";
|
3591
|
+
|
3592
|
+
var __importDefault = this && this.__importDefault || function (mod) {
|
3593
|
+
return mod && mod.__esModule ? mod : {
|
3594
|
+
"default": mod
|
3595
|
+
};
|
3596
|
+
};
|
3597
|
+
|
3598
|
+
Object.defineProperty(exports, "__esModule", {
|
3599
|
+
value: true
|
3600
|
+
});
|
3601
|
+
|
3602
|
+
var ujs_1 = __importDefault(require("@rails/ujs"));
|
3603
|
+
|
3604
|
+
var stimulus_1 = require("stimulus");
|
3605
|
+
|
3606
|
+
var apply_template_controller_1 = __importDefault(require("./apply_template_controller"));
|
3607
|
+
|
3608
|
+
var toggle_pending_destruction_controller_1 = __importDefault(require("./toggle_pending_destruction_controller"));
|
3609
|
+
|
3610
|
+
ujs_1.default.start();
|
3611
|
+
var application = stimulus_1.Application.start();
|
3612
|
+
application.register("apply-template", apply_template_controller_1.default);
|
3613
|
+
application.register("toggle-pending-destruction", toggle_pending_destruction_controller_1.default);
|
3614
|
+
exports.default = {
|
3615
|
+
StimulusApplication: application,
|
3616
|
+
StimulusController: stimulus_1.Controller
|
3617
|
+
};
|
3618
|
+
},{"@rails/ujs":"../node_modules/@rails/ujs/lib/assets/compiled/rails-ujs.js","stimulus":"../node_modules/stimulus/index.js","./apply_template_controller":"javascripts/super/apply_template_controller.ts","./toggle_pending_destruction_controller":"javascripts/super/toggle_pending_destruction_controller.ts"}]},{},["javascripts/super/application.ts"], "Super")
|