diff --git a/packages/builder/src/common/ActionButton.svelte b/packages/builder/src/common/ActionButton.svelte new file mode 100644 index 0000000000..4a09d55943 --- /dev/null +++ b/packages/builder/src/common/ActionButton.svelte @@ -0,0 +1,30 @@ + + + + + diff --git a/packages/builder/src/common/Input.svelte b/packages/builder/src/common/Input.svelte new file mode 100644 index 0000000000..04938b670a --- /dev/null +++ b/packages/builder/src/common/Input.svelte @@ -0,0 +1,27 @@ + + + + + diff --git a/packages/builder/src/common/Modal.svelte b/packages/builder/src/common/Modal.svelte index 0f47d553a0..3e716f5c9a 100644 --- a/packages/builder/src/common/Modal.svelte +++ b/packages/builder/src/common/Modal.svelte @@ -36,6 +36,7 @@ $: { .uk-modal-dialog { border-radius: .3rem; + width: 60%; } \ No newline at end of file diff --git a/packages/builder/src/common/Select.svelte b/packages/builder/src/common/Select.svelte index 9053803ca7..bebad32c38 100644 --- a/packages/builder/src/common/Select.svelte +++ b/packages/builder/src/common/Select.svelte @@ -14,21 +14,22 @@ select { display: block; - font-size: 16px; + font-size: 14px; font-family: sans-serif; - font-weight: 700; - color: #444; + font-weight: 500; + color: #163057; line-height: 1.3; padding: 1em 2.6em 0.9em 1.4em; width: 100%; max-width: 100%; box-sizing: border-box; margin: 0; - border-radius: 0.5em; -moz-appearance: none; -webkit-appearance: none; appearance: none; - background-color: #fafafa; + background: #fff; + border: 1px solid #ccc; + height: 50px; } .arrow { diff --git a/packages/builder/src/userInterface/ComponentPanel.svelte b/packages/builder/src/userInterface/ComponentPanel.svelte index 1fa8ce0642..d4d982f2e2 100644 --- a/packages/builder/src/userInterface/ComponentPanel.svelte +++ b/packages/builder/src/userInterface/ComponentPanel.svelte @@ -18,6 +18,7 @@ const onPropChanged = store.setComponentProp; const onStyleChanged = store.setComponentStyle; +
diff --git a/packages/builder/src/userInterface/EventListSelector.svelte b/packages/builder/src/userInterface/EventListSelector.svelte deleted file mode 100644 index cfbe20345d..0000000000 --- a/packages/builder/src/userInterface/EventListSelector.svelte +++ /dev/null @@ -1,88 +0,0 @@ - - -
-
- {#each events as ev, index} - -
- - -
- -
- {/each} - -
- -
-
-
- - - diff --git a/packages/builder/src/userInterface/EventSelector.svelte b/packages/builder/src/userInterface/EventSelector.svelte deleted file mode 100644 index e109d8122d..0000000000 --- a/packages/builder/src/userInterface/EventSelector.svelte +++ /dev/null @@ -1,105 +0,0 @@ - - -
- - - - -
- -{#if parameters} - {#each parameters as p, index} - -
- {p.name} -
- - - {/each} -{/if} - - diff --git a/packages/builder/src/userInterface/EventsEditor/EventEditorModal.svelte b/packages/builder/src/userInterface/EventsEditor/EventEditorModal.svelte index 3fa7ab44f9..74e3e956a2 100644 --- a/packages/builder/src/userInterface/EventsEditor/EventEditorModal.svelte +++ b/packages/builder/src/userInterface/EventsEditor/EventEditorModal.svelte @@ -1,19 +1,58 @@ - - {#if event} -

{event.name}

- {:else} -

Create a New Component Event

- {/if} - Click here to learn more about component events + +

{eventData.name || "Create a New Component Event"}

+

Click here to learn more about component events

-
-
Event Name
- -
-
Event Type
- + {#each events as event} + {/each}
Event Action(s)
- {#if event.handlers} - {#each event.handlers as handler, index} + { + createNewEventHandler(newEventHandler) + newEventHandler = { parameters: [] }; + }} + handler={newEventHandler} /> + {#if eventData} + {#each eventData.handlers as handler, index} removeEventHandler(index)} + onRemoved={() => deleteEventHandler(index)} {handler} /> -
{/each} {/if} -
addEventHandler(newEventType)}> - - Add Handler + +
+ Delete + Save
diff --git a/packages/builder/src/userInterface/EventsEditor/EventsEditor.svelte b/packages/builder/src/userInterface/EventsEditor/EventsEditor.svelte index 2947ca1b42..f351befc8d 100644 --- a/packages/builder/src/userInterface/EventsEditor/EventsEditor.svelte +++ b/packages/builder/src/userInterface/EventsEditor/EventsEditor.svelte @@ -31,18 +31,13 @@ let modalOpen = false; let events = []; - let selectedEvent = {}; - let newEventType = "onClick"; + let selectedEvent = null; - // TODO: only show events that have handlers - - $: events = - componentInfo && - Object.entries(componentInfo).filter( - ([name]) => findType(name) == EVENT_TYPE - ); - - $: action = selectedEvent ? "Edit" : "Create"; + $: { + events = Object.keys(componentInfo) + .filter(key => componentInfo[key].length && findType(key) === EVENT_TYPE) + .map(key => ({ name: key, handlers: componentInfo[key] })); + } function findType(propName) { if (!componentInfo._component) return; @@ -56,45 +51,9 @@ }; const closeModal = () => { - selectedEvent = {}; + selectedEvent = null; modalOpen = false; }; - - const addEventHandler = eventType => { - const newEventHandler = { - parameters: {}, - [EVENT_TYPE_MEMBER_NAME]: "" - }; - // TODO: improve - just pass the event from props - selectedEvent = { - ...selectedEvent, - handlers: [...(selectedEvent.handlers || []), newEventHandler] - }; - // events = [...events, newEventHandler]; - onPropChanged(newEventType, [...selectedEvent.handlers, newEventHandler]); - }; - - const changeEventHandler = (updatedHandler, index) => { - // TODO: Improve - const handlers = [...selectedEvent.handlers]; - handlers[index] = updatedHandler; - - console.log("CHANGED HANDLERS", handlers); - - selectedEvent = { - ...selectedEvent, - handlers - }; - - onPropChanged(newEventType, handlers); - }; - - // TODO: verify - const removeEventHandler = index => { - const handlers = [...selectedEvent.handlers]; - handlers.splice(index, 1); - onPropChanged(newEventType, handlers); - };

Events

- openModal({})} /> + openModal()} />
-
- {#each events as [name, handlers], index} - {#if handlers.length > 0} + {#each events as event, index} + {#if event.handlers.length > 0}
openModal({ name, handlers, index })}> - {name} + class="handler-container hierarchy-item {selectedEvent && selectedEvent.index === index ? 'selected' : ''}" + on:click={() => openModal({ ...event, index })}> + {event.name} + {event.name} EDIT - updateState
{/if} {/each}
+ /> diff --git a/packages/builder/src/userInterface/EventsEditor/HandlerSelector.svelte b/packages/builder/src/userInterface/EventsEditor/HandlerSelector.svelte index 9c30efb266..b84f371f73 100644 --- a/packages/builder/src/userInterface/EventsEditor/HandlerSelector.svelte +++ b/packages/builder/src/userInterface/EventsEditor/HandlerSelector.svelte @@ -1,7 +1,8 @@ - -{#if isBound} -
-
-
{isExpanded ? "" : bindingPath}
- isExpanded=!isExpanded}/> - {#if !canOnlyBind} - - {/if} -
- {#if isExpanded} -
-
Binding Path
- -
Fallback Value
- -
Binding Source
- -
- {/if} - -
-{:else} -
- - {#if type === "bool"} - -
- onChanged(!value)} /> -
- - {:else if type === "options"} - - - - {:else} - - onChanged(ev.target.value)} - bind:value={value} - style="flex: 1 0 auto;" /> - - - {/if} - -
-{/if} - - - diff --git a/packages/builder/src/userInterface/StateBindingControl.svelte b/packages/builder/src/userInterface/StateBindingControl.svelte index 32065a111e..2e5de88d6a 100644 --- a/packages/builder/src/userInterface/StateBindingControl.svelte +++ b/packages/builder/src/userInterface/StateBindingControl.svelte @@ -1,5 +1,6 @@