microtags 0.0.13 → 0.1.1

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.
Files changed (85) hide show
  1. package/README.md +567 -40
  2. package/dist/build.cjs +412 -0
  3. package/dist/build.cjs.map +7 -0
  4. package/dist/build.d.ts +17 -0
  5. package/dist/build.d.ts.map +1 -0
  6. package/dist/build.js +395 -0
  7. package/dist/build.js.map +7 -0
  8. package/dist/builders.d.ts +70 -4
  9. package/dist/builders.d.ts.map +1 -1
  10. package/dist/{chunk-CCYWRJW6.js → chunk-46UEUDVX.js} +4 -26
  11. package/dist/chunk-46UEUDVX.js.map +7 -0
  12. package/dist/chunk-LS4L5QRD.js +26 -0
  13. package/dist/chunk-LS4L5QRD.js.map +7 -0
  14. package/dist/chunk-RKWPTT6P.js +69 -0
  15. package/dist/chunk-RKWPTT6P.js.map +7 -0
  16. package/dist/chunk-ZZ4ZLOQY.js +33 -0
  17. package/dist/chunk-ZZ4ZLOQY.js.map +7 -0
  18. package/dist/cli.cjs +536 -0
  19. package/dist/cli.cjs.map +7 -0
  20. package/dist/context.js +2 -1
  21. package/dist/esbuild.cjs +451 -0
  22. package/dist/esbuild.cjs.map +7 -0
  23. package/dist/esbuild.d.ts +7 -0
  24. package/dist/esbuild.d.ts.map +1 -0
  25. package/dist/esbuild.js +434 -0
  26. package/dist/esbuild.js.map +7 -0
  27. package/dist/factory.d.ts +7 -1
  28. package/dist/factory.d.ts.map +1 -1
  29. package/dist/htm.browser.cjs +591 -0
  30. package/dist/htm.browser.cjs.map +7 -0
  31. package/dist/htm.browser.d.ts +30 -0
  32. package/dist/htm.browser.d.ts.map +1 -0
  33. package/dist/htm.browser.js +498 -0
  34. package/dist/htm.browser.js.map +7 -0
  35. package/dist/htm.browser.min.js +3 -0
  36. package/dist/htm.browser.min.js.map +7 -0
  37. package/dist/htm.cjs +284 -0
  38. package/dist/htm.cjs.map +7 -0
  39. package/dist/htm.d.ts +14 -0
  40. package/dist/htm.d.ts.map +1 -0
  41. package/dist/htm.js +196 -0
  42. package/dist/htm.js.map +7 -0
  43. package/dist/htm.min.js +3 -0
  44. package/dist/htm.min.js.map +7 -0
  45. package/dist/index.cjs +125 -11
  46. package/dist/index.cjs.map +2 -2
  47. package/dist/index.d.ts +3 -1
  48. package/dist/index.d.ts.map +1 -1
  49. package/dist/index.js +133 -17
  50. package/dist/index.js.map +2 -2
  51. package/dist/index.min.js +1 -1
  52. package/dist/index.min.js.map +3 -3
  53. package/dist/meta.json +411 -26
  54. package/dist/preact-shared.d.ts +61 -0
  55. package/dist/preact-shared.d.ts.map +1 -0
  56. package/dist/preact.browser.d.ts +8 -0
  57. package/dist/preact.browser.d.ts.map +1 -0
  58. package/dist/preact.browser.js +45 -0
  59. package/dist/preact.browser.js.map +7 -0
  60. package/dist/preact.browser.min.js +2 -0
  61. package/dist/preact.browser.min.js.map +7 -0
  62. package/dist/preact.cjs +128 -0
  63. package/dist/preact.cjs.map +7 -0
  64. package/dist/preact.d.ts +9 -0
  65. package/dist/preact.d.ts.map +1 -0
  66. package/dist/preact.js +35 -0
  67. package/dist/preact.js.map +7 -0
  68. package/dist/render-support.cjs +86 -0
  69. package/dist/render-support.cjs.map +7 -0
  70. package/dist/render-support.d.ts +23 -0
  71. package/dist/render-support.d.ts.map +1 -0
  72. package/dist/render-support.js +12 -0
  73. package/dist/render-support.js.map +7 -0
  74. package/dist/render-support.min.js +2 -0
  75. package/dist/render-support.min.js.map +7 -0
  76. package/dist/types.d.ts +8 -0
  77. package/dist/types.d.ts.map +1 -1
  78. package/dist/vite.cjs +448 -0
  79. package/dist/vite.cjs.map +7 -0
  80. package/dist/vite.d.ts +7 -0
  81. package/dist/vite.d.ts.map +1 -0
  82. package/dist/vite.js +429 -0
  83. package/dist/vite.js.map +7 -0
  84. package/package.json +92 -13
  85. package/dist/chunk-CCYWRJW6.js.map +0 -7
package/dist/meta.json CHANGED
@@ -65,7 +65,7 @@
65
65
  "format": "esm"
66
66
  },
67
67
  "src/factory.ts": {
68
- "bytes": 7064,
68
+ "bytes": 10151,
69
69
  "imports": [
70
70
  {
71
71
  "path": "src/reactivity.ts",
@@ -96,7 +96,7 @@
96
96
  "format": "esm"
97
97
  },
98
98
  "src/builders.ts": {
99
- "bytes": 8571,
99
+ "bytes": 14136,
100
100
  "imports": [
101
101
  {
102
102
  "path": "src/util.ts",
@@ -117,7 +117,7 @@
117
117
  "format": "esm"
118
118
  },
119
119
  "src/index.ts": {
120
- "bytes": 134,
120
+ "bytes": 406,
121
121
  "imports": [
122
122
  {
123
123
  "path": "src/reactivity.ts",
@@ -128,6 +128,11 @@
128
128
  "path": "src/builders.ts",
129
129
  "kind": "import-statement",
130
130
  "original": "./builders.js"
131
+ },
132
+ {
133
+ "path": "src/factory.ts",
134
+ "kind": "import-statement",
135
+ "original": "./factory.js"
131
136
  }
132
137
  ],
133
138
  "format": "esm"
@@ -142,31 +147,195 @@
142
147
  }
143
148
  ],
144
149
  "format": "esm"
150
+ },
151
+ "src/render-support.ts": {
152
+ "bytes": 3068,
153
+ "imports": [
154
+ {
155
+ "path": "<runtime>",
156
+ "kind": "import-statement",
157
+ "external": true
158
+ }
159
+ ],
160
+ "format": "esm"
161
+ },
162
+ "src/htm.ts": {
163
+ "bytes": 6577,
164
+ "imports": [
165
+ {
166
+ "path": "htm",
167
+ "kind": "import-statement",
168
+ "external": true
169
+ },
170
+ {
171
+ "path": "src/render-support.ts",
172
+ "kind": "import-statement",
173
+ "original": "./render-support.js"
174
+ },
175
+ {
176
+ "path": "<runtime>",
177
+ "kind": "import-statement",
178
+ "external": true
179
+ }
180
+ ],
181
+ "format": "esm"
182
+ },
183
+ "src/htm.browser.ts": {
184
+ "bytes": 20962,
185
+ "imports": [
186
+ {
187
+ "path": "htm",
188
+ "kind": "import-statement",
189
+ "external": true
190
+ },
191
+ {
192
+ "path": "src/reactivity.ts",
193
+ "kind": "import-statement",
194
+ "original": "./reactivity.js"
195
+ },
196
+ {
197
+ "path": "src/render-support.ts",
198
+ "kind": "import-statement",
199
+ "original": "./render-support.js"
200
+ },
201
+ {
202
+ "path": "<runtime>",
203
+ "kind": "import-statement",
204
+ "external": true
205
+ }
206
+ ],
207
+ "format": "esm"
208
+ },
209
+ "src/preact-shared.ts": {
210
+ "bytes": 2940,
211
+ "imports": [
212
+ {
213
+ "path": "<runtime>",
214
+ "kind": "import-statement",
215
+ "external": true
216
+ }
217
+ ],
218
+ "format": "esm"
219
+ },
220
+ "src/preact.ts": {
221
+ "bytes": 1914,
222
+ "imports": [
223
+ {
224
+ "path": "preact",
225
+ "kind": "import-statement",
226
+ "external": true
227
+ },
228
+ {
229
+ "path": "src/render-support.ts",
230
+ "kind": "import-statement",
231
+ "original": "./render-support.js"
232
+ },
233
+ {
234
+ "path": "src/preact-shared.ts",
235
+ "kind": "import-statement",
236
+ "original": "./preact-shared.js"
237
+ },
238
+ {
239
+ "path": "<runtime>",
240
+ "kind": "import-statement",
241
+ "external": true
242
+ }
243
+ ],
244
+ "format": "esm"
245
+ },
246
+ "src/preact.browser.ts": {
247
+ "bytes": 2903,
248
+ "imports": [
249
+ {
250
+ "path": "preact",
251
+ "kind": "import-statement",
252
+ "external": true
253
+ },
254
+ {
255
+ "path": "preact/hooks",
256
+ "kind": "import-statement",
257
+ "external": true
258
+ },
259
+ {
260
+ "path": "src/preact-shared.ts",
261
+ "kind": "import-statement",
262
+ "original": "./preact-shared.js"
263
+ },
264
+ {
265
+ "path": "<runtime>",
266
+ "kind": "import-statement",
267
+ "external": true
268
+ }
269
+ ],
270
+ "format": "esm"
145
271
  }
146
272
  },
147
273
  "outputs": {
274
+ "dist/preact.browser.js.map": {
275
+ "imports": [],
276
+ "exports": [],
277
+ "inputs": {},
278
+ "bytes": 3979
279
+ },
280
+ "dist/preact.browser.js": {
281
+ "imports": [
282
+ {
283
+ "path": "dist/chunk-LS4L5QRD.js",
284
+ "kind": "import-statement"
285
+ },
286
+ {
287
+ "path": "dist/chunk-7QVYU63E.js",
288
+ "kind": "import-statement"
289
+ },
290
+ {
291
+ "path": "preact",
292
+ "kind": "import-statement",
293
+ "external": true
294
+ },
295
+ {
296
+ "path": "preact/hooks",
297
+ "kind": "import-statement",
298
+ "external": true
299
+ }
300
+ ],
301
+ "exports": [
302
+ "toPreact"
303
+ ],
304
+ "entryPoint": "src/preact.browser.ts",
305
+ "inputs": {
306
+ "src/preact.browser.ts": {
307
+ "bytesInOutput": 1000
308
+ }
309
+ },
310
+ "bytes": 1192
311
+ },
148
312
  "dist/index.js.map": {
149
313
  "imports": [],
150
314
  "exports": [],
151
315
  "inputs": {},
152
- "bytes": 26188
316
+ "bytes": 37453
153
317
  },
154
318
  "dist/index.js": {
155
319
  "imports": [
156
320
  {
157
- "path": "dist/chunk-CCYWRJW6.js",
321
+ "path": "dist/chunk-46UEUDVX.js",
158
322
  "kind": "import-statement"
159
323
  },
160
324
  {
161
325
  "path": "dist/chunk-FZKCMDSS.js",
162
326
  "kind": "import-statement"
163
327
  },
328
+ {
329
+ "path": "dist/chunk-ZZ4ZLOQY.js",
330
+ "kind": "import-statement"
331
+ },
164
332
  {
165
333
  "path": "dist/chunk-7QVYU63E.js",
166
334
  "kind": "import-statement"
167
335
  }
168
336
  ],
169
337
  "exports": [
338
+ "bindProp",
170
339
  "define",
171
340
  "peek",
172
341
  "untracked"
@@ -180,13 +349,13 @@
180
349
  "bytesInOutput": 1999
181
350
  },
182
351
  "src/factory.ts": {
183
- "bytesInOutput": 3589
352
+ "bytesInOutput": 5258
184
353
  },
185
354
  "src/builders.ts": {
186
- "bytesInOutput": 3646
355
+ "bytesInOutput": 5401
187
356
  }
188
357
  },
189
- "bytes": 9658
358
+ "bytes": 13132
190
359
  },
191
360
  "dist/render.js.map": {
192
361
  "imports": [],
@@ -222,7 +391,11 @@
222
391
  "dist/context.js": {
223
392
  "imports": [
224
393
  {
225
- "path": "dist/chunk-CCYWRJW6.js",
394
+ "path": "dist/chunk-46UEUDVX.js",
395
+ "kind": "import-statement"
396
+ },
397
+ {
398
+ "path": "dist/chunk-ZZ4ZLOQY.js",
226
399
  "kind": "import-statement"
227
400
  },
228
401
  {
@@ -238,45 +411,37 @@
238
411
  ],
239
412
  "entryPoint": "src/context.ts",
240
413
  "inputs": {},
241
- "bytes": 263
414
+ "bytes": 293
242
415
  },
243
- "dist/chunk-CCYWRJW6.js.map": {
416
+ "dist/chunk-46UEUDVX.js.map": {
244
417
  "imports": [],
245
418
  "exports": [],
246
419
  "inputs": {},
247
- "bytes": 4998
420
+ "bytes": 3903
248
421
  },
249
- "dist/chunk-CCYWRJW6.js": {
422
+ "dist/chunk-46UEUDVX.js": {
250
423
  "imports": [
251
424
  {
252
- "path": "dist/chunk-7QVYU63E.js",
425
+ "path": "dist/chunk-ZZ4ZLOQY.js",
253
426
  "kind": "import-statement"
254
427
  },
255
428
  {
256
- "path": "alien-signals",
257
- "kind": "import-statement",
258
- "external": true
429
+ "path": "dist/chunk-7QVYU63E.js",
430
+ "kind": "import-statement"
259
431
  }
260
432
  ],
261
433
  "exports": [
262
434
  "createContext",
263
- "effect",
264
435
  "onContextAvailable",
265
- "peek",
266
436
  "provide",
267
- "resolveContextSignal",
268
- "signal",
269
- "untracked"
437
+ "resolveContextSignal"
270
438
  ],
271
439
  "inputs": {
272
- "src/reactivity.ts": {
273
- "bytesInOutput": 324
274
- },
275
440
  "src/context.ts": {
276
441
  "bytesInOutput": 1603
277
442
  }
278
443
  },
279
- "bytes": 2186
444
+ "bytes": 1847
280
445
  },
281
446
  "dist/util.js.map": {
282
447
  "imports": [],
@@ -335,6 +500,226 @@
335
500
  },
336
501
  "bytes": 1381
337
502
  },
503
+ "dist/htm.js.map": {
504
+ "imports": [],
505
+ "exports": [],
506
+ "inputs": {},
507
+ "bytes": 10486
508
+ },
509
+ "dist/htm.js": {
510
+ "imports": [
511
+ {
512
+ "path": "dist/chunk-RKWPTT6P.js",
513
+ "kind": "import-statement"
514
+ },
515
+ {
516
+ "path": "dist/chunk-7QVYU63E.js",
517
+ "kind": "import-statement"
518
+ },
519
+ {
520
+ "path": "htm",
521
+ "kind": "import-statement",
522
+ "external": true
523
+ }
524
+ ],
525
+ "exports": [
526
+ "Markup",
527
+ "h",
528
+ "html",
529
+ "raw"
530
+ ],
531
+ "entryPoint": "src/htm.ts",
532
+ "inputs": {
533
+ "src/htm.ts": {
534
+ "bytesInOutput": 4265
535
+ }
536
+ },
537
+ "bytes": 4431
538
+ },
539
+ "dist/htm.browser.js.map": {
540
+ "imports": [],
541
+ "exports": [],
542
+ "inputs": {},
543
+ "bytes": 33613
544
+ },
545
+ "dist/htm.browser.js": {
546
+ "imports": [
547
+ {
548
+ "path": "dist/chunk-ZZ4ZLOQY.js",
549
+ "kind": "import-statement"
550
+ },
551
+ {
552
+ "path": "dist/chunk-RKWPTT6P.js",
553
+ "kind": "import-statement"
554
+ },
555
+ {
556
+ "path": "dist/chunk-7QVYU63E.js",
557
+ "kind": "import-statement"
558
+ },
559
+ {
560
+ "path": "htm",
561
+ "kind": "import-statement",
562
+ "external": true
563
+ }
564
+ ],
565
+ "exports": [
566
+ "Markup",
567
+ "h",
568
+ "html",
569
+ "mount",
570
+ "raw"
571
+ ],
572
+ "entryPoint": "src/htm.browser.ts",
573
+ "inputs": {
574
+ "src/htm.browser.ts": {
575
+ "bytesInOutput": 13890
576
+ }
577
+ },
578
+ "bytes": 14177
579
+ },
580
+ "dist/chunk-ZZ4ZLOQY.js.map": {
581
+ "imports": [],
582
+ "exports": [],
583
+ "inputs": {},
584
+ "bytes": 1188
585
+ },
586
+ "dist/chunk-ZZ4ZLOQY.js": {
587
+ "imports": [
588
+ {
589
+ "path": "dist/chunk-7QVYU63E.js",
590
+ "kind": "import-statement"
591
+ },
592
+ {
593
+ "path": "alien-signals",
594
+ "kind": "import-statement",
595
+ "external": true
596
+ }
597
+ ],
598
+ "exports": [
599
+ "effect",
600
+ "effectScope",
601
+ "peek",
602
+ "signal",
603
+ "untracked"
604
+ ],
605
+ "inputs": {
606
+ "src/reactivity.ts": {
607
+ "bytesInOutput": 324
608
+ }
609
+ },
610
+ "bytes": 505
611
+ },
612
+ "dist/render-support.js.map": {
613
+ "imports": [],
614
+ "exports": [],
615
+ "inputs": {},
616
+ "bytes": 93
617
+ },
618
+ "dist/render-support.js": {
619
+ "imports": [
620
+ {
621
+ "path": "dist/chunk-RKWPTT6P.js",
622
+ "kind": "import-statement"
623
+ },
624
+ {
625
+ "path": "dist/chunk-7QVYU63E.js",
626
+ "kind": "import-statement"
627
+ }
628
+ ],
629
+ "exports": [
630
+ "register",
631
+ "renderHost",
632
+ "renderParts"
633
+ ],
634
+ "entryPoint": "src/render-support.ts",
635
+ "inputs": {},
636
+ "bytes": 204
637
+ },
638
+ "dist/preact.js.map": {
639
+ "imports": [],
640
+ "exports": [],
641
+ "inputs": {},
642
+ "bytes": 2693
643
+ },
644
+ "dist/preact.js": {
645
+ "imports": [
646
+ {
647
+ "path": "dist/chunk-LS4L5QRD.js",
648
+ "kind": "import-statement"
649
+ },
650
+ {
651
+ "path": "dist/chunk-RKWPTT6P.js",
652
+ "kind": "import-statement"
653
+ },
654
+ {
655
+ "path": "dist/chunk-7QVYU63E.js",
656
+ "kind": "import-statement"
657
+ },
658
+ {
659
+ "path": "preact",
660
+ "kind": "import-statement",
661
+ "external": true
662
+ }
663
+ ],
664
+ "exports": [
665
+ "toPreact"
666
+ ],
667
+ "entryPoint": "src/preact.ts",
668
+ "inputs": {
669
+ "src/preact.ts": {
670
+ "bytesInOutput": 784
671
+ }
672
+ },
673
+ "bytes": 990
674
+ },
675
+ "dist/chunk-LS4L5QRD.js.map": {
676
+ "imports": [],
677
+ "exports": [],
678
+ "inputs": {},
679
+ "bytes": 3598
680
+ },
681
+ "dist/chunk-LS4L5QRD.js": {
682
+ "imports": [
683
+ {
684
+ "path": "dist/chunk-7QVYU63E.js",
685
+ "kind": "import-statement"
686
+ }
687
+ ],
688
+ "exports": [
689
+ "splitProps"
690
+ ],
691
+ "inputs": {
692
+ "src/preact-shared.ts": {
693
+ "bytesInOutput": 480
694
+ }
695
+ },
696
+ "bytes": 622
697
+ },
698
+ "dist/chunk-RKWPTT6P.js.map": {
699
+ "imports": [],
700
+ "exports": [],
701
+ "inputs": {},
702
+ "bytes": 4665
703
+ },
704
+ "dist/chunk-RKWPTT6P.js": {
705
+ "imports": [
706
+ {
707
+ "path": "dist/chunk-7QVYU63E.js",
708
+ "kind": "import-statement"
709
+ }
710
+ ],
711
+ "exports": [
712
+ "register",
713
+ "renderHost",
714
+ "renderParts"
715
+ ],
716
+ "inputs": {
717
+ "src/render-support.ts": {
718
+ "bytesInOutput": 1641
719
+ }
720
+ },
721
+ "bytes": 1811
722
+ },
338
723
  "dist/chunk-7QVYU63E.js.map": {
339
724
  "imports": [],
340
725
  "exports": [],
@@ -0,0 +1,61 @@
1
+ import type { FunctionComponent } from 'preact';
2
+ import type { RenderParts } from './builders.js';
3
+ /**
4
+ * The part of a microtags element class the adapter reads. Any class
5
+ * from `setup` fits; `renderParts` is absent at runtime when the class
6
+ * has no render link.
7
+ */
8
+ export interface PreactElementClass<P = any> {
9
+ readonly TAG: string;
10
+ readonly props: readonly string[];
11
+ readonly renderParts?: (props: P, options?: {
12
+ children?: string;
13
+ attrs?: Record<string, string>;
14
+ }) => RenderParts;
15
+ }
16
+ /** Map from callback prop name to DOM event name. */
17
+ export type EventMap = Record<string, string>;
18
+ export interface ToPreactOptions<E extends EventMap = EventMap> {
19
+ /** e.g. `{ onChange: 'number-input:change' }` */
20
+ events?: E;
21
+ }
22
+ type AttrValue = string | number | boolean | null | undefined;
23
+ /** Host attributes passed through to the host tag. */
24
+ export interface PassthroughProps {
25
+ class?: string;
26
+ id?: string;
27
+ [aria: `aria-${string}`]: AttrValue;
28
+ [data: `data-${string}`]: AttrValue;
29
+ }
30
+ /** The declared props of an element class, all optional. */
31
+ export type DeclaredProps<C> = C extends {
32
+ renderParts?: (props: infer P, ...a: any[]) => any;
33
+ } ? Partial<P> : never;
34
+ /**
35
+ * Props of the Preact component `toPreact` returns: the declared
36
+ * props, one callback per mapped event, passthrough host attributes,
37
+ * and no children.
38
+ */
39
+ export type PreactProps<C, E extends EventMap = Record<never, never>> = DeclaredProps<C> & {
40
+ [K in keyof E]?: (ev: CustomEvent) => void;
41
+ } & PassthroughProps & {
42
+ children?: never;
43
+ };
44
+ export type PreactComponent<C, E extends EventMap> = FunctionComponent<PreactProps<C, E>>;
45
+ /** Props split by where they go on the host. */
46
+ export interface SplitProps {
47
+ /** declared props, by name */
48
+ own: Record<string, unknown>;
49
+ /** handlers, by DOM event name */
50
+ on: Record<string, unknown>;
51
+ /** passthrough host attributes */
52
+ rest: Record<string, unknown>;
53
+ }
54
+ /**
55
+ * Split adapter props into declared props, event handlers (keyed by DOM
56
+ * event name) and passthrough attributes. Throws, naming the tag, when
57
+ * children are passed.
58
+ */
59
+ export declare function splitProps(El: PreactElementClass, events: EventMap, props: Record<string, unknown>): SplitProps;
60
+ export {};
61
+ //# sourceMappingURL=preact-shared.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preact-shared.d.ts","sourceRoot":"","sources":["../src/preact-shared.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAA;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEhD;;;;GAIG;AACH,MAAM,WAAW,kBAAkB,CAAC,CAAC,GAAG,GAAG;IACvC,QAAQ,CAAC,GAAG,EAAC,MAAM,CAAA;IACnB,QAAQ,CAAC,KAAK,EAAC,SAAS,MAAM,EAAE,CAAA;IAChC,QAAQ,CAAC,WAAW,CAAC,EAAC,CAClB,KAAK,EAAC,CAAC,EACP,OAAO,CAAC,EAAC;QAAE,QAAQ,CAAC,EAAC,MAAM,CAAC;QAAC,KAAK,CAAC,EAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,KAC3D,WAAW,CAAA;CACnB;AAED,qDAAqD;AACrD,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAE7C,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,QAAQ,GAAG,QAAQ;IAC1D,iDAAiD;IACjD,MAAM,CAAC,EAAC,CAAC,CAAA;CACZ;AAED,KAAK,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAA;AAE7D,sDAAsD;AACtD,MAAM,WAAW,gBAAgB;IAC7B,KAAK,CAAC,EAAC,MAAM,CAAA;IACb,EAAE,CAAC,EAAC,MAAM,CAAA;IACV,CAAC,IAAI,EAAC,QAAQ,MAAM,EAAE,GAAE,SAAS,CAAA;IACjC,CAAC,IAAI,EAAC,QAAQ,MAAM,EAAE,GAAE,SAAS,CAAA;CACpC;AAED,4DAA4D;AAC5D,MAAM,MAAM,aAAa,CAAC,CAAC,IACvB,CAAC,SAAS;IAAE,WAAW,CAAC,EAAC,CAAC,KAAK,EAAC,MAAM,CAAC,EAAE,GAAG,CAAC,EAAC,GAAG,EAAE,KAAK,GAAG,CAAA;CAAE,GACzD,OAAO,CAAC,CAAC,CAAC,GACV,KAAK,CAAA;AAEb;;;;GAIG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,EAAE,CAAC,SAAS,QAAQ,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAChE,aAAa,CAAC,CAAC,CAAC,GAChB;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAC,CAAC,EAAE,EAAC,WAAW,KAAK,IAAI;CAAE,GAC5C,gBAAgB,GAChB;IAAE,QAAQ,CAAC,EAAC,KAAK,CAAA;CAAE,CAAA;AAEvB,MAAM,MAAM,eAAe,CAAC,CAAC,EAAE,CAAC,SAAS,QAAQ,IAC7C,iBAAiB,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;AAExC,gDAAgD;AAChD,MAAM,WAAW,UAAU;IACvB,8BAA8B;IAC9B,GAAG,EAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC3B,kCAAkC;IAClC,EAAE,EAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC1B,kCAAkC;IAClC,IAAI,EAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC/B;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CACtB,EAAE,EAAC,kBAAkB,EACrB,MAAM,EAAC,QAAQ,EACf,KAAK,EAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,UAAU,CAcX"}
@@ -0,0 +1,8 @@
1
+ import { type EventMap, type PreactComponent, type PreactElementClass, type ToPreactOptions } from './preact-shared.js';
2
+ export type { DeclaredProps, EventMap, PassthroughProps, PreactComponent, PreactElementClass, PreactProps, ToPreactOptions, } from './preact-shared.js';
3
+ /**
4
+ * Wrap a microtags element class as a Preact component. Preact owns the
5
+ * host and its attributes; the element owns the host's children.
6
+ */
7
+ export declare function toPreact<C extends PreactElementClass, E extends EventMap = Record<never, never>>(El: C, options?: ToPreactOptions<E>): PreactComponent<C, E>;
8
+ //# sourceMappingURL=preact.browser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preact.browser.d.ts","sourceRoot":"","sources":["../src/preact.browser.ts"],"names":[],"mappings":"AAOA,OAAO,EAEH,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACvB,MAAM,oBAAoB,CAAA;AAE3B,YAAY,EACR,aAAa,EACb,QAAQ,EACR,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,WAAW,EACX,eAAe,GAClB,MAAM,oBAAoB,CAAA;AAU3B;;;GAGG;AACH,wBAAgB,QAAQ,CACpB,CAAC,SAAS,kBAAkB,EAC5B,CAAC,SAAS,QAAQ,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,EAC1C,EAAE,EAAC,CAAC,EAAE,OAAO,CAAC,EAAC,eAAe,CAAC,CAAC,CAAC,GAAE,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,CAoC1D"}
@@ -0,0 +1,45 @@
1
+ import {
2
+ splitProps
3
+ } from "./chunk-LS4L5QRD.js";
4
+ import {
5
+ __name
6
+ } from "./chunk-7QVYU63E.js";
7
+
8
+ // src/preact.browser.ts
9
+ import { h } from "preact";
10
+ import { useRef } from "preact/hooks";
11
+ function toPreact(El, options) {
12
+ const events = options?.events ?? {};
13
+ return (props) => {
14
+ const { own, on, rest } = splitProps(El, events, props);
15
+ const s = useRef({ live: false, html: "" }).current;
16
+ const vprops = { ...rest, ...own };
17
+ for (const k in on) vprops["on" + k] = on[k];
18
+ vprops.dangerouslySetInnerHTML = s.inner ??= {
19
+ get __html() {
20
+ if (!s.live && El.renderParts) {
21
+ const extra = {};
22
+ for (const k in rest) {
23
+ if (rest[k] != null) extra[k] = String(rest[k]);
24
+ }
25
+ s.html = El.renderParts(own, { attrs: extra }).html;
26
+ }
27
+ return s.html;
28
+ }
29
+ };
30
+ vprops.ref = (el) => {
31
+ if (!el) return;
32
+ s.live = true;
33
+ for (const k in own) {
34
+ const v = own[k];
35
+ if (typeof v !== "function" && el[k] !== v) el[k] = v;
36
+ }
37
+ };
38
+ return h(El.TAG, vprops);
39
+ };
40
+ }
41
+ __name(toPreact, "toPreact");
42
+ export {
43
+ toPreact
44
+ };
45
+ //# sourceMappingURL=preact.browser.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/preact.browser.ts"],
4
+ "sourcesContent": ["// `microtags/preact`, browser build. Renders the host tag only: the\n// declared props go to the host's prop accessors, mapped events become\n// `on<event-name>` listeners, and a per-instance fixed\n// `dangerouslySetInnerHTML` keeps Preact out of the host's children.\n// Never imports render support. See ADR-010.\nimport { h, type VNode } from 'preact'\nimport { useRef } from 'preact/hooks'\nimport {\n splitProps,\n type EventMap,\n type PreactComponent,\n type PreactElementClass,\n type ToPreactOptions,\n} from './preact-shared.js'\n\nexport type {\n DeclaredProps,\n EventMap,\n PassthroughProps,\n PreactComponent,\n PreactElementClass,\n PreactProps,\n ToPreactOptions,\n} from './preact-shared.js'\n\ninterface State {\n /** the host has been committed once (hydrated or mounted) */\n live:boolean\n /** the inner HTML, fixed once the host is live */\n html:string\n inner?:{ readonly __html:string }\n}\n\n/**\n * Wrap a microtags element class as a Preact component. Preact owns the\n * host and its attributes; the element owns the host's children.\n */\nexport function toPreact<\n C extends PreactElementClass,\n E extends EventMap = Record<never, never>,\n> (El:C, options?:ToPreactOptions<E>):PreactComponent<C, E> {\n const events:EventMap = options?.events ?? {}\n return (props:Record<string, unknown>):VNode<any> => {\n const { own, on, rest } = splitProps(El, events, props)\n const s = useRef<State>({ live: false, html: '' }).current!\n const vprops:Record<string, unknown> = { ...rest, ...own }\n for (const k in on) vprops['on' + k] = on[k]\n // Preact reads `__html` only outside hydration: on a client-only\n // mount (before the ref below runs), when the element's render\n // fills the host. Once live the value never changes, so Preact\n // never writes `innerHTML` over the element's children again.\n vprops.dangerouslySetInnerHTML = s.inner ??= {\n get __html () {\n if (!s.live && El.renderParts) {\n const extra:Record<string, string> = {}\n for (const k in rest) {\n if (rest[k] != null) extra[k] = String(rest[k])\n }\n s.html = El.renderParts(own, { attrs: extra }).html\n }\n return s.html\n },\n }\n // A fresh ref per render runs on every commit. Preact skips\n // non-function props while hydrating and later skips a value\n // equal to the hydrated one, so assign any the host lacks.\n vprops.ref = (el:Record<string, unknown>|null) => {\n if (!el) return\n s.live = true\n for (const k in own) {\n const v = own[k]\n if (typeof v !== 'function' && el[k] !== v) el[k] = v\n }\n }\n return h(El.TAG, vprops)\n }\n}\n"],
5
+ "mappings": ";;;;;;;;AAKA,SAAS,SAAqB;AAC9B,SAAS,cAAc;AA+BhB,SAAS,SAGb,IAAM,SAAmD;AACxD,QAAM,SAAkB,SAAS,UAAU,CAAC;AAC5C,SAAO,CAAC,UAA6C;AACjD,UAAM,EAAE,KAAK,IAAI,KAAK,IAAI,WAAW,IAAI,QAAQ,KAAK;AACtD,UAAM,IAAI,OAAc,EAAE,MAAM,OAAO,MAAM,GAAG,CAAC,EAAE;AACnD,UAAM,SAAiC,EAAE,GAAG,MAAM,GAAG,IAAI;AACzD,eAAW,KAAK,GAAI,QAAO,OAAO,CAAC,IAAI,GAAG,CAAC;AAK3C,WAAO,0BAA0B,EAAE,UAAU;AAAA,MACzC,IAAI,SAAU;AACV,YAAI,CAAC,EAAE,QAAQ,GAAG,aAAa;AAC3B,gBAAM,QAA+B,CAAC;AACtC,qBAAW,KAAK,MAAM;AAClB,gBAAI,KAAK,CAAC,KAAK,KAAM,OAAM,CAAC,IAAI,OAAO,KAAK,CAAC,CAAC;AAAA,UAClD;AACA,YAAE,OAAO,GAAG,YAAY,KAAK,EAAE,OAAO,MAAM,CAAC,EAAE;AAAA,QACnD;AACA,eAAO,EAAE;AAAA,MACb;AAAA,IACJ;AAIA,WAAO,MAAM,CAAC,OAAoC;AAC9C,UAAI,CAAC,GAAI;AACT,QAAE,OAAO;AACT,iBAAW,KAAK,KAAK;AACjB,cAAM,IAAI,IAAI,CAAC;AACf,YAAI,OAAO,MAAM,cAAc,GAAG,CAAC,MAAM,EAAG,IAAG,CAAC,IAAI;AAAA,MACxD;AAAA,IACJ;AACA,WAAO,EAAE,GAAG,KAAK,MAAM;AAAA,EAC3B;AACJ;AAvCgB;",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ var f=Object.defineProperty;var l=(n,a)=>f(n,"name",{value:a,configurable:!0});import{h as g}from"preact";import{useRef as m}from"preact/hooks";function u(n,a,r){if(r.children!==void 0)throw new Error(`microtags/preact: <${n.TAG}> takes no children`);let c={},o={},i={};for(let e in r)e!=="children"&&(n.props.includes(e)?c[e]=r[e]:Object.hasOwn(a,e)?o[a[e]]=r[e]:i[e]=r[e]);return{own:c,on:o,rest:i}}l(u,"splitProps");function R(n,a){let r=a?.events??{};return c=>{let{own:o,on:i,rest:e}=u(n,r,c),p=m({live:!1,html:""}).current,d={...e,...o};for(let t in i)d["on"+t]=i[t];return d.dangerouslySetInnerHTML=p.inner??={get __html(){if(!p.live&&n.renderParts){let t={};for(let s in e)e[s]!=null&&(t[s]=String(e[s]));p.html=n.renderParts(o,{attrs:t}).html}return p.html}},d.ref=t=>{if(t){p.live=!0;for(let s in o){let P=o[s];typeof P!="function"&&t[s]!==P&&(t[s]=P)}}},g(n.TAG,d)}}l(R,"toPreact");export{R as toPreact};
2
+ //# sourceMappingURL=preact.browser.min.js.map