vanilla-breeze 0.7.1 → 0.7.2

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 (96) hide show
  1. package/custom-elements.json +422 -7
  2. package/dist/cdn/components/activity-feed.js +1 -1
  3. package/dist/cdn/components/data-table.js +1 -1
  4. package/dist/cdn/components/manifest.json +8 -4
  5. package/dist/cdn/components/settings-panel.js +1 -1
  6. package/dist/cdn/components/site-map.js +1 -1
  7. package/dist/cdn/components/social-feed.js +5 -0
  8. package/dist/cdn/components/theme-picker.js +14 -7
  9. package/dist/cdn/packs/manifest.json +2 -2
  10. package/dist/cdn/packs/ui.full.css +1 -1
  11. package/dist/cdn/packs/ui.full.js +15 -8
  12. package/dist/cdn/themes/8bit.tokens.json +1 -1
  13. package/dist/cdn/themes/alpha1999-dark.tokens.json +1 -1
  14. package/dist/cdn/themes/alpha1999.tokens.json +1 -1
  15. package/dist/cdn/themes/art-deco-dark.tokens.json +1 -1
  16. package/dist/cdn/themes/art-deco.tokens.json +1 -1
  17. package/dist/cdn/themes/bauhaus-dark.tokens.json +1 -1
  18. package/dist/cdn/themes/bauhaus.tokens.json +1 -1
  19. package/dist/cdn/themes/brutalist-dark.tokens.json +1 -1
  20. package/dist/cdn/themes/brutalist.tokens.json +1 -1
  21. package/dist/cdn/themes/catppuccin-frappe.tokens.json +1 -1
  22. package/dist/cdn/themes/catppuccin-latte-dark.tokens.json +1 -1
  23. package/dist/cdn/themes/catppuccin-latte.tokens.json +1 -1
  24. package/dist/cdn/themes/catppuccin-macchiato.tokens.json +1 -1
  25. package/dist/cdn/themes/catppuccin-mocha.tokens.json +1 -1
  26. package/dist/cdn/themes/classic-dark.tokens.json +1 -1
  27. package/dist/cdn/themes/classic.tokens.json +1 -1
  28. package/dist/cdn/themes/claymorphism-dark.tokens.json +1 -1
  29. package/dist/cdn/themes/claymorphism.tokens.json +1 -1
  30. package/dist/cdn/themes/clinical-dark.tokens.json +1 -1
  31. package/dist/cdn/themes/clinical.tokens.json +1 -1
  32. package/dist/cdn/themes/cottagecore-dark.tokens.json +1 -1
  33. package/dist/cdn/themes/cottagecore.tokens.json +1 -1
  34. package/dist/cdn/themes/cyber.tokens.json +1 -1
  35. package/dist/cdn/themes/dawn-dark.tokens.json +1 -1
  36. package/dist/cdn/themes/dawn.tokens.json +1 -1
  37. package/dist/cdn/themes/dracula.tokens.json +1 -1
  38. package/dist/cdn/themes/dusk.tokens.json +1 -1
  39. package/dist/cdn/themes/editorial-dark.tokens.json +1 -1
  40. package/dist/cdn/themes/editorial.tokens.json +1 -1
  41. package/dist/cdn/themes/financial-dark.tokens.json +1 -1
  42. package/dist/cdn/themes/financial.tokens.json +1 -1
  43. package/dist/cdn/themes/genai.tokens.json +1 -1
  44. package/dist/cdn/themes/glassmorphism-dark.tokens.json +1 -1
  45. package/dist/cdn/themes/glassmorphism.tokens.json +1 -1
  46. package/dist/cdn/themes/government-dark.tokens.json +1 -1
  47. package/dist/cdn/themes/government.tokens.json +1 -1
  48. package/dist/cdn/themes/gruvbox-dark.tokens.json +1 -1
  49. package/dist/cdn/themes/gruvbox.tokens.json +1 -1
  50. package/dist/cdn/themes/high-noon-dark.tokens.json +1 -1
  51. package/dist/cdn/themes/high-noon.tokens.json +1 -1
  52. package/dist/cdn/themes/journal-dark.tokens.json +1 -1
  53. package/dist/cdn/themes/journal.tokens.json +1 -1
  54. package/dist/cdn/themes/kawaii-dark.tokens.json +1 -1
  55. package/dist/cdn/themes/kawaii.tokens.json +1 -1
  56. package/dist/cdn/themes/magna-dark.tokens.json +1 -1
  57. package/dist/cdn/themes/magna.tokens.json +1 -1
  58. package/dist/cdn/themes/midnight.tokens.json +1 -1
  59. package/dist/cdn/themes/minimal-dark.tokens.json +1 -1
  60. package/dist/cdn/themes/minimal.tokens.json +1 -1
  61. package/dist/cdn/themes/modern-dark.tokens.json +1 -1
  62. package/dist/cdn/themes/modern.tokens.json +1 -1
  63. package/dist/cdn/themes/nes-dark.tokens.json +1 -1
  64. package/dist/cdn/themes/nes.tokens.json +1 -1
  65. package/dist/cdn/themes/neumorphism-dark.tokens.json +1 -1
  66. package/dist/cdn/themes/neumorphism.tokens.json +1 -1
  67. package/dist/cdn/themes/nord-dark.tokens.json +1 -1
  68. package/dist/cdn/themes/nord.tokens.json +1 -1
  69. package/dist/cdn/themes/organic-dark.tokens.json +1 -1
  70. package/dist/cdn/themes/organic.tokens.json +1 -1
  71. package/dist/cdn/themes/rose-pine-dark.tokens.json +1 -1
  72. package/dist/cdn/themes/rose-pine.tokens.json +1 -1
  73. package/dist/cdn/themes/rough-dark.tokens.json +1 -1
  74. package/dist/cdn/themes/rough.tokens.json +1 -1
  75. package/dist/cdn/themes/solarized-dark.tokens.json +1 -1
  76. package/dist/cdn/themes/solarized.tokens.json +1 -1
  77. package/dist/cdn/themes/startup-dark.tokens.json +1 -1
  78. package/dist/cdn/themes/startup.tokens.json +1 -1
  79. package/dist/cdn/themes/super2026-dark.tokens.json +1 -1
  80. package/dist/cdn/themes/super2026.tokens.json +1 -1
  81. package/dist/cdn/themes/swiss-dark.tokens.json +1 -1
  82. package/dist/cdn/themes/swiss.tokens.json +1 -1
  83. package/dist/cdn/themes/terminal.tokens.json +1 -1
  84. package/dist/cdn/themes/tokyo-night-dark.tokens.json +1 -1
  85. package/dist/cdn/themes/tokyo-night.tokens.json +1 -1
  86. package/dist/cdn/themes/vaporwave-dark.tokens.json +1 -1
  87. package/dist/cdn/themes/vaporwave.tokens.json +1 -1
  88. package/dist/cdn/themes/win9x-dark.tokens.json +1 -1
  89. package/dist/cdn/themes/win9x.tokens.json +1 -1
  90. package/dist/cdn/vanilla-breeze-autoload.js +52 -52
  91. package/dist/cdn/vanilla-breeze-core.css +1 -1
  92. package/dist/cdn/vanilla-breeze-core.js +44 -44
  93. package/dist/cdn/vanilla-breeze-extras.js +36 -33
  94. package/dist/cdn/vanilla-breeze.css +1 -1
  95. package/dist/cdn/vanilla-breeze.js +168 -158
  96. package/package.json +2 -2
@@ -268,7 +268,7 @@
268
268
  "declarations": [
269
269
  {
270
270
  "kind": "class",
271
- "description": "Author renders entries as `<article data-activity>` children, each carrying\nits timestamp either as `data-time=\"ISO\"` or as an authored\n`<time datetime=\"ISO\">` direct child (which also gives a no-JS time).\nComponent:\n - Decorates each entry with a relative-time badge (upgrading an authored\n `<time>` in place, or creating one from data-time)\n - Optionally groups entries under day / week date headings (data-group)\n - Optionally renders a left-rail avatar / icon (data-activity-avatar /\n data-activity-icon)\n - Wires the WAI-ARIA Feed pattern: role=\"feed\", aria-labelledby /\n aria-describedby per article, aria-posinset / aria-setsize (-1 while\n more may load), aria-busy around load-more, keyboard nav\n (PageDown / PageUp, Ctrl+Home / Ctrl+End; Home / End when the\n article itself has focus; arrow keys are left to the page)\n - Optionally arms an IntersectionObserver sentinel for infinite scroll\n (data-infinite → activity-feed:load-more event with a done() callback)\n - Watches for new direct children via MutationObserver and decorates them\n\nAccessibility tree: date headings, the sentinel and the empty-state text are\nDOM children of the host, but only <article>s are feed children. Headings\nand the sentinel are aria-hidden (a heading's text is attached to the first\narticle of its group via aria-describedby); while the feed is empty the host\nrole is \"group\" so the empty-state paragraph is a legitimate child.\n\nRead-only / immutable per entry — distinct from `<comment-thread>`\n(mutable + threaded) and `<chat-thread>` (real-time, sender-grouped).",
271
+ "description": "Author renders entries as `<article data-activity>` children, each carrying\nits timestamp either as `data-time=\"ISO\"` or as an authored\n`<time datetime=\"ISO\">` direct child (which also gives a no-JS time).\nComponent:\n - Decorates each entry with a relative-time badge (upgrading an authored\n `<time>` in place, or creating one from data-time)\n - Optionally groups entries under day / week date headings (data-group)\n - Optionally renders a left-rail avatar / icon (data-activity-avatar /\n data-activity-icon)\n - Wires the WAI-ARIA Feed pattern: role=\"feed\", aria-labelledby /\n aria-describedby per article, aria-posinset / aria-setsize (-1 while\n more may load), aria-busy around load-more, keyboard nav\n (PageDown / PageUp, Ctrl+Home / Ctrl+End; plain Home / End and the\n arrow keys are left to the page)\n - Optionally arms an IntersectionObserver sentinel for infinite scroll\n (data-infinite → activity-feed:load-more event with a done() callback)\n - Watches for new direct children via MutationObserver and decorates them\n\nAccessibility tree: date headings, the sentinel and the empty-state text are\nDOM children of the host, but only <article>s are feed children. Headings\nand the sentinel are aria-hidden (a heading's text is attached to the first\narticle of its group via aria-describedby); while the feed is empty the host\nrole is \"group\" so the empty-state paragraph is a legitimate child.\n\nRead-only / immutable per entry — distinct from `<comment-thread>`\n(mutable + threaded) and `<chat-thread>` (real-time, sender-grouped).",
272
272
  "name": "ActivityFeed",
273
273
  "members": [
274
274
  {
@@ -9102,7 +9102,7 @@
9102
9102
  "declarations": [
9103
9103
  {
9104
9104
  "kind": "class",
9105
- "description": "Wraps a standard HTML table and adds interactive features based on\ndata attributes. Progressive enhancement - table works without JS.\n\nHost attributes:",
9105
+ "description": "Wraps a standard HTML table and adds interactive features based on\ndata attributes. Progressive enhancement - table works without JS.\n\nHost attributes (every generated string; each is read when it is used):",
9106
9106
  "name": "DataTable",
9107
9107
  "members": [
9108
9108
  {
@@ -9411,19 +9411,63 @@
9411
9411
  "parameters": [
9412
9412
  {
9413
9413
  "name": "key",
9414
- "description": "dataset key suffix, e.g. 'NoResults' for data-label-no-results",
9414
+ "description": "LABELS key, e.g. 'no-results' for data-label-no-results",
9415
9415
  "type": {
9416
9416
  "text": "string"
9417
9417
  }
9418
- },
9418
+ }
9419
+ ],
9420
+ "description": "Author-overridable UI string: data-label-<key> on the host, else the\nEnglish default. Read on every use so a changed attribute applies to\nthe next render or announcement.",
9421
+ "return": {
9422
+ "type": {
9423
+ "text": "string"
9424
+ }
9425
+ }
9426
+ },
9427
+ {
9428
+ "kind": "method",
9429
+ "name": "#countLabel",
9430
+ "privacy": "private",
9431
+ "parameters": [
9419
9432
  {
9420
- "name": "fallback",
9433
+ "name": "key",
9434
+ "description": "e.g. 'selected' for data-label-selected-one / -other",
9421
9435
  "type": {
9422
9436
  "text": "string"
9423
9437
  }
9438
+ },
9439
+ {
9440
+ "name": "n",
9441
+ "description": "the number the plural form agrees with",
9442
+ "type": {
9443
+ "text": "number"
9444
+ }
9445
+ },
9446
+ {
9447
+ "name": "values",
9448
+ "description": "placeholder values",
9449
+ "type": {
9450
+ "text": "Record<string, string | number>"
9451
+ }
9424
9452
  }
9425
9453
  ],
9426
- "description": "Author-overridable UI string from a data-label-* attribute."
9454
+ "description": "Counted message: picks data-label-<key>-<category> by Intl.PluralRules\nfor `n`, falling back to the author's -other, then the English default.",
9455
+ "return": {
9456
+ "type": {
9457
+ "text": "string"
9458
+ }
9459
+ }
9460
+ },
9461
+ {
9462
+ "kind": "method",
9463
+ "name": "#number",
9464
+ "privacy": "private",
9465
+ "parameters": [
9466
+ {
9467
+ "name": "n"
9468
+ }
9469
+ ],
9470
+ "description": "Format a count or page number for the resolved locale (nearest [lang])."
9427
9471
  },
9428
9472
  {
9429
9473
  "kind": "method",
@@ -9785,6 +9829,118 @@
9785
9829
  "description": "Empty-state / announcement text when the filter matches nothing (default \"No matching rows found\")",
9786
9830
  "fieldName": "data-label-no-results"
9787
9831
  },
9832
+ {
9833
+ "name": "data-label-filter",
9834
+ "type": {
9835
+ "text": "string"
9836
+ },
9837
+ "description": "Accessible name of the filter input (default \"Filter table rows\")",
9838
+ "fieldName": "data-label-filter"
9839
+ },
9840
+ {
9841
+ "name": "data-label-placeholder",
9842
+ "type": {
9843
+ "text": "string"
9844
+ },
9845
+ "description": "Placeholder of the filter input (default \"Filter table...\")",
9846
+ "fieldName": "data-label-placeholder"
9847
+ },
9848
+ {
9849
+ "name": "data-label-pagination",
9850
+ "type": {
9851
+ "text": "string"
9852
+ },
9853
+ "description": "Accessible name of the pagination nav (default \"Table pagination\")",
9854
+ "fieldName": "data-label-pagination"
9855
+ },
9856
+ {
9857
+ "name": "data-label-prev",
9858
+ "type": {
9859
+ "text": "string"
9860
+ },
9861
+ "description": "Text of the previous-page button (default \"Previous\")",
9862
+ "fieldName": "data-label-prev"
9863
+ },
9864
+ {
9865
+ "name": "data-label-next",
9866
+ "type": {
9867
+ "text": "string"
9868
+ },
9869
+ "description": "Text of the next-page button (default \"Next\")",
9870
+ "fieldName": "data-label-next"
9871
+ },
9872
+ {
9873
+ "name": "data-label-sorted",
9874
+ "type": {
9875
+ "text": "string"
9876
+ },
9877
+ "description": "Sort announcement; {column} and {direction} are replaced (default \"Sorted by {column}, {direction}\")",
9878
+ "fieldName": "data-label-sorted"
9879
+ },
9880
+ {
9881
+ "name": "data-label-ascending",
9882
+ "type": {
9883
+ "text": "string"
9884
+ },
9885
+ "description": "Direction word for {direction} (default \"ascending\")",
9886
+ "fieldName": "data-label-ascending"
9887
+ },
9888
+ {
9889
+ "name": "data-label-descending",
9890
+ "type": {
9891
+ "text": "string"
9892
+ },
9893
+ "description": "Direction word for {direction} (default \"descending\")",
9894
+ "fieldName": "data-label-descending"
9895
+ },
9896
+ {
9897
+ "name": "data-label-filtered-one",
9898
+ "type": {
9899
+ "text": "string"
9900
+ },
9901
+ "description": "Filter announcement when Intl.PluralRules selects \"one\" for the total; {count} and {total} are replaced (default \"{count} of {total} row shown\"). Any category works: -two, -few, -many, -zero",
9902
+ "fieldName": "data-label-filtered-one"
9903
+ },
9904
+ {
9905
+ "name": "data-label-filtered-other",
9906
+ "type": {
9907
+ "text": "string"
9908
+ },
9909
+ "description": "Filter announcement for the \"other\" category and for unset categories (default \"{count} of {total} rows shown\")",
9910
+ "fieldName": "data-label-filtered-other"
9911
+ },
9912
+ {
9913
+ "name": "data-label-all-one",
9914
+ "type": {
9915
+ "text": "string"
9916
+ },
9917
+ "description": "Announcement when the filter is cleared, \"one\" category; {total} is replaced (default \"All {total} row shown\")",
9918
+ "fieldName": "data-label-all-one"
9919
+ },
9920
+ {
9921
+ "name": "data-label-all-other",
9922
+ "type": {
9923
+ "text": "string"
9924
+ },
9925
+ "description": "Announcement when the filter is cleared, \"other\" category and unset categories (default \"All {total} rows shown\")",
9926
+ "fieldName": "data-label-all-other"
9927
+ },
9928
+ {
9929
+ "name": "data-label-selected-one",
9930
+ "type": {
9931
+ "text": "string"
9932
+ },
9933
+ "description": "Selection announcement, \"one\" category; {count} is replaced (default \"{count} row selected\")",
9934
+ "fieldName": "data-label-selected-one"
9935
+ },
9936
+ {
9937
+ "name": "data-label-selected-other",
9938
+ "type": {
9939
+ "text": "string"
9940
+ },
9941
+ "description": "Selection announcement, \"other\" category and unset categories (default \"{count} rows selected\")",
9942
+ "fieldName": "data-label-selected-other"
9943
+ },
9788
9944
  {
9789
9945
  "name": "data-filterable",
9790
9946
  "type": {
@@ -26377,6 +26533,14 @@
26377
26533
  "static": true,
26378
26534
  "default": "20"
26379
26535
  },
26536
+ {
26537
+ "kind": "field",
26538
+ "name": "#TURNED_KEYS",
26539
+ "privacy": "private",
26540
+ "static": true,
26541
+ "default": "({ ArrowRight: 'ArrowDown', // first child ArrowLeft: 'ArrowUp', // parent ArrowDown: 'ArrowRight', // next sibling ArrowUp: 'ArrowLeft', // previous sibling })",
26542
+ "description": "Horizontal orientation: pressed arrow -> the vertical-layout arrow that makes the same tree move"
26543
+ },
26380
26544
  {
26381
26545
  "kind": "method",
26382
26546
  "name": "#parseVisualTree",
@@ -28322,6 +28486,257 @@
28322
28486
  }
28323
28487
  ]
28324
28488
  },
28489
+ {
28490
+ "kind": "javascript-module",
28491
+ "path": "src/web-components/social-feed/logic.js",
28492
+ "declarations": [
28493
+ {
28494
+ "kind": "class",
28495
+ "description": "GitHub accounts, in a scrolling region.\n\nCook fills an empty <social-feed> at build time: an <activity-feed> of\nentries (<article data-activity data-id>), a \"More on …\" line and a state\nJSON script. Without JavaScript that markup is the whole feature. With it:\n - once per page view, each account's first page is fetched from the\n service's public API, sending no credentials; posts not yet shown that\n fall inside the shown window are inserted in date order, and the\n counts on posts already shown are updated;\n - on activity-feed:load-more, the next batch comes from the state buffer\n first, then from each account that is not done, paged from its cursor\n (at most 3 pages per account per load, tag filter applied);\n - when every account is done and the buffer is empty, data-infinite is\n removed from the activity-feed so no more loads are asked for.\nEntries are deduped by id across everything shown (a repost of a shown\npost is the same id). Failures are silent: an account whose request fails\nis marked done and the shown entries stay.\n\nBrowser entries are rendered by the same renderEntry Cook uses, so they\nmatch the built ones; renderEntry applies safeHttps and escaping, and the\nbuffer from the state JSON is never trusted as markup.",
28496
+ "name": "SocialFeed",
28497
+ "members": [
28498
+ {
28499
+ "kind": "field",
28500
+ "name": "#state",
28501
+ "privacy": "private",
28502
+ "type": {
28503
+ "text": "FeedState | null"
28504
+ },
28505
+ "default": "null"
28506
+ },
28507
+ {
28508
+ "kind": "field",
28509
+ "name": "#queue",
28510
+ "privacy": "private",
28511
+ "description": "Serialises refresh and load-more so they never interleave."
28512
+ },
28513
+ {
28514
+ "kind": "field",
28515
+ "name": "#refresh",
28516
+ "privacy": "private",
28517
+ "type": {
28518
+ "text": "Promise<void> | null"
28519
+ },
28520
+ "default": "null"
28521
+ },
28522
+ {
28523
+ "kind": "method",
28524
+ "name": "setup"
28525
+ },
28526
+ {
28527
+ "kind": "method",
28528
+ "name": "teardown"
28529
+ },
28530
+ {
28531
+ "kind": "field",
28532
+ "name": "refreshed",
28533
+ "description": "Settles when this page view's refresh has finished (or at once when there is none).",
28534
+ "return": {
28535
+ "type": {
28536
+ "text": "Promise<void>"
28537
+ }
28538
+ },
28539
+ "readonly": true
28540
+ },
28541
+ {
28542
+ "kind": "method",
28543
+ "name": "#start",
28544
+ "privacy": "private"
28545
+ },
28546
+ {
28547
+ "kind": "method",
28548
+ "name": "#applyHeight",
28549
+ "privacy": "private"
28550
+ },
28551
+ {
28552
+ "kind": "method",
28553
+ "name": "#feed",
28554
+ "privacy": "private",
28555
+ "return": {
28556
+ "type": {
28557
+ "text": "HTMLElement | null"
28558
+ }
28559
+ }
28560
+ },
28561
+ {
28562
+ "kind": "method",
28563
+ "name": "#batchSize",
28564
+ "privacy": "private"
28565
+ },
28566
+ {
28567
+ "kind": "method",
28568
+ "name": "#enqueue",
28569
+ "privacy": "private",
28570
+ "parameters": [
28571
+ {
28572
+ "name": "task",
28573
+ "type": {
28574
+ "text": "() => Promise<void>"
28575
+ }
28576
+ }
28577
+ ]
28578
+ },
28579
+ {
28580
+ "kind": "method",
28581
+ "name": "#shown",
28582
+ "privacy": "private",
28583
+ "return": {
28584
+ "type": {
28585
+ "text": "Map<string, HTMLElement>"
28586
+ }
28587
+ }
28588
+ },
28589
+ {
28590
+ "kind": "method",
28591
+ "name": "#dateOf",
28592
+ "privacy": "private",
28593
+ "parameters": [
28594
+ {
28595
+ "name": "article",
28596
+ "type": {
28597
+ "text": "Element"
28598
+ }
28599
+ }
28600
+ ]
28601
+ },
28602
+ {
28603
+ "kind": "method",
28604
+ "name": "#render",
28605
+ "privacy": "private",
28606
+ "parameters": [
28607
+ {
28608
+ "name": "item",
28609
+ "type": {
28610
+ "text": "object"
28611
+ }
28612
+ },
28613
+ {
28614
+ "name": "hideCounts",
28615
+ "type": {
28616
+ "text": "boolean"
28617
+ }
28618
+ }
28619
+ ],
28620
+ "return": {
28621
+ "type": {
28622
+ "text": "HTMLElement | null"
28623
+ }
28624
+ }
28625
+ },
28626
+ {
28627
+ "kind": "method",
28628
+ "name": "#insert",
28629
+ "privacy": "private",
28630
+ "parameters": [
28631
+ {
28632
+ "name": "item"
28633
+ }
28634
+ ],
28635
+ "description": "Insert one item where its date puts it, keeping the list newest first."
28636
+ },
28637
+ {
28638
+ "kind": "method",
28639
+ "name": "#updateCounts",
28640
+ "privacy": "private",
28641
+ "parameters": [
28642
+ {
28643
+ "name": "article"
28644
+ },
28645
+ {
28646
+ "name": "item"
28647
+ }
28648
+ ],
28649
+ "description": "Replace the counts of a shown entry with the item's fresh ones."
28650
+ },
28651
+ {
28652
+ "kind": "method",
28653
+ "name": "#unseen",
28654
+ "privacy": "private",
28655
+ "parameters": [
28656
+ {
28657
+ "name": "lists",
28658
+ "type": {
28659
+ "text": "object[][]"
28660
+ }
28661
+ },
28662
+ {
28663
+ "name": "shown",
28664
+ "type": {
28665
+ "text": "Map<string, HTMLElement>"
28666
+ }
28667
+ }
28668
+ ],
28669
+ "description": "Items not shown, filtered by the block's tags, deduped and newest first."
28670
+ },
28671
+ {
28672
+ "kind": "method",
28673
+ "name": "#syncEnd",
28674
+ "privacy": "private",
28675
+ "description": "End the feed when nothing more can come; start it when entries arrived."
28676
+ },
28677
+ {
28678
+ "kind": "method",
28679
+ "name": "#doRefresh",
28680
+ "privacy": "private"
28681
+ },
28682
+ {
28683
+ "kind": "field",
28684
+ "name": "#onLoadMore",
28685
+ "privacy": "private",
28686
+ "type": {
28687
+ "text": "(e: Event) => void"
28688
+ }
28689
+ },
28690
+ {
28691
+ "kind": "method",
28692
+ "name": "#doLoadMore",
28693
+ "privacy": "private"
28694
+ }
28695
+ ],
28696
+ "attributes": [
28697
+ {
28698
+ "name": "accounts"
28699
+ },
28700
+ {
28701
+ "name": "tags"
28702
+ },
28703
+ {
28704
+ "name": "items"
28705
+ },
28706
+ {
28707
+ "name": "height"
28708
+ },
28709
+ {
28710
+ "name": "hide-counts"
28711
+ }
28712
+ ],
28713
+ "superclass": {
28714
+ "name": "VBElement",
28715
+ "module": "/src/lib/vb-element.js"
28716
+ },
28717
+ "tagName": "social-feed",
28718
+ "customElement": true
28719
+ }
28720
+ ],
28721
+ "exports": [
28722
+ {
28723
+ "kind": "custom-element-definition",
28724
+ "name": "social-feed",
28725
+ "declaration": {
28726
+ "name": "SocialFeed",
28727
+ "module": "src/web-components/social-feed/logic.js"
28728
+ }
28729
+ },
28730
+ {
28731
+ "kind": "js",
28732
+ "name": "SocialFeed",
28733
+ "declaration": {
28734
+ "name": "SocialFeed",
28735
+ "module": "src/web-components/social-feed/logic.js"
28736
+ }
28737
+ }
28738
+ ]
28739
+ },
28325
28740
  {
28326
28741
  "kind": "javascript-module",
28327
28742
  "path": "src/web-components/social-links/logic.js",
@@ -30953,7 +31368,7 @@
30953
31368
  "name": "brand"
30954
31369
  }
30955
31370
  ],
30956
- "description": "Default: the themes in one <select>, grouped when there are groups.\nThe legend is its only name source (no aria-label repeating the text)."
31371
+ "description": "Default: the themes in one <select>, grouped when there are groups.\nOne control needs no group: a visible <label> names it, once."
30957
31372
  },
30958
31373
  {
30959
31374
  "kind": "method",
@@ -1,2 +1,2 @@
1
- var O=window.matchMedia("(prefers-reduced-motion: reduce)");var p=new Map;function y(s,t,i={}){let e=i.priority??10,r={impl:t,bundle:i.bundle,contract:i.contract,priority:e},n=p.get(s);if(customElements.get(s)){if(!n||n.priority>=e){n&&n.priority===e&&n.impl!==t&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${i.bundle}".`);return}console.warn(`[VB Bundle] Tag <${s}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${i.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=e){n.priority===e&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${n.bundle}". Skipping "${i.bundle}" (first wins at equal priority).`);return}p.set(s,r),customElements.define(s,t)}var f=class extends HTMLElement{#i=[];#t;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#i)t();this.#i=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,i,e,r){t.addEventListener(i,e,r),this.#i.push(()=>t.removeEventListener(i,e,r))}_reinit(){for(let t of this.#i)t();this.#i=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,i){this.#t||(this.#t=this.attachInternals());let e=this.#t.states;try{i?e.add(t):e.delete(t)}catch{let r=`--${t}`;i?e.add(r):e.delete(r)}}_adoptInternals(t){this.#t||(this.#t=t)}#e(){return this.constructor.formAssociated&&this.#t?this.#t:null}get validity(){return this.#e()?.validity}get validationMessage(){return this.#e()?.validationMessage??""}get willValidate(){return this.#e()?.willValidate??!1}get form(){return this.#e()?.form??null}checkValidity(){return this.#e()?.checkValidity()??!0}reportValidity(){return this.#e()?.reportValidity()??!0}};function u(s){let t=(Date.now()-s.getTime())/1e3;if(Number.isNaN(t)||t<0)return null;if(t<60)return"just now";if(t<3600){let e=Math.floor(t/60);return`${e} minute${e!==1?"s":""} ago`}if(t<86400){let e=Math.floor(t/3600);return`${e} hour${e!==1?"s":""} ago`}if(t<2592e3){let e=Math.floor(t/86400);return`${e} day${e!==1?"s":""} ago`}if(t<31536e3){let e=Math.floor(t/2592e3);return`${e} month${e!==1?"s":""} ago`}let i=Math.floor(t/31536e3);return`${i} year${i!==1?"s":""} ago`}function v(s=document){for(let t of s.querySelectorAll("time[data-relative]")){if(t.closest("page-info"))continue;let i=t.getAttribute("datetime");if(!i)continue;let e=new Date(i),r=t.closest("[lang]")?.getAttribute("lang")||"",n=r&&!/^en\b/i.test(r)?w(e,r):u(e);n&&(t.textContent=n)}}function w(s,t){let i=(Date.now()-s.getTime())/1e3;if(Number.isNaN(i)||i<0)return null;let e;try{e=new Intl.RelativeTimeFormat(t,{numeric:"auto"})}catch{return u(s)}return i<60?e.format(0,"second"):i<3600?e.format(-Math.floor(i/60),"minute"):i<86400?e.format(-Math.floor(i/3600),"hour"):i<2592e3?e.format(-Math.floor(i/86400),"day"):i<31536e3?e.format(-Math.floor(i/2592e3),"month"):e.format(-Math.floor(i/31536e3),"year")}var h=typeof document<"u"?document.documentElement:null,g;function E(){v(),g||(g=setInterval(()=>v(),6e4))}h&&!h.hasAttribute("data-vb-time-relative-init")&&(h.setAttribute("data-vb-time-relative-init",""),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",E,{once:!0}):E());function m(s){let t=new Date(s);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}function S(s){let t=new Date(s),i=(t.getDay()+6)%7,e=new Date(t);e.setDate(t.getDate()-i);let r=new Date(e);r.setDate(e.getDate()+3);let n=new Date(r.getFullYear(),0,1),o=Math.ceil(((r.getTime()-n.getTime())/864e5+1)/7);return`${r.getFullYear()}-W${String(o).padStart(2,"0")}`}function $(s){let t=m(new Date),i=m(new Date(Date.now()-864e5));if(s===t)return"Today";if(s===i)return"Yesterday";let[e,r,n]=s.split("-").map(Number);return new Date(e,r-1,n).toLocaleDateString(void 0,{weekday:"long",month:"short",day:"numeric"})}function A(s){return s.nodeType===1&&s.matches("article[data-activity]")}function M(s){return`Week of ${s.replace("-W",", week ")}`}var C='a[href], area[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), summary, iframe, [contenteditable=""], [contenteditable="true"], [tabindex]:not([tabindex="-1"])',T=0,b=class extends f{static observedAttributes=["data-infinite"];#i=null;#t=null;#e=null;#a=null;#s=null;#d=`activity-feed-${++T}`;#g=0;#r=!1;#l=0;#u=!0;setup(){let t=this.getAttribute("role");return this.#u=t===null||t==="feed"||t==="group",!this.hasAttribute("aria-label")&&!this.hasAttribute("aria-labelledby")&&this.setAttribute("aria-label","Recent activity"),this.#r=!1,this.setAttribute("aria-busy","false"),this.#n().forEach(i=>this.#f(i)),this.hasAttribute("data-infinite")&&this.#y(),this.#o(),this.#p(),this.#i=new MutationObserver(i=>{let e=!1,r=!1;for(let n of i){for(let o of n.addedNodes)A(o)&&(this.#f(o),e=!0,r=!0);for(let o of n.removedNodes)A(o)&&(e=!0)}e&&(this.#o(),this.#p()),r&&this.#r&&this.#c()}),this.#i.observe(this,{childList:!0}),this.#a=setInterval(()=>this.#E(),6e4),this.listen(this,"keydown",this.#$),this.listen(this,"focusin",this.#S),!0}teardown(){this.#a!==null&&clearInterval(this.#a),this.#a=null,this.#i?.disconnect(),this.#i=null,this.#v(),this.#r=!1,this.setAttribute("aria-busy","false")}attributeChangedCallback(t,i,e){!this.hasAttribute("data-upgraded")||i===null==(e===null)||t==="data-infinite"&&(e!==null?this.#y():(this.#v(),this.#r&&this.#c()),this.#o())}#n(){return[...this.querySelectorAll(":scope > article[data-activity]")]}#f(t){if(t.dataset.decorated==="")return;t.dataset.decorated="",t.setAttribute("tabindex","-1");let i=`${this.#d}-e${++this.#g}`,e=t.querySelector(":scope > time[datetime]");e?.remove();let r=t.dataset.time||e?.getAttribute("datetime")||"";r&&!t.dataset.time&&(t.dataset.time=r);let n=document.createElement("div");for(n.className="activity-body",n.id=`${i}-body`;t.firstChild;)n.appendChild(t.firstChild);t.appendChild(n),!t.hasAttribute("aria-label")&&!t.hasAttribute("aria-labelledby")&&t.setAttribute("aria-labelledby",n.id);let o=t.dataset.activityAvatar,d=t.dataset.activityIcon;if(o||d){let a=document.createElement("div");if(a.className="activity-rail",a.setAttribute("aria-hidden","true"),o){let c=document.createElement("user-avatar"),l=document.createElement("img");l.src=o,l.alt="",l.loading="lazy",l.decoding="async",c.appendChild(l),a.appendChild(c)}else{let c=document.createElement("icon-wc");c.setAttribute("name",d||""),a.appendChild(c)}t.prepend(a)}if(r){let a=e||document.createElement("time");a.classList.add("activity-time"),a.setAttribute("datetime",r),a.id||(a.id=`${i}-time`),a.setAttribute("title",this.#A(r)),a.textContent=u(new Date(r))||a.textContent||r,t.appendChild(a)}}#E(){for(let t of this.querySelectorAll(":scope > article[data-activity] > time.activity-time")){let i=t.getAttribute("datetime");if(!i)continue;let e=u(new Date(i));e&&(t.textContent=e)}}#A(t){try{return new Date(t).toLocaleString()}catch{return t}}#o(){this.querySelectorAll(":scope > [data-activity-heading]").forEach(n=>n.remove());let t=this.#n(),i=this.#t?"-1":String(t.length),e=this.getAttribute("data-group")||"none",r=null;t.forEach((n,o)=>{n.setAttribute("aria-posinset",String(o+1)),n.setAttribute("aria-setsize",i);let d=[];if(e!=="none"&&n.dataset.time){let c=e==="week"?S(n.dataset.time):m(n.dataset.time);if(c!==r){let l=document.createElement("h3");l.setAttribute("data-activity-heading",""),l.setAttribute("aria-hidden","true"),l.id=`${this.#d}-g-${c}`,l.className="activity-heading",l.textContent=e==="week"?M(c):$(c),this.insertBefore(l,n),d.push(l.id),r=c}}let a=n.querySelector(":scope > time.activity-time");a?.id&&d.push(a.id),d.length?n.setAttribute("aria-describedby",d.join(" ")):n.removeAttribute("aria-describedby")}),this.#w(),this.#h()}#h(){let t=this.#t;t&&t.parentNode===this&&this.lastElementChild!==t&&this.appendChild(t)}#w(){let t=this.#n(),i=t.find(e=>e.getAttribute("tabindex")==="0")||t[0];for(let e of t)e.setAttribute("tabindex",e===i?"0":"-1")}#m(t){for(let i of this.#n())i.setAttribute("tabindex",i===t?"0":"-1")}#b(t){let e=(t instanceof Element?t:null)?.closest("article[data-activity]")??null;return e&&e.parentElement===this?e:null}#S=t=>{let i=this.#b(t.target);i&&i.getAttribute("tabindex")!=="0"&&this.#m(i)};#p(){let t=this.#n().length;t===0?this.#s||(this.#s=document.createElement("p"),this.#s.className="activity-empty",this.#s.textContent=this.getAttribute("data-empty-text")||"No recent activity",this.appendChild(this.#s),this.#h()):(this.#s?.remove(),this.#s=null),this.#u&&this.setAttribute("role",t===0?"group":"feed")}#$=t=>{let i=t.target;if(i.isContentEditable||i.matches?.("input, textarea, select"))return;let e=this.#n(),r=this.#b(t.target),n=r?e.indexOf(r):-1;if(n===-1)return;let o=i===r;if(t.ctrlKey&&(t.key==="Home"||t.key==="End")){let c=this.#M(t.key==="Home"?"before":"after");c&&(t.preventDefault(),c.focus());return}if(t.altKey||t.ctrlKey||t.metaKey)return;let d=n;switch(t.key){case"PageDown":d=Math.min(e.length-1,n+1);break;case"PageUp":d=Math.max(0,n-1);break;case"Home":if(!o)return;d=0;break;case"End":if(!o)return;d=e.length-1;break;default:return}t.preventDefault();let a=e[d];a&&(this.#m(a),a.focus())};#M(t){let i=[...document.querySelectorAll(C)].filter(r=>!this.contains(r)&&(r.checkVisibility?.()??!0));return t==="after"?i.find(r=>this.compareDocumentPosition(r)&Node.DOCUMENT_POSITION_FOLLOWING)||null:i.filter(r=>this.compareDocumentPosition(r)&Node.DOCUMENT_POSITION_PRECEDING).at(-1)||null}#y(){this.#t||!("IntersectionObserver"in window)||(this.querySelectorAll(":scope > .activity-sentinel").forEach(t=>t.remove()),this.#t=document.createElement("div"),this.#t.className="activity-sentinel",this.#t.setAttribute("aria-hidden","true"),this.appendChild(this.#t),this.#e=new IntersectionObserver(t=>{t.some(i=>i.isIntersecting)&&this.#C()},{rootMargin:"200px"}),this.#e.observe(this.#t))}#v(){this.#e?.disconnect(),this.#e=null,this.#t?.remove(),this.#t=null}#C(){if(this.#r)return;this.#r=!0,this.setAttribute("aria-busy","true");let t=++this.#l,i=()=>{this.#r&&t===this.#l&&this.#c()};this.dispatchEvent(new CustomEvent("activity-feed:load-more",{bubbles:!0,detail:{done:i}}))}#c(){this.#r=!1,this.setAttribute("aria-busy","false"),this.#e&&this.#t&&(this.#e.unobserve(this.#t),this.#e.observe(this.#t))}addEntry(t,i={}){let e=document.createElement("article");if(e.setAttribute("data-activity",""),e.dataset.time=t.time,t.avatar&&(e.dataset.activityAvatar=t.avatar),t.icon&&(e.dataset.activityIcon=t.icon),e.innerHTML=t.html,i.prepend){let r=this.#n()[0];r?this.insertBefore(e,r):this.appendChild(e)}else this.#t?this.insertBefore(e,this.#t):this.appendChild(e);return e}removeEntry(t){t?.matches?.("article[data-activity]")&&t.remove()}clear(){this.#n().forEach(t=>t.remove())}get entries(){return this.#n()}get loading(){return this.#r}};y("activity-feed",b);export{b as ActivityFeed};
1
+ var O=window.matchMedia("(prefers-reduced-motion: reduce)");var p=new Map;function y(s,t,i={}){let e=i.priority??10,r={impl:t,bundle:i.bundle,contract:i.contract,priority:e},n=p.get(s);if(customElements.get(s)){if(!n||n.priority>=e){n&&n.priority===e&&n.impl!==t&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${i.bundle}".`);return}console.warn(`[VB Bundle] Tag <${s}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${i.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=e){n.priority===e&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${n.bundle}". Skipping "${i.bundle}" (first wins at equal priority).`);return}p.set(s,r),customElements.define(s,t)}var f=class extends HTMLElement{#i=[];#t;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#i)t();this.#i=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,i,e,r){t.addEventListener(i,e,r),this.#i.push(()=>t.removeEventListener(i,e,r))}_reinit(){for(let t of this.#i)t();this.#i=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,i){this.#t||(this.#t=this.attachInternals());let e=this.#t.states;try{i?e.add(t):e.delete(t)}catch{let r=`--${t}`;i?e.add(r):e.delete(r)}}_adoptInternals(t){this.#t||(this.#t=t)}#e(){return this.constructor.formAssociated&&this.#t?this.#t:null}get validity(){return this.#e()?.validity}get validationMessage(){return this.#e()?.validationMessage??""}get willValidate(){return this.#e()?.willValidate??!1}get form(){return this.#e()?.form??null}checkValidity(){return this.#e()?.checkValidity()??!0}reportValidity(){return this.#e()?.reportValidity()??!0}};function u(s){let t=(Date.now()-s.getTime())/1e3;if(Number.isNaN(t)||t<0)return null;if(t<60)return"just now";if(t<3600){let e=Math.floor(t/60);return`${e} minute${e!==1?"s":""} ago`}if(t<86400){let e=Math.floor(t/3600);return`${e} hour${e!==1?"s":""} ago`}if(t<2592e3){let e=Math.floor(t/86400);return`${e} day${e!==1?"s":""} ago`}if(t<31536e3){let e=Math.floor(t/2592e3);return`${e} month${e!==1?"s":""} ago`}let i=Math.floor(t/31536e3);return`${i} year${i!==1?"s":""} ago`}function v(s=document){for(let t of s.querySelectorAll("time[data-relative]")){if(t.closest("page-info"))continue;let i=t.getAttribute("datetime");if(!i)continue;let e=new Date(i),r=t.closest("[lang]")?.getAttribute("lang")||"",n=r&&!/^en\b/i.test(r)?w(e,r):u(e);n&&(t.textContent=n)}}function w(s,t){let i=(Date.now()-s.getTime())/1e3;if(Number.isNaN(i)||i<0)return null;let e;try{e=new Intl.RelativeTimeFormat(t,{numeric:"auto"})}catch{return u(s)}return i<60?e.format(0,"second"):i<3600?e.format(-Math.floor(i/60),"minute"):i<86400?e.format(-Math.floor(i/3600),"hour"):i<2592e3?e.format(-Math.floor(i/86400),"day"):i<31536e3?e.format(-Math.floor(i/2592e3),"month"):e.format(-Math.floor(i/31536e3),"year")}var h=typeof document<"u"?document.documentElement:null,g;function E(){v(),g||(g=setInterval(()=>v(),6e4))}h&&!h.hasAttribute("data-vb-time-relative-init")&&(h.setAttribute("data-vb-time-relative-init",""),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",E,{once:!0}):E());function m(s){let t=new Date(s);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}function S(s){let t=new Date(s),i=(t.getDay()+6)%7,e=new Date(t);e.setDate(t.getDate()-i);let r=new Date(e);r.setDate(e.getDate()+3);let n=new Date(r.getFullYear(),0,1),o=Math.ceil(((r.getTime()-n.getTime())/864e5+1)/7);return`${r.getFullYear()}-W${String(o).padStart(2,"0")}`}function $(s){let t=m(new Date),i=m(new Date(Date.now()-864e5));if(s===t)return"Today";if(s===i)return"Yesterday";let[e,r,n]=s.split("-").map(Number);return new Date(e,r-1,n).toLocaleDateString(void 0,{weekday:"long",month:"short",day:"numeric"})}function A(s){return s.nodeType===1&&s.matches("article[data-activity]")}function M(s){return`Week of ${s.replace("-W",", week ")}`}var C='a[href], area[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), summary, iframe, [contenteditable=""], [contenteditable="true"], [tabindex]:not([tabindex="-1"])',T=0,b=class extends f{static observedAttributes=["data-infinite"];#i=null;#t=null;#e=null;#a=null;#s=null;#d=`activity-feed-${++T}`;#g=0;#r=!1;#l=0;#u=!0;setup(){let t=this.getAttribute("role");return this.#u=t===null||t==="feed"||t==="group",!this.hasAttribute("aria-label")&&!this.hasAttribute("aria-labelledby")&&this.setAttribute("aria-label","Recent activity"),this.#r=!1,this.setAttribute("aria-busy","false"),this.#n().forEach(i=>this.#f(i)),this.hasAttribute("data-infinite")&&this.#y(),this.#o(),this.#p(),this.#i=new MutationObserver(i=>{let e=!1,r=!1;for(let n of i){for(let o of n.addedNodes)A(o)&&(this.#f(o),e=!0,r=!0);for(let o of n.removedNodes)A(o)&&(e=!0)}e&&(this.#o(),this.#p()),r&&this.#r&&this.#c()}),this.#i.observe(this,{childList:!0}),this.#a=setInterval(()=>this.#E(),6e4),this.listen(this,"keydown",this.#$),this.listen(this,"focusin",this.#S),!0}teardown(){this.#a!==null&&clearInterval(this.#a),this.#a=null,this.#i?.disconnect(),this.#i=null,this.#v(),this.#r=!1,this.setAttribute("aria-busy","false")}attributeChangedCallback(t,i,e){!this.hasAttribute("data-upgraded")||i===null==(e===null)||t==="data-infinite"&&(e!==null?this.#y():(this.#v(),this.#r&&this.#c()),this.#o())}#n(){return[...this.querySelectorAll(":scope > article[data-activity]")]}#f(t){if(t.dataset.decorated==="")return;t.dataset.decorated="",t.setAttribute("tabindex","-1");let i=`${this.#d}-e${++this.#g}`,e=t.querySelector(":scope > time[datetime]");e?.remove();let r=t.dataset.time||e?.getAttribute("datetime")||"";r&&!t.dataset.time&&(t.dataset.time=r);let n=document.createElement("div");for(n.className="activity-body",n.id=`${i}-body`;t.firstChild;)n.appendChild(t.firstChild);t.appendChild(n),!t.hasAttribute("aria-label")&&!t.hasAttribute("aria-labelledby")&&t.setAttribute("aria-labelledby",n.id);let o=t.dataset.activityAvatar,d=t.dataset.activityIcon;if(o||d){let a=document.createElement("div");if(a.className="activity-rail",a.setAttribute("aria-hidden","true"),o){let l=document.createElement("user-avatar"),c=document.createElement("img");c.src=o,c.alt="",c.loading="lazy",c.decoding="async",l.appendChild(c),a.appendChild(l)}else{let l=document.createElement("icon-wc");l.setAttribute("name",d||""),a.appendChild(l)}t.prepend(a)}if(r){let a=e||document.createElement("time");a.classList.add("activity-time"),a.setAttribute("datetime",r),a.id||(a.id=`${i}-time`),a.setAttribute("title",this.#A(r)),a.textContent=u(new Date(r))||a.textContent||r,t.appendChild(a)}}#E(){for(let t of this.querySelectorAll(":scope > article[data-activity] > time.activity-time")){let i=t.getAttribute("datetime");if(!i)continue;let e=u(new Date(i));e&&(t.textContent=e)}}#A(t){try{return new Date(t).toLocaleString()}catch{return t}}#o(){this.querySelectorAll(":scope > [data-activity-heading]").forEach(n=>n.remove());let t=this.#n(),i=this.#t?"-1":String(t.length),e=this.getAttribute("data-group")||"none",r=null;t.forEach((n,o)=>{n.setAttribute("aria-posinset",String(o+1)),n.setAttribute("aria-setsize",i);let d=[];if(e!=="none"&&n.dataset.time){let l=e==="week"?S(n.dataset.time):m(n.dataset.time);if(l!==r){let c=document.createElement("h3");c.setAttribute("data-activity-heading",""),c.setAttribute("aria-hidden","true"),c.id=`${this.#d}-g-${l}`,c.className="activity-heading",c.textContent=e==="week"?M(l):$(l),this.insertBefore(c,n),d.push(c.id),r=l}}let a=n.querySelector(":scope > time.activity-time");a?.id&&d.push(a.id),d.length?n.setAttribute("aria-describedby",d.join(" ")):n.removeAttribute("aria-describedby")}),this.#w(),this.#h()}#h(){let t=this.#t;t&&t.parentNode===this&&this.lastElementChild!==t&&this.appendChild(t)}#w(){let t=this.#n(),i=t.find(e=>e.getAttribute("tabindex")==="0")||t[0];for(let e of t)e.setAttribute("tabindex",e===i?"0":"-1")}#m(t){for(let i of this.#n())i.setAttribute("tabindex",i===t?"0":"-1")}#b(t){let e=(t instanceof Element?t:null)?.closest("article[data-activity]")??null;return e&&e.parentElement===this?e:null}#S=t=>{let i=this.#b(t.target);i&&i.getAttribute("tabindex")!=="0"&&this.#m(i)};#p(){let t=this.#n().length;t===0?this.#s||(this.#s=document.createElement("p"),this.#s.className="activity-empty",this.#s.textContent=this.getAttribute("data-empty-text")||"No recent activity",this.appendChild(this.#s),this.#h()):(this.#s?.remove(),this.#s=null),this.#u&&this.setAttribute("role",t===0?"group":"feed")}#$=t=>{let i=t.target;if(i.isContentEditable||i.matches?.("input, textarea, select"))return;let e=this.#n(),r=this.#b(t.target),n=r?e.indexOf(r):-1;if(n===-1)return;if(t.ctrlKey&&(t.key==="Home"||t.key==="End")){let a=this.#M(t.key==="Home"?"before":"after");a&&(t.preventDefault(),a.focus());return}if(t.altKey||t.ctrlKey||t.metaKey)return;let o=n;switch(t.key){case"PageDown":o=Math.min(e.length-1,n+1);break;case"PageUp":o=Math.max(0,n-1);break;default:return}t.preventDefault();let d=e[o];d&&(this.#m(d),d.focus())};#M(t){let i=[...document.querySelectorAll(C)].filter(r=>!this.contains(r)&&(r.checkVisibility?.()??!0));return t==="after"?i.find(r=>this.compareDocumentPosition(r)&Node.DOCUMENT_POSITION_FOLLOWING)||null:i.filter(r=>this.compareDocumentPosition(r)&Node.DOCUMENT_POSITION_PRECEDING).at(-1)||null}#y(){this.#t||!("IntersectionObserver"in window)||(this.querySelectorAll(":scope > .activity-sentinel").forEach(t=>t.remove()),this.#t=document.createElement("div"),this.#t.className="activity-sentinel",this.#t.setAttribute("aria-hidden","true"),this.appendChild(this.#t),this.#e=new IntersectionObserver(t=>{t.some(i=>i.isIntersecting)&&this.#C()},{rootMargin:"200px"}),this.#e.observe(this.#t))}#v(){this.#e?.disconnect(),this.#e=null,this.#t?.remove(),this.#t=null}#C(){if(this.#r)return;this.#r=!0,this.setAttribute("aria-busy","true");let t=++this.#l,i=()=>{this.#r&&t===this.#l&&this.#c()};this.dispatchEvent(new CustomEvent("activity-feed:load-more",{bubbles:!0,detail:{done:i}}))}#c(){this.#r=!1,this.setAttribute("aria-busy","false"),this.#e&&this.#t&&(this.#e.unobserve(this.#t),this.#e.observe(this.#t))}addEntry(t,i={}){let e=document.createElement("article");if(e.setAttribute("data-activity",""),e.dataset.time=t.time,t.avatar&&(e.dataset.activityAvatar=t.avatar),t.icon&&(e.dataset.activityIcon=t.icon),e.innerHTML=t.html,i.prepend){let r=this.#n()[0];r?this.insertBefore(e,r):this.appendChild(e)}else this.#t?this.insertBefore(e,this.#t):this.appendChild(e);return e}removeEntry(t){t?.matches?.("article[data-activity]")&&t.remove()}clear(){this.#n().forEach(t=>t.remove())}get entries(){return this.#n()}get loading(){return this.#r}};y("activity-feed",b);export{b as ActivityFeed};
2
2
  //# sourceMappingURL=activity-feed.js.map
@@ -1,2 +1,2 @@
1
- var $=window.matchMedia("(prefers-reduced-motion: reduce)");var A=new Map;function y(u,t,e={}){let s=e.priority??10,n={impl:t,bundle:e.bundle,contract:e.contract,priority:s},i=A.get(u);if(customElements.get(u)){if(!i||i.priority>=s){i&&i.priority===s&&i.impl!==t&&console.warn(`[VB Bundle] Tag <${u}> already registered by "${i.bundle}" (priority ${i.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${u}> defined by "${i.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(i&&i.priority>=s){i.priority===s&&console.warn(`[VB Bundle] Tag <${u}> already registered by "${i.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}A.set(u,n),customElements.define(u,t)}var m=class extends HTMLElement{#e=[];#t;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#e)t();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,s,n){t.addEventListener(e,s,n),this.#e.push(()=>t.removeEventListener(e,s,n))}_reinit(){for(let t of this.#e)t();this.#e=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#t||(this.#t=this.attachInternals());let s=this.#t.states;try{e?s.add(t):s.delete(t)}catch{let n=`--${t}`;e?s.add(n):s.delete(n)}}_adoptInternals(t){this.#t||(this.#t=t)}#r(){return this.constructor.formAssociated&&this.#t?this.#t:null}get validity(){return this.#r()?.validity}get validationMessage(){return this.#r()?.validationMessage??""}get willValidate(){return this.#r()?.willValidate??!1}get form(){return this.#r()?.form??null}checkValidity(){return this.#r()?.checkValidity()??!0}reportValidity(){return this.#r()?.reportValidity()??!0}};function E({newItems:u,nodes:t,keyOf:e,renderItem:s,containerFor:n}){let i=[],a=[],c=[],o=new Set;for(let d of u)o.add(e(d));for(let[d,l]of[...t])o.has(d)||(l.remove(),t.delete(d),c.push(d));let r=new Map;for(let d of u){let l=e(d),h=t.get(l)||null,f=n(d,h);r.has(f)||r.set(f,[]),r.get(f)?.push({item:d,key:l,existing:h})}for(let[d,l]of r)for(let h=0;h<l.length;h++){let{item:f,key:p,existing:x}=l[h],b=x;b?(b.parentElement!==d||d.children[h]!==b)&&a.push(p):(b=s(f),t.set(p,b),i.push(p));let w=d.children[h];w!==b&&d.insertBefore(b,w||null)}return{added:i,moved:a,removed:c}}var g=":scope > tr:not([data-expand-content])",v=class u extends m{#e;#t;#r=[];#s=[];#n=[];#c=-1;#d=null;#i=1;#a=0;#u=null;#h=null;#f=null;#l="";#o=null;#C=null;#m=null;#p=null;#g=[];#S=new Map;#v=[];setup(){return this.#e=this.querySelector(":scope > table"),!this.#e||(this.#t=this.#e.querySelector("tbody"),!this.#t)?!1:(this.#V(),!0)}teardown(){this.#O(),this.#r=[],this.#s=[],this.#n=[]}#V(){this.#s=[...this.#t.querySelectorAll(g)],this.#n=[...this.#s],this.#i=1,this.#c=-1,this.#d=null,this.#l="",this.#a=0,this.#v=[...this.#e.tHead?.rows[0]?.cells||[]].map(e=>({key:e.getAttribute("data-key")||e.textContent.trim().toLowerCase(),label:e.textContent.trim(),sort:e.getAttribute("data-sort")||void 0})),this.#S.clear(),this.#g=[];for(let e of this.#s){let s=e.getAttribute("data-id")||e.getAttribute("data-key");s&&(this.#S.set(s,e),this.#g.push({id:s}))}this.#H(),this.#k(),this.#$(),this.#j(),this.#D(),this.#e.hasAttribute("data-filterable")&&this.#J();let t=this.#e.getAttribute("data-paginate");t&&(this.#a=parseInt(t,10),this.#a>0&&this.#X()),this.#Y(),this.#N(),this.#E()}get rows(){return this.#g}set rows(t){let e=t||[],s=E({newItems:e,nodes:this.#S,keyOf:n=>n.id,renderItem:n=>this._renderRow(n),containerFor:()=>this.#t});this.#g=e,this.#s=[...this.#t.querySelectorAll(g)],this.#k(),this.#$(),this.#y(this.#l),this.dispatchEvent(new CustomEvent("data-table:rows-changed",{detail:{rows:e,added:s.added,moved:s.moved,removed:s.removed,source:"api"},bubbles:!0}))}get columns(){return this.#v}_renderRow(t){let e=this;if(typeof e.renderRow=="function"){let n=e.renderRow(t,this.#v);if(!(n instanceof Element))throw new Error("data-table: renderRow must return an Element");return n.hasAttribute("data-id")||n.setAttribute("data-id",String(t.id)),n}let s=document.createElement("tr");s.setAttribute("data-id",String(t.id));for(let n of this.#v){let i=document.createElement("td"),a=t[n.key];i.textContent=a==null?"":String(a),s.appendChild(i)}return s}#q=[];#b=[];#w=[];#H(){let t=[...this.#e.tHead?.rows[0]?.cells||[]];this.#q=t.map(e=>{let s=parseFloat(e.getAttribute("data-weight"));return Number.isFinite(s)?s:null}),this.#b=t.map(e=>e.getAttribute("data-rollup")||null),this.#w=t.map(e=>e.getAttribute("data-heatmap")||null)}#k(){if(this.#b.some(Boolean))for(let t=0;t<this.#b.length;t++){let e=this.#b[t];if(e)for(let s of this.#s){let n=s.children[t];if(!n)continue;let i=this.#I(s,t,e),a=u.#_(i);n.textContent=a,n.setAttribute("data-rollup-value",String(i)),n.hasAttribute("data-sort-value")||n.setAttribute("data-sort-value",String(i))}}}#I(t,e,s){let n=[...t.children],i=0,a=0,c=-1/0,o=0,r=1,d=!1;for(let l=0;l<n.length;l++){if(l===e||this.#b[l])continue;let h=n[l].getAttribute("data-sort-value")??n[l].textContent??"",f=parseFloat(h);if(!Number.isFinite(f))continue;i+=f,a++,f>c&&(c=f),r*=f,d=!0;let p=this.#q[l];p!==null&&(o+=f*p)}switch(s){case"sum":return i;case"avg":return a?i/a:0;case"max":return c===-1/0?0:c;case"weighted-sum":return o;case"product":return d?r:0;default:return i}}static#_(t){return Number.isFinite(t)?Number.isInteger(t)?String(t):(Math.round(t*100)/100).toString():""}#$(){if(this.#w.some(Boolean))for(let t=0;t<this.#w.length;t++){let e=this.#w[t];if(!e)continue;let s=this.#s.map(o=>{let r=o.children[t];if(!r)return null;let d=r.getAttribute("data-rollup-value")??r.getAttribute("data-sort-value")??r.textContent??"",l=parseFloat(d);return Number.isFinite(l)?l:null}),n=s.filter(o=>o!==null);if(!n.length)continue;let i=Math.min(...n),c=Math.max(...n)-i||1;for(let o=0;o<this.#s.length;o++){let r=this.#s[o].children[t];if(!r)continue;let d=s[o];if(d===null){r.removeAttribute("data-heat-level");continue}let l=(d-i)/c;e==="low-good"&&(l=1-l);let h=l<.34?"low":l<.67?"mid":"high";r.setAttribute("data-heat-level",h)}}}#O(){this.#f&&clearTimeout(this.#f),this.#u?.parentElement?.remove(),this.#h?.remove(),this.#m?.remove(),this.#p?.remove(),this.#u=null,this.#h=null,this.#m=null,this.#p=null}#P(t,e){return this.dataset[`label${t}`]||e}#j(){let t=document.createElement("span");t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),t.setAttribute("data-table-status",""),t.className="visually-hidden",this.appendChild(t),this.#m=t}#M(t){let e=this.#m;e&&(e.textContent=e.textContent===t?`${t}\xA0`:t)}#D(){this.#e.querySelectorAll("thead th[data-sort]").forEach((e,s)=>{let n=e.getAttribute("data-sort"),i=this.#z(e);this.#r.push({th:e,sortType:n,columnIndex:i}),e.setAttribute("aria-sort","none"),u.#K(e),e.dataset.columnIndex=i,this.listen(e,"click",this.#Q)})}static#K(t){if(t.querySelector(":scope > button[data-sort-button]"))return;let e=document.createElement("button");e.type="button",e.setAttribute("data-sort-button",""),e.append(...t.childNodes),t.appendChild(e)}#z(t){return[...t.parentElement.children].indexOf(t)}#Q=t=>{let e=t.currentTarget,s=t.target.closest?.("a, input, select, textarea, button:not([data-sort-button])");if(s&&e.contains(s))return;let n=parseInt(e.dataset.columnIndex,10);this.#G(n)};#W(t,e,s){let n=this.#n;if(n.length<2)return!0;let i=s==="asc"?1:-1;for(let a=1;a<n.length;a++){let c=this.#A(n[a-1].children[t],e),o=this.#A(n[a].children[t],e);if((typeof c=="string"?c.localeCompare(o)*i:(c-o)*i)>0)return!1}return!0}#G(t){let e=this.#r.find(i=>i.columnIndex===t);if(!e)return;let s;this.#c===t?s=this.#d==="asc"?"desc":"asc":this.#W(t,e.sortType,"asc")?s="desc":s="asc",this.#r.forEach(({th:i})=>{i.setAttribute("aria-sort","none")}),e.th.setAttribute("aria-sort",s==="asc"?"ascending":"descending"),this.#c=t,this.#d=s,this.#B(t,s,e.sortType),this.#i=1,this.#E();let n=e.th.textContent.trim();this.#M(`Sorted by ${n}, ${s==="asc"?"ascending":"descending"}`),this.dispatchEvent(new CustomEvent("data-table:sort",{detail:{column:t,direction:s,columnName:n},bubbles:!0}))}#B(t,e,s){let n=e==="asc"?1:-1;this.#n.sort((i,a)=>{let c=i.children[t],o=a.children[t];if(!c||!o)return 0;let r=this.#A(c,s),d=this.#A(o,s),l=0;switch(s){case"number":l=r-d;break;case"date":l=r-d;break;default:l=r.localeCompare(d,void 0,{numeric:!0,sensitivity:"base"});break}return l*n})}#A(t,e){let n=t.getAttribute("data-sort-value")??t.textContent.trim();switch(e){case"number":return parseFloat(n)||0;case"date":return new Date(n).getTime()||0;default:return n.toLowerCase()}}#J(){let t=document.createElement("div");t.setAttribute("data-table-filter","");let e=document.createElement("input");e.type="search",e.setAttribute("data-filter-input",""),e.setAttribute("placeholder","Filter table..."),e.setAttribute("aria-label","Filter table rows"),t.appendChild(e),this.insertBefore(t,this.#e),this.#u=e;let s=document.createElement("p");s.setAttribute("data-table-empty",""),s.hidden=!0,s.textContent=this.#P("NoResults","No matching rows found"),this.#e.after(s),this.#p=s,this.listen(e,"input",this.#U)}#U=t=>{let e=t.target.value;this.#f&&clearTimeout(this.#f),this.#f=setTimeout(()=>{this.#y(e,{announce:!0})},150)};#y(t,{announce:e=!1,keepPage:s=!1}={}){if(this.#l=String(t??"").toLowerCase().trim(),this.#l===""?this.#n=[...this.#s]:this.#n=this.#s.filter(n=>[...n.children].some(a=>(a.getAttribute("data-filter-value")??a.textContent).toLowerCase().includes(this.#l))),this.#c>=0&&this.#d){let n=this.#r.find(i=>i.columnIndex===this.#c);n&&this.#B(this.#c,this.#d,n.sortType)}if(s?this.#i=Math.min(this.#i,this.totalPages):this.#i=1,this.#E(),e){let n=this.#n.length,i=this.#s.length;this.#M(n===0?this.#P("NoResults","No matching rows found"):this.#l?`${n} of ${i} ${i===1?"row":"rows"} shown`:`All ${i} ${i===1?"row":"rows"} shown`)}this.dispatchEvent(new CustomEvent("data-table:filter",{detail:{query:this.#l,count:this.#n.length},bubbles:!0}))}#X(){let t=document.createElement("nav");t.setAttribute("data-pagination",""),t.setAttribute("aria-label","Table pagination"),this.appendChild(t),this.#h=t}#Y(){for(let t of this.#t.querySelectorAll(":scope > tr[data-expandable]")){let e=t.querySelector('[data-action="toggle-expand"]');e&&e.setAttribute("aria-expanded",String(t.hasAttribute("data-state-expanded")))}this.listen(this.#e,"click",this.#Z)}#Z=t=>{let e=t.target.closest('[data-action="toggle-expand"]');if(!e)return;let s=e.closest("tr[data-expandable]");if(!s)return;let n=s.hasAttribute("data-state-expanded"),i=s.nextElementSibling;n?(s.removeAttribute("data-state-expanded"),e.setAttribute("aria-expanded","false"),i?.hasAttribute("data-expand-content")&&(i.hidden=!0,i.setAttribute("aria-hidden","true"))):(s.setAttribute("data-state-expanded",""),e.setAttribute("aria-expanded","true"),i?.hasAttribute("data-expand-content")&&(i.hidden=!1,i.removeAttribute("aria-hidden"))),this.dispatchEvent(new CustomEvent("data-table:expand",{detail:{row:s,expanded:!n},bubbles:!0}))};#N(){this.#o=this.#e.querySelector('thead [data-action="select-all"]'),this.#o&&this.listen(this.#o,"change",this.#tt),this.listen(this.#t,"change",this.#et),this.#C=this.querySelector("[data-selected-count]"),this.#T()}#tt=t=>{let e=t.target.checked;this.#t.querySelectorAll("tr[data-selectable]").forEach(n=>{let i=n.querySelector('[data-action="select-row"]');e?(n.setAttribute("data-state-selected",""),i&&(i.checked=!0)):(n.removeAttribute("data-state-selected"),i&&(i.checked=!1))}),t.target.indeterminate=!1,this.#R(),this.#L(),this.#F()};#et=t=>{let e=t.target.closest('[data-action="select-row"]');if(!e)return;let s=e.closest("tr[data-selectable]");s&&(e.checked?s.setAttribute("data-state-selected",""):s.removeAttribute("data-state-selected"),this.#T(),this.#L(),this.#F())};#L(){let t=this.getSelectedRows().length;this.#M(`${t} ${t===1?"row":"rows"} selected`)}#T(){if(!this.#o){this.#R();return}let t=this.#t.querySelectorAll("tr[data-selectable]"),e=this.#t.querySelectorAll("tr[data-selectable][data-state-selected]"),s=t.length,n=e.length;n===0?(this.#o.checked=!1,this.#o.indeterminate=!1):n===s?(this.#o.checked=!0,this.#o.indeterminate=!1):(this.#o.checked=!1,this.#o.indeterminate=!0),this.#R()}#R(){let e=this.#t.querySelectorAll("tr[data-selectable][data-state-selected]").length;this.#C&&(this.#C.textContent=e)}#F(){let t=[...this.#t.querySelectorAll("tr[data-selectable][data-state-selected]")];this.dispatchEvent(new CustomEvent("data-table:selection",{detail:{count:t.length,rows:t},bubbles:!0}))}#st(){if(!this.#h||this.#a<=0)return;let t=this.#h,e=Math.ceil(this.#n.length/this.#a),s=document.activeElement,n=null;if(s instanceof HTMLElement&&t.contains(s)&&(n=s.hasAttribute("data-pagination-prev")?"prev":s.hasAttribute("data-pagination-next")?"next":"page"),t.replaceChildren(),e<=1)return;let i=document.createElement("button");i.type="button",i.textContent="Previous",i.setAttribute("data-pagination-prev",""),i.disabled=this.#i===1,i.addEventListener("click",()=>this.goToPage(this.#i-1)),t.appendChild(i),this.#nt(e).forEach(o=>{if(o==="..."){let r=document.createElement("span");r.textContent="...",r.setAttribute("data-pagination-ellipsis",""),t.appendChild(r)}else{let r=document.createElement("button");r.type="button",r.textContent=o,r.setAttribute("data-pagination-page",""),o===this.#i&&(r.setAttribute("aria-current","page"),r.setAttribute("data-current","")),r.addEventListener("click",()=>this.goToPage(o)),t.appendChild(r)}});let c=document.createElement("button");if(c.type="button",c.textContent="Next",c.setAttribute("data-pagination-next",""),c.disabled=this.#i===e,c.addEventListener("click",()=>this.goToPage(this.#i+1)),t.appendChild(c),n){let o=t.querySelector('[aria-current="page"]');(n==="prev"&&!i.disabled?i:n==="next"&&!c.disabled?c:o)?.focus()}}#nt(t){let e=this.#i,s=[];if(t<=7)for(let n=1;n<=t;n++)s.push(n);else{s.push(1),e>3&&s.push("...");let n=Math.max(2,e-1),i=Math.min(t-1,e+1);for(let a=n;a<=i;a++)s.push(a);e<t-2&&s.push("..."),s.push(t)}return s}#E(){this.#s.forEach(s=>{s.setAttribute("data-state-hidden",""),this.#x(s)?.setAttribute("data-state-hidden","")});let t;if(this.#a>0){let s=(this.#i-1)*this.#a,n=s+this.#a;t=this.#n.slice(s,n)}else t=this.#n;t.forEach(s=>{s.removeAttribute("data-state-hidden");let n=this.#x(s);this.#t.appendChild(s),n&&(n.removeAttribute("data-state-hidden"),this.#t.appendChild(n))}),this.#n.forEach(s=>{if(s.hasAttribute("data-state-hidden")){let n=this.#x(s);this.#t.appendChild(s),n&&this.#t.appendChild(n)}});let e=new Set(this.#n);this.#s.forEach(s=>{if(!e.has(s)){let n=this.#x(s);this.#t.appendChild(s),n&&this.#t.appendChild(n)}}),this.#p&&(this.#p.hidden=!(this.#l&&this.#n.length===0&&this.#s.length>0)),this.#st()}#x(t){if(!t.hasAttribute("data-expandable"))return null;let e=t.nextElementSibling;return e?.hasAttribute("data-expand-content")?e:null}goToPage(t){if(this.#a<=0)return;let e=Math.max(1,Math.ceil(this.#n.length/this.#a)),s=Math.max(1,Math.min(Math.trunc(Number(t))||1,e));s!==this.#i&&(this.#i=s,this.#E(),this.dispatchEvent(new CustomEvent("data-table:page",{detail:{page:this.#i},bubbles:!0})))}setFilter(t){this.#u&&(this.#u.value=t),this.#y(t,{announce:!0})}refresh(){this.#t&&(this.#s=[...this.#t.querySelectorAll(g)],this.#k(),this.#$(),this.#y(this.#l,{keepPage:!0}),this.#T())}get currentPage(){return this.#i}get totalPages(){return this.#a<=0?1:Math.max(1,Math.ceil(this.#n.length/this.#a))}get filteredCount(){return this.#n.length}get totalCount(){return this.#s.length}getSelectedRows(){return this.#t?[...this.#t.querySelectorAll("tr[data-selectable][data-state-selected]")]:[]}};y("data-table",v);export{v as DataTable};
1
+ var q=window.matchMedia("(prefers-reduced-motion: reduce)");var E=new Map;function C(u,t,e={}){let n=e.priority??10,s={impl:t,bundle:e.bundle,contract:e.contract,priority:n},i=E.get(u);if(customElements.get(u)){if(!i||i.priority>=n){i&&i.priority===n&&i.impl!==t&&console.warn(`[VB Bundle] Tag <${u}> already registered by "${i.bundle}" (priority ${i.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${u}> defined by "${i.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(i&&i.priority>=n){i.priority===n&&console.warn(`[VB Bundle] Tag <${u}> already registered by "${i.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}E.set(u,s),customElements.define(u,t)}var m=class extends HTMLElement{#e=[];#t;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#e)t();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,n,s){t.addEventListener(e,n,s),this.#e.push(()=>t.removeEventListener(e,n,s))}_reinit(){for(let t of this.#e)t();this.#e=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#t||(this.#t=this.attachInternals());let n=this.#t.states;try{e?n.add(t):n.delete(t)}catch{let s=`--${t}`;e?n.add(s):n.delete(s)}}_adoptInternals(t){this.#t||(this.#t=t)}#r(){return this.constructor.formAssociated&&this.#t?this.#t:null}get validity(){return this.#r()?.validity}get validationMessage(){return this.#r()?.validationMessage??""}get willValidate(){return this.#r()?.willValidate??!1}get form(){return this.#r()?.form??null}checkValidity(){return this.#r()?.checkValidity()??!0}reportValidity(){return this.#r()?.reportValidity()??!0}};function S({newItems:u,nodes:t,keyOf:e,renderItem:n,containerFor:s}){let i=[],a=[],c=[],o=new Set;for(let d of u)o.add(e(d));for(let[d,l]of[...t])o.has(d)||(l.remove(),t.delete(d),c.push(d));let r=new Map;for(let d of u){let l=e(d),h=t.get(l)||null,f=s(d,h);r.has(f)||r.set(f,[]),r.get(f)?.push({item:d,key:l,existing:h})}for(let[d,l]of r)for(let h=0;h<l.length;h++){let{item:f,key:p,existing:$}=l[h],b=$;b?(b.parentElement!==d||d.children[h]!==b)&&a.push(p):(b=n(f),t.set(p,b),i.push(p));let x=d.children[h];x!==b&&d.insertBefore(b,x||null)}return{added:i,moved:a,removed:c}}function g(u,t){return u.replace(/\{(\w+)\}/g,(e,n)=>n in t?String(t[n]):e)}function v(u){return k(u&&u.closest("[lang]")?.lang||document.documentElement.lang||navigator.language||"en")}function k(u,t="en-US"){try{if(u)return Intl.getCanonicalLocales(u),u}catch{}try{return Intl.getCanonicalLocales(t),t}catch{return"en-US"}}var A={"no-results":"No matching rows found",filter:"Filter table rows",placeholder:"Filter table...",pagination:"Table pagination",prev:"Previous",next:"Next",sorted:"Sorted by {column}, {direction}",ascending:"ascending",descending:"descending","filtered-one":"{count} of {total} row shown","filtered-other":"{count} of {total} rows shown","all-one":"All {total} row shown","all-other":"All {total} rows shown","selected-one":"{count} row selected","selected-other":"{count} rows selected"},w=":scope > tr:not([data-expand-content])",y=class u extends m{#e;#t;#r=[];#n=[];#s=[];#d=-1;#h=null;#i=1;#a=0;#f=null;#p=null;#b=null;#c="";#o=null;#$=null;#g=null;#u=null;#v=[];#k=new Map;#A=[];setup(){return this.#e=this.querySelector(":scope > table"),!this.#e||(this.#t=this.#e.querySelector("tbody"),!this.#t)?!1:(this.#H(),!0)}teardown(){this.#D(),this.#r=[],this.#n=[],this.#s=[]}#H(){this.#n=[...this.#t.querySelectorAll(w)],this.#s=[...this.#n],this.#i=1,this.#d=-1,this.#h=null,this.#c="",this.#a=0,this.#A=[...this.#e.tHead?.rows[0]?.cells||[]].map(e=>({key:e.getAttribute("data-key")||e.textContent.trim().toLowerCase(),label:e.textContent.trim(),sort:e.getAttribute("data-sort")||void 0})),this.#k.clear(),this.#v=[];for(let e of this.#n){let n=e.getAttribute("data-id")||e.getAttribute("data-key");n&&(this.#k.set(n,e),this.#v.push({id:n}))}this.#_(),this.#L(),this.#M(),this.#K(),this.#z(),this.#e.hasAttribute("data-filterable")&&this.#X();let t=this.#e.getAttribute("data-paginate");t&&(this.#a=parseInt(t,10),this.#a>0&&this.#N()),this.#Z(),this.#et(),this.#C()}get rows(){return this.#v}set rows(t){let e=t||[],n=S({newItems:e,nodes:this.#k,keyOf:s=>s.id,renderItem:s=>this._renderRow(s),containerFor:()=>this.#t});this.#v=e,this.#n=[...this.#t.querySelectorAll(w)],this.#L(),this.#M(),this.#E(this.#c),this.dispatchEvent(new CustomEvent("data-table:rows-changed",{detail:{rows:e,added:n.added,moved:n.moved,removed:n.removed,source:"api"},bubbles:!0}))}get columns(){return this.#A}_renderRow(t){let e=this;if(typeof e.renderRow=="function"){let s=e.renderRow(t,this.#A);if(!(s instanceof Element))throw new Error("data-table: renderRow must return an Element");return s.hasAttribute("data-id")||s.setAttribute("data-id",String(t.id)),s}let n=document.createElement("tr");n.setAttribute("data-id",String(t.id));for(let s of this.#A){let i=document.createElement("td"),a=t[s.key];i.textContent=a==null?"":String(a),n.appendChild(i)}return n}#P=[];#m=[];#w=[];#_(){let t=[...this.#e.tHead?.rows[0]?.cells||[]];this.#P=t.map(e=>{let n=parseFloat(e.getAttribute("data-weight"));return Number.isFinite(n)?n:null}),this.#m=t.map(e=>e.getAttribute("data-rollup")||null),this.#w=t.map(e=>e.getAttribute("data-heatmap")||null)}#L(){if(this.#m.some(Boolean))for(let t=0;t<this.#m.length;t++){let e=this.#m[t];if(e)for(let n of this.#n){let s=n.children[t];if(!s)continue;let i=this.#O(n,t,e),a=u.#j(i);s.textContent=a,s.setAttribute("data-rollup-value",String(i)),s.hasAttribute("data-sort-value")||s.setAttribute("data-sort-value",String(i))}}}#O(t,e,n){let s=[...t.children],i=0,a=0,c=-1/0,o=0,r=1,d=!1;for(let l=0;l<s.length;l++){if(l===e||this.#m[l])continue;let h=s[l].getAttribute("data-sort-value")??s[l].textContent??"",f=parseFloat(h);if(!Number.isFinite(f))continue;i+=f,a++,f>c&&(c=f),r*=f,d=!0;let p=this.#P[l];p!==null&&(o+=f*p)}switch(n){case"sum":return i;case"avg":return a?i/a:0;case"max":return c===-1/0?0:c;case"weighted-sum":return o;case"product":return d?r:0;default:return i}}static#j(t){return Number.isFinite(t)?Number.isInteger(t)?String(t):(Math.round(t*100)/100).toString():""}#M(){if(this.#w.some(Boolean))for(let t=0;t<this.#w.length;t++){let e=this.#w[t];if(!e)continue;let n=this.#n.map(o=>{let r=o.children[t];if(!r)return null;let d=r.getAttribute("data-rollup-value")??r.getAttribute("data-sort-value")??r.textContent??"",l=parseFloat(d);return Number.isFinite(l)?l:null}),s=n.filter(o=>o!==null);if(!s.length)continue;let i=Math.min(...s),c=Math.max(...s)-i||1;for(let o=0;o<this.#n.length;o++){let r=this.#n[o].children[t];if(!r)continue;let d=n[o];if(d===null){r.removeAttribute("data-heat-level");continue}let l=(d-i)/c;e==="low-good"&&(l=1-l);let h=l<.34?"low":l<.67?"mid":"high";r.setAttribute("data-heat-level",h)}}}#D(){this.#b&&clearTimeout(this.#b),this.#f?.parentElement?.remove(),this.#p?.remove(),this.#g?.remove(),this.#u?.remove(),this.#f=null,this.#p=null,this.#g=null,this.#u=null}#l(t){return this.getAttribute(`data-label-${t}`)||A[t]||""}#B(t,e,n){let s="other";try{s=new Intl.PluralRules(v(this)).select(e)}catch{}let i=this.getAttribute(`data-label-${t}-${s}`)||this.getAttribute(`data-label-${t}-other`)||A[`${t}-${s}`]||A[`${t}-other`];return g(i,n)}#y(t){return new Intl.NumberFormat(v(this)).format(t)}#K(){let t=document.createElement("span");t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),t.setAttribute("data-table-status",""),t.className="visually-hidden",this.appendChild(t),this.#g=t}#T(t){let e=this.#g;e&&(e.textContent=e.textContent===t?`${t}\xA0`:t)}#z(){this.#e.querySelectorAll("thead th[data-sort]").forEach((e,n)=>{let s=e.getAttribute("data-sort"),i=this.#G(e);this.#r.push({th:e,sortType:s,columnIndex:i}),e.setAttribute("aria-sort","none"),u.#U(e),e.dataset.columnIndex=i,this.listen(e,"click",this.#W)})}static#U(t){if(t.querySelector(":scope > button[data-sort-button]"))return;let e=document.createElement("button");e.type="button",e.setAttribute("data-sort-button",""),e.append(...t.childNodes),t.appendChild(e)}#G(t){return[...t.parentElement.children].indexOf(t)}#W=t=>{let e=t.currentTarget,n=t.target.closest?.("a, input, select, textarea, button:not([data-sort-button])");if(n&&e.contains(n))return;let s=parseInt(e.dataset.columnIndex,10);this.#Q(s)};#J(t,e,n){let s=this.#s;if(s.length<2)return!0;let i=n==="asc"?1:-1;for(let a=1;a<s.length;a++){let c=this.#x(s[a-1].children[t],e),o=this.#x(s[a].children[t],e);if((typeof c=="string"?c.localeCompare(o)*i:(c-o)*i)>0)return!1}return!0}#Q(t){let e=this.#r.find(i=>i.columnIndex===t);if(!e)return;let n;this.#d===t?n=this.#h==="asc"?"desc":"asc":this.#J(t,e.sortType,"asc")?n="desc":n="asc",this.#r.forEach(({th:i})=>{i.setAttribute("aria-sort","none")}),e.th.setAttribute("aria-sort",n==="asc"?"ascending":"descending"),this.#d=t,this.#h=n,this.#F(t,n,e.sortType),this.#i=1,this.#C();let s=e.th.textContent.trim();this.#T(g(this.#l("sorted"),{column:s,direction:this.#l(n==="asc"?"ascending":"descending")})),this.dispatchEvent(new CustomEvent("data-table:sort",{detail:{column:t,direction:n,columnName:s},bubbles:!0}))}#F(t,e,n){let s=e==="asc"?1:-1;this.#s.sort((i,a)=>{let c=i.children[t],o=a.children[t];if(!c||!o)return 0;let r=this.#x(c,n),d=this.#x(o,n),l=0;switch(n){case"number":l=r-d;break;case"date":l=r-d;break;default:l=r.localeCompare(d,void 0,{numeric:!0,sensitivity:"base"});break}return l*s})}#x(t,e){let s=t.getAttribute("data-sort-value")??t.textContent.trim();switch(e){case"number":return parseFloat(s)||0;case"date":return new Date(s).getTime()||0;default:return s.toLowerCase()}}#X(){let t=document.createElement("div");t.setAttribute("data-table-filter","");let e=document.createElement("input");e.type="search",e.setAttribute("data-filter-input",""),e.setAttribute("placeholder",this.#l("placeholder")),e.setAttribute("aria-label",this.#l("filter")),t.appendChild(e),this.insertBefore(t,this.#e),this.#f=e;let n=document.createElement("p");n.setAttribute("data-table-empty",""),n.hidden=!0,n.textContent=this.#l("no-results"),this.#e.after(n),this.#u=n,this.listen(e,"input",this.#Y)}#Y=t=>{let e=t.target.value;this.#b&&clearTimeout(this.#b),this.#b=setTimeout(()=>{this.#E(e,{announce:!0})},150)};#E(t,{announce:e=!1,keepPage:n=!1}={}){if(this.#c=String(t??"").toLowerCase().trim(),this.#c===""?this.#s=[...this.#n]:this.#s=this.#n.filter(s=>[...s.children].some(a=>(a.getAttribute("data-filter-value")??a.textContent).toLowerCase().includes(this.#c))),this.#d>=0&&this.#h){let s=this.#r.find(i=>i.columnIndex===this.#d);s&&this.#F(this.#d,this.#h,s.sortType)}if(n?this.#i=Math.min(this.#i,this.totalPages):this.#i=1,this.#C(),e){let s=this.#s.length,i=this.#n.length,a={count:this.#y(s),total:this.#y(i)};this.#T(s===0?this.#l("no-results"):this.#B(this.#c?"filtered":"all",i,a))}this.dispatchEvent(new CustomEvent("data-table:filter",{detail:{query:this.#c,count:this.#s.length},bubbles:!0}))}#N(){let t=document.createElement("nav");t.setAttribute("data-pagination",""),t.setAttribute("aria-label",this.#l("pagination")),this.appendChild(t),this.#p=t}#Z(){for(let t of this.#t.querySelectorAll(":scope > tr[data-expandable]")){let e=t.querySelector('[data-action="toggle-expand"]');e&&e.setAttribute("aria-expanded",String(t.hasAttribute("data-state-expanded")))}this.listen(this.#e,"click",this.#tt)}#tt=t=>{let e=t.target.closest('[data-action="toggle-expand"]');if(!e)return;let n=e.closest("tr[data-expandable]");if(!n)return;let s=n.hasAttribute("data-state-expanded"),i=n.nextElementSibling;s?(n.removeAttribute("data-state-expanded"),e.setAttribute("aria-expanded","false"),i?.hasAttribute("data-expand-content")&&(i.hidden=!0,i.setAttribute("aria-hidden","true"))):(n.setAttribute("data-state-expanded",""),e.setAttribute("aria-expanded","true"),i?.hasAttribute("data-expand-content")&&(i.hidden=!1,i.removeAttribute("aria-hidden"))),this.dispatchEvent(new CustomEvent("data-table:expand",{detail:{row:n,expanded:!s},bubbles:!0}))};#et(){this.#o=this.#e.querySelector('thead [data-action="select-all"]'),this.#o&&this.listen(this.#o,"change",this.#nt),this.listen(this.#t,"change",this.#st),this.#$=this.querySelector("[data-selected-count]"),this.#q()}#nt=t=>{let e=t.target.checked;this.#t.querySelectorAll("tr[data-selectable]").forEach(s=>{let i=s.querySelector('[data-action="select-row"]');e?(s.setAttribute("data-state-selected",""),i&&(i.checked=!0)):(s.removeAttribute("data-state-selected"),i&&(i.checked=!1))}),t.target.indeterminate=!1,this.#R(),this.#I(),this.#V()};#st=t=>{let e=t.target.closest('[data-action="select-row"]');if(!e)return;let n=e.closest("tr[data-selectable]");n&&(e.checked?n.setAttribute("data-state-selected",""):n.removeAttribute("data-state-selected"),this.#q(),this.#I(),this.#V())};#I(){let t=this.getSelectedRows().length;this.#T(this.#B("selected",t,{count:this.#y(t)}))}#q(){if(!this.#o){this.#R();return}let t=this.#t.querySelectorAll("tr[data-selectable]"),e=this.#t.querySelectorAll("tr[data-selectable][data-state-selected]"),n=t.length,s=e.length;s===0?(this.#o.checked=!1,this.#o.indeterminate=!1):s===n?(this.#o.checked=!0,this.#o.indeterminate=!1):(this.#o.checked=!1,this.#o.indeterminate=!0),this.#R()}#R(){let e=this.#t.querySelectorAll("tr[data-selectable][data-state-selected]").length;this.#$&&(this.#$.textContent=e)}#V(){let t=[...this.#t.querySelectorAll("tr[data-selectable][data-state-selected]")];this.dispatchEvent(new CustomEvent("data-table:selection",{detail:{count:t.length,rows:t},bubbles:!0}))}#it(){if(!this.#p||this.#a<=0)return;let t=this.#p,e=Math.ceil(this.#s.length/this.#a),n=document.activeElement,s=null;if(n instanceof HTMLElement&&t.contains(n)&&(s=n.hasAttribute("data-pagination-prev")?"prev":n.hasAttribute("data-pagination-next")?"next":"page"),t.replaceChildren(),e<=1)return;let i=document.createElement("button");i.type="button",i.textContent=this.#l("prev"),i.setAttribute("data-pagination-prev",""),i.disabled=this.#i===1,i.addEventListener("click",()=>this.goToPage(this.#i-1)),t.appendChild(i),this.#rt(e).forEach(o=>{if(o==="..."){let r=document.createElement("span");r.textContent="...",r.setAttribute("data-pagination-ellipsis",""),t.appendChild(r)}else{let r=document.createElement("button");r.type="button",r.textContent=this.#y(o),r.setAttribute("data-pagination-page",""),o===this.#i&&(r.setAttribute("aria-current","page"),r.setAttribute("data-current","")),r.addEventListener("click",()=>this.goToPage(o)),t.appendChild(r)}});let c=document.createElement("button");if(c.type="button",c.textContent=this.#l("next"),c.setAttribute("data-pagination-next",""),c.disabled=this.#i===e,c.addEventListener("click",()=>this.goToPage(this.#i+1)),t.appendChild(c),s){let o=t.querySelector('[aria-current="page"]');(s==="prev"&&!i.disabled?i:s==="next"&&!c.disabled?c:o)?.focus()}}#rt(t){let e=this.#i,n=[];if(t<=7)for(let s=1;s<=t;s++)n.push(s);else{n.push(1),e>3&&n.push("...");let s=Math.max(2,e-1),i=Math.min(t-1,e+1);for(let a=s;a<=i;a++)n.push(a);e<t-2&&n.push("..."),n.push(t)}return n}#C(){this.#n.forEach(n=>{n.setAttribute("data-state-hidden",""),this.#S(n)?.setAttribute("data-state-hidden","")});let t;if(this.#a>0){let n=(this.#i-1)*this.#a,s=n+this.#a;t=this.#s.slice(n,s)}else t=this.#s;t.forEach(n=>{n.removeAttribute("data-state-hidden");let s=this.#S(n);this.#t.appendChild(n),s&&(s.removeAttribute("data-state-hidden"),this.#t.appendChild(s))}),this.#s.forEach(n=>{if(n.hasAttribute("data-state-hidden")){let s=this.#S(n);this.#t.appendChild(n),s&&this.#t.appendChild(s)}});let e=new Set(this.#s);this.#n.forEach(n=>{if(!e.has(n)){let s=this.#S(n);this.#t.appendChild(n),s&&this.#t.appendChild(s)}}),this.#u&&(this.#u.textContent=this.#l("no-results"),this.#u.hidden=!(this.#c&&this.#s.length===0&&this.#n.length>0)),this.#it()}#S(t){if(!t.hasAttribute("data-expandable"))return null;let e=t.nextElementSibling;return e?.hasAttribute("data-expand-content")?e:null}goToPage(t){if(this.#a<=0)return;let e=Math.max(1,Math.ceil(this.#s.length/this.#a)),n=Math.max(1,Math.min(Math.trunc(Number(t))||1,e));n!==this.#i&&(this.#i=n,this.#C(),this.dispatchEvent(new CustomEvent("data-table:page",{detail:{page:this.#i},bubbles:!0})))}setFilter(t){this.#f&&(this.#f.value=t),this.#E(t,{announce:!0})}refresh(){this.#t&&(this.#n=[...this.#t.querySelectorAll(w)],this.#L(),this.#M(),this.#E(this.#c,{keepPage:!0}),this.#q())}get currentPage(){return this.#i}get totalPages(){return this.#a<=0?1:Math.max(1,Math.ceil(this.#s.length/this.#a))}get filteredCount(){return this.#s.length}get totalCount(){return this.#n.length}getSelectedRows(){return this.#t?[...this.#t.querySelectorAll("tr[data-selectable][data-state-selected]")]:[]}};C("data-table",y);export{y as DataTable};
2
2
  //# sourceMappingURL=data-table.js.map