@thi.ng/hiccup 5.1.16 → 5.1.18

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/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2024-02-25T14:07:53Z
3
+ - **Last updated**: 2024-03-02T14:05:52Z
4
4
  - **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
5
5
 
6
6
  All notable changes to this project will be documented in this file.
package/README.md CHANGED
@@ -1,16 +1,5 @@
1
1
  <!-- This file is generated - DO NOT EDIT! -->
2
2
  <!-- Please see: https://github.com/thi-ng/umbrella/blob/develop/CONTRIBUTING.md#changes-to-readme-files -->
3
- > [!IMPORTANT]
4
- > ‼️ Announcing the thi.ng user survey 2024 📋
5
- >
6
- > [Please participate in the survey here!](https://forms.gle/XacbSDEmQMPZg8197)\
7
- > (open until end of February)
8
- >
9
- > **To achieve a better sample size, I'd highly appreciate if you could
10
- > circulate the link to this survey in your own networks.**
11
- >
12
- > [Discussion](https://github.com/thi-ng/umbrella/discussions/447)
13
-
14
3
  # ![@thi.ng/hiccup](https://media.thi.ng/umbrella/banners-20230807/thing-hiccup.svg?81af4609)
15
4
 
16
5
  [![npm version](https://img.shields.io/npm/v/@thi.ng/hiccup.svg)](https://www.npmjs.com/package/@thi.ng/hiccup)
@@ -22,7 +11,7 @@
22
11
  > of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo
23
12
  > and anti-framework.
24
13
  >
25
- > 🚀 Help me to work full-time on these projects by [sponsoring me on
14
+ > 🚀 Please help me to work full-time on these projects by [sponsoring me on
26
15
  > GitHub](https://github.com/sponsors/postspectacular). Thank you! ❤️
27
16
 
28
17
  - [About](#about)
@@ -227,6 +216,8 @@ Tag names support
227
216
  style ID & class attribute expansion:
228
217
 
229
218
  ```ts
219
+ import { serialize } from "@thi.ng/hiccup";
220
+
230
221
  serialize(
231
222
  ["div#yo.hello.world", "Look ma, ", ["strong", "no magic!"]]
232
223
  );
@@ -247,6 +238,8 @@ If the 2nd array element is not a plain object, it's treated as normal
247
238
  child node (see previous example).
248
239
 
249
240
  ```ts
241
+ import { serialize } from "@thi.ng/hiccup";
242
+
250
243
  serialize(
251
244
  ["div.notice",
252
245
  {
@@ -299,6 +292,8 @@ Function values for event attributes (any attrib name starting with
299
292
  ### Simple components
300
293
 
301
294
  ```ts
295
+ import { serialize } from "@thi.ng/hiccup";
296
+
302
297
  const thumb = (src) => ["img.thumb", { src, alt: "thumbnail" }];
303
298
 
304
299
  serialize(
@@ -326,6 +321,8 @@ The context object should contain any global component configuration,
326
321
  e.g. for theming purposes.
327
322
 
328
323
  ```ts
324
+ import { serialize } from "@thi.ng/hiccup";
325
+
329
326
  const header = (ctx, body) =>
330
327
  ["h1", ctx.theme.title, body];
331
328
 
@@ -355,6 +352,8 @@ yourself. Likewise, if a component function doesn't make use of the context you
355
352
  can use either:
356
353
 
357
354
  ```ts
355
+ import { serialize } from "@thi.ng/hiccup";
356
+
358
357
  // skip the context arg and require direct invocation
359
358
  const div = (attribs, body) => ["div", attribs, body];
360
359
 
@@ -365,6 +364,8 @@ serialize(div({id: "foo"}, "bar"));
365
364
  Or...
366
365
 
367
366
  ```ts
367
+ import { serialize } from "@thi.ng/hiccup";
368
+
368
369
  // ignore the first arg (context) and support both direct & indirect calls
369
370
  const div = (_, attribs, body) => ["div", attribs, body];
370
371
 
@@ -578,7 +579,10 @@ Single or multiline comments can be included using the special `COMMENT`
578
579
  tag (`__COMMENT__`) (always WITHOUT attributes!).
579
580
 
580
581
  ```ts
582
+ import { COMMENT } from "@thi.ng/hiccup";
583
+
581
584
  [COMMENT, "Hello world"]
585
+ // serializes to:
582
586
  // <!-- Hello world -->
583
587
 
584
588
  [COMMENT, "Hello", "world"]
@@ -674,6 +678,8 @@ that function is called. The return value the function MUST be a valid
674
678
  new tree (or undefined).
675
679
 
676
680
  ```ts
681
+ import { serialize } from "@thi.ng/hiccup";
682
+
677
683
  const foo = (ctx, a, b) => ["div#" + a, ctx.foo, b];
678
684
 
679
685
  serialize([foo, "id", "body"], { foo: { class: "black" } })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/hiccup",
3
- "version": "5.1.16",
3
+ "version": "5.1.18",
4
4
  "description": "HTML/SVG/XML serialization of nested data structures, iterables & closures",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -35,14 +35,14 @@
35
35
  "test": "bun test"
36
36
  },
37
37
  "dependencies": {
38
- "@thi.ng/api": "^8.9.26",
39
- "@thi.ng/checks": "^3.5.0",
40
- "@thi.ng/errors": "^2.4.18",
41
- "@thi.ng/strings": "^3.7.18"
38
+ "@thi.ng/api": "^8.9.27",
39
+ "@thi.ng/checks": "^3.5.1",
40
+ "@thi.ng/errors": "^2.4.19",
41
+ "@thi.ng/strings": "^3.7.20"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@microsoft/api-extractor": "^7.40.1",
45
- "@thi.ng/atom": "^5.2.33",
45
+ "@thi.ng/atom": "^5.2.35",
46
46
  "esbuild": "^0.20.0",
47
47
  "rimraf": "^5.0.5",
48
48
  "typedoc": "^0.25.7",
@@ -127,5 +127,5 @@
127
127
  ],
128
128
  "year": 2016
129
129
  },
130
- "gitHead": "190d68e7f7524631b333cfdbf32c6a23be27c166\n"
130
+ "gitHead": "df9e312af741d87e6b450afcfea6a6e381662b1e\n"
131
131
  }
package/serialize.d.ts CHANGED
@@ -100,6 +100,8 @@ export interface SerializeOpts {
100
100
  * interface.
101
101
  *
102
102
  * ```js
103
+ * import { serialize } from "@thi.ng/hiccup";
104
+ *
103
105
  * const foo = (ctx, a, b) => ["div#" + a, ctx.foo, b];
104
106
  *
105
107
  * serialize([foo, "id", "body"], { ctx: { foo: { class: "black" } } })
@@ -122,7 +124,10 @@ export interface SerializeOpts {
122
124
  * (`"__COMMENT__"`) (always WITHOUT attributes!).
123
125
  *
124
126
  * ```js
127
+ * import { COMMENT } from "@thi.ng/hiccup";
128
+ *
125
129
  * [COMMENT, "Hello world"]
130
+ * // serializes to:
126
131
  * // <!-- Hello world -->
127
132
  *
128
133
  * [COMMENT, "Hello", "world"]