@seahax/elemental 0.5.7 → 0.5.9
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 +22 -0
- package/dist/classes.d.ts +2 -0
- package/dist/classes.js +8 -0
- package/dist/classes.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +18 -17
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -302,3 +302,25 @@ h(parent, items.map((item) => {
|
|
|
302
302
|
return h('p', { 'data-key': item.id }, [item.text]);
|
|
303
303
|
}));
|
|
304
304
|
```
|
|
305
|
+
|
|
306
|
+
## Combine Conditional Classes
|
|
307
|
+
|
|
308
|
+
```ts
|
|
309
|
+
// Using a dictionary of boolean values.
|
|
310
|
+
const classNames = classes({
|
|
311
|
+
'my-class-0': true,
|
|
312
|
+
'my-class-1': false,
|
|
313
|
+
'my-class-2': undefined,
|
|
314
|
+
'my-class-3': null,
|
|
315
|
+
'my-class-4': true,
|
|
316
|
+
}); // = 'my-class-0 my-class-4'
|
|
317
|
+
|
|
318
|
+
// Using a sparse array.
|
|
319
|
+
const classNames = classes([
|
|
320
|
+
'my-class-0',
|
|
321
|
+
false,
|
|
322
|
+
undefined,
|
|
323
|
+
null,
|
|
324
|
+
'my-class-4',
|
|
325
|
+
]); // = 'my-class-0 my-class-3'
|
|
326
|
+
```
|
package/dist/classes.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classes.js","names":[],"sources":["../src/classes.ts"],"sourcesContent":["/** Space separated class string helper. */\nexport function classes(\n classes: readonly (string | boolean | null | undefined)[] | Readonly<Record<string, boolean | null | undefined>>,\n): string | null {\n return (\n (Array.isArray(classes)\n ? classes.filter(Boolean).join(' ')\n : Object.entries(classes)\n .filter(([, value]) => value)\n .map(([key]) => key)\n .join(' ')) || null\n );\n}\n"],"mappings":";AACA,SAAgB,EACd,GACe;AACf,SACG,MAAM,QAAQ,EAAQ,GACnB,EAAQ,OAAO,QAAQ,CAAC,KAAK,IAAI,GACjC,OAAO,QAAQ,EAAQ,CACpB,QAAQ,GAAG,OAAW,EAAM,CAC5B,KAAK,CAAC,OAAS,EAAI,CACnB,KAAK,IAAI,KAAK"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
|
|
1
|
+
import { classes as e } from "./classes.js";
|
|
2
|
+
import { createStore as t } from "./createStore.js";
|
|
3
|
+
import { useRef as n } from "./hooks/useRef.js";
|
|
4
|
+
import { defineComponent as r } from "./defineComponent.js";
|
|
5
|
+
import { useDisconnectCallback as i } from "./hooks/useDisconnect.js";
|
|
6
|
+
import { useEffect as a } from "./hooks/useEffect.js";
|
|
7
|
+
import { useAsync as o } from "./hooks/useAsync.js";
|
|
8
|
+
import { useHost as s } from "./hooks/useHost.js";
|
|
9
|
+
import { useAttributes as c } from "./hooks/useAttributes.js";
|
|
10
|
+
import { useChildEffect as l } from "./hooks/useChildEffect.js";
|
|
11
|
+
import { useDocument as u } from "./hooks/useDocument.js";
|
|
12
|
+
import { useElementInternals as d } from "./hooks/useElementInternals.js";
|
|
13
|
+
import { useForm as f, useFormDisabled as p, useFormResetCallback as m, useFormRestoreCallback as h } from "./hooks/useForm.js";
|
|
14
|
+
import { useParent as g } from "./hooks/useParent.js";
|
|
15
|
+
import { useStore as _ } from "./hooks/useStore.js";
|
|
16
|
+
import { useRoute as v } from "./hooks/useRoute.js";
|
|
17
|
+
import { html as y } from "./html.js";
|
|
18
|
+
export { e as classes, t as createStore, r as defineComponent, y as h, y as html, o as useAsync, c as useAttributes, l as useChildEffect, i as useDisconnectCallback, u as useDocument, a as useEffect, d as useElementInternals, f as useForm, p as useFormDisabled, m as useFormResetCallback, h as useFormRestoreCallback, s as useHost, g as useParent, n as useRef, v as useRoute, _ as useStore };
|
package/package.json
CHANGED