proscenium 0.11.0.pre.10-x86_64-darwin → 0.11.0.pre.11-x86_64-darwin

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: 2830fab8a04207b16ce26439994e8cb5ae6882a2f78e90f49faca58f1c3db2b4
4
- data.tar.gz: 87549366f8decdda2fdcb5e63461fac3cff46e75fa4f1bc00661cf5d24b4552c
3
+ metadata.gz: bbaa1085da775617ff05dd56b98b9596a269ce6dbdcbf2022298b805ba60d9d1
4
+ data.tar.gz: 12cba17bddc0b42ef9e9352a816711ab4dca1ee8b2c1090c95774aaf32772c1f
5
5
  SHA512:
6
- metadata.gz: f134a7364fdb029e1c5f2195934ee57fd2111eefd0d3dcebd84651ce593be69d40ca50a3feca9104a3540947eadf6648160c19bb0976e1d68847fd5e91d43a76
7
- data.tar.gz: fef4d6c37eefac4acc926793abb61ffff76936056ef8c9b619107b13034440900dceb5454bf59824886b5ee7988bfc2820d59023940f968d1cfb557699ad1a09
6
+ metadata.gz: c8f0ca2517304db1a98e07f86b6f170de1a798e73044914974dc9997b8ef9475f71926466ed40f035b02bafba2b35206dcbefb66573c82def82e6c36ffb9a8e1
7
+ data.tar.gz: 5c575c1788cd624ed78d358e4d5a01158a532f6e16676d86fa267aadd7eb6300684f6a9cbf9038e43dd849af81de6b0459c533323def4cd9cdbc3a354c457bad
Binary file
@@ -77,10 +77,14 @@ module Proscenium
77
77
 
78
78
  if extract_lazy_scripts
79
79
  content_for :proscenium_lazy_scripts do
80
- javascript_tag "window.prosceniumLazyScripts = #{scripts.to_json}"
80
+ tag.script type: 'application/json', id: 'prosceniumLazyScripts' do
81
+ raw scripts.to_json
82
+ end
81
83
  end
82
84
  else
83
- out << javascript_tag("window.prosceniumLazyScripts = #{scripts.to_json}")
85
+ out << tag.script(type: 'application/json', id: 'prosceniumLazyScripts') do
86
+ raw scripts.to_json
87
+ end
84
88
  end
85
89
  else
86
90
  Importer.each_javascript(delete: true) do |path, _|
@@ -1,7 +1,16 @@
1
- const elements = document.querySelectorAll("[data-proscenium-component-path]");
1
+ window.Proscenium = window.Proscenium || { lazyScripts: {} };
2
+
3
+ const element = document.querySelector("#prosceniumLazyScripts");
4
+ if (element) {
5
+ const scripts = JSON.parse(element.text);
6
+ window.Proscenium.lazyScripts = {
7
+ ...window.Proscenium.lazyScripts,
8
+ ...scripts,
9
+ };
10
+ }
2
11
 
3
- // Initialize only if there are components.
4
- elements.length > 0 && init();
12
+ const elements = document.querySelectorAll("[data-proscenium-component-path]");
13
+ elements.length > 0 && init(elements);
5
14
 
6
15
  function init() {
7
16
  /**
@@ -20,12 +29,12 @@ function init() {
20
29
  // For testing and simulation of slow connections.
21
30
  // const sim = new Promise((resolve) => setTimeout(resolve, 5000));
22
31
 
23
- if (!(path in window.prosceniumLazyScripts)) {
24
- throw `[proscenium/react/manager] Cannot load component ${path} (not found in prosceniumLazyScripts)`;
32
+ if (!window.Proscenium.lazyScripts[path]) {
33
+ throw `[proscenium/react/manager] Cannot load component ${path} (not found in Proscenium.lazyScripts)`;
25
34
  }
26
35
 
27
36
  const react = import("@proscenium/react-manager/react");
28
- const Component = import(window.prosceniumLazyScripts[path].outpath);
37
+ const Component = import(window.Proscenium.lazyScripts[path].outpath);
29
38
 
30
39
  const forwardChildren =
31
40
  "prosceniumComponentForwardChildren" in element.dataset &&
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Proscenium
4
- VERSION = '0.11.0.pre.10'
4
+ VERSION = '0.11.0.pre.11'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: proscenium
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0.pre.10
4
+ version: 0.11.0.pre.11
5
5
  platform: x86_64-darwin
6
6
  authors:
7
7
  - Joel Moss
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-05 00:00:00.000000000 Z
11
+ date: 2023-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport