@alwatr/render-state 5.5.31 → 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.31",
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.17"
8
+ "@alwatr/logger": "7.0.0"
9
9
  },
10
10
  "devDependencies": {
11
- "@alwatr/nano-build": "6.4.1",
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"
@@ -55,21 +53,21 @@
55
53
  "directory": "packages/render-state"
56
54
  },
57
55
  "scripts": {
58
- "b": "yarn run build",
59
- "build": "yarn run build:ts && yarn run build:es",
60
- "build:es": "nano-build --preset=module",
56
+ "b": "bun run build",
57
+ "build": "bun run build:ts && bun run build:es",
58
+ "build:es": "nano-build --preset=module src/main.ts",
61
59
  "build:ts": "tsc --build",
62
- "c": "yarn run clean",
63
- "cb": "yarn run clean && yarn run build",
60
+ "c": "bun run clean",
61
+ "cb": "bun run clean && bun run build",
64
62
  "clean": "rm -rfv dist *.tsbuildinfo",
65
- "d": "yarn run build:es && yarn node --enable-source-maps --trace-warnings",
66
- "w": "yarn run watch",
67
- "watch": "yarn run watch:ts & yarn run watch:es",
68
- "watch:es": "yarn run build:es --watch",
69
- "watch:ts": "yarn run build:ts --watch --preserveWatchOutput"
63
+ "d": "bun run build:es && bun",
64
+ "w": "bun run watch",
65
+ "watch": "bun run watch:ts & bun run watch:es",
66
+ "watch:es": "bun run build:es --watch",
67
+ "watch:ts": "bun run build:ts --watch --preserveWatchOutput"
70
68
  },
71
69
  "sideEffects": false,
72
70
  "type": "module",
73
71
  "types": "./dist/main.d.ts",
74
- "gitHead": "f9f9ba54b319ce8ccc6968059b222e89f4b5d149"
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,272 +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.31](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.30...@alwatr/render-state@5.5.31) (2026-02-18)
7
-
8
- **Note:** Version bump only for package @alwatr/render-state
9
-
10
- ## [5.5.30](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.29...@alwatr/render-state@5.5.30) (2025-12-23)
11
-
12
- **Note:** Version bump only for package @alwatr/render-state
13
-
14
- ## [5.5.29](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.28...@alwatr/render-state@5.5.29) (2025-12-13)
15
-
16
- **Note:** Version bump only for package @alwatr/render-state
17
-
18
- ## [5.5.28](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.27...@alwatr/render-state@5.5.28) (2025-12-10)
19
-
20
- **Note:** Version bump only for package @alwatr/render-state
21
-
22
- ## [5.5.27](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.26...@alwatr/render-state@5.5.27) (2025-11-18)
23
-
24
- ### 🐛 Bug Fixes
25
-
26
- * add type imports from @alwatr/nano-build and @alwatr/type-helper across multiple packages ([5ab7f15](https://github.com/Alwatr/nanolib/commit/5ab7f159ba57788bf8df40fa96a3027f589d5a77))
27
-
28
- ### 🔨 Code Refactoring
29
-
30
- * remove unnecessary type declarations from tsconfig.json files ([89bcc7d](https://github.com/Alwatr/nanolib/commit/89bcc7db839807110b80f8ba34414ea9734d9c75))
31
-
32
- ## [5.5.26](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.25...@alwatr/render-state@5.5.26) (2025-11-15)
33
-
34
- **Note:** Version bump only for package @alwatr/render-state
35
-
36
- ## [5.5.25](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.24...@alwatr/render-state@5.5.25) (2025-11-15)
37
-
38
- **Note:** Version bump only for package @alwatr/render-state
39
-
40
- ## [5.5.24](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.23...@alwatr/render-state@5.5.24) (2025-11-04)
41
-
42
- **Note:** Version bump only for package @alwatr/render-state
43
-
44
- ## [5.5.23](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.22...@alwatr/render-state@5.5.23) (2025-10-06)
45
-
46
- ### 🔗 Dependencies update
47
-
48
- * bump the npm-dependencies group with 4 updates ([9825815](https://github.com/Alwatr/nanolib/commit/982581552bbb4b97dca52af5e93a80937f0c3109))
49
-
50
- ## [5.5.22](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.21...@alwatr/render-state@5.5.22) (2025-09-27)
51
-
52
- ### 🧹 Miscellaneous Chores
53
-
54
- * exclude test files from package distribution ([86f4f2f](https://github.com/Alwatr/nanolib/commit/86f4f2f5985845c5cf3a3a9398de7b2f98ce53e7))
55
-
56
- ## [5.5.21](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.20...@alwatr/render-state@5.5.21) (2025-09-22)
57
-
58
- **Note:** Version bump only for package @alwatr/render-state
59
-
60
- ## [5.5.20](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.19...@alwatr/render-state@5.5.20) (2025-09-22)
61
-
62
- **Note:** Version bump only for package @alwatr/render-state
63
-
64
- ## [5.5.19](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.18...@alwatr/render-state@5.5.19) (2025-09-21)
65
-
66
- **Note:** Version bump only for package @alwatr/render-state
67
-
68
- ## [5.5.18](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.17...@alwatr/render-state@5.5.18) (2025-09-20)
69
-
70
- ### 🐛 Bug Fixes
71
-
72
- * add sideEffects property to package.json files for better tree-shaking ([c7b9e74](https://github.com/Alwatr/nanolib/commit/c7b9e74e1920c8e35b438742de61883ca62da58c))
73
- * add sideEffects property to package.json files for better tree-shaking ([e8402c4](https://github.com/Alwatr/nanolib/commit/e8402c481a14a1f807a37aaa862a936713d26176))
74
- * remove unnecessary pure annotations ([adeb916](https://github.com/Alwatr/nanolib/commit/adeb9166f8e911f59269032b76c36cb1888332cf))
75
-
76
- ### 🧹 Miscellaneous Chores
77
-
78
- * remove duplicate sideEffects property from multiple package.json files ([b123f86](https://github.com/Alwatr/nanolib/commit/b123f86be81481de2314aae9bb2eeb629743d24c))
79
-
80
- ## [5.5.17](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.16...@alwatr/render-state@5.5.17) (2025-09-19)
81
-
82
- **Note:** Version bump only for package @alwatr/render-state
83
-
84
- ## [5.5.16](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.15...@alwatr/render-state@5.5.16) (2025-09-19)
85
-
86
- **Note:** Version bump only for package @alwatr/render-state
87
-
88
- ## [5.5.15](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.14...@alwatr/render-state@5.5.15) (2025-09-15)
89
-
90
- **Note:** Version bump only for package @alwatr/render-state
91
-
92
- ## [5.5.14](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.13...@alwatr/render-state@5.5.14) (2025-09-14)
93
-
94
- **Note:** Version bump only for package @alwatr/render-state
95
-
96
- ## [5.5.13](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.12...@alwatr/render-state@5.5.13) (2025-09-13)
97
-
98
- **Note:** Version bump only for package @alwatr/render-state
99
-
100
- ## [5.5.12](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.11...@alwatr/render-state@5.5.12) (2025-09-13)
101
-
102
- ### 🧹 Miscellaneous Chores
103
-
104
- * remove package-tracer dependency and related code from fetch package ([96fe4e9](https://github.com/Alwatr/nanolib/commit/96fe4e9552a205f218ceed187c55e4e904a07089))
105
-
106
- ## [5.5.11](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.10...@alwatr/render-state@5.5.11) (2025-09-13)
107
-
108
- **Note:** Version bump only for package @alwatr/render-state
109
-
110
- ## [5.5.10](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.9...@alwatr/render-state@5.5.10) (2025-09-09)
111
-
112
- ### 🧹 Miscellaneous Chores
113
-
114
- * remove trailing newlines from contributing sections in README files ([e8ab1bc](https://github.com/Alwatr/nanolib/commit/e8ab1bc43e0addea5ccd4c897c2cec597cb9e15f))
115
-
116
- ## [5.5.9](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.8...@alwatr/render-state@5.5.9) (2025-09-06)
117
-
118
- **Note:** Version bump only for package @alwatr/render-state
119
-
120
- ## [5.5.8](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.7...@alwatr/render-state@5.5.8) (2025-09-05)
121
-
122
- **Note:** Version bump only for package @alwatr/render-state
123
-
124
- ## [5.5.7](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.6...@alwatr/render-state@5.5.7) (2025-09-01)
125
-
126
- **Note:** Version bump only for package @alwatr/render-state
127
-
128
- ## [5.5.6](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.5...@alwatr/render-state@5.5.6) (2025-08-23)
129
-
130
- **Note:** Version bump only for package @alwatr/render-state
131
-
132
- ## [5.5.5](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.3...@alwatr/render-state@5.5.5) (2025-08-23)
133
-
134
- ### 🐛 Bug Fixes
135
-
136
- * render-state folder name ([405d456](https://github.com/Alwatr/nanolib/commit/405d456ac6f29d3b86a4f54424bc1cf3cdd338c1))
137
-
138
- ## [5.5.4](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.3...@alwatr/render-state@5.5.4) (2025-08-23)
139
-
140
- ### Code Refactoring
141
-
142
- * 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
143
-
144
- ## <small>5.5.3 (2025-04-15)</small>
145
-
146
- **Note:** Version bump only for package @alwatr/render-state
147
-
148
- ## [5.5.2](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.1...@alwatr/render-state@5.5.2) (2025-04-01)
149
-
150
- **Note:** Version bump only for package @alwatr/render-state
151
-
152
- ## [5.5.1](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.5.0...@alwatr/render-state@5.5.1) (2025-03-18)
153
-
154
- **Note:** Version bump only for package @alwatr/render-state
155
-
156
- ## [5.5.0](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@5.4.0...@alwatr/render-state@5.5.0) (2025-03-06)
157
-
158
- ### Miscellaneous Chores
159
-
160
- * update username casing in changelog entries ([9722ac9](https://github.com/Alwatr/nanolib/commit/9722ac9a078438a4e8ebfa5826ea70e0e3a52ca6)) by @
161
-
162
- ### Dependencies update
163
-
164
- * bump the development-dependencies group across 1 directory with 11 updates ([720c395](https://github.com/Alwatr/nanolib/commit/720c3954da55c929fe8fb16957121f4c51fb7f0c)) by @dependabot[bot]
165
-
166
- ## [5.4.0](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@1.0.8...@alwatr/render-state@5.4.0) (2025-02-18)
167
-
168
- ## 5.3.0 (2025-02-03)
169
-
170
- ### Miscellaneous Chores
171
-
172
- * edit README ([3860b3d](https://github.com/Alwatr/nanolib/commit/3860b3df48ab82dc479d5236c2e8579df614aabf)) by @
173
-
174
- ### Dependencies update
175
-
176
- * bump the development-dependencies group across 1 directory with 11 updates ([cb79d07](https://github.com/Alwatr/nanolib/commit/cb79d072a57c79e1c01abff1a293d6757bb65350)) by @
177
- * 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 @
178
-
179
- ## 5.0.0 (2024-11-02)
180
-
181
- ### ⚠ BREAKING CHANGES
182
-
183
- * 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.
184
-
185
- ### Code Refactoring
186
-
187
- * use the same version as @alwatr/nanolib ([60eb860](https://github.com/Alwatr/nanolib/commit/60eb860a0e33dfffe2d1d95e63ce54c60876be06)) by @
188
-
189
- ## [5.3.0](https://github.com/Alwatr/nanolib/compare/v5.2.1...v5.3.0) (2025-02-03)
190
-
191
- ### Miscellaneous Chores
192
-
193
- * edit README ([3860b3d](https://github.com/Alwatr/nanolib/commit/3860b3df48ab82dc479d5236c2e8579df614aabf)) by @ArmanAsadian
194
-
195
- ### Dependencies update
196
-
197
- * bump the development-dependencies group across 1 directory with 11 updates ([cb79d07](https://github.com/Alwatr/nanolib/commit/cb79d072a57c79e1c01abff1a293d6757bb65350)) by @dependabot[bot]
198
- * 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
199
-
200
- ## 5.0.0 (2024-11-02)
201
-
202
- ### ⚠ BREAKING CHANGES
203
-
204
- * 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.
205
-
206
- ### Features
207
-
208
- * **render-state:** add `render-state` package ([7f5b112](https://github.com/Alwatr/nanolib/commit/7f5b1122482a5df205cb4fee1113005310c9464f)) by @
209
-
210
- ### Code Refactoring
211
-
212
- * prevent side-effects ([01e00e1](https://github.com/Alwatr/nanolib/commit/01e00e191385cc92b28677df0c01a085916ae677)) by @
213
- * use the same version as @alwatr/nanolib ([60eb860](https://github.com/Alwatr/nanolib/commit/60eb860a0e33dfffe2d1d95e63ce54c60876be06)) by @
214
-
215
- ### Miscellaneous Chores
216
-
217
- * fix versions ([497a6d8](https://github.com/Alwatr/nanolib/commit/497a6d81ae5989e566e96d498fc5f1b6c80193ae)) by @
218
- * include LICENSE and LEGAL files to publish ([09f366f](https://github.com/Alwatr/nanolib/commit/09f366f680bfa9fb26acb2cd1ccbc68c5a9e9ad8)) by @
219
- * Remove change log file ([1955c9c](https://github.com/Alwatr/nanolib/commit/1955c9c20fc72df6c07e8e37a4bad48f1bd9125f)) by @
220
-
221
- ### Dependencies update
222
-
223
- * bump the development-dependencies group with 10 updates ([fa4aaf0](https://github.com/Alwatr/nanolib/commit/fa4aaf04c907ecae06aa14000ce35216170c15ad)) by @
224
-
225
- ## [1.0.8](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@1.0.7...@alwatr/render-state@1.0.8) (2024-11-02)
226
-
227
- **Note:** Version bump only for package @alwatr/render-state
228
-
229
- ## [1.0.7](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@1.0.6...@alwatr/render-state@1.0.7) (2024-10-25)
230
-
231
- **Note:** Version bump only for package @alwatr/render-state
232
-
233
- ## [1.0.6](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@1.0.5...@alwatr/render-state@1.0.6) (2024-10-12)
234
-
235
- **Note:** Version bump only for package @alwatr/render-state
236
-
237
- ## [1.0.5](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@1.0.4...@alwatr/render-state@1.0.5) (2024-10-11)
238
-
239
- ### Code Refactoring
240
-
241
- - prevent side-effects ([01e00e1](https://github.com/Alwatr/nanolib/commit/01e00e191385cc92b28677df0c01a085916ae677)) by @mohammadhonarvar
242
-
243
- ## [1.0.4](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@1.0.3...@alwatr/render-state@1.0.4) (2024-10-11)
244
-
245
- ### Miscellaneous Chores
246
-
247
- - include LICENSE and LEGAL files to publish ([09f366f](https://github.com/Alwatr/nanolib/commit/09f366f680bfa9fb26acb2cd1ccbc68c5a9e9ad8)) by @alimd
248
-
249
- ## [1.0.3](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@1.0.2...@alwatr/render-state@1.0.3) (2024-10-11)
250
-
251
- **Note:** Version bump only for package @alwatr/render-state
252
-
253
- ## [1.0.2](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@1.0.1...@alwatr/render-state@1.0.2) (2024-10-10)
254
-
255
- ### Dependencies update
256
-
257
- - bump the development-dependencies group with 10 updates ([fa4aaf0](https://github.com/Alwatr/nanolib/commit/fa4aaf04c907ecae06aa14000ce35216170c15ad)) by @dependabot[bot]
258
-
259
- ## [1.0.1](https://github.com/Alwatr/nanolib/compare/@alwatr/render-state@1.0.0...@alwatr/render-state@1.0.1) (2024-10-08)
260
-
261
- **Note:** Version bump only for package @alwatr/render-state
262
-
263
- ## 1.0.0 (2024-09-29)
264
-
265
- ### Features
266
-
267
- - **render-state:** add `render-state` package ([7f5b112](https://github.com/Alwatr/nanolib/commit/7f5b1122482a5df205cb4fee1113005310c9464f)) by @mohammadhonarvar
268
-
269
- ### Miscellaneous Chores
270
-
271
- - fix versions ([497a6d8](https://github.com/Alwatr/nanolib/commit/497a6d81ae5989e566e96d498fc5f1b6c80193ae)) by @alimd
272
- - Remove change log file ([1955c9c](https://github.com/Alwatr/nanolib/commit/1955c9c20fc72df6c07e8e37a4bad48f1bd9125f)) by @alimd
package/dist/main.cjs DELETED
@@ -1,4 +0,0 @@
1
- /** 📦 @alwatr/render-state v5.5.31 */
2
- __dev_mode__: console.debug("📦 @alwatr/render-state v5.5.31");
3
- "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});
4
- //# 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,4 +0,0 @@
1
- /** 📦 @alwatr/render-state v5.5.31 */
2
- __dev_mode__: console.debug("📦 @alwatr/render-state v5.5.31");
3
- 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};
4
- //# 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
- }