@artisan-commerce/state 0.3.0-canary.1 → 0.3.0-canary.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.cjs.js +52 -0
- package/dist/bundle.cjs.js.map +1 -0
- package/dist/bundle.d.ts +57 -0
- package/dist/bundle.esm.js +48 -0
- package/dist/bundle.esm.js.map +1 -0
- package/dist/bundle.umd.js +58 -0
- package/dist/bundle.umd.js.map +1 -0
- package/package.json +32 -50
- package/CHANGELOG.md +0 -175
- package/build/config/constants.d.ts +0 -2
- package/build/index.d.ts +0 -1
- package/build/lib/state.d.ts +0 -34
- package/build/lib/state.test.d.ts +0 -1
- package/build/main.bundle.js +0 -1
- package/build/vendors.bundle.js +0 -1
- package/build/vendors.d.ts +0 -1
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
+
var __spreadValues = (a, b) => {
|
|
11
|
+
for (var prop in b || (b = {}))
|
|
12
|
+
if (__hasOwnProp.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
if (__getOwnPropSymbols)
|
|
15
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
+
if (__propIsEnum.call(b, prop))
|
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
|
18
|
+
}
|
|
19
|
+
return a;
|
|
20
|
+
};
|
|
21
|
+
const _State = class {
|
|
22
|
+
constructor(state) {
|
|
23
|
+
this._state = state;
|
|
24
|
+
this._initialState = state;
|
|
25
|
+
}
|
|
26
|
+
static getInstance(initialState) {
|
|
27
|
+
if (!_State._instance) {
|
|
28
|
+
_State._instance = new _State(initialState);
|
|
29
|
+
}
|
|
30
|
+
return _State._instance;
|
|
31
|
+
}
|
|
32
|
+
setState(overrides) {
|
|
33
|
+
this._state = __spreadValues(__spreadValues({}, this._state), overrides);
|
|
34
|
+
}
|
|
35
|
+
get state() {
|
|
36
|
+
if (this._state === null) {
|
|
37
|
+
throw new Error("The state has not been initialized, make sure to call State.init beforehand");
|
|
38
|
+
}
|
|
39
|
+
return this._state;
|
|
40
|
+
}
|
|
41
|
+
checkInit() {
|
|
42
|
+
return !!this._state;
|
|
43
|
+
}
|
|
44
|
+
reset() {
|
|
45
|
+
this._state = this._initialState;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
let State = _State;
|
|
49
|
+
State._instance = null;
|
|
50
|
+
|
|
51
|
+
exports.State = State;
|
|
52
|
+
//# sourceMappingURL=bundle.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle.cjs.js","sources":["../src/lib/state.ts"],"sourcesContent":["// Common functions and data\n\n/**\n * @since 0.1.0\n * @typedef State\n */\nexport type GlobalState = Record<string, any>;\n\n/**\n *\n * Create a global state.\n *\n * @example\n * interface Animal {\n * walk: () => void;\n * name: string;\n * }\n *\n * function getDogState(): State<Animal> {\n * return State.getInstance({ name: \"Rancho\", walk: () => {} });\n * }\n *\n * const dogState = getDogState();\n */\nexport class State<T extends GlobalState> {\n static _instance: State<any> | null = null;\n private _initialState: T;\n private _state: T;\n\n private constructor(state: T) {\n this._state = state;\n this._initialState = state;\n }\n\n public static getInstance<T extends GlobalState>(initialState: T): State<T> {\n if (!State._instance) {\n State._instance = new State<T>(initialState);\n }\n return State._instance as State<T>;\n }\n\n /**\n * Updates the global state.\n *\n * @since 0.1.0\n * @param {T} overrides Global state overrides\n */\n public setState(overrides: Partial<T>) {\n this._state = { ...this._state, ...overrides };\n }\n\n /**\n * Returns the global state.\n *\n * @since 0.1.0\n * @returns {T} The global state\n */\n public get state(): T {\n if (this._state === null) {\n throw new Error(\n \"The state has not been initialized, make sure to call State.init beforehand\"\n );\n }\n return this._state;\n }\n\n /**\n * Returns whether the state has been initialized.\n *\n * @since 0.1.0\n * @returns {boolean} Whether the state has been initialized\n */\n public checkInit(): boolean {\n return !!this._state;\n }\n\n /**\n * Reset state to the given initial state.\n *\n * @since 0.1.0\n */\n public reset() {\n this._state = this._initialState;\n }\n}\n"],"names":[],"mappings":";;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAChK,IAAI,cAAc,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK;AAC/B,EAAE,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;AAChC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC;AAClC,MAAM,eAAe,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AACxC,EAAE,IAAI,mBAAmB;AACzB,IAAI,KAAK,IAAI,IAAI,IAAI,mBAAmB,CAAC,CAA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AAC1B,KAAK,CAAC,SAAS,GAAG,IAAI;;;;"}
|
package/dist/bundle.d.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @since 0.1.0
|
|
3
|
+
* @typedef State
|
|
4
|
+
*/
|
|
5
|
+
declare type GlobalState = Record<string, any>;
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* Create a global state.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* interface Animal {
|
|
12
|
+
* walk: () => void;
|
|
13
|
+
* name: string;
|
|
14
|
+
* }
|
|
15
|
+
*
|
|
16
|
+
* function getDogState(): State<Animal> {
|
|
17
|
+
* return State.getInstance({ name: "Rancho", walk: () => {} });
|
|
18
|
+
* }
|
|
19
|
+
*
|
|
20
|
+
* const dogState = getDogState();
|
|
21
|
+
*/
|
|
22
|
+
declare class State<T extends GlobalState> {
|
|
23
|
+
static _instance: State<any> | null;
|
|
24
|
+
private _initialState;
|
|
25
|
+
private _state;
|
|
26
|
+
private constructor();
|
|
27
|
+
static getInstance<T extends GlobalState>(initialState: T): State<T>;
|
|
28
|
+
/**
|
|
29
|
+
* Updates the global state.
|
|
30
|
+
*
|
|
31
|
+
* @since 0.1.0
|
|
32
|
+
* @param {T} overrides Global state overrides
|
|
33
|
+
*/
|
|
34
|
+
setState(overrides: Partial<T>): void;
|
|
35
|
+
/**
|
|
36
|
+
* Returns the global state.
|
|
37
|
+
*
|
|
38
|
+
* @since 0.1.0
|
|
39
|
+
* @returns {T} The global state
|
|
40
|
+
*/
|
|
41
|
+
get state(): T;
|
|
42
|
+
/**
|
|
43
|
+
* Returns whether the state has been initialized.
|
|
44
|
+
*
|
|
45
|
+
* @since 0.1.0
|
|
46
|
+
* @returns {boolean} Whether the state has been initialized
|
|
47
|
+
*/
|
|
48
|
+
checkInit(): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Reset state to the given initial state.
|
|
51
|
+
*
|
|
52
|
+
* @since 0.1.0
|
|
53
|
+
*/
|
|
54
|
+
reset(): void;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export { State };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
const _State = class {
|
|
18
|
+
constructor(state) {
|
|
19
|
+
this._state = state;
|
|
20
|
+
this._initialState = state;
|
|
21
|
+
}
|
|
22
|
+
static getInstance(initialState) {
|
|
23
|
+
if (!_State._instance) {
|
|
24
|
+
_State._instance = new _State(initialState);
|
|
25
|
+
}
|
|
26
|
+
return _State._instance;
|
|
27
|
+
}
|
|
28
|
+
setState(overrides) {
|
|
29
|
+
this._state = __spreadValues(__spreadValues({}, this._state), overrides);
|
|
30
|
+
}
|
|
31
|
+
get state() {
|
|
32
|
+
if (this._state === null) {
|
|
33
|
+
throw new Error("The state has not been initialized, make sure to call State.init beforehand");
|
|
34
|
+
}
|
|
35
|
+
return this._state;
|
|
36
|
+
}
|
|
37
|
+
checkInit() {
|
|
38
|
+
return !!this._state;
|
|
39
|
+
}
|
|
40
|
+
reset() {
|
|
41
|
+
this._state = this._initialState;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
let State = _State;
|
|
45
|
+
State._instance = null;
|
|
46
|
+
|
|
47
|
+
export { State };
|
|
48
|
+
//# sourceMappingURL=bundle.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle.esm.js","sources":["../src/lib/state.ts"],"sourcesContent":["// Common functions and data\n\n/**\n * @since 0.1.0\n * @typedef State\n */\nexport type GlobalState = Record<string, any>;\n\n/**\n *\n * Create a global state.\n *\n * @example\n * interface Animal {\n * walk: () => void;\n * name: string;\n * }\n *\n * function getDogState(): State<Animal> {\n * return State.getInstance({ name: \"Rancho\", walk: () => {} });\n * }\n *\n * const dogState = getDogState();\n */\nexport class State<T extends GlobalState> {\n static _instance: State<any> | null = null;\n private _initialState: T;\n private _state: T;\n\n private constructor(state: T) {\n this._state = state;\n this._initialState = state;\n }\n\n public static getInstance<T extends GlobalState>(initialState: T): State<T> {\n if (!State._instance) {\n State._instance = new State<T>(initialState);\n }\n return State._instance as State<T>;\n }\n\n /**\n * Updates the global state.\n *\n * @since 0.1.0\n * @param {T} overrides Global state overrides\n */\n public setState(overrides: Partial<T>) {\n this._state = { ...this._state, ...overrides };\n }\n\n /**\n * Returns the global state.\n *\n * @since 0.1.0\n * @returns {T} The global state\n */\n public get state(): T {\n if (this._state === null) {\n throw new Error(\n \"The state has not been initialized, make sure to call State.init beforehand\"\n );\n }\n return this._state;\n }\n\n /**\n * Returns whether the state has been initialized.\n *\n * @since 0.1.0\n * @returns {boolean} Whether the state has been initialized\n */\n public checkInit(): boolean {\n return !!this._state;\n }\n\n /**\n * Reset state to the given initial state.\n *\n * @since 0.1.0\n */\n public reset() {\n this._state = this._initialState;\n }\n}\n"],"names":[],"mappings":"AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SA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AS,GAAG,IAAI,MAAM,CAAC,YAAY,CAAC,CAAC;AAClD,KAAK;AACL,IAAI,OAAO,MAAM,CAAC,SAAS,CAAC;AAC5B,GAAG;AACH,EAAE,QAAQ,CAAC,SAAS,EAAE;AACtB,IAAI,IAAI,CAAC,MAAM,GAAG,cAAc,CAAC,cAAc,CAAC,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,CAAC;AAC7E,GAAG;AACH,EAAE,IAAI,KAAK,GAAG;AACd,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,EAAE;AAC9B,MAAM,MAAM,IAAI,KAAK,CAAC,6EAA6E,CAAC,CAAC;AACrG,KAAK;AACL,IAAI,OAAO,IAAI,CAAC,MAAM,CAAC;AACvB,GAAG;AACH,EAAE,SAAS,GAAG;AACd,IAAI,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;AACzB,GAAG;AACH,EAAE,KAAK,GAAG;AACV,IAAI,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC;AACrC,GAAG;AACH,CAAC,CAAC;AACQ,IAAC,KAAK,GAAG,OAAO;AAC1B,KAAK,CAAC,SAAS,GAAG,IAAI;;;;"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
(function (global, factory) {
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ArtisnState = {}));
|
|
5
|
+
})(this, (function (exports) { 'use strict';
|
|
6
|
+
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
const _State = class {
|
|
24
|
+
constructor(state) {
|
|
25
|
+
this._state = state;
|
|
26
|
+
this._initialState = state;
|
|
27
|
+
}
|
|
28
|
+
static getInstance(initialState) {
|
|
29
|
+
if (!_State._instance) {
|
|
30
|
+
_State._instance = new _State(initialState);
|
|
31
|
+
}
|
|
32
|
+
return _State._instance;
|
|
33
|
+
}
|
|
34
|
+
setState(overrides) {
|
|
35
|
+
this._state = __spreadValues(__spreadValues({}, this._state), overrides);
|
|
36
|
+
}
|
|
37
|
+
get state() {
|
|
38
|
+
if (this._state === null) {
|
|
39
|
+
throw new Error("The state has not been initialized, make sure to call State.init beforehand");
|
|
40
|
+
}
|
|
41
|
+
return this._state;
|
|
42
|
+
}
|
|
43
|
+
checkInit() {
|
|
44
|
+
return !!this._state;
|
|
45
|
+
}
|
|
46
|
+
reset() {
|
|
47
|
+
this._state = this._initialState;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
let State = _State;
|
|
51
|
+
State._instance = null;
|
|
52
|
+
|
|
53
|
+
exports.State = State;
|
|
54
|
+
|
|
55
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
56
|
+
|
|
57
|
+
}));
|
|
58
|
+
//# sourceMappingURL=bundle.umd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle.umd.js","sources":["../src/lib/state.ts"],"sourcesContent":["// Common functions and data\n\n/**\n * @since 0.1.0\n * @typedef State\n */\nexport type GlobalState = Record<string, any>;\n\n/**\n *\n * Create a global state.\n *\n * @example\n * interface Animal {\n * walk: () => void;\n * name: string;\n * }\n *\n * function getDogState(): State<Animal> {\n * return State.getInstance({ name: \"Rancho\", walk: () => {} });\n * }\n *\n * const dogState = getDogState();\n */\nexport class State<T extends GlobalState> {\n static _instance: State<any> | null = null;\n private _initialState: T;\n private _state: T;\n\n private constructor(state: T) {\n this._state = state;\n this._initialState = state;\n }\n\n public static getInstance<T extends GlobalState>(initialState: T): State<T> {\n if (!State._instance) {\n State._instance = new State<T>(initialState);\n }\n return State._instance as State<T>;\n }\n\n /**\n * Updates the global state.\n *\n * @since 0.1.0\n * @param {T} overrides Global state overrides\n */\n public setState(overrides: Partial<T>) {\n this._state = { ...this._state, ...overrides };\n }\n\n /**\n * Returns the global state.\n *\n * @since 0.1.0\n * @returns {T} The global state\n */\n public get state(): T {\n if (this._state === null) {\n throw new Error(\n \"The state has not been initialized, make sure to call State.init beforehand\"\n );\n }\n return this._state;\n }\n\n /**\n * Returns whether the state has been initialized.\n *\n * @since 0.1.0\n * @returns {boolean} Whether the state has been initialized\n */\n public checkInit(): boolean {\n return !!this._state;\n }\n\n /**\n * Reset state to the given initial state.\n *\n * @since 0.1.0\n */\n public reset() {\n this._state = this._initialState;\n }\n}\n"],"names":[],"mappings":";;;;;;EAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;EACtC,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;EACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;EACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;EACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAA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CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,CAAC;EAC7E,GAAG;EACH,EAAE,IAAI,KAAK,GAAG;EACd,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,EAAE;EAC9B,MAAM,MAAM,IAAI,KAAK,CAAC,6EAA6E,CAAC,CAAC;EACrG,KAAK;EACL,IAAI,OAAO,IAAI,CAAC,MAAM,CAAC;EACvB,GAAG;EACH,EAAE,SAAS,GAAG;EACd,IAAI,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;EACzB,GAAG;EACH,EAAE,KAAK,GAAG;EACV,IAAI,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC;EACrC,GAAG;EACH,CAAC,CAAC;AACQ,MAAC,KAAK,GAAG,OAAO;EAC1B,KAAK,CAAC,SAAS,GAAG,IAAI;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@artisan-commerce/state",
|
|
3
3
|
"description": "Library used to share state functionality",
|
|
4
|
-
"version": "0.3.0-canary.
|
|
5
|
-
"main": "./
|
|
6
|
-
"
|
|
4
|
+
"version": "0.3.0-canary.11",
|
|
5
|
+
"main": "./dist/bundle.cjs.js",
|
|
6
|
+
"module": "./dist/bundle.esm.js",
|
|
7
|
+
"types": "./dist/bundle.d.ts",
|
|
7
8
|
"files": [
|
|
8
|
-
"
|
|
9
|
-
"LICENSE",
|
|
10
|
-
"README.md"
|
|
9
|
+
"dist"
|
|
11
10
|
],
|
|
11
|
+
"sideEffects": false,
|
|
12
12
|
"scripts": {
|
|
13
|
-
"compile": "
|
|
14
|
-
"dev": "yarn compile",
|
|
15
|
-
"
|
|
16
|
-
"
|
|
13
|
+
"compile": "rollup -c && npx agadoo",
|
|
14
|
+
"dev": "yarn compile -w",
|
|
15
|
+
"clean": "rimraf dist",
|
|
16
|
+
"prebuild": "yarn clean",
|
|
17
|
+
"build": "yarn compile",
|
|
17
18
|
"test": "jest --watchAll --runInBand",
|
|
18
19
|
"test:all": "yarn test --watchAll=false --coverage",
|
|
19
20
|
"test:ci": "cross-env CI=true jest --runInBand",
|
|
@@ -29,46 +30,27 @@
|
|
|
29
30
|
},
|
|
30
31
|
"author": "Santiago Benítez",
|
|
31
32
|
"license": "MIT",
|
|
33
|
+
"nx": {
|
|
34
|
+
"targets": {
|
|
35
|
+
"build": {
|
|
36
|
+
"outputs": [
|
|
37
|
+
"./dist"
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
"compile": {
|
|
41
|
+
"outputs": [
|
|
42
|
+
"./dist"
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
"test:all": {
|
|
46
|
+
"outputs": [
|
|
47
|
+
"./coverage"
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
},
|
|
32
52
|
"devDependencies": {
|
|
33
|
-
"@
|
|
34
|
-
"@babel/preset-env": "^7.10.4",
|
|
35
|
-
"@babel/preset-react": "^7.10.4",
|
|
36
|
-
"@types/faker": "^4.1.12",
|
|
37
|
-
"@types/jest": "^26.0.5",
|
|
38
|
-
"@types/jest-in-case": "^1.0.2",
|
|
39
|
-
"@types/node": "^14.0.24",
|
|
40
|
-
"@typescript-eslint/eslint-plugin": "^3.7.0",
|
|
41
|
-
"@typescript-eslint/parser": "^3.7.0",
|
|
42
|
-
"avn": "^0.2.4",
|
|
43
|
-
"avn-nvm": "^0.2.2",
|
|
44
|
-
"clean-webpack-plugin": "^3.0.0",
|
|
45
|
-
"dotenv-webpack": "^2.0.0",
|
|
46
|
-
"env-cmd": "^10.1.0",
|
|
47
|
-
"eslint": "^7.5.0",
|
|
48
|
-
"eslint-config-prettier": "^6.11.0",
|
|
49
|
-
"eslint-config-react-app": "^5.2.1",
|
|
50
|
-
"eslint-config-universe": "^4.0.0",
|
|
51
|
-
"eslint-plugin-cypress": "^2.11.1",
|
|
52
|
-
"eslint-plugin-flowtype": "^5.2.0",
|
|
53
|
-
"eslint-plugin-import": "^2.22.0",
|
|
54
|
-
"eslint-plugin-jsx-a11y": "^6.3.1",
|
|
55
|
-
"eslint-plugin-react": "^7.20.3",
|
|
56
|
-
"eslint-plugin-react-hooks": "^4.0.8",
|
|
57
|
-
"is-ci-cli": "^2.1.2",
|
|
58
|
-
"jest-axe": "^3.5.0",
|
|
59
|
-
"jest-in-case": "^1.0.2",
|
|
60
|
-
"jest-styled-components": "^7.0.2",
|
|
61
|
-
"nodemon": "^2.0.4",
|
|
62
|
-
"npm-run-all": "^4.1.5",
|
|
63
|
-
"prettier": "^2.2.1",
|
|
64
|
-
"start-server-and-test": "^1.11.2",
|
|
65
|
-
"test-data-bot": "^0.8.0",
|
|
66
|
-
"ts-jest": "^26.1.4",
|
|
67
|
-
"ts-loader": "^8.0.2",
|
|
68
|
-
"webpack": "^4.43.0",
|
|
69
|
-
"webpack-cli": "^3.3.12",
|
|
70
|
-
"webpack-dev-server": "^3.11.0",
|
|
71
|
-
"webpack-merge": "^5.0.9"
|
|
53
|
+
"@artisan-commerce/types": "0.14.0-canary.39"
|
|
72
54
|
},
|
|
73
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "7972507b3d08431547670c22f88532d142ddf1de"
|
|
74
56
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
-
|
|
6
|
-
## [0.3.0-canary.1](https://bitbucket.org/tradesystem/artisn_sdk/compare/@artisan-commerce/state@0.3.0-canary.0...@artisan-commerce/state@0.3.0-canary.1) (2021-10-04)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
### Features
|
|
10
|
-
|
|
11
|
-
* **global:** update registerModifiersForm function, control state error ([c3534cf](https://bitbucket.org/tradesystem/artisn_sdk/commit/c3534cf2eac5f7d90176888ad5b6dd575998e2f1))
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
## [0.3.0-canary.0](https://bitbucket.org/tradesystem/artisn_sdk/compare/@artisan-commerce/state@0.2.2...@artisan-commerce/state@0.3.0-canary.0) (2021-08-11)
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
### Features
|
|
19
|
-
|
|
20
|
-
* **global:** rebrand artisan-commerce to artisn ([b2688b1](https://bitbucket.org/tradesystem/artisn_sdk/commit/b2688b107757ed82791c0be49439e9fb28f78b6d))
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
### [0.2.2](https://bitbucket.org/tradesystem/artisan_sdk/compare/@artisan-commerce/state@0.2.2-canary.4...@artisan-commerce/state@0.2.2) (2021-07-30)
|
|
25
|
-
|
|
26
|
-
**Note:** Version bump only for package @artisan-commerce/state
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
### [0.2.2-canary.4](https://bitbucket.org/tradesystem/artisan_monorepo/compare/@artisan-commerce/state@0.2.2-canary.3...@artisan-commerce/state@0.2.2-canary.4) (2021-04-27)
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
### Bug Fixes
|
|
36
|
-
|
|
37
|
-
* **global:** fix updateActiveVendor utility function and state lib ([e5d9c52](https://bitbucket.org/tradesystem/artisan_monorepo/commit/e5d9c52455929782ada1762b03abb3363efe88cf))
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
### [0.2.2-canary.3](https://bitbucket.org/tradesystem/artisan_monorepo/compare/@artisan-commerce/state@0.2.2-canary.2...@artisan-commerce/state@0.2.2-canary.3) (2021-04-16)
|
|
42
|
-
|
|
43
|
-
**Note:** Version bump only for package @artisan-commerce/state
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
### [0.2.2-canary.2](https://bitbucket.org/tradesystem/artisan_monorepo/compare/@artisan-commerce/state@0.2.2-canary.1...@artisan-commerce/state@0.2.2-canary.2) (2021-04-06)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
### Performance Improvements
|
|
53
|
-
|
|
54
|
-
* **global:** move typescript to be a global dependency ([32370e1](https://bitbucket.org/tradesystem/artisan_monorepo/commit/32370e134f1bcc4f79c55e2bae0ee22fee193e77))
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
### [0.2.2-canary.1](https://bitbucket.org/tradesystem/artisan_monorepo/compare/@artisan-commerce/state@0.2.2-canary.0...@artisan-commerce/state@0.2.2-canary.1) (2021-03-30)
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
### Performance Improvements
|
|
62
|
-
|
|
63
|
-
* **global:** add esbuild opt-in for dev ([f760449](https://bitbucket.org/tradesystem/artisan_monorepo/commit/f7604492fc17967bad75583a49d91a51cd6241aa))
|
|
64
|
-
* **global:** improve jest performance ([8c36173](https://bitbucket.org/tradesystem/artisan_monorepo/commit/8c36173df7e7cbfad40888499c81fcf7d11a7105))
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
### [0.2.2-canary.0](https://bitbucket.org/tradesystem/artisan_monorepo/compare/@artisan-commerce/state@0.2.1...@artisan-commerce/state@0.2.2-canary.0) (2021-03-12)
|
|
69
|
-
|
|
70
|
-
**Note:** Version bump only for package @artisan-commerce/state
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
### [0.2.1](https://bitbucket.org/tradesystem/artisan_monorepo/compare/@artisan-commerce/state@0.2.1-canary.1...@artisan-commerce/state@0.2.1) (2021-03-02)
|
|
77
|
-
|
|
78
|
-
**Note:** Version bump only for package @artisan-commerce/state
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
### [0.2.1-canary.1](https://bitbucket.org/tradesystem/artisan_monorepo/compare/@artisan-commerce/state@0.2.1-canary.0...@artisan-commerce/state@0.2.1-canary.1) (2021-02-25)
|
|
85
|
-
|
|
86
|
-
**Note:** Version bump only for package @artisan-commerce/state
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
### [0.2.1-canary.0](https://bitbucket.org/tradesystem/artisan_monorepo/compare/@artisan-commerce/state@0.2.0...@artisan-commerce/state@0.2.1-canary.0) (2021-02-25)
|
|
93
|
-
|
|
94
|
-
**Note:** Version bump only for package @artisan-commerce/state
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
## [0.2.0](https://bitbucket.org/tradesystem/artisan_monorepo/compare/@artisan-commerce/state@0.2.0-canary.1...@artisan-commerce/state@0.2.0) (2021-02-25)
|
|
101
|
-
|
|
102
|
-
**Note:** Version bump only for package @artisan-commerce/state
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
## [0.2.0-canary.1](https://bitbucket.org/tradesystem/artisan_monorepo/compare/@artisan-commerce/state@0.2.0-canary.0...@artisan-commerce/state@0.2.0-canary.1) (2021-02-25)
|
|
109
|
-
|
|
110
|
-
**Note:** Version bump only for package @artisan-commerce/state
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
## [0.2.0-canary.0](https://bitbucket.org/tradesystem/artisan_monorepo/compare/@artisan-commerce/state@0.1.1-canary.6...@artisan-commerce/state@0.2.0-canary.0) (2021-02-25)
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
### Features
|
|
120
|
-
|
|
121
|
-
* added commentaries ([400127f](https://bitbucket.org/tradesystem/artisan_monorepo/commit/400127f878abdafc2236cee866300a765956e0ce))
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
### [0.1.1-canary.6](https://bitbucket.org/tradesystem/artisan_monorepo/compare/@artisan-commerce/state@0.1.1-canary.5...@artisan-commerce/state@0.1.1-canary.6) (2021-02-23)
|
|
126
|
-
|
|
127
|
-
**Note:** Version bump only for package @artisan-commerce/state
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
### [0.1.1-canary.5](https://bitbucket.org/tradesystem/artisan_monorepo/compare/@artisan-commerce/state@0.1.1-canary.4...@artisan-commerce/state@0.1.1-canary.5) (2021-02-04)
|
|
134
|
-
|
|
135
|
-
**Note:** Version bump only for package @artisan-commerce/state
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
### [0.1.1-canary.4](https://bitbucket.org/tradesystem/artisan_monorepo/compare/@artisan-commerce/state@0.1.1-canary.3...@artisan-commerce/state@0.1.1-canary.4) (2021-02-04)
|
|
142
|
-
|
|
143
|
-
**Note:** Version bump only for package @artisan-commerce/state
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
### [0.1.1-canary.3](https://bitbucket.org/tradesystem/artisan_monorepo/compare/@artisan-commerce/state@0.1.1-canary.2...@artisan-commerce/state@0.1.1-canary.3) (2021-02-04)
|
|
150
|
-
|
|
151
|
-
**Note:** Version bump only for package @artisan-commerce/state
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
### [0.1.1-canary.2](https://bitbucket.org/tradesystem/artisan_monorepo/compare/@artisan-commerce/state@0.1.1-canary.1...@artisan-commerce/state@0.1.1-canary.2) (2021-02-04)
|
|
158
|
-
|
|
159
|
-
**Note:** Version bump only for package @artisan-commerce/state
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
### [0.1.1-canary.1](https://bitbucket.org/tradesystem/artisan_monorepo/compare/@artisan-commerce/state@0.1.1-canary.0...@artisan-commerce/state@0.1.1-canary.1) (2021-02-04)
|
|
166
|
-
|
|
167
|
-
**Note:** Version bump only for package @artisan-commerce/state
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
## 0.1.1-canary.0 (2021-02-03)
|
|
174
|
-
|
|
175
|
-
**Note:** Version bump only for package @artisan-commerce/state
|
package/build/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { checkInit, getState, initState, setState } from "./lib/state";
|
package/build/lib/state.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @since 0.1.0
|
|
3
|
-
* @typedef State
|
|
4
|
-
*/
|
|
5
|
-
declare type State = Record<string, any>;
|
|
6
|
-
/**
|
|
7
|
-
* Initializes the global state.
|
|
8
|
-
*
|
|
9
|
-
* @since 0.1.0
|
|
10
|
-
* @param {T} initialState Initial global state
|
|
11
|
-
*/
|
|
12
|
-
export declare const initState: <T extends State>(initialState: T) => void;
|
|
13
|
-
/**
|
|
14
|
-
* Updates the global state.
|
|
15
|
-
*
|
|
16
|
-
* @since 0.1.0
|
|
17
|
-
* @param {T} overrides Global state overrides
|
|
18
|
-
*/
|
|
19
|
-
export declare const setState: <T extends State>(overrides: Partial<T>) => void;
|
|
20
|
-
/**
|
|
21
|
-
* Returns the global state.
|
|
22
|
-
*
|
|
23
|
-
* @since 0.1.0
|
|
24
|
-
* @returns {T} The global state
|
|
25
|
-
*/
|
|
26
|
-
export declare const getState: <T extends State>() => T;
|
|
27
|
-
/**
|
|
28
|
-
* Returns whether the state has been initialized.
|
|
29
|
-
*
|
|
30
|
-
* @since 0.1.0
|
|
31
|
-
* @returns {boolean} Whether the state has been initialized
|
|
32
|
-
*/
|
|
33
|
-
export declare const checkInit: () => boolean;
|
|
34
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/build/main.bundle.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("state",[],t):"object"==typeof exports?exports.state=t():e.state=t()}(this,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([,function(e,t,n){"use strict";n.r(t),n.d(t,"checkInit",(function(){return c})),n.d(t,"getState",(function(){return f})),n.d(t,"initState",(function(){return u})),n.d(t,"setState",(function(){return i}));var r=function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},o=null,u=function(e){Object.freeze(e),o=r({},e),Object.seal(o)},i=function(e){var t=o?r({},o):{};o=null,o=r(r({},t),e),Object.seal(o)},f=function(){if(null===o)throw new Error("The state has not been initialized, make sure to call initState beforehand");return r({},o)},c=function(){return!!o}}])}));
|
package/build/vendors.bundle.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("state",[],t):"object"==typeof exports?exports.state=t():e.state=t()}(this,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";n.r(t)}])}));
|
package/build/vendors.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|