anu-verzum 1.21.3 → 1.21.4

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/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  <h3>@author: <strong>Anubis-programmer</strong></h3>
6
6
  <h3>@license: <strong>MIT</strong></h3>
7
- <h3>@version: <strong>1.21.3</strong></h3>
7
+ <h3>@version: <strong>1.21.4</strong></h3>
8
8
 
9
9
  <br>
10
10
 
@@ -118,7 +118,7 @@ Create `tsconfig.json`:
118
118
  ```json
119
119
  {
120
120
  "compilerOptions": {
121
- "target": "ES2017",
121
+ "target": "ES2018",
122
122
  "module": "ESNext",
123
123
  "moduleResolution": "bundler",
124
124
  "jsx": "react",
@@ -141,6 +141,7 @@ Create `tsconfig.json`:
141
141
  | `noEmit` | `true` | Type checking only — Babel handles compilation |
142
142
  | `skipLibCheck` | `true` | Skips type checking inside `node_modules` |
143
143
  | `moduleResolution` | `"bundler"` | Correct setting for Webpack/Babel projects |
144
+ | `target` | `"ES2018"` | Because Babel handles compilation (`noEmit: true`), `target` only controls which TypeScript built-in type definitions are available — it does not affect emitted code. ES2018 is the minimum required to include `Promise.prototype.finally` on values returned by `Anu.ServerAPI` methods. |
144
145
 
145
146
  Compilation and type checking are intentionally separate — `npm start` and `npm run build` succeed regardless of type errors. Run `npx tsc --noEmit` during development to catch type issues without blocking the build.
146
147
 
@@ -5,7 +5,7 @@ export interface FeatureProviderProps extends Props {
5
5
  }
6
6
  export interface FeatureToggleProps extends Props {
7
7
  name: string;
8
- defaultComponent?: AnuElement | null;
8
+ defaultComponent?: AnuElement | AnuElement[] | null;
9
9
  }
10
10
  declare const Feature: {
11
11
  Provider: new (props: Props) => import("./Component").Component;
@@ -6,8 +6,15 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _elements = require("../elements");
8
8
  var _Context = require("./Context");
9
+ var _Fragment = require("./Fragment");
9
10
  const defaultFeatures = {};
10
11
  const FeaturesContext = (0, _Context.createContext)(defaultFeatures);
12
+ const resolveDefault = defaultComponent => {
13
+ if (defaultComponent && !Array.isArray(defaultComponent) && defaultComponent.type === _Fragment.Fragment) {
14
+ return defaultComponent.props.children ?? null;
15
+ }
16
+ return defaultComponent;
17
+ };
11
18
  const FeatureToggle = ({
12
19
  name,
13
20
  children,
@@ -16,7 +23,7 @@ const FeatureToggle = ({
16
23
  value: {
17
24
  features
18
25
  }
19
- }) => features && features[name] === true ? children : defaultComponent);
26
+ }) => features && features[name] === true ? children : resolveDefault(defaultComponent));
20
27
  const Feature = {
21
28
  Provider: FeaturesContext.ContextProvider,
22
29
  Toggle: FeatureToggle
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anu-verzum",
3
- "version": "1.21.3",
3
+ "version": "1.21.4",
4
4
  "description": "A \"React-like\" UI library that supports JSX syntax, Redux-like state management, array-rendering, i18n, routing and many more.",
5
5
  "keywords": [
6
6
  "anu-verzum",