mashvp / mashvp-forms

No-bullsh!t form plugin for WordPress
MIT License
0 stars 0 forks source link

Roadmap for v1.0 remake #6

Open Schlipak opened 2 years ago

Schlipak commented 2 years ago

Notes for the v1.0 roadmap

Form structure format

Rework a standardized versioned format, write an RFC. It will probably not be compatible with the current beta format.

Front-end

Back-end

Admin UI

Rework the entire UI inside a single React app, with MobX-backed state.

Useful links

Schlipak commented 2 years ago

Notes on the new JSON format

Draft for the new JSON format

{
  "version": "1.0.0",
  "form_id": "WORDPRESS_POST_ID",
  "fields": [],
}

Field data should follow a similar structure structure :

{
  "type": "FIELD_TYPE_IDENTIFIER",
  "id": "FIELD_UUID",
  "rect": {
    "default": { "x": 0, "y": 0, "w": 1, "h": 1 },
    "breakpoints": [
        { "above": "@media min-width", "below": "@media max-width", "x": 0, "y": 0, "w": 1, "h": 1 },
        { "above": "@media min-width", "below": "@media max-width", "x": 0, "y": 0, "w": 1, "h": 1 },
    ]
  },
  "properties": { "...FIELD_SETTINGS" }
}

Dependent group field :

{
  "type": "dependent_group",
  "id": "FIELD_UUID",
  "rect": { "...FIELD_RECT" },
  "children": [ "...FIELDS_WITHOUT_RECT" ]
}

Dependent field:

{
  "...FIELD_STRUCT",
  "dependent": {
    "enabled": true,
    "predicate": [
      // OR conditions
      {
        // AND conditions
        "conditions": [
          { "field": "FIELD_ID", "operator": "equals", "value": "..." },
          { "field": "FIELD_ID", "operator": "not equals", "value": "..." },
          { "field": "FIELD_ID", "operator": "contains", "value": "..." },
          { "field": "FIELD_ID", "operator": "not contains", "value": "..." },
          { "field": "FIELD_ID", "operator": "like", "value": "..." },
          { "field": "FIELD_ID", "operator": "not like", "value": "..." }
        ]
      },
      {
        "conditions": ["..."]
      }
    ]
  }
}

→ Maintain a separate parser implementation for each breaking change version for the JSON to internal object representation conversion.