isomorfeus-preact 10.6.16 → 10.6.17

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: 2796e916f3c62cec0b330e99b7ac6fb46b368f059c3ed1278353211fc4c8370c
4
- data.tar.gz: ad47708be18d9e8f781a8e5bbddbc8501667bafbdee75b9589656789245d656c
3
+ metadata.gz: 4ccc4b9e2e9c992e268704b23e9e1fdf21d323c5f3a38fb92ec8e35c1b512f2b
4
+ data.tar.gz: 27bc9c10c4627bbbeb07e087c46d29e5e74be6b1a33b336f8843646eb9ea9236
5
5
  SHA512:
6
- metadata.gz: 2d40522093a724e462b77833292c29622521832d1faac7cedf584eadf20ea4005a42de057252927eac7d1c96b847f4a19c62416722f1e818a058b3b97b04a2a2
7
- data.tar.gz: 612ebd137795482e93c356869f32af3c4f50b4164ce629ff4c3822a4dda8a4fc748b34899ee771771c3e0e0e57e4198547c62fb7e2466f3b02b2215ce8198d25
6
+ metadata.gz: e12591ed06bdc60ab93eb88d9d208e2b16159c89901c3a07dd387d2a4a434b93d798855109dc270689bdfeceea1ffd59e0ae4c8e1532e70bbba818127d031c82
7
+ data.tar.gz: efc7de705de7b59cb84ab654c06b8d10836a631e92a21a51607f310e70ca35f216657ba6639bce91279af5816f59cef6be4949acb0a3954c04cb48d538aa4414
data/lib/preact/props.rb CHANGED
@@ -11,6 +11,24 @@ module Preact
11
11
  }
12
12
  end
13
13
 
14
+ def [](prop)
15
+ %x{
16
+ const p = #@native.props;
17
+ if (typeof p[prop] === 'undefined') {
18
+ prop = Opal.Preact.lower_camelize(prop);
19
+ if (typeof p[prop] === 'undefined') { return nil; }
20
+ }
21
+ return p[prop];
22
+ }
23
+ end
24
+
25
+ def key?(k)
26
+ %x{
27
+ if (typeof #@native.props[k] !== 'undefined') { return true; }
28
+ return false;
29
+ }
30
+ end
31
+
14
32
  def method_missing(prop, *args, &block)
15
33
  %x{
16
34
  const p = #@native.props;
data/lib/preact/state.rb CHANGED
@@ -13,6 +13,26 @@ module Preact
13
13
  }
14
14
  end
15
15
 
16
+ def [](key)
17
+ %x{
18
+ if (typeof #@native.state[key] === 'undefined') { return nil; }
19
+ return #@native.state[key];
20
+ }
21
+ end
22
+
23
+ def []=(key)
24
+ new_state = `{}`
25
+ new_state.JS[(`key.endsWith('=')` ? key.chop : key)] = args[0]
26
+ @native.JS.setState(new_state, `null`)
27
+ end
28
+
29
+ def key?(k)
30
+ %x{
31
+ if (typeof #@native.state[k] !== 'undefined') { return true; }
32
+ return false;
33
+ }
34
+ end
35
+
16
36
  def method_missing(key, *args, &block)
17
37
  if `args.length > 0`
18
38
  new_state = `{}`
@@ -1,3 +1,3 @@
1
1
  module Preact
2
- VERSION = '10.6.16'
2
+ VERSION = '10.6.17'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isomorfeus-preact
3
3
  version: !ruby/object:Gem::Version
4
- version: 10.6.16
4
+ version: 10.6.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Biedermann