isomorfeus-preact 10.6.34 → 10.6.35

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: 94d90b7804579f6dd573ec4878ad1d0f4579a7541eefb6b8a7874ca115b36951
4
- data.tar.gz: 835a4f9d89c1f0cdd2bc3e7f909481ed182fb4cbd8d5aaf545744280645c16aa
3
+ metadata.gz: 06de7c22eb8524e87e402efb9580b29571de8605c2277e7055e2e60d2f64b901
4
+ data.tar.gz: 29c9ee7246ef0a4e0a15433990ff00dd0e5295c6f1ed7a4d10ef7d0dc33f84c9
5
5
  SHA512:
6
- metadata.gz: 2ec9097e4dfae922a7d665831a90ded698c549f1ac1cbde91912bce844b7124c7de6a4eaaade509624e4a44e56f265fe0c1625daec89375313a91f8d2cae9a29
7
- data.tar.gz: b4219dd2ad74032549c276a29d4388058175ea4baf161dfee8c2f5ad7d4181314895289917b2db4e898375130940ab8fd6a244b062c153891cb4586d8c548cb8
6
+ metadata.gz: 25c7696c2f613a637a452ea4ccb4e3c471de1a2f471f79de667a47a6fb5c26c419124e25b145a3214327866f02819bbdb940d341e7bce60e3399a36edcb6a7af
7
+ data.tar.gz: 0a4e8945291167adf81552877fc01aa41b41d7aeb639f1a17be3822cc6b43e9a39a07a0b001311d456ba4dfbfbb5f7f4a59fc498ac2fbf5d8505ee37bafbf106
@@ -86,13 +86,13 @@ module Isomorfeus
86
86
  JAVASCRIPT
87
87
  # execute first render pass
88
88
  begin
89
- pass += 1
90
89
  first_pass_skipped = Isomorfeus.ssr_contexts[thread_id_asset].exec(javascript)
91
90
  rescue Exception => e
92
91
  Isomorfeus.raise_error(error: e)
93
92
  end
94
93
  # wait for first pass to finish
95
94
  unless first_pass_skipped
95
+ pass += 1
96
96
  first_pass_finished, exception = Isomorfeus.ssr_contexts[thread_id_asset].exec('return [global.FirstPassFinished, global.Exception ? { message: global.Exception.message, stack: global.Exception.stack } : false ]')
97
97
  Isomorfeus.raise_error(message: "Server Side Rendering: #{exception['message']}", stack: exception['stack']) if exception
98
98
  unless first_pass_finished
@@ -132,24 +132,24 @@ module Isomorfeus
132
132
  global.Exception = e;
133
133
  }
134
134
  let application_state = global.Opal.Isomorfeus.store.native.getState();
135
- let transport_busy = false;
136
- if (typeof global.Opal.Isomorfeus.Transport !== 'undefined' && global.Opal.Isomorfeus.Transport["$busy?"]()) { transport_busy = true; }
135
+ let still_busy = (#{pass}<2) ? global.Opal.Isomorfeus.store['$recently_dispatched?']() : false;
136
+ if (typeof global.Opal.Isomorfeus.Transport !== 'undefined' && global.Opal.Isomorfeus.Transport["$busy?"]()) { still_busy = true; }
137
137
  if (typeof global.NanoCSSInstance !== 'undefined') { ssr_styles = global.NanoCSSInstance.raw }
138
- return [rendered_tree, application_state, ssr_styles, global.Opal.Isomorfeus['$ssr_response_status'](), transport_busy, global.Exception ? { message: global.Exception.message, stack: global.Exception.stack } : false];
138
+ return [rendered_tree, application_state, ssr_styles, global.Opal.Isomorfeus['$ssr_response_status'](), still_busy, global.Exception ? { message: global.Exception.message, stack: global.Exception.stack } : false];
139
139
  JAVASCRIPT
140
140
  # execute further render passes
141
141
  pass += 1
142
- rendered_tree, application_state, @ssr_styles, @ssr_response_status, transport_busy, exception = Isomorfeus.ssr_contexts[thread_id_asset].exec(javascript)
142
+ rendered_tree, application_state, @ssr_styles, @ssr_response_status, still_busy, exception = Isomorfeus.ssr_contexts[thread_id_asset].exec(javascript)
143
143
  start_time = Time.now
144
- while transport_busy
144
+ while still_busy
145
145
  break if (Time.now - start_time) > 5
146
- while transport_busy
146
+ while still_busy
147
147
  break if (Time.now - start_time) > 4
148
148
  sleep 0.01
149
- transport_busy = Isomorfeus.ssr_contexts[thread_id_asset].exec('return global.Opal.Isomorfeus.Transport["$busy?"]()')
149
+ still_busy = Isomorfeus.ssr_contexts[thread_id_asset].exec('return (typeof global.Opal.Isomorfeus.Transport !== "undefined") ? global.Opal.Isomorfeus.Transport["$busy?"]() : false')
150
150
  end
151
151
  pass += 1
152
- rendered_tree, application_state, @ssr_styles, @ssr_response_status, transport_busy, exception = Isomorfeus.ssr_contexts[thread_id_asset].exec(javascript)
152
+ rendered_tree, application_state, @ssr_styles, @ssr_response_status, still_busy, exception = Isomorfeus.ssr_contexts[thread_id_asset].exec(javascript)
153
153
  break if pass >= max_passes
154
154
  end
155
155
  javascript = <<~JAVASCRIPT
@@ -4,7 +4,6 @@ module LucidComponent::Api
4
4
  # stores
5
5
  attr_accessor :app_store
6
6
  attr_accessor :class_store
7
- attr_accessor :store
8
7
 
9
8
  def class_store
10
9
  @class_store ||= ::LucidComponent::ClassStoreProxy.new(self.to_s)
@@ -3,7 +3,6 @@ module LucidComponent::Initializer
3
3
  @native = native_component
4
4
  @app_store = LucidComponent::AppStoreProxy.new(self)
5
5
  @class_store = LucidComponent::ClassStoreProxy.new(self.class.to_s, self, @native)
6
- @store = LucidComponent::InstanceStoreProxy.new(self)
7
6
  @props = `Opal.Preact.Props.$new(#@native)`
8
7
  @state = `Opal.Preact.State.$new(#@native)`
9
8
  end
@@ -4,6 +4,5 @@ module LucidFunc::Initializer
4
4
  @native_props = `Opal.Preact.Props.$new(#{self})`
5
5
  @app_store = LucidComponent::AppStoreProxy.new(self)
6
6
  @class_store = LucidComponent::ClassStoreProxy.new(self.class.to_s, self, self)
7
- @store = LucidComponent::InstanceStoreProxy.new(self)
8
7
  end
9
8
  end
@@ -5,7 +5,7 @@ module LucidApp
5
5
  css_server = `null`
6
6
  css_server = `document.getElementById('css-server-side')` unless on_ssr?
7
7
  %x{
8
- n = Opal.NanoCSS;
8
+ let n = Opal.NanoCSS;
9
9
  nano_css = (css_server) ? n.create({ sh: css_server }) : n.create();
10
10
  n.rule(nano_css);
11
11
  n.sheet(nano_css);
data/lib/nano_css.rb CHANGED
@@ -1,22 +1,22 @@
1
1
  module NanoCSS
2
2
  %x{
3
3
  var KEBAB_REGEX = /[A-Z]/g;
4
+ var on_browser = #{on_browser?};
5
+ var in_dev = #{Isomorfeus.development?};
4
6
 
5
7
  function hash(str) {
6
8
  var h = 5381, i = str.length;
7
9
  while (i) h = (h * 33) ^ str.charCodeAt(--i);
8
10
  return '_' + (h >>> 0).toString(36);
9
11
  };
10
- }
11
12
 
12
- %x{
13
13
  self.create = function (config) {
14
14
  config = config || {};
15
15
  var assign = config.assign || Object.assign;
16
16
  var client = typeof window === 'object';
17
17
 
18
18
  // Check if we are really in browser environment.
19
- if (process.env.NODE_ENV !== 'production') {
19
+ if (on_browser && in_dev) {
20
20
  if (client) {
21
21
  if ((typeof document !== 'object') || !document.getElementsByTagName('HTML')) {
22
22
  console.error('nano-css detected browser environment because of "window" global, but "document" global seems to be defective.');
@@ -47,7 +47,7 @@ module NanoCSS
47
47
  if (renderer.client) {
48
48
  if (!renderer.sh) { document.head.appendChild(renderer.sh = document.createElement('style')); }
49
49
 
50
- if (process.env.NODE_ENV !== 'production') {
50
+ if (in_dev) {
51
51
  renderer.sh.setAttribute('data-nano-css-dev', '');
52
52
 
53
53
  // Test style sheet used in DEV mode to test if .insetRule() would throw.
@@ -60,7 +60,7 @@ module NanoCSS
60
60
  // .insertRule() is faster than .appendChild(), that's why we use it in PROD.
61
61
  // But CSS injected using .insertRule() is not displayed in Chrome Devtools
62
62
  var sheet = renderer.sh.sheet;
63
- if (process.env.NODE_ENV === 'production') {
63
+ if (!in_dev) {
64
64
  // Unknown pseudo-selectors will throw, this try/catch swallows all errors.
65
65
  try { sheet.insertRule(rawCssRule, sheet.cssRules.length); }
66
66
  catch (error) {}
@@ -91,7 +91,7 @@ module NanoCSS
91
91
  if ((value instanceof Object) && !(value instanceof Array)) {
92
92
  postponed.push(prop);
93
93
  } else {
94
- if ((process.env.NODE_ENV !== 'production') && !renderer.sourcemaps) {
94
+ if (in_dev && !renderer.sourcemaps) {
95
95
  str += ' ' + renderer.decl(prop, value, selector, atrule) + '\n';
96
96
  } else {
97
97
  str += renderer.decl(prop, value, selector, atrule);
@@ -100,7 +100,7 @@ module NanoCSS
100
100
  }
101
101
 
102
102
  if (str) {
103
- if ((process.env.NODE_ENV !== 'production') && !renderer.sourcemaps) {
103
+ if (in_dev && !renderer.sourcemaps) {
104
104
  str = '\n' + selector + ' {\n' + str + '}\n';
105
105
  } else {
106
106
  str = selector + '{' + str + '}';
@@ -129,7 +129,7 @@ module NanoCSS
129
129
 
130
130
  %x{
131
131
  self.rule = function (renderer) {
132
- if (process.env.NODE_ENV !== 'production') {
132
+ if (in_dev) {
133
133
  renderer.rule_blocks = {};
134
134
  }
135
135
 
@@ -142,7 +142,7 @@ module NanoCSS
142
142
 
143
143
  renderer.rule = function (css, block) {
144
144
  // Warn user if CSS selectors clash.
145
- if (process.env.NODE_ENV !== 'production') {
145
+ if (in_dev) {
146
146
  if (block) {
147
147
  if (typeof block !== 'string') {
148
148
  throw new TypeError(
@@ -194,7 +194,7 @@ module NanoCSS
194
194
  var onElementModifier = function (elementModifier) {
195
195
  var styles = map[elementModifier];
196
196
 
197
- if ((process.env.NODE_ENV !== 'production') && renderer.sourcemaps) {
197
+ if (in_dev && renderer.sourcemaps) {
198
198
  // In dev mode emit CSS immediately to generate sourcemaps.
199
199
  result[elementModifier] = renderer.rule(styles, block + '-' + elementModifier);
200
200
  } else {
@@ -1,3 +1,3 @@
1
1
  module Preact
2
- VERSION = '10.6.34'
2
+ VERSION = '10.6.35'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isomorfeus-preact
3
3
  version: !ruby/object:Gem::Version
4
- version: 10.6.34
4
+ version: 10.6.35
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Biedermann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-14 00:00:00.000000000 Z
11
+ date: 2022-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 4.1.15
103
+ version: 4.1.16
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 4.1.15
110
+ version: 4.1.16
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: isomorfeus-speednode
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -242,7 +242,6 @@ files:
242
242
  - lib/isomorfeus_preact/lucid_component/base.rb
243
243
  - lib/isomorfeus_preact/lucid_component/class_store_proxy.rb
244
244
  - lib/isomorfeus_preact/lucid_component/initializer.rb
245
- - lib/isomorfeus_preact/lucid_component/instance_store_proxy.rb
246
245
  - lib/isomorfeus_preact/lucid_component/mixin.rb
247
246
  - lib/isomorfeus_preact/lucid_component/native_component_constructor.rb
248
247
  - lib/isomorfeus_preact/lucid_component/styles_wrapper.rb
@@ -1,44 +0,0 @@
1
- module LucidComponent
2
- class InstanceStoreProxy
3
- def initialize(component_instance)
4
- @native = component_instance.to_n
5
- @component_instance = component_instance
6
- @component_object_id = component_instance.object_id.to_s
7
- end
8
-
9
- def [](key)
10
- method_missing(key)
11
- end
12
-
13
- def []=(key, value)
14
- method_missing(key, value)
15
- end
16
-
17
- def method_missing(key, *args, &block)
18
- if `args.length > 0`
19
- # set instance state, simply a dispatch
20
-
21
- action = { type: 'INSTANCE_STATE', object_id: @component_object_id, name: (`key.endsWith('=')` ? key.chop : key), value: args[0] }
22
- Isomorfeus.store.collect_and_defer_dispatch(action)
23
-
24
- else
25
- # get instance state
26
- if @native.JS[:props].JS[:iso_store]
27
- if @native.JS[:props].JS[:iso_store].JS[:instance_state] &&
28
- @native.JS[:props].JS[:iso_store].JS[:instance_state].JS[@component_object_id] &&
29
- @native.JS[:props].JS[:iso_store].JS[:instance_state].JS[@component_object_id].JS.hasOwnProperty(key)
30
- # check if we have a component local state value
31
- return @native.JS[:props].JS[:iso_store].JS[:instance_state].JS[@component_object_id].JS[key]
32
- end
33
- else
34
- a_state = Isomorfeus.store.get_state
35
- if a_state.key?(:instance_state) && a_state[:instance_state].key?(key)
36
- return a_state[:instance_state][key]
37
- end
38
- end
39
- # otherwise return nil
40
- return nil
41
- end
42
- end
43
- end
44
- end