diff --git a/dist/spruce.umd.js b/dist/spruce.umd.js index 2ad9820..7265b21 100644 --- a/dist/spruce.umd.js +++ b/dist/spruce.umd.js @@ -2,8 +2,7 @@ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Spruce = factory()); -}(this, (function () { 'use strict'; - +}(this, (function () { function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { diff --git a/dist/spruce.umd.js.map b/dist/spruce.umd.js.map index 952c454..eb0620c 100644 --- a/dist/spruce.umd.js.map +++ b/dist/spruce.umd.js.map @@ -1 +1 @@ -{"version":3,"file":"spruce.umd.js","sources":["../node_modules/compare-versions/index.js","../src/utils.js","../src/observable.js","../src/index.js"],"sourcesContent":["/* global define */\n(function (root, factory) {\n /* istanbul ignore next */\n if (typeof define === 'function' && define.amd) {\n define([], factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.compareVersions = factory();\n }\n}(this, function () {\n\n var semver = /^v?(?:\\d+)(\\.(?:[x*]|\\d+)(\\.(?:[x*]|\\d+)(\\.(?:[x*]|\\d+))?(?:-[\\da-z\\-]+(?:\\.[\\da-z\\-]+)*)?(?:\\+[\\da-z\\-]+(?:\\.[\\da-z\\-]+)*)?)?)?$/i;\n\n function indexOrEnd(str, q) {\n return str.indexOf(q) === -1 ? str.length : str.indexOf(q);\n }\n\n function split(v) {\n var c = v.replace(/^v/, '').replace(/\\+.*$/, '');\n var patchIndex = indexOrEnd(c, '-');\n var arr = c.substring(0, patchIndex).split('.');\n arr.push(c.substring(patchIndex + 1));\n return arr;\n }\n\n function tryParse(v) {\n return isNaN(Number(v)) ? v : Number(v);\n }\n\n function validate(version) {\n if (typeof version !== 'string') {\n throw new TypeError('Invalid argument expected string');\n }\n if (!semver.test(version)) {\n throw new Error('Invalid argument not valid semver (\\''+version+'\\' received)');\n }\n }\n\n function compareVersions(v1, v2) {\n [v1, v2].forEach(validate);\n\n var s1 = split(v1);\n var s2 = split(v2);\n\n for (var i = 0; i < Math.max(s1.length - 1, s2.length - 1); i++) {\n var n1 = parseInt(s1[i] || 0, 10);\n var n2 = parseInt(s2[i] || 0, 10);\n\n if (n1 > n2) return 1;\n if (n2 > n1) return -1;\n }\n\n var sp1 = s1[s1.length - 1];\n var sp2 = s2[s2.length - 1];\n\n if (sp1 && sp2) {\n var p1 = sp1.split('.').map(tryParse);\n var p2 = sp2.split('.').map(tryParse);\n\n for (i = 0; i < Math.max(p1.length, p2.length); i++) {\n if (p1[i] === undefined || typeof p2[i] === 'string' && typeof p1[i] === 'number') return -1;\n if (p2[i] === undefined || typeof p1[i] === 'string' && typeof p2[i] === 'number') return 1;\n\n if (p1[i] > p2[i]) return 1;\n if (p2[i] > p1[i]) return -1;\n }\n } else if (sp1 || sp2) {\n return sp1 ? -1 : 1;\n }\n\n return 0;\n };\n\n var allowedOperators = [\n '>',\n '>=',\n '=',\n '<',\n '<='\n ];\n\n var operatorResMap = {\n '>': [1],\n '>=': [0, 1],\n '=': [0],\n '<=': [-1, 0],\n '<': [-1]\n };\n\n function validateOperator(op) {\n if (typeof op !== 'string') {\n throw new TypeError('Invalid operator type, expected string but got ' + typeof op);\n }\n if (allowedOperators.indexOf(op) === -1) {\n throw new TypeError('Invalid operator, expected one of ' + allowedOperators.join('|'));\n }\n }\n\n compareVersions.validate = function(version) {\n return typeof version === 'string' && semver.test(version);\n }\n\n compareVersions.compare = function (v1, v2, operator) {\n // Validate operator\n validateOperator(operator);\n\n // since result of compareVersions can only be -1 or 0 or 1\n // a simple map can be used to replace switch\n var res = compareVersions(v1, v2);\n return operatorResMap[operator].indexOf(res) > -1;\n }\n\n return compareVersions;\n}));\n","import { compare } from 'compare-versions'\n\nexport const isNullOrUndefined = value => {\n return value === null || value === undefined\n}\n\nexport const isObject = _ => {\n return Object.getPrototypeOf(_) === Object.prototype\n}\n\nexport const isArray = _ => Array.isArray(_)\n\nexport const getMethods = obj => {\n let methods = {}\n\n Object.entries(obj).filter(([_, value]) => typeof value === 'function').forEach(([key, value]) => methods[key] = value)\n\n return methods\n}\n\nexport const isTesting = () => {\n return navigator.userAgent, navigator.userAgent.includes(\"Node.js\")\n || navigator.userAgent.includes(\"jsdom\")\n}\n\nexport const checkForAlpine = () => {\n if (isTesting()) {\n return true\n }\n\n if (! window.Alpine) {\n return false\n }\n\n return compare(window.Alpine.version, '2.7.0', '>=')\n}","import { isNullOrUndefined, isObject, isArray } from './utils'\n\nexport const createObservable = (target, callbacks) => {\n Object.entries(target).forEach(([key, value]) => {\n if (! isNullOrUndefined(value) && (isObject(value) || isArray(value))) { \n target[key] = createObservable(value, callbacks)\n }\n })\n\n return new Proxy(target, {\n get(target, key, receiver) {\n return callbacks.get(target, key, receiver)\n },\n set(target, key, value, receiver) {\n if (! isNullOrUndefined(value) && (isObject(value) || isArray(value))) {\n value = createObservable(value, callbacks)\n }\n\n let originalValue = target[key]\n\n target[key] = value\n\n // Copy watchers from the original value if they exist\n if (!isNullOrUndefined(originalValue) && !isNullOrUndefined(originalValue.__watchers)) {\n target[key].__watchers = originalValue.__watchers\n }\n\n callbacks.set(target, key, target[key], receiver)\n\n return true\n }\n })\n}","import { getMethods, checkForAlpine, isObject, isArray, isNullOrUndefined } from './utils'\nimport { createObservable } from './observable'\n\nconst Spruce = {\n stores: {},\n\n persistenceDriver: window.localStorage,\n\n persisted: [],\n\n persistedDrivers: {},\n\n subscribers: [],\n\n pendingWatchers: {},\n\n disableReactivity: false,\n\n startingCallbacks: [],\n\n startedCallbacks: [],\n\n hasStarted: false,\n\n start() {\n this.startingCallbacks.forEach(fn => fn())\n\n this.attach()\n\n this.stores = createObservable(this.stores, {\n get: (target, key, receiver) => {\n if (Object.is(receiver, this.stores) && ['get', 'set', 'toggle', 'call', 'clear'].includes(key)) {\n return this[key].bind(this)\n }\n\n return Reflect.get(target, key, receiver)\n },\n set: (target, key, value, receiver) => {\n if (this.disableReactivity) {\n return\n }\n\n this.updateSubscribers()\n\n this.runWatchers(target, key, value, receiver)\n\n this.disableReactivity = true\n\n try {\n this.persisted.forEach(this.updateLocalStorage.bind(this))\n } catch (e) {\n // Do nothing here (thanks Safari!)\n }\n\n this.disableReactivity = false\n }\n })\n\n this.hasStarted = true\n\n this.disableReactivity = true\n\n Object.entries(this.pendingWatchers).forEach(([name, callbacks]) => {\n callbacks.forEach(callback => this.watch(name, callback))\n })\n\n this.disableReactivity = false\n\n this.startedCallbacks.forEach(fn => fn())\n },\n\n starting(callback) {\n this.startingCallbacks.push(callback)\n },\n\n started(callback) {\n this.startedCallbacks.push(callback)\n },\n\n attach() {\n if (! checkForAlpine()) {\n throw new Error('[Spruce] You must be using Alpine >= 2.5.0 to use Spruce.')\n }\n\n const self = this\n\n window.Alpine.addMagicProperty('store', el => {\n self.subscribe(el)\n\n return self.stores\n })\n },\n\n store(name, state, persist = false) {\n if (typeof state === 'function') {\n state = state()\n }\n\n const isValidDriver = this.isValidDriver(persist)\n \n if (persist === true || isValidDriver) {\n try {\n this.stores[name] = this.retrieveFromLocalStorage(\n name,\n getMethods(state),\n isValidDriver ? persist : undefined\n )\n\n if (isValidDriver) {\n this.persistedDrivers[name] = persist\n }\n\n if (!this.persisted.includes(name)) {\n this.persisted.push(name)\n }\n } catch (e) {\n // Do nothing here (thanks Safari!)\n }\n }\n\n if (!this.stores[name]) {\n this.stores[name] = state\n }\n\n return this.stores[name]\n },\n\n reset(name, state) {\n if (this.stores[name] === undefined) {\n return;\n }\n \n this.stores[name] = state\n },\n\n delete(name, reload = true) {\n if (this.stores[name] === undefined) {\n return false;\n }\n\n delete this.stores[name]\n\n if (reload) {\n this.updateSubscribers()\n }\n\n return true;\n },\n\n deleteAll() {\n const results = Object.keys(this.stores).map(key => this.delete(key, false))\n\n this.updateSubscribers()\n\n return !results.some(bool => !bool)\n },\n\n subscribe(el) {\n if (!this.subscribers.includes(el)) {\n this.subscribers.push(el)\n }\n\n return this.stores\n },\n\n updateSubscribers() {\n this.subscribers.filter(el => !!el.__x).forEach(el => {\n el.__x.updateElements(el)\n })\n },\n\n retrieveFromLocalStorage(name, methods = {}, handler) {\n let driver = this.persistenceDriver\n\n if (handler !== undefined) {\n this.guardAgainstInvalidDrivers(handler)\n\n driver = handler\n }\n \n const value = driver.getItem(`__spruce:${name}`)\n\n if (! value) {\n return null\n }\n\n let storage = JSON.parse(value)\n\n if (typeof storage === 'object') {\n storage = Object.assign(methods, storage)\n\n delete storage.__watchers\n delete storage.__key_name\n }\n\n return storage\n },\n\n updateLocalStorage(name) {\n const store = { ...this.store(name) }\n\n delete store.__watchers\n delete store.__key_name\n\n const driver = this.persistedDrivers[name] || this.persistenceDriver\n\n driver.setItem(`__spruce:${name}`, JSON.stringify(this.store(name)))\n },\n\n get(name, target = this.stores) {\n return name.split('.').reduce((target, part) => target[part], target)\n },\n\n set(name, value, target = this.stores) {\n if (! isArray(name)) {\n name = name.split('.')\n }\n\n if (name.length === 1) return target[name[0]] = value\n\n if (target[name[0]]) {\n return this.set(name.slice(1), value, target[name[0]])\n } else {\n target[name[0]] = {}\n\n return this.set(name.slice(1), value, target[name[0]])\n }\n },\n\n toggle(name) {\n return this.set(name, ! this.get(name))\n },\n\n call(name, ...args) {\n return this.get(name)(...args)\n },\n\n clear(name) {\n return this.persistenceDriver.removeItem(`__spruce:${name}`)\n },\n\n watch(name, callback) {\n if (! this.hasStarted) {\n this.pendingWatchers[name] || (this.pendingWatchers[name] = [])\n\n this.pendingWatchers[name].push(callback)\n\n return [() => this.unwatch(name, callback)]\n }\n\n const nameParts = name.split('.')\n\n const target = nameParts.reduce((target, part) => {\n const sub = target[part]\n\n if (! isNullOrUndefined(sub) && (isObject(sub) || isArray(sub))) {\n return sub\n }\n\n return target\n }, this.stores)\n\n /**\n * If the target object / array is the property\n * that needs to be watched, a magic `__self` key is\n * used so that runner can pick up on it later.\n */\n const part = Object.is(target, this.get(name)) ? '__self' : nameParts[nameParts.length - 1]\n\n if (! target.hasOwnProperty('__watchers')) {\n Object.defineProperty(target, '__watchers', {\n enumerable: false,\n value: new Map,\n configurable: true\n })\n }\n \n if (! target.__watchers.has(part)) {\n target.__watchers.set(part, new Set)\n }\n\n target.__watchers.get(part).add(callback)\n\n return [() => this.unwatch(name, callback)]\n },\n\n unwatch(name, callback) {\n const nameParts = name.split('.')\n\n const target = nameParts.reduce((target, part) => {\n const sub = target[part]\n\n if (! isNullOrUndefined(sub) && (isObject(sub) || isArray(sub))) {\n return sub\n }\n\n return target\n }, this.stores)\n\n const part = Object.is(target, this.get(name)) ? '__self' : nameParts[nameParts.length - 1]\n const watchers = target.__watchers\n\n if (! watchers.has(part)) {\n return\n }\n\n watchers.get(part).delete(callback)\n },\n\n watchers(name) {\n const nameParts = name.split('.')\n\n const target = nameParts.reduce((target, part) => {\n const sub = target[part]\n\n if (! isNullOrUndefined(sub) && (isObject(sub) || isArray(sub))) {\n return sub\n }\n\n return target\n }, this.stores)\n\n const part = Object.is(target, this.get(name)) ? '__self' : nameParts[nameParts.length - 1]\n\n if (! target.__watchers) {\n return {}\n }\n\n return target.__watchers.get(part)\n },\n\n runWatchers(target, key, value) {\n if (! target.__watchers) {\n return\n }\n\n if (target.__watchers.has(key)) {\n target.__watchers.get(key).forEach(f => f(value))\n }\n\n /**\n * The `__self` key is used for watchers that are registered\n * to the object or array being updated.\n */\n if (target.__watchers.has('__self')) {\n target.__watchers.get('__self').forEach(f => f(value, key))\n }\n },\n\n persistUsing(driver) {\n if (this.persisted.length > 0) {\n console.warn('[Spruce] You have already initialised a persisted store. Changing the driver may cause issues.')\n }\n\n this.guardAgainstInvalidDrivers(driver)\n\n this.persistenceDriver = driver\n },\n\n guardAgainstInvalidDrivers(driver) {\n if (typeof driver.getItem !== 'function') {\n throw new Error('[Spruce] The persistence driver must have a `getItem(key)` method.')\n }\n\n if (typeof driver.setItem !== 'function') {\n throw new Error('[Spruce] The persistence driver must have a `setItem(key, value)` method.')\n }\n\n if (typeof driver.removeItem !== 'function') {\n throw new Error('[Spruce] The persistence driver must have a `removeItem(name)` method.')\n }\n },\n\n isValidDriver(driver) {\n try {\n this.guardAgainstInvalidDrivers(driver)\n } catch (e) {\n return false;\n }\n\n return true;\n }\n}\n\nwindow.Spruce = Spruce\n\nconst deferrer = window.deferLoadingAlpine || function (callback) { callback() }\n\nwindow.deferLoadingAlpine = function (callback) {\n window.Spruce.start()\n\n deferrer(callback)\n}\n\nexport default Spruce\n"],"names":["root","factory","module","this","semver","indexOrEnd","str","q","indexOf","length","split","v","c","replace","patchIndex","arr","substring","push","tryParse","isNaN","Number","validate","version","TypeError","test","Error","compareVersions","v1","v2","forEach","s1","s2","i","Math","max","n1","parseInt","n2","sp1","sp2","p1","map","p2","undefined","allowedOperators","operatorResMap","validateOperator","op","join","compare","operator","res","isNullOrUndefined","value","isObject","_","Object","getPrototypeOf","prototype","isArray","Array","getMethods","obj","methods","entries","filter","key","isTesting","navigator","userAgent","includes","checkForAlpine","window","Alpine","createObservable","target","callbacks","Proxy","get","receiver","set","originalValue","__watchers","Spruce","stores","persistenceDriver","localStorage","persisted","persistedDrivers","subscribers","pendingWatchers","disableReactivity","startingCallbacks","startedCallbacks","hasStarted","start","fn","attach","is","bind","Reflect","updateSubscribers","runWatchers","updateLocalStorage","e","name","callback","watch","starting","started","self","addMagicProperty","el","subscribe","store","state","persist","isValidDriver","retrieveFromLocalStorage","reset","delete","reload","deleteAll","results","keys","some","bool","__x","updateElements","handler","driver","guardAgainstInvalidDrivers","getItem","storage","JSON","parse","assign","__key_name","setItem","stringify","reduce","part","slice","toggle","call","args","clear","removeItem","unwatch","nameParts","sub","hasOwnProperty","defineProperty","enumerable","Map","configurable","has","Set","add","watchers","f","persistUsing","console","warn","deferrer","deferLoadingAlpine"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EACC,aAAUA,IAAV,EAAgBC,OAAhB,EAAyB;;EAExB,IAEwC;EACtCC,MAAAA,cAAA,GAAiBD,OA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B,UAAjC,EAA6C;EACzC,YAAM,IAAI1H,KAAJ,CAAU,wEAAV,CAAN;EACH;EACJ,GAhXU;;EAkXX4F,EAAAA,aAAa,CAACa,MAAD,EAAS;EAClB,QAAI;EACA,WAAKC,0BAAL,CAAgCD,MAAhC;EACH,KAFD,CAEE,OAAO1B,CAAP,EAAU;EACR,aAAO,KAAP;EACH;;EAED,WAAO,IAAP;EACH;;EA1XU;EA6XfhC,MAAM,CAACW,MAAP,GAAgBA,MAAhB;;EAEA,MAAMiF,QAAQ,GAAG5F,MAAM,CAAC6F,kBAAP,IAA6B,UAAU3D,QAAV,EAAoB;EAAEA,EAAAA,QAAQ;EAAI,CAAhF;;EAEAlC,MAAM,CAAC6F,kBAAP,GAA4B,UAAU3D,QAAV,EAAoB;EAC5ClC,EAAAA,MAAM,CAACW,MAAP,CAAcY,KAAd;EAEAqE,EAAAA,QAAQ,CAAC1D,QAAD,CAAR;EACH,CAJD;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"spruce.umd.js","sources":["../node_modules/compare-versions/index.js","../src/utils.js","../src/observable.js","../src/index.js"],"sourcesContent":["/* global define */\n(function (root, factory) {\n /* istanbul ignore next */\n if (typeof define === 'function' && define.amd) {\n define([], factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.compareVersions = factory();\n }\n}(this, function () {\n\n var semver = /^v?(?:\\d+)(\\.(?:[x*]|\\d+)(\\.(?:[x*]|\\d+)(\\.(?:[x*]|\\d+))?(?:-[\\da-z\\-]+(?:\\.[\\da-z\\-]+)*)?(?:\\+[\\da-z\\-]+(?:\\.[\\da-z\\-]+)*)?)?)?$/i;\n\n function indexOrEnd(str, q) {\n return str.indexOf(q) === -1 ? str.length : str.indexOf(q);\n }\n\n function split(v) {\n var c = v.replace(/^v/, '').replace(/\\+.*$/, '');\n var patchIndex = indexOrEnd(c, '-');\n var arr = c.substring(0, patchIndex).split('.');\n arr.push(c.substring(patchIndex + 1));\n return arr;\n }\n\n function tryParse(v) {\n return isNaN(Number(v)) ? v : Number(v);\n }\n\n function validate(version) {\n if (typeof version !== 'string') {\n throw new TypeError('Invalid argument expected string');\n }\n if (!semver.test(version)) {\n throw new Error('Invalid argument not valid semver (\\''+version+'\\' received)');\n }\n }\n\n function compareVersions(v1, v2) {\n [v1, v2].forEach(validate);\n\n var s1 = split(v1);\n var s2 = split(v2);\n\n for (var i = 0; i < Math.max(s1.length - 1, s2.length - 1); i++) {\n var n1 = parseInt(s1[i] || 0, 10);\n var n2 = parseInt(s2[i] || 0, 10);\n\n if (n1 > n2) return 1;\n if (n2 > n1) return -1;\n }\n\n var sp1 = s1[s1.length - 1];\n var sp2 = s2[s2.length - 1];\n\n if (sp1 && sp2) {\n var p1 = sp1.split('.').map(tryParse);\n var p2 = sp2.split('.').map(tryParse);\n\n for (i = 0; i < Math.max(p1.length, p2.length); i++) {\n if (p1[i] === undefined || typeof p2[i] === 'string' && typeof p1[i] === 'number') return -1;\n if (p2[i] === undefined || typeof p1[i] === 'string' && typeof p2[i] === 'number') return 1;\n\n if (p1[i] > p2[i]) return 1;\n if (p2[i] > p1[i]) return -1;\n }\n } else if (sp1 || sp2) {\n return sp1 ? -1 : 1;\n }\n\n return 0;\n };\n\n var allowedOperators = [\n '>',\n '>=',\n '=',\n '<',\n '<='\n ];\n\n var operatorResMap = {\n '>': [1],\n '>=': [0, 1],\n '=': [0],\n '<=': [-1, 0],\n '<': [-1]\n };\n\n function validateOperator(op) {\n if (typeof op !== 'string') {\n throw new TypeError('Invalid operator type, expected string but got ' + typeof op);\n }\n if (allowedOperators.indexOf(op) === -1) {\n throw new TypeError('Invalid operator, expected one of ' + allowedOperators.join('|'));\n }\n }\n\n compareVersions.validate = function(version) {\n return typeof version === 'string' && semver.test(version);\n }\n\n compareVersions.compare = function (v1, v2, operator) {\n // Validate operator\n validateOperator(operator);\n\n // since result of compareVersions can only be -1 or 0 or 1\n // a simple map can be used to replace switch\n var res = compareVersions(v1, v2);\n return operatorResMap[operator].indexOf(res) > -1;\n }\n\n return compareVersions;\n}));\n","import { compare } from 'compare-versions'\n\nexport const isNullOrUndefined = value => {\n return value === null || value === undefined\n}\n\nexport const isObject = _ => {\n return Object.getPrototypeOf(_) === Object.prototype\n}\n\nexport const isArray = _ => Array.isArray(_)\n\nexport const getMethods = obj => {\n let methods = {}\n\n Object.entries(obj).filter(([_, value]) => typeof value === 'function').forEach(([key, value]) => methods[key] = value)\n\n return methods\n}\n\nexport const isTesting = () => {\n return navigator.userAgent, navigator.userAgent.includes(\"Node.js\")\n || navigator.userAgent.includes(\"jsdom\")\n}\n\nexport const checkForAlpine = () => {\n if (isTesting()) {\n return true\n }\n\n if (! window.Alpine) {\n return false\n }\n\n return compare(window.Alpine.version, '2.7.0', '>=')\n}","import { isNullOrUndefined, isObject, isArray } from './utils'\n\nexport const createObservable = (target, callbacks) => {\n Object.entries(target).forEach(([key, value]) => {\n if (! isNullOrUndefined(value) && (isObject(value) || isArray(value))) { \n target[key] = createObservable(value, callbacks)\n }\n })\n\n return new Proxy(target, {\n get(target, key, receiver) {\n return callbacks.get(target, key, receiver)\n },\n set(target, key, value, receiver) {\n if (! isNullOrUndefined(value) && (isObject(value) || isArray(value))) {\n value = createObservable(value, callbacks)\n }\n\n let originalValue = target[key]\n\n target[key] = value\n\n // Copy watchers from the original value if they exist\n if (!isNullOrUndefined(originalValue) && !isNullOrUndefined(originalValue.__watchers)) {\n target[key].__watchers = originalValue.__watchers\n }\n\n callbacks.set(target, key, target[key], receiver)\n\n return true\n }\n })\n}","import { getMethods, checkForAlpine, isObject, isArray, isNullOrUndefined } from './utils'\nimport { createObservable } from './observable'\n\nconst Spruce = {\n stores: {},\n\n persistenceDriver: window.localStorage,\n\n persisted: [],\n\n persistedDrivers: {},\n\n subscribers: [],\n\n pendingWatchers: {},\n\n disableReactivity: false,\n\n startingCallbacks: [],\n\n startedCallbacks: [],\n\n hasStarted: false,\n\n start() {\n this.startingCallbacks.forEach(fn => fn())\n\n this.attach()\n\n this.stores = createObservable(this.stores, {\n get: (target, key, receiver) => {\n if (Object.is(receiver, this.stores) && ['get', 'set', 'toggle', 'call', 'clear'].includes(key)) {\n return this[key].bind(this)\n }\n\n return Reflect.get(target, key, receiver)\n },\n set: (target, key, value, receiver) => {\n if (this.disableReactivity) {\n return\n }\n\n this.updateSubscribers()\n\n this.runWatchers(target, key, value, receiver)\n\n this.disableReactivity = true\n\n try {\n this.persisted.forEach(this.updateLocalStorage.bind(this))\n } catch (e) {\n // Do nothing here (thanks Safari!)\n }\n\n this.disableReactivity = false\n }\n })\n\n this.hasStarted = true\n\n this.disableReactivity = true\n\n Object.entries(this.pendingWatchers).forEach(([name, callbacks]) => {\n callbacks.forEach(callback => this.watch(name, callback))\n })\n\n this.disableReactivity = false\n\n this.startedCallbacks.forEach(fn => fn())\n },\n\n starting(callback) {\n this.startingCallbacks.push(callback)\n },\n\n started(callback) {\n this.startedCallbacks.push(callback)\n },\n\n attach() {\n if (! checkForAlpine()) {\n throw new Error('[Spruce] You must be using Alpine >= 2.5.0 to use Spruce.')\n }\n\n const self = this\n\n window.Alpine.addMagicProperty('store', el => {\n self.subscribe(el)\n\n return self.stores\n })\n },\n\n store(name, state, persist = false) {\n if (typeof state === 'function') {\n state = state()\n }\n\n const isValidDriver = this.isValidDriver(persist)\n \n if (persist === true || isValidDriver) {\n try {\n this.stores[name] = this.retrieveFromLocalStorage(\n name,\n getMethods(state),\n isValidDriver ? persist : undefined\n )\n\n if (isValidDriver) {\n this.persistedDrivers[name] = persist\n }\n\n if (!this.persisted.includes(name)) {\n this.persisted.push(name)\n }\n } catch (e) {\n // Do nothing here (thanks Safari!)\n }\n }\n\n if (!this.stores[name]) {\n this.stores[name] = state\n }\n\n return this.stores[name]\n },\n\n reset(name, state) {\n if (this.stores[name] === undefined) {\n return;\n }\n \n this.stores[name] = state\n },\n\n delete(name, reload = true) {\n if (this.stores[name] === undefined) {\n return false;\n }\n\n delete this.stores[name]\n\n if (reload) {\n this.updateSubscribers()\n }\n\n return true;\n },\n\n deleteAll() {\n const results = Object.keys(this.stores).map(key => this.delete(key, false))\n\n this.updateSubscribers()\n\n return !results.some(bool => !bool)\n },\n\n subscribe(el) {\n if (!this.subscribers.includes(el)) {\n this.subscribers.push(el)\n }\n\n return this.stores\n },\n\n updateSubscribers() {\n this.subscribers.filter(el => !!el.__x).forEach(el => {\n el.__x.updateElements(el)\n })\n },\n\n retrieveFromLocalStorage(name, methods = {}, handler) {\n let driver = this.persistenceDriver\n\n if (handler !== undefined) {\n this.guardAgainstInvalidDrivers(handler)\n\n driver = handler\n }\n \n const value = driver.getItem(`__spruce:${name}`)\n\n if (! value) {\n return null\n }\n\n let storage = JSON.parse(value)\n\n if (typeof storage === 'object') {\n storage = Object.assign(methods, storage)\n\n delete storage.__watchers\n delete storage.__key_name\n }\n\n return storage\n },\n\n updateLocalStorage(name) {\n const store = { ...this.store(name) }\n\n delete store.__watchers\n delete store.__key_name\n\n const driver = this.persistedDrivers[name] || this.persistenceDriver\n\n driver.setItem(`__spruce:${name}`, JSON.stringify(this.store(name)))\n },\n\n get(name, target = this.stores) {\n return name.split('.').reduce((target, part) => target[part], target)\n },\n\n set(name, value, target = this.stores) {\n if (! isArray(name)) {\n name = name.split('.')\n }\n\n if (name.length === 1) return target[name[0]] = value\n\n if (target[name[0]]) {\n return this.set(name.slice(1), value, target[name[0]])\n } else {\n target[name[0]] = {}\n\n return this.set(name.slice(1), value, target[name[0]])\n }\n },\n\n toggle(name) {\n return this.set(name, ! this.get(name))\n },\n\n call(name, ...args) {\n return this.get(name)(...args)\n },\n\n clear(name) {\n return this.persistenceDriver.removeItem(`__spruce:${name}`)\n },\n\n watch(name, callback) {\n if (! this.hasStarted) {\n this.pendingWatchers[name] || (this.pendingWatchers[name] = [])\n\n this.pendingWatchers[name].push(callback)\n\n return [() => this.unwatch(name, callback)]\n }\n\n const nameParts = name.split('.')\n\n const target = nameParts.reduce((target, part) => {\n const sub = target[part]\n\n if (! isNullOrUndefined(sub) && (isObject(sub) || isArray(sub))) {\n return sub\n }\n\n return target\n }, this.stores)\n\n /**\n * If the target object / array is the property\n * that needs to be watched, a magic `__self` key is\n * used so that runner can pick up on it later.\n */\n const part = Object.is(target, this.get(name)) ? '__self' : nameParts[nameParts.length - 1]\n\n if (! target.hasOwnProperty('__watchers')) {\n Object.defineProperty(target, '__watchers', {\n enumerable: false,\n value: new Map,\n configurable: true\n })\n }\n \n if (! target.__watchers.has(part)) {\n target.__watchers.set(part, new Set)\n }\n\n target.__watchers.get(part).add(callback)\n\n return [() => this.unwatch(name, callback)]\n },\n\n unwatch(name, callback) {\n const nameParts = name.split('.')\n\n const target = nameParts.reduce((target, part) => {\n const sub = target[part]\n\n if (! isNullOrUndefined(sub) && (isObject(sub) || isArray(sub))) {\n return sub\n }\n\n return target\n }, this.stores)\n\n const part = Object.is(target, this.get(name)) ? '__self' : nameParts[nameParts.length - 1]\n const watchers = target.__watchers\n\n if (! watchers.has(part)) {\n return\n }\n\n watchers.get(part).delete(callback)\n },\n\n watchers(name) {\n const nameParts = name.split('.')\n\n const target = nameParts.reduce((target, part) => {\n const sub = target[part]\n\n if (! isNullOrUndefined(sub) && (isObject(sub) || isArray(sub))) {\n return sub\n }\n\n return target\n }, this.stores)\n\n const part = Object.is(target, this.get(name)) ? '__self' : nameParts[nameParts.length - 1]\n\n if (! target.__watchers) {\n return {}\n }\n\n return target.__watchers.get(part)\n },\n\n runWatchers(target, key, value) {\n if (! target.__watchers) {\n return\n }\n\n if (target.__watchers.has(key)) {\n target.__watchers.get(key).forEach(f => f(value))\n }\n\n /**\n * The `__self` key is used for watchers that are registered\n * to the object or array being updated.\n */\n if (target.__watchers.has('__self')) {\n target.__watchers.get('__self').forEach(f => f(value, key))\n }\n },\n\n persistUsing(driver) {\n if (this.persisted.length > 0) {\n console.warn('[Spruce] You have already initialised a persisted store. Changing the driver may cause issues.')\n }\n\n this.guardAgainstInvalidDrivers(driver)\n\n this.persistenceDriver = driver\n },\n\n guardAgainstInvalidDrivers(driver) {\n if (typeof driver.getItem !== 'function') {\n throw new Error('[Spruce] The persistence driver must have a `getItem(key)` method.')\n }\n\n if (typeof driver.setItem !== 'function') {\n throw new Error('[Spruce] The persistence driver must have a `setItem(key, value)` method.')\n }\n\n if (typeof driver.removeItem !== 'function') {\n throw new Error('[Spruce] The persistence driver must have a `removeItem(name)` method.')\n }\n },\n\n isValidDriver(driver) {\n try {\n this.guardAgainstInvalidDrivers(driver)\n } catch (e) {\n return false;\n }\n\n return true;\n }\n}\n\nwindow.Spruce = Spruce\n\nconst deferrer = window.deferLoadingAlpine || function (callback) { callback() }\n\nwindow.deferLoadingAlpine = function (callback) {\n window.Spruce.start()\n\n deferrer(callback)\n}\n\nexport default Spruce\n"],"names":["root","factory","module","this","semver","indexOrEnd","str","q","indexOf","length","split","v","c","replace","patchIndex","arr","substring","push","tryParse","isNaN","Number","validate","version","TypeError","test","Error","compareVersions","v1","v2","forEach","s1","s2","i","Math","max","n1","parseInt","n2","sp1","sp2","p1","map","p2","undefined","allowedOperators","operatorResMap","validateOperator","op","join","compare","operator","res","isNullOrUndefined","value","isObject","_","Object","getPrototypeOf","prototype","isArray","Array","getMethods","obj","methods","entries","filter","key","isTesting","navigator","userAgent","includes","checkForAlpine","window","Alpine","createObservable","target","callbacks","Proxy","get","receiver","set","originalValue","__watchers","Spruce","stores","persistenceDriver","localStorage","persisted","persistedDrivers","subscribers","pendingWatchers","disableReactivity","startingCallbacks","startedCallbacks","hasStarted","start","fn","attach","is","bind","Reflect","updateSubscribers","runWatchers","updateLocalStorage","e","name","callback","watch","starting","started","self","addMagicProperty","el","subscribe","store","state","persist","isValidDriver","retrieveFromLocalStorage","reset","delete","reload","deleteAll","results","keys","some","bool","__x","updateElements","handler","driver","guardAgainstInvalidDrivers","getItem","storage","JSON","parse","assign","__key_name","setItem","stringify","reduce","part","slice","toggle","call","args","clear","removeItem","unwatch","nameParts","sub","hasOwnProperty","defineProperty","enumerable","Map","configurable","has","Set","add","watchers","f","persistUsing","console","warn","deferrer","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,CAAU,oEAAV,CAAN;EACH;;EAED,QAAI,OAAOyG,MAAM,CAACQ,OAAd,KAA0B,UAA9B,EAA0C;EACtC,YAAM,IAAIjH,KAAJ,CAAU,2EAAV,CAAN;EACH;;EAED,QAAI,OAAOyG,MAAM,CAACiB,UAAd,KAA6B,UAAjC,EAA6C;EACzC,YAAM,IAAI1H,KAAJ,CAAU,wEAAV,CAAN;EACH;EACJ,GAhXU;;EAkXX4F,EAAAA,aAAa,CAACa,MAAD,EAAS;EAClB,QAAI;EACA,WAAKC,0BAAL,CAAgCD,MAAhC;EACH,KAFD,CAEE,OAAO1B,CAAP,EAAU;EACR,aAAO,KAAP;EACH;;EAED,WAAO,IAAP;EACH;;EA1XU;EA6XfhC,MAAM,CAACW,MAAP,GAAgBA,MAAhB;;EAEA,MAAMiF,QAAQ,GAAG5F,MAAM,CAAC6F,kBAAP,IAA6B,UAAU3D,QAAV,EAAoB;EAAEA,EAAAA,QAAQ;EAAI,CAAhF;;EAEAlC,MAAM,CAAC6F,kBAAP,GAA4B,UAAU3D,QAAV,EAAoB;EAC5ClC,EAAAA,MAAM,CAACW,MAAP,CAAcY,KAAd;EAEAqE,EAAAA,QAAQ,CAAC1D,QAAD,CAAR;EACH,CAJD;;;;;;;;"} \ No newline at end of file diff --git a/rollup.config.js b/rollup.config.js index e3827fc..f4359ae 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -10,8 +10,9 @@ export default { name: 'Spruce', file: 'dist/spruce.umd.js', format: 'umd', - sourcemap: true - } + sourcemap: true, + strict: false, + }, ], plugins: [ filesize(),