Skip to content

Commit 14ef35c

Browse files
First commit
0 parents  commit 14ef35c

File tree

8 files changed

+713
-0
lines changed

8 files changed

+713
-0
lines changed

.gitignore

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
node_modules/
2+
3+
# Logs
4+
logs
5+
*.log
6+
npm-debug.log*
7+
yarn-debug.log*
8+
yarn-error.log*
9+
10+
# General
11+
.DS_Store
12+
.AppleDouble
13+
.LSOverride
14+
.idea
15+
.cloud
16+
.project
17+
tmp/
18+
typings/
19+
20+
# Visual Studio Code
21+
.vscode/*
22+
!.vscode/settings.json
23+
!.vscode/tasks.json
24+
!.vscode/launch.json
25+
!.vscode/extensions.json

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2022 Yukino Song
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+117
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
# DOMiNATIVE-Solid
2+
3+
### **Custom render and patches for SolidJS to work with [DOMiNATIVE](https://github.com/SudoMaker/DOMiNATIVE) on [NativeScript](https://nativescript.org/)**
4+
5+
[Playground](https://stackblitz.com/edit/nativescript-dominative-solid?file=app/app.jsx)
6+
7+
---
8+
9+
## Installation
10+
11+
Via npm:
12+
13+
```shell
14+
npm install dominative-solid dominative @utls/undom-ef solid-js
15+
```
16+
17+
**Note:** `dominative`, `@utls/undom-ef`, `solid-js` are peer dependencies, you have to install them manually.
18+
19+
---
20+
21+
## Usage
22+
23+
```jsx
24+
import { Application } from "@nativescript/core"
25+
import { render } from "dominative-solid"
26+
import { createSignal } from "solid-js"
27+
28+
const App = () => {
29+
const [count, setCount] = createSignal(0)
30+
const increment = () => {
31+
setCount(c => c + 1)
32+
}
33+
return <>
34+
<actionbar title="Hello, SolidJS!"></actionbar>
35+
<stacklayout>
36+
<label>You have taapped {count()} time(s)</label>
37+
<button class="-primary" on:tap={increment}>Tap me!</button>
38+
</stacklayout>
39+
</>
40+
}
41+
42+
const create = () => {
43+
render(App, document.documentElement)
44+
return document
45+
}
46+
47+
Application.run({ create })
48+
49+
```
50+
51+
---
52+
53+
## Caveats
54+
55+
You have to patch the `exports` key in the `package.json` form `node_modules/solid-js`. It is recommended to use [patch-package](https://www.npmjs.com/package/patch-package) for patching.
56+
57+
For example:
58+
59+
```patch
60+
diff --git a/node_modules/solid-js/package.json b/node_modules/solid-js/package.json
61+
index b4c3656..47e362f 100644
62+
--- a/node_modules/solid-js/package.json
63+
+++ b/node_modules/solid-js/package.json
64+
@@ -44,48 +44,6 @@
65+
],
66+
"exports": {
67+
".": {
68+
- "browser": {
69+
- "development": {
70+
- "import": {
71+
- "types": "./types/index.d.ts",
72+
- "default": "./dist/dev.js"
73+
- },
74+
- "require": "./dist/dev.cjs"
75+
- },
76+
- "import": {
77+
- "types": "./types/index.d.ts",
78+
- "default": "./dist/solid.js"
79+
- },
80+
- "require": "./dist/solid.cjs"
81+
- },
82+
- "deno": {
83+
- "import": {
84+
- "types": "./types/index.d.ts",
85+
- "default": "./dist/server.js"
86+
- },
87+
- "require": "./dist/server.cjs"
88+
- },
89+
- "worker": {
90+
- "import": {
91+
- "types": "./types/index.d.ts",
92+
- "default": "./dist/server.js"
93+
- },
94+
- "require": "./dist/server.cjs"
95+
- },
96+
- "node": {
97+
- "import": {
98+
- "types": "./types/index.d.ts",
99+
- "default": "./dist/server.js"
100+
- },
101+
- "require": "./dist/server.cjs"
102+
- },
103+
- "development": {
104+
- "import": {
105+
- "types": "./types/index.d.ts",
106+
- "default": "./dist/dev.js"
107+
- },
108+
- "require": "./dist/dev.cjs"
109+
- },
110+
"import": {
111+
"types": "./types/index.d.ts",
112+
"default": "./dist/solid.js"
113+
```
114+
115+
## License
116+
117+
MIT

0 commit comments

Comments
 (0)