spoonx / aurelia-view-manager Goto Github PK
View Code? Open in Web Editor NEWA view manager for aurelia plugins. Add support for overriding views, and multiple frameworks.
License: MIT License
A view manager for aurelia plugins. Add support for overriding views, and multiple frameworks.
License: MIT License
I cannot build my project using aurelia-view-manager and typescript with errors in dist/aurelia-view-manager.d.ts:
Cannot find name 'ViewEngine'
Cannot find name 'ViewCompileInstructions'
Cannot find name 'ResourceLoadContext'
Cannot find name 'ViewFactory'
The problem is fixed when I add these missing types to import statement on line 3:
import {viewStrategy,useViewStrategy,ViewEngine,ViewCompileInstruction,ResourceLoadContext,ViewFactory} from 'aurelia-templating';
Views are created by a ViewFactory, so they don’t go through DI directly, but their internal components are created by DI. If you create a custom ViewStrategy, you can control whether or not the view is relative to the view model or not. The strategies implement a method “makeRelativeTo”. You can implement that but just ignore the file path it provides.
We could say that defaults from plugins are relative to the plugin. Anything user-provided is relative to the project.
I'm trying to figure out if Aurelia supports fully dynamic views and view models?
I'd like to have a blank slate (canvas), where the user can drag and drop elements to update an underlying model (schema) and where the canvas then responds by rendering the corresponding views (elements/components) to reflect this model.
Does view-manager (or Aurelia) currently support this or what would be need for this to be possible? Thanks!
import {Container} from 'aurelia-dependency-injection';
import {ViewManager} from './../view-manager';
import {RelativeViewStrategy, useViewStrategy} from 'aurelia-templating';
export function resolvedView(namespace, view) {
let viewManager = Container.instance.get(ViewManager);
let path = viewManager.resolve(namespace, view);
return useViewStrategy(new RelativeViewStrategy(path));
}
that's not a good idea. That's only likely to be the same container as used in a SPA. My guess is that it's not when using aurelia-testing. hence to make it proper the code from @Inject would need to be borrowed so that the right container instance will be used
Allow configuring of view configs via aurelia-config.
In the README.md you have:
Run npm i aurelia-view-manager--save from your project root.
it needs to be
Run npm i aurelia-view-manager --save from your project root.
add space before --save
We should be able to just do .plugin('view-manager')
At the moment we have to provide a callback: .plugin('view-manager', function() {})
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.