@ruby-native/vue 0.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/index.js +109 -0
- package/package.json +21 -0
package/index.js
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { defineComponent, h } from "vue"
|
|
2
|
+
|
|
3
|
+
import("@inertiajs/vue3").then(m => { window.__inertiaRouter = m.router }).catch(() => {})
|
|
4
|
+
|
|
5
|
+
export const NativeTabs = defineComponent({
|
|
6
|
+
name: "NativeTabs",
|
|
7
|
+
props: {
|
|
8
|
+
enabled: { type: Boolean, default: true }
|
|
9
|
+
},
|
|
10
|
+
render() {
|
|
11
|
+
if (!this.enabled) return null
|
|
12
|
+
return h("div", { "data-native-tabs": true, hidden: true })
|
|
13
|
+
}
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
export const NativePush = defineComponent({
|
|
17
|
+
name: "NativePush",
|
|
18
|
+
render() {
|
|
19
|
+
return h("div", { "data-native-push": true, hidden: true })
|
|
20
|
+
}
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
export const NativeForm = defineComponent({
|
|
24
|
+
name: "NativeForm",
|
|
25
|
+
render() {
|
|
26
|
+
return h("div", { "data-native-form": true, hidden: true })
|
|
27
|
+
}
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
export const NativeNavbar = defineComponent({
|
|
31
|
+
name: "NativeNavbar",
|
|
32
|
+
props: { title: { type: String, required: true } },
|
|
33
|
+
render() {
|
|
34
|
+
return h("div", { "data-native-navbar": this.title, hidden: true }, this.$slots.default?.())
|
|
35
|
+
}
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
export const NativeButton = defineComponent({
|
|
39
|
+
name: "NativeButton",
|
|
40
|
+
props: {
|
|
41
|
+
position: { type: String, default: "trailing" },
|
|
42
|
+
icon: String,
|
|
43
|
+
title: String,
|
|
44
|
+
href: String,
|
|
45
|
+
click: String,
|
|
46
|
+
selected: { type: Boolean, default: undefined }
|
|
47
|
+
},
|
|
48
|
+
render() {
|
|
49
|
+
const attrs = { "data-native-button": true }
|
|
50
|
+
if (this.icon) attrs["data-native-icon"] = this.icon
|
|
51
|
+
if (this.title) attrs["data-native-title"] = this.title
|
|
52
|
+
if (this.href) attrs["data-native-href"] = this.href
|
|
53
|
+
if (this.click) attrs["data-native-click"] = this.click
|
|
54
|
+
if (this.position) attrs["data-native-position"] = this.position
|
|
55
|
+
if (this.selected) attrs["data-native-selected"] = ""
|
|
56
|
+
return h("div", attrs, this.$slots.default?.())
|
|
57
|
+
}
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
export const NativeMenuItem = defineComponent({
|
|
61
|
+
name: "NativeMenuItem",
|
|
62
|
+
props: {
|
|
63
|
+
title: String,
|
|
64
|
+
href: String,
|
|
65
|
+
click: String,
|
|
66
|
+
icon: String,
|
|
67
|
+
selected: { type: Boolean, default: undefined }
|
|
68
|
+
},
|
|
69
|
+
render() {
|
|
70
|
+
const attrs = { "data-native-menu-item": true }
|
|
71
|
+
if (this.title) attrs["data-native-title"] = this.title
|
|
72
|
+
if (this.href) attrs["data-native-href"] = this.href
|
|
73
|
+
if (this.click) attrs["data-native-click"] = this.click
|
|
74
|
+
if (this.icon) attrs["data-native-icon"] = this.icon
|
|
75
|
+
if (this.selected) attrs["data-native-selected"] = ""
|
|
76
|
+
return h("div", attrs)
|
|
77
|
+
}
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
export const NativeOverscroll = defineComponent({
|
|
81
|
+
name: "NativeOverscroll",
|
|
82
|
+
props: {
|
|
83
|
+
top: { type: String, required: true },
|
|
84
|
+
bottom: String
|
|
85
|
+
},
|
|
86
|
+
render() {
|
|
87
|
+
return h("div", {
|
|
88
|
+
"data-native-overscroll-top": this.top,
|
|
89
|
+
"data-native-overscroll-bottom": this.bottom || this.top,
|
|
90
|
+
hidden: true
|
|
91
|
+
})
|
|
92
|
+
}
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
export const NativeSubmitButton = defineComponent({
|
|
96
|
+
name: "NativeSubmitButton",
|
|
97
|
+
props: {
|
|
98
|
+
title: { type: String, default: "Save" },
|
|
99
|
+
click: { type: String, default: "[type='submit']" }
|
|
100
|
+
},
|
|
101
|
+
render() {
|
|
102
|
+
return h("div", {
|
|
103
|
+
"data-native-submit-button": true,
|
|
104
|
+
"data-native-title": this.title,
|
|
105
|
+
"data-native-click": this.click,
|
|
106
|
+
hidden: true
|
|
107
|
+
})
|
|
108
|
+
}
|
|
109
|
+
})
|
package/package.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ruby-native/vue",
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"description": "Vue components for Ruby Native",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"files": ["index.js"],
|
|
7
|
+
"peerDependencies": {
|
|
8
|
+
"vue": ">=3",
|
|
9
|
+
"@inertiajs/vue3": ">=2"
|
|
10
|
+
},
|
|
11
|
+
"peerDependenciesMeta": {
|
|
12
|
+
"@inertiajs/vue3": { "optional": true }
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/ruby-native/gem.git",
|
|
17
|
+
"directory": "packages/vue"
|
|
18
|
+
},
|
|
19
|
+
"homepage": "https://rubynative.com",
|
|
20
|
+
"license": "MIT"
|
|
21
|
+
}
|