@thi.ng/hiccup 5.1.17 → 5.1.19

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-03-01T15:22:50Z
3
+ - **Last updated**: 2024-03-07T20:40:47Z
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
@@ -216,6 +216,8 @@ Tag names support
216
216
  style ID & class attribute expansion:
217
217
 
218
218
  ```ts
219
+ import { serialize } from "@thi.ng/hiccup";
220
+
219
221
  serialize(
220
222
  ["div#yo.hello.world", "Look ma, ", ["strong", "no magic!"]]
221
223
  );
@@ -236,6 +238,8 @@ If the 2nd array element is not a plain object, it's treated as normal
236
238
  child node (see previous example).
237
239
 
238
240
  ```ts
241
+ import { serialize } from "@thi.ng/hiccup";
242
+
239
243
  serialize(
240
244
  ["div.notice",
241
245
  {
@@ -288,6 +292,8 @@ Function values for event attributes (any attrib name starting with
288
292
  ### Simple components
289
293
 
290
294
  ```ts
295
+ import { serialize } from "@thi.ng/hiccup";
296
+
291
297
  const thumb = (src) => ["img.thumb", { src, alt: "thumbnail" }];
292
298
 
293
299
  serialize(
@@ -315,6 +321,8 @@ The context object should contain any global component configuration,
315
321
  e.g. for theming purposes.
316
322
 
317
323
  ```ts
324
+ import { serialize } from "@thi.ng/hiccup";
325
+
318
326
  const header = (ctx, body) =>
319
327
  ["h1", ctx.theme.title, body];
320
328
 
@@ -344,6 +352,8 @@ yourself. Likewise, if a component function doesn't make use of the context you
344
352
  can use either:
345
353
 
346
354
  ```ts
355
+ import { serialize } from "@thi.ng/hiccup";
356
+
347
357
  // skip the context arg and require direct invocation
348
358
  const div = (attribs, body) => ["div", attribs, body];
349
359
 
@@ -354,6 +364,8 @@ serialize(div({id: "foo"}, "bar"));
354
364
  Or...
355
365
 
356
366
  ```ts
367
+ import { serialize } from "@thi.ng/hiccup";
368
+
357
369
  // ignore the first arg (context) and support both direct & indirect calls
358
370
  const div = (_, attribs, body) => ["div", attribs, body];
359
371
 
@@ -567,7 +579,10 @@ Single or multiline comments can be included using the special `COMMENT`
567
579
  tag (`__COMMENT__`) (always WITHOUT attributes!).
568
580
 
569
581
  ```ts
582
+ import { COMMENT } from "@thi.ng/hiccup";
583
+
570
584
  [COMMENT, "Hello world"]
585
+ // serializes to:
571
586
  // <!-- Hello world -->
572
587
 
573
588
  [COMMENT, "Hello", "world"]
@@ -663,6 +678,8 @@ that function is called. The return value the function MUST be a valid
663
678
  new tree (or undefined).
664
679
 
665
680
  ```ts
681
+ import { serialize } from "@thi.ng/hiccup";
682
+
666
683
  const foo = (ctx, a, b) => ["div#" + a, ctx.foo, b];
667
684
 
668
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.17",
3
+ "version": "5.1.19",
4
4
  "description": "HTML/SVG/XML serialization of nested data structures, iterables & closures",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -32,17 +32,18 @@
32
32
  "doc:ae": "mkdir -p .ae/doc .ae/temp && api-extractor run --local --verbose",
33
33
  "doc:readme": "bun ../../tools/src/module-stats.ts && bun ../../tools/src/readme.ts",
34
34
  "pub": "yarn npm publish --access public",
35
- "test": "bun test"
35
+ "test": "bun test",
36
+ "tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
36
37
  },
37
38
  "dependencies": {
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.19"
39
+ "@thi.ng/api": "^8.9.28",
40
+ "@thi.ng/checks": "^3.5.2",
41
+ "@thi.ng/errors": "^2.4.20",
42
+ "@thi.ng/strings": "^3.7.21"
42
43
  },
43
44
  "devDependencies": {
44
45
  "@microsoft/api-extractor": "^7.40.1",
45
- "@thi.ng/atom": "^5.2.34",
46
+ "@thi.ng/atom": "^5.2.36",
46
47
  "esbuild": "^0.20.0",
47
48
  "rimraf": "^5.0.5",
48
49
  "typedoc": "^0.25.7",
@@ -127,5 +128,5 @@
127
128
  ],
128
129
  "year": 2016
129
130
  },
130
- "gitHead": "d660ae8fd1bf64d919b4334f19509f1f539d70f6\n"
131
+ "gitHead": "a421058a65ba76608d94129ac29451bfedaf201c\n"
131
132
  }
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"]