UNPKG

@difizen/ai-flow

Version:

Scalable, out-of-the-box, agent-oriented flow

56 lines 2.56 kB
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); } function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } import { defaultShortcuts } from "../constants/constant"; import { create } from 'zustand'; export var useShortcutsStore = create(function (set, get) { return { shortcuts: defaultShortcuts, setShortcuts: function setShortcuts(newShortcuts) { set({ shortcuts: newShortcuts }); }, output: 'o', play: 'p', flow: 'mod+b', undo: 'mod+z', redo: 'mod+y', open: 'mod+k', advanced: 'mod+shift+a', minimize: 'mod+shift+q', code: 'space', copy: 'mod+c', duplicate: 'mod+d', component: 'mod+shift+s', docs: 'mod+shift+d', save: 'mod+s', delete: 'backspace', group: 'mod+g', cut: 'mod+x', paste: 'mod+v', api: 'r', update: 'mod+u', download: 'mod+j', freeze: 'mod+f', FreezePath: 'mod+shift+f', updateUniqueShortcut: function updateUniqueShortcut(name, combination) { set(_defineProperty({}, name, combination)); }, getShortcutsFromStorage: function getShortcutsFromStorage() { if (localStorage.getItem('langflow-shortcuts')) { var savedShortcuts = localStorage.getItem('langflow-shortcuts'); var savedArr = JSON.parse(savedShortcuts); savedArr.forEach(function (_ref) { var name = _ref.name, shortcut = _ref.shortcut; var shortcutName = name.split(' ')[0].toLowerCase(); set(_defineProperty({}, shortcutName, shortcut)); }); get().setShortcuts(JSON.parse(savedShortcuts)); } } }; }); useShortcutsStore.getState().getShortcutsFromStorage();