-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor for modularity and reusability #65
Comments
Thinking of ways to achieve:
I am currently reading up on the following which I think will provide insight into how to use vue components in agnostic web environments: From the first link:
Things to look into:
|
When redesigning the interface for instantiating (a part of) Now, the question is: how would other apps instantiate (a part of)
In all cases a web component could be constructed to define the main purpose of the instantiation, e.g. via html tags such as
In addition, any component that is class-specific would need to specify the relevant class name via another attribute. This refactoring would affect where and how the required data are read, provided, injected, computed, etc. As mentioned, the input files are currently read on app startup. There is some discrepancy in how provide/inject is used in order to supply the current three main views ( More to follow... |
I am trying to figure out how to structure the app's hierarchy in terms of classes, components, and composables. I intend to go the route of making user-facing features (such as a "form" or "data browser" or both) available as both regular vue components for vue apps and as custom elements for non-vue apps. The question now is which features to establish as these entry points, and how to structure the classes, components and composables accordingly. I already know that there will be a number of required inputs and derived variables for any feature instantiation. More specifically, if a user wants to instantiate either a
Firstly, I am not sure what is common or best practice when it comes to reading/fetching data provided as input arguments to a component instantiation. Is it better to expect the surrounding user application to do this and to pass javascript objects to the component or custom element? Or is it better to be able to pass URLs and expect the classes/composables behind the instantiation to handle data loading? Or should both options be supported? I'm leaning towards letting the Secondly, I am also thinking whether it would be a good idea to just have a single entry point e.g. Whether I have a single or multiple entry points for rendered views, I do think there should be a single instantiation of a class that handles required data loading and structuring, and possibly includes further graph-related functions such as storing/editing form data, storing/editing graph data, etc. I am not sure yet how such a class instantiation would be used across the Vue component hierarchy, where currently the process depends mainly on the Thirdly, there is another feature that needs to be supported by the refactored application. To minimize the effects of upfront bulk data import/fetching, we could let it operate on the principle of only fetching specific subsets when necessary. For example, a user is completing a form for a |
I have made some progress on this front, and I hope to create a PR with a somewhat major overhaul of the source code structure and deployment setup within the next day. What follows is a summary of the updated app. Main goalWe want the main functionality of An example of using it in a Vue application: import { createApp } from 'vue';
import { ShaclVue} from 'shacl-vue'; // after `npm install shacl-vue`
import App from './App.vue';
const app = createApp(App);
app.component('ShaclVue', ShaclVue);
app.mount('#app'); <template>
<shacl-vue></shacl-vue>
</template>
An example of using it in a NON-Vue application via the import { registerCustomElements } from 'shacl-vue'; // after `npm install shacl-vue`
// Register custom elements with the function exported by `elements.js`, see in new structure below
registerCustomElements();
// Use the custom element in the DOM
document.body.innerHTML = '<shacl-vue></shacl-vue>'; or via CDN (and with DOM injection via javascript, just for the fun of it): <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/shacl-vue.umd.js"></script>
<script>
const app = document.createElement('shacl-vue');
document.body.appendChild(app);
</script> In all of the examples above, the surrounding application can prepare whichever arguments are necessary and pass them along to the New structureThe new source code structure will look as follows (summarised):
Main changes include:
TODO
|
Progress on this issue is here: 82ef69e The structure is substantially more understandable and modular. Basically all envisioned changes have been made apart from adding the build and deployment workflow. I was testing the changes and got stuck on some sort of memory leak or recursive reactivity update that I can't pin down yet, and this breaks the metadata editing workflow that is central to the UX. I have spent too much time on this and it is extremely frustrating, to say the least. I will take a break from this and get back to it later. |
The
shacl-vue
app has a few core functionalities currently:rdf/js
-based librariesThe current application is fairly modular already, with core functionality divided into vue components, vue composables, general modules, and general plugins that all support the above functionality. Even so, it could very well do with more refactoring to improve modularity and reusability of components, both Vue-based or conceptual components. In addition, the code in general does not (yet) make use of object-oriented programming approaches; this needs some exploration to see where and how it would be beneficial.
Three envisioned use cases provide additional context for this refactoring process:
shacl-vue
as a dependency. Developers might want to deploy their own custom site for whichever purpose, and only use a specific component fromshacl-vue
, e.g. metadata viewers, on said site. To support such uses, the various functionalities ofshacl-vue
should be appropriately sectioned and made interoperable, such that they can be imported into other applications as self-contained and fully functional modules/classes/functions.shacl-vue
depending on other core libraries. This is already the case for RDF/JS-based libraries (e.g.rdf-ext
,n3
), but is conceivable that this list might grow in future, in order forshacl-vue
to depend on open and widely used libraries that might already achieve some function thatshacl-vue
needs. E.g.shacl-vue
currently supports only basic SHACL constraints, so if another library exists that supports a wider range of SHACL constraints and is also continuously maintained,shacl-vue
could rather depend on that. See also for context: Questions aboutshacl-form
ULB-Darmstadt/shacl-form#28shacl-vue
is pretty much operating in the domain of this use case, although far from fully fledged and far from appropriately refactored.The text was updated successfully, but these errors were encountered: