@alwatr/render-state 5.5.32 → 6.0.0

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/main.js ADDED
@@ -0,0 +1,5 @@
1
+ /* 📦 @alwatr/render-state v6.0.0 */
2
+ import{createLogger as i}from"@alwatr/logger";var r=i("@alwatr/render-state"),u=(n,e,a=null)=>{r.logMethodArgs?.("renderState",{state:n,renderRecord:e});let t=e[n];if(typeof t==="string")t=e[t];if(t===void 0){if(e._default===void 0){r.error("renderState","invalid_render_state");return}if(typeof e._default==="string"){if(e[e._default]===void 0){r.error("renderState","invalid_default_render");return}return u(e._default,e,a)}t=e._default}if(typeof t!=="function"){r.error("renderState","invalid_render_state");return}try{return t.call(a)}catch(f){r.error("renderState","render_error",f);return}};export{u as renderState};
3
+
4
+ //# debugId=1EAE7C960CB429FF64756E2164756E21
5
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/main.ts"],
4
+ "sourcesContent": [
5
+ "import {createLogger} from '@alwatr/logger';\n\nimport type {} from '@alwatr/nano-build';\n\nconst logger = createLogger(__package_name__);\n\nexport const renderState = <R, T extends string>(\n state: T,\n renderRecord: Record<T | '_default', undefined | T | (() => R)>,\n thisArg: unknown = null,\n): R | undefined => {\n logger.logMethodArgs?.('renderState', {state, renderRecord});\n\n let render = renderRecord[state];\n\n if (typeof render === 'string') {\n render = renderRecord[render as T];\n }\n\n if (render === undefined) {\n if (renderRecord._default === undefined) {\n logger.error('renderState', 'invalid_render_state');\n return;\n }\n // else\n if (typeof renderRecord._default === 'string') {\n if (renderRecord[renderRecord._default] === undefined) {\n logger.error('renderState', 'invalid_default_render');\n return;\n }\n // else\n return renderState(renderRecord._default, renderRecord, thisArg);\n }\n // else\n render = renderRecord._default;\n }\n\n if (typeof render !== 'function') {\n logger.error('renderState', 'invalid_render_state');\n return;\n }\n\n try {\n return render.call(thisArg);\n }\n catch (err) {\n logger.error('renderState', 'render_error', err);\n return;\n }\n};\n"
6
+ ],
7
+ "mappings": ";AAAA,uBAAQ,uBAIR,IAAM,EAAS,EAAa,sBAAgB,EAE/B,EAAc,CACzB,EACA,EACA,EAAmB,OACD,CAClB,EAAO,gBAAgB,cAAe,CAAC,QAAO,cAAY,CAAC,EAE3D,IAAI,EAAS,EAAa,GAE1B,GAAI,OAAO,IAAW,SACpB,EAAS,EAAa,GAGxB,GAAI,IAAW,OAAW,CACxB,GAAI,EAAa,WAAa,OAAW,CACvC,EAAO,MAAM,cAAe,sBAAsB,EAClD,OAGF,GAAI,OAAO,EAAa,WAAa,SAAU,CAC7C,GAAI,EAAa,EAAa,YAAc,OAAW,CACrD,EAAO,MAAM,cAAe,wBAAwB,EACpD,OAGF,OAAO,EAAY,EAAa,SAAU,EAAc,CAAO,EAGjE,EAAS,EAAa,SAGxB,GAAI,OAAO,IAAW,WAAY,CAChC,EAAO,MAAM,cAAe,sBAAsB,EAClD,OAGF,GAAI,CACF,OAAO,EAAO,KAAK,CAAO,EAE5B,MAAO,EAAK,CACV,EAAO,MAAM,cAAe,eAAgB,CAAG,EAC/C",
8
+ "debugId": "1EAE7C960CB429FF64756E2164756E21",
9
+ "names": []
10
+ }
package/package.json CHANGED
@@ -1,27 +1,27 @@
1
1
  {
2
2
  "name": "@alwatr/render-state",
3
3
  "description": "Clone deeply nested objects and arrays in JavaScript.",
4
- "version": "5.5.32",
4
+ "version": "6.0.0",
5
5
  "author": "S. Ali Mihandoost <ali.mihandoost@gmail.com>",
6
6
  "bugs": "https://github.com/Alwatr/nanolib/issues",
7
7
  "dependencies": {
8
- "@alwatr/logger": "6.0.18"
8
+ "@alwatr/logger": "7.0.0"
9
9
  },
10
10
  "devDependencies": {
11
- "@alwatr/nano-build": "6.4.2",
12
- "@alwatr/prettier-config": "6.0.2",
13
- "@alwatr/tsconfig-base": "6.0.4",
11
+ "@alwatr/nano-build": "7.0.0",
12
+ "@alwatr/prettier-config": "7.0.0",
13
+ "@alwatr/tsconfig-base": "7.0.0",
14
14
  "typescript": "^5.9.3"
15
15
  },
16
16
  "exports": {
17
17
  ".": {
18
18
  "types": "./dist/main.d.ts",
19
- "import": "./dist/main.mjs",
20
- "require": "./dist/main.cjs"
19
+ "default": "./dist/main.js"
21
20
  }
22
21
  },
23
22
  "files": [
24
- "**/*.{js,mjs,cjs,map,d.ts,html,md,LEGAL.txt}",
23
+ "**/*.{js,mjs,cjs,ts,map,d.ts,html,LEGAL.txt}",
24
+ "README.md",
25
25
  "LICENSE",
26
26
  "!demo/**/*",
27
27
  "!**/*.test.js"
@@ -43,8 +43,6 @@
43
43
  "utils"
44
44
  ],
45
45
  "license": "MPL-2.0",
46
- "main": "./dist/main.cjs",
47
- "module": "./dist/main.mjs",
48
46
  "prettier": "@alwatr/prettier-config",
49
47
  "publishConfig": {
50
48
  "access": "public"
@@ -57,12 +55,12 @@
57
55
  "scripts": {
58
56
  "b": "bun run build",
59
57
  "build": "bun run build:ts && bun run build:es",
60
- "build:es": "nano-build --preset=module",
58
+ "build:es": "nano-build --preset=module src/main.ts",
61
59
  "build:ts": "tsc --build",
62
60
  "c": "bun run clean",
63
61
  "cb": "bun run clean && bun run build",
64
62
  "clean": "rm -rfv dist *.tsbuildinfo",
65
- "d": "bun run build:es && bun --enable-source-maps --trace-warnings",
63
+ "d": "bun run build:es && bun",
66
64
  "w": "bun run watch",
67
65
  "watch": "bun run watch:ts & bun run watch:es",
68
66
  "watch:es": "bun run build:es --watch",
@@ -71,5 +69,5 @@
71
69
  "sideEffects": false,
72
70
  "type": "module",
73
71
  "types": "./dist/main.d.ts",
74
- "gitHead": "c3889e3756b0a0f9b935a1b702a1373ac52cb379"
72
+ "gitHead": "056102a1c8a563bbae8a290b6830450f467322a3"
75
73
  }
package/src/main.ts ADDED
@@ -0,0 +1,50 @@
1
+ import {createLogger} from '@alwatr/logger';
2
+
3
+ import type {} from '@alwatr/nano-build';
4
+
5
+ const logger = createLogger(__package_name__);
6
+
7
+ export const renderState = <R, T extends string>(
8
+ state: T,
9
+ renderRecord: Record<T | '_default', undefined | T | (() => R)>,
10
+ thisArg: unknown = null,
11
+ ): R | undefined => {
12
+ logger.logMethodArgs?.('renderState', {state, renderRecord});
13
+
14
+ let render = renderRecord[state];
15
+
16
+ if (typeof render === 'string') {
17
+ render = renderRecord[render as T];
18
+ }
19
+
20
+ if (render === undefined) {
21
+ if (renderRecord._default === undefined) {
22
+ logger.error('renderState', 'invalid_render_state');
23
+ return;
24
+ }
25
+ // else
26
+ if (typeof renderRecord._default === 'string') {
27
+ if (renderRecord[renderRecord._default] === undefined) {
28
+ logger.error('renderState', 'invalid_default_render');
29
+ return;
30
+ }
31
+ // else
32
+ return renderState(renderRecord._default, renderRecord, thisArg);
33
+ }
34
+ // else
35
+ render = renderRecord._default;
36
+ }
37
+
38
+ if (typeof render !== 'function') {
39
+ logger.error('renderState', 'invalid_render_state');
40
+ return;
41
+ }
42
+
43
+ try {
44
+ return render.call(thisArg);
45
+ }
46
+ catch (err) {
47
+ logger.error('renderState', 'render_error', err);
48
+ return;
49
+ }
50
+ };
package/CHANGELOG.md DELETED
@@ -1,278 +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
- ## [5.5.32](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.31...@alwatr/render-state@5.5.32) (2026-03-16)
7
-
8
- ### 🔨 Code Refactoring
9
-
10
- * migrate build scripts from yarn to bun across multiple packages ([d90e962](https://github.com/Alwatr/nanolib/commit/d90e962f15e5c951e191d5f02341279b6472abc3))
11
-
12
- ## [5.5.31](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.30...@alwatr/render-state@5.5.31) (2026-02-18)
13
-
14
- **Note:** Version bump only for package @alwatr/render-state
15
-
16
- ## [5.5.30](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.29...@alwatr/render-state@5.5.30) (2025-12-23)
17
-
18
- **Note:** Version bump only for package @alwatr/render-state
19
-
20
- ## [5.5.29](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.28...@alwatr/render-state@5.5.29) (2025-12-13)
21
-
22
- **Note:** Version bump only for package @alwatr/render-state
23
-
24
- ## [5.5.28](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.27...@alwatr/render-state@5.5.28) (2025-12-10)
25
-
26
- **Note:** Version bump only for package @alwatr/render-state
27
-
28
- ## [5.5.27](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.26...@alwatr/render-state@5.5.27) (2025-11-18)
29
-
30
- ### 🐛 Bug Fixes
31
-
32
- * add type imports from @alwatr/nano-build and @alwatr/type-helper across multiple packages ([5ab7f15](https://github.com/Alwatr/nanolib/commit/5ab7f159ba57788bf8df40fa96a3027f589d5a77))
33
-
34
- ### 🔨 Code Refactoring
35
-
36
- * remove unnecessary type declarations from tsconfig.json files ([89bcc7d](https://github.com/Alwatr/nanolib/commit/89bcc7db839807110b80f8ba34414ea9734d9c75))
37
-
38
- ## [5.5.26](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.25...@alwatr/render-state@5.5.26) (2025-11-15)
39
-
40
- **Note:** Version bump only for package @alwatr/render-state
41
-
42
- ## [5.5.25](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.24...@alwatr/render-state@5.5.25) (2025-11-15)
43
-
44
- **Note:** Version bump only for package @alwatr/render-state
45
-
46
- ## [5.5.24](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.23...@alwatr/render-state@5.5.24) (2025-11-04)
47
-
48
- **Note:** Version bump only for package @alwatr/render-state
49
-
50
- ## [5.5.23](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.22...@alwatr/render-state@5.5.23) (2025-10-06)
51
-
52
- ### 🔗 Dependencies update
53
-
54
- * bump the npm-dependencies group with 4 updates ([9825815](https://github.com/Alwatr/nanolib/commit/982581552bbb4b97dca52af5e93a80937f0c3109))
55
-
56
- ## [5.5.22](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.21...@alwatr/render-state@5.5.22) (2025-09-27)
57
-
58
- ### 🧹 Miscellaneous Chores
59
-
60
- * exclude test files from package distribution ([86f4f2f](https://github.com/Alwatr/nanolib/commit/86f4f2f5985845c5cf3a3a9398de7b2f98ce53e7))
61
-
62
- ## [5.5.21](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.20...@alwatr/render-state@5.5.21) (2025-09-22)
63
-
64
- **Note:** Version bump only for package @alwatr/render-state
65
-
66
- ## [5.5.20](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.19...@alwatr/render-state@5.5.20) (2025-09-22)
67
-
68
- **Note:** Version bump only for package @alwatr/render-state
69
-
70
- ## [5.5.19](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.18...@alwatr/render-state@5.5.19) (2025-09-21)
71
-
72
- **Note:** Version bump only for package @alwatr/render-state
73
-
74
- ## [5.5.18](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.17...@alwatr/render-state@5.5.18) (2025-09-20)
75
-
76
- ### 🐛 Bug Fixes
77
-
78
- * add sideEffects property to package.json files for better tree-shaking ([c7b9e74](https://github.com/Alwatr/nanolib/commit/c7b9e74e1920c8e35b438742de61883ca62da58c))
79
- * add sideEffects property to package.json files for better tree-shaking ([e8402c4](https://github.com/Alwatr/nanolib/commit/e8402c481a14a1f807a37aaa862a936713d26176))
80
- * remove unnecessary pure annotations ([adeb916](https://github.com/Alwatr/nanolib/commit/adeb9166f8e911f59269032b76c36cb1888332cf))
81
-
82
- ### 🧹 Miscellaneous Chores
83
-
84
- * remove duplicate sideEffects property from multiple package.json files ([b123f86](https://github.com/Alwatr/nanolib/commit/b123f86be81481de2314aae9bb2eeb629743d24c))
85
-
86
- ## [5.5.17](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.16...@alwatr/render-state@5.5.17) (2025-09-19)
87
-
88
- **Note:** Version bump only for package @alwatr/render-state
89
-
90
- ## [5.5.16](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.15...@alwatr/render-state@5.5.16) (2025-09-19)
91
-
92
- **Note:** Version bump only for package @alwatr/render-state
93
-
94
- ## [5.5.15](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.14...@alwatr/render-state@5.5.15) (2025-09-15)
95
-
96
- **Note:** Version bump only for package @alwatr/render-state
97
-
98
- ## [5.5.14](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.13...@alwatr/render-state@5.5.14) (2025-09-14)
99
-
100
- **Note:** Version bump only for package @alwatr/render-state
101
-
102
- ## [5.5.13](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.12...@alwatr/render-state@5.5.13) (2025-09-13)
103
-
104
- **Note:** Version bump only for package @alwatr/render-state
105
-
106
- ## [5.5.12](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.11...@alwatr/render-state@5.5.12) (2025-09-13)
107
-
108
- ### 🧹 Miscellaneous Chores
109
-
110
- * remove package-tracer dependency and related code from fetch package ([96fe4e9](https://github.com/Alwatr/nanolib/commit/96fe4e9552a205f218ceed187c55e4e904a07089))
111
-
112
- ## [5.5.11](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.10...@alwatr/render-state@5.5.11) (2025-09-13)
113
-
114
- **Note:** Version bump only for package @alwatr/render-state
115
-
116
- ## [5.5.10](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.9...@alwatr/render-state@5.5.10) (2025-09-09)
117
-
118
- ### 🧹 Miscellaneous Chores
119
-
120
- * remove trailing newlines from contributing sections in README files ([e8ab1bc](https://github.com/Alwatr/nanolib/commit/e8ab1bc43e0addea5ccd4c897c2cec597cb9e15f))
121
-
122
- ## [5.5.9](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.8...@alwatr/render-state@5.5.9) (2025-09-06)
123
-
124
- **Note:** Version bump only for package @alwatr/render-state
125
-
126
- ## [5.5.8](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.7...@alwatr/render-state@5.5.8) (2025-09-05)
127
-
128
- **Note:** Version bump only for package @alwatr/render-state
129
-
130
- ## [5.5.7](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.6...@alwatr/render-state@5.5.7) (2025-09-01)
131
-
132
- **Note:** Version bump only for package @alwatr/render-state
133
-
134
- ## [5.5.6](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.5...@alwatr/render-state@5.5.6) (2025-08-23)
135
-
136
- **Note:** Version bump only for package @alwatr/render-state
137
-
138
- ## [5.5.5](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.3...@alwatr/render-state@5.5.5) (2025-08-23)
139
-
140
- ### 🐛 Bug Fixes
141
-
142
- * render-state folder name ([405d456](https://github.com/Alwatr/nanolib/commit/405d456ac6f29d3b86a4f54424bc1cf3cdd338c1))
143
-
144
- ## [5.5.4](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.3...@alwatr/render-state@5.5.4) (2025-08-23)
145
-
146
- ### Code Refactoring
147
-
148
- * Updated all package.json files in the project to change dependency version specifiers from "workspace:^" to "workspace:*" for consistency and to allow for more flexible version resolution. ([db6a4f7](https://github.com/Alwatr/nanolib/commit/db6a4f76deec2d1d8039978144e4bc51b6f1a0e3)) by @alimd
149
-
150
- ## <small>5.5.3 (2025-04-15)</small>
151
-
152
- **Note:** Version bump only for package @alwatr/render-state
153
-
154
- ## [5.5.2](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.1...@alwatr/render-state@5.5.2) (2025-04-01)
155
-
156
- **Note:** Version bump only for package @alwatr/render-state
157
-
158
- ## [5.5.1](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.0...@alwatr/render-state@5.5.1) (2025-03-18)
159
-
160
- **Note:** Version bump only for package @alwatr/render-state
161
-
162
- ## [5.5.0](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.4.0...@alwatr/render-state@5.5.0) (2025-03-06)
163
-
164
- ### Miscellaneous Chores
165
-
166
- * update username casing in changelog entries ([9722ac9](https://github.com/Alwatr/nanolib/commit/9722ac9a078438a4e8ebfa5826ea70e0e3a52ca6)) by @
167
-
168
- ### Dependencies update
169
-
170
- * bump the development-dependencies group across 1 directory with 11 updates ([720c395](https://github.com/Alwatr/nanolib/commit/720c3954da55c929fe8fb16957121f4c51fb7f0c)) by @dependabot[bot]
171
-
172
- ## [5.4.0](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@1.0.8...@alwatr/render-state@5.4.0) (2025-02-18)
173
-
174
- ## 5.3.0 (2025-02-03)
175
-
176
- ### Miscellaneous Chores
177
-
178
- * edit README ([3860b3d](https://github.com/Alwatr/nanolib/commit/3860b3df48ab82dc479d5236c2e8579df614aabf)) by @
179
-
180
- ### Dependencies update
181
-
182
- * bump the development-dependencies group across 1 directory with 11 updates ([cb79d07](https://github.com/Alwatr/nanolib/commit/cb79d072a57c79e1c01abff1a293d6757bb65350)) by @
183
- * update typescript and @types/node to version 5.7.3 and 22.13.0 respectively across multiple packages ([ddab05b](https://github.com/Alwatr/nanolib/commit/ddab05b5d767c30191f36a065e4bc88744e8e3fe)) by @
184
-
185
- ## 5.0.0 (2024-11-02)
186
-
187
- ### ⚠ BREAKING CHANGES
188
-
189
- * To simplify version management and ensure consistency, all nanolib packages now use the same version as @alwatr/nanolib. This may require updates to your project's dependencies.
190
-
191
- ### Code Refactoring
192
-
193
- * use the same version as @alwatr/nanolib ([60eb860](https://github.com/Alwatr/nanolib/commit/60eb860a0e33dfffe2d1d95e63ce54c60876be06)) by @
194
-
195
- ## [5.3.0](https://github.com/Alwatr/nanolib/compare/v5.2.1...v5.3.0) (2025-02-03)
196
-
197
- ### Miscellaneous Chores
198
-
199
- * edit README ([3860b3d](https://github.com/Alwatr/nanolib/commit/3860b3df48ab82dc479d5236c2e8579df614aabf)) by @ArmanAsadian
200
-
201
- ### Dependencies update
202
-
203
- * bump the development-dependencies group across 1 directory with 11 updates ([cb79d07](https://github.com/Alwatr/nanolib/commit/cb79d072a57c79e1c01abff1a293d6757bb65350)) by @dependabot[bot]
204
- * update typescript and @types/node to version 5.7.3 and 22.13.0 respectively across multiple packages ([ddab05b](https://github.com/Alwatr/nanolib/commit/ddab05b5d767c30191f36a065e4bc88744e8e3fe)) by @alimd
205
-
206
- ## 5.0.0 (2024-11-02)
207
-
208
- ### ⚠ BREAKING CHANGES
209
-
210
- * To simplify version management and ensure consistency, all nanolib packages now use the same version as @alwatr/nanolib. This may require updates to your project's dependencies.
211
-
212
- ### Features
213
-
214
- * **render-state:** add `render-state` package ([7f5b112](https://github.com/Alwatr/nanolib/commit/7f5b1122482a5df205cb4fee1113005310c9464f)) by @
215
-
216
- ### Code Refactoring
217
-
218
- * prevent side-effects ([01e00e1](https://github.com/Alwatr/nanolib/commit/01e00e191385cc92b28677df0c01a085916ae677)) by @
219
- * use the same version as @alwatr/nanolib ([60eb860](https://github.com/Alwatr/nanolib/commit/60eb860a0e33dfffe2d1d95e63ce54c60876be06)) by @
220
-
221
- ### Miscellaneous Chores
222
-
223
- * fix versions ([497a6d8](https://github.com/Alwatr/nanolib/commit/497a6d81ae5989e566e96d498fc5f1b6c80193ae)) by @
224
- * include LICENSE and LEGAL files to publish ([09f366f](https://github.com/Alwatr/nanolib/commit/09f366f680bfa9fb26acb2cd1ccbc68c5a9e9ad8)) by @
225
- * Remove change log file ([1955c9c](https://github.com/Alwatr/nanolib/commit/1955c9c20fc72df6c07e8e37a4bad48f1bd9125f)) by @
226
-
227
- ### Dependencies update
228
-
229
- * bump the development-dependencies group with 10 updates ([fa4aaf0](https://github.com/Alwatr/nanolib/commit/fa4aaf04c907ecae06aa14000ce35216170c15ad)) by @
230
-
231
- ## [1.0.8](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@1.0.7...@alwatr/render-state@1.0.8) (2024-11-02)
232
-
233
- **Note:** Version bump only for package @alwatr/render-state
234
-
235
- ## [1.0.7](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@1.0.6...@alwatr/render-state@1.0.7) (2024-10-25)
236
-
237
- **Note:** Version bump only for package @alwatr/render-state
238
-
239
- ## [1.0.6](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@1.0.5...@alwatr/render-state@1.0.6) (2024-10-12)
240
-
241
- **Note:** Version bump only for package @alwatr/render-state
242
-
243
- ## [1.0.5](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@1.0.4...@alwatr/render-state@1.0.5) (2024-10-11)
244
-
245
- ### Code Refactoring
246
-
247
- - prevent side-effects ([01e00e1](https://github.com/Alwatr/nanolib/commit/01e00e191385cc92b28677df0c01a085916ae677)) by @mohammadhonarvar
248
-
249
- ## [1.0.4](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@1.0.3...@alwatr/render-state@1.0.4) (2024-10-11)
250
-
251
- ### Miscellaneous Chores
252
-
253
- - include LICENSE and LEGAL files to publish ([09f366f](https://github.com/Alwatr/nanolib/commit/09f366f680bfa9fb26acb2cd1ccbc68c5a9e9ad8)) by @alimd
254
-
255
- ## [1.0.3](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@1.0.2...@alwatr/render-state@1.0.3) (2024-10-11)
256
-
257
- **Note:** Version bump only for package @alwatr/render-state
258
-
259
- ## [1.0.2](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@1.0.1...@alwatr/render-state@1.0.2) (2024-10-10)
260
-
261
- ### Dependencies update
262
-
263
- - bump the development-dependencies group with 10 updates ([fa4aaf0](https://github.com/Alwatr/nanolib/commit/fa4aaf04c907ecae06aa14000ce35216170c15ad)) by @dependabot[bot]
264
-
265
- ## [1.0.1](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@1.0.0...@alwatr/render-state@1.0.1) (2024-10-08)
266
-
267
- **Note:** Version bump only for package @alwatr/render-state
268
-
269
- ## 1.0.0 (2024-09-29)
270
-
271
- ### Features
272
-
273
- - **render-state:** add `render-state` package ([7f5b112](https://github.com/Alwatr/nanolib/commit/7f5b1122482a5df205cb4fee1113005310c9464f)) by @mohammadhonarvar
274
-
275
- ### Miscellaneous Chores
276
-
277
- - fix versions ([497a6d8](https://github.com/Alwatr/nanolib/commit/497a6d81ae5989e566e96d498fc5f1b6c80193ae)) by @alimd
278
- - Remove change log file ([1955c9c](https://github.com/Alwatr/nanolib/commit/1955c9c20fc72df6c07e8e37a4bad48f1bd9125f)) by @alimd
package/dist/main.cjs DELETED
@@ -1,3 +0,0 @@
1
- /** 📦 @alwatr/render-state v5.5.32 */
2
- "use strict";var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:true})};var __copyProps=(to,from,except,desc)=>{if(from&&typeof from==="object"||typeof from==="function"){for(let key of __getOwnPropNames(from))if(!__hasOwnProp.call(to,key)&&key!==except)__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable})}return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:true}),mod);var main_exports={};__export(main_exports,{renderState:()=>renderState});module.exports=__toCommonJS(main_exports);var import_logger=require("@alwatr/logger");var logger=(0,import_logger.createLogger)("@alwatr/render-state");var renderState=(state,renderRecord,thisArg=null)=>{logger.logMethodArgs?.("renderState",{state,renderRecord});let render=renderRecord[state];if(typeof render==="string"){render=renderRecord[render]}if(render===void 0){if(renderRecord._default===void 0){logger.error("renderState","invalid_render_state");return}if(typeof renderRecord._default==="string"){if(renderRecord[renderRecord._default]===void 0){logger.error("renderState","invalid_default_render");return}return renderState(renderRecord._default,renderRecord,thisArg)}render=renderRecord._default}if(typeof render!=="function"){logger.error("renderState","invalid_render_state");return}try{return render.call(thisArg)}catch(err){logger.error("renderState","render_error",err);return}};0&&(module.exports={renderState});
3
- //# sourceMappingURL=main.cjs.map
package/dist/main.cjs.map DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/main.ts"],
4
- "sourcesContent": ["import {createLogger} from '@alwatr/logger';\n\nimport type {} from '@alwatr/nano-build';\n\nconst logger = createLogger(__package_name__);\n\nexport const renderState = <R, T extends string>(\n state: T,\n renderRecord: Record<T | '_default', undefined | T | (() => R)>,\n thisArg: unknown = null,\n): R | undefined => {\n logger.logMethodArgs?.('renderState', {state, renderRecord});\n\n let render = renderRecord[state];\n\n if (typeof render === 'string') {\n render = renderRecord[render as T];\n }\n\n if (render === undefined) {\n if (renderRecord._default === undefined) {\n logger.error('renderState', 'invalid_render_state');\n return;\n }\n // else\n if (typeof renderRecord._default === 'string') {\n if (renderRecord[renderRecord._default] === undefined) {\n logger.error('renderState', 'invalid_default_render');\n return;\n }\n // else\n return renderState(renderRecord._default, renderRecord, thisArg);\n }\n // else\n render = renderRecord._default;\n }\n\n if (typeof render !== 'function') {\n logger.error('renderState', 'invalid_render_state');\n return;\n }\n\n try {\n return render.call(thisArg);\n }\n catch (err) {\n logger.error('renderState', 'render_error', err);\n return;\n }\n};\n"],
5
- "mappings": ";qqBAAA,qIAA2B,0BAI3B,IAAM,UAAS,4BAAa,sBAAgB,EAErC,IAAM,YAAc,CACzB,MACA,aACA,QAAmB,OACD,CAClB,OAAO,gBAAgB,cAAe,CAAC,MAAO,YAAY,CAAC,EAE3D,IAAI,OAAS,aAAa,KAAK,EAE/B,GAAI,OAAO,SAAW,SAAU,CAC9B,OAAS,aAAa,MAAW,CACnC,CAEA,GAAI,SAAW,OAAW,CACxB,GAAI,aAAa,WAAa,OAAW,CACvC,OAAO,MAAM,cAAe,sBAAsB,EAClD,MACF,CAEA,GAAI,OAAO,aAAa,WAAa,SAAU,CAC7C,GAAI,aAAa,aAAa,QAAQ,IAAM,OAAW,CACrD,OAAO,MAAM,cAAe,wBAAwB,EACpD,MACF,CAEA,OAAO,YAAY,aAAa,SAAU,aAAc,OAAO,CACjE,CAEA,OAAS,aAAa,QACxB,CAEA,GAAI,OAAO,SAAW,WAAY,CAChC,OAAO,MAAM,cAAe,sBAAsB,EAClD,MACF,CAEA,GAAI,CACF,OAAO,OAAO,KAAK,OAAO,CAC5B,OACO,IAAK,CACV,OAAO,MAAM,cAAe,eAAgB,GAAG,EAC/C,MACF,CACF",
6
- "names": []
7
- }
package/dist/main.mjs DELETED
@@ -1,3 +0,0 @@
1
- /** 📦 @alwatr/render-state v5.5.32 */
2
- import{createLogger}from"@alwatr/logger";var logger=createLogger("@alwatr/render-state");var renderState=(state,renderRecord,thisArg=null)=>{logger.logMethodArgs?.("renderState",{state,renderRecord});let render=renderRecord[state];if(typeof render==="string"){render=renderRecord[render]}if(render===void 0){if(renderRecord._default===void 0){logger.error("renderState","invalid_render_state");return}if(typeof renderRecord._default==="string"){if(renderRecord[renderRecord._default]===void 0){logger.error("renderState","invalid_default_render");return}return renderState(renderRecord._default,renderRecord,thisArg)}render=renderRecord._default}if(typeof render!=="function"){logger.error("renderState","invalid_render_state");return}try{return render.call(thisArg)}catch(err){logger.error("renderState","render_error",err);return}};export{renderState};
3
- //# sourceMappingURL=main.mjs.map
package/dist/main.mjs.map DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/main.ts"],
4
- "sourcesContent": ["import {createLogger} from '@alwatr/logger';\n\nimport type {} from '@alwatr/nano-build';\n\nconst logger = createLogger(__package_name__);\n\nexport const renderState = <R, T extends string>(\n state: T,\n renderRecord: Record<T | '_default', undefined | T | (() => R)>,\n thisArg: unknown = null,\n): R | undefined => {\n logger.logMethodArgs?.('renderState', {state, renderRecord});\n\n let render = renderRecord[state];\n\n if (typeof render === 'string') {\n render = renderRecord[render as T];\n }\n\n if (render === undefined) {\n if (renderRecord._default === undefined) {\n logger.error('renderState', 'invalid_render_state');\n return;\n }\n // else\n if (typeof renderRecord._default === 'string') {\n if (renderRecord[renderRecord._default] === undefined) {\n logger.error('renderState', 'invalid_default_render');\n return;\n }\n // else\n return renderState(renderRecord._default, renderRecord, thisArg);\n }\n // else\n render = renderRecord._default;\n }\n\n if (typeof render !== 'function') {\n logger.error('renderState', 'invalid_render_state');\n return;\n }\n\n try {\n return render.call(thisArg);\n }\n catch (err) {\n logger.error('renderState', 'render_error', err);\n return;\n }\n};\n"],
5
- "mappings": ";AAAA,OAAQ,iBAAmB,iBAI3B,IAAM,OAAS,aAAa,sBAAgB,EAErC,IAAM,YAAc,CACzB,MACA,aACA,QAAmB,OACD,CAClB,OAAO,gBAAgB,cAAe,CAAC,MAAO,YAAY,CAAC,EAE3D,IAAI,OAAS,aAAa,KAAK,EAE/B,GAAI,OAAO,SAAW,SAAU,CAC9B,OAAS,aAAa,MAAW,CACnC,CAEA,GAAI,SAAW,OAAW,CACxB,GAAI,aAAa,WAAa,OAAW,CACvC,OAAO,MAAM,cAAe,sBAAsB,EAClD,MACF,CAEA,GAAI,OAAO,aAAa,WAAa,SAAU,CAC7C,GAAI,aAAa,aAAa,QAAQ,IAAM,OAAW,CACrD,OAAO,MAAM,cAAe,wBAAwB,EACpD,MACF,CAEA,OAAO,YAAY,aAAa,SAAU,aAAc,OAAO,CACjE,CAEA,OAAS,aAAa,QACxB,CAEA,GAAI,OAAO,SAAW,WAAY,CAChC,OAAO,MAAM,cAAe,sBAAsB,EAClD,MACF,CAEA,GAAI,CACF,OAAO,OAAO,KAAK,OAAO,CAC5B,OACO,IAAK,CACV,OAAO,MAAM,cAAe,eAAgB,GAAG,EAC/C,MACF,CACF",
6
- "names": []
7
- }