Vuex Actions
Modules
- component-data
- decorators
- deep-linking
- drawers
- forms
- layout-state
- lists
- nav
- page-data
- page-state
- preloader
- toolbar
- undo
- validators
component-data
- component-data
- static
- .saveComponent(store, uri, data, [eventID], [snapshot], [prevData], forceSave) ⇒
Promise
- .removeComponent(store, data) ⇒
Promise
- .removeHeadComponent(store, startNode) ⇒
Promise
- .addCreatedComponentsToPageArea(store, newComponents, currentURI, path, replace, number, array, boolean) ⇒
Promise
- .addComponents(store, [currentURI], parentURI, path, [replace], components) ⇒
Promise
- .openAddComponent(store, [currentURI], parentURI, path) ⇒
Promise
- .currentlyRestoring(store, restoring)
- .saveComponent(store, uri, data, [eventID], [snapshot], [prevData], forceSave) ⇒
- inner
- ~logSaveError(uri, e, data, [eventID], [snapshot], store)
- ~revertReject(uri, data, [snapshot], paths, store) ⇒
Promise
- ~clientSave(uri, data, oldData, store, [eventID], [snapshot], paths) ⇒
Promise
- ~findIndex(data, [uri]) ⇒
number
- ~addComponentsToComponentList(store, data, [currentURI], parentURI, path, [replace], components) ⇒
Promise
- ~addComponentsToComponentProp(store, data, parentURI, path, components) ⇒
Promise
- ~addComponentsToPageArea(store, currentURI, path, replace, components) ⇒
Promise
- static
Promise
component-data.saveComponent(store, uri, data, [eventID], [snapshot], [prevData], forceSave) ⇒ save a component's data and re-render
Kind: static method of component-data
Param | Type | Description |
---|---|---|
store | object | |
uri | string | |
data | object | (may be a subset of the data) |
[eventID] | string | when saving from a pubsub subscription |
[snapshot] | boolean | set to false if save is triggered by undo/redo |
[prevData] | object | manually passed in when undoing/redoing (because the store has already been updated) |
forceSave | boolean | if true, component will be saved even if it doesn't appear to have changed |
Promise
component-data.removeComponent(store, data) ⇒ remove a component from its parent note: removes from parent component OR page
Kind: static method of component-data
Param | Type | Description |
---|---|---|
store | object | |
data | Element | {el, msg} where el is the component to delete |
Promise
component-data.removeHeadComponent(store, startNode) ⇒ remove head components (from page or layout)
Kind: static method of component-data
Param | Type | Description |
---|---|---|
store | object | |
startNode | Node | comment with data-uri |
Promise
component-data.addCreatedComponentsToPageArea(store, newComponents, currentURI, path, replace, number, array, boolean) ⇒ add components to a page area when they have already been created when the page is being reverted to the published version for instance
Kind: static method of component-data
Param | Type |
---|---|
store | object |
newComponents | array |
currentURI | string |
path | string |
replace | boolean |
number | index |
array | data |
boolean | forceRender |
Promise
component-data.addComponents(store, [currentURI], parentURI, path, [replace], components) ⇒ add components to a parent component (or page) note: allows multiple components to be added at once note: always creates new instances of the components you're adding note: allows you to replace a specific uri, or add components after it note: if no currentURI passed in, it will add new components to the end (and won't replace anything)
Kind: static method of component-data
Returns: Promise
- with the last added component's el
Param | Type | Description |
---|---|---|
store | object | |
[currentURI] | string | if adding after / replacing a specific component |
parentURI | string | |
path | string | |
[replace] | boolean | to replace the current URI |
components | array | to add (object with name and [data]) |
Promise
component-data.openAddComponent(store, [currentURI], parentURI, path) ⇒ open the add components pane, or add a new components
Kind: static method of component-data
Param | Type | Description |
---|---|---|
store | object | |
[currentURI] | string | if we're inserting after a specific component |
parentURI | string | |
path | string |
component-data.currentlyRestoring(store, restoring)
open the add components pane, or add a new components
Kind: static method of component-data
Param | Type | Description |
---|---|---|
store | object | |
restoring | boolean | if we're currently restoring a page |
component-data~logSaveError(uri, e, data, [eventID], [snapshot], store)
log errors when components save and display them to the user
Kind: inner method of component-data
Param | Type |
---|---|
uri | string |
e | Error |
data | object |
[eventID] | string |
[snapshot] | boolean |
store | object |
Promise
component-data~revertReject(uri, data, [snapshot], paths, store) ⇒ re-render (reverting) a component and stop the saving promise chain
Kind: inner method of component-data
Param | Type |
---|---|
uri | string |
data | object |
[snapshot] | boolean |
paths | array |
store | object |
Promise
component-data~clientSave(uri, data, oldData, store, [eventID], [snapshot], paths) ⇒ save data client-side and queue up api call for the server note: this uses the components' model.js (if it exists) and handlebars template note: server-side saving and/or re-rendering has been removed in kiln v4.x
Kind: inner method of component-data
Param | Type | Description |
---|---|---|
uri | string | |
data | object | |
oldData | object | |
store | object | |
[eventID] | string | |
[snapshot] | boolean | passed through to render |
paths | array |
number
component-data~findIndex(data, [uri]) ⇒ find the index of a uri in a list this is broken out into a separate function so we don't assume an index of 0 is falsy
Kind: inner method of component-data
Param | Type |
---|---|
data | array |
[uri] | string |
Promise
component-data~addComponentsToComponentList(store, data, [currentURI], parentURI, path, [replace], components) ⇒ add one or more components to a component list
Kind: inner method of component-data
Param | Type | Description |
---|---|---|
store | object | |
data | array | list data |
[currentURI] | string | if you want to add after / replace a specific current component |
parentURI | string | |
path | string | of the list |
[replace] | boolean | to replace currentURI |
components | array | with { name, [data] } |
Promise
component-data~addComponentsToComponentProp(store, data, parentURI, path, components) ⇒ replace a single component in another component's property
Kind: inner method of component-data
Param | Type | Description |
---|---|---|
store | object | |
data | object | |
parentURI | string | |
path | string | |
components | array | note: it'll only replace using the first thing in this array |
Promise
component-data~addComponentsToPageArea(store, currentURI, path, replace, components) ⇒ add one or more components to a page area
Kind: inner method of component-data
Param | Type |
---|---|
store | object |
currentURI | string |
path | string |
replace | boolean |
components | array |
decorators
decorators.unselect(store)
unselect currently-selected component
Kind: static method of decorators
Param | Type |
---|---|
store | object |
decorators.select(store, el)
select a component
Kind: static method of decorators
Param | Type |
---|---|
store | object |
el | element |
decorators.scrollToComponent(store, el)
Scroll user to the component. "Weeee!" or "What the?"
Kind: static method of decorators
Param | Type |
---|---|
store | object |
el | Element |
Promise
decorators.navigateComponents(store, direction) ⇒ navigate to the previous or next component
Kind: static method of decorators
Param | Type | Description |
---|---|---|
store | object | |
direction | string | 'prev' or 'next' |
Promise
decorators.unfocus(store) ⇒ unfocus currently-focused field/group
Kind: static method of decorators
Param | Type |
---|---|
store | object |
deep-linking
Promise
deep-linking.parseURLHash(store) ⇒ parse url hash, opening form or clay menu as necessary
Kind: static method of deep-linking
Param | Type |
---|---|
store | object |
deep-linking.setHash(commit, [uri], [path], [initialFocus], [menu])
set hash in window and store
Kind: static method of deep-linking
Param | Type |
---|---|
commit | function |
[uri] | string |
[path] | string |
[initialFocus] | string |
[menu] | object |
deep-linking.clearHash(commit)
clear hash in window and store
Kind: static method of deep-linking
Param | Type |
---|---|
commit | function |
drawers
drawers.closeDrawer(store)
close drawer without toggling a new drawer
Kind: static method of drawers
Param | Type |
---|---|
store | Object |
drawers.openDrawer(store, nameOrConfig)
open drawer
Kind: static method of drawers
Param | Type | Description |
---|---|---|
store | Object | |
nameOrConfig | string \ object | either just the tab name or a json object for deeper linking |
forms
forms.openForm(store, uri, path, [el], [offset], [appendText], [initialFocus], pos)
open form
Kind: static method of forms
Param | Type | Description |
---|---|---|
store | object | |
uri | string | component uri |
path | string | field/form path |
[el] | Element | parent element (for inline forms) |
[offset] | number | caret offset (for text inputs) |
[appendText] | string | text to append (for text inputs, used when splitting/merging components with text fields) |
[initialFocus] | string | if focusing on a specific field when opening the form |
pos | object | x/y coordinates used to position overlay forms |
Boolean
forms~hasDataChanged(newData, oldData) ⇒ determine if data in form has changed note: convert data to plain objects, since they're reactive
Kind: inner method of forms
Param | Type | Description |
---|---|---|
newData | object | from form |
oldData | object | from store |
layout-state
- layout-state
- .fetchLayoutState(store, [preloadOptions]) ⇒
Promise
- .updateLayout(store, [data], [preloadOptions]) ⇒
Promise
- .scheduleLayout(store, timestamp) ⇒
Promise
- .unscheduleLayout(store, [publishing]) ⇒
Promise
- .publishLayout(store) ⇒
Promise
- .fetchLayoutState(store, [preloadOptions]) ⇒
Promise
layout-state.fetchLayoutState(store, [preloadOptions]) ⇒ get the list data for a specific layout note: if prefix / uri is specified, this does NOT commit the data (only returns it), allowing the preloader to use it when doing the initial preload of data
Kind: static method of layout-state
Param | Type |
---|---|
store | object |
[preloadOptions] | object |
[preloadOptions.uri] | string |
[preloadOptions.prefix] | string |
[preloadOptions.user] | object |
Promise
layout-state.updateLayout(store, [data], [preloadOptions]) ⇒ update a layout's title, or just the latest timestamp + user
Kind: static method of layout-state
Param | Type |
---|---|
store | object |
[data] | object |
[data.title] | string |
[preloadOptions] | object |
Promise
layout-state.scheduleLayout(store, timestamp) ⇒ schedule the layout and update its index
Kind: static method of layout-state
Param | Type |
---|---|
store | object |
timestamp | Date |
Promise
layout-state.unscheduleLayout(store, [publishing]) ⇒ unschedule the layout get updated layout state if the call wasn't made during layout publish
Kind: static method of layout-state
Param | Type |
---|---|
store | object |
[publishing] | Boolean |
Promise
layout-state.publishLayout(store) ⇒ publish layout note: layouts index is updated server-side, including unscheduling the layout if it's currently scheduled also note: this will trigger a fetch of the updated (published) layout state
Kind: static method of layout-state
Param | Type |
---|---|
store | object |
lists
nav
nav.openNav(store, nameOrConfig)
open nav tab
Kind: static method of nav
Param | Type | Description |
---|---|---|
store | object | |
nameOrConfig | string \ object | tab name, or clay menu config openNav sets the ui.currentDrawer vuex variable, this allows drawers (the right slide-in menus) as well as the "nav" (the left slide-in menu) to be deep linked to. The openNav/closeNav are functions are depreciated. Should use the openDrawer/closeDrawer/toggleDrawer actions Just leaving these here in case any legacy plugins are still calling these functions |
page-data
- page-data
- static
- .savePage(store, data, [snapshot]) ⇒
Promise
- .createPage(store, id) ⇒
Promise
- .publishPage(store, uri) ⇒
Promise
- .unpublishPage(store, uri) ⇒
Promise
- .schedulePage(store, uri, timestamp) ⇒
Promise
- .unschedulePage(store, [publishing]) ⇒
Promise
- .savePage(store, data, [snapshot]) ⇒
- inner
- ~shouldRender(paths) ⇒
boolean
- ~removeURI(uri, store) ⇒
Promise
- ~shouldRender(paths) ⇒
- static
Promise
page-data.savePage(store, data, [snapshot]) ⇒ save a page's data, but do not re-render because, uh, that would just be reloading the page
Kind: static method of page-data
Param | Type | Description |
---|---|---|
store | object | |
data | * | to save |
[snapshot] | boolean | false if we're undoing/redoing |
Promise
page-data.createPage(store, id) ⇒ create a new page, then return its editable link
Kind: static method of page-data
Param | Type |
---|---|
store | object |
id | string |
Promise
page-data.publishPage(store, uri) ⇒ manually publish the page
Kind: static method of page-data
Param | Type |
---|---|
store | object |
uri | string |
Promise
page-data.unpublishPage(store, uri) ⇒ remove uri from /uris/
Kind: static method of page-data
Param | Type |
---|---|
store | object |
uri | string |
Promise
page-data.schedulePage(store, uri, timestamp) ⇒ schedule the page to publish
Kind: static method of page-data
Param | Type |
---|---|
store | object |
uri | string |
timestamp | Date |
Promise
page-data.unschedulePage(store, [publishing]) ⇒ unschedule the page get updated page state if the call wasn't made during a page publish
Kind: static method of page-data
Param | Type |
---|---|
store | object |
[publishing] | Boolean |
boolean
page-data~shouldRender(paths) ⇒ iterate through the paths we're saving if one of them ISN'T in the internalPageProps, we should re-render
Kind: inner method of page-data
Param | Type |
---|---|
paths | array |
Promise
page-data~removeURI(uri, store) ⇒ remove uri from /uris/
Kind: inner method of page-data
Param | Type |
---|---|
uri | String |
store | Object |
page-state
- page-state
- static
- .updatePageList(store, [data]) ⇒
Promise
- .getListData(store, uri, [prefix]) ⇒
Promise
- .updatePageList(store, [data]) ⇒
- inner
- ~sequentialUpdate(prefix, uri, data) ⇒
Promise
- ~sequentialUpdate(prefix, uri, data) ⇒
- static
Promise
page-state.updatePageList(store, [data]) ⇒ update page list with data provided from pubsub note: if called without data, this just updates the updateTime and user (e.g. when saving components in the page) note: if called with a user, it adds the user (with updateTime) to the page (instead of current user)
Kind: static method of page-state
Param | Type |
---|---|
store | object |
[data] | object |
Promise
page-state.getListData(store, uri, [prefix]) ⇒ get the list data for a specific page note: if the prefix is specified, this does NOT commit the data (only returns it), allowing the preloader to use it when doing the initial preload of data
Kind: static method of page-state
Param | Type | Description |
---|---|---|
store | object | |
uri | string | |
[prefix] | string | passed in when preloading (e.g. if site isn't in store yet) |
Promise
page-state~sequentialUpdate(prefix, uri, data) ⇒ run page list updates sequentially, grabbing from the store after each to prevent race conditions
Kind: inner method of page-state
Param | Type |
---|---|
prefix | string |
uri | string |
data | object |
preloader
- preloader
- ~getComponentModels() ⇒
object
- ~reduceComponents(result, val) ⇒
obj
- ~composeLayoutData(layoutSchema, components, original) ⇒
object
- ~reduceTemplates(result, val, key) ⇒
obj
- ~getPageStatus(state) ⇒
string
- ~getComponentModels() ⇒
object
preloader~getComponentModels() ⇒ get component models so we can mount them on window.kiln.componentModels if they aren't already mounted (backwards-compatability)
Kind: inner method of preloader
obj
preloader~reduceComponents(result, val) ⇒ extract component data from preloadData obj
Kind: inner method of preloader
Param | Type |
---|---|
result | obj |
val | obj |
object
preloader~composeLayoutData(layoutSchema, components, original) ⇒ extract layout data from original data
Kind: inner method of preloader
Param | Type | Description |
---|---|---|
layoutSchema | object | schema for layout |
components | object | key/value store of components |
original | object | original preloaded data |
obj
preloader~reduceTemplates(result, val, key) ⇒ make precompiled hbs templates ready for user
Kind: inner method of preloader
Param | Type |
---|---|
result | obj |
val | obj |
key | string |
string
preloader~getPageStatus(state) ⇒ get string state to pass to progress bar
Kind: inner method of preloader
Param | Type |
---|---|
state | object |
toolbar
toolbar.startProgress(commit, type)
start progress bar. if already started, this will cause a slight pause before continuing the progress bar
Kind: static method of toolbar
Param | Type | Description |
---|---|---|
commit | function | |
type | string | e.g. 'save' or 'publish' |
toolbar.finishProgress(commit, type)
finish the progress bar.
Kind: static method of toolbar
Param | Type | Description |
---|---|---|
commit | function | |
type | string | e.g. 'save' or 'publish' |
toolbar.addAlert(store, config)
add alert to the array
Kind: static method of toolbar
Param | Type | Description |
---|---|---|
store | object | |
config | string \ object | the text of the alert (for info), or an object with { type, text } |
toolbar.removeAlert(store, config)
remove an alert from the array, specifying the index
Kind: static method of toolbar
Param | Type | Description |
---|---|---|
store | object | |
config | number \ object | index or an equivalent config object |
toolbar.showSnackbar(store, config)
trigger a new snackbar. note: this happens imperatively (toolbar handles the actual creation, by watching this value)
note: if you want the snackbar to have an action, pass in both action
(the text of the button) and onActionClick
(a reference to the function you want invoked)
Kind: static method of toolbar
Param | Type | Description |
---|---|---|
store | object | |
config | string \ object | message or full config object |
undo
undo.createSnapshot(store)
create snapshot. called from the plugin listening to batched renders
Kind: static method of undo
Param | Type |
---|---|
store | object |
undo.setFixedPoint(store)
"You're a fixed point in time and space. You're a fact. That's never meant to happen." when doing a manual save from some point in history, we need to remove snapshots after that point (to preserve the expected undo functionality)
Kind: static method of undo
Param | Type |
---|---|
store | object |
undo.undo(store)
undo: sets cursor back one, re-saves affected components with old data
Kind: static method of undo
Param | Type |
---|---|
store | object |
undo.redo(store)
redo: sets cursor forward one, re-saves affected components with new data
Kind: static method of undo
Param | Type |
---|---|
store | object |
object
undo~getChangedComponents(current, compare) ⇒ get changed components, used by undo and redo
Kind: inner method of undo
Param | Type | Description |
---|---|---|
current | object | |
compare | object | (prev/next components object) |
undo~saveChangedComponents(changedComponents, store)
render multiple components at once
Kind: inner method of undo
Param | Type |
---|---|
changedComponents | object |
store | object |
validators
- validators
- static
- .validate(store) ⇒
Promise
- .validate(store) ⇒
- inner
- ~isComponentInPageHeadList(uri, state) ⇒
Boolean
- ~runValidator(state) ⇒
function
- ~runValidators(validators, state) ⇒
Promise
- ~hasItems(error) ⇒
Boolean
- ~runMetaValidator(metadata) ⇒
function
- ~runMetaValidators(uri, validators) ⇒
Promise
- ~isMetadataError(scope, type) ⇒
boolean
- ~isMetadataWarning(scope, type) ⇒
boolean
- ~isGlobalMetadataError(validator) ⇒
boolean
- ~isGlobalMetadataWarning(validator) ⇒
boolean
- ~isSpecificMetadataWarning(validator, pageUri) ⇒
boolean
- ~isSpecificMetadataError(validator, pageUri) ⇒
boolean
- ~isComponentInPageHeadList(uri, state) ⇒
- static
Promise
validators.validate(store) ⇒ trigger validation
Kind: static method of validators
Param | Type |
---|---|
store | object |
Boolean
validators~isComponentInPageHeadList(uri, state) ⇒ determine if a component is in a page-specific head list
Kind: inner method of validators
Param | Type |
---|---|
uri | string |
state | object |
function
validators~runValidator(state) ⇒ run an individual validator. if it returns items, add the label and description
Kind: inner method of validators
Param | Type |
---|---|
state | object |
Promise
validators~runValidators(validators, state) ⇒ run a list of validators
Kind: inner method of validators
Param | Type |
---|---|
validators | array |
state | object |
Boolean
validators~hasItems(error) ⇒ make sure that all errors have items that can display. some may have been parsed out by the isActive check in runValidator, above
Kind: inner method of validators
Param | Type |
---|---|
error | object |
function
validators~runMetaValidator(metadata) ⇒ run an metadata validator. if it returns items, add the label and description and items
Kind: inner method of validators
Param | Type |
---|---|
metadata | object |
Promise
validators~runMetaValidators(uri, validators) ⇒ run a list of validators using page metadata
Kind: inner method of validators
Param | Type | Description |
---|---|---|
uri | uri | uri |
validators | array |
boolean
validators~isMetadataError(scope, type) ⇒ Check whether is a metadata error
Kind: inner method of validators
Param | Type |
---|---|
scope | string |
type | string |
boolean
validators~isMetadataWarning(scope, type) ⇒ Check whether is a metadata warning
Kind: inner method of validators
Param | Type |
---|---|
scope | string |
type | string |
boolean
validators~isGlobalMetadataError(validator) ⇒ Check whether is a metadata error
Kind: inner method of validators
Param | Type |
---|---|
validator | object |
validator.scope | string |
validator.type | string |
validator.uri | string |
boolean
validators~isGlobalMetadataWarning(validator) ⇒ Check whether is a metadata error
Kind: inner method of validators
Param | Type |
---|---|
validator | object |
validator.scope | string |
validator.type | string |
validator.uri | string |
boolean
validators~isSpecificMetadataWarning(validator, pageUri) ⇒ Check whether is a metadata warning for a specific page
Kind: inner method of validators
Param | Type |
---|---|
validator | object |
validator.scope | string |
validator.type | string |
validator.uri | string |
pageUri | string |
boolean
validators~isSpecificMetadataError(validator, pageUri) ⇒ Check whether is a metadata error for specific page
Kind: inner method of validators
Param | Type |
---|---|
validator | object |
validator.scope | string |
validator.type | string |
validator.uri | string |
pageUri | string |