stimulus-rails 0.2.4 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d7b182fb2a48a9405b734b3d8180930f181cf115cb52b7d9061f3f92183d2f3e
4
- data.tar.gz: 663e24b437761d3ff60ad7e78e8dc9ac9191ad91b83935ae95a04100dd6c66c2
3
+ metadata.gz: 4e2d87258c887a8886dff96fa2c1f866fe6efd0bc1f1eeb74f4cbcbb0f71c803
4
+ data.tar.gz: e394de1e3402e42f4f6d413db72a9913e9634e036dae3d65768a5ad9e62d7d66
5
5
  SHA512:
6
- metadata.gz: 0d84fd49c9ad55572e525b5239b289fbe9a01839f67a24453efa875357ab0a0ecb30f39bc43df447d565dd75cda282ab21c653e09ff7db36d1150136b53fcbb0
7
- data.tar.gz: 9e3bfa7a5be5a8457a3612863d7b136fd3c3e514f04367ceacce7327050f2403b69f18305c598cc07311a89cb3fa55c1f4aeb667c0f73e0c76cc15bdc8e684c7
6
+ metadata.gz: 633b7fcc4c34bdc5ca37c33f2d0b110d2a6ca97b45baced2da649b25655bac932cbd8b5f2a2db0b72a3bb00542830d8a383ef8b054dff01374e481d96528829d
7
+ data.tar.gz: 3f342369df93d915c043e98ea84507128e50f76ed5ab08ac0fcb7cb1e8e6fb4c49200ba60908b02c0c87739f7bbc12e03ab209111682ea0c18b37e877213b359
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2020 Basecamp
1
+ Copyright (c) 2021 Basecamp
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,10 +1,9 @@
1
1
  # Stimulus for Rails
2
2
 
3
- [Stimulus](https://stimulus.hotwire.dev) is a JavaScript framework with modest ambitions. It doesn’t seek to take over your entire front-end in fact, it’s not concerned with rendering HTML at all. Instead, it’s designed to augment your HTML with just enough behavior to make it shine. Stimulus pairs beautifully with Turbo to provide a complete solution for fast, compelling applications with a minimal amount of effort.
3
+ [Stimulus](https://stimulus.hotwired.dev) is a JavaScript framework with modest ambitions. It doesn’t seek to take over your entire front-end in fact, it’s not concerned with rendering HTML at all. Instead, it’s designed to augment your HTML with just enough behavior to make it shine. Stimulus pairs beautifully with Turbo to provide a complete solution for fast, compelling applications with a minimal amount of effort. Together they form the core of [Hotwire](https://hotwired.dev).
4
4
 
5
- Stimulus for Rails makes it easy to use this modest framework with the asset pipeline and ES6/ESM in the browser. It uses the 7kb es-module-shim to provide [importmap](https://github.com/WICG/import-maps) support for all ES6-compatible browsers. This means you can develop and deploy without using any bundling or transpiling at all! Far less complexity, no waiting for compiling.
5
+ Stimulus for Rails makes it easy to use this modest framework with the asset pipeline and ES6/ESM in the browser. It relies on `importmap-rails` to make stimulus available via ESM. Make sure to install this first!
6
6
 
7
- If you want to use Stimulus with a bundler, you should use [Webpacker](https://github.com/rails/webpacker) instead. This gem is purely intended for those who wish to use Stimulus with the asset pipeline using ESM in the browser.
8
7
 
9
8
  ## Installation
10
9
 
@@ -15,9 +14,9 @@ If you want to use Stimulus with a bundler, you should use [Webpacker](https://g
15
14
  If using the asset pipeline to manage JavaScript, the last command will:
16
15
 
17
16
  1. Create an example controller in `app/assets/javascripts/controllers/hello_controller.js`.
18
- 2. Append the include tags to the `<head>` of your `app/views/layouts/application.html.erb`.
19
- 3. Initialize your `importmap.json` in `app/assets/javascripts/importmap.json.erb`.
20
- 4. Ensure JavaScript is included in your `app/assets/config/manifest.js` file for compilation.
17
+ 2. Append `import "@hotwired/stimulus-autoloader"` to your `app/assets/javascripts/application.js` entrypoint.
18
+
19
+ Make sure you've already installed `importmap-rails` and that it's referenced before `stimulus-rails` (or `hotwire-rails`) in your Gemfile.
21
20
 
22
21
  If using Webpacker to manage JavaScript, the last command will:
23
22
 
@@ -26,9 +25,10 @@ If using Webpacker to manage JavaScript, the last command will:
26
25
  3. Create an example controller in `app/javascripts/controllers/hello_controller.js`.
27
26
  4. Install the Stimulus NPM package.
28
27
 
28
+
29
29
  ## Usage
30
30
 
31
- With the Stimulus include tags added, you'll automatically have activated Stimulus through the controller autoloader. You can now easily add new Stimulus controllers that'll be loaded via ESM dynamic imports.
31
+ With the installation done, you'll automatically have activated Stimulus through the controller autoloader. You can now easily add new Stimulus controllers that'll be loaded via ESM dynamic imports.
32
32
 
33
33
  For example, a more advanced `hello_controller` could look like this:
34
34
 
@@ -62,10 +62,6 @@ And it'll be activated and registered automatically when encountering the data-c
62
62
 
63
63
  That's it!
64
64
 
65
- You can add additional libraries needed by your controllers in `app/assets/javascripts/libraries` using the `library@1.0.0.js` naming convention. These libraries will be added to the dynamically generated [importmap](https://github.com/WICG/import-maps) (a shim is included with the `stimulus_include_tags`), so you can reference `cookies@0.5.6.js` as `import Cookie from "cookies"`.
66
-
67
- The libraries must be made for ESM. See https://skypack.dev where you can either directly reference libraries or download them and use them with the ESM conversion.
68
-
69
65
 
70
66
  ## License
71
67
 
@@ -1,4 +1,4 @@
1
- import { Application } from "stimulus"
1
+ import { Application } from "@hotwired/stimulus"
2
2
 
3
3
  const application = Application.start()
4
4
  const { controllerAttribute } = application.schema
@@ -23,7 +23,7 @@ function loadController(name) {
23
23
  }
24
24
 
25
25
  function controllerFilename(name) {
26
- return `${name.replace(/--/g, "/").replace(/-/g, "_")}_controller`
26
+ return `controllers/${name.replace(/--/g, "/").replace(/-/g, "_")}_controller`
27
27
  }
28
28
 
29
29
  function registerController(name, module) {
@@ -1,4 +1,4 @@
1
- import { Controller } from "stimulus"
1
+ import { Controller } from "@hotwired/stimulus"
2
2
 
3
3
  export default class extends Controller {
4
4
  connect() {
@@ -4,6 +4,6 @@
4
4
  import { Application } from "stimulus"
5
5
  import { definitionsFromContext } from "stimulus/webpack-helpers"
6
6
 
7
- const application = Application.start()
7
+ window.Stimulus = Application.start()
8
8
  const context = require.context("controllers", true, /_controller\.(js|ts)$/)
9
- application.load(definitionsFromContext(context))
9
+ Stimulus.load(definitionsFromContext(context))
@@ -1,23 +1,7 @@
1
- say "Copying Stimulus JavaScript"
2
- directory "#{__dir__}/app/assets/javascripts", "app/assets/javascripts"
3
- empty_directory_with_keep_file "app/assets/javascripts/libraries"
1
+ APP_JS_ROOT = Rails.root.join("app/assets/javascripts")
4
2
 
5
- say "Add app/assets/javascripts to asset pipeline manifest"
6
- append_to_file Rails.root.join("app/assets/config/manifest.js").to_s, "//= link_tree ../javascripts\n"
3
+ say "Import Stimulus autoloader in existing app/assets/javascripts/application.js"
4
+ append_to_file APP_JS_ROOT.join("application.js"), %(import "@hotwired/stimulus-autoloader"\n)
7
5
 
8
- APPLICATION_LAYOUT_PATH = Rails.root.join("app/views/layouts/application.html.erb")
9
-
10
- if APPLICATION_LAYOUT_PATH.exist?
11
- say "Add Stimulus include tags in application layout"
12
- insert_into_file Rails.root.join("app/views/layouts/application.html.erb").to_s, "\n <%= stimulus_include_tags %>", before: /\s*<\/head>/
13
- else
14
- say "Default application.html.erb is missing!", :red
15
- say " Add <%= stimulus_include_tags %> within the <head> tag in your custom layout."
16
- end
17
-
18
- say "Turn off development debug mode"
19
- comment_lines Rails.root.join("config/environments/development.rb"), /config.assets.debug = true/
20
-
21
- say "Turn off rack-mini-profiler"
22
- comment_lines Rails.root.join("Gemfile"), /rack-mini-profiler/
23
- run "bin/bundle", capture: true
6
+ say "Creating controllers directory"
7
+ copy_file "#{__dir__}/app/assets/javascripts/controllers/hello_controller.js", APP_JS_ROOT.join("controllers/hello_controller.js")
@@ -1,7 +1,5 @@
1
1
  say "Appending Stimulus setup code to #{Webpacker.config.source_entry_path}/application.js"
2
- append_to_file "#{Webpacker.config.source_entry_path}/application.js" do
3
- "\n" + open("#{__dir__}/application.js").read
4
- end
2
+ append_to_file "#{Webpacker.config.source_entry_path}/application.js", %(\nimport "controllers")
5
3
 
6
4
  say "Creating controllers directory"
7
5
  directory "#{__dir__}/app/assets/javascripts/controllers", "#{Webpacker.config.source_path}/controllers"
@@ -1,23 +1,16 @@
1
- require "stimulus/importmap_helper"
2
-
3
1
  module Stimulus
4
2
  class Engine < ::Rails::Engine
5
- config.autoload_once_paths = %w( #{root}/app/helpers )
6
-
7
3
  initializer "stimulus.assets" do
8
4
  if Rails.application.config.respond_to?(:assets)
9
- Rails.application.config.assets.precompile += %w( importmap.json stimulus/manifest )
5
+ Rails.application.config.assets.precompile += %w( stimulus stimulus-autoloader )
10
6
  end
11
7
  end
12
8
 
13
- initializer "stimulus.helpers" do
14
- ActiveSupport.on_load(:action_controller_base) do
15
- helper Stimulus::StimulusHelper
16
- end
17
-
18
- if Rails.application.config.respond_to?(:assets)
19
- Rails.application.config.assets.configure do |env|
20
- env.context_class.class_eval { include Stimulus::ImportmapHelper }
9
+ initializer "stimulus.importmap" do
10
+ if Rails.application.config.respond_to?(:importmap)
11
+ Rails.application.config.importmap.paths.tap do |paths|
12
+ paths.asset "@hotwired/stimulus", path: "stimulus"
13
+ paths.asset "@hotwired/stimulus-autoloader", path: "stimulus-autoloader"
21
14
  end
22
15
  end
23
16
  end
@@ -1,3 +1,3 @@
1
1
  module Stimulus
2
- VERSION = "0.2.4"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -5,8 +5,10 @@ namespace :stimulus do
5
5
  task :install do
6
6
  if defined?(Webpacker::Engine)
7
7
  Rake::Task["stimulus:install:webpacker"].invoke
8
- else
8
+ elsif defined?(Importmap)
9
9
  Rake::Task["stimulus:install:asset_pipeline"].invoke
10
+ else
11
+ puts "You must either be running Webpacker or importmap-rails to use this gem."
10
12
  end
11
13
  end
12
14
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stimulus-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Stephenson
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-06-12 00:00:00.000000000 Z
13
+ date: 2021-08-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
@@ -35,29 +35,22 @@ files:
35
35
  - MIT-LICENSE
36
36
  - README.md
37
37
  - Rakefile
38
- - app/assets/javascripts/stimulus/libraries/es-module-shims.js
39
- - app/assets/javascripts/stimulus/libraries/es-module-shims@0.7.1.js
40
- - app/assets/javascripts/stimulus/libraries/stimulus.js
41
- - app/assets/javascripts/stimulus/libraries/stimulus@2.js
42
- - app/assets/javascripts/stimulus/loaders/autoloader.js
43
- - app/assets/javascripts/stimulus/manifest.js
44
- - app/helpers/stimulus/stimulus_helper.rb
38
+ - app/assets/javascripts/stimulus-autoloader.js
39
+ - app/assets/javascripts/stimulus.js
40
+ - app/assets/javascripts/stimulus@2.js
45
41
  - lib/install/app/assets/javascripts/controllers/hello_controller.js
46
42
  - lib/install/app/assets/javascripts/controllers/index.js
47
- - lib/install/app/assets/javascripts/importmap.json.erb
48
- - lib/install/application.js
49
43
  - lib/install/stimulus_with_asset_pipeline.rb
50
44
  - lib/install/stimulus_with_webpacker.rb
51
45
  - lib/stimulus-rails.rb
52
46
  - lib/stimulus/engine.rb
53
- - lib/stimulus/importmap_helper.rb
54
47
  - lib/stimulus/version.rb
55
48
  - lib/tasks/stimulus_tasks.rake
56
- homepage: https://stimulus.hotwire.dev
49
+ homepage: https://stimulus.hotwired.dev
57
50
  licenses:
58
51
  - MIT
59
52
  metadata:
60
- homepage_uri: https://stimulus.hotwire.dev
53
+ homepage_uri: https://stimulus.hotwired.dev
61
54
  source_code_uri: https://github.com/hotwired/stimulus-rails
62
55
  post_install_message:
63
56
  rdoc_options: []
@@ -1 +0,0 @@
1
- //= require ./es-module-shims@0.7.1.js
@@ -1,475 +0,0 @@
1
- /* ES Module Shims 0.5.0 */
2
- (function () {
3
- 'use strict';
4
-
5
- const resolvedPromise = Promise.resolve();
6
-
7
- let baseUrl;
8
-
9
- function createBlob (source) {
10
- return URL.createObjectURL(new Blob([source], { type: 'application/javascript' }));
11
- }
12
-
13
- const hasDocument = typeof document !== 'undefined';
14
-
15
- // support browsers without dynamic import support (eg Firefox 6x)
16
- let dynamicImport;
17
- try {
18
- dynamicImport = (0, eval)('u=>import(u)');
19
- }
20
- catch (e) {
21
- if (hasDocument) {
22
- self.addEventListener('error', e => importShim.e = e.error);
23
- dynamicImport = blobUrl => {
24
- const topLevelBlobUrl = createBlob(
25
- `import*as m from'${blobUrl}';self.importShim.l=m;self.importShim.e=null`
26
- );
27
- const s = document.createElement('script');
28
- s.type = 'module';
29
- s.src = topLevelBlobUrl;
30
- document.head.appendChild(s);
31
- return new Promise((resolve, reject) => {
32
- s.addEventListener('load', () => {
33
- document.head.removeChild(s);
34
- importShim.e ? reject(importShim.e) : resolve(importShim.l, baseUrl);
35
- });
36
- });
37
- };
38
- }
39
- }
40
-
41
- if (hasDocument) {
42
- const baseEl = document.querySelector('base[href]');
43
- if (baseEl)
44
- baseUrl = baseEl.href;
45
- }
46
-
47
- if (!baseUrl && typeof location !== 'undefined') {
48
- baseUrl = location.href.split('#')[0].split('?')[0];
49
- const lastSepIndex = baseUrl.lastIndexOf('/');
50
- if (lastSepIndex !== -1)
51
- baseUrl = baseUrl.slice(0, lastSepIndex + 1);
52
- }
53
-
54
- let esModuleShimsSrc;
55
- if (hasDocument) {
56
- esModuleShimsSrc = document.currentScript && document.currentScript.src;
57
- }
58
-
59
- const backslashRegEx = /\\/g;
60
- function resolveIfNotPlainOrUrl (relUrl, parentUrl) {
61
- // strip off any trailing query params or hashes
62
- parentUrl = parentUrl && parentUrl.split('#')[0].split('?')[0];
63
- if (relUrl.indexOf('\\') !== -1)
64
- relUrl = relUrl.replace(backslashRegEx, '/');
65
- // protocol-relative
66
- if (relUrl[0] === '/' && relUrl[1] === '/') {
67
- return parentUrl.slice(0, parentUrl.indexOf(':') + 1) + relUrl;
68
- }
69
- // relative-url
70
- else if (relUrl[0] === '.' && (relUrl[1] === '/' || relUrl[1] === '.' && (relUrl[2] === '/' || relUrl.length === 2 && (relUrl += '/')) ||
71
- relUrl.length === 1 && (relUrl += '/')) ||
72
- relUrl[0] === '/') {
73
- const parentProtocol = parentUrl.slice(0, parentUrl.indexOf(':') + 1);
74
- // Disabled, but these cases will give inconsistent results for deep backtracking
75
- //if (parentUrl[parentProtocol.length] !== '/')
76
- // throw new Error('Cannot resolve');
77
- // read pathname from parent URL
78
- // pathname taken to be part after leading "/"
79
- let pathname;
80
- if (parentUrl[parentProtocol.length + 1] === '/') {
81
- // resolving to a :// so we need to read out the auth and host
82
- if (parentProtocol !== 'file:') {
83
- pathname = parentUrl.slice(parentProtocol.length + 2);
84
- pathname = pathname.slice(pathname.indexOf('/') + 1);
85
- }
86
- else {
87
- pathname = parentUrl.slice(8);
88
- }
89
- }
90
- else {
91
- // resolving to :/ so pathname is the /... part
92
- pathname = parentUrl.slice(parentProtocol.length + (parentUrl[parentProtocol.length] === '/'));
93
- }
94
-
95
- if (relUrl[0] === '/')
96
- return parentUrl.slice(0, parentUrl.length - pathname.length - 1) + relUrl;
97
-
98
- // join together and split for removal of .. and . segments
99
- // looping the string instead of anything fancy for perf reasons
100
- // '../../../../../z' resolved to 'x/y' is just 'z'
101
- const segmented = pathname.slice(0, pathname.lastIndexOf('/') + 1) + relUrl;
102
-
103
- const output = [];
104
- let segmentIndex = -1;
105
- for (let i = 0; i < segmented.length; i++) {
106
- // busy reading a segment - only terminate on '/'
107
- if (segmentIndex !== -1) {
108
- if (segmented[i] === '/') {
109
- output.push(segmented.slice(segmentIndex, i + 1));
110
- segmentIndex = -1;
111
- }
112
- }
113
-
114
- // new segment - check if it is relative
115
- else if (segmented[i] === '.') {
116
- // ../ segment
117
- if (segmented[i + 1] === '.' && (segmented[i + 2] === '/' || i + 2 === segmented.length)) {
118
- output.pop();
119
- i += 2;
120
- }
121
- // ./ segment
122
- else if (segmented[i + 1] === '/' || i + 1 === segmented.length) {
123
- i += 1;
124
- }
125
- else {
126
- // the start of a new segment as below
127
- segmentIndex = i;
128
- }
129
- }
130
- // it is the start of a new segment
131
- else {
132
- segmentIndex = i;
133
- }
134
- }
135
- // finish reading out the last segment
136
- if (segmentIndex !== -1)
137
- output.push(segmented.slice(segmentIndex));
138
- return parentUrl.slice(0, parentUrl.length - pathname.length) + output.join('');
139
- }
140
- }
141
-
142
- /*
143
- * Import maps implementation
144
- *
145
- * To make lookups fast we pre-resolve the entire import map
146
- * and then match based on backtracked hash lookups
147
- *
148
- */
149
- function resolveUrl (relUrl, parentUrl) {
150
- return resolveIfNotPlainOrUrl(relUrl, parentUrl) || (relUrl.indexOf(':') !== -1 ? relUrl : resolveIfNotPlainOrUrl('./' + relUrl, parentUrl));
151
- }
152
-
153
- function resolveAndComposePackages (packages, outPackages, baseUrl, parentMap) {
154
- for (let p in packages) {
155
- const resolvedLhs = resolveIfNotPlainOrUrl(p, baseUrl) || p;
156
- let target = packages[p];
157
- if (typeof target !== 'string')
158
- continue;
159
- const mapped = resolveImportMap(parentMap, resolveIfNotPlainOrUrl(target, baseUrl) || target, baseUrl);
160
- if (mapped) {
161
- outPackages[resolvedLhs] = mapped;
162
- continue;
163
- }
164
- targetWarning(p, packages[p], 'bare specifier did not resolve');
165
- }
166
- }
167
-
168
- function resolveAndComposeImportMap (json, baseUrl, parentMap) {
169
- const outMap = { imports: Object.assign({}, parentMap.imports), scopes: Object.assign({}, parentMap.scopes), depcache: Object.assign({}, parentMap.depcache) };
170
-
171
- if (json.imports)
172
- resolveAndComposePackages(json.imports, outMap.imports, baseUrl, parentMap,);
173
-
174
- if (json.scopes)
175
- for (let s in json.scopes) {
176
- const resolvedScope = resolveUrl(s, baseUrl);
177
- resolveAndComposePackages(json.scopes[s], outMap.scopes[resolvedScope] || (outMap.scopes[resolvedScope] = {}), baseUrl, parentMap);
178
- }
179
-
180
- if (json.depcache)
181
- for (let d in json.depcache) {
182
- const resolvedDepcache = resolveUrl(d, baseUrl);
183
- outMap.depcache[resolvedDepcache] = json.depcache[d];
184
- }
185
-
186
- return outMap;
187
- }
188
-
189
- function getMatch (path, matchObj) {
190
- if (matchObj[path])
191
- return path;
192
- let sepIndex = path.length;
193
- do {
194
- const segment = path.slice(0, sepIndex + 1);
195
- if (segment in matchObj)
196
- return segment;
197
- } while ((sepIndex = path.lastIndexOf('/', sepIndex - 1)) !== -1)
198
- }
199
-
200
- function applyPackages (id, packages) {
201
- const pkgName = getMatch(id, packages);
202
- if (pkgName) {
203
- const pkg = packages[pkgName];
204
- if (pkg === null) return;
205
- if (id.length > pkgName.length && pkg[pkg.length - 1] !== '/')
206
- targetWarning(pkgName, pkg, "should have a trailing '/'");
207
- else
208
- return pkg + id.slice(pkgName.length);
209
- }
210
- }
211
-
212
- function targetWarning (match, target, msg) {
213
- console.warn("Package target " + msg + ", resolving target '" + target + "' for " + match);
214
- }
215
-
216
- function resolveImportMap (importMap, resolvedOrPlain, parentUrl) {
217
- let scopeUrl = parentUrl && getMatch(parentUrl, importMap.scopes);
218
- while (scopeUrl) {
219
- const packageResolution = applyPackages(resolvedOrPlain, importMap.scopes[scopeUrl]);
220
- if (packageResolution)
221
- return packageResolution;
222
- scopeUrl = getMatch(scopeUrl.slice(0, scopeUrl.lastIndexOf('/')), importMap.scopes);
223
- }
224
- return applyPackages(resolvedOrPlain, importMap.imports) || resolvedOrPlain.indexOf(':') !== -1 && resolvedOrPlain;
225
- }
226
-
227
- /* es-module-lexer 0.3.26 */
228
- const A=1===new Uint8Array(new Uint16Array([1]).buffer)[0];function parse(E,g="@"){if(!B)return init.then(()=>parse(E));const I=E.length+1,D=(B.__heap_base.value||B.__heap_base)+4*I-B.memory.buffer.byteLength;D>0&&B.memory.grow(Math.ceil(D/65536));const w=B.sa(I-1);if((A?C:Q)(E,new Uint16Array(B.memory.buffer,w,I)),!B.parse())throw Object.assign(new Error(`Parse error ${g}:${E.slice(0,B.e()).split("\n").length}:${B.e()-E.lastIndexOf("\n",B.e()-1)}`),{idx:B.e()});const L=[],k=[];for(;B.ri();)L.push({s:B.is(),e:B.ie(),ss:B.ss(),se:B.se(),d:B.id()});for(;B.re();)k.push(E.slice(B.es(),B.ee()));return [L,k,!!B.f()]}function Q(A,Q){const C=A.length;let B=0;for(;B<C;){const C=A.charCodeAt(B);Q[B++]=(255&C)<<8|C>>>8;}}function C(A,Q){const C=A.length;let B=0;for(;B<C;)Q[B]=A.charCodeAt(B++);}let B;const init=WebAssembly.compile((E="AGFzbQEAAAABWAxgAX8Bf2AEf39/fwBgAn9/AGAAAX9gAABgBn9/f39/fwF/YAR/f39/AX9gA39/fwF/YAd/f39/f39/AX9gBX9/f39/AX9gAn9/AX9gCH9/f39/f39/AX8DLy4AAQIDAwMDAwMDAwMDAwAEBAAFBAQAAAAABAQEBAQABQYHCAkKCwMCAAAKAwgLBAUBcAEBAQUDAQABBg8CfwFB8PAAC38AQfDwAAsHWg8GbWVtb3J5AgACc2EAAAFlAAMCaXMABAJpZQAFAnNzAAYCc2UABwJpZAAIAmVzAAkCZWUACgJyaQALAnJlAAwBZgANBXBhcnNlAA4LX19oZWFwX2Jhc2UDAQqjMy5oAQF/QQAgADYCtAhBACgCkAgiASAAQQF0aiIAQQA7AQBBACAAQQJqIgA2ArgIQQAgADYCvAhBAEEANgKUCEEAQQA2AqQIQQBBADYCnAhBAEEANgKYCEEAQQA2AqwIQQBBADYCoAggAQudAQECf0EAKAKkCCIEQRRqQZQIIAQbQQAoArwIIgU2AgBBACAFNgKkCEEAIAQ2AqgIQQAgBUEYajYCvAggBSAANgIIAkACQEEAKAKICCADRw0AIAUgAjYCDAwBCwJAQQAoAoQIIANHDQAgBSACQQJqNgIMDAELIAVBACgCkAg2AgwLIAVBADYCFCAFIAM2AhAgBSACNgIEIAUgATYCAAtIAQF/QQAoAqwIIgJBCGpBmAggAhtBACgCvAgiAjYCAEEAIAI2AqwIQQAgAkEMajYCvAggAkEANgIIIAIgATYCBCACIAA2AgALCABBACgCwAgLFQBBACgCnAgoAgBBACgCkAhrQQF1CxUAQQAoApwIKAIEQQAoApAIa0EBdQsVAEEAKAKcCCgCCEEAKA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Rw0EDAILIAAOBAADAwAACxAdCw8LAkACQCACDgIBAAELQQAgAEEEajYC4AgMAQsQKxoMAAsLkQEBBH9BACgC4AghAEEAKALkCCEBAkADQCAAIgJBAmohACACIAFPDQECQCAALwEAIgNB3ABGDQACQCADQXZqIgJBA00NACADQSJHDQJBACAANgLgCA8LIAIOBAIBAQICCyACQQRqIQAgAi8BBEENRw0AIAJBBmogACACLwEGQQpGGyEADAALC0EAIAA2AuAIEB0LkQEBBH9BACgC4AghAEEAKALkCCEBAkADQCAAIgJBAmohACACIAFPDQECQCAALwEAIgNB3ABGDQACQCADQXZqIgJBA00NACADQSdHDQJBACAANgLgCA8LIAIOBAIBAQICCyACQQRqIQAgAi8BBEENRw0AIAJBBmogACACLwEGQQpGGyEADAALC0EAIAA2AuAIEB0LyQEBBX9BACgC4AghAEEAKALkCCEBA0AgACICQQJqIQACQAJAIAIgAU8NACAALwEAIgNBpH9qIgRBBE0NASADQSRHDQIgAi8BBEH7AEcNAkEAQQAvAcYIIgBBAWo7AcYIQQAoAtQIIABBAXRqQQAvAcoIOwEAQQAgAkEEajYC4AhBAEEALwHICEEBaiIAOwHKCEEAIAA7AcgIDwtBACAANgLgCBAdDwsCQAJAIAQOBQECAgIAAQtBACAANgLgCA8LIAJBBGohAAwACws1AQF/QQBBAToAsAhBACgC4AghAEEAQQAoAuQIQQJqNgLgCEEAIABBACgCkAhrQQF1NgLACAs0AQF/QQEhAQJAIABBd2pB//8DcUEFSQ0AIABBgAFyQaABRg0AIABBLkcgABAocSEBCyABC0kBA39BACEGAkAgAEF4aiIHQQAoApAIIghJDQAgByABIAIgAyAEIAUQEkUNAAJAIAcgCEcNAEEBDwsgAEF2ai8BABAeIQYLIAYLWQEDf0EAIQQCQCAAQXxqIgVBACgCkAgiBkkNACAALwEAIANHDQAgAEF+ai8BACACRw0AIAUvAQAgAUcNAAJAIAUgBkcNAEEBDwsgAEF6ai8BABAeIQQLIAQLTAEDf0EAIQMCQCAAQX5qIgRBACgCkAgiB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BGo2AuAIECYhAkEAKALgCCEAIAIQKRpBACgC4AghARAmIQNBACgC4AghAgsCQCACIABGDQAgACABEAILIAMLiQEBBX9BACgC4AghAEEAKALkCCEBA38gAEECaiECAkACQCAAIAFPDQAgAi8BACIDQaR/aiIEQQFNDQEgAiEAIANBdmoiA0EDSw0CIAIhACADDgQAAgIAAAtBACACNgLgCBAdQQAPCwJAAkAgBA4CAQABC0EAIAI2AuAIQd0ADwsgAEEEaiEADAALC0kBAX9BACEHAkAgAC8BCiAGRw0AIAAvAQggBUcNACAALwEGIARHDQAgAC8BBCADRw0AIAAvAQIgAkcNACAALwEAIAFGIQcLIAcLUwEBf0EAIQgCQCAALwEMIAdHDQAgAC8BCiAGRw0AIAAvAQggBUcNACAALwEGIARHDQAgAC8BBCADRw0AIAAvAQIgAkcNACAALwEAIAFGIQgLIAgLCx8CAEGACAsCAAAAQYQICxABAAAAAgAAAAAEAABwOAAA","function"==typeof atob?Uint8Array.from(atob(E),A=>A.charCodeAt(0)):Buffer.from(E,"base64"))).then(WebAssembly.instantiate).then(({exports:A})=>{B=A;});var E;
229
-
230
- let id = 0;
231
- const registry = {};
232
-
233
- async function loadAll (load, seen) {
234
- if (load.b || seen[load.u])
235
- return;
236
- seen[load.u] = 1;
237
- await load.L;
238
- return Promise.all(load.d.map(dep => loadAll(dep, seen)));
239
- }
240
-
241
- let waitingForImportMapsInterval;
242
- let firstTopLevelProcess = true;
243
- async function topLevelLoad (url, source) {
244
- if (waitingForImportMapsInterval > 0) {
245
- clearTimeout(waitingForImportMapsInterval);
246
- waitingForImportMapsInterval = 0;
247
- }
248
- if (firstTopLevelProcess) {
249
- firstTopLevelProcess = false;
250
- processScripts();
251
- }
252
- await importMapPromise;
253
- await init;
254
- const load = getOrCreateLoad(url, source);
255
- const seen = {};
256
- await loadAll(load, seen);
257
- lastLoad = undefined;
258
- resolveDeps(load, seen);
259
- const module = await dynamicImport(load.b);
260
- // if the top-level load is a shell, run its update function
261
- if (load.s)
262
- (await dynamicImport(load.s)).u$_(module);
263
- return module;
264
- }
265
-
266
- async function importShim$1 (id, parentUrl) {
267
- return topLevelLoad(resolve(id, parentUrl || baseUrl));
268
- }
269
-
270
- self.importShim = importShim$1;
271
-
272
- const meta = {};
273
-
274
- const edge = navigator.userAgent.match(/Edge\/\d\d\.\d+$/);
275
-
276
- async function importMetaResolve (id, parentUrl = this.url) {
277
- await importMapPromise;
278
- return resolve(id, `${parentUrl}`);
279
- }
280
-
281
- Object.defineProperties(importShim$1, {
282
- m: { value: meta },
283
- l: { value: undefined, writable: true },
284
- e: { value: undefined, writable: true }
285
- });
286
- importShim$1.fetch = url => fetch(url);
287
- importShim$1.skip = /^https?:\/\/(cdn\.pika\.dev|dev\.jspm\.io|jspm\.dev)\//;
288
- importShim$1.load = processScripts;
289
- importShim$1.onerror = (e) => {
290
- throw e;
291
- };
292
-
293
- let lastLoad;
294
- function resolveDeps (load, seen) {
295
- if (load.b || !seen[load.u])
296
- return;
297
- seen[load.u] = 0;
298
-
299
- for (const dep of load.d)
300
- resolveDeps(dep, seen);
301
-
302
- // "execution"
303
- const source = load.S;
304
- // edge doesnt execute sibling in order, so we fix this up by ensuring all previous executions are explicit dependencies
305
- let resolvedSource = edge && lastLoad ? `import '${lastLoad}';` : '';
306
-
307
- const [imports] = load.a;
308
-
309
- if (!imports.length) {
310
- resolvedSource += source;
311
- }
312
- else {
313
- // once all deps have loaded we can inline the dependency resolution blobs
314
- // and define this blob
315
- let lastIndex = 0, depIndex = 0;
316
- for (const { s: start, e: end, d: dynamicImportIndex } of imports) {
317
- // dependency source replacements
318
- if (dynamicImportIndex === -1) {
319
- const depLoad = load.d[depIndex++];
320
- let blobUrl = depLoad.b;
321
- if (!blobUrl) {
322
- // circular shell creation
323
- if (!(blobUrl = depLoad.s)) {
324
- blobUrl = depLoad.s = createBlob(`export function u$_(m){${
325
- depLoad.a[1].map(
326
- name => name === 'default' ? `$_default=m.default` : `${name}=m.${name}`
327
- ).join(',')
328
- }}${
329
- depLoad.a[1].map(name =>
330
- name === 'default' ? `let $_default;export{$_default as default}` : `export let ${name}`
331
- ).join(';')
332
- }\n//# sourceURL=${depLoad.r}?cycle`);
333
- }
334
- }
335
- // circular shell execution
336
- else if (depLoad.s) {
337
- resolvedSource += source.slice(lastIndex, start - 1) + '/*' + source.slice(start - 1, end + 1) + '*/' + source.slice(start - 1, start) + blobUrl + source[end] + `;import*as m$_${depIndex} from'${depLoad.b}';import{u$_ as u$_${depIndex}}from'${depLoad.s}';u$_${depIndex}(m$_${depIndex})`;
338
- lastIndex = end + 1;
339
- depLoad.s = undefined;
340
- continue;
341
- }
342
- resolvedSource += source.slice(lastIndex, start - 1) + '/*' + source.slice(start - 1, end + 1) + '*/' + source.slice(start - 1, start) + blobUrl;
343
- lastIndex = end;
344
- }
345
- // import.meta
346
- else if (dynamicImportIndex === -2) {
347
- meta[load.r] = { url: load.r, resolve: importMetaResolve };
348
- resolvedSource += source.slice(lastIndex, start) + 'importShim.m[' + JSON.stringify(load.r) + ']';
349
- lastIndex = end;
350
- }
351
- // dynamic import
352
- else {
353
- resolvedSource += source.slice(lastIndex, dynamicImportIndex + 6) + 'Shim(' + source.slice(start, end) + ', ' + JSON.stringify(load.r);
354
- lastIndex = end;
355
- }
356
- }
357
-
358
- resolvedSource += source.slice(lastIndex);
359
- }
360
-
361
- let sourceMappingResolved = '';
362
- const sourceMappingIndex = resolvedSource.lastIndexOf('//# sourceMappingURL=');
363
- if (sourceMappingIndex > -1) {
364
- const sourceMappingEnd = resolvedSource.indexOf('\n',sourceMappingIndex);
365
- const sourceMapping = resolvedSource.slice(sourceMappingIndex, sourceMappingEnd > -1 ? sourceMappingEnd : undefined);
366
- sourceMappingResolved = `\n//# sourceMappingURL=` + resolveUrl(sourceMapping.slice(21), load.r);
367
- }
368
- load.b = lastLoad = createBlob(resolvedSource + sourceMappingResolved + '\n//# sourceURL=' + load.r);
369
- load.S = undefined;
370
- }
371
-
372
- function getOrCreateLoad (url, source) {
373
- let load = registry[url];
374
- if (load)
375
- return load;
376
-
377
- load = registry[url] = {
378
- // url
379
- u: url,
380
- // response url
381
- r: undefined,
382
- // fetchPromise
383
- f: undefined,
384
- // source
385
- S: undefined,
386
- // linkPromise
387
- L: undefined,
388
- // analysis
389
- a: undefined,
390
- // deps
391
- d: undefined,
392
- // blobUrl
393
- b: undefined,
394
- // shellUrl
395
- s: undefined,
396
- };
397
-
398
- const depcache = importMap.depcache[url];
399
- if (depcache)
400
- depcache.forEach(depUrl => getOrCreateLoad(resolve(depUrl, url)));
401
-
402
- load.f = (async () => {
403
- if (!source) {
404
- const res = await importShim$1.fetch(url);
405
- if (!res.ok)
406
- throw new Error(`${res.status} ${res.statusText} ${res.url}`);
407
- load.r = res.url;
408
- const contentType = res.headers.get('content-type');
409
- if (contentType.match(/^(text|application)\/(x-)?javascript(;|$)/))
410
- source = await res.text();
411
- else
412
- throw new Error(`Unknown Content-Type "${contentType}"`);
413
- }
414
- try {
415
- load.a = parse(source, load.u);
416
- }
417
- catch (e) {
418
- console.warn(e);
419
- load.a = [[], []];
420
- }
421
- load.S = source;
422
- return load.a[0].filter(d => d.d === -1).map(d => source.slice(d.s, d.e));
423
- })();
424
-
425
- load.L = load.f.then(async deps => {
426
- load.d = await Promise.all(deps.map(async depId => {
427
- const resolved = resolve(depId, load.r || load.u);
428
- if (importShim$1.skip.test(resolved))
429
- return { b: resolved };
430
- const depLoad = getOrCreateLoad(resolved);
431
- await depLoad.f;
432
- return depLoad;
433
- }));
434
- });
435
-
436
- return load;
437
- }
438
-
439
- let importMap = { imports: {}, scopes: {}, depcache: {} };
440
- let importMapPromise = resolvedPromise;
441
-
442
- if (hasDocument) {
443
- processScripts();
444
- waitingForImportMapsInterval = setInterval(processScripts, 20);
445
- }
446
-
447
- async function processScripts () {
448
- if (waitingForImportMapsInterval > 0 && document.readyState !== 'loading') {
449
- clearTimeout(waitingForImportMapsInterval);
450
- waitingForImportMapsInterval = 0;
451
- }
452
- for (const script of document.querySelectorAll('script[type="module-shim"],script[type="importmap-shim"]')) {
453
- if (script.ep) // ep marker = script processed
454
- return;
455
- if (script.type === 'module-shim') {
456
- await topLevelLoad(script.src || `${baseUrl}?${id++}`, !script.src && script.innerHTML).catch(e => importShim$1.onerror(e));
457
- }
458
- else {
459
- importMapPromise = importMapPromise.then(async () =>
460
- importMap = resolveAndComposeImportMap(script.src ? await (await fetch(script.src)).json() : JSON.parse(script.innerHTML), script.src || baseUrl, importMap)
461
- );
462
- }
463
- script.ep = true;
464
- }
465
- }
466
-
467
- function resolve (id, parentUrl) {
468
- return resolveImportMap(importMap, resolveIfNotPlainOrUrl(id, parentUrl) || id, parentUrl) || throwUnresolved(id, parentUrl);
469
- }
470
-
471
- function throwUnresolved (id, parentUrl) {
472
- throw Error("Unable to resolve specifier '" + id + (parentUrl ? "' from " + parentUrl : "'"));
473
- }
474
-
475
- }());
@@ -1,2 +0,0 @@
1
- //= link_directory ./libraries
2
- //= link_directory ./loaders
@@ -1,10 +0,0 @@
1
- module Stimulus::StimulusHelper
2
- def stimulus_include_tags(importmap = "importmap.json")
3
- safe_join [
4
- javascript_include_tag("stimulus/libraries/es-module-shims", type: "module"),
5
- tag.script(type: "importmap-shim", src: asset_path(importmap)),
6
- javascript_include_tag("stimulus/libraries/stimulus", type: "module-shim"),
7
- javascript_include_tag("stimulus/loaders/autoloader", type: "module-shim")
8
- ], "\n"
9
- end
10
- end
@@ -1,5 +0,0 @@
1
- {
2
- "imports": {
3
- <%= importmap_list_with_stimulus_from "app/assets/javascripts/controllers", "app/assets/javascripts/libraries" %>
4
- }
5
- }
@@ -1 +0,0 @@
1
- import "controllers"
@@ -1,33 +0,0 @@
1
- module Stimulus::ImportmapHelper
2
- def importmap_list_with_stimulus_from(*paths)
3
- [ %("stimulus": "#{asset_path("stimulus/libraries/stimulus")}"), importmap_list_from(*paths) ].reject(&:blank?).join(",\n")
4
- end
5
-
6
- def importmap_list_from(*paths)
7
- Array(paths).flat_map do |path|
8
- if (absolute_path = absolute_root_of(path)).exist?
9
- find_javascript_files_in_tree(absolute_path).collect do |filename|
10
- module_filename = filename.relative_path_from(absolute_path)
11
- module_name = importmap_module_name_from(module_filename)
12
- module_path = asset_path(absolute_path.basename.join(module_filename))
13
-
14
- %("#{module_name}": "#{module_path}")
15
- end
16
- end
17
- end.compact.join(",\n")
18
- end
19
-
20
- private
21
- # Strip off the extension and any versioning data for an absolute module name.
22
- def importmap_module_name_from(filename)
23
- filename.to_s.remove(filename.extname).split("@").first
24
- end
25
-
26
- def find_javascript_files_in_tree(path)
27
- Dir[path.join("**/*.js{,m}")].collect { |file| Pathname.new(file) }.select(&:file?)
28
- end
29
-
30
- def absolute_root_of(path)
31
- (pathname = Pathname.new(path)).absolute? ? pathname : Rails.root.join(path)
32
- end
33
- end