Skip to content

Commit

Permalink
upgrade to snabbdom 2
Browse files Browse the repository at this point in the history
  • Loading branch information
tobymao committed Oct 13, 2020
1 parent 7c6addc commit 6fb76e7
Show file tree
Hide file tree
Showing 15 changed files with 975 additions and 890 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
/tmp/
/examples/roda/public
/examples/roda/build
/node_modules/
package-lock.json

.DS_STORE
*.swp
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class NestedExample < Snabberb::Component
h(:div, { style: { width: '100px' } }, [
h(:div, 'hello'),
])
](
])
end
end
```
Expand Down
20 changes: 20 additions & 0 deletions build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// browserify deps.js -p esmify -s snabbdom > opal/vendor/snabbdom.js
import { init } from './node_modules/snabbdom/build/package/init'
import { h } from './node_modules/snabbdom/build/package/h'
import { toVNode } from './node_modules/snabbdom/build/package/tovnode'

import { attributesModule } from './node_modules/snabbdom/build/package/modules/attributes'
import { classModule } from './node_modules/snabbdom/build/package/modules/class'
import { eventListenersModule } from './node_modules/snabbdom/build/package/modules/eventlisteners'
import { propsModule } from './node_modules/snabbdom/build/package/modules/props'
import { styleModule } from './node_modules/snabbdom/build/package/modules/style'

module.exports.init = init
module.exports.h = h
module.exports.toVNode = toVNode

module.exports.attributesModule = attributesModule
module.exports.classModule = classModule
module.exports.eventListenersModule = eventListenersModule
module.exports.propsModule = propsModule
module.exports.styleModule = styleModule
6 changes: 3 additions & 3 deletions examples/rack/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
PATH
remote: ../..
specs:
snabberb (0.2.3)
snabberb (0.4.2)
opal (~> 1.0)

GEM
remote: https://rubygems.org/
specs:
ast (2.4.0)
ast (2.4.1)
c_lexer (2.6.4.1.1)
ast (~> 2.4.0)
parser (= 2.6.4.1)
Expand All @@ -28,4 +28,4 @@ DEPENDENCIES
snabberb!

BUNDLED WITH
2.1.2
2.1.4
18 changes: 9 additions & 9 deletions examples/roda/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
PATH
remote: ../..
specs:
snabberb (0.2.5)
snabberb (0.4.2)
opal (~> 1.0)

GEM
remote: https://rubygems.org/
specs:
ast (2.4.0)
ast (2.4.1)
c_lexer (2.6.4.1.1)
ast (~> 2.4.0)
parser (= 2.6.4.1)
concurrent-ruby (1.1.6)
concurrent-ruby (1.1.7)
execjs (2.7.0)
libv8 (7.3.492.27.1)
mini_racer (0.2.9)
libv8 (>= 6.9.411)
libv8 (8.4.255.0)
mini_racer (0.3.1)
libv8 (~> 8.4.255)
opal (1.0.3)
ast (>= 2.3.0)
parser (~> 2.6)
opal-sprockets (0.4.8.1.0.3.7)
opal-sprockets (0.4.9.1.0.3.7)
opal (~> 1.0.0)
sprockets (~> 3.7)
tilt (>= 1.4)
parser (2.6.4.1)
ast (~> 2.4.0)
rack (2.2.3)
roda (3.30.0)
roda (3.36.0)
rack
sprockets (3.7.2)
concurrent-ruby (~> 1.0)
Expand All @@ -46,4 +46,4 @@ DEPENDENCIES
snabberb!

BUNDLED WITH
2.1.2
2.1.4
2 changes: 1 addition & 1 deletion lib/snabberb/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Snabberb
VERSION = '0.4.2'
VERSION = '0.5.0'
end
6 changes: 0 additions & 6 deletions opal/snabberb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@
require 'native'

require 'vendor/snabbdom'
require 'vendor/snabbdom-attributes'
require 'vendor/snabbdom-class'
require 'vendor/snabbdom-eventlisteners'
require 'vendor/snabbdom-props'
require 'vendor/snabbdom-style'
require 'vendor/snabbdom-to-html'
require 'vendor/tovnode'

require 'snabberb/component'

Expand Down
10 changes: 5 additions & 5 deletions opal/snabberb/component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,11 @@ def update!
return unless request_ids.empty?

@@patcher ||= %x{snabbdom.init([
snabbdom_attributes.default,
snabbdom_class.default,
snabbdom_eventlisteners.default,
snabbdom_props.default,
snabbdom_style.default,
snabbdom.attributesModule,
snabbdom.classModule,
snabbdom.eventListenersModule,
snabbdom.propsModule,
snabbdom.styleModule,
])}
node = @root.render
@@patcher.call(@root.node, node)
Expand Down
71 changes: 0 additions & 71 deletions opal/vendor/snabbdom-attributes.js

This file was deleted.

29 changes: 0 additions & 29 deletions opal/vendor/snabbdom-class.js

This file was deleted.

Loading

0 comments on commit 6fb76e7

Please sign in to comment.