@arpproject/recrate 0.1.7 → 0.1.8

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 (188) hide show
  1. package/dist/index.d.ts +3 -2
  2. package/dist/recrate.css +4 -4
  3. package/dist/recrate.es.js +34674 -114061
  4. package/package.json +41 -32
  5. package/.eslintrc.json +0 -37
  6. package/.storybook/main.ts +0 -40
  7. package/.storybook/preview.tsx +0 -46
  8. package/babel.config.json +0 -5
  9. package/docker-compose.yml +0 -30
  10. package/docs/.nojekyll +0 -1
  11. package/docs/assets/highlight.css +0 -99
  12. package/docs/assets/icons.js +0 -18
  13. package/docs/assets/icons.svg +0 -1
  14. package/docs/assets/main.js +0 -60
  15. package/docs/assets/navigation.js +0 -1
  16. package/docs/assets/search.js +0 -1
  17. package/docs/assets/style.css +0 -1448
  18. package/docs/classes/src_crate_builder_CrateManager_crate_manager.CrateManager.html +0 -240
  19. package/docs/classes/src_crate_builder_CrateManager_profile_manager.ProfileManager.html +0 -42
  20. package/docs/classes/src_crate_builder_editor_state.EditorState.html +0 -28
  21. package/docs/classes/src_crate_builder_types.CrateManagerType.html +0 -57
  22. package/docs/classes/src_crate_builder_types.ProfileManagerType.html +0 -13
  23. package/docs/functions/src_crate_builder_CrateManager_lib.isURL.html +0 -2
  24. package/docs/functions/src_crate_builder_CrateManager_lib.mintNewCrate.html +0 -3
  25. package/docs/functions/src_crate_builder_CrateManager_lib.normalise.html +0 -5
  26. package/docs/functions/src_crate_builder_CrateManager_lib.normaliseEntityType.html +0 -1
  27. package/docs/index.html +0 -58
  28. package/docs/interfaces/src_crate_builder_types.NormalisedCrate.html +0 -3
  29. package/docs/interfaces/src_crate_builder_types.NormalisedEntityDefinition.html +0 -4
  30. package/docs/interfaces/src_crate_builder_types.NormalisedProfile.html +0 -9
  31. package/docs/interfaces/src_crate_builder_types.ProfileLayout.html +0 -2
  32. package/docs/interfaces/src_crate_builder_types.ProfileLayoutGroup.html +0 -9
  33. package/docs/interfaces/src_crate_builder_types.UnverifiedCrate.html +0 -3
  34. package/docs/interfaces/src_crate_builder_types.UnverifiedEntityDefinition.html +0 -4
  35. package/docs/modules/src_crate_builder_CrateManager_crate_manager.html +0 -2
  36. package/docs/modules/src_crate_builder_CrateManager_lib.html +0 -6
  37. package/docs/modules/src_crate_builder_CrateManager_profile_manager.html +0 -2
  38. package/docs/modules/src_crate_builder_editor_state.html +0 -2
  39. package/docs/modules/src_crate_builder_types.html +0 -16
  40. package/docs/types/src_crate_builder_types.EntityReference.html +0 -1
  41. package/docs/types/src_crate_builder_types.NormalisedContext.html +0 -1
  42. package/docs/types/src_crate_builder_types.PrimitiveType.html +0 -1
  43. package/docs/types/src_crate_builder_types.ProfileAssociation.html +0 -1
  44. package/docs/types/src_crate_builder_types.ProfileInput.html +0 -1
  45. package/docs/types/src_crate_builder_types.UnverifiedContext.html +0 -1
  46. package/docs/variables/src_crate_builder_CrateManager_lib.urlProtocols.html +0 -1
  47. package/index.html +0 -13
  48. package/load-data-packs.cjs +0 -38
  49. package/postcss.config.cjs +0 -6
  50. package/public/favicon.ico +0 -0
  51. package/public/index.html +0 -43
  52. package/public/logo192.png +0 -0
  53. package/public/logo512.png +0 -0
  54. package/public/manifest.json +0 -25
  55. package/public/marker-icon.png +0 -0
  56. package/public/marker-shadow.png +0 -0
  57. package/public/robots.txt +0 -3
  58. package/react-app-env.d.ts +0 -1
  59. package/rollup.config.js +0 -26
  60. package/src/app/App.tsx +0 -13
  61. package/src/app/EmbeddedComponent.tsx +0 -432
  62. package/src/app/index.html +0 -20
  63. package/src/app/index.tsx +0 -19
  64. package/src/app/lookup.ts +0 -141
  65. package/src/app/override-styles.css +0 -96
  66. package/src/crate-builder/CrateManager/contexts/1.1-context.jsonld +0 -2660
  67. package/src/crate-builder/CrateManager/contexts/1.2-DRAFT-context.jsonld +0 -2918
  68. package/src/crate-builder/CrateManager/contexts.ts +0 -42
  69. package/src/crate-builder/CrateManager/crate-manager-benchmarking.spec.ts +0 -31
  70. package/src/crate-builder/CrateManager/crate-manager-loading-exporting.spec.ts +0 -431
  71. package/src/crate-builder/CrateManager/crate-manager-operations.spec.ts +0 -298
  72. package/src/crate-builder/CrateManager/crate-manager.spec.ts +0 -2336
  73. package/src/crate-builder/CrateManager/crate-manager.ts +0 -2111
  74. package/src/crate-builder/CrateManager/lib.spec.ts +0 -133
  75. package/src/crate-builder/CrateManager/lib.ts +0 -170
  76. package/src/crate-builder/CrateManager/profile-manager.spec.ts +0 -593
  77. package/src/crate-builder/CrateManager/profile-manager.ts +0 -367
  78. package/src/crate-builder/CrateManager/schema-type-definitions.json +0 -35122
  79. package/src/crate-builder/CrateManager/validate-identifier.spec.ts +0 -82
  80. package/src/crate-builder/CrateManager/validate-identifier.ts +0 -65
  81. package/src/crate-builder/RenderEntity/Add.tsx +0 -249
  82. package/src/crate-builder/RenderEntity/AddControl.stories.tsx +0 -126
  83. package/src/crate-builder/RenderEntity/AddControl.tsx +0 -84
  84. package/src/crate-builder/RenderEntity/AutoComplete.tsx +0 -215
  85. package/src/crate-builder/RenderEntity/BulkAdd.tsx +0 -136
  86. package/src/crate-builder/RenderEntity/DeleteProperty.tsx +0 -33
  87. package/src/crate-builder/RenderEntity/DialogAddProperty.tsx +0 -83
  88. package/src/crate-builder/RenderEntity/DialogBrowseEntities.tsx +0 -136
  89. package/src/crate-builder/RenderEntity/DialogEditContext.tsx +0 -107
  90. package/src/crate-builder/RenderEntity/DialogPreviewCrate.tsx +0 -54
  91. package/src/crate-builder/RenderEntity/DialogSaveCrateAsTemplate.tsx +0 -65
  92. package/src/crate-builder/RenderEntity/DialogSaveEntityTemplate.tsx +0 -87
  93. package/src/crate-builder/RenderEntity/DisplayPropertyName.stories.tsx +0 -30
  94. package/src/crate-builder/RenderEntity/DisplayPropertyName.tsx +0 -21
  95. package/src/crate-builder/RenderEntity/EntityId.tsx +0 -75
  96. package/src/crate-builder/RenderEntity/EntityName.tsx +0 -49
  97. package/src/crate-builder/RenderEntity/EntityProperty.tsx +0 -188
  98. package/src/crate-builder/RenderEntity/EntityPropertyInstance.tsx +0 -255
  99. package/src/crate-builder/RenderEntity/EntityType.tsx +0 -95
  100. package/src/crate-builder/RenderEntity/ItemLink.tsx +0 -37
  101. package/src/crate-builder/RenderEntity/PaginateLinkedEntities.stories.tsx +0 -43
  102. package/src/crate-builder/RenderEntity/PaginateLinkedEntities.tsx +0 -141
  103. package/src/crate-builder/RenderEntity/PropertyHelp.tsx +0 -39
  104. package/src/crate-builder/RenderEntity/RenderControls.tsx +0 -278
  105. package/src/crate-builder/RenderEntity/RenderLinkedItem.tsx +0 -139
  106. package/src/crate-builder/RenderEntity/RenderPropertyHelp.tsx +0 -41
  107. package/src/crate-builder/RenderEntity/RenderReverseConnections.tsx +0 -150
  108. package/src/crate-builder/RenderEntity/RenderTypes.tsx +0 -102
  109. package/src/crate-builder/RenderEntity/Shell2.tsx +0 -576
  110. package/src/crate-builder/RenderEntity/UnlinkEntity.tsx +0 -30
  111. package/src/crate-builder/RenderEntity/auto-complete.lib.ts +0 -184
  112. package/src/crate-builder/RenderEntity/keys.ts +0 -4
  113. package/src/crate-builder/RenderEntity/layout.spec.js +0 -593
  114. package/src/crate-builder/RenderEntity/layout.ts +0 -220
  115. package/src/crate-builder/Shell.tsx +0 -337
  116. package/src/crate-builder/component.css +0 -65
  117. package/src/crate-builder/editor-state.ts +0 -114
  118. package/src/crate-builder/emotionCache.ts +0 -8
  119. package/src/crate-builder/helpers.ts +0 -16
  120. package/src/crate-builder/i18n.ts +0 -22
  121. package/src/crate-builder/lib/validate-iri.js +0 -69
  122. package/src/crate-builder/lib/validate-iri.ts +0 -57
  123. package/src/crate-builder/locales/en.js +0 -149
  124. package/src/crate-builder/locales/hu.js +0 -147
  125. package/src/crate-builder/primitives/Boolean.stories.tsx +0 -33
  126. package/src/crate-builder/primitives/Boolean.tsx +0 -67
  127. package/src/crate-builder/primitives/Date.stories.tsx +0 -32
  128. package/src/crate-builder/primitives/Date.tsx +0 -58
  129. package/src/crate-builder/primitives/DateTime.stories.tsx +0 -32
  130. package/src/crate-builder/primitives/DateTime.tsx +0 -64
  131. package/src/crate-builder/primitives/Geo.stories.tsx +0 -57
  132. package/src/crate-builder/primitives/Geo.tsx +0 -225
  133. package/src/crate-builder/primitives/Map.SelectArea.js +0 -359
  134. package/src/crate-builder/primitives/Map.stories.tsx +0 -61
  135. package/src/crate-builder/primitives/Map.tsx +0 -124
  136. package/src/crate-builder/primitives/Number.stories.tsx +0 -74
  137. package/src/crate-builder/primitives/Number.tsx +0 -166
  138. package/src/crate-builder/primitives/Select.stories.tsx +0 -66
  139. package/src/crate-builder/primitives/Select.tsx +0 -121
  140. package/src/crate-builder/primitives/SelectObject.stories.tsx +0 -29
  141. package/src/crate-builder/primitives/SelectObject.tsx +0 -105
  142. package/src/crate-builder/primitives/SelectUrl.stories.tsx +0 -42
  143. package/src/crate-builder/primitives/SelectUrl.tsx +0 -110
  144. package/src/crate-builder/primitives/Text.stories.tsx +0 -106
  145. package/src/crate-builder/primitives/Text.tsx +0 -197
  146. package/src/crate-builder/primitives/Time.stories.tsx +0 -38
  147. package/src/crate-builder/primitives/Time.tsx +0 -71
  148. package/src/crate-builder/primitives/Url.stories.tsx +0 -43
  149. package/src/crate-builder/primitives/Url.tsx +0 -75
  150. package/src/crate-builder/primitives/Value.stories.tsx +0 -37
  151. package/src/crate-builder/primitives/Value.tsx +0 -30
  152. package/src/crate-builder/primitives/date-libs.ts +0 -12
  153. package/src/crate-builder/profile-schema.json +0 -145
  154. package/src/crate-builder/property-definitions.ts +0 -78
  155. package/src/crate-builder/recrate.css +0 -3
  156. package/src/crate-builder/store.ts +0 -14
  157. package/src/crate-builder/tailwind.css +0 -5
  158. package/src/crate-builder/types.d.ts +0 -318
  159. package/src/examples/collection/collections-entity-example.json +0 -131
  160. package/src/examples/collection/crate-builder-entity-example.json +0 -33
  161. package/src/examples/item/complex-collection/ro-crate-metadata.json +0 -174
  162. package/src/examples/item/complex-item/ro-crate-metadata.json +0 -769
  163. package/src/examples/item/crate-with-language.json +0 -38
  164. package/src/examples/item/empty/ro-crate-metadata.json +0 -20
  165. package/src/examples/item/item-with-relationship-and-action/ro-crate-metadata.json +0 -66
  166. package/src/examples/item/large-crate/ro-crate-metadata.json +0 -5762
  167. package/src/examples/item/multiple-types/ro-crate-metadata.json +0 -20
  168. package/src/examples/item/ridiculously-big-collection/ro-crate-metadata.json +0 -162977
  169. package/src/examples/profile/aroma.complex.profile.json +0 -11098
  170. package/src/examples/profile/aroma.profile.json +0 -9158
  171. package/src/examples/profile/nyingarn-item-profile.json +0 -426
  172. package/src/examples/profile/profile-to-test-inverse-associations.json +0 -73
  173. package/src/examples/profile/profile-to-test-multiple-types.json +0 -31
  174. package/src/examples/profile/profile-with-all-primitives-and-groups.json +0 -207
  175. package/src/examples/profile/profile-with-all-primitives.json +0 -244
  176. package/src/examples/profile/profile-with-constraints.json +0 -446
  177. package/src/examples/profile/profile-with-resolve.json +0 -57
  178. package/src/examples/profile/vocabulary-creation-profile.json +0 -231
  179. package/src/images.d.ts +0 -5
  180. package/src/index.ts +0 -12
  181. package/src/types.ts +0 -104
  182. package/tailwind.config.js +0 -21
  183. package/tsconfig.app.json +0 -31
  184. package/tsconfig.json +0 -26
  185. package/typedoc.json +0 -11
  186. package/update-deps.sh +0 -4
  187. package/vite-env.d.ts +0 -1
  188. package/vite.config.ts +0 -46
@@ -1,38 +0,0 @@
1
- const { IndexDataPacks } = require("@describo/data-packs");
2
- const { Client } = require("@elastic/elasticsearch");
3
-
4
- const elasticUrl = "http://localhost:9200";
5
- main();
6
- async function main() {
7
- const index = new IndexDataPacks({ elasticUrl, log: true });
8
- await index.load();
9
-
10
- const client = new Client({
11
- node: elasticUrl,
12
- });
13
-
14
- let entities = [
15
- {
16
- "@id": "#person1",
17
- "@type": "Person",
18
- name: "person1",
19
- },
20
- {
21
- "@id": "#person2",
22
- "@type": ["Person", "Human"],
23
- name: "person2",
24
- },
25
- {
26
- "@id": "#language1",
27
- "@type": "Language",
28
- name: "language1",
29
- },
30
- ];
31
- for (let entity of entities) {
32
- await client.index({
33
- index: "entities",
34
- id: encodeURIComponent(entity["@id"]),
35
- document: entity,
36
- });
37
- }
38
- }
@@ -1,6 +0,0 @@
1
- module.exports = {
2
- plugins: {
3
- "@tailwindcss/postcss": {},
4
- autoprefixer: {},
5
- },
6
- }
Binary file
package/public/index.html DELETED
@@ -1,43 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8" />
5
- <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1" />
7
- <meta name="theme-color" content="#000000" />
8
- <meta
9
- name="description"
10
- content="Web site created using create-react-app"
11
- />
12
- <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
13
- <!--
14
- manifest.json provides metadata used when your web app is installed on a
15
- user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
16
- -->
17
- <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
18
- <!--
19
- Notice the use of %PUBLIC_URL% in the tags above.
20
- It will be replaced with the URL of the `public` folder during the build.
21
- Only files inside the `public` folder can be referenced from the HTML.
22
-
23
- Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
24
- work correctly both with client-side routing and a non-root public URL.
25
- Learn how to configure a non-root public URL by running `npm run build`.
26
- -->
27
- <title>React App</title>
28
- </head>
29
- <body>
30
- <noscript>You need to enable JavaScript to run this app.</noscript>
31
- <div id="root"></div>
32
- <!--
33
- This HTML file is a template.
34
- If you open it directly in the browser, you will see an empty page.
35
-
36
- You can add webfonts, meta tags, or analytics to this file.
37
- The build step will place the bundled scripts into the <body> tag.
38
-
39
- To begin the development, run `npm start` or `yarn start`.
40
- To create a production bundle, use `npm run build` or `yarn build`.
41
- -->
42
- </body>
43
- </html>
Binary file
Binary file
@@ -1,25 +0,0 @@
1
- {
2
- "short_name": "React App",
3
- "name": "Create React App Sample",
4
- "icons": [
5
- {
6
- "src": "favicon.ico",
7
- "sizes": "64x64 32x32 24x24 16x16",
8
- "type": "image/x-icon"
9
- },
10
- {
11
- "src": "logo192.png",
12
- "type": "image/png",
13
- "sizes": "192x192"
14
- },
15
- {
16
- "src": "logo512.png",
17
- "type": "image/png",
18
- "sizes": "512x512"
19
- }
20
- ],
21
- "start_url": ".",
22
- "display": "standalone",
23
- "theme_color": "#000000",
24
- "background_color": "#ffffff"
25
- }
Binary file
Binary file
package/public/robots.txt DELETED
@@ -1,3 +0,0 @@
1
- # https://www.robotstxt.org/robotstxt.html
2
- User-agent: *
3
- Disallow:
@@ -1 +0,0 @@
1
- /// <reference types="react-scripts" />
package/rollup.config.js DELETED
@@ -1,26 +0,0 @@
1
- import postcss from "rollup-plugin-postcss";
2
- import cssnano from "cssnano";
3
- import { nodeResolve } from "@rollup/plugin-node-resolve";
4
- import copy from "rollup-plugin-copy";
5
-
6
- export default {
7
- input: "./src/crate-builder/index.wc-css.js",
8
- output: {
9
- dir: "dist/web-component-styles",
10
- },
11
- plugins: [
12
- nodeResolve(),
13
- postcss({
14
- extract: "styles.css",
15
- plugins: [cssnano({ preset: "default" })],
16
- }),
17
- copy({
18
- targets: [
19
- {
20
- src: "node_modules/@fortawesome/fontawesome-free/webfonts",
21
- dest: "dist/",
22
- },
23
- ],
24
- }),
25
- ],
26
- };
package/src/app/App.tsx DELETED
@@ -1,13 +0,0 @@
1
- import EmbeddedComponent from './EmbeddedComponent';
2
-
3
- function App() {
4
- return (
5
- <div className="App">
6
- <main className="p-4">
7
- <EmbeddedComponent />
8
- </main>
9
- </div>
10
- );
11
- }
12
-
13
- export default App;
@@ -1,432 +0,0 @@
1
- import React, { useState, useRef, useImperativeHandle, forwardRef } from 'react';
2
- import DescriboCrateBuilder from '../crate-builder/Shell';
3
- import { Lookup } from './lookup';
4
- import { Select, Button, Switch, Form, Space } from 'antd';
5
- import "./override-styles.css"
6
-
7
- // Import example crates
8
- import emptyCrate from '../examples/item/empty/ro-crate-metadata.json';
9
- import complexCollectionCrate from '../examples/item/complex-collection/ro-crate-metadata.json';
10
- import complexItemCrate from '../examples/item/complex-item/ro-crate-metadata.json';
11
- import largeCrate from '../examples/item/large-crate/ro-crate-metadata.json';
12
- import bigCollectionCrate from '../examples/item/ridiculously-big-collection/ro-crate-metadata.json';
13
- import relationshipActionCrate from '../examples/item/item-with-relationship-and-action/ro-crate-metadata.json';
14
- import multipleTypesCrate from '../examples/item/multiple-types/ro-crate-metadata.json';
15
- import crateFile9 from "../examples/item/crate-with-language.json";
16
-
17
- // Import example profiles
18
- import primitiveProfile from '../examples/profile/profile-with-all-primitives.json';
19
- import primitiveGroupsProfile from '../examples/profile/profile-with-all-primitives-and-groups.json';
20
- import multipleTypesProfile from '../examples/profile/profile-to-test-multiple-types.json';
21
- import resolveProfile from '../examples/profile/profile-with-resolve.json';
22
- import nyingarnProfile from '../examples/profile/nyingarn-item-profile.json';
23
- import vocabularyProfile from '../examples/profile/vocabulary-creation-profile.json';
24
- import constraintsProfile from '../examples/profile/profile-with-constraints.json';
25
- import inverseAssociationsProfile from '../examples/profile/profile-to-test-inverse-associations.json';
26
- import profile11 from "../examples/profile/aroma.profile.json";
27
- import profile12 from "../examples/profile/aroma.complex.profile.json";
28
- import { minWidth } from '@mui/system';
29
-
30
- // Define types for our examples
31
- interface CrateExample {
32
- name: string;
33
- value: any;
34
- }
35
-
36
- interface ProfileExample {
37
- name: string;
38
- value: any;
39
- }
40
-
41
- interface LanguageOption {
42
- name: string;
43
- value: string;
44
- }
45
-
46
- const EmbeddedComponent: React.FC = () => {
47
- // Create a ref to access the Shell component methods
48
- const shellComponentRef = useRef<any>(null);
49
-
50
- // Define state
51
- const [data, setData] = useState({
52
- loading: false,
53
- select: {
54
- crate: '' as string | undefined,
55
- profile: '' as string | undefined,
56
- },
57
- readonly: false,
58
- crates: [
59
- { name: "Empty", value: emptyCrate },
60
- { name: "Complex Collection", value: complexCollectionCrate },
61
- { name: "Complex Item", value: complexItemCrate },
62
- { name: "Large Crate", value: largeCrate },
63
- { name: "Big Collection", value: bigCollectionCrate },
64
- { name: "Item with Relationship", value: relationshipActionCrate },
65
- { name: "Multiple Types", value: multipleTypesCrate },
66
- { name: "Crate with language", value: crateFile9 }
67
- ] as CrateExample[],
68
- profiles: [
69
- { name: primitiveProfile.metadata.name, value: primitiveProfile },
70
- { name: primitiveGroupsProfile.metadata.name, value: primitiveGroupsProfile },
71
- { name: multipleTypesProfile.metadata.name, value: multipleTypesProfile },
72
- { name: resolveProfile.metadata.name, value: resolveProfile },
73
- { name: nyingarnProfile.metadata.name, value: nyingarnProfile },
74
- { name: vocabularyProfile.metadata.name, value: vocabularyProfile },
75
- { name: constraintsProfile.metadata.name, value: constraintsProfile },
76
- { name: inverseAssociationsProfile.metadata.name, value: inverseAssociationsProfile },
77
- { name: profile11.metadata.name, value: profile11 },
78
- { name: profile12.metadata.name, value: profile12 }
79
- ] as ProfileExample[],
80
- languages: [
81
- { name: "English", value: "en" },
82
- { name: "Magyar", value: "hu" },
83
- ] as LanguageOption[],
84
- selectedCrate: undefined as any,
85
- selectedProfile: undefined as any,
86
- configuration: {
87
- language: "en",
88
- enableContextEditor: true,
89
- enableCratePreview: true,
90
- enableBrowseEntities: true,
91
- enableTemplateSave: true,
92
- enableReverseLinkBrowser: false,
93
- enableUrlMarkup: true,
94
- purgeUnlinkedEntities: true,
95
- enableEntityTimestamps: false,
96
- readonly: false,
97
- tabLocation: "left" as "left" | "top" | "right" | "bottom",
98
- showControls: true,
99
- },
100
- });
101
-
102
- // Setup the lookup service
103
- const lookup = new Lookup();
104
-
105
- // Functions
106
- const setCrate = (name: string | undefined) => {
107
- const crate = name ? data.crates.filter((c) => c.name === name)[0]?.value : undefined;
108
- setData(prev => ({
109
- ...prev,
110
- selectedCrate: crate,
111
- select: {
112
- ...prev.select,
113
- crate: name
114
- }
115
- }));
116
- };
117
-
118
- const setProfile = (name: string | undefined) => {
119
- const profile = name ? data.profiles.filter((p) => p.name === name)[0]?.value : undefined;
120
- setData(prev => ({
121
- ...prev,
122
- selectedProfile: profile,
123
- select: {
124
- ...prev.select,
125
- profile: name
126
- }
127
- }));
128
- //console.log("Profile changed to: ", name, profile);
129
- };
130
-
131
- const handleCrateChange = (value: string) => {
132
- //console.log("Crate changed to: ", event.target.value);
133
- setCrate(value);
134
- };
135
-
136
- const handleProfileChange = (value: string) => {
137
- setProfile(value);
138
- };
139
-
140
- const handleConfigChange = (key: string, value: any) => {
141
- //console.log("Config changed to: ", key, value);
142
- setData(prev => ({
143
- ...prev,
144
- configuration: {
145
- ...prev.configuration,
146
- [key]: value
147
- }
148
- }));
149
- };
150
-
151
- // Button action handlers
152
- const add = () => {
153
- if (!shellComponentRef.current) return;
154
-
155
- // Get crate manager from the shell component
156
- const shell = shellComponentRef.current;
157
- const cm = shell.cm;
158
-
159
- if (!cm) return;
160
-
161
- cm.setProperty({ id: "./", property: "author", value: 1 });
162
- cm.setProperty({ id: "./", property: "babies", value: 1 });
163
- const e = cm.addEntity({ "@id": "#person", "@type": "Person", name: "a person" });
164
- cm.linkEntity({
165
- id: "./",
166
- property: "contributor",
167
- value: { "@id": e["@id"] },
168
- });
169
-
170
- // Call shell's refresh method
171
- if (typeof shell.refresh === 'function') {
172
- shell.refresh();
173
- }
174
- };
175
-
176
- const setTab = () => {
177
- if (!shellComponentRef.current) return;
178
- const shell = shellComponentRef.current;
179
-
180
- if (typeof shell.setTab === 'function') {
181
- shell.setTab("numbers");
182
- }
183
- };
184
-
185
- const setEntity = () => {
186
- if (!shellComponentRef.current) return;
187
- const shell = shellComponentRef.current;
188
-
189
- if (typeof shell.setCurrentEntity === 'function') {
190
- shell.setCurrentEntity({ id: "#person" });
191
- }
192
- };
193
-
194
- const toggleReverseLinkBrowser = () => {
195
- if (!shellComponentRef.current) return;
196
- const shell = shellComponentRef.current;
197
-
198
- if (typeof shell.toggleReverseLinkBrowser === 'function') {
199
- shell.toggleReverseLinkBrowser();
200
- }
201
- };
202
-
203
- const back = () => {
204
- if (!shellComponentRef.current) return;
205
- const shell = shellComponentRef.current;
206
-
207
- if (shell.state?.editorState?.back) {
208
- shell.state.editorState.back();
209
- }
210
- };
211
-
212
- const forward = () => {
213
- if (!shellComponentRef.current) return;
214
- const shell = shellComponentRef.current;
215
-
216
- if (shell.state?.editorState?.forward) {
217
- shell.state.editorState.forward();
218
- }
219
- };
220
-
221
- return (
222
- <div className="flex flex-row space-x-2 w-screen">
223
- <div className="flex flex-col space-y-2 w-4/6">
224
- <div className="flex flex-row gap-x-2">
225
- <Select
226
- size='middle'
227
- value={data.select.crate || undefined}
228
- onChange={handleCrateChange}
229
- placeholder="Select a crate"
230
- style={{ width: '100%', minWidth: '190px' }}
231
- >
232
- {data.crates.map((crate) => (
233
- <Select.Option key={crate.name} value={crate.name}>
234
- {crate.name}
235
- </Select.Option>
236
- ))}
237
- </Select>
238
-
239
- <Select
240
- size='middle'
241
- value={data.select.profile || undefined}
242
- onChange={handleProfileChange}
243
- placeholder="Select a profile"
244
- style={{ width: '100%', minWidth: '190px' }}
245
- >
246
- {data.profiles.map((profile) => (
247
- <Select.Option key={profile.name} value={profile.name}>
248
- {profile.name}
249
- </Select.Option>
250
- ))}
251
- </Select>
252
-
253
- <Button
254
- type="default"
255
- size='middle'
256
- onClick={add}
257
- style={{
258
- whiteSpace: 'nowrap',
259
- minWidth: 'fit-content'
260
- }}>Add</Button>
261
- <Button
262
- type="default"
263
- size='middle'
264
- onClick={setTab}
265
- style={{
266
- whiteSpace: 'nowrap',
267
- minWidth: 'fit-content'
268
- }}>Set Tab</Button>
269
- <Button
270
- type="default"
271
- size='middle'
272
- onClick={setEntity}
273
- style={{
274
- whiteSpace: 'nowrap',
275
- minWidth: 'fit-content'
276
- }}>Set Entity</Button>
277
- <Button
278
- type="default"
279
- size='middle'
280
- onClick={toggleReverseLinkBrowser}
281
- style={{
282
- whiteSpace: 'nowrap',
283
- minWidth: 'fit-content'
284
- }}>Toggle Links</Button>
285
- <Button
286
- type="default"
287
- size='middle'
288
- onClick={back}
289
- style={{
290
- whiteSpace: 'nowrap',
291
- minWidth: 'fit-content'
292
- }}>{"<"}</Button>
293
- <Button
294
- type="default"
295
- size='middle'
296
- onClick={forward}
297
- style={{
298
- whiteSpace: 'nowrap',
299
- minWidth: 'fit-content'
300
- }}>{">"}</Button>
301
- </div>
302
-
303
- <div className="mt-2">
304
- {data.selectedCrate && (
305
- <DescriboCrateBuilder
306
- crate={data.selectedCrate}
307
- profile={data.selectedProfile}
308
- lookup={lookup}
309
- readonly={data.configuration.readonly}
310
- enableContextEditor={data.configuration.enableContextEditor}
311
- enableCratePreview={data.configuration.enableCratePreview}
312
- enableBrowseEntities={data.configuration.enableBrowseEntities}
313
- enableTemplateSave={data.configuration.enableTemplateSave}
314
- enableEntityTimestamps={data.configuration.enableEntityTimestamps}
315
- enableReverseLinkBrowser={data.configuration.enableReverseLinkBrowser}
316
- purgeUnlinkedEntities={data.configuration.purgeUnlinkedEntities}
317
- enableUrlMarkup={data.configuration.enableUrlMarkup}
318
- webComponent={false}
319
- language={data.configuration.language}
320
- tabLocation={data.configuration.tabLocation}
321
- showControls={data.configuration.showControls}
322
- />
323
- )}
324
- </div>
325
- </div>
326
-
327
- <div className="flex flex-col w-2/6 p-8 border-slate-200 border-2">
328
- <div className="mb-4">Component Controls</div>
329
- <Form labelCol={{ span: 12 }} wrapperCol={{ span: 12 }}>
330
- <Form.Item label="Language">
331
- <Select
332
- value={data.configuration.language}
333
- onChange={(value) => handleConfigChange("language", value)}
334
- style={{ width: '100%' }}
335
- >
336
- {data.languages.map((lang) => (
337
- <Select.Option key={lang.value} value={lang.value}>
338
- {lang.name}
339
- </Select.Option>
340
- ))}
341
- </Select>
342
- </Form.Item>
343
-
344
- <Form.Item label="Tab Location">
345
- <Select
346
- value={data.configuration.tabLocation}
347
- onChange={(value) => handleConfigChange("tabLocation", value)}
348
- style={{ width: '100%' }}
349
- >
350
- <Select.Option value="left">Tabs: left</Select.Option>
351
- <Select.Option value="top">Tabs: top</Select.Option>
352
- <Select.Option value="right">Tabs: right</Select.Option>
353
- <Select.Option value="bottom">Tabs: bottom</Select.Option>
354
- </Select>
355
- </Form.Item>
356
-
357
- <Form.Item label="Set to readonly">
358
- <Switch
359
- checked={data.configuration.readonly}
360
- onChange={(checked) => handleConfigChange('readonly', checked)}
361
- />
362
- </Form.Item>
363
-
364
- <Form.Item label="Enable component controls">
365
- <Switch
366
- checked={data.configuration.showControls}
367
- onChange={(checked) => handleConfigChange('showControls', checked)}
368
- />
369
- </Form.Item>
370
-
371
- <Form.Item label="Enable Context Editor">
372
- <Switch
373
- checked={data.configuration.enableContextEditor}
374
- onChange={(checked) => handleConfigChange('enableContextEditor', checked)}
375
- />
376
- </Form.Item>
377
-
378
- <Form.Item label="Enable Crate Preview">
379
- <Switch
380
- checked={data.configuration.enableCratePreview}
381
- onChange={(checked) => handleConfigChange('enableCratePreview', checked)}
382
- />
383
- </Form.Item>
384
-
385
- <Form.Item label="Enable Browse Entities">
386
- <Switch
387
- checked={data.configuration.enableBrowseEntities}
388
- onChange={(checked) => handleConfigChange('enableBrowseEntities', checked)}
389
- />
390
- </Form.Item>
391
-
392
- <Form.Item label="Enable Reverse Link Browser">
393
- <Switch
394
- checked={data.configuration.enableReverseLinkBrowser}
395
- onChange={(checked) => handleConfigChange('enableReverseLinkBrowser', checked)}
396
- />
397
- </Form.Item>
398
-
399
- <Form.Item label="Enable Template Save">
400
- <Switch
401
- checked={data.configuration.enableTemplateSave}
402
- onChange={(checked) => handleConfigChange('enableTemplateSave', checked)}
403
- />
404
- </Form.Item>
405
-
406
- <Form.Item label="Enable URL Markup">
407
- <Switch
408
- checked={data.configuration.enableUrlMarkup}
409
- onChange={(checked) => handleConfigChange('enableUrlMarkup', checked)}
410
- />
411
- </Form.Item>
412
-
413
- <Form.Item label="Purge Unlinked Entities">
414
- <Switch
415
- checked={data.configuration.purgeUnlinkedEntities}
416
- onChange={(checked) => handleConfigChange('purgeUnlinkedEntities', checked)}
417
- />
418
- </Form.Item>
419
-
420
- <Form.Item label="Enable Entity Timestamps">
421
- <Switch
422
- checked={data.configuration.enableEntityTimestamps}
423
- onChange={(checked) => handleConfigChange('enableEntityTimestamps', checked)}
424
- />
425
- </Form.Item>
426
- </Form>
427
- </div>
428
- </div>
429
- );
430
- };
431
-
432
- export default EmbeddedComponent;
@@ -1,20 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta http-equiv="X-UA-Compatible" content="IE=edge" />
6
- <meta name="viewport" content="width=device-width,initial-scale=1.0" />
7
- <link rel="icon" href="favicon.ico" />
8
- <title><%= htmlWebpackPlugin.options.title %></title>
9
- </head>
10
- <body>
11
- <noscript>
12
- <strong
13
- >We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly
14
- without JavaScript enabled. Please enable it to continue.</strong
15
- >
16
- </noscript>
17
- <div id="app"></div>
18
- <!-- built files will be auto injected -->
19
- </body>
20
- </html>
package/src/app/index.tsx DELETED
@@ -1,19 +0,0 @@
1
- import React from 'react';
2
- import ReactDOM from 'react-dom/client';
3
- import '../crate-builder/component.css';
4
- import '../crate-builder/tailwind.css';
5
- import App from './App';
6
- import { I18nextProvider } from 'react-i18next';
7
- import i18next from '../crate-builder/i18n';
8
-
9
- const root = ReactDOM.createRoot(
10
- document.getElementById('root') as HTMLElement
11
- );
12
- root.render(
13
- <React.StrictMode>
14
- <I18nextProvider i18n={i18next}>
15
- <App />
16
- </I18nextProvider>
17
- </React.StrictMode>
18
- );
19
-