anu-verzum 1.21.2 → 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.2</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 declare abstract class Component<P extends Record<string, any> = Props, S
5
5
  context: Record<string, any>;
6
6
  /** @internal Set by the reconciler. */
7
7
  __fiber?: any;
8
- static isAnuComponent?: boolean;
8
+ static isAnuComponent: boolean;
9
9
  constructor(props: P, context?: Record<string, any>);
10
10
  setState(partialState?: Partial<S> | ((prevState: S, prevProps: P) => S)): void;
11
11
  abstract render(): AnuElement | AnuElement[] | string | number | boolean | null | undefined;
@@ -8,6 +8,7 @@ var _reconciler = require("../reconciler");
8
8
  class Component {
9
9
  /** @internal Set by the reconciler. */
10
10
 
11
+ static isAnuComponent = true;
11
12
  constructor(props, context) {
12
13
  this.props = props || {};
13
14
  this.context = {
@@ -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
@@ -20,12 +20,7 @@ const getHTMLValidSvgTag = fiberType => {
20
20
  exports.getHTMLValidSvgTag = getHTMLValidSvgTag;
21
21
  const SVG_ELEMENT_LIST = exports.SVG_ELEMENT_LIST = ['anchor', 'animate', 'animateMotion', 'animateTransform', 'circle', 'clipPath', 'desc', 'discard', 'ellipse', 'feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feDropShadow', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence', 'filter', 'foreignObject', 'g', 'hatch', 'hatchpath', 'image', 'line', 'linearGradient', 'marker', 'mask', 'mesh', 'meshgradient', 'meshpatch', 'meshrow', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'set', 'stop', 'svgStyle', 'svg', 'switch', 'symbol', 'text', 'textPath', 'svgTitle', 'tspan', 'unknown', 'use', 'view'];
22
22
  const updateDomProperties = (dom, prevProps, nextProps, isSvgElement = false) => {
23
- const isEvent = name => {
24
- if (!String.prototype.startsWith) {
25
- return name[0] === 'o' && name[1] === 'n';
26
- }
27
- return name.startsWith('on');
28
- };
23
+ const isEvent = name => name.startsWith('on');
29
24
  const isAttribute = name => !isEvent(name) && name !== 'children' && name !== 'style';
30
25
  const isNew = (prev, next) => key => prev[key] !== next[key];
31
26
  const isGone = (prev, next) => key => !(key in next);
@@ -1,7 +1,4 @@
1
- import { AnuElement } from './elements';
2
- export type Ref<T> = {
3
- current: T | null;
4
- };
1
+ import { AnuElement, Ref } from './elements';
5
2
  export declare const createRef: <T = any>() => Ref<T>;
6
3
  export declare const scheduleUpdate: (instance: any, partialState: Record<string, any>, partialStateCallback?: (prevState: any, prevProps: any) => any) => void;
7
4
  export declare const render: (elements: AnuElement | AnuElement[], containerDom: Element) => void;
package/dist/index.d.ts CHANGED
@@ -29,7 +29,7 @@ declare const Anu: {
29
29
  };
30
30
  createContext: <T extends Record<string, any> = Record<string, any>>(context: T) => import("./core/components/Context").Context<T>;
31
31
  createElement: (type: import(".").ElementType, config: Props | null, ...args: any[]) => AnuElement;
32
- createRef: <T = any>() => import("./core/reconciler").Ref<T>;
32
+ createRef: <T = any>() => Ref<T>;
33
33
  Component: typeof Component;
34
34
  Fragment: typeof Fragment;
35
35
  render: (elements: AnuElement | AnuElement[], containerDom: Element) => void;
@@ -52,7 +52,7 @@ declare const Anu: {
52
52
  componentDidUpdate(_prevProps: import("./core/components/History").HistoryLinkProps, _prevState: Record<string, any>): void;
53
53
  componentWillUnmount(): void;
54
54
  };
55
- isAnuComponent?: boolean;
55
+ isAnuComponent: boolean;
56
56
  };
57
57
  Redirect: {
58
58
  new (props: import("./core/components/History").HistoryRedirectProps, context?: Record<string, any>): {
@@ -66,7 +66,7 @@ declare const Anu: {
66
66
  componentDidUpdate(_prevProps: import("./core/components/History").HistoryRedirectProps, _prevState: Record<string, any>): void;
67
67
  componentWillUnmount(): void;
68
68
  };
69
- isAnuComponent?: boolean;
69
+ isAnuComponent: boolean;
70
70
  };
71
71
  Route: {
72
72
  new (props: import("./core/components/History").HistoryRouteProps): {
@@ -81,7 +81,7 @@ declare const Anu: {
81
81
  setState(partialState?: Partial<Record<string, any>> | ((prevState: Record<string, any>, prevProps: import("./core/components/History").HistoryRouteProps) => Record<string, any>)): void;
82
82
  componentDidUpdate(_prevProps: import("./core/components/History").HistoryRouteProps, _prevState: Record<string, any>): void;
83
83
  };
84
- isAnuComponent?: boolean;
84
+ isAnuComponent: boolean;
85
85
  };
86
86
  getUrlParams: (key: string) => string | null;
87
87
  getAllUrlParamNames: () => string[];
@@ -112,7 +112,7 @@ declare const Anu: {
112
112
  componentDidUpdate(_prevProps: import("./core/components/Connector").ConnectorProviderProps, _prevState: Record<string, any>): void;
113
113
  componentWillUnmount(): void;
114
114
  };
115
- isAnuComponent?: boolean;
115
+ isAnuComponent: boolean;
116
116
  };
117
117
  };
118
118
  ServerAPI: {
@@ -139,7 +139,7 @@ declare const Anu: {
139
139
  deepEqual: (object1: Record<string, any>, object2: Record<string, any>) => boolean;
140
140
  };
141
141
  };
142
- export type { AnuElement, AnuChild, AnuNode, Props, Ref, FunctionComponent, ElementType } from './core/elements';
142
+ export type { AnuElement, AnuChild, AnuNode, AnuCSSProperties, Props, Ref, FunctionComponent, ElementType } from './core/elements';
143
143
  export type { ContextValue, ConsumerProps } from './core/components/Context';
144
144
  export type { Action, ThunkAction, Dispatch, Reducer, MiddlewareAPI, Middleware, Store, SelectorFn, CreateSelectorFn } from './store/store';
145
145
  export type { ApiSuccessResponse, ApiErrorResponse } from './server-api/server-api';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anu-verzum",
3
- "version": "1.21.2",
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",