linked-data-browser 0.0.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.
Files changed (91) hide show
  1. package/.eslintrc.js +13 -0
  2. package/.ldo/profile.context.ts +459 -0
  3. package/.ldo/profile.schema.ts +751 -0
  4. package/.ldo/profile.shapeTypes.ts +71 -0
  5. package/.ldo/profile.typings.ts +295 -0
  6. package/.prettierignore +6 -0
  7. package/.prettierrc +10 -0
  8. package/.shapes/profile.shex +121 -0
  9. package/README.md +3 -0
  10. package/app/index.tsx +25 -0
  11. package/app.json +37 -0
  12. package/assets/images/adaptive-icon.png +0 -0
  13. package/assets/images/favicon.png +0 -0
  14. package/assets/images/icon.png +0 -0
  15. package/assets/images/splash.png +0 -0
  16. package/babel.config.js +6 -0
  17. package/components/DataBrowser.tsx +57 -0
  18. package/components/ResourceView.tsx +14 -0
  19. package/components/TargetResourceProvider.tsx +128 -0
  20. package/components/ThemeProvider.tsx +123 -0
  21. package/components/nav/DialogProvider.tsx +140 -0
  22. package/components/nav/Layout.tsx +118 -0
  23. package/components/nav/header/AddressBox.tsx +126 -0
  24. package/components/nav/header/AvatarMenu.tsx +62 -0
  25. package/components/nav/header/Header.tsx +28 -0
  26. package/components/nav/header/SignInMenu.tsx +126 -0
  27. package/components/nav/header/ThemeToggleMenu.tsx +34 -0
  28. package/components/nav/header/ViewMenu.tsx +88 -0
  29. package/components/nav/useValidView.tsx +51 -0
  30. package/components/nav/utilityResourceViews/ErrorMessageResourceView.tsx +26 -0
  31. package/components/ui/avatar.tsx +53 -0
  32. package/components/ui/button.tsx +88 -0
  33. package/components/ui/card.tsx +101 -0
  34. package/components/ui/dialog.tsx +159 -0
  35. package/components/ui/dropdown-menu.tsx +275 -0
  36. package/components/ui/input.tsx +25 -0
  37. package/components/ui/label.tsx +34 -0
  38. package/components/ui/navigation-menu.tsx +200 -0
  39. package/components/ui/popover.tsx +45 -0
  40. package/components/ui/progress.tsx +79 -0
  41. package/components/ui/radio-group.tsx +59 -0
  42. package/components/ui/separator.tsx +27 -0
  43. package/components/ui/switch.tsx +105 -0
  44. package/components/ui/text.tsx +30 -0
  45. package/components/ui/tooltip.tsx +46 -0
  46. package/components.json +7 -0
  47. package/global.css +61 -0
  48. package/index.js +12 -0
  49. package/lib/android-navigation-bar.ts +11 -0
  50. package/lib/constants.ts +18 -0
  51. package/lib/icons/ArrowRight.tsx +4 -0
  52. package/lib/icons/Check.tsx +4 -0
  53. package/lib/icons/ChevronDown.tsx +4 -0
  54. package/lib/icons/ChevronRight.tsx +4 -0
  55. package/lib/icons/ChevronUp.tsx +4 -0
  56. package/lib/icons/ChevronsRight.tsx +4 -0
  57. package/lib/icons/CircleSlash.tsx +4 -0
  58. package/lib/icons/CircleX.tsx +4 -0
  59. package/lib/icons/Code.tsx +4 -0
  60. package/lib/icons/EllipsisVertical.tsx +4 -0
  61. package/lib/icons/EyeOff.tsx +4 -0
  62. package/lib/icons/File.tsx +4 -0
  63. package/lib/icons/Folder.tsx +4 -0
  64. package/lib/icons/Folders.tsx +4 -0
  65. package/lib/icons/Info.tsx +4 -0
  66. package/lib/icons/MonitorSmartphone.tsx +4 -0
  67. package/lib/icons/MoonStar.tsx +4 -0
  68. package/lib/icons/OctagonX.tsx +4 -0
  69. package/lib/icons/RefreshCw.tsx +4 -0
  70. package/lib/icons/ShieldX.tsx +4 -0
  71. package/lib/icons/Sun.tsx +4 -0
  72. package/lib/icons/TextCursorInput.tsx +4 -0
  73. package/lib/icons/Trash.tsx +4 -0
  74. package/lib/icons/ViewIcon.tsx +4 -0
  75. package/lib/icons/X.tsx +4 -0
  76. package/lib/icons/iconWithClassName.ts +14 -0
  77. package/lib/utils.ts +6 -0
  78. package/metro.config.js +6 -0
  79. package/nativewind-env.d.ts +1 -0
  80. package/package.json +89 -0
  81. package/resourceViews/Container/ContainerConfig.tsx +13 -0
  82. package/resourceViews/Container/ContainerView.tsx +148 -0
  83. package/resourceViews/RawCode/RawCodeConfig.tsx +11 -0
  84. package/resourceViews/RawCode/RawCodeEditor.tsx +37 -0
  85. package/resourceViews/RawCode/RawCodeView.tsx +67 -0
  86. package/scripts/adjust-server-paths.js +37 -0
  87. package/scripts/adjust-standalone-paths.js +28 -0
  88. package/tailwind.config.js +69 -0
  89. package/test-server/server-config.json +75 -0
  90. package/test-server/solid-css-seed.json +11 -0
  91. package/tsconfig.json +19 -0
@@ -0,0 +1,71 @@
1
+ import { ShapeType } from "@ldo/ldo";
2
+ import { profileSchema } from "./profile.schema";
3
+ import { profileContext } from "./profile.context";
4
+ import {
5
+ SolidProfileShape,
6
+ AddressShape,
7
+ EmailShape,
8
+ PhoneNumberShape,
9
+ TrustedAppShape,
10
+ RSAPublicKeyShape,
11
+ } from "./profile.typings";
12
+
13
+ /**
14
+ * =============================================================================
15
+ * LDO ShapeTypes profile
16
+ * =============================================================================
17
+ */
18
+
19
+ /**
20
+ * SolidProfileShape ShapeType
21
+ */
22
+ export const SolidProfileShapeShapeType: ShapeType<SolidProfileShape> = {
23
+ schema: profileSchema,
24
+ shape: "https://shaperepo.com/schemas/solidProfile#SolidProfileShape",
25
+ context: profileContext,
26
+ };
27
+
28
+ /**
29
+ * AddressShape ShapeType
30
+ */
31
+ export const AddressShapeShapeType: ShapeType<AddressShape> = {
32
+ schema: profileSchema,
33
+ shape: "https://shaperepo.com/schemas/solidProfile#AddressShape",
34
+ context: profileContext,
35
+ };
36
+
37
+ /**
38
+ * EmailShape ShapeType
39
+ */
40
+ export const EmailShapeShapeType: ShapeType<EmailShape> = {
41
+ schema: profileSchema,
42
+ shape: "https://shaperepo.com/schemas/solidProfile#EmailShape",
43
+ context: profileContext,
44
+ };
45
+
46
+ /**
47
+ * PhoneNumberShape ShapeType
48
+ */
49
+ export const PhoneNumberShapeShapeType: ShapeType<PhoneNumberShape> = {
50
+ schema: profileSchema,
51
+ shape: "https://shaperepo.com/schemas/solidProfile#PhoneNumberShape",
52
+ context: profileContext,
53
+ };
54
+
55
+ /**
56
+ * TrustedAppShape ShapeType
57
+ */
58
+ export const TrustedAppShapeShapeType: ShapeType<TrustedAppShape> = {
59
+ schema: profileSchema,
60
+ shape: "https://shaperepo.com/schemas/solidProfile#TrustedAppShape",
61
+ context: profileContext,
62
+ };
63
+
64
+ /**
65
+ * RSAPublicKeyShape ShapeType
66
+ */
67
+ export const RSAPublicKeyShapeShapeType: ShapeType<RSAPublicKeyShape> = {
68
+ schema: profileSchema,
69
+ shape: "https://shaperepo.com/schemas/solidProfile#RSAPublicKeyShape",
70
+ context: profileContext,
71
+ };
@@ -0,0 +1,295 @@
1
+ import { LdoJsonldContext, LdSet } from "@ldo/ldo";
2
+
3
+ /**
4
+ * =============================================================================
5
+ * Typescript Typings for profile
6
+ * =============================================================================
7
+ */
8
+
9
+ /**
10
+ * SolidProfileShape Type
11
+ */
12
+ export interface SolidProfileShape {
13
+ "@id"?: string;
14
+ "@context"?: LdoJsonldContext;
15
+ /**
16
+ * Defines the node as a Person (from Schema.org) | Defines the node as a Person (from foaf)
17
+ */
18
+ type: LdSet<
19
+ | {
20
+ "@id": "Person";
21
+ }
22
+ | {
23
+ "@id": "Person2";
24
+ }
25
+ >;
26
+ /**
27
+ * The formatted name of a person. Example: John Smith
28
+ */
29
+ fn?: string;
30
+ /**
31
+ * An alternate way to define a person's name.
32
+ */
33
+ name?: string;
34
+ /**
35
+ * The person's street address.
36
+ */
37
+ hasAddress?: LdSet<AddressShape>;
38
+ /**
39
+ * The person's email.
40
+ */
41
+ hasEmail?: LdSet<EmailShape>;
42
+ /**
43
+ * A link to the person's photo
44
+ */
45
+ hasPhoto?: {
46
+ "@id": string;
47
+ };
48
+ /**
49
+ * Photo link but in string form
50
+ */
51
+ img?: string;
52
+ /**
53
+ * Person's telephone number
54
+ */
55
+ hasTelephone?: LdSet<PhoneNumberShape>;
56
+ /**
57
+ * An alternative way to define a person's telephone number using a string
58
+ */
59
+ phone?: string;
60
+ /**
61
+ * The name of the organization with which the person is affiliated
62
+ */
63
+ organizationName?: string;
64
+ /**
65
+ * The name of the person's role in their organization
66
+ */
67
+ role?: string;
68
+ /**
69
+ * A list of app origins that are trusted by this user
70
+ */
71
+ trustedApp?: LdSet<TrustedAppShape>;
72
+ /**
73
+ * A list of RSA public keys that are associated with private keys the user holds.
74
+ */
75
+ key?: LdSet<RSAPublicKeyShape>;
76
+ /**
77
+ * The user's LDP inbox to which apps can post notifications
78
+ */
79
+ inbox: {
80
+ "@id": string;
81
+ };
82
+ /**
83
+ * The user's preferences
84
+ */
85
+ preferencesFile?: {
86
+ "@id": string;
87
+ };
88
+ /**
89
+ * The location of a Solid storage server related to this WebId
90
+ */
91
+ storage?: LdSet<{
92
+ "@id": string;
93
+ }>;
94
+ /**
95
+ * The user's account
96
+ */
97
+ account?: {
98
+ "@id": string;
99
+ };
100
+ /**
101
+ * A registry of all types used on the user's Pod (for private access only)
102
+ */
103
+ privateTypeIndex?: LdSet<{
104
+ "@id": string;
105
+ }>;
106
+ /**
107
+ * A registry of all types used on the user's Pod (for public access)
108
+ */
109
+ publicTypeIndex?: LdSet<{
110
+ "@id": string;
111
+ }>;
112
+ /**
113
+ * A list of WebIds for all the people this user knows.
114
+ */
115
+ knows?: LdSet<{
116
+ "@id": string;
117
+ }>;
118
+ }
119
+
120
+ /**
121
+ * AddressShape Type
122
+ */
123
+ export interface AddressShape {
124
+ "@id"?: string;
125
+ "@context"?: LdoJsonldContext;
126
+ /**
127
+ * The name of the user's country of residence
128
+ */
129
+ countryName?: string;
130
+ /**
131
+ * The name of the user's locality (City, Town etc.) of residence
132
+ */
133
+ locality?: string;
134
+ /**
135
+ * The user's postal code
136
+ */
137
+ postalCode?: string;
138
+ /**
139
+ * The name of the user's region (State, Province etc.) of residence
140
+ */
141
+ region?: string;
142
+ /**
143
+ * The user's street address
144
+ */
145
+ streetAddress?: string;
146
+ }
147
+
148
+ /**
149
+ * EmailShape Type
150
+ */
151
+ export interface EmailShape {
152
+ "@id"?: string;
153
+ "@context"?: LdoJsonldContext;
154
+ /**
155
+ * The type of email.
156
+ */
157
+ type?:
158
+ | {
159
+ "@id": "Dom";
160
+ }
161
+ | {
162
+ "@id": "Home";
163
+ }
164
+ | {
165
+ "@id": "ISDN";
166
+ }
167
+ | {
168
+ "@id": "Internet";
169
+ }
170
+ | {
171
+ "@id": "Intl";
172
+ }
173
+ | {
174
+ "@id": "Label";
175
+ }
176
+ | {
177
+ "@id": "Parcel";
178
+ }
179
+ | {
180
+ "@id": "Postal";
181
+ }
182
+ | {
183
+ "@id": "Pref";
184
+ }
185
+ | {
186
+ "@id": "Work";
187
+ }
188
+ | {
189
+ "@id": "X400";
190
+ };
191
+ /**
192
+ * The value of an email as a mailto link (Example <mailto:jane@example.com>)
193
+ */
194
+ value: {
195
+ "@id": string;
196
+ };
197
+ }
198
+
199
+ /**
200
+ * PhoneNumberShape Type
201
+ */
202
+ export interface PhoneNumberShape {
203
+ "@id"?: string;
204
+ "@context"?: LdoJsonldContext;
205
+ /**
206
+ * They type of Phone Number
207
+ */
208
+ type?:
209
+ | {
210
+ "@id": "Dom";
211
+ }
212
+ | {
213
+ "@id": "Home";
214
+ }
215
+ | {
216
+ "@id": "ISDN";
217
+ }
218
+ | {
219
+ "@id": "Internet";
220
+ }
221
+ | {
222
+ "@id": "Intl";
223
+ }
224
+ | {
225
+ "@id": "Label";
226
+ }
227
+ | {
228
+ "@id": "Parcel";
229
+ }
230
+ | {
231
+ "@id": "Postal";
232
+ }
233
+ | {
234
+ "@id": "Pref";
235
+ }
236
+ | {
237
+ "@id": "Work";
238
+ }
239
+ | {
240
+ "@id": "X400";
241
+ };
242
+ /**
243
+ * The value of a phone number as a tel link (Example <tel:555-555-5555>)
244
+ */
245
+ value: {
246
+ "@id": string;
247
+ };
248
+ }
249
+
250
+ /**
251
+ * TrustedAppShape Type
252
+ */
253
+ export interface TrustedAppShape {
254
+ "@id"?: string;
255
+ "@context"?: LdoJsonldContext;
256
+ /**
257
+ * The level of access provided to this origin
258
+ */
259
+ mode: LdSet<
260
+ | {
261
+ "@id": "Append";
262
+ }
263
+ | {
264
+ "@id": "Control";
265
+ }
266
+ | {
267
+ "@id": "Read";
268
+ }
269
+ | {
270
+ "@id": "Write";
271
+ }
272
+ >;
273
+ /**
274
+ * The app origin the user trusts
275
+ */
276
+ origin: {
277
+ "@id": string;
278
+ };
279
+ }
280
+
281
+ /**
282
+ * RSAPublicKeyShape Type
283
+ */
284
+ export interface RSAPublicKeyShape {
285
+ "@id"?: string;
286
+ "@context"?: LdoJsonldContext;
287
+ /**
288
+ * RSA Modulus
289
+ */
290
+ modulus: string;
291
+ /**
292
+ * RSA Exponent
293
+ */
294
+ exponent: number;
295
+ }
@@ -0,0 +1,6 @@
1
+ node_modules
2
+ android
3
+ ios
4
+ build
5
+ dist
6
+ coverage
package/.prettierrc ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "semi": true,
3
+ "singleQuote": true,
4
+ "trailingComma": "all",
5
+ "printWidth": 80,
6
+ "tabWidth": 2,
7
+ "bracketSpacing": true,
8
+ "jsxBracketSameLine": false,
9
+ "arrowParens": "always"
10
+ }
@@ -0,0 +1,121 @@
1
+ PREFIX srs: <https://shaperepo.com/schemas/solidProfile#>
2
+ PREFIX foaf: <http://xmlns.com/foaf/0.1/>
3
+ PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
4
+ PREFIX schem: <http://schema.org/>
5
+ PREFIX vcard: <http://www.w3.org/2006/vcard/ns#>
6
+ PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
7
+ PREFIX acl: <http://www.w3.org/ns/auth/acl#>
8
+ PREFIX cert: <http://www.w3.org/ns/auth/cert#>
9
+ PREFIX ldp: <http://www.w3.org/ns/ldp#>
10
+ PREFIX sp: <http://www.w3.org/ns/pim/space#>
11
+ PREFIX solid: <http://www.w3.org/ns/solid/terms#>
12
+
13
+ srs:SolidProfileShape EXTRA a {
14
+ a [ schem:Person ]
15
+ // rdfs:comment "Defines the node as a Person (from Schema.org)" ;
16
+ a [ foaf:Person ]
17
+ // rdfs:comment "Defines the node as a Person (from foaf)" ;
18
+ vcard:fn xsd:string ?
19
+ // rdfs:comment "The formatted name of a person. Example: John Smith" ;
20
+ foaf:name xsd:string ?
21
+ // rdfs:comment "An alternate way to define a person's name." ;
22
+ vcard:hasAddress @srs:AddressShape *
23
+ // rdfs:comment "The person's street address." ;
24
+ vcard:hasEmail @srs:EmailShape *
25
+ // rdfs:comment "The person's email." ;
26
+ vcard:hasPhoto IRI ?
27
+ // rdfs:comment "A link to the person's photo" ;
28
+ foaf:img xsd:string ?
29
+ // rdfs:comment "Photo link but in string form" ;
30
+ vcard:hasTelephone @srs:PhoneNumberShape *
31
+ // rdfs:comment "Person's telephone number" ;
32
+ vcard:phone xsd:string ?
33
+ // rdfs:comment "An alternative way to define a person's telephone number using a string" ;
34
+ vcard:organization-name xsd:string ?
35
+ // rdfs:comment "The name of the organization with which the person is affiliated" ;
36
+ vcard:role xsd:string ?
37
+ // rdfs:comment "The name of the person's role in their organization" ;
38
+ acl:trustedApp @srs:TrustedAppShape *
39
+ // rdfs:comment "A list of app origins that are trusted by this user" ;
40
+ cert:key @srs:RSAPublicKeyShape *
41
+ // rdfs:comment "A list of RSA public keys that are associated with private keys the user holds." ;
42
+ ldp:inbox IRI
43
+ // rdfs:comment "The user's LDP inbox to which apps can post notifications" ;
44
+ sp:preferencesFile IRI ?
45
+ // rdfs:comment "The user's preferences" ;
46
+ sp:storage IRI *
47
+ // rdfs:comment "The location of a Solid storage server related to this WebId" ;
48
+ solid:account IRI ?
49
+ // rdfs:comment "The user's account" ;
50
+ solid:privateTypeIndex IRI *
51
+ // rdfs:comment "A registry of all types used on the user's Pod (for private access only)" ;
52
+ solid:publicTypeIndex IRI *
53
+ // rdfs:comment "A registry of all types used on the user's Pod (for public access)" ;
54
+ foaf:knows IRI *
55
+ // rdfs:comment "A list of WebIds for all the people this user knows." ;
56
+ }
57
+
58
+ srs:AddressShape {
59
+ vcard:country-name xsd:string ?
60
+ // rdfs:comment "The name of the user's country of residence" ;
61
+ vcard:locality xsd:string ?
62
+ // rdfs:comment "The name of the user's locality (City, Town etc.) of residence" ;
63
+ vcard:postal-code xsd:string ?
64
+ // rdfs:comment "The user's postal code" ;
65
+ vcard:region xsd:string ?
66
+ // rdfs:comment "The name of the user's region (State, Province etc.) of residence" ;
67
+ vcard:street-address xsd:string ?
68
+ // rdfs:comment "The user's street address" ;
69
+ }
70
+
71
+ srs:EmailShape EXTRA a {
72
+ a [
73
+ vcard:Dom
74
+ vcard:Home
75
+ vcard:ISDN
76
+ vcard:Internet
77
+ vcard:Intl
78
+ vcard:Label
79
+ vcard:Parcel
80
+ vcard:Postal
81
+ vcard:Pref
82
+ vcard:Work
83
+ vcard:X400
84
+ ] ?
85
+ // rdfs:comment "The type of email." ;
86
+ vcard:value IRI
87
+ // rdfs:comment "The value of an email as a mailto link (Example <mailto:jane@example.com>)" ;
88
+ }
89
+
90
+ srs:PhoneNumberShape EXTRA a {
91
+ a [
92
+ vcard:Dom
93
+ vcard:Home
94
+ vcard:ISDN
95
+ vcard:Internet
96
+ vcard:Intl
97
+ vcard:Label
98
+ vcard:Parcel
99
+ vcard:Postal
100
+ vcard:Pref
101
+ vcard:Work
102
+ vcard:X400
103
+ ] ?
104
+ // rdfs:comment "They type of Phone Number" ;
105
+ vcard:value IRI
106
+ // rdfs:comment "The value of a phone number as a tel link (Example <tel:555-555-5555>)" ;
107
+ }
108
+
109
+ srs:TrustedAppShape {
110
+ acl:mode [acl:Append acl:Control acl:Read acl:Write] +
111
+ // rdfs:comment "The level of access provided to this origin" ;
112
+ acl:origin IRI
113
+ // rdfs:comment "The app origin the user trusts"
114
+ }
115
+
116
+ srs:RSAPublicKeyShape {
117
+ cert:modulus xsd:string
118
+ // rdfs:comment "RSA Modulus" ;
119
+ cert:exponent xsd:integer
120
+ // rdfs:comment "RSA Exponent" ;
121
+ }
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # Linked Data Browser (LDB)
2
+
3
+ This codebase is for a data browser UI for Solid servers.
package/app/index.tsx ADDED
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import { DataBrowser } from '~/components/DataBrowser';
3
+ import { Text } from '~/components/ui/text';
4
+ import { RawCodeConfig } from '~/resourceViews/RawCode/RawCodeConfig';
5
+ import { ContainerConfig } from '~/resourceViews/Container/ContainerConfig';
6
+ import { SafeAreaProvider } from 'react-native-safe-area-context';
7
+ import { StatusBar } from 'react-native';
8
+
9
+ export function Screen() {
10
+ const mode = process.env.EXPO_PUBLIC_IS_SERVER_HOSTED
11
+ ? 'server-ui'
12
+ : 'standalone-app';
13
+
14
+ return (
15
+ <SafeAreaProvider>
16
+ <StatusBar />
17
+ <DataBrowser
18
+ views={[ContainerConfig, RawCodeConfig]}
19
+ mode={mode}
20
+ renderHomepage={() => <Text>Hopepage</Text>}
21
+ renderLogo={() => <Text>Logo</Text>}
22
+ />
23
+ </SafeAreaProvider>
24
+ );
25
+ }
package/app.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "expo": {
3
+ "name": "linked-data-browser",
4
+ "slug": "linked-data-browser",
5
+ "version": "1.0.0",
6
+ "orientation": "portrait",
7
+ "icon": "./assets/images/icon.png",
8
+ "scheme": "myapp",
9
+ "userInterfaceStyle": "automatic",
10
+ "newArchEnabled": true,
11
+ "splash": {
12
+ "image": "./assets/images/splash.png",
13
+ "resizeMode": "contain",
14
+ "backgroundColor": "#ffffff"
15
+ },
16
+ "assetBundlePatterns": [
17
+ "**/*"
18
+ ],
19
+ "ios": {
20
+ "supportsTablet": true
21
+ },
22
+ "android": {
23
+ "adaptiveIcon": {
24
+ "foregroundImage": "./assets/images/adaptive-icon.png",
25
+ "backgroundColor": "#ffffff"
26
+ }
27
+ },
28
+ "web": {
29
+ "bundler": "metro",
30
+ "favicon": "./assets/images/favicon.png"
31
+ },
32
+ "plugins": [],
33
+ "experiments": {
34
+ "typedRoutes": true
35
+ }
36
+ }
37
+ }
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,6 @@
1
+ module.exports = function (api) {
2
+ api.cache(true);
3
+ return {
4
+ presets: [['babel-preset-expo', { jsxImportSource: 'nativewind' }], 'nativewind/babel'],
5
+ };
6
+ };
@@ -0,0 +1,57 @@
1
+ import { createContext, ReactNode, useContext, useMemo } from 'react';
2
+ import { BrowserSolidLdoProvider } from '@ldo/solid-react';
3
+ import React, { FunctionComponent } from 'react';
4
+ import { Layout } from './nav/Layout';
5
+ import { PortalHost } from '@rn-primitives/portal';
6
+ import { TargetResourceProvider } from './TargetResourceProvider';
7
+ import { ResourceViewConfig } from './ResourceView';
8
+ import { NotifierWrapper } from 'react-native-notifier';
9
+ import { Platform } from 'react-native';
10
+ import { ThemeProvider } from '~/components/ThemeProvider';
11
+
12
+ export interface DataBrowserConfig {
13
+ views: ResourceViewConfig[];
14
+ mode: 'standalone-app' | 'server-ui';
15
+ defaultIssuer?: string;
16
+ origin?: string;
17
+ renderHomepage?: () => ReactNode;
18
+ renderLogo?: () => ReactNode;
19
+ }
20
+
21
+ // @ts-ignore This will be filled in once the component mounts
22
+ export const DataBrowserConfigContext = createContext<DataBrowserConfig>({});
23
+
24
+ export function useDataBrowserConfig() {
25
+ return useContext(DataBrowserConfigContext);
26
+ }
27
+
28
+ export const DataBrowser: FunctionComponent<DataBrowserConfig> = (props) => {
29
+ const providerProps = useMemo<DataBrowserConfig>(() => {
30
+ return {
31
+ origin:
32
+ Platform.OS === 'web' && !props.origin
33
+ ? window.location.origin
34
+ : undefined,
35
+ defaultIssuer:
36
+ props.mode === 'server-ui'
37
+ ? window.location.origin
38
+ : 'https://solidcommunity.net',
39
+ ...props,
40
+ };
41
+ }, [props]);
42
+
43
+ return (
44
+ <ThemeProvider>
45
+ <BrowserSolidLdoProvider>
46
+ <NotifierWrapper>
47
+ <DataBrowserConfigContext.Provider value={providerProps}>
48
+ <TargetResourceProvider>
49
+ <Layout />
50
+ <PortalHost />
51
+ </TargetResourceProvider>
52
+ </DataBrowserConfigContext.Provider>
53
+ </NotifierWrapper>
54
+ </BrowserSolidLdoProvider>
55
+ </ThemeProvider>
56
+ );
57
+ };
@@ -0,0 +1,14 @@
1
+ import { SolidContainer, SolidLeaf } from '@ldo/connected-solid';
2
+ import { LucideIcon } from 'lucide-react-native';
3
+ import { ElementType } from 'react';
4
+
5
+ export interface ResourceViewConfig {
6
+ name: string;
7
+ displayName: string;
8
+ displayIcon: LucideIcon;
9
+ view: ElementType;
10
+ canDisplay: (
11
+ targetUri: string,
12
+ targetResource: SolidLeaf | SolidContainer,
13
+ ) => boolean;
14
+ }