memorio 1.0.0 → 1.0.2

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.
Files changed (106) hide show
  1. package/{dist/index.js → index.js} +1 -1
  2. package/package.json +1 -1
  3. package/.editorconfig +0 -31
  4. package/.gitattributes +0 -1
  5. package/.github/CHANGELOG.md +0 -10
  6. package/.github/CITATION.cff +0 -24
  7. package/.github/CODEOWNERS +0 -1
  8. package/.github/CODE_OF_CONDUCT.md +0 -108
  9. package/.github/CONTRIBUTING.md +0 -108
  10. package/.github/COPYRIGHT.md +0 -9
  11. package/.github/FUNDING.yml +0 -16
  12. package/.github/HISTORY.md +0 -1
  13. package/.github/LICENSE.md +0 -21
  14. package/.github/SECURITY.md +0 -3
  15. package/.github/SUMMARY.md +0 -21
  16. package/.github/dependabot.yml +0 -11
  17. package/.github/documents/OBSERVER.md +0 -72
  18. package/.github/documents/STATE.md +0 -72
  19. package/.github/documents/STORE.md +0 -84
  20. package/.github/pull_request_template.md +0 -27
  21. package/.private/npm +0 -1
  22. package/.vscode/extension.json +0 -15
  23. package/.vscode/settings.json +0 -90
  24. package/config/dispatch.ts +0 -49
  25. package/config/global.ts +0 -36
  26. package/coverage/clover.xml +0 -260
  27. package/coverage/coverage-final.json +0 -10
  28. package/coverage/lcov-report/a51.memorio/config/dispatch.ts.html +0 -232
  29. package/coverage/lcov-report/a51.memorio/config/global.ts.html +0 -193
  30. package/coverage/lcov-report/a51.memorio/config/index.html +0 -131
  31. package/coverage/lcov-report/a51.memorio/dist/config/dispatch.js.html +0 -157
  32. package/coverage/lcov-report/a51.memorio/dist/config/global.js.html +0 -142
  33. package/coverage/lcov-report/a51.memorio/dist/config/index.html +0 -131
  34. package/coverage/lcov-report/a51.memorio/dist/functions/cache/index.html +0 -116
  35. package/coverage/lcov-report/a51.memorio/dist/functions/cache/index.js.html +0 -103
  36. package/coverage/lcov-report/a51.memorio/dist/functions/observer/index.html +0 -116
  37. package/coverage/lcov-report/a51.memorio/dist/functions/observer/index.js.html +0 -280
  38. package/coverage/lcov-report/a51.memorio/dist/functions/state/index.html +0 -116
  39. package/coverage/lcov-report/a51.memorio/dist/functions/state/index.js.html +0 -460
  40. package/coverage/lcov-report/a51.memorio/dist/functions/store/index.html +0 -116
  41. package/coverage/lcov-report/a51.memorio/dist/functions/store/index.js.html +0 -367
  42. package/coverage/lcov-report/a51.memorio/dist/index.html +0 -116
  43. package/coverage/lcov-report/a51.memorio/dist/init.js.html +0 -106
  44. package/coverage/lcov-report/a51.memorio/functions/cache/index.html +0 -116
  45. package/coverage/lcov-report/a51.memorio/functions/cache/index.ts.html +0 -142
  46. package/coverage/lcov-report/a51.memorio/functions/observer/index.html +0 -116
  47. package/coverage/lcov-report/a51.memorio/functions/observer/index.ts.html +0 -448
  48. package/coverage/lcov-report/a51.memorio/functions/session/index.html +0 -116
  49. package/coverage/lcov-report/a51.memorio/functions/session/index.ts.html +0 -409
  50. package/coverage/lcov-report/a51.memorio/functions/state/index.html +0 -116
  51. package/coverage/lcov-report/a51.memorio/functions/state/index.ts.html +0 -682
  52. package/coverage/lcov-report/a51.memorio/functions/store/index.html +0 -116
  53. package/coverage/lcov-report/a51.memorio/functions/store/index.ts.html +0 -409
  54. package/coverage/lcov-report/a51.memorio/index.html +0 -131
  55. package/coverage/lcov-report/a51.memorio/index.ts.html +0 -88
  56. package/coverage/lcov-report/a51.memorio/init.ts.html +0 -115
  57. package/coverage/lcov-report/base.css +0 -224
  58. package/coverage/lcov-report/block-navigation.js +0 -87
  59. package/coverage/lcov-report/favicon.png +0 -0
  60. package/coverage/lcov-report/index.html +0 -206
  61. package/coverage/lcov-report/prettify.css +0 -1
  62. package/coverage/lcov-report/prettify.js +0 -2
  63. package/coverage/lcov-report/session/index.html +0 -116
  64. package/coverage/lcov-report/session/index.ts.html +0 -571
  65. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  66. package/coverage/lcov-report/sorter.js +0 -210
  67. package/coverage/lcov-report/state/index.html +0 -116
  68. package/coverage/lcov-report/state/index.ts.html +0 -1090
  69. package/coverage/lcov-report/store/index.html +0 -116
  70. package/coverage/lcov-report/store/index.ts.html +0 -556
  71. package/coverage/lcov.info +0 -518
  72. package/dist/README.md +0 -319
  73. package/dist/index.d.ts +0 -7
  74. package/dist/package.json +0 -98
  75. package/dist/types/cache.d.ts +0 -27
  76. package/dist/types/memorio.d.ts +0 -18
  77. package/dist/types/observer.d.ts +0 -47
  78. package/dist/types/session.d.ts +0 -91
  79. package/dist/types/state.d.ts +0 -71
  80. package/dist/types/store.d.ts +0 -91
  81. package/esbuild.config.mjs +0 -54
  82. package/eslint.config.mjs +0 -174
  83. package/examples/bg.jpg +0 -0
  84. package/examples/bootstrap.less +0 -92
  85. package/examples/favicon.ico +0 -0
  86. package/examples/index.htm +0 -65
  87. package/examples/javascript.js +0 -2
  88. package/examples/responsive.less +0 -47
  89. package/examples/styles.less +0 -169
  90. package/functions/cache/index.ts +0 -19
  91. package/functions/observer/index.ts +0 -121
  92. package/functions/session/index.ts +0 -108
  93. package/functions/state/index.ts +0 -199
  94. package/functions/store/index.ts +0 -108
  95. package/index.ts +0 -1
  96. package/init.ts +0 -12
  97. package/jest.config.mjs +0 -33
  98. package/jest.setup.js +0 -2
  99. package/tests/basic.test.ts +0 -50
  100. package/tests/cache.test.ts +0 -52
  101. package/tests/observer.test.ts +0 -62
  102. package/tests/setup.ts +0 -48
  103. package/tests/state.test.ts +0 -45
  104. package/tests/store.test.ts +0 -62
  105. package/tsconfig.json +0 -67
  106. /package/{.github/README.md → README.md} +0 -0
@@ -1,52 +0,0 @@
1
- import { describe, test, expect, beforeEach } from '@jest/globals'
2
- import '../config/global.js'
3
- import '../init'
4
-
5
- describe('Cache Tests', () => {
6
- beforeEach(() => {
7
- // Clear cache if possible
8
- try {
9
- cache.clear()
10
- } catch (e) {
11
- // Ignore if clear is not available
12
- }
13
- })
14
-
15
- test('should set and get cache values', () => {
16
- cache.test = 'value'
17
- expect(cache.test).toBe('value')
18
- })
19
-
20
- test('should handle object values', () => {
21
- const testObj = { key: 'value' }
22
- cache.testObj = testObj
23
- expect(cache.testObj).toEqual(testObj)
24
- })
25
-
26
- test('should handle array values', () => {
27
- const testArray = [1, 2, 3]
28
- cache.testArray = testArray
29
- expect(cache.testArray).toEqual(testArray)
30
- })
31
-
32
- test('should handle nested objects', () => {
33
- const nested = {
34
- level1: {
35
- level2: {
36
- data: 'test'
37
- }
38
- }
39
- }
40
- cache.nested = nested
41
- expect(cache.nested.level1.level2.data).toBe('test')
42
- })
43
-
44
- test('should handle persistence', () => {
45
- cache.persistent = 'persist'
46
- expect(cache.persistent).toBe('persist')
47
-
48
- // Test removal
49
- delete cache.persistent
50
- expect(cache.persistent).toBeUndefined()
51
- })
52
- })
@@ -1,62 +0,0 @@
1
- import { describe, test, expect, jest, beforeEach } from '@jest/globals'
2
- import '../config/global.js'
3
-
4
- // Initialize memorio object first
5
- if (!globalThis.memorio) {
6
- Object.defineProperty(globalThis, 'memorio', {
7
- value: {},
8
- writable: false,
9
- configurable: false,
10
- enumerable: false
11
- })
12
- }
13
-
14
- // Then import other modules
15
- import { buildProxy } from '../functions/state/index.js'
16
- import '../init'
17
-
18
- describe('Observer Tests', () => {
19
- beforeEach(() => {
20
- // Reset state for each test
21
- globalThis.state = buildProxy({}, () => { })
22
- })
23
-
24
- test('should observe state changes', async () => {
25
- const mockCallback = jest.fn()
26
- observer('state.test', mockCallback)
27
-
28
- state.test = 'value'
29
-
30
- // Observer events are async, so we need to wait
31
- await new Promise(resolve => setTimeout(resolve, 100))
32
- expect(mockCallback).toHaveBeenCalled()
33
- })
34
-
35
- test('should handle multiple observers', async () => {
36
- const mockCallback1 = jest.fn()
37
- const mockCallback2 = jest.fn()
38
-
39
- observer('state.test', mockCallback1)
40
- observer('state.test', mockCallback2)
41
-
42
- state.test = 'value'
43
-
44
- await new Promise(resolve => setTimeout(resolve, 100))
45
- expect(mockCallback1).toHaveBeenCalled()
46
- expect(mockCallback2).toHaveBeenCalled()
47
- })
48
-
49
- test('should observe nested state changes', async () => {
50
- const mockCallback = jest.fn()
51
-
52
- // Initialize nested state structure first
53
- state.nested = {}
54
- observer('state.nested.deep', mockCallback)
55
-
56
- // Then set the deep value
57
- state.nested.deep = 'value'
58
-
59
- await new Promise(resolve => setTimeout(resolve, 100))
60
- expect(mockCallback).toHaveBeenCalled()
61
- })
62
- })
package/tests/setup.ts DELETED
@@ -1,48 +0,0 @@
1
-
2
- import { jest } from '@jest/globals'
3
-
4
- // Mock localStorage and sessionStorage
5
- const localStorageMock = {
6
- getItem: jest.fn(),
7
- setItem: jest.fn(),
8
- removeItem: jest.fn(),
9
- clear: jest.fn(),
10
- length: 0,
11
- key: jest.fn()
12
- }
13
-
14
- const sessionStorageMock = {
15
- getItem: jest.fn(),
16
- setItem: jest.fn(),
17
- removeItem: jest.fn(),
18
- clear: jest.fn(),
19
- length: 0,
20
- key: jest.fn()
21
- }
22
-
23
- Object.defineProperty(globalThis, 'localStorage', { value: localStorageMock })
24
- Object.defineProperty(globalThis, 'sessionStorage', { value: sessionStorageMock })
25
-
26
- // Mock navigator.storage
27
- Object.defineProperty(globalThis, 'navigator', {
28
- value: {
29
- storage: {
30
- estimate: () => Promise.resolve({ usage: 0, quota: 1000000 })
31
- }
32
- }
33
- })
34
-
35
- // Initialize global objects
36
- globalThis.state = {}
37
- globalThis.store = {
38
- get: jest.fn(key => null),
39
- set: jest.fn((key, value) => true),
40
- remove: jest.fn(() => true),
41
- removeAll: jest.fn(() => true),
42
- delete: jest.fn(() => true),
43
- clearAll: jest.fn(() => true),
44
- quota: jest.fn(() => ({ usage: 0, quota: 1000000 })),
45
- size: jest.fn(() => 0)
46
- }
47
- globalThis.cache = {}
48
- globalThis.observer = jest.fn()
@@ -1,45 +0,0 @@
1
- import { describe, test, expect, beforeEach } from '@jest/globals'
2
- import '../config/global.js'
3
- import { buildProxy } from '../functions/state/index.js'
4
- import '../init'
5
-
6
- describe('State Management', () => {
7
- beforeEach(() => {
8
- // Reset state by creating a new proxy
9
- globalThis.state = buildProxy({}, () => { })
10
- })
11
-
12
- test('should set and get state value', () => {
13
- state.test = 'value'
14
- expect(state.test).toBe('value')
15
- })
16
-
17
- test('should list all states', () => {
18
- state.test1 = 'value1'
19
- state.test2 = 'value2'
20
- const list = state.list
21
- expect(list).toHaveProperty('test1')
22
- expect(list).toHaveProperty('test2')
23
- })
24
-
25
- test('should remove state', () => {
26
- state.test = 'value'
27
- state.remove('test')
28
- expect(state.test).toBeUndefined()
29
- })
30
-
31
- test('should remove all states', () => {
32
- state.test1 = 'value1'
33
- state.test2 = 'value2'
34
- state.removeAll()
35
- expect(state.list).toEqual({})
36
- })
37
-
38
- test('should lock object state', () => {
39
- state.test = { prop: 'value' }
40
- state.test.lock()
41
- expect(() => {
42
- state.test.newProp = 'value'
43
- }).toThrow()
44
- })
45
- })
@@ -1,62 +0,0 @@
1
- import { describe, test, expect, jest, beforeEach } from '@jest/globals'
2
- import '../config/global.js'
3
- import '../init'
4
-
5
- describe('Store Tests', () => {
6
- let mockStore = {}
7
-
8
- beforeEach(() => {
9
- mockStore = {}
10
- localStorage.clear()
11
- jest.spyOn(localStorage, 'getItem').mockImplementation(key => mockStore[key] || null)
12
- jest.spyOn(localStorage, 'setItem').mockImplementation((key, value) => {
13
- mockStore[key] = value
14
- })
15
- jest.spyOn(localStorage, 'removeItem').mockImplementation(key => {
16
- delete mockStore[key]
17
- })
18
- jest.spyOn(localStorage, 'clear').mockImplementation(() => {
19
- mockStore = {}
20
- })
21
- })
22
-
23
- test('should set and get store values', () => {
24
- const testValue = 'test value'
25
- store.set('test', testValue)
26
- expect(localStorage.setItem).toHaveBeenCalledWith('test', JSON.stringify(testValue))
27
- expect(store.get('test')).toBe(testValue)
28
- })
29
-
30
- test('should handle object values', () => {
31
- const testObj = { key: 'value' }
32
- store.set('test', testObj)
33
- expect(localStorage.setItem).toHaveBeenCalledWith('test', JSON.stringify(testObj))
34
- expect(store.get('test')).toEqual(testObj)
35
- })
36
-
37
- test('should remove store item', () => {
38
- store.set('test', 'value')
39
- store.remove('test')
40
- expect(localStorage.removeItem).toHaveBeenCalledWith('test')
41
- expect(store.get('test')).toBeNull()
42
- })
43
-
44
- test('should remove all store items', () => {
45
- store.set('test1', 'value1')
46
- store.set('test2', 'value2')
47
- store.removeAll()
48
- expect(localStorage.clear).toHaveBeenCalled()
49
- expect(store.get('test1')).toBeNull()
50
- expect(store.get('test2')).toBeNull()
51
- })
52
-
53
- test('should get store size', () => {
54
- mockStore = {}
55
- store.removeAll()
56
- store.set('test1', 'value1')
57
- store.set('test2', 'value2')
58
- const size = Object.keys(mockStore).length
59
- expect(typeof size).toBe('number')
60
- expect(size).toBe(2)
61
- })
62
- })
package/tsconfig.json DELETED
@@ -1,67 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "lib": [
4
- "es2022",
5
- "dom"
6
- ],
7
- "module": "NodeNext",
8
- "moduleResolution": "NodeNext",
9
- "types": [
10
- "node"
11
- ],
12
- "strict": true,
13
- "noEmit": false,
14
- "noImplicitThis": true,
15
- "noUnusedLocals": true,
16
- "importHelpers": true,
17
- "skipLibCheck": true,
18
- "allowSyntheticDefaultImports": true,
19
- "forceConsistentCasingInFileNames": true,
20
- "resolveJsonModule": true,
21
- "isolatedModules": true,
22
- "noImplicitAny": false,
23
- "preserveConstEnums": true,
24
- "removeComments": true,
25
- "sourceMap": false,
26
- "allowJs": true,
27
- "esModuleInterop": true,
28
- "strictNullChecks": false,
29
- "strictPropertyInitialization": false,
30
- "jsx": "react",
31
- "moduleDetection": "force",
32
- "baseUrl": ".",
33
- "outDir": "./dist/",
34
- "target": "es2022",
35
- "rootDirs": [
36
- "./"
37
- ],
38
- "paths": {
39
- "/*": [
40
- "./*"
41
- ]
42
- }
43
- },
44
- "include": [
45
- "index.d.ts",
46
- "./types/memorio.d.ts",
47
- "./**/*.ts",
48
- "./**/*.tsx"
49
- ],
50
- "types": [
51
- "node"
52
- ],
53
- "typeRoots": [
54
- "./types/*"
55
- ],
56
- "exclude": [
57
- "node_modules",
58
- "private",
59
- "archive",
60
- "*backup",
61
- "dist",
62
- ".old*",
63
- ".OLD*",
64
- "#OLD*",
65
- "@OLD*",
66
- ]
67
- }
File without changes