lilact 0.3.0 → 0.4.0
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 +1 -1
- package/dist/lilact.development.min.js +1 -1
- package/dist/lilact.development.min.js.map +1 -1
- package/dist/lilact.production.min.js +1 -1
- package/dist/lilact.production.min.js.map +1 -1
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/accessories.ErrorBoundary.html +8 -8
- package/docs/classes/accessories.Suspense.html +7 -7
- package/docs/classes/components.Component.html +10 -10
- package/docs/classes/components.HTMLComponent.html +10 -10
- package/docs/classes/components.RootComponent.html +10 -10
- package/docs/functions/components.createComponent.html +1 -1
- package/docs/functions/components.createRoot.html +1 -1
- package/docs/functions/components.render.html +1 -1
- package/docs/functions/misc.toBool.html +3 -0
- package/docs/index.html +2 -2
- package/docs/modules/misc.html +1 -1
- package/docs/static/demos/form-elements.jsx +110 -0
- package/docs/static/index.html +2 -1
- package/docs/static/lilact.development.min.js +1 -1
- package/docs/static/lilact.production.min.js +1 -1
- package/package.json +2 -2
- package/root/demos/form-elements.jsx +110 -0
- package/root/index.html +2 -1
- package/root/lilact.development.min.js +1 -1
- package/root/lilact.production.min.js +1 -1
- package/src/components.jsx +27 -10
- package/src/jsx.js +5 -1
- package/src/lilact.jsx +1 -1
- package/src/misc.jsx +42 -14
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
module.exports = function() {
|
|
2
|
+
|
|
3
|
+
return <>
|
|
4
|
+
|
|
5
|
+
<p>Boolean attributes: literal JSX -> Lilact correct; pasted-as-HTML examples below intentionally look wrong</p>
|
|
6
|
+
<div style={{ fontFamily: "sans-serif" }}>
|
|
7
|
+
<h3>Boolean: disabled={false} (should NOT render disabled)</h3>
|
|
8
|
+
<input disabled={false} />
|
|
9
|
+
|
|
10
|
+
<h3>Boolean: disabled (presence) (should render disabled)</h3>
|
|
11
|
+
<input disabled />
|
|
12
|
+
|
|
13
|
+
<h3>Boolean: readOnly={false} (should NOT be readonly)</h3>
|
|
14
|
+
<input readOnly={false} defaultValue="Try editing (should be editable)" />
|
|
15
|
+
|
|
16
|
+
<h3>Boolean: readOnly (presence) (should be readonly)</h3>
|
|
17
|
+
<input readOnly defaultValue="Readonly (pasted HTML demo should be wrong)" />
|
|
18
|
+
|
|
19
|
+
<h3>Boolean: required={false} (should NOT be required)</h3>
|
|
20
|
+
<input required={false} placeholder="Not required" />
|
|
21
|
+
|
|
22
|
+
<h3>Boolean: required (presence) (should be required)</h3>
|
|
23
|
+
<input required placeholder="Required" />
|
|
24
|
+
|
|
25
|
+
<h3>Boolean: checked={false} (checkbox should be unchecked)</h3>
|
|
26
|
+
<input type="checkbox" checked={false} onChange={() => {}} />
|
|
27
|
+
|
|
28
|
+
<h3>Boolean: checked={true} (checkbox should be checked)</h3>
|
|
29
|
+
<input type="checkbox" checked={true} onChange={() => {}} />
|
|
30
|
+
|
|
31
|
+
<h3>Boolean: multiple={false} (select should NOT allow multiple)</h3>
|
|
32
|
+
<select multiple={false}>
|
|
33
|
+
<option>A</option>
|
|
34
|
+
<option>B</option>
|
|
35
|
+
</select>
|
|
36
|
+
|
|
37
|
+
<h3>Boolean: multiple (presence) (select should allow multiple)</h3>
|
|
38
|
+
<select multiple>
|
|
39
|
+
<option>A</option>
|
|
40
|
+
<option>B</option>
|
|
41
|
+
</select>
|
|
42
|
+
|
|
43
|
+
<h3>Boolean: autoFocus={false} (should NOT steal focus)</h3>
|
|
44
|
+
<input autoFocus={false} defaultValue="No autofocus (Lilact)" />
|
|
45
|
+
|
|
46
|
+
<h3>Boolean: autoFocus (presence) (should autofocus)</h3>
|
|
47
|
+
<input autoFocus defaultValue="Autofocus (Lilact)" />
|
|
48
|
+
|
|
49
|
+
<hr />
|
|
50
|
+
|
|
51
|
+
<h3>Select: value="b" (Lilact selects option b)</h3>
|
|
52
|
+
<select value="b" onChange={() => {}}>
|
|
53
|
+
<option value="a">A</option>
|
|
54
|
+
<option value="b">B</option>
|
|
55
|
+
<option value="c">C</option>
|
|
56
|
+
</select>
|
|
57
|
+
|
|
58
|
+
<hr />
|
|
59
|
+
|
|
60
|
+
{/* Uncontrolled components: defaultValue/defaultChecked (Lilact sets initial, then DOM updates) */}
|
|
61
|
+
<h3>Uncontrolled input: defaultValue (initial value, then user can edit)</h3>
|
|
62
|
+
<input defaultValue="Uncontrolled after mount" />
|
|
63
|
+
|
|
64
|
+
<h3>Uncontrolled checkbox: defaultChecked (initially checked, then user toggles)</h3>
|
|
65
|
+
<input type="checkbox" defaultChecked />
|
|
66
|
+
|
|
67
|
+
<hr />
|
|
68
|
+
|
|
69
|
+
{/* checked vs value pitfall */}
|
|
70
|
+
<h3>Checkbox using value attribute (NOT the checked state in Lilact)</h3>
|
|
71
|
+
<input type="checkbox" value="on" onChange={() => {}} />
|
|
72
|
+
|
|
73
|
+
<h3>Checkbox using checked prop (checked state in Lilact)</h3>
|
|
74
|
+
<input type="checkbox" checked onChange={() => {}} />
|
|
75
|
+
|
|
76
|
+
<hr />
|
|
77
|
+
|
|
78
|
+
{/* JSX camelCase: works in Lilact; if pasted literally into HTML it’s “visibly wrong” because HTML won’t interpret JSX props */}
|
|
79
|
+
<h3>JSX attribute casing: className="..." (Lilact applies class; pasted HTML uses className literally)</h3>
|
|
80
|
+
<div className="demo" style={{ padding: 8, border: "1px solid #888" }}>
|
|
81
|
+
className target
|
|
82
|
+
</div>
|
|
83
|
+
|
|
84
|
+
<h3>HTML uses class; Lilact uses className (pasted HTML would ignore className)</h3>
|
|
85
|
+
<div class="demo" style={{ padding: 8, border: "1px solid #888" }}>
|
|
86
|
+
(This one uses class, so pasted HTML is correct.)
|
|
87
|
+
</div>
|
|
88
|
+
|
|
89
|
+
<h3>JSX attribute casing: htmlFor="x" (Lilact links label; pasted HTML uses htmlFor literally)</h3>
|
|
90
|
+
<label htmlFor="x_Lilact">Click label (Lilact should focus input)</label>
|
|
91
|
+
<input id="x_Lilact" type="text" placeholder="Focus target" />
|
|
92
|
+
|
|
93
|
+
<h3>Corresponding plain HTML: for="x" (works in both)</h3>
|
|
94
|
+
<label htmlFor="y_html">Click label (HTML should focus input)</label>
|
|
95
|
+
<input id="y_html" type="text" placeholder="Focus target" />
|
|
96
|
+
|
|
97
|
+
<h3>JSX: tabIndex={2} (Lilact sets focus order; pasted HTML won’t)</h3>
|
|
98
|
+
<input tabIndex={2} defaultValue="tabIndex Lilact" />
|
|
99
|
+
|
|
100
|
+
<h3>JSX: readOnly={true} (Lilact makes readonly; pasted HTML won’t interpret readonly={true})</h3>
|
|
101
|
+
<input readOnly={true} defaultValue="readonly (Lilact)" />
|
|
102
|
+
|
|
103
|
+
<h3>JSX: maxLength={5} (Lilact enforces length; pasted HTML won’t parse maxLength={5})</h3>
|
|
104
|
+
<input maxLength={5} defaultValue="123456789" />
|
|
105
|
+
<p style={{ margin: "4px 0 0" }}>
|
|
106
|
+
Type/try to enter more: Lilact will limit to 5 chars; pasted HTML won’t.
|
|
107
|
+
</p>
|
|
108
|
+
</div>
|
|
109
|
+
</>
|
|
110
|
+
}
|
package/docs/static/index.html
CHANGED
|
@@ -174,7 +174,8 @@ function App()
|
|
|
174
174
|
['redux.jsx', '( Provider, useSelector, useDispatch, connect ), redux:( createStore )'],
|
|
175
175
|
['suspense.jsx', '( Suspense, Spinner )'],
|
|
176
176
|
['transition.jsx', '( useState, Transition )'],
|
|
177
|
-
['lazy.jsx', '( lazy, require, Suspene, Spinner )']
|
|
177
|
+
['lazy.jsx', '( lazy, require, Suspene, Spinner )'],
|
|
178
|
+
['form-elements.jsx', '()']
|
|
178
179
|
];
|
|
179
180
|
|
|
180
181
|
return <>
|