Code Monkey home page Code Monkey logo

ensemble's Introduction

Getting Started

For detailed instructions on how to run locally or deploy to iOS AppStore or Google Play, see this - https://github.com/EnsembleUI/ensemble_starter

This is Ensemble Runtime that is essentially an interpreter for the Ensemble Declarative Language (EDL) written in Flutter.

Signup for Ensemble studio here - https://studio.ensembleui.com to see how the EDL is used to build front-ends.

To run Ensemble locally using Android Studio or VCS, you will need to download the Ensemble Starter repo here - https://github.com/EnsembleUI/ensemble_starter

and edit the following files as follows -

  1. change the ensemble/appId to your app's Id. If you are just starting off, you can use the Kitchen Sink app's id as an example. It is e24402cb-75e2-404c-866c-29e6c3dd7992
  2. You can always find your app's id in the studio.ensembleui.com from the right side 3 dot menu.

and following the instructions in the readme of https://github.com/EnsembleUI/ensemble_starter to run locally.

How to contribute a new widget or enhance an existing widget in Ensemble

  1. All the ensemble widgets are here - https://github.com/EnsembleUI/ensemble/tree/main/lib/widget
  2. run the Kitchen Sink app - https://studio.ensembleui.com/app/e24402cb-75e2-404c-866c-29e6c3dd7992/screens when running locally use the appId as described above.
  3. See how each widget works and how the yaml is mapped to the Flutter widget
  4. In the studio, create your own app and screens with your widget (or enhanced widget). Make sure you can test locally and it works fine
  5. When ready, create a pull request and we will review and provide feedback.

ensemble's People

Contributors

amin-nas avatar evshi avatar fullstackctp avatar hamxa152 avatar hemish11 avatar imranahmed223 avatar kmahmood74 avatar moeez1999 avatar saddamrashid avatar sharjeelyunus avatar snehmehta avatar vinothvino42 avatar vusters avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ensemble's Issues

Firebase integration research

Integrate Firebase / Firestore with first class support inside Ensemble:

  1. Firebase authentication.
  2. Query Firestore directly

DataRow's visible prop does not work

Setting visible: false on DataRow does not work.

example

View:
  title: DataGrid
  Column:
    styles: { gap: 12, padding: 24, scrollable: true }
    children:
      - DataGrid: 
          DataColumns:
            - label: Hotel Name
              type: text
              tooltip: Hotel Name
            - label: Location
              type: text
              tooltip: Location
          children:
            - DataRow:
                children:
                  - Text:
                      text: My Hotel
                  - Text:
                      style: {font: subtitle}
                      text: Location
            - DataRow:
                visible: false
                styles: {font: subtitle}
                children:
                  - Text:
                      text: My Hotel - hidden row
                  - Text:
                      style: {font: subtitle}
                      text: Location

Support getting device location

  1. get device's location (lat, lng)
  2. option to continuously callback when location has changed (further than x meters from previous location)

Default value in a drop down rather than Hint text

It doesn't look like it is possible to have one of the values in a dropdown appear as a default, already selected, value. This would be rather than the Hint text parameter.

For example:

      - Dropdown:
          label: Select a payment card
          default: 0 #<-- the index of the default value in the items list
          items:
            - 5186***************
            - 5120***************
            - 2223***************
          required: true

This would then show the value (5186***************) rather than any hint text or an empty dropdown. In addition, any sort of code or selection logic would pick up this selected value even if the user never interacts with the dropdown.

Concurrent API calls

I want to be able to fire multiple actions for an event.

View:
  onLoad:
    - action: invokeAPI
      name:
      onResponse:
    - action: invokeAPI
      name:
      onResponse:

Reusable Ensemble widget

Use Cases -

  1. As an Ensemble app developer, I want to define a custom widget in Ensemble and reuse across any view of my app.
  2. Ensemble will be releasing a bunch of templates as re-usable custom widgets as well such as SummaryWidget, ProfileWidget etc.

Events on user interactions with the Carousel

There doesn't seem to be any event listeners for when a user interacts with a carousel. For example, when a user swipes between "cards" in a carousel it would be nice to have an "onChange" listener that would let us know what position in the array of content that the user is on.

This would open up a lot of new possibilities, including changing sub content as the user swipes. However, for our use case we just need to know which item the user has switched to so we can load a detail view for that item.

I'd imagine the listeners would follow the same structure as existing listeners for other elements such as onTap for the Button element.

errors on console when running on iOS simulator

Running this app - e74abf50-6177-456f-8556-0f01e5235860

following are the errors -

An Observatory debugger and profiler on iPhone 13 is available at: http://127.0.0.1:61286/cDkKUo-KVHY=/
The Flutter DevTools debugger and profiler on iPhone 13 is available at: http://127.0.0.1:9101?uri=http://127.0.0.1:61286/cDkKUo-KVHY=/
flutter: Code Error: Exception: Error: LateInitializationError: Field 'rootScopeManager' has not been initialized. while executing ensemble.storage.token = response.body.token;
flutter:
flutter: null
flutter: Code Error: Exception: Error: LateInitializationError: Field 'rootScopeManager' has not been initialized. while executing ensemble.storage.customerId = response.body.id;
flutter:
flutter: null
flutter: Code Error: Exception: Error: Exception: Cannot set a property on a null object. Property=enabled and prop value=true while executing connectBtn.enabled = true;
flutter:
flutter: null

Reusable actions

Background

There are use cases where I need to chain multiple actions of different types, and then trigger that set of actions on more than one event. E.g. run the action group on screen load and also when user presses a button.

Use case

As an app developer, I want to be able to create a reusable composite action globally and call it throughout my app.

Proposed syntax

# new section where I can define action groups to be reused
Actions:   

  # name the action
  myCustomAction:
    action : ...

ability to define re-usable code libraries and import them where needed

  1. Defining re-usable code
    Just like we define screens and widgets as re-usable, code itself is defined as another artifact except this artifact contains javascript code.
    Re-usable code contains -
  • functions such as
function add(a,b) { return a+b;}
  • vars such as
var counter = 0;
  1. Scope of imports
    Each import is resolved at the screen level. Code libraries cannot be used to share state across screens or widgets.
    Example
    myLib
var counter = 0;

Let's say myLib is imported in Home and Profile screens. The code in the Home screen updates the counter to 10. The Profile screen or any other screen that imported myLib will still get their own independent counter as 0.

  1. How are the variables and functions in re-usable libraries resolved in case of naming conflicts
    We apply the rules that ES5/HTML uses i.e. the last one wins except when the same library has been included multiple times.
    Example -
    commonUtils
var counter = 0;
function add(a,b) {return a + b;}

apiUtils

var counter = 10;
function add(a,b,c) {return a+b+c;}

Let's say the screen imports commonUtils and then apiUtils. Value of the counter will be 10 and the add function from apiUtils will be one invoked when anyone calls add in the page.

Same applies to re-usable widgets as well. Code libraries at the screen level are automatically inherited by all the widgets in the page. Widgets can have their own libraries as well. If widget imports the same library that is already imported in the screen it resides in, it is not imported again. Any new libraries are imported in the order defined.

  1. Importing code is supported in both Screens and Widgets as follows. Currently importing code within a code library is not supported. It is being tracked here - #1142

Importing Code in a screen -

Import:
  - apiUtils
  - common

View:
    # Optional - style the screen
    styles:
      scrollableView: true

    # Optional - set the header for the screen
    header:
      title: Home
    onLoad: |
      saveName('Khurram','Mahmood');
      console.log('name is ='+storageName);

    # Specify the body of the screen
    body:
      Column:
        styles:
          padding: 24
          gap: 8
        children:
          - Text:
              text: Hello ${ensemble.storage.jslibtest.name.first} ${ensemble.storage.jslibtest.name.last}

Importing in a re-usable widget -

Import:
  - common
  - apiUtils
Widget:
    inputs:
      - inputName
    body:
      Column:
        children:
          - Text:
              text: ${inputName.first} ${inputName.last}
          - Button:
              text: ${storageName.name.first} ${storageName.name.last}
              onTap: |-
                sayHello();
                console.log('name:'+getName());
                callAPI('mockAPI',{});

Ability to bind to variables

Global javascript variables/functions are processed AFTER the widget binding, so binding to a javascript variable will not work. Additionally, when the variable changes, we doesn’t dispatch changes so binding again is not working.

We need the Variable Invokable to notify us when it is modified, either directly via = or myVar.name =

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.