isomorfeus-preact 10.8.2 → 22.9.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +14 -3
- data/README.md +23 -39
- data/lib/browser/delegate_native.rb +94 -72
- data/lib/browser/document.rb +38 -0
- data/lib/browser/element.rb +160 -176
- data/lib/browser/event.rb +99 -94
- data/lib/browser/history.rb +40 -20
- data/lib/browser/location.rb +59 -0
- data/lib/browser/window.rb +58 -0
- data/lib/data_uri/open_uri.rb +18 -0
- data/lib/data_uri/uri.rb +61 -0
- data/lib/data_uri.rb +4 -0
- data/lib/isomorfeus/preact/config.rb +42 -54
- data/lib/isomorfeus/preact/imports.rb +5 -20
- data/lib/isomorfeus/preact/ssr.rb +34 -0
- data/lib/isomorfeus/preact/thread_local_component_cache.rb +9 -11
- data/lib/isomorfeus/preact/version.rb +5 -0
- data/lib/isomorfeus/preact/view_helper.rb +72 -0
- data/lib/isomorfeus/props/validator.rb +19 -11
- data/lib/isomorfeus/top_level.rb +55 -33
- data/lib/isomorfeus-preact.rb +78 -103
- data/lib/link.rb +52 -0
- data/lib/lucid_app.rb +117 -0
- data/lib/lucid_component.rb +154 -0
- data/lib/nano_css.rb +282 -465
- data/lib/preact/component.rb +222 -0
- data/lib/preact/component_resolution.rb +49 -83
- data/lib/preact/context.rb +68 -0
- data/lib/preact/elements.rb +2 -9
- data/lib/preact/module_component_resolution.rb +50 -0
- data/lib/preact/prop_declaration_mixin.rb +73 -0
- data/lib/preact.rb +1548 -257
- data/lib/redirect.rb +34 -0
- data/lib/route.rb +15 -0
- data/lib/router.rb +145 -0
- data/lib/switch.rb +70 -0
- metadata +42 -309
- data/lib/isomorfeus/preact/memcached_component_cache.rb +0 -19
- data/lib/isomorfeus/preact/redis_component_cache.rb +0 -19
- data/lib/isomorfeus/preact/ssr/history.rb +0 -23
- data/lib/isomorfeus/preact/ssr/render_core.rb +0 -117
- data/lib/isomorfeus/preact/ssr/top_level.rb +0 -37
- data/lib/isomorfeus/preact_view_helper.rb +0 -129
- data/lib/isomorfeus_preact/lucid_app/api.rb +0 -38
- data/lib/isomorfeus_preact/lucid_app/base.rb +0 -7
- data/lib/isomorfeus_preact/lucid_app/mixin.rb +0 -14
- data/lib/isomorfeus_preact/lucid_app/native_component_constructor.rb +0 -101
- data/lib/isomorfeus_preact/lucid_component/api.rb +0 -123
- data/lib/isomorfeus_preact/lucid_component/app_store_proxy.rb +0 -32
- data/lib/isomorfeus_preact/lucid_component/base.rb +0 -7
- data/lib/isomorfeus_preact/lucid_component/class_store_proxy.rb +0 -37
- data/lib/isomorfeus_preact/lucid_component/initializer.rb +0 -9
- data/lib/isomorfeus_preact/lucid_component/mixin.rb +0 -13
- data/lib/isomorfeus_preact/lucid_component/native_component_constructor.rb +0 -87
- data/lib/isomorfeus_preact/lucid_component/styles_wrapper.rb +0 -40
- data/lib/isomorfeus_preact/lucid_func/base.rb +0 -7
- data/lib/isomorfeus_preact/lucid_func/initializer.rb +0 -8
- data/lib/isomorfeus_preact/lucid_func/mixin.rb +0 -10
- data/lib/isomorfeus_preact/lucid_func/native_component_constructor.rb +0 -56
- data/lib/isomorfeus_preact/preact/function_component/api.rb +0 -140
- data/lib/isomorfeus_preact/preact/function_component/base.rb +0 -7
- data/lib/isomorfeus_preact/preact/function_component/initializer.rb +0 -6
- data/lib/isomorfeus_preact/preact/function_component/mixin.rb +0 -8
- data/lib/isomorfeus_preact/preact/function_component/native_component_constructor.rb +0 -47
- data/lib/lucid_app/context.rb +0 -24
- data/lib/lucid_prop_declaration/mixin.rb +0 -126
- data/lib/preact/component/api.rb +0 -137
- data/lib/preact/component/base.rb +0 -7
- data/lib/preact/component/callbacks.rb +0 -111
- data/lib/preact/component/initializer.rb +0 -7
- data/lib/preact/component/mixin.rb +0 -11
- data/lib/preact/component/native_component_constructor.rb +0 -77
- data/lib/preact/context_wrapper.rb +0 -48
- data/lib/preact/native_constant_wrapper.rb +0 -29
- data/lib/preact/option_hooks.rb +0 -98
- data/lib/preact/params.rb +0 -16
- data/lib/preact/props.rb +0 -69
- data/lib/preact/ref.rb +0 -17
- data/lib/preact/state.rb +0 -87
- data/lib/preact/version.rb +0 -3
- data/node_modules/.package-lock.json +0 -38
- data/node_modules/preact/LICENSE +0 -21
- data/node_modules/preact/README.md +0 -188
- data/node_modules/preact/compat/LICENSE +0 -21
- data/node_modules/preact/compat/client.js +0 -19
- data/node_modules/preact/compat/client.mjs +0 -17
- data/node_modules/preact/compat/dist/compat.js +0 -2
- data/node_modules/preact/compat/dist/compat.js.map +0 -1
- data/node_modules/preact/compat/dist/compat.mjs +0 -2
- data/node_modules/preact/compat/dist/compat.module.js +0 -2
- data/node_modules/preact/compat/dist/compat.module.js.map +0 -1
- data/node_modules/preact/compat/dist/compat.umd.js +0 -2
- data/node_modules/preact/compat/dist/compat.umd.js.map +0 -1
- data/node_modules/preact/compat/jsx-dev-runtime.js +0 -3
- data/node_modules/preact/compat/jsx-dev-runtime.mjs +0 -3
- data/node_modules/preact/compat/jsx-runtime.js +0 -3
- data/node_modules/preact/compat/jsx-runtime.mjs +0 -3
- data/node_modules/preact/compat/package.json +0 -49
- data/node_modules/preact/compat/scheduler.js +0 -15
- data/node_modules/preact/compat/scheduler.mjs +0 -23
- data/node_modules/preact/compat/server.browser.js +0 -4
- data/node_modules/preact/compat/server.js +0 -15
- data/node_modules/preact/compat/server.mjs +0 -4
- data/node_modules/preact/compat/src/Children.js +0 -21
- data/node_modules/preact/compat/src/PureComponent.js +0 -15
- data/node_modules/preact/compat/src/forwardRef.js +0 -44
- data/node_modules/preact/compat/src/index.d.ts +0 -155
- data/node_modules/preact/compat/src/index.js +0 -187
- data/node_modules/preact/compat/src/internal.d.ts +0 -47
- data/node_modules/preact/compat/src/memo.js +0 -34
- data/node_modules/preact/compat/src/portals.js +0 -82
- data/node_modules/preact/compat/src/render.js +0 -238
- data/node_modules/preact/compat/src/suspense-list.d.ts +0 -14
- data/node_modules/preact/compat/src/suspense-list.js +0 -126
- data/node_modules/preact/compat/src/suspense.d.ts +0 -15
- data/node_modules/preact/compat/src/suspense.js +0 -270
- data/node_modules/preact/compat/src/util.js +0 -28
- data/node_modules/preact/compat/test-utils.js +0 -1
- data/node_modules/preact/debug/LICENSE +0 -21
- data/node_modules/preact/debug/dist/debug.js +0 -2
- data/node_modules/preact/debug/dist/debug.js.map +0 -1
- data/node_modules/preact/debug/dist/debug.mjs +0 -2
- data/node_modules/preact/debug/dist/debug.module.js +0 -2
- data/node_modules/preact/debug/dist/debug.module.js.map +0 -1
- data/node_modules/preact/debug/dist/debug.umd.js +0 -2
- data/node_modules/preact/debug/dist/debug.umd.js.map +0 -1
- data/node_modules/preact/debug/package.json +0 -26
- data/node_modules/preact/debug/src/check-props.js +0 -54
- data/node_modules/preact/debug/src/component-stack.js +0 -146
- data/node_modules/preact/debug/src/constants.js +0 -3
- data/node_modules/preact/debug/src/debug.js +0 -437
- data/node_modules/preact/debug/src/index.js +0 -6
- data/node_modules/preact/debug/src/internal.d.ts +0 -82
- data/node_modules/preact/debug/src/util.js +0 -11
- data/node_modules/preact/devtools/LICENSE +0 -21
- data/node_modules/preact/devtools/dist/devtools.js +0 -2
- data/node_modules/preact/devtools/dist/devtools.js.map +0 -1
- data/node_modules/preact/devtools/dist/devtools.mjs +0 -2
- data/node_modules/preact/devtools/dist/devtools.module.js +0 -2
- data/node_modules/preact/devtools/dist/devtools.module.js.map +0 -1
- data/node_modules/preact/devtools/dist/devtools.umd.js +0 -2
- data/node_modules/preact/devtools/dist/devtools.umd.js.map +0 -1
- data/node_modules/preact/devtools/package.json +0 -25
- data/node_modules/preact/devtools/src/devtools.js +0 -10
- data/node_modules/preact/devtools/src/index.d.ts +0 -8
- data/node_modules/preact/devtools/src/index.js +0 -15
- data/node_modules/preact/dist/preact.js +0 -2
- data/node_modules/preact/dist/preact.js.map +0 -1
- data/node_modules/preact/dist/preact.min.js +0 -2
- data/node_modules/preact/dist/preact.min.js.map +0 -1
- data/node_modules/preact/dist/preact.mjs +0 -2
- data/node_modules/preact/dist/preact.module.js +0 -2
- data/node_modules/preact/dist/preact.module.js.map +0 -1
- data/node_modules/preact/dist/preact.umd.js +0 -2
- data/node_modules/preact/dist/preact.umd.js.map +0 -1
- data/node_modules/preact/hooks/LICENSE +0 -21
- data/node_modules/preact/hooks/dist/hooks.js +0 -2
- data/node_modules/preact/hooks/dist/hooks.js.map +0 -1
- data/node_modules/preact/hooks/dist/hooks.mjs +0 -2
- data/node_modules/preact/hooks/dist/hooks.module.js +0 -2
- data/node_modules/preact/hooks/dist/hooks.module.js.map +0 -1
- data/node_modules/preact/hooks/dist/hooks.umd.js +0 -2
- data/node_modules/preact/hooks/dist/hooks.umd.js.map +0 -1
- data/node_modules/preact/hooks/package.json +0 -35
- data/node_modules/preact/hooks/src/index.d.ts +0 -139
- data/node_modules/preact/hooks/src/index.js +0 -417
- data/node_modules/preact/hooks/src/internal.d.ts +0 -78
- data/node_modules/preact/jsx-runtime/LICENSE +0 -21
- data/node_modules/preact/jsx-runtime/dist/jsxRuntime.js +0 -2
- data/node_modules/preact/jsx-runtime/dist/jsxRuntime.js.map +0 -1
- data/node_modules/preact/jsx-runtime/dist/jsxRuntime.mjs +0 -2
- data/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js +0 -2
- data/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js.map +0 -1
- data/node_modules/preact/jsx-runtime/dist/jsxRuntime.umd.js +0 -2
- data/node_modules/preact/jsx-runtime/dist/jsxRuntime.umd.js.map +0 -1
- data/node_modules/preact/jsx-runtime/package.json +0 -28
- data/node_modules/preact/jsx-runtime/src/index.d.ts +0 -50
- data/node_modules/preact/jsx-runtime/src/index.js +0 -77
- data/node_modules/preact/package.json +0 -304
- data/node_modules/preact/src/cjs.js +0 -3
- data/node_modules/preact/src/clone-element.js +0 -34
- data/node_modules/preact/src/component.js +0 -225
- data/node_modules/preact/src/constants.js +0 -3
- data/node_modules/preact/src/create-context.js +0 -68
- data/node_modules/preact/src/create-element.js +0 -98
- data/node_modules/preact/src/diff/catch-error.js +0 -40
- data/node_modules/preact/src/diff/children.js +0 -335
- data/node_modules/preact/src/diff/index.js +0 -533
- data/node_modules/preact/src/diff/props.js +0 -158
- data/node_modules/preact/src/index.d.ts +0 -317
- data/node_modules/preact/src/index.js +0 -13
- data/node_modules/preact/src/internal.d.ts +0 -155
- data/node_modules/preact/src/jsx.d.ts +0 -1013
- data/node_modules/preact/src/options.js +0 -16
- data/node_modules/preact/src/render.js +0 -75
- data/node_modules/preact/src/util.js +0 -27
- data/node_modules/preact/test-utils/dist/testUtils.js +0 -2
- data/node_modules/preact/test-utils/dist/testUtils.js.map +0 -1
- data/node_modules/preact/test-utils/dist/testUtils.mjs +0 -2
- data/node_modules/preact/test-utils/dist/testUtils.module.js +0 -2
- data/node_modules/preact/test-utils/dist/testUtils.module.js.map +0 -1
- data/node_modules/preact/test-utils/dist/testUtils.umd.js +0 -2
- data/node_modules/preact/test-utils/dist/testUtils.umd.js.map +0 -1
- data/node_modules/preact/test-utils/package.json +0 -28
- data/node_modules/preact/test-utils/src/index.d.ts +0 -3
- data/node_modules/preact/test-utils/src/index.js +0 -118
- data/node_modules/preact-render-to-string/LICENSE +0 -21
- data/node_modules/preact-render-to-string/README.md +0 -102
- data/node_modules/preact-render-to-string/dist/commonjs.js +0 -2
- data/node_modules/preact-render-to-string/dist/commonjs.js.map +0 -1
- data/node_modules/preact-render-to-string/dist/index.d.ts +0 -16
- data/node_modules/preact-render-to-string/dist/index.js +0 -1
- data/node_modules/preact-render-to-string/dist/index.js.map +0 -1
- data/node_modules/preact-render-to-string/dist/index.mjs +0 -2
- data/node_modules/preact-render-to-string/dist/index.module.js +0 -2
- data/node_modules/preact-render-to-string/dist/index.module.js.map +0 -1
- data/node_modules/preact-render-to-string/dist/jsx-entry.js +0 -2
- data/node_modules/preact-render-to-string/dist/jsx-entry.js.map +0 -1
- data/node_modules/preact-render-to-string/dist/jsx.d.ts +0 -13
- data/node_modules/preact-render-to-string/dist/jsx.js +0 -1
- data/node_modules/preact-render-to-string/dist/jsx.js.map +0 -1
- data/node_modules/preact-render-to-string/dist/jsx.mjs +0 -2
- data/node_modules/preact-render-to-string/dist/jsx.modern.js +0 -2
- data/node_modules/preact-render-to-string/dist/jsx.modern.js.map +0 -1
- data/node_modules/preact-render-to-string/dist/jsx.module.js +0 -2
- data/node_modules/preact-render-to-string/dist/jsx.module.js.map +0 -1
- data/node_modules/preact-render-to-string/dist/preact-render-to-string-tests.d.ts +0 -1
- data/node_modules/preact-render-to-string/jsx.js +0 -1
- data/node_modules/preact-render-to-string/package.json +0 -142
- data/node_modules/preact-render-to-string/src/index.d.ts +0 -16
- data/node_modules/preact-render-to-string/src/index.js +0 -462
- data/node_modules/preact-render-to-string/src/jsx.d.ts +0 -13
- data/node_modules/preact-render-to-string/src/jsx.js +0 -76
- data/node_modules/preact-render-to-string/src/polyfills.js +0 -8
- data/node_modules/preact-render-to-string/src/preact-render-to-string-tests.d.ts +0 -1
- data/node_modules/preact-render-to-string/src/util.js +0 -78
- data/node_modules/preact-render-to-string/typings.json +0 -5
- data/node_modules/pretty-format/.npmignore +0 -3
- data/node_modules/pretty-format/LICENSE.md +0 -15
- data/node_modules/pretty-format/README.md +0 -94
- data/node_modules/pretty-format/index.js +0 -343
- data/node_modules/pretty-format/package.json +0 -26
- data/node_modules/pretty-format/plugins/ReactElement.js +0 -74
- data/node_modules/pretty-format/plugins/ReactTestComponent.js +0 -58
- data/node_modules/pretty-format/printString.js +0 -7
- data/node_modules/wouter-preact/cjs/index.js +0 -180
- data/node_modules/wouter-preact/cjs/matcher.js +0 -72
- data/node_modules/wouter-preact/cjs/package.json +0 -1
- data/node_modules/wouter-preact/cjs/react-deps.js +0 -75
- data/node_modules/wouter-preact/cjs/static-location.js +0 -21
- data/node_modules/wouter-preact/cjs/use-location.js +0 -94
- data/node_modules/wouter-preact/index.d.ts +0 -110
- data/node_modules/wouter-preact/index.js +0 -178
- data/node_modules/wouter-preact/matcher.d.ts +0 -30
- data/node_modules/wouter-preact/matcher.js +0 -66
- data/node_modules/wouter-preact/package.json +0 -33
- data/node_modules/wouter-preact/react-deps.js +0 -15
- data/node_modules/wouter-preact/static-location.d.ts +0 -16
- data/node_modules/wouter-preact/static-location.js +0 -17
- data/node_modules/wouter-preact/use-location.d.ts +0 -43
- data/node_modules/wouter-preact/use-location.js +0 -86
- data/package.json +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f03a9caab0b34f6c66cc1b321a6b7ab89a42af5b5ffb58f775ed5ac2d5bf2a14
|
4
|
+
data.tar.gz: f31916a7ca1e982c0f24f7fde58b0ae09aa834e14a3d872086842f802ffe0c45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d301859c505f127332372ab4c5ace3eb01d8357d581baa38c2f187e5564c41dbee9cef90cb4fc1d1ad47c3665bf6b415bf2f76adce43b9490dcfaae02da3e443
|
7
|
+
data.tar.gz: aa70516de11b90de247423429e78def56967e780cb13bcd761d8d4de653310d7247d2ebd2ed87e66143ea31e3851136694df6effc9379d2f87738369ef55e518
|
data/LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
MIT License
|
2
2
|
|
3
|
-
Copyright (c) 2018-
|
3
|
+
Copyright (c) 2018-present Jan Biedermann
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
@@ -20,7 +20,8 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
21
|
SOFTWARE.
|
22
22
|
|
23
|
-
|
23
|
+
|
24
|
+
Files in lib/browser directory originally taken from https://github.com/clearwater-rb/bowser:
|
24
25
|
|
25
26
|
MIT License
|
26
27
|
|
@@ -28,7 +29,17 @@ Copyright (c) 2015 Jamie Gaskins
|
|
28
29
|
|
29
30
|
(as above)
|
30
31
|
|
31
|
-
|
32
|
+
|
33
|
+
Javascript in file lib/preact.rb originally taken from https://github.com/preactjs/preact:
|
34
|
+
|
35
|
+
MIT License
|
36
|
+
|
37
|
+
Copyright (c) 2015-present Jason Miller
|
38
|
+
|
39
|
+
(as above)
|
40
|
+
|
41
|
+
|
42
|
+
Javascript in file lib/nano_css.rb originally taken from https://github.com/streamich/nano-css:
|
32
43
|
|
33
44
|
This is free and unencumbered software released into the public domain.
|
34
45
|
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
<h1 align="center">
|
2
|
-
<img src="https://github.com/isomorfeus/isomorfeus-
|
2
|
+
<img src="https://github.com/isomorfeus/isomorfeus-project/blob/master/isomorfeus-preact/Logo.png?raw=true" align="center" width="234" height="125" />
|
3
3
|
<br/>
|
4
4
|
Isomorfeus Preact<br/>
|
5
5
|
</h1>
|
@@ -10,52 +10,36 @@ Develop Preact components for Opal Ruby along with very easy to use and advanced
|
|
10
10
|
At the [Isomorfeus Framework Project](https://isomorfeus.com)
|
11
11
|
|
12
12
|
## Versioning and Compatibility
|
13
|
-
isomorfeus-preact
|
13
|
+
As of version 22.8 isomorfeus-preact implements its own preact and preact-render-to-string versions, adapted to work directly with ruby classes or ported to ruby.
|
14
14
|
|
15
15
|
### Preact
|
16
|
-
|
16
|
+
|
17
|
+
Isomorfeus-preact implements a Preact Class Components API in Ruby.
|
17
18
|
|
18
19
|
## Documentation
|
19
20
|
|
20
21
|
Because isomorfeus-preact follows closely the Preact principles/implementation/API and Documentation, most things of the official Preact documentation
|
21
|
-
apply, but in the Ruby way,
|
22
|
-
- [https://preactjs.com/guide/v10/
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
- [
|
27
|
-
- [
|
28
|
-
- [
|
29
|
-
- [
|
30
|
-
|
31
|
-
|
32
|
-
-
|
33
|
-
|
34
|
-
|
35
|
-
- [
|
36
|
-
- [Lifecycle Callbacks](https://github.com/isomorfeus/isomorfeus-preact/blob/master/docs/lifecycle_callbacks.md)
|
37
|
-
- [Props](https://github.com/isomorfeus/isomorfeus-preact/blob/master/docs/props.md)
|
38
|
-
- [State](https://github.com/isomorfeus/isomorfeus-preact/blob/master/docs/state.md)
|
39
|
-
|
40
|
-
For all Components:
|
41
|
-
- [Accessibility](https://github.com/isomorfeus/isomorfeus-preact/blob/master/docs/accessibility.md)
|
42
|
-
- [Render Blocks](https://github.com/isomorfeus/isomorfeus-preact/blob/master/docs/render_blocks.md)
|
43
|
-
- [Rendering HTML or SVG Elements](https://github.com/isomorfeus/isomorfeus-preact/blob/master/docs/rendering_elements.md)
|
44
|
-
|
45
|
-
Special Preact Features:
|
46
|
-
- [Context](https://github.com/isomorfeus/isomorfeus-preact/blob/master/docs/context.md)
|
47
|
-
- [Fragments](https://github.com/isomorfeus/isomorfeus-preact/blob/master/docs/fragments.md)
|
48
|
-
- [Refs](https://github.com/isomorfeus/isomorfeus-preact/blob/master/docs/refs.md)
|
22
|
+
apply, but in the Ruby way. (Except for Function components and Hooks, which are not supported). See the Preact Class Component documentation:
|
23
|
+
- [https://preactjs.com/guide/v10/components#class-components](https://preactjs.com/guide/v10/components#class-components)
|
24
|
+
- The base class in Ruby to inherit from and implement components is `Preact::Component`
|
25
|
+
|
26
|
+
Components:
|
27
|
+
- [Lucid App, Lucid Component](https://github.com/isomorfeus/isomorfeus-project/blob/master/isomorfeus-preact/docs/lucid_component.md)
|
28
|
+
- [Events](https://github.com/isomorfeus/isomorfeus-project/blob/master/isomorfeus-preact/docs/events.md)
|
29
|
+
- [Props](https://github.com/isomorfeus/isomorfeus-project/blob/master/isomorfeus-preact/docs/props.md)
|
30
|
+
- [State](https://github.com/isomorfeus/isomorfeus-project/blob/master/isomorfeus-preact/docs/state.md)
|
31
|
+
- [Accessibility](https://github.com/isomorfeus/isomorfeus-project/blob/master/isomorfeus-preact/docs/accessibility.md)
|
32
|
+
- [Render Blocks](https://github.com/isomorfeus/isomorfeus-project/blob/master/isomorfeus-preact/docs/render_blocks.md)
|
33
|
+
- [Rendering HTML or SVG Elements](https://github.com/isomorfeus/isomorfeus-project/blob/master/isomorfeus-preact/docs/rendering_elements.md)
|
34
|
+
- [Context](https://github.com/isomorfeus/isomorfeus-project/blob/master/isomorfeus-preact/docs/context.md)
|
35
|
+
- [Fragments](https://github.com/isomorfeus/isomorfeus-project/blob/master/isomorfeus-preact/docs/fragments.md)
|
36
|
+
- [Refs](https://github.com/isomorfeus/isomorfeus-project/blob/master/isomorfeus-preact/docs/refs.md)
|
49
37
|
|
50
38
|
Other Features:
|
51
|
-
- [Hot Module Reloading](https://github.com/isomorfeus/isomorfeus-
|
52
|
-
- [Server Side Rendering](https://github.com/isomorfeus/isomorfeus-
|
53
|
-
- [Using
|
54
|
-
- [Isomorfeus Helpers](https://github.com/isomorfeus/isomorfeus-
|
55
|
-
|
56
|
-
### Development Tools
|
57
|
-
The Preact Devtools allow for analyzing, debugging and profiling components. A very helpful toolset and working very nice with isomorfeus-preact:
|
58
|
-
[https://preactjs.github.io/preact-devtools/](https://preactjs.github.io/preact-devtools/)
|
39
|
+
- [Hot Module Reloading](https://github.com/isomorfeus/isomorfeus-project/blob/master/isomorfeus-preact/docs/hot_module_reloading.md)
|
40
|
+
- [Server Side Rendering](https://github.com/isomorfeus/isomorfeus-project/blob/master/isomorfeus-preact/docs/server_side_rendering.md)
|
41
|
+
- [Using Router](https://github.com/isomorfeus/isomorfeus-project/blob/master/isomorfeus-preact/docs/router.md)
|
42
|
+
- [Isomorfeus Helpers](https://github.com/isomorfeus/isomorfeus-project/blob/master/isomorfeus-preact/docs/isomorfeus_helpers.md)
|
59
43
|
|
60
44
|
### Specs and Benchmarks
|
61
45
|
- clone repo
|
@@ -1,72 +1,94 @@
|
|
1
|
-
module Browser
|
2
|
-
module DelegateNative
|
3
|
-
# Provides a default initializer. This should be overridden in all but the
|
4
|
-
# simplest cases.
|
5
|
-
def initialize native
|
6
|
-
@native = native
|
7
|
-
end
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
17
|
-
#
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
}
|
67
|
-
}
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
1
|
+
module Browser
|
2
|
+
module DelegateNative
|
3
|
+
# Provides a default initializer. This should be overridden in all but the
|
4
|
+
# simplest cases.
|
5
|
+
def initialize native
|
6
|
+
@native = native
|
7
|
+
end
|
8
|
+
|
9
|
+
def [](property)
|
10
|
+
method_missing(property)
|
11
|
+
end
|
12
|
+
|
13
|
+
# Fall back to native properties. If the message sent to this element is not
|
14
|
+
# recognized, it checks to see if it is a property of the native element. It
|
15
|
+
# also checks for variations of the message name, such as:
|
16
|
+
#
|
17
|
+
# :supported? => [:supported, :isSupported]
|
18
|
+
#
|
19
|
+
# If a property with the specified message name is found and it is a
|
20
|
+
# function, that function is invoked with `args`. Otherwise, the property
|
21
|
+
# is returned as is.
|
22
|
+
def method_missing message, *args, &block
|
23
|
+
if message.end_with? '='
|
24
|
+
message = message.chop
|
25
|
+
property_name = property_for_message(message)
|
26
|
+
arg = args[0]
|
27
|
+
arg = if `arg && typeof arg.$to_n === 'function'`
|
28
|
+
arg.to_n
|
29
|
+
else
|
30
|
+
arg
|
31
|
+
end
|
32
|
+
return `#@native[#{property_name}] = args[0]`
|
33
|
+
else
|
34
|
+
property_name = property_for_message(message)
|
35
|
+
|
36
|
+
%x{
|
37
|
+
let value = #@native[#{property_name}];
|
38
|
+
let type = typeof(value);
|
39
|
+
try {
|
40
|
+
if (type === 'function') {
|
41
|
+
#{
|
42
|
+
args.map! do |arg|
|
43
|
+
if `arg && typeof arg.$to_n === 'function'`
|
44
|
+
arg.to_n
|
45
|
+
else
|
46
|
+
arg
|
47
|
+
end
|
48
|
+
end
|
49
|
+
}
|
50
|
+
value = value.apply(#@native, args);
|
51
|
+
}
|
52
|
+
if (value instanceof HTMLCollection || value instanceof NodeList) {
|
53
|
+
let a = [];
|
54
|
+
for(let i=0; i<value.length; i++) {
|
55
|
+
a[i] = #{Browser::Element.new(`value.item(i)`)};
|
56
|
+
}
|
57
|
+
value = a;
|
58
|
+
} else if (value instanceof HTMLElement || value instanceof SVGElement) {
|
59
|
+
value = #{Browser::Element.new(`value`)};
|
60
|
+
} else if (value instanceof Event) {
|
61
|
+
value = #{Browser::Event.new(`value`)};
|
62
|
+
} else if (value === null || type === 'undefined' || (type === 'number' && isNaN(value))) {
|
63
|
+
value = nil;
|
64
|
+
}
|
65
|
+
return value;
|
66
|
+
} catch { return value; }
|
67
|
+
}
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def respond_to_missing? message, include_all
|
72
|
+
message = message.chop if message.end_with? '='
|
73
|
+
property_name = property_for_message(message)
|
74
|
+
return true unless `#{property_name} in #@native`
|
75
|
+
false
|
76
|
+
end
|
77
|
+
|
78
|
+
def property_for_message(message)
|
79
|
+
%x{
|
80
|
+
let camel_cased_message;
|
81
|
+
if (typeof(#@native[message]) !== 'undefined') { camel_cased_message = message; }
|
82
|
+
else { camel_cased_message = #{message.camelize(:lower)} }
|
83
|
+
|
84
|
+
if (camel_cased_message.endsWith('?')) {
|
85
|
+
camel_cased_message = camel_cased_message.substring(0, camel_cased_message.length - 2);
|
86
|
+
if (typeof(#@native[camel_cased_message]) === 'undefined') {
|
87
|
+
camel_cased_message = 'is' + camel_cased_message[0].toUpperCase() + camel_cased_message.substring(0, camel_cased_message.length - 1);
|
88
|
+
}
|
89
|
+
}
|
90
|
+
return camel_cased_message
|
91
|
+
}
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Browser
|
2
|
+
module Document
|
3
|
+
extend DelegateNative
|
4
|
+
extend EventTarget
|
5
|
+
|
6
|
+
@native = `document`
|
7
|
+
|
8
|
+
module_function
|
9
|
+
|
10
|
+
# @return [Browser::Element] the head element of the current document
|
11
|
+
def head
|
12
|
+
@head ||= Element.new(`#@native.head`)
|
13
|
+
end
|
14
|
+
|
15
|
+
# @return [Browser::Element] the body element of the current document
|
16
|
+
def body
|
17
|
+
@body ||= Element.new(`#@native.body`)
|
18
|
+
end
|
19
|
+
|
20
|
+
# @return [Browser::Element?] the first element that matches the given CSS
|
21
|
+
# selector or `nil` if no elements match
|
22
|
+
def [] css
|
23
|
+
native = `#@native.querySelector(css)`
|
24
|
+
if `#{native} === null`
|
25
|
+
nil
|
26
|
+
else
|
27
|
+
Element.new(native)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
module_function
|
33
|
+
|
34
|
+
# @return [Document] the browser's document object
|
35
|
+
def document
|
36
|
+
Document
|
37
|
+
end
|
38
|
+
end
|