@fast-compose/compose-script 0.1.2 → 0.1.3
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.
|
Binary file
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
|
|
3
|
-
<img src="https://raw.githubusercontent.com/fast-compose/compose-script/v0.1.
|
|
3
|
+
<img src="https://raw.githubusercontent.com/fast-compose/compose-script/v0.1.3/docs/images/logo.png" width="160" alt="Compose Script logo">
|
|
4
4
|
|
|
5
5
|
# Compose Script
|
|
6
6
|
|
|
@@ -23,7 +23,7 @@ Add one script, write Compose in your HTML, and it renders in the page, powered
|
|
|
23
23
|
Add the library to your page:
|
|
24
24
|
|
|
25
25
|
```html
|
|
26
|
-
<script src="https://cdn.jsdelivr.net/npm/@fast-compose/compose-script@0.1.
|
|
26
|
+
<script src="https://cdn.jsdelivr.net/npm/@fast-compose/compose-script@0.1.3/compose-script.js"></script>
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
- Load `compose-script.js` with a plain `<script src>`, not `type="module"`: it loads its `.wasm` files from its own URL.
|
|
@@ -110,6 +110,18 @@ within it; content larger than a fixed size is cut off. The composable still set
|
|
|
110
110
|
|
|
111
111
|
Sizes from stylesheets or classes are not read; to size by class, put the script in an element with that class.
|
|
112
112
|
|
|
113
|
+
### Layout
|
|
114
|
+
|
|
115
|
+
The element sits in the text flow like an image (`display: inline-block`), so other elements can go beside it. For
|
|
116
|
+
its own line, add `display: block` to the script's `style`.
|
|
117
|
+
|
|
118
|
+
```html
|
|
119
|
+
<script type="text/compose-content">
|
|
120
|
+
Button(onClick = {}) { Text("Click me") }
|
|
121
|
+
</script>
|
|
122
|
+
<label>Beside the button</label>
|
|
123
|
+
```
|
|
124
|
+
|
|
113
125
|
## compose-preview
|
|
114
126
|
|
|
115
127
|
The code is a whole Kotlin file. Every `@Composable` function with `@Preview` is shown with its name, size, background,
|