updates imports and finishes moving all commonly used files to the node_modules folder

This commit is contained in:
kevmodrome 2020-03-31 13:16:03 +02:00
parent 3cdb598b34
commit c120eb934d
48 changed files with 305 additions and 273 deletions

View File

@ -214,13 +214,12 @@ export default {
// Watch the `dist` directory and refresh the // Watch the `dist` directory and refresh the
// browser on changes when not in production // browser on changes when not in production
!production && serve(),
!production && livereload(outputpath), !production && livereload(outputpath),
!production && !production &&
browsersync({ browsersync({
server: outputpath, server: outputpath,
middleware: [apiProxy, _builderProxy], middleware: [apiProxy, _builderProxy],
}), }),
// If we're building for production (npm run build // If we're building for production (npm run build
// instead of npm run dev), minify // instead of npm run dev), minify

View File

@ -8,7 +8,7 @@
import Spinner from "components/common/Spinner.svelte" import Spinner from "components/common/Spinner.svelte"
import AppNotification, { import AppNotification, {
showAppNotification, showAppNotification,
} from "components/AppNotification.svelte" } from "components/common/AppNotification.svelte"
let init = initialise() let init = initialise()

View File

@ -1,5 +1,5 @@
import { filter, map, reduce, toPairs } from "lodash/fp" import { filter, map, reduce, toPairs } from "lodash/fp"
import { pipe } from "../common/core" import { pipe } from "components/common/core"
const self = n => n const self = n => n
const join_with = delimiter => a => a.join(delimiter) const join_with = delimiter => a => a.join(delimiter)

View File

@ -1,5 +1,5 @@
import { flatten, values, uniq, map } from "lodash/fp" import { flatten, values, uniq, map } from "lodash/fp"
import { pipe } from "../common/core" import { pipe } from "components/common/core"
export const loadLibs = async (appName, appPackage) => { export const loadLibs = async (appName, appPackage) => {
const allLibraries = {} const allLibraries = {}

View File

@ -1,7 +1,7 @@
import { writable } from "svelte/store" import { writable } from "svelte/store"
import api from "../api" import api from "../api"
import { cloneDeep, sortBy, find, remove } from "lodash/fp" import { cloneDeep, sortBy, find, remove } from "lodash/fp"
import { hierarchy as hierarchyFunctions } from "../../../../core/src" import { hierarchy as hierarchyFunctions } from "../../../../../core/src"
import { import {
getNode, getNode,
validate, validate,
@ -10,7 +10,7 @@ import {
isIndex, isIndex,
canDeleteIndex, canDeleteIndex,
canDeleteRecord, canDeleteRecord,
} from "../../common/core" } from "components/common/core"
export const getBackendUiStore = () => { export const getBackendUiStore = () => {
const INITIAL_BACKEND_UI_STATE = { const INITIAL_BACKEND_UI_STATE = {
@ -100,9 +100,9 @@ export const saveBackend = async state => {
const instances_currentFirst = state.selectedDatabase const instances_currentFirst = state.selectedDatabase
? [ ? [
state.appInstances.find(i => i.id === state.selectedDatabase.id), state.appInstances.find(i => i.id === state.selectedDatabase.id),
...state.appInstances.filter(i => i.id !== state.selectedDatabase.id), ...state.appInstances.filter(i => i.id !== state.selectedDatabase.id),
] ]
: state.appInstances : state.appInstances
for (let instance of instances_currentFirst) { for (let instance of instances_currentFirst) {

View File

@ -1,18 +1,18 @@
import { filter, cloneDeep, last, concat, isEmpty, values } from "lodash/fp" import { filter, cloneDeep, last, concat, isEmpty, values } from "lodash/fp"
import { pipe, getNode, constructHierarchy } from "../../common/core" import { pipe, getNode, constructHierarchy } from "components/common/core"
import * as backendStoreActions from "./backend" import * as backendStoreActions from "./backend"
import { writable } from "svelte/store" import { writable } from "svelte/store"
import { defaultPagesObject } from "../../userInterface/pagesParsing/defaultPagesObject" import { defaultPagesObject } from "components/userInterface/pagesParsing/defaultPagesObject"
import api from "../api" import api from "../api"
import { getExactComponent } from "../../userInterface/pagesParsing/searchComponents" import { getExactComponent } from "components/userInterface/pagesParsing/searchComponents"
import { rename } from "../../userInterface/pagesParsing/renameScreen" import { rename } from "components/userInterface/pagesParsing/renameScreen"
import { import {
getNewScreen, getNewScreen,
createProps, createProps,
makePropsSafe, makePropsSafe,
getBuiltin, getBuiltin,
} from "../../userInterface/pagesParsing/createProps" } from "components/userInterface/pagesParsing/createProps"
import { expandComponentDefinition } from "../../userInterface/pagesParsing/types" import { expandComponentDefinition } from "components/userInterface/pagesParsing/types"
import { loadLibs, libUrlsForPreview } from "../loadComponentLibraries" import { loadLibs, libUrlsForPreview } from "../loadComponentLibraries"
import { buildCodeForScreens } from "../buildCodeForScreens" import { buildCodeForScreens } from "../buildCodeForScreens"
import { generate_screen_css } from "../generate_css" import { generate_screen_css } from "../generate_css"

View File

@ -1,12 +1,15 @@
<script> <script>
import ButtonGroup from "../common/ButtonGroup.svelte" import ButtonGroup from "components/common/ButtonGroup.svelte"
import Button from "../common/Button.svelte" import Button from "components/common/Button.svelte"
import ActionButton from "../common/ActionButton.svelte" import ActionButton from "components/common/ActionButton.svelte"
import { store, backendUiStore } from "../builderStore" import { store, backendUiStore } from "builderStore"
import { generateFullPermissions, getNewAccessLevel } from "../common/core" import {
import getIcon from "../common/icon" generateFullPermissions,
getNewAccessLevel,
} from "components/common/core"
import getIcon from "components/common/icon"
import AccessLevelView from "./AccessLevelView.svelte" import AccessLevelView from "./AccessLevelView.svelte"
import Modal from "../common/Modal.svelte" import Modal from "components/common/Modal.svelte"
let editingLevel = null let editingLevel = null
let editingLevelIsNew = false let editingLevelIsNew = false

View File

@ -1,12 +1,12 @@
<script> <script>
import Textbox from "../common/Textbox.svelte" import Textbox from "components/common/Textbox.svelte"
import Button from "../common/Button.svelte" import Button from "components/common/Button.svelte"
import ActionButton from "../common/ActionButton.svelte" import ActionButton from "components/common/ActionButton.svelte"
import ButtonGroup from "../common/ButtonGroup.svelte" import ButtonGroup from "components/common/ButtonGroup.svelte"
import { cloneDeep, filter, keys, map, isUndefined } from "lodash/fp" import { cloneDeep, filter, keys, map, isUndefined } from "lodash/fp"
import ErrorsBox from "../common/ErrorsBox.svelte" import ErrorsBox from "components/common/ErrorsBox.svelte"
import { validateActions, pipe } from "../common/core" import { validateActions, pipe } from "components/common/core"
import getIcon from "../common/icon" import getIcon from "components/common/icon"
export let action export let action
export let onFinished = action => {} export let onFinished = action => {}

View File

@ -1,11 +1,11 @@
<script> <script>
import getIcon from "../common/icon" import getIcon from "components/common/icon"
import { store } from "../builderStore" import { store } from "builderStore"
import Button from "../common/Button.svelte" import Button from "components/common/Button.svelte"
import ButtonGroup from "../common/ButtonGroup.svelte" import ButtonGroup from "components/common/ButtonGroup.svelte"
import ActionView from "./ActionView.svelte" import ActionView from "./ActionView.svelte"
import Modal from "../common/Modal.svelte" import Modal from "components/common/Modal.svelte"
import { pipe } from "../common/core" import { pipe } from "components/common/core"
import { keys, map, join } from "lodash/fp" import { keys, map, join } from "lodash/fp"
export let editingActionIsNew = false export let editingActionIsNew = false

View File

@ -1,12 +1,12 @@
<script> <script>
import getIcon from "../common/icon" import getIcon from "components/common/icon"
import { store } from "../builderStore" import { store } from "builderStore"
import Button from "../common/Button.svelte" import Button from "components/common/Button.svelte"
import ActionButton from "../common/ActionButton.svelte" import ActionButton from "components/common/ActionButton.svelte"
import ButtonGroup from "../common/ButtonGroup.svelte" import ButtonGroup from "components/common/ButtonGroup.svelte"
import Actions from "./Actions.svelte" import Actions from "./Actions.svelte"
import Triggers from "./Triggers.svelte" import Triggers from "./Triggers.svelte"
import { getNewAction, getNewTrigger } from "../common/core" import { getNewAction, getNewTrigger } from "components/common/core"
let editingAction = null let editingAction = null
let editingActionIsNew = true let editingActionIsNew = true
@ -14,16 +14,19 @@
let editingTriggerIsNew = true let editingTriggerIsNew = true
let getDefaultOptionsHtml = defaultOptions => let getDefaultOptionsHtml = defaultOptions =>
pipe(defaultOptions, [ pipe(
keys, defaultOptions,
map( [
k => keys,
`<span style="color:var(--slate)">${k}: </span>${JSON.parse( map(
typeOptions[k] k =>
)}` `<span style="color:var(--slate)">${k}: </span>${JSON.parse(
), typeOptions[k]
join("<br>"), )}`
]) ),
join("<br>"),
]
)
let onActionEdit = action => { let onActionEdit = action => {
editingAction = action editingAction = action

View File

@ -1,14 +1,14 @@
<script> <script>
import Textbox from "../common/Textbox.svelte" import Textbox from "components/common/Textbox.svelte"
import Button from "../common/Button.svelte" import Button from "components/common/Button.svelte"
import ActionButton from "../common/ActionButton.svelte" import ActionButton from "components/common/ActionButton.svelte"
import Dropdown from "../common/Dropdown.svelte" import Dropdown from "components/common/Dropdown.svelte"
import ButtonGroup from "../common/ButtonGroup.svelte" import ButtonGroup from "components/common/ButtonGroup.svelte"
import CodeArea from "../common/CodeArea.svelte" import CodeArea from "components/common/CodeArea.svelte"
import { cloneDeep, filter, keys, some, map, isUndefined } from "lodash/fp" import { cloneDeep, filter, keys, some, map, isUndefined } from "lodash/fp"
import ErrorsBox from "../common/ErrorsBox.svelte" import ErrorsBox from "components/common/ErrorsBox.svelte"
import { validateTriggers, pipe, events } from "../common/core" import { validateTriggers, pipe, events } from "components/common/core"
import getIcon from "../common/icon" import getIcon from "components/common/icon"
export let trigger export let trigger
export let onFinished = action => {} export let onFinished = action => {}
@ -22,7 +22,10 @@
let cancel = () => onFinished() let cancel = () => onFinished()
let save = () => { let save = () => {
const newTriggersList = [ const newTriggersList = [
...pipe(allTriggers, [filter(t => t !== trigger)]), ...pipe(
allTriggers,
[filter(t => t !== trigger)]
),
clonedTrigger, clonedTrigger,
] ]

View File

@ -1,8 +1,8 @@
<script> <script>
import { store } from "../builderStore" import { store } from "builderStore"
import getIcon from "../common/icon" import getIcon from "components/common/icon"
import Button from "../common/Button.svelte" import Button from "components/common/Button.svelte"
import Modal from "../common/Modal.svelte" import Modal from "components/common/Modal.svelte"
import TriggerView from "./TriggerView.svelte" import TriggerView from "./TriggerView.svelte"
export let editingTrigger = null export let editingTrigger = null

View File

@ -3,17 +3,17 @@ import {
common, common,
getTemplateApi, getTemplateApi,
getAuthApi, getAuthApi,
} from "../../../core/src" } from "../../../../../core/src"
import { _getNew } from "../../../core/src/recordApi/getNew" import { _getNew } from "../../../../../core/src/recordApi/getNew"
import { find, filter, keyBy, flatten, map } from "lodash/fp" import { find, filter, keyBy, flatten, map } from "lodash/fp"
import { generateSchema } from "../../../core/src/indexing/indexSchemaCreator" import { generateSchema } from "../../../../../core/src/indexing/indexSchemaCreator"
import { generate } from "shortid" import { generate } from "shortid"
export { canDeleteIndex } from "../../../core/src/templateApi/canDeleteIndex" export { canDeleteIndex } from "../../../../../core/src/templateApi/canDeleteIndex"
export { canDeleteRecord } from "../../../core/src/templateApi/canDeleteRecord" export { canDeleteRecord } from "../../../../../core/src/templateApi/canDeleteRecord"
export { userWithFullAccess } from "../../../core/src/index" export { userWithFullAccess } from "../../../../../core/src/index"
export { joinKey } from "../../../core/src/common" export { joinKey } from "../../../../../core/src/common"
export { getExactNodeForKey } from "../../../core/src/templateApi/hierarchy" export { getExactNodeForKey } from "../../../../../core/src/templateApi/hierarchy"
export const pipe = common.$ export const pipe = common.$
export const events = common.eventsList export const events = common.eventsList
@ -38,7 +38,7 @@ export const authApi = (hierarchy, actions) =>
getAuthApi({ getAuthApi({
hierarchy, hierarchy,
actions: keyBy("name")(actions), actions: keyBy("name")(actions),
publish: () => {}, publish: () => { },
}) })
export const allTypes = templateApi({}).allTypes export const allTypes = templateApi({}).allTypes

View File

@ -1,7 +1,7 @@
import { eventHandlers } from "../../../client/src/state/eventHandlers" import { eventHandlers } from "../../../../../client/src/state/eventHandlers"
import { writable } from "svelte/store" import { writable } from "svelte/store"
export { EVENT_TYPE_MEMBER_NAME } from "../../../client/src/state/eventHandlers" export { EVENT_TYPE_MEMBER_NAME } from "../../../../../client/src/state/eventHandlers"
import { createCoreApi } from "../../../client/src/core" import { createCoreApi } from "../../../../../client/src/core"
export const allHandlers = (appDefinition, user) => { export const allHandlers = (appDefinition, user) => {
const coreApi = createCoreApi(appDefinition, user) const coreApi = createCoreApi(appDefinition, user)

View File

@ -2,11 +2,11 @@
import ModelView from "./ModelView.svelte" import ModelView from "./ModelView.svelte"
import IndexView from "./IndexView.svelte" import IndexView from "./IndexView.svelte"
import ModelDataTable from "./ModelDataTable" import ModelDataTable from "./ModelDataTable"
import { store, backendUiStore } from "../builderStore" import { store, backendUiStore } from "builderStore"
import getIcon from "../common/icon" import getIcon from "components/common/icon"
import DropdownButton from "../common/DropdownButton.svelte" import DropdownButton from "components/common/DropdownButton.svelte"
import ActionButton from "../common/ActionButton.svelte" import ActionButton from "components/common/ActionButton.svelte"
import Modal from "../common/Modal.svelte" import Modal from "components/common/Modal.svelte"
import * as api from "./ModelDataTable/api" import * as api from "./ModelDataTable/api"
import { import {
CreateEditRecordModal, CreateEditRecordModal,

View File

@ -1,13 +1,16 @@
<script> <script>
import Textbox from "../common/Textbox.svelte" import Textbox from "components/common/Textbox.svelte"
import CodeArea from "../common/CodeArea.svelte" import CodeArea from "components/common/CodeArea.svelte"
import Button from "../common/Button.svelte" import Button from "components/common/Button.svelte"
import Dropdown from "../common/Dropdown.svelte" import Dropdown from "components/common/Dropdown.svelte"
import { store } from "../builderStore" import { store } from "builderStore"
import { filter, some, map, compose } from "lodash/fp" import { filter, some, map, compose } from "lodash/fp"
import { hierarchy as hierarchyFunctions, common } from "../../../core/src" import {
import ErrorsBox from "../common/ErrorsBox.svelte" hierarchy as hierarchyFunctions,
import ActionButton from "../common/ActionButton.svelte" common,
} from "../../../../../core/src/"
import ErrorsBox from "components/common/ErrorsBox.svelte"
import ActionButton from "components/common/ActionButton.svelte"
const SNIPPET_EDITORS = { const SNIPPET_EDITORS = {
MAP: "Map", MAP: "Map",

View File

@ -1,6 +1,6 @@
<script> <script>
import { onMount } from "svelte" import { onMount } from "svelte"
import { store, backendUiStore } from "../../builderStore" import { store, backendUiStore } from "builderStore"
import { import {
tap, tap,
get, get,
@ -11,11 +11,11 @@
map, map,
remove, remove,
keys, keys,
takeRight takeRight,
} from "lodash/fp" } from "lodash/fp"
import Select from "../../common/Select.svelte" import Select from "components/common/Select.svelte"
import { getIndexSchema } from "../../common/core" import { getIndexSchema } from "components/common/core"
import ActionButton from "../../common/ActionButton.svelte" import ActionButton from "components/common/ActionButton.svelte"
import TablePagination from "./TablePagination.svelte" import TablePagination from "./TablePagination.svelte"
import { DeleteRecordModal } from "./modals" import { DeleteRecordModal } from "./modals"
import * as api from "./api" import * as api from "./api"
@ -56,7 +56,11 @@
const getSchema = getIndexSchema($store.hierarchy) const getSchema = getIndexSchema($store.hierarchy)
const childViewsForRecord = compose(flatten, map("indexes"), get("children")) const childViewsForRecord = compose(
flatten,
map("indexes"),
get("children")
)
const hideInternalHeaders = compose( const hideInternalHeaders = compose(
remove(headerName => INTERNAL_HEADERS.includes(headerName)), remove(headerName => INTERNAL_HEADERS.includes(headerName)),
@ -95,7 +99,9 @@
<section> <section>
<div class="table-controls"> <div class="table-controls">
<h4 class="budibase__title--3">{takeRight(2, $backendUiStore.breadcrumbs).join(" / ")}</h4> <h4 class="budibase__title--3">
{takeRight(2, $backendUiStore.breadcrumbs).join(' / ')}
</h4>
<Select icon="ri-eye-line" bind:value={$backendUiStore.selectedView}> <Select icon="ri-eye-line" bind:value={$backendUiStore.selectedView}>
{#each views as view} {#each views as view}
<option value={view}>{view.name}</option> <option value={view}>{view.name}</option>

View File

@ -1,5 +1,5 @@
<script> <script>
import { backendUiStore } from "../../builderStore" import { backendUiStore } from "builderStore"
export let data export let data
export let currentPage export let currentPage

View File

@ -1,5 +1,5 @@
import api from "../../builderStore/api" import api from "builderStore/api"
import { getNewRecord, getNewInstance } from "../../common/core" import { getNewRecord, getNewInstance } from "components/common/core"
export async function createUser(password, user, { appname, instanceId }) { export async function createUser(password, user, { appname, instanceId }) {
const CREATE_USER_URL = `/_builder/instance/${appname}/${instanceId}/api/createUser` const CREATE_USER_URL = `/_builder/instance/${appname}/${instanceId}/api/createUser`

View File

@ -1,7 +1,7 @@
<script> <script>
import Modal from "../../../common/Modal.svelte" import Modal from "components/common/Modal.svelte"
import { store } from "../../../builderStore" import { store } from "builderStore"
import ActionButton from "../../../common/ActionButton.svelte" import ActionButton from "components/common/ActionButton.svelte"
import * as api from "../api" import * as api from "../api"
export let onClosed export let onClosed

View File

@ -1,7 +1,7 @@
<script> <script>
import Modal from "../../../common/Modal.svelte" import Modal from "components/common/Modal.svelte"
import ActionButton from "../../../common/ActionButton.svelte" import ActionButton from "components/common/ActionButton.svelte"
import { backendUiStore } from "../../../builderStore" import { backendUiStore } from "builderStore"
import ModelView from "../../ModelView.svelte" import ModelView from "../../ModelView.svelte"
import * as api from "../api" import * as api from "../api"
</script> </script>

View File

@ -1,18 +1,18 @@
<script> <script>
import { onMount } from "svelte" import { onMount } from "svelte"
import { store, backendUiStore } from "../../../builderStore" import { store, backendUiStore } from "builderStore"
import { compose, map, get, flatten } from "lodash/fp" import { compose, map, get, flatten } from "lodash/fp"
import Modal from "../../../common/Modal.svelte" import Modal from "components/common/Modal.svelte"
import ActionButton from "../../../common/ActionButton.svelte" import ActionButton from "components/common/ActionButton.svelte"
import Select from "../../../common/Select.svelte" import Select from "components/common/Select.svelte"
import { import {
getNewRecord, getNewRecord,
joinKey, joinKey,
getExactNodeForKey, getExactNodeForKey,
} from "../../../common/core" } from "components/common/core"
import RecordFieldControl from "./RecordFieldControl.svelte" import RecordFieldControl from "./RecordFieldControl.svelte"
import * as api from "../api" import * as api from "../api"
import ErrorsBox from "../../../common/ErrorsBox.svelte" import ErrorsBox from "components/common/ErrorsBox.svelte"
export let record export let record
export let onClosed export let onClosed

View File

@ -1,7 +1,7 @@
<script> <script>
import Modal from "../../../common/Modal.svelte" import Modal from "components/common/Modal.svelte"
import { store, backendUiStore } from "../../../builderStore" import { store, backendUiStore } from "builderStore"
import ActionButton from "../../../common/ActionButton.svelte" import ActionButton from "components/common/ActionButton.svelte"
import * as api from "../api" import * as api from "../api"
export let onClosed export let onClosed

View File

@ -1,7 +1,7 @@
<script> <script>
import Modal from "../../../common/Modal.svelte" import Modal from "components/common/Modal.svelte"
import ActionButton from "../../../common/ActionButton.svelte" import ActionButton from "components/common/ActionButton.svelte"
import { store, backendUiStore } from "../../../builderStore" import { store, backendUiStore } from "builderStore"
import * as api from "../api" import * as api from "../api"
export let record export let record

View File

@ -1,12 +1,12 @@
<script> <script>
import { tick } from "svelte" import { tick } from "svelte"
import Textbox from "../common/Textbox.svelte" import Textbox from "components/common/Textbox.svelte"
import Button from "../common/Button.svelte" import Button from "components/common/Button.svelte"
import Select from "../common/Select.svelte" import Select from "components/common/Select.svelte"
import ActionButton from "../common/ActionButton.svelte" import ActionButton from "components/common/ActionButton.svelte"
import getIcon from "../common/icon" import getIcon from "components/common/icon"
import FieldView from "./FieldView.svelte" import FieldView from "./FieldView.svelte"
import Modal from "../common/Modal.svelte" import Modal from "components/common/Modal.svelte"
import { import {
get, get,
compose, compose,
@ -18,11 +18,11 @@
keys, keys,
isDate, isDate,
} from "lodash/fp" } from "lodash/fp"
import { store, backendUiStore } from "../builderStore" import { store, backendUiStore } from "builderStore"
import { common, hierarchy } from "../../../core/src" import { common, hierarchy } from "../../../../../core/src/"
import { getNode } from "../common/core" import { getNode } from "components/common/core"
import { templateApi, pipe, validate } from "../common/core" import { templateApi, pipe, validate } from "components/common/core"
import ErrorsBox from "../common/ErrorsBox.svelte" import ErrorsBox from "components/common/ErrorsBox.svelte"
let record let record
let getIndexAllowedRecords let getIndexAllowedRecords
@ -154,7 +154,7 @@
<div>{field.name}</div> <div>{field.name}</div>
</td> </td>
<td>{field.type}</td> <td>{field.type}</td>
<td>{field.typeOptions.values || ""}</td> <td>{field.typeOptions.values || ''}</td>
<td> <td>
<i <i
class="ri-delete-bin-6-line hoverable" class="ri-delete-bin-6-line hoverable"
@ -164,26 +164,28 @@
{/each} {/each}
</tbody> </tbody>
</table> </table>
<div class="uk-margin"> <div class="uk-margin">
<ActionButton color="secondary" on:click={store.saveCurrentNode}> <ActionButton color="secondary" on:click={store.saveCurrentNode}>
Save Save
</ActionButton>
{#if modelExistsInHierarchy}
<ActionButton color="primary" on:click={store.newChildRecord}>
Create Child Model on {record.name}
</ActionButton> </ActionButton>
{#if modelExistsInHierarchy} <ActionButton
<ActionButton color="primary" on:click={store.newChildRecord}> color="primary"
Create Child Model on {record.name} on:click={async () => {
</ActionButton> backendUiStore.actions.modals.show('VIEW')
<ActionButton await tick()
color="primary" store.newChildIndex()
on:click={async () => { }}>
backendUiStore.actions.modals.show('VIEW') Create Child View on {record.name}
await tick() </ActionButton>
store.newChildIndex() <ActionButton alert on:click={store.deleteCurrentNode}>
}}> Delete
Create Child View on {record.name} </ActionButton>
</ActionButton> {/if}
<ActionButton alert on:click={store.deleteCurrentNode}>Delete</ActionButton> </div>
{/if}
</div>
{:else} {:else}
<FieldView <FieldView
field={fieldToEdit} field={fieldToEdit}

View File

@ -1,12 +1,11 @@
<script> <script>
import { getContext } from "svelte" import { getContext } from "svelte"
import { store, backendUiStore } from "../builderStore" import { store, backendUiStore } from "builderStore"
import HierarchyRow from "./HierarchyRow.svelte" import HierarchyRow from "./HierarchyRow.svelte"
import DatabasesList from "./DatabasesList.svelte" import DatabasesList from "./DatabasesList.svelte"
import UsersList from "./UsersList.svelte" import UsersList from "./UsersList.svelte"
import { hierarchy as hierarchyFunctions } from "../../../core/src"
import NavItem from "./NavItem.svelte" import NavItem from "./NavItem.svelte"
import getIcon from "../common/icon" import getIcon from "components/common/icon"
</script> </script>
<div class="items-root"> <div class="items-root">

View File

@ -1,6 +1,6 @@
<script> <script>
import { tick } from "svelte" import { tick } from "svelte"
import { store, backendUiStore } from "../builderStore" import { store, backendUiStore } from "builderStore"
import getIcon from "../common/icon" import getIcon from "../common/icon"
import { CheckIcon } from "../common/Icons" import { CheckIcon } from "../common/Icons"

View File

@ -1,6 +1,6 @@
<script> <script>
import { getContext } from "svelte" import { getContext } from "svelte"
import { store, backendUiStore } from "../builderStore" import { store, backendUiStore } from "builderStore"
import { cloneDeep } from "lodash/fp" import { cloneDeep } from "lodash/fp"
import getIcon from "../common/icon" import getIcon from "../common/icon"

View File

@ -1,6 +1,6 @@
<script> <script>
import getIcon from "../common/icon" import getIcon from "../common/icon"
import { backendUiStore } from "../builderStore" import { backendUiStore } from "builderStore"
export let name = "" export let name = ""
export let label = "" export let label = ""

View File

@ -1,10 +1,9 @@
<script> <script>
import { store, backendUiStore } from "../builderStore" import { store, backendUiStore } from "builderStore"
import HierarchyRow from "./HierarchyRow.svelte" import HierarchyRow from "./HierarchyRow.svelte"
import DropdownButton from "../common/DropdownButton.svelte" import DropdownButton from "components/common/DropdownButton.svelte"
import { hierarchy as hierarchyFunctions } from "../../../core/src"
import NavItem from "./NavItem.svelte" import NavItem from "./NavItem.svelte"
import getIcon from "../common/icon" import getIcon from "components/common/icon"
function newModel() { function newModel() {
if ($store.currentNode) { if ($store.currentNode) {

View File

@ -1,7 +1,7 @@
<script> <script>
import { onMount } from "svelte" import { onMount } from "svelte"
import { store, backendUiStore } from "../builderStore" import { store, backendUiStore } from "builderStore"
import api from "../builderStore/api" import api from "builderStore/api"
import getIcon from "../common/icon" import getIcon from "../common/icon"
import { CheckIcon } from "../common/Icons" import { CheckIcon } from "../common/Icons"

View File

@ -1,8 +1,8 @@
<script> <script>
import { store } from "../builderStore" import { store } from "builderStore"
import UIkit from "uikit" import UIkit from "uikit"
import ActionButton from "../common/ActionButton.svelte" import ActionButton from "components/common/ActionButton.svelte"
import ButtonGroup from "../common/ButtonGroup.svelte" import ButtonGroup from "components/common/ButtonGroup.svelte"
import CodeMirror from "codemirror" import CodeMirror from "codemirror"
import "codemirror/mode/javascript/javascript.js" import "codemirror/mode/javascript/javascript.js"

View File

@ -1,15 +1,15 @@
<script> <script>
import PropsView from "./PropsView.svelte" import PropsView from "./PropsView.svelte"
import StateBindingControl from "./StateBindingControl.svelte" import StateBindingControl from "./StateBindingControl.svelte"
import { store } from "../builderStore" import { store } from "builderStore"
import IconButton from "../common/IconButton.svelte" import IconButton from "components/common/IconButton.svelte"
import { import {
LayoutIcon, LayoutIcon,
PaintIcon, PaintIcon,
TerminalIcon, TerminalIcon,
CircleIndicator, CircleIndicator,
EventsIcon, EventsIcon,
} from "../common/Icons/" } from "components/common/Icons/"
import CodeEditor from "./CodeEditor.svelte" import CodeEditor from "./CodeEditor.svelte"
import LayoutEditor from "./LayoutEditor.svelte" import LayoutEditor from "./LayoutEditor.svelte"
import EventsEditor from "./EventsEditor" import EventsEditor from "./EventsEditor"

View File

@ -1,6 +1,6 @@
<script> <script>
import { splitName } from "./pagesParsing/splitRootComponentName.js" import { splitName } from "./pagesParsing/splitRootComponentName.js"
import { store } from "../builderStore" import { store } from "builderStore"
import { import {
find, find,
sortBy, sortBy,
@ -11,16 +11,16 @@
uniqBy, uniqBy,
flatten, flatten,
} from "lodash/fp" } from "lodash/fp"
import { ImageIcon, InputIcon, LayoutIcon } from "../common/Icons/" import { ImageIcon, InputIcon, LayoutIcon } from "components/common/Icons/"
import Select from "../common/Select.svelte" import Select from "components/common/Select.svelte"
import Button from "../common/PlusButton.svelte" import Button from "components/common/PlusButton.svelte"
import ConfirmDialog from "../common/ConfirmDialog.svelte" import ConfirmDialog from "components/common/ConfirmDialog.svelte"
import { import {
getRecordNodes, getRecordNodes,
getIndexNodes, getIndexNodes,
getIndexSchema, getIndexSchema,
pipe, pipe,
} from "../common/core" } from "components/common/core"
export let toggleTab export let toggleTab
@ -35,13 +35,16 @@
$: templatesByComponent = groupBy(t => t.component)($store.templates) $: templatesByComponent = groupBy(t => t.component)($store.templates)
$: hierarchy = $store.hierarchy $: hierarchy = $store.hierarchy
$: libraryModules = $store.libraries $: libraryModules = $store.libraries
$: standaloneTemplates = pipe(templatesByComponent, [ $: standaloneTemplates = pipe(
values, templatesByComponent,
flatten, [
filter(t => !$store.components.some(c => c.name === t.component)), values,
map(t => ({ name: splitName(t.component).componentName, template: t })), flatten,
uniqBy(t => t.name), filter(t => !$store.components.some(c => c.name === t.component)),
]) map(t => ({ name: splitName(t.component).componentName, template: t })),
uniqBy(t => t.name),
]
)
const addRootComponent = (component, allComponents) => { const addRootComponent = (component, allComponents) => {
const { libName } = splitName(component.name) const { libName } = splitName(component.name)

View File

@ -2,10 +2,10 @@
import ComponentsHierarchyChildren from "./ComponentsHierarchyChildren.svelte" import ComponentsHierarchyChildren from "./ComponentsHierarchyChildren.svelte"
import { last, sortBy, map, trimCharsStart, trimChars, join } from "lodash/fp" import { last, sortBy, map, trimCharsStart, trimChars, join } from "lodash/fp"
import ConfirmDialog from "../common/ConfirmDialog.svelte" import ConfirmDialog from "components/common/ConfirmDialog.svelte"
import { pipe } from "../common/core" import { pipe } from "components/common/core"
import { store } from "../builderStore" import { store } from "builderStore"
import { ArrowDownIcon, ShapeIcon } from "../common/Icons/" import { ArrowDownIcon, ShapeIcon } from "components/common/Icons/"
export let screens = [] export let screens = []
@ -15,12 +15,15 @@
const joinPath = join("/") const joinPath = join("/")
const normalizedName = name => const normalizedName = name =>
pipe(name, [ pipe(
trimCharsStart("./"), name,
trimCharsStart("~/"), [
trimCharsStart("../"), trimCharsStart("./"),
trimChars(" "), trimCharsStart("~/"),
]) trimCharsStart("../"),
trimChars(" "),
]
)
const lastPartOfName = c => { const lastPartOfName = c => {
if (!c) return "" if (!c) return ""
@ -32,10 +35,10 @@
const isFolderSelected = (current, folder) => isInSubfolder(current, folder) const isFolderSelected = (current, folder) => isInSubfolder(current, folder)
$: _screens = pipe(screens, [ $: _screens = pipe(
map(c => ({ component: c, title: lastPartOfName(c) })), screens,
sortBy("title"), [map(c => ({ component: c, title: lastPartOfName(c) })), sortBy("title")]
]) )
const isScreenSelected = component => const isScreenSelected = component =>
component.component && component.component &&

View File

@ -1,5 +1,5 @@
<script> <script>
import { store } from "../builderStore/" import { store } from "builderStore/"
import ComponentPropertiesPanel from "./ComponentPropertiesPanel.svelte" import ComponentPropertiesPanel from "./ComponentPropertiesPanel.svelte"
import ComponentSelectionList from "./ComponentSelectionList.svelte" import ComponentSelectionList from "./ComponentSelectionList.svelte"

View File

@ -1,7 +1,7 @@
<script> <script>
import { store, backendUiStore } from "../builderStore" import { store, backendUiStore } from "builderStore"
import { map, join } from "lodash/fp" import { map, join } from "lodash/fp"
import { pipe } from "../common/core" import { pipe } from "components/common/core"
let iframe let iframe

View File

@ -10,18 +10,18 @@
filter, filter,
difference, difference,
} from "lodash/fp" } from "lodash/fp"
import { pipe } from "../../common/core" import { pipe } from "components/common/core"
import Checkbox from "../../common/Checkbox.svelte" import Checkbox from "components/common/Checkbox.svelte"
import Textbox from "../../common/Textbox.svelte" import Textbox from "components/common/Textbox.svelte"
import Dropdown from "../../common/Dropdown.svelte" import Dropdown from "components/common/Dropdown.svelte"
import PlusButton from "../../common/PlusButton.svelte" import PlusButton from "components/common/PlusButton.svelte"
import IconButton from "../../common/IconButton.svelte" import IconButton from "components/common/IconButton.svelte"
import Modal from "../../common/Modal.svelte" import Modal from "components/common/Modal.svelte"
import EventEditorModal from "./EventEditorModal.svelte" import EventEditorModal from "./EventEditorModal.svelte"
import HandlerSelector from "./HandlerSelector.svelte" import HandlerSelector from "./HandlerSelector.svelte"
import { PencilIcon } from "../../common/Icons" import { PencilIcon } from "components/common/Icons"
import { EVENT_TYPE_MEMBER_NAME } from "../../common/eventHandlers" import { EVENT_TYPE_MEMBER_NAME } from "components/common/eventHandlers"
export const EVENT_TYPE = "event" export const EVENT_TYPE = "event"

View File

@ -1,16 +1,16 @@
<script> <script>
import IconButton from "../../common/IconButton.svelte" import IconButton from "components/common/IconButton.svelte"
import PlusButton from "../../common/PlusButton.svelte" import PlusButton from "components/common/PlusButton.svelte"
import Select from "../../common/Select.svelte" import Select from "components/common/Select.svelte"
import StateBindingCascader from "./StateBindingCascader.svelte" import StateBindingCascader from "./StateBindingCascader.svelte"
import StateBindingControl from "../StateBindingControl.svelte" import StateBindingControl from "../StateBindingControl.svelte"
import { find, map, keys, reduce, keyBy } from "lodash/fp" import { find, map, keys, reduce, keyBy } from "lodash/fp"
import { pipe, userWithFullAccess } from "../../common/core" import { pipe, userWithFullAccess } from "components/common/core"
import { import {
EVENT_TYPE_MEMBER_NAME, EVENT_TYPE_MEMBER_NAME,
allHandlers, allHandlers,
} from "../../common/eventHandlers" } from "components/common/eventHandlers"
import { store } from "../../builderStore" import { store } from "builderStore"
export let handler export let handler
export let onCreate export let onCreate

View File

@ -1,18 +1,18 @@
<script> <script>
import IconButton from "../../common/IconButton.svelte" import IconButton from "components/common/IconButton.svelte"
import PlusButton from "../../common/PlusButton.svelte" import PlusButton from "components/common/PlusButton.svelte"
import Select from "../../common/Select.svelte" import Select from "components/common/Select.svelte"
import Input from "../../common/Input.svelte" import Input from "components/common/Input.svelte"
import StateBindingControl from "../StateBindingControl.svelte" import StateBindingControl from "../StateBindingControl.svelte"
import { find, map, keys, reduce, keyBy } from "lodash/fp" import { find, map, keys, reduce, keyBy } from "lodash/fp"
import { pipe, userWithFullAccess } from "../../common/core" import { pipe, userWithFullAccess } from "components/common/core"
import { import {
EVENT_TYPE_MEMBER_NAME, EVENT_TYPE_MEMBER_NAME,
allHandlers, allHandlers,
} from "../../common/eventHandlers" } from "components/common/eventHandlers"
import { store } from "../../builderStore" import { store } from "builderStore"
import StateBindingOptions from "../PropertyCascader/StateBindingOptions.svelte" import StateBindingOptions from "../PropertyCascader/StateBindingOptions.svelte"
import { ArrowDownIcon } from "../../common/Icons/" import { ArrowDownIcon } from "components/common/Icons/"
export let parameter export let parameter
export let onChange export let onChange

View File

@ -3,10 +3,10 @@
import ComponentsHierarchyChildren from "./ComponentsHierarchyChildren.svelte" import ComponentsHierarchyChildren from "./ComponentsHierarchyChildren.svelte"
import { last, sortBy, map, trimCharsStart, trimChars, join } from "lodash/fp" import { last, sortBy, map, trimCharsStart, trimChars, join } from "lodash/fp"
import ConfirmDialog from "../common/ConfirmDialog.svelte" import ConfirmDialog from "components/common/ConfirmDialog.svelte"
import { pipe } from "../common/core" import { pipe } from "components/common/core"
import { store } from "../builderStore" import { store } from "builderStore"
import { ArrowDownIcon, GridIcon } from "../common/Icons/" import { ArrowDownIcon, GridIcon } from "components/common/Icons/"
export let layout export let layout
@ -16,12 +16,15 @@
const joinPath = join("/") const joinPath = join("/")
const normalizedName = name => const normalizedName = name =>
pipe(name, [ pipe(
trimCharsStart("./"), name,
trimCharsStart("~/"), [
trimCharsStart("../"), trimCharsStart("./"),
trimChars(" "), trimCharsStart("~/"),
]) trimCharsStart("../"),
trimChars(" "),
]
)
const lastPartOfName = c => const lastPartOfName = c =>
c && last(c.name ? c.name.split("/") : c._component.split("/")) c && last(c.name ? c.name.split("/") : c._component.split("/"))
@ -30,7 +33,10 @@
const isFolderSelected = (current, folder) => isInSubfolder(current, folder) const isFolderSelected = (current, folder) => isInSubfolder(current, folder)
$: _layout = pipe(layout, [c => ({ component: c, title: lastPartOfName(c) })]) $: _layout = pipe(
layout,
[c => ({ component: c, title: lastPartOfName(c) })]
)
const isScreenSelected = component => const isScreenSelected = component =>
component.component && component.component &&

View File

@ -1,12 +1,12 @@
<script> <script>
import { store } from "../builderStore" import { store } from "builderStore"
import PropsView from "./PropsView.svelte" import PropsView from "./PropsView.svelte"
import Textbox from "../common/Textbox.svelte" import Textbox from "components/common/Textbox.svelte"
import Button from "../common/Button.svelte" import Button from "components/common/Button.svelte"
import ActionButton from "../common/ActionButton.svelte" import ActionButton from "components/common/ActionButton.svelte"
import ButtonGroup from "../common/ButtonGroup.svelte" import ButtonGroup from "components/common/ButtonGroup.svelte"
import ConfirmDialog from "../common/ConfirmDialog.svelte" import ConfirmDialog from "components/common/ConfirmDialog.svelte"
import { pipe } from "../common/core" import { pipe } from "components/common/core"
import UIkit from "uikit" import UIkit from "uikit"
import { isRootComponent } from "./pagesParsing/searchComponents" import { isRootComponent } from "./pagesParsing/searchComponents"
import { splitName } from "./pagesParsing/splitRootComponentName.js" import { splitName } from "./pagesParsing/splitRootComponentName.js"
@ -26,10 +26,13 @@
let saveAttempted = false let saveAttempted = false
$: layoutComponents = pipe($store.components, [ $: layoutComponents = pipe(
filter(c => c.container), $store.components,
map(c => ({ name: c.name, ...splitName(c.name) })), [
]) filter(c => c.container),
map(c => ({ name: c.name, ...splitName(c.name) })),
]
)
$: layoutComponent = layoutComponent $: layoutComponent = layoutComponent
? find(c => c.name === layoutComponent.name)(layoutComponents) ? find(c => c.name === layoutComponent.name)(layoutComponents)

View File

@ -1,20 +1,20 @@
<script> <script>
import Textbox from "../common/Textbox.svelte" import Textbox from "components/common/Textbox.svelte"
import Dropdown from "../common/Dropdown.svelte" import Dropdown from "components/common/Dropdown.svelte"
import Button from "../common/Button.svelte" import Button from "components/common/Button.svelte"
import { store } from "../builderStore" import { store } from "builderStore"
import { isRootComponent } from "./pagesParsing/searchComponents" import { isRootComponent } from "./pagesParsing/searchComponents"
import { pipe } from "../common/core" import { pipe } from "components/common/core"
import { filter, find, concat } from "lodash/fp" import { filter, find, concat } from "lodash/fp"
const notSeletedComponent = { name: "(none selected)" } const notSeletedComponent = { name: "(none selected)" }
$: page = $store.pages[$store.currentPageName] $: page = $store.pages[$store.currentPageName]
$: title = page.index.title $: title = page.index.title
$: components = pipe($store.components, [ $: components = pipe(
filter(store => !isRootComponent($store)), $store.components,
concat([notSeletedComponent]), [filter(store => !isRootComponent($store)), concat([notSeletedComponent])]
]) )
$: entryComponent = $: entryComponent =
find(c => c.name === page.appBody)(components) || notSeletedComponent find(c => c.name === page.appBody)(components) || notSeletedComponent

View File

@ -1,7 +1,7 @@
<script> <script>
import { store } from "../builderStore" import { store } from "builderStore"
import getIcon from "../common/icon" import getIcon from "components/common/icon"
import { CheckIcon } from "../common/Icons" import { CheckIcon } from "components/common/Icons"
const getPage = (s, name) => { const getPage = (s, name) => {
const props = s.pages[name] const props = s.pages[name]

View File

@ -1,8 +1,8 @@
<script> <script>
import { ArrowDownIcon } from "../../common/Icons/" import { ArrowDownIcon } from "components/common/Icons/"
import { store } from "../../builderStore" import { store } from "builderStore"
import { buildStateOrigins } from "../../builderStore/buildStateOrigins" import { buildStateOrigins } from "builderStore/buildStateOrigins"
import { isBinding, getBinding, setBinding } from "../../common/binding" import { isBinding, getBinding, setBinding } from "components/common/binding"
import StateBindingOptions from "./StateBindingOptions.svelte" import StateBindingOptions from "./StateBindingOptions.svelte"
export let onChanged = () => {} export let onChanged = () => {}

View File

@ -1,11 +1,11 @@
<script> <script>
import { store } from "../builderStore" import { store } from "builderStore"
import Textbox from "../common/Textbox.svelte" import Textbox from "components/common/Textbox.svelte"
import Button from "../common/Button.svelte" import Button from "components/common/Button.svelte"
import IconButton from "../common/IconButton.svelte" import IconButton from "components/common/IconButton.svelte"
import { libraryDependencies } from "./pagesParsing/findDependencies" import { libraryDependencies } from "./pagesParsing/findDependencies"
import UIkit from "uikit" import UIkit from "uikit"
import { libsFromPages } from "../builderStore/loadComponentLibraries" import { libsFromPages } from "builderStore/loadComponentLibraries"
let addNewLib = "" let addNewLib = ""
let addNewStylesheet = "" let addNewStylesheet = ""
let modalElement let modalElement

View File

@ -3,17 +3,17 @@
import ComponentsHierarchyChildren from "./ComponentsHierarchyChildren.svelte" import ComponentsHierarchyChildren from "./ComponentsHierarchyChildren.svelte"
import MasterLayout from "./MasterLayout.svelte" import MasterLayout from "./MasterLayout.svelte"
import PagesList from "./PagesList.svelte" import PagesList from "./PagesList.svelte"
import { store } from "../builderStore" import { store } from "builderStore"
import IconButton from "../common/IconButton.svelte" import IconButton from "components/common/IconButton.svelte"
import Modal from "../common/Modal.svelte" import Modal from "components/common/Modal.svelte"
import NewScreen from "./NewScreen.svelte" import NewScreen from "./NewScreen.svelte"
import CurrentItemPreview from "./CurrentItemPreview.svelte" import CurrentItemPreview from "./CurrentItemPreview.svelte"
import SettingsView from "./SettingsView.svelte" import SettingsView from "./SettingsView.svelte"
import PageView from "./PageView.svelte" import PageView from "./PageView.svelte"
import ComponentsPaneSwitcher from "./ComponentsPaneSwitcher.svelte" import ComponentsPaneSwitcher from "./ComponentsPaneSwitcher.svelte"
import ConfirmDialog from "../common/ConfirmDialog.svelte" import ConfirmDialog from "components/common/ConfirmDialog.svelte"
import { last } from "lodash/fp" import { last } from "lodash/fp"
import { AddIcon } from "../common/Icons" import { AddIcon } from "components/common/Icons"
let newScreenPicker let newScreenPicker
let confirmDeleteDialog let confirmDeleteDialog

View File

@ -1,7 +1,7 @@
import { isString, isUndefined } from "lodash/fp" import { isString, isUndefined } from "lodash/fp"
import { types } from "./types" import { types } from "./types"
import { assign } from "lodash" import { assign } from "lodash"
import { uuid } from "../../builderStore/uuid" import { uuid } from "builderStore/uuid"
export const getBuiltin = name => { export const getBuiltin = name => {
const { props } = createProps({ name }) const { props } = createProps({ name })