How to use the solid-ui.store function in solid-ui

To help you get started, we’ve selected a few solid-ui examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github solid / solid-panes / contact / toolsPane.js View on Github external
var toolsPane = function (selectAllGroups, selectedGroups, groupsMainTable, book, dom, me) {
  var kb = UI.store, ns = UI.ns
  var updater = UI.store.updater
  var ACL = UI.ns.acl, VCARD = UI.ns.vcard
  var doc = $rdf.sym(book.uri.split('#')[0]) // The ACL is actually to the doc describing the thing

  var buttonStyle = 'font-size: 100%; margin: 0.8em; padding:0.5em;'

  var pane = dom.createElement('div')
  var table = pane.appendChild(dom.createElement('table'))
  table.setAttribute('style', 'font-size:120%; margin: 1em; border: 0.1em #ccc ;')
  var headerRow = table.appendChild(dom.createElement('tr'))
  headerRow.textContent = UI.utils.label(book) + ' - tools'
  headerRow.setAttribute('style', 'min-width: 20em; padding: 1em; font-size: 150%; border-bottom: 0.1em solid red; margin-bottom: 2em;')

  var statusRow = table.appendChild(dom.createElement('tr'))
  var statusBlock = statusRow.appendChild(dom.createElement('div'))
  statusBlock.setAttribute('style', 'padding: 2em;')
  var MainRow = table.appendChild(dom.createElement('tr'))
github solid / solid-panes / meeting / meetingPane.js View on Github external
return new Promise(function (resolve, reject) {
        var kb = UI.store
        if (!options.useExisting) { // useExisting means use existing object in new role
          var existing = kb.any(meeting, options.predicate)
          if (existing) {
            if (toolObject.limit && toolObject.limit === 1 && !toolObject.shareTab) {
              complain('Already have ' + existing + ' as ' + UI.utils.label(options.predicate))
              complain('Cant have two')
              return resolve(null)
            } if (toolObject.shareTab) { // return existing one
              console.log('Using existing ' + existing + ' as ' + UI.utils.label(options.predicate))
              return resolve({ me: me, newInstance: existing, instanceClass: options.instanceClass })
            }
          }
        }
        if (!me && !options.me) reject(new Error('Username not defined for new tool'))
        options.me = options.me || me
        options.newInstance = options.useExisting || options.newInstance || kb.sym(options.newBase + 'index.ttl#this')
github solid / solid-panes / folderPane.js View on Github external
mintNew: function (newPaneOptions) {
    var kb = UI.store
    var newInstance = newPaneOptions.newInstance || kb.sym(newPaneOptions.newBase)
    var u = newInstance.uri
    if (u.endsWith('/')) {
      u = u.slice(0, -1) // chop off trailer
    }// { throw new Error('URI of new folder must end in "/" :' + u) }
    newPaneOptions.newInstance = kb.sym(u + '/')

    // @@@@ kludge until we can get the solid-client version working
    // Force the folder by saving a dummy file inside it
    return kb.fetcher.webOperation('PUT', newInstance.uri + '.dummy')
      .then(function () {
        console.log('New folder created: ' + newInstance.uri)

        return kb.fetcher.delete(newInstance.uri + '.dummy')
      })
      .then(function () {
github solid / solid-panes / issue / pane.js View on Github external
var sendComplete = function (uri, success, body) {
          if (!success) {
            console.log("Error: can't save new issue:" + body)
          } else {
            form.parentNode.removeChild(form)
            rerender(div)
            outliner.GotoSubject(issue, true, undefined, true, undefined)
          }
        }
        updater.update([], sts, sendComplete)
      }
      // form.addEventListener('submit', function() {try {sendNewIssue} catch(e){console.log('sendNewIssue: '+e)}}, false)
      // form.setAttribute('onsubmit', "function xx(){return false;}")

      UI.store.fetcher.removeCallback('done', 'expand') // @@ experimental -- does this kill the re-paint? no
      UI.store.fetcher.removeCallback('fail', 'expand')

      var states = kb.any(tracker, WF('issueClass'))
      var classLabel = UI.utils.label(states)
      form.innerHTML = '<h2>Add new ' + (superIssue ? 'sub ' : '') +
        classLabel + '</h2><p>Title of new ' + classLabel + ':</p>'
      var titlefield = dom.createElement('input')
      titlefield.setAttribute('type', 'text')
      titlefield.setAttribute('style', 'margin: 0.5em; font-size: 100%; padding: 0.3em;')
      titlefield.setAttribute('size', '100')
      titlefield.setAttribute('maxLength', '2048') // No arbitrary limits
      titlefield.select() // focus next user input
      titlefield.addEventListener('keyup', function (e) {
        if (e.keyCode === 13) {
          sendNewIssue()
        }
github solid / solid-panes / issue / pane.js View on Github external
label: function (subject) {
    var kb = UI.store
    var t = kb.findTypeURIs(subject)
    if (t['http://www.w3.org/2005/01/wf/flow#Task'] ||
      kb.holds(subject, UI.ns.wf('tracker'))) return 'issue' // in case ontology not available
    if (t['http://www.w3.org/2005/01/wf/flow#Tracker']) return 'tracker'
    // Later: Person. For a list of things assigned to them,
    // open bugs on projects they are developer on, etc
    return null // No under other circumstances (while testing at least!)
  },
github solid / solid-panes / src / outline / userInput.js View on Github external
// var dcterms = UI.rdf.Namespace('http://purl.org/dc/terms/')
  var dcelems = UI.rdf.Namespace('http://purl.org/dc/elements/1.1/')

  var movedArrow = false // hq

  // var updateService=new updateCenter(kb);

  if (!UserInputFormula) {
    UserInputFormula = new UI.rdf.Formula()
    UserInputFormula.superFormula = kb
    // UserInputFormula.registerFormula("Your Work");
  }
  if (!TempFormula) TempFormula = new UI.rdf.IndexedFormula()
  // Use RDFIndexedFormula so add returns the statement
  TempFormula.name = 'TempFormula'
  if (!UI.store.updater) UI.store.updater = new UI.rdf.UpdateManager(kb)

  return {
    // updateService: updateService,

    sparqler: UI.store.updater,
    lastModified: null, // the last <input> being modified, .isNew indicates whether it's a new input
    lastModifiedStat: null, // the last statement being modified
    statIsInverse: false, // whether the statement is an inverse

    /**
     *  Triggering Events: event entry points, should be called only from outline.js but not anywhere else
     *                     in userinput.js, should be as short as possible, function names to be discussed
     */

    //  Called when the blue cross under the default pane is clicked.
    //  Add a new row to a property list ( P and O)
github solid / solid-panes / airPane.js View on Github external
airPane.renderReasonsForStatement = function renderReasonsForStatement(st,
					divJustification){
  var divDescription = myDocument.createElement("div");
  divDescription.setAttribute('class', 'description');

        //Display the actual English-like description first
	//It's no longer English-like, but just property tables
        //var stsDesc = kb.statementsMatching(undefined, ap_description, undefined, subject);
        //var stsDesc = kb.statementsMatching(st, ap_description);
	var stsDesc = UI.store.statementsMatching(st, ap_just);
	// {}  tms:justification []. (multiple)

	if(stsDesc.length &gt; 1){
            for (var j=0; j
github solid / solid-panes / chat / longChatPane.js View on Github external
/*   Long Chat Pane
**
**  A long chat consists a of a series of chat files saved by date.
*/
/* global alert */

const UI = require('solid-ui')
const ns = UI.ns
const kb = UI.store
const mainClass = ns.meeting('LongChat') // @@ something from SIOC?

module.exports = { // noun_704.svg Canoe   noun_346319.svg = 1 Chat  noun_1689339.svg = three chat
  icon: UI.icons.iconBase + 'noun_1689339.svg',

  name: 'long chat',

  label: function (subject) {
    if (kb.holds(subject, ns.rdf('type'), ns.meeting('LongChat'))) { // subject is the object
      return 'Chat channnel'
    }
    return null // Suppress pane otherwise
  },

  mintClass: mainClass,
github solid / solid-panes / photo / photoImportPane.js View on Github external
photoImportPane.render.InsertTriples = function (triples, id) {
    // var st = new RDFStatement(PAC('PhotoAlbum'),PAC('Owner'),ME('me'))
    var sparqlService = UI.store.updater
    sparqlService.insert_statement(triples, function (uri, success, error) {
      if (!success) {
        alert('Error.')
      } else {
        alert('The photo has been added to the photo album successfully.')
        for (var i = 0; i &lt; triples.length; i++) {
          triples[i] = kb.add(triples[i].subject, triples[i].predicate, triples[i].object, triples[i].why)
        }
        var item = myDocument.getElementById(id)
        photoPanel.removeChild(item)
      }
    })
  }
github solid / solid-panes / src / outline / dragDrop.js View on Github external
onDrop: function (e, aXferData, _dragSession) {
    var selection = UI.utils.ancestor(
      UI.utils.ancestor(e.originalTarget, 'TABLE').parentNode,
      'TABLE'
    ).outline.selection
    var contentType = aXferData.flavour.contentType
    var url = transferUtils.retrieveURLFromData(aXferData.data, contentType)
    if (!url) return
    if (contentType === 'application/x-moz-file') {
      if (aXferData.data.fileSize === 0) {
        var templateDoc = $rdf.sym(
          'chrome://tabulator/content/internalKnowledge.n3#defaultNew'
        )
        UI.store.copyTo(templateDoc, $rdf.sym(url))
        /*
      function WriteToFileRepresentedBy (subject){
          var outputFormulaTerm=kb.any(subject,OWL('unionOf'))
          var theClass =  kb.constructor.SuperClass
          var outputFormula= theClass.instances[kb.the(outputFormulaTerm,tabont('accesskey')).value]
      }
      */
      }
    }
    var targetTd = selection[0]
    var table = UI.utils.ancestor(
      UI.utils.ancestor(targetTd, 'TABLE').parentNode,
      'TABLE'
    )
    var thisOutline = table.outline
    thisOutline.UserInput.insertTermTo(targetTd, $rdf.sym(url))