@viewfly/core 0.0.15 → 0.0.17

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.
@@ -5,5 +5,5 @@ export interface ObjectChanges {
5
5
  }
6
6
  export declare const refKey = "ref";
7
7
  export declare function getObjectChanges(newProps: Record<string, any>, oldProps: Record<string, any>): ObjectChanges;
8
- export declare function classToString(config: unknown): any;
8
+ export declare function classToString(config: unknown): string;
9
9
  export declare function styleToObject(style: string | Record<string, any>): Record<string, any>;
@@ -81,9 +81,14 @@ function classToString(config) {
81
81
  return config;
82
82
  }
83
83
  else if (Array.isArray(config)) {
84
- return config.map(i => {
85
- return classToString(i);
86
- }).join(' ');
84
+ const classes = [];
85
+ for (const i of config) {
86
+ const v = classToString(i);
87
+ if (v) {
88
+ classes.push(v);
89
+ }
90
+ }
91
+ return classes.join(' ');
87
92
  }
88
93
  else if (typeof config === 'object') {
89
94
  if (config.toString !== Object.prototype.toString && !config.toString.toString().includes('[native code]')) {
@@ -97,6 +102,7 @@ function classToString(config) {
97
102
  }
98
103
  return classes.join(' ');
99
104
  }
105
+ return '';
100
106
  }
101
107
  function styleToObject(style) {
102
108
  if (typeof style !== 'string') {
package/bundles/index.js CHANGED
@@ -82,9 +82,14 @@ function classToString(config) {
82
82
  return config;
83
83
  }
84
84
  else if (Array.isArray(config)) {
85
- return config.map(i => {
86
- return classToString(i);
87
- }).join(' ');
85
+ const classes = [];
86
+ for (const i of config) {
87
+ const v = classToString(i);
88
+ if (v) {
89
+ classes.push(v);
90
+ }
91
+ }
92
+ return classes.join(' ');
88
93
  }
89
94
  else if (typeof config === 'object') {
90
95
  if (config.toString !== Object.prototype.toString && !config.toString.toString().includes('[native code]')) {
@@ -98,6 +103,7 @@ function classToString(config) {
98
103
  }
99
104
  return classes.join(' ');
100
105
  }
106
+ return '';
101
107
  }
102
108
  function styleToObject(style) {
103
109
  if (typeof style !== 'string') {
@@ -1,6 +1,6 @@
1
1
  import { Key, ExtractInstanceType, Ref } from './_api';
2
2
  export declare namespace JSXInternal {
3
- type ClassNames = string | Record<string, unknown> | Array<string | Record<string, unknown>>;
3
+ type ClassNames = string | Record<string, unknown> | ClassNames[];
4
4
  interface ComponentInstance<P> {
5
5
  $render(): JSXChildNode;
6
6
  $shouldUpdate?(currentProps: P, prevProps: P): boolean;
@@ -16,7 +16,7 @@ export declare namespace JSXInternal {
16
16
  ref?: Ref<T, ExtractInstanceType<T>> | Ref<T, ExtractInstanceType<T>>[];
17
17
  }
18
18
  interface ElementClass<P = any> {
19
- (props: P): () => (JSXChildNode | ComponentInstance<P>);
19
+ (props?: P): () => (JSXChildNode | ComponentInstance<P>);
20
20
  }
21
21
  interface ElementChildrenAttribute {
22
22
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viewfly/core",
3
- "version": "0.0.15",
3
+ "version": "0.0.17",
4
4
  "description": "Viewfly is a simple and easy-to-use JavaScript framework with an intuitive development experience.",
5
5
  "main": "./bundles/index.js",
6
6
  "module": "./bundles/index.esm.js",
@@ -51,5 +51,5 @@
51
51
  "bugs": {
52
52
  "url": "https://github.com/viewfly/viewfly.git/issues"
53
53
  },
54
- "gitHead": "993944f270a1a0abd095bcda0d9080c4bfebc655"
54
+ "gitHead": "7a61edbca87f411d2ddbb390eb0b2e0416d80551"
55
55
  }