@fower/store
Advanced tools
Comparing version 1.30.0 to 1.31.0
import { FowerPlugin, Configuration, Theme, CSSObject, ModeType } from '@fower/types'; | ||
import { PartialThemeConfig, PartialConfig } from './types'; | ||
declare type Strategy = 'replace' | 'merge' | 'deepmerge'; | ||
declare class Store { | ||
export declare class Store { | ||
config: Configuration; | ||
@@ -6,0 +6,0 @@ atomCache: Map<string, any>; |
@@ -45,3 +45,2 @@ 'use strict'; | ||
var modeCacheKey = 'fower-mode'; | ||
var Store = /*#__PURE__*/function () { | ||
@@ -173,3 +172,3 @@ function Store() { | ||
if (_this.compositions.get(atomName)) { | ||
console.warn(atomName, 'is existed'); | ||
console.log("composed atom \"" + atomName + "\" is existed"); | ||
} else { | ||
@@ -190,7 +189,7 @@ _this.compositions.set(atomName, cssObject); | ||
}(); | ||
var store = /*#__PURE__*/new Store(); | ||
globalThis.__fower_store__ = store; | ||
exports.Store = Store; | ||
exports.store = store; | ||
//# sourceMappingURL=store.cjs.development.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=(e=require("deepmerge"))&&"object"==typeof e&&"default"in e?e.default:e,n=require("@fower/utils");function o(){return(o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}var i=new(function(){function e(){var e=this;this.config={unit:"px",inline:!1,important:!1,mode:{currentMode:"light",autoDarkMode:{enabled:!1,mappings:{white:"black",black:"white",50:"900",100:"800",200:"700",300:"600",400:"500",500:"400",600:"300",700:"200",800:"100",900:"50"}},modeList:["light","dark"],classPrefix:""},prefix:"",pseudos:["active","checked","disabled","enabled","default","empty","focus","focus-within","invalid","hover","link","visited","first-child","last-child","after","before","placeholder","selection"],theme:{breakpoints:{}},plugins:[]},this.atomCache=new Map,this.getAtomIds=function(){return Array.from(e.atomCache.keys())},this.compositions=new Map,this.getConfig=function(){return e.config},this.setConfig=function(n,i){void 0===i&&(i="deepmerge"),e.config="replace"===i?n:"merge"===i?o({},e.config,n):t(e.config,n)},this.getTheme=function(){return e.config.theme},this.setTheme=function(n){e.config.theme=t(e.config.theme||{},n)},this.getMode=function(){var t;return(null==(t=e.config.mode)?void 0:t.currentMode)||""},this.setMode=function(t){if(n.isBrowser){var o=e.config.mode.currentMode;o&&document.documentElement.classList.remove(o),t&&document.documentElement.classList.add(t),localStorage.setItem("fower-mode",t),e.setConfig({mode:{currentMode:t}})}},this.use=function(){var t;(t=e.config.plugins).push.apply(t,arguments)},this.addAtom=function(t,n){var o={isMatch:function(e){return"string"==typeof t?e===t:t instanceof RegExp&&t.test(e)},handleAtom:"function"==typeof n?n:function(e){return e.style=n,e}};return e.use(o),o},this.composeAtom=function(t,n){e.compositions.get(t)?console.warn(t,"is existed"):e.compositions.set(t,n)}}var i;return(i=[{key:"theme",get:function(){return this.config.theme}}])&&function(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}(e.prototype,i),e}());globalThis.__fower_store__=i,exports.store=i; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=(e=require("deepmerge"))&&"object"==typeof e&&"default"in e?e.default:e,o=require("@fower/utils");function n(){return(n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e}).apply(this,arguments)}var i=function(){function e(){var e=this;this.config={unit:"px",inline:!1,important:!1,mode:{currentMode:"light",autoDarkMode:{enabled:!1,mappings:{white:"black",black:"white",50:"900",100:"800",200:"700",300:"600",400:"500",500:"400",600:"300",700:"200",800:"100",900:"50"}},modeList:["light","dark"],classPrefix:""},prefix:"",pseudos:["active","checked","disabled","enabled","default","empty","focus","focus-within","invalid","hover","link","visited","first-child","last-child","after","before","placeholder","selection"],theme:{breakpoints:{}},plugins:[]},this.atomCache=new Map,this.getAtomIds=function(){return Array.from(e.atomCache.keys())},this.compositions=new Map,this.getConfig=function(){return e.config},this.setConfig=function(o,i){void 0===i&&(i="deepmerge"),e.config="replace"===i?o:"merge"===i?n({},e.config,o):t(e.config,o)},this.getTheme=function(){return e.config.theme},this.setTheme=function(o){e.config.theme=t(e.config.theme||{},o)},this.getMode=function(){var t;return(null==(t=e.config.mode)?void 0:t.currentMode)||""},this.setMode=function(t){if(o.isBrowser){var n=e.config.mode.currentMode;n&&document.documentElement.classList.remove(n),t&&document.documentElement.classList.add(t),localStorage.setItem("fower-mode",t),e.setConfig({mode:{currentMode:t}})}},this.use=function(){var t;(t=e.config.plugins).push.apply(t,arguments)},this.addAtom=function(t,o){var n={isMatch:function(e){return"string"==typeof t?e===t:t instanceof RegExp&&t.test(e)},handleAtom:"function"==typeof o?o:function(e){return e.style=o,e}};return e.use(n),n},this.composeAtom=function(t,o){e.compositions.get(t)?console.log('composed atom "'+t+'" is existed'):e.compositions.set(t,o)}}var i;return(i=[{key:"theme",get:function(){return this.config.theme}}])&&function(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,i),e}(),r=new i;globalThis.__fower_store__=r,exports.Store=i,exports.store=r; | ||
//# sourceMappingURL=store.cjs.production.min.js.map |
@@ -39,3 +39,2 @@ import deepmerge from 'deepmerge'; | ||
var modeCacheKey = 'fower-mode'; | ||
var Store = /*#__PURE__*/function () { | ||
@@ -167,3 +166,3 @@ function Store() { | ||
if (_this.compositions.get(atomName)) { | ||
console.warn(atomName, 'is existed'); | ||
console.log("composed atom \"" + atomName + "\" is existed"); | ||
} else { | ||
@@ -184,7 +183,6 @@ _this.compositions.set(atomName, cssObject); | ||
}(); | ||
var store = /*#__PURE__*/new Store(); | ||
globalThis.__fower_store__ = store; | ||
export { store }; | ||
export { Store, store }; | ||
//# sourceMappingURL=store.esm.js.map |
{ | ||
"name": "@fower/store", | ||
"version": "1.30.0", | ||
"version": "1.31.0", | ||
"license": "MIT", | ||
@@ -24,7 +24,7 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@fower/types": "^1.30.0", | ||
"@fower/utils": "^1.30.0", | ||
"@fower/types": "^1.31.0", | ||
"@fower/utils": "^1.31.0", | ||
"deepmerge": "^4.2.2" | ||
}, | ||
"gitHead": "c79b3d7a6f046ef1d309772e85e20a4440d488ba" | ||
"gitHead": "4031b8cbff3b4a419d2129a389a92036183c9a1e" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36947
354
Updated@fower/types@^1.31.0
Updated@fower/utils@^1.31.0