@nativescript/template-blank-solid-vision 8.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/App_Resources/visionOS/Assets.xcassets/AppIcon.solidimagestack/Back.solidimagestacklayer/Content.imageset/Back.png +0 -0
- package/App_Resources/visionOS/Assets.xcassets/AppIcon.solidimagestack/Back.solidimagestacklayer/Content.imageset/Contents.json +13 -0
- package/App_Resources/visionOS/Assets.xcassets/AppIcon.solidimagestack/Back.solidimagestacklayer/Contents.json +6 -0
- package/App_Resources/visionOS/Assets.xcassets/AppIcon.solidimagestack/Contents.json +17 -0
- package/App_Resources/visionOS/Assets.xcassets/AppIcon.solidimagestack/Front.solidimagestacklayer/Content.imageset/Contents.json +13 -0
- package/App_Resources/visionOS/Assets.xcassets/AppIcon.solidimagestack/Front.solidimagestacklayer/Content.imageset/Front.png +0 -0
- package/App_Resources/visionOS/Assets.xcassets/AppIcon.solidimagestack/Front.solidimagestacklayer/Contents.json +6 -0
- package/App_Resources/visionOS/Assets.xcassets/AppIcon.solidimagestack/Middle.solidimagestacklayer/Content.imageset/Contents.json +13 -0
- package/App_Resources/visionOS/Assets.xcassets/AppIcon.solidimagestack/Middle.solidimagestacklayer/Content.imageset/Middle.png +0 -0
- package/App_Resources/visionOS/Assets.xcassets/AppIcon.solidimagestack/Middle.solidimagestacklayer/Contents.json +6 -0
- package/App_Resources/visionOS/Assets.xcassets/Contents.json +6 -0
- package/App_Resources/visionOS/Info.plist +45 -0
- package/App_Resources/visionOS/build.xcconfig +3 -0
- package/App_Resources/visionOS/src/NativeScriptApp.swift +9 -0
- package/README.md +5 -0
- package/hooks/after-createProject/after-createProject.js +65 -0
- package/package.json +66 -0
- package/patches/@nativescript-community+solid-js+0.0.4-alpha.5.patch +233 -0
- package/patches/dominative+0.0.9-alpha.4.patch +746 -0
- package/src/app.css +3 -0
- package/src/app.tsx +73 -0
- package/src/assets/solid.png +0 -0
- package/src/components/collectionview.tsx +95 -0
- package/src/components/list.tsx +81 -0
- package/src/index.js +14 -0
- package/src/router.ts +14 -0
- package/src/routes/home.tsx +23 -0
- package/src/routes/settings.tsx +31 -0
- package/tailwind.config.js +15 -0
- package/tools/dot.gitignore +28 -0
- package/tools/vscode.extensions.json +3 -0
- package/tsconfig.json +35 -0
- package/webpack.config.js +9 -0
package/src/app.css
ADDED
package/src/app.tsx
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { CollectionView } from "@nativescript-community/ui-collectionview";
|
|
2
|
+
import { ItemLoadingEventData } from "@nativescript-dom/core-types";
|
|
3
|
+
import { Route, StackRouter } from "./router";
|
|
4
|
+
import { Home } from "./routes/home";
|
|
5
|
+
//@ts-ignore
|
|
6
|
+
import { makeListView, registerElement } from "dominative";
|
|
7
|
+
import { Settings } from "./routes/settings";
|
|
8
|
+
|
|
9
|
+
registerElement(
|
|
10
|
+
"collectionview",
|
|
11
|
+
makeListView(CollectionView, { force: true })
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
declare global {
|
|
15
|
+
interface HTMLCollectionViewElement extends HTMLListViewElement {}
|
|
16
|
+
|
|
17
|
+
var HTMLCollectionViewElement: {
|
|
18
|
+
prototype: HTMLCollectionViewElement;
|
|
19
|
+
new (): HTMLCollectionViewElement;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
interface HTMLCollectionViewElement extends HTMLListViewElement {}
|
|
23
|
+
|
|
24
|
+
var HTMLCollectionViewElement: {
|
|
25
|
+
prototype: HTMLCollectionViewElement;
|
|
26
|
+
new (): HTMLCollectionViewElement;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
declare module "@nativescript-dom/solidjs-types/jsx-runtime" {
|
|
31
|
+
export namespace JSX {
|
|
32
|
+
interface IntrinsicElements {
|
|
33
|
+
/**
|
|
34
|
+
* Register custom library view
|
|
35
|
+
*/
|
|
36
|
+
collectionview: Partial<
|
|
37
|
+
HTMLListViewElementAttributes<HTMLCollectionViewElement>
|
|
38
|
+
>;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Register dominative elements
|
|
42
|
+
*/
|
|
43
|
+
itemtemplate: Partial<
|
|
44
|
+
HTMLViewBaseElementAttributes & {
|
|
45
|
+
"on:createView": (event: ItemLoadingEventData) => void;
|
|
46
|
+
"on:itemLoading": (event: ItemLoadingEventData) => void;
|
|
47
|
+
key: string;
|
|
48
|
+
}
|
|
49
|
+
>;
|
|
50
|
+
arrayprop: Partial<
|
|
51
|
+
HTMLViewBaseElementAttributes & {
|
|
52
|
+
key: string;
|
|
53
|
+
}
|
|
54
|
+
>;
|
|
55
|
+
keyprop: Partial<
|
|
56
|
+
HTMLViewBaseElementAttributes & {
|
|
57
|
+
key: string;
|
|
58
|
+
}
|
|
59
|
+
>;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const App = () => {
|
|
65
|
+
return (
|
|
66
|
+
<StackRouter initialRouteName="Home">
|
|
67
|
+
<Route name="Home" component={Home as any} />
|
|
68
|
+
<Route name="Settings" component={Settings as any} />
|
|
69
|
+
</StackRouter>
|
|
70
|
+
);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export { App };
|
|
Binary file
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { JSX } from "@nativescript-dom/solidjs-types/jsx-runtime";
|
|
2
|
+
import { ContentView } from "@nativescript/core";
|
|
3
|
+
import {
|
|
4
|
+
children,
|
|
5
|
+
Component,
|
|
6
|
+
createSignal,
|
|
7
|
+
For,
|
|
8
|
+
getOwner,
|
|
9
|
+
Owner,
|
|
10
|
+
runWithOwner,
|
|
11
|
+
} from "solid-js";
|
|
12
|
+
|
|
13
|
+
export const DynamicList: Component<
|
|
14
|
+
{
|
|
15
|
+
renderItem: (props: { item: any; index: any; type: any }) => any;
|
|
16
|
+
items: any[];
|
|
17
|
+
onItemType: (item: any, index: any) => string;
|
|
18
|
+
itemTypes: string[];
|
|
19
|
+
} & Omit<
|
|
20
|
+
JSX.IntrinsicElements["collectionview"],
|
|
21
|
+
"itemTemplateSelector" | "items" | "itemTemplates" | "itemTemplate"
|
|
22
|
+
>
|
|
23
|
+
> = (props) => {
|
|
24
|
+
const owner = getOwner();
|
|
25
|
+
const { items, renderItem, onItemType, itemTypes, ...restProps } = props;
|
|
26
|
+
const templates = props.itemTypes || ["_default"];
|
|
27
|
+
return (
|
|
28
|
+
<contentview
|
|
29
|
+
style={{
|
|
30
|
+
width: "100%",
|
|
31
|
+
height: "100%",
|
|
32
|
+
flexGrow: 1,
|
|
33
|
+
}}
|
|
34
|
+
>
|
|
35
|
+
<collectionview
|
|
36
|
+
{...restProps}
|
|
37
|
+
items={{
|
|
38
|
+
length: props.items?.length,
|
|
39
|
+
getItem(index: number) {
|
|
40
|
+
return {
|
|
41
|
+
index: props.items?.[index],
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
}}
|
|
45
|
+
itemTemplateSelector={(item: any, index: any) => {
|
|
46
|
+
return onItemType?.(item, index) || "_default";
|
|
47
|
+
}}
|
|
48
|
+
>
|
|
49
|
+
<arrayprop key="itemTemplates">
|
|
50
|
+
<For each={templates}>
|
|
51
|
+
{(key) => (
|
|
52
|
+
<itemtemplate
|
|
53
|
+
key={key}
|
|
54
|
+
on:itemLoading={(event: any) => {
|
|
55
|
+
const { view, item, index } = event;
|
|
56
|
+
const update_solid_context = (view as any)
|
|
57
|
+
.__update_solid_context;
|
|
58
|
+
if (update_solid_context) {
|
|
59
|
+
update_solid_context(item, index, key);
|
|
60
|
+
} else {
|
|
61
|
+
runWithOwner(owner as Owner, () => {
|
|
62
|
+
const [item, setItem] = createSignal(event.item);
|
|
63
|
+
const [index, setIndex] = createSignal<number>(
|
|
64
|
+
event.index || 0
|
|
65
|
+
);
|
|
66
|
+
const [type, setType] = createSignal<string>(key);
|
|
67
|
+
const element = children(() =>
|
|
68
|
+
renderItem({ item, index, type: type })
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
(event.view as ContentView).content = element() as never;
|
|
72
|
+
|
|
73
|
+
(event.view as any).__update_solid_context = (
|
|
74
|
+
item: any,
|
|
75
|
+
index: number,
|
|
76
|
+
type: string
|
|
77
|
+
) => {
|
|
78
|
+
setItem(item);
|
|
79
|
+
setIndex(index);
|
|
80
|
+
setType(type);
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}}
|
|
85
|
+
on:createView={(event: any) => {
|
|
86
|
+
event.view = document.createElement("ContentView") as any;
|
|
87
|
+
}}
|
|
88
|
+
/>
|
|
89
|
+
)}
|
|
90
|
+
</For>
|
|
91
|
+
</arrayprop>
|
|
92
|
+
</collectionview>
|
|
93
|
+
</contentview>
|
|
94
|
+
);
|
|
95
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { JSX } from "@nativescript-dom/solidjs-types/jsx-runtime";
|
|
2
|
+
import {
|
|
3
|
+
children,
|
|
4
|
+
createSignal,
|
|
5
|
+
getOwner,
|
|
6
|
+
Owner,
|
|
7
|
+
runWithOwner,
|
|
8
|
+
Component,
|
|
9
|
+
For,
|
|
10
|
+
} from "solid-js";
|
|
11
|
+
|
|
12
|
+
export const List: Component<
|
|
13
|
+
{
|
|
14
|
+
renderItem: (props: { item: any; index: any; type: any }) => any;
|
|
15
|
+
items: any[];
|
|
16
|
+
onItemType: (item: any, index: any) => string;
|
|
17
|
+
itemTypes: string[];
|
|
18
|
+
} & Omit<
|
|
19
|
+
JSX.IntrinsicElements["listview"],
|
|
20
|
+
"itemTemplateSelector" | "items" | "itemTemplates" | "itemTemplate"
|
|
21
|
+
>
|
|
22
|
+
> = (props) => {
|
|
23
|
+
const owner = getOwner();
|
|
24
|
+
const { items, renderItem, onItemType, itemTypes, ...restProps } = props;
|
|
25
|
+
const templates = props.itemTypes || ["_default"];
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<listview
|
|
29
|
+
{...restProps}
|
|
30
|
+
items={{
|
|
31
|
+
length: props.items?.length,
|
|
32
|
+
getItem(index) {
|
|
33
|
+
return {
|
|
34
|
+
index: props.items?.[index],
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
}}
|
|
38
|
+
itemTemplateSelector={(item, index) => {
|
|
39
|
+
return onItemType?.(item, index) || "_default";
|
|
40
|
+
}}
|
|
41
|
+
>
|
|
42
|
+
<arrayprop key="itemTemplates">
|
|
43
|
+
<For each={templates}>
|
|
44
|
+
{(key) => (
|
|
45
|
+
<itemtemplate
|
|
46
|
+
key={key}
|
|
47
|
+
on:itemLoading={(event) => {
|
|
48
|
+
const { view, item, index } = event;
|
|
49
|
+
const update_solid_context = (view as any)
|
|
50
|
+
.__update_solid_context;
|
|
51
|
+
if (update_solid_context) {
|
|
52
|
+
update_solid_context(item, index, key);
|
|
53
|
+
}
|
|
54
|
+
}}
|
|
55
|
+
on:createView={(event) => {
|
|
56
|
+
runWithOwner(owner as Owner, () => {
|
|
57
|
+
const [item, setItem] = createSignal();
|
|
58
|
+
const [index, setIndex] = createSignal<number>(0);
|
|
59
|
+
const [type, setType] = createSignal<string>(key);
|
|
60
|
+
const element = children(() =>
|
|
61
|
+
renderItem({ item, index, type: type })
|
|
62
|
+
);
|
|
63
|
+
event.view = element() as never;
|
|
64
|
+
(event.view as any).__update_solid_context = (
|
|
65
|
+
item: any,
|
|
66
|
+
index: number,
|
|
67
|
+
type: string
|
|
68
|
+
) => {
|
|
69
|
+
setItem(item);
|
|
70
|
+
setIndex(index);
|
|
71
|
+
setType(type);
|
|
72
|
+
};
|
|
73
|
+
});
|
|
74
|
+
}}
|
|
75
|
+
/>
|
|
76
|
+
)}
|
|
77
|
+
</For>
|
|
78
|
+
</arrayprop>
|
|
79
|
+
</listview>
|
|
80
|
+
);
|
|
81
|
+
};
|
package/src/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Application } from "@nativescript/core";
|
|
2
|
+
import { render } from "@nativescript-community/solid-js";
|
|
3
|
+
import { App } from "./app";
|
|
4
|
+
import { document } from "dominative";
|
|
5
|
+
|
|
6
|
+
document.body.actionBarHidden = true;
|
|
7
|
+
document.body.appendChild(document.createElement("ContentView"));
|
|
8
|
+
|
|
9
|
+
render(App, document.body.firstElementChild);
|
|
10
|
+
|
|
11
|
+
const create = () => document;
|
|
12
|
+
|
|
13
|
+
Application.run({ create });
|
|
14
|
+
|
package/src/router.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createStackRouter, RouteDefinition } from "solid-navigation";
|
|
2
|
+
|
|
3
|
+
declare module "solid-navigation" {
|
|
4
|
+
export interface Routers {
|
|
5
|
+
Default: {
|
|
6
|
+
Home: RouteDefinition;
|
|
7
|
+
Settings: RouteDefinition;
|
|
8
|
+
Feed: RouteDefinition;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const { Route, StackRouter, useParams, useRouter } =
|
|
14
|
+
createStackRouter<"Default">();
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useRouter } from "../router";
|
|
2
|
+
|
|
3
|
+
export const Home = () => {
|
|
4
|
+
const router = useRouter();
|
|
5
|
+
|
|
6
|
+
return (
|
|
7
|
+
<>
|
|
8
|
+
<actionbar title="Home"/>
|
|
9
|
+
{/* @ts-ignore */}
|
|
10
|
+
<gridlayout rows="*,auto,*">
|
|
11
|
+
<button
|
|
12
|
+
row="1"
|
|
13
|
+
className="rounded-full bg-blue-500 text-white w-[300] p-3 text-2xl font-bold h-[60] text-center capitalize" iosOverflowSafeArea="false"
|
|
14
|
+
text="View Settings"
|
|
15
|
+
on:tap={() => {
|
|
16
|
+
router.navigate("Settings");
|
|
17
|
+
}}
|
|
18
|
+
/>
|
|
19
|
+
<image rowSpan="3" src="~/assets/solid.png" width="100" height="100" className="align-bottom mb-2" />
|
|
20
|
+
</gridlayout>
|
|
21
|
+
</>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useRouter } from "../router";
|
|
2
|
+
|
|
3
|
+
export const Settings = () => {
|
|
4
|
+
const router = useRouter();
|
|
5
|
+
return (
|
|
6
|
+
<>
|
|
7
|
+
<actionbar title="Settings" />
|
|
8
|
+
<flexboxlayout
|
|
9
|
+
style={{
|
|
10
|
+
height: "100%",
|
|
11
|
+
width: "100%",
|
|
12
|
+
flexDirection: "column",
|
|
13
|
+
justifyContent: "center",
|
|
14
|
+
alignItems: "center",
|
|
15
|
+
}}
|
|
16
|
+
>
|
|
17
|
+
<button
|
|
18
|
+
text="Go to Home"
|
|
19
|
+
on:tap={() => {
|
|
20
|
+
router.goBack();
|
|
21
|
+
}}
|
|
22
|
+
style={{
|
|
23
|
+
height: 40,
|
|
24
|
+
width: 150,
|
|
25
|
+
borderRadius: "10px",
|
|
26
|
+
}}
|
|
27
|
+
/>
|
|
28
|
+
</flexboxlayout>
|
|
29
|
+
</>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** @type {import('tailwindcss').Config} */
|
|
2
|
+
module.exports = {
|
|
3
|
+
content: ['./src/**/*.{css,xml,html,vue,svelte,ts,tsx}'],
|
|
4
|
+
// use the .ns-dark class to control dark mode (applied by NativeScript) - since 'media' (default) is not supported.
|
|
5
|
+
darkMode: ['class', '.ns-dark'],
|
|
6
|
+
theme: {
|
|
7
|
+
extend: {},
|
|
8
|
+
},
|
|
9
|
+
plugins: [],
|
|
10
|
+
corePlugins: {
|
|
11
|
+
preflight: false, // disables browser-specific resets
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# NativeScript
|
|
2
|
+
hooks/
|
|
3
|
+
node_modules/
|
|
4
|
+
platforms/
|
|
5
|
+
|
|
6
|
+
# Logs
|
|
7
|
+
logs
|
|
8
|
+
*.log
|
|
9
|
+
npm-debug.log*
|
|
10
|
+
yarn-debug.log*
|
|
11
|
+
yarn-error.log*
|
|
12
|
+
|
|
13
|
+
# General
|
|
14
|
+
.DS_Store
|
|
15
|
+
.AppleDouble
|
|
16
|
+
.LSOverride
|
|
17
|
+
.idea
|
|
18
|
+
.cloud
|
|
19
|
+
.project
|
|
20
|
+
tmp/
|
|
21
|
+
typings/
|
|
22
|
+
|
|
23
|
+
# Visual Studio Code
|
|
24
|
+
.vscode/*
|
|
25
|
+
!.vscode/settings.json
|
|
26
|
+
!.vscode/tasks.json
|
|
27
|
+
!.vscode/launch.json
|
|
28
|
+
!.vscode/extensions.json
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"strict": true,
|
|
4
|
+
"target": "es2017",
|
|
5
|
+
"module": "esnext",
|
|
6
|
+
"moduleResolution": "node",
|
|
7
|
+
"lib": ["es2017", "DOM"],
|
|
8
|
+
"sourceMap": true,
|
|
9
|
+
"jsx": "preserve",
|
|
10
|
+
"jsxImportSource": "@nativescript-dom/solidjs-types",
|
|
11
|
+
"noEmitHelpers": true,
|
|
12
|
+
"importHelpers": true,
|
|
13
|
+
"baseUrl": ".",
|
|
14
|
+
"paths": {
|
|
15
|
+
"~/*": ["src/*"],
|
|
16
|
+
"@/*": ["src/*"]
|
|
17
|
+
},
|
|
18
|
+
"allowJs": true,
|
|
19
|
+
"types": [
|
|
20
|
+
"node",
|
|
21
|
+
"@nativescript-dom/core-types",
|
|
22
|
+
"@nativescript-dom/solidjs-types"
|
|
23
|
+
],
|
|
24
|
+
"allowSyntheticDefaultImports": true,
|
|
25
|
+
"esModuleInterop": true,
|
|
26
|
+
"experimentalDecorators": true,
|
|
27
|
+
"emitDecoratorMetadata": true,
|
|
28
|
+
"skipLibCheck": true,
|
|
29
|
+
"outDir": "dist",
|
|
30
|
+
"downlevelIteration": true,
|
|
31
|
+
"maxNodeModuleJsDepth": 5
|
|
32
|
+
},
|
|
33
|
+
"include": ["src"],
|
|
34
|
+
"exclude": ["node_modules", "platforms"]
|
|
35
|
+
}
|