isomorfeus-preact 23.7.0.rc4 → 23.8.0.rc1

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: 2a716fa5db31975a9ad530fd668fa4f44e429411b2cdf64ff38a3ba087004a2d
4
- data.tar.gz: 531dd5efc835cd3945c585cfce5c06ed1763344d36c4de489befc23e69af95b5
3
+ metadata.gz: 9e74d06838d043bfc0eafeb88a07433d80e1245239a4858f8e9d57642ce01f59
4
+ data.tar.gz: 1e2077fcc0c0b11eee19b3608495f8e13434537f0e2abda87e083f02d078c082
5
5
  SHA512:
6
- metadata.gz: b45462a5083ae7d2f7ee7ec853b48e921bd97d6cc6a436d03ab383c291790054e80dcfddbe2a6f37d2923f7ed6d4ae8d560ca8f94b5b3f41c26799505cba5862
7
- data.tar.gz: f74e88b8369067509ac1b0588251e0575563f7079c244ff84d47f6df6d79d0499a159cbac5ac5c28356e3cb6cce78cd4852bd176d7440b5ec2f4fe1bfcc15c1d
6
+ metadata.gz: 211616b07ca29aa226410a423a92ce060e00e9de37a0cd477efc00e0605cb4fec90bb7590b74746da93221ede19a8a67d6c6ac74403ebaab4667e73a5011804b
7
+ data.tar.gz: b7be734796c82c9b0cd85dbd454137b0410643576e26dd88c39264e19e355c0a0e2806ffb125eba5f1f6899d4218dd4cb110dc468fe8a15feb9244eff8183f90
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  module Browser
2
4
  module DelegateNative
3
5
  # Provides a default initializer. This should be overridden in all but the
@@ -57,7 +59,7 @@ module Browser
57
59
  end
58
60
 
59
61
  def respond_to_missing? message, include_all
60
- return true if message.end_with? '='
62
+ message = message.chop if message.end_with? '='
61
63
  property_name = property_for_message(message)
62
64
  return true if `#{property_name} in #@native`
63
65
  false
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  module Browser
2
4
  module Document
3
5
  extend DelegateNative
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  module Browser
2
4
  class Element
3
5
  element :canvas do
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  module Browser
2
4
  class Element
3
5
  element :video, :audio do
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  module Browser
2
4
  autoload :FileList, 'browser/file_list'
3
5
 
data/lib/browser/event.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  module Browser
2
4
  # Wrapper for JS events
3
5
  class Event
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  module Browser
2
4
  module EventTarget
3
5
  # Add the block as a handler for the specified event name. Will use either
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  module Browser
2
4
  class FileList
3
5
  include Enumerable
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  module Browser
2
4
  class History
3
5
  if RUBY_ENGINE == 'opal'
@@ -11,11 +13,11 @@ module Browser
11
13
  alias :size :length
12
14
 
13
15
  def push_state(state, title = '', url = `null`)
14
- `#@native.pushState(#{state.to_n}, #{title}, #{url})`
16
+ `#@native.pushState(Object.fromEntries(#{state}), #{title}, #{url})`
15
17
  end
16
18
 
17
19
  def replace_state(state, title = '', url = `null`)
18
- `#@native.replaceState(#{state.to_n}, #{title}, #{url})`
20
+ `#@native.replaceState(Object.fromEntries(#{state}), #{title}, #{url})`
19
21
  end
20
22
 
21
23
  def scroll_restoration
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  module Browser
2
4
  module Window
3
5
  extend DelegateNative
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  module Isomorfeus
2
4
  if RUBY_ENGINE == 'opal'
3
5
  class << self
@@ -1,5 +1,5 @@
1
1
  module Isomorfeus
2
2
  module Preact
3
- VERSION = '23.7.0.rc4'
3
+ VERSION = '23.8.0.rc1'
4
4
  end
5
5
  end
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  module Isomorfeus
2
4
  class TopLevel
3
5
  class << self
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  require 'base64'
2
4
  require 'stringio'
3
5
  if RUBY_ENGINE == 'opal'
data/lib/link.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  class Link < Preact::Component
2
4
  EVENT_PUSH_STATE = "pushState"
3
5
  EVENT_REPLACE_STATE = "replaceState"
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  class LucidComponent < Preact::Component
2
4
  include LucidI18nMixin
3
5
 
data/lib/nano_css.rb CHANGED
@@ -1,12 +1,14 @@
1
+ # backtick_javascript: true
2
+
1
3
  class NanoCSS
2
- KEBAB_REGEX = /[A-Z]/
4
+ KEBAB_REGEX = /[A-Z]/.freeze
3
5
  UNITLESS_NUMBER_PROPS = %w[animation-iteration-count border-image-outset border-image-slice
4
6
  border-image-width box-flex box-flex-group box-ordinal-group column-count columns flex
5
7
  flex-grow flex-positive flex-shrink flex-negative flex-order grid-row grid-row-end
6
8
  grid-row-span grid-row-start grid-column grid-column-end grid-column-span grid-column-start
7
9
  font-weight line-clamp line-height opacity order orphans tabSize widows z-index zoom
8
10
  fill-opacity flood-opacity stop-opacity stroke-dasharray stroke-dashoffset stroke-miterlimit
9
- stroke-opacity stroke-width] # from fill-opacity onwards is for SVG
11
+ stroke-opacity stroke-width].freeze # from fill-opacity onwards is for SVG
10
12
 
11
13
  class << self
12
14
  if RUBY_ENGINE == 'opal'
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  module Preact
2
4
  class Component
3
5
  extend Preact::PropDeclarationMixin
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  module Preact::ComponentResolution
2
4
  if RUBY_ENGINE == 'opal'
3
5
  unless method_defined?(:_preact_component_resolution_original_method_missing)
@@ -13,8 +15,6 @@ module Preact::ComponentResolution
13
15
  let sc = self.$class();
14
16
  // disable stack traces here for improved performance
15
17
  // if const cannot be found, the orignal method_mising will throw with stacktrace
16
- let orig_est = Opal.config.enable_stack_trace;
17
- Opal.config.enable_stack_trace = false;
18
18
  try {
19
19
  // disable the const cache for development, so that always the latest constant
20
20
  // version is used to make hot reloading reliable
@@ -35,8 +35,6 @@ module Preact::ComponentResolution
35
35
  break;
36
36
  } catch(err) { }
37
37
  }
38
- } finally {
39
- Opal.config.enable_stack_trace = orig_est;
40
38
  }
41
39
  if (constant) {
42
40
  if (!Opal.Isomorfeus.development && !self.$$iso_preact_const_cache[component_name]) {
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  module Preact::HtmlElements
2
4
  # https://html.spec.whatwg.org/multipage/indices.html#elements-3
3
5
  SUPPORTED_HTML_ELEMENTS = %w[
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  module Preact::MathMlElements
2
4
  # https://www.w3.org/TR/MathML3/appendixi.html#index.elem
3
5
  SUPPORTED_MATH_ML_ELEMENTS = %w[
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  class Module
2
4
  if RUBY_ENGINE == 'opal'
3
5
  unless method_defined?(:_preact_component_class_resolution_original_method_missing)
@@ -14,8 +16,7 @@ class Module
14
16
  let c = component_name[0];
15
17
  if (c == c.toUpperCase()) {
16
18
  // disable stack traces here for improved performance
17
- // if const cannot be found, the orignal method_mising will throw with stacktrace
18
- Opal.config.enable_stack_trace = false;
19
+ // if const cannot be found, the orignal method_missing will throw with stacktrace
19
20
  try {
20
21
  // disable the const cache for development, so that always the latest constant
21
22
  // version is used to make hot reloading reliable
@@ -26,8 +27,6 @@ class Module
26
27
  constant = self.$const_get(component_name);
27
28
  } catch(err) {
28
29
  // nothing
29
- } finally {
30
- Opal.config.enable_stack_trace = true;
31
30
  }
32
31
  if (constant) {
33
32
  if (!Opal.Isomorfeus.development && !self.$$iso_preact_const_cache[component_name]) {
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  module Preact::SvgElements
2
4
  # https://www.w3.org/TR/SVG11/eltindex.html + https://www.w3.org/TR/SVG2/eltindex.htm
3
5
  SUPPORTED_SVG_ELEMENTS = %w[
data/lib/preact.rb CHANGED
@@ -1,4 +1,5 @@
1
- # helpers: hash2, hash_get, hash_put
1
+ # backtick_javascript: true
2
+ # helpers: hash_get, hash_put
2
3
 
3
4
  if RUBY_ENGINE == 'opal'
4
5
  class VNode
@@ -65,7 +66,6 @@ module Preact
65
66
  const EMPTY_OBJ = Object.create(null);
66
67
  const EMPTY_ARR = [];
67
68
  const slice = EMPTY_ARR.slice;
68
- const $has_own = Object.hasOwn || $call.bind(Object.prototype.hasOwnProperty);
69
69
 
70
70
  function hash_fetch(hash, key) {
71
71
  let val = $hash_get(hash, key);
@@ -84,7 +84,7 @@ module Preact
84
84
  else if (typeof value.$$class !== 'undefined') { converted_value = value; }
85
85
  else if (value instanceof Element || value instanceof Node) { converted_value = #{Browser::Element.new(`value`)}; }
86
86
  if (typeof ref === "function") ref.$call(converted_value);
87
- else $hash_put(ref, "current", converted_value);
87
+ else ref.set("current", converted_value);
88
88
  } catch (e) {
89
89
  _catchError(e, vnode);
90
90
  }
@@ -489,11 +489,11 @@ module Preact
489
489
  }
490
490
 
491
491
  if (value && value !== nil && value.$$is_hash) {
492
- value = value.$to_n();
492
+ value = Object.fromEntries(value);
493
493
  }
494
494
 
495
495
  if (oldValue && oldValue !== nil && oldValue.$$is_hash) {
496
- oldValue = oldValue.$to_n();
496
+ oldValue = Object.fromEntries(oldValue);
497
497
  }
498
498
 
499
499
  if (oldValue && oldValue !== nil) {
@@ -584,7 +584,7 @@ module Preact
584
584
 
585
585
  function diff_props(dom, new_props, old_props, is_svg, hydrate) {
586
586
  #{`old_props`.each do |prop, value|
587
- `if (prop !== "children" && prop !== "key" && !(prop.$$is_string && $has_own(new_props.$$smap, prop))) { self.setProperty(dom, prop, null, value, is_svg); }`
587
+ `if (prop !== "children" && prop !== "key" && !(prop.$$is_string && new_props.has(prop))) { self.setProperty(dom, prop, null, value, is_svg); }`
588
588
  nil
589
589
  end
590
590
  `new_props`.each do |prop, value|
@@ -647,7 +647,7 @@ module Preact
647
647
  nodeType
648
648
  );
649
649
  } else {
650
- let np = newProps.$to_n();
650
+ let np = Object.fromEntries(newProps);
651
651
  dom = document.createElement(
652
652
  // We know `newVNode.type` is a string
653
653
  nodeType,
@@ -670,7 +670,7 @@ module Preact
670
670
  // If excessDomChildren was not null, repopulate it with the current element's children:
671
671
  excessDomChildren = excessDomChildren && slice.call(dom.childNodes);
672
672
 
673
- oldProps = oldVNode.props || $hash2([], {});
673
+ oldProps = oldVNode.props || new Map();
674
674
 
675
675
  let oldHtml = hash_fetch(oldProps, "dangerouslySetInnerHTML");
676
676
  let newHtml = hash_fetch(newProps, "dangerouslySetInnerHTML");
@@ -681,9 +681,9 @@ module Preact
681
681
  // But, if we are in a situation where we are using existing DOM (e.g. replaceNode)
682
682
  // we should read the existing DOM attributes to diff them
683
683
  if (excessDomChildren != null) {
684
- oldProps = $hash2([], {});
684
+ oldProps = new Map();
685
685
  for (i = 0; i < dom.attributes.length; i++) {
686
- $hash_put(oldProps, dom.attributes[i].name, dom.attributes[i].value);
686
+ oldProps.set(dom.attributes[i].name, dom.attributes[i].value);
687
687
  }
688
688
  }
689
689
 
@@ -732,8 +732,6 @@ module Preact
732
732
  // (as above, don't diff props during hydration)
733
733
  if (!isHydrating) {
734
734
  if (
735
- // instead of newProps["$key?"]("value")
736
- $has_own(newProps.$$smap, "value") &&
737
735
  (i = hash_fetch(newProps, "value")) !== nil &&
738
736
  // #2756 For the <progress>-element the initial value is 0,
739
737
  // despite the attribute not being present. When the attribute
@@ -747,11 +745,7 @@ module Preact
747
745
  ) {
748
746
  self.setProperty(dom, 'value', i, hash_fetch(oldProps, "value"), false, null);
749
747
  }
750
- if (
751
- $has_own(newProps.$$smap, "checked") &&
752
- (i = hash_fetch(newProps, "checked")) !== nil &&
753
- i !== dom.checked
754
- ) {
748
+ if ((i = hash_fetch(newProps, "checked")) !== nil && i !== dom.checked) {
755
749
  self.setProperty(dom, 'checked', i, hash_fetch(oldProps, "checked"), false, null);
756
750
  }
757
751
  }
@@ -764,7 +758,7 @@ module Preact
764
758
  if (newType.declared_props && newType.declared_props !== nil) {
765
759
  #{
766
760
  `newType.declared_props`.each do |prop, value|
767
- `if ($has_own(value.$$smap, "default") && !$has_own(newProps.$$smap, prop)) { #{`newProps`[prop] = value[:default]} }`
761
+ `if (value.has("default") && !newProps.has(prop)) { newProps.set(prop, value.get("default")) }`
768
762
  nil
769
763
  end
770
764
  }
@@ -824,7 +818,7 @@ module Preact
824
818
  if (provider && provider !== nil) provider.$sub(c);
825
819
 
826
820
  c.props = newProps;
827
- if (c.state === nil || !c.state) c.state = $hash2([], {});
821
+ if (c.state === nil || !c.state) c.state = new Map();
828
822
  c.context = componentContext;
829
823
  c._globalContext = globalContext;
830
824
  isNew = c._dirty = true;
@@ -1055,7 +1049,7 @@ module Preact
1055
1049
  // our custom `_children` property.
1056
1050
  vnode,
1057
1051
  ov ? oldVNode : EMPTY_OBJ,
1058
- $hash2([], {}),
1052
+ new Map(),
1059
1053
  parentDom.ownerSVGElement !== undefined,
1060
1054
  nohy_reno ? [replaceNode] : ov ? null : parentDom.firstChild ? slice.call(parentDom.childNodes) : null,
1061
1055
  commitQueue,
@@ -1220,7 +1214,7 @@ module Preact
1220
1214
  end
1221
1215
 
1222
1216
  %x{
1223
- if (children !== nil && children !== null) { $hash_put(normalized_props, "children", children); }
1217
+ if (children !== nil && children !== null) { normalized_props.set("children", children); }
1224
1218
  return self.createVNode(type, normalized_props, key, ref, null);
1225
1219
  }
1226
1220
  end
data/lib/redirect.rb CHANGED
@@ -1,17 +1,19 @@
1
+ # backtick_javascript: true
2
+
1
3
  class Redirect < Preact::Component
2
4
  EVENT_PUSH_STATE = "pushState"
3
5
  EVENT_REPLACE_STATE = "replaceState"
4
6
 
5
7
  self.context_type = RouterContext
6
8
 
7
- def initialize(props, context)
8
- super(props, context)
9
- if RUBY_ENGINE == 'opal'
10
- @history = if `typeof window !== "undefined"`
9
+ if RUBY_ENGINE == 'opal'
10
+ def initialize(props, context)
11
+ super(props, context)
12
+ @history = if `typeof window !== "undefined"`
11
13
  `window.history`
12
- else
14
+ else
13
15
  `{ length: 1, state: null, scrollRestoration: "auto", pushState: function(e,t,n){}, replaceState: function(e,t,n){} }`
14
- end
16
+ end
15
17
  @base = ''
16
18
  end
17
19
  end
data/lib/router.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  class Router < Preact::Component
2
4
  EVENT_POP_STATE = "popstate"
3
5
  EVENT_PUSH_STATE = "pushState"
data/lib/switch.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  class Switch < Preact::Component
2
4
 
3
5
  self.context_type = RouterContext
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: 23.7.0.rc4
4
+ version: 23.8.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Biedermann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-21 00:00:00.000000000 Z
11
+ date: 2023-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oj
@@ -36,14 +36,14 @@ dependencies:
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: 1.7.3
39
+ version: 1.8.0.alpha1
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: 1.7.3
46
+ version: 1.8.0.alpha1
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: opal-activesupport
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -78,28 +78,28 @@ dependencies:
78
78
  requirements:
79
79
  - - '='
80
80
  - !ruby/object:Gem::Version
81
- version: 23.7.0.rc4
81
+ version: 23.8.0.rc1
82
82
  type: :runtime
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
86
  - - '='
87
87
  - !ruby/object:Gem::Version
88
- version: 23.7.0.rc4
88
+ version: 23.8.0.rc1
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: isomorfeus-redux
91
91
  requirement: !ruby/object:Gem::Requirement
92
92
  requirements:
93
93
  - - '='
94
94
  - !ruby/object:Gem::Version
95
- version: 23.7.0.rc4
95
+ version: 23.8.0.rc1
96
96
  type: :runtime
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - '='
101
101
  - !ruby/object:Gem::Version
102
- version: 23.7.0.rc4
102
+ version: 23.8.0.rc1
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: benchmark-ips
105
105
  requirement: !ruby/object:Gem::Requirement
@@ -120,14 +120,14 @@ dependencies:
120
120
  requirements:
121
121
  - - "~>"
122
122
  - !ruby/object:Gem::Version
123
- version: 0.8.7
123
+ version: 0.9.1
124
124
  type: :development
125
125
  prerelease: false
126
126
  version_requirements: !ruby/object:Gem::Requirement
127
127
  requirements:
128
128
  - - "~>"
129
129
  - !ruby/object:Gem::Version
130
- version: 0.8.7
130
+ version: 0.9.1
131
131
  - !ruby/object:Gem::Dependency
132
132
  name: rake
133
133
  requirement: !ruby/object:Gem::Requirement
@@ -226,7 +226,6 @@ files:
226
226
  - lib/route.rb
227
227
  - lib/router.rb
228
228
  - lib/switch.rb
229
- - opal/cgi.rb
230
229
  - opal/iso_uri.rb
231
230
  - opal/uri/common.rb
232
231
  - opal/uri/generic.rb
data/opal/cgi.rb DELETED
@@ -1,15 +0,0 @@
1
- # TODO remove after included in Opal (possibly 1.8)
2
-
3
- class CGI
4
- module Escape
5
- def escapeURIComponent(c)
6
- `encodeURI(c)`
7
- end
8
-
9
- def unescapeURIComponent(c)
10
- `decodeURI(c)`
11
- end
12
- end
13
-
14
- extend Escape
15
- end