lupine.components 1.0.15 → 1.0.16

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lupine.components",
3
- "version": "1.0.15",
3
+ "version": "1.0.16",
4
4
  "license": "MIT",
5
5
  "author": "uuware.com",
6
6
  "homepage": "https://github.com/uuware/lupine.js",
@@ -1,4 +1,4 @@
1
- import { RefProps, VNode, mountComponents, replaceInnerhtml } from 'lupine.web';
1
+ import { RefProps, VNode } from 'lupine.web';
2
2
 
3
3
  export type HtmlVarResult = { value: string | VNode<any>; ref: RefProps; node: VNode<any> };
4
4
  export const HtmlVar = (initial?: string | VNode<any>): HtmlVarResult => {
@@ -6,12 +6,7 @@ export const HtmlVar = (initial?: string | VNode<any>): HtmlVarResult => {
6
6
  let _dirty = false;
7
7
  const waitUpdate = async (value: string | VNode<any>) => {
8
8
  if (!ref.current) return;
9
- if (typeof value === 'object' && value.type && value.props) {
10
- await mountComponents(ref.current, value);
11
- } else {
12
- await replaceInnerhtml(ref.current, value as string);
13
- // ref.current.innerHTML = value;
14
- }
9
+ await ref.loadContent!(value);
15
10
  _dirty = false;
16
11
  };
17
12
  const ref: RefProps = {
@@ -19,10 +14,6 @@ export const HtmlVar = (initial?: string | VNode<any>): HtmlVarResult => {
19
14
  _dirty && waitUpdate(_value);
20
15
  },
21
16
  };
22
- const FragmentRef = (props: any) => {
23
- return <>{props.children}</>;
24
- };
25
-
26
17
  return {
27
18
  set value(value: string | VNode<any>) {
28
19
  _value = value;
@@ -35,10 +26,10 @@ export const HtmlVar = (initial?: string | VNode<any>): HtmlVarResult => {
35
26
  get ref() {
36
27
  return ref;
37
28
  },
38
- // _fragment_ref is a special id to add ref to a fragment and it is processed in mount-components
39
29
  get node() {
40
30
  _dirty = false;
41
- return <FragmentRef _fragment_ref={ref}>{_value}</FragmentRef>;
31
+ // the Fragment Tag will be present in the html if ref is assigned
32
+ return { type: 'Fragment', props: { ref, children: _value }, html: [] };
42
33
  },
43
34
  };
44
35
  };
@@ -35,7 +35,7 @@ export const Spinner02 = ({
35
35
  color?: string;
36
36
  }) => {
37
37
  const base = parseInt(size.replace('px', ''));
38
- const ballSize = Array.from({ length: 7 }, (_, i) => `${i * base / 15 / 7}px`);
38
+ const ballSize = Array.from({ length: 7 }, (_, i) => `${(i * base / 15 / 7).toFixed(2)}px`);
39
39
  const css: any = {
40
40
  width: size,
41
41
  height: size,