@builder.io/sdk-solid 0.0.4 → 0.0.5
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 +7 -2
- package/src/blocks/button.js +16 -25
- package/src/blocks/button.lite.tsx +8 -14
package/package.json
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@builder.io/sdk-solid",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"solid-js": "^1.3.15",
|
|
8
7
|
"solid-styled-components": "^0.27.6"
|
|
8
|
+
},
|
|
9
|
+
"peerDependencies": {
|
|
10
|
+
"solid-js": "^1.3.15"
|
|
11
|
+
},
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"solid-js": "^1.3.15"
|
|
9
14
|
}
|
|
10
15
|
}
|
package/src/blocks/button.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { template as _$template } from "solid-js/web";
|
|
2
|
-
import { createComponent as _$createComponent } from "solid-js/web";
|
|
3
2
|
import { setAttribute as _$setAttribute } from "solid-js/web";
|
|
4
3
|
import { effect as _$effect } from "solid-js/web";
|
|
5
4
|
import { insert as _$insert } from "solid-js/web";
|
|
@@ -7,35 +6,27 @@ import { spread as _$spread } from "solid-js/web";
|
|
|
7
6
|
|
|
8
7
|
const _tmpl$ = /*#__PURE__*/_$template(`<a role="button"></a>`, 2);
|
|
9
8
|
|
|
10
|
-
import { Show } from "solid-js";
|
|
11
9
|
export default function Button(props) {
|
|
12
|
-
return
|
|
13
|
-
|
|
14
|
-
return props.link;
|
|
15
|
-
},
|
|
10
|
+
return (() => {
|
|
11
|
+
const _el$ = _tmpl$.cloneNode(true);
|
|
16
12
|
|
|
17
|
-
|
|
18
|
-
const _el$ = _tmpl$.cloneNode(true);
|
|
13
|
+
_$spread(_el$, () => props.attributes, false, true);
|
|
19
14
|
|
|
20
|
-
|
|
15
|
+
_$insert(_el$, () => props.text);
|
|
21
16
|
|
|
22
|
-
|
|
17
|
+
_$effect(_p$ => {
|
|
18
|
+
const _v$ = props.link,
|
|
19
|
+
_v$2 = props.openLinkInNewTab ? "_blank" : undefined;
|
|
23
20
|
|
|
24
|
-
_$
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
_v$ !== _p$._v$ && _$setAttribute(_el$, "href", _p$._v$ = _v$);
|
|
22
|
+
_v$2 !== _p$._v$2 && _$setAttribute(_el$, "target", _p$._v$2 = _v$2);
|
|
23
|
+
return _p$;
|
|
24
|
+
}, {
|
|
25
|
+
_v$: undefined,
|
|
26
|
+
_v$2: undefined
|
|
27
|
+
});
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return _p$;
|
|
31
|
-
}, {
|
|
32
|
-
_v$: undefined,
|
|
33
|
-
_v$2: undefined
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
return _el$;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
});
|
|
29
|
+
return _el$;
|
|
30
|
+
})();
|
|
40
31
|
}import { registerComponent } from '../functions/register-component';
|
|
41
32
|
registerComponent(Button, {name:'Core:Button',builtIn:true,image:'https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F81a15681c3e74df09677dfc57a615b13',defaultStyles:{appearance:'none',paddingTop:'15px',paddingBottom:'15px',paddingLeft:'25px',paddingRight:'25px',backgroundColor:'#000000',color:'white',borderRadius:'4px',textAlign:'center',cursor:'pointer'},inputs:[{name:'text',type:'text',defaultValue:'Click me!',bubble:true},{name:'link',type:'url',bubble:true},{name:'openLinkInNewTab',type:'boolean',defaultValue:false,friendlyName:'Open link in new tab'}],static:true,noWrap:true});
|
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
import { Show } from "solid-js";
|
|
2
|
-
|
|
3
1
|
export default function Button(props) {
|
|
4
2
|
return (
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
{props.text}
|
|
14
|
-
</a>
|
|
15
|
-
</Show>
|
|
16
|
-
</>
|
|
3
|
+
<a
|
|
4
|
+
{...props.attributes}
|
|
5
|
+
role="button"
|
|
6
|
+
href={props.link}
|
|
7
|
+
target={props.openLinkInNewTab ? "_blank" : undefined}
|
|
8
|
+
>
|
|
9
|
+
{props.text}
|
|
10
|
+
</a>
|
|
17
11
|
);
|
|
18
12
|
}
|