@threadlabs/looma 0.49.3 → 0.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/ui-cluster/ui-cluster.html +30 -2
- package/components/ui-cluster/ui-cluster.js +107 -0
- package/components/ui-combobox/ui-combobox.html +7 -5
- package/components/ui-combobox/ui-combobox.js +2 -2
- package/components/ui-site-header/ui-site-header.html +4 -0
- package/dist/index.js +60 -59
- package/docs/catalog.json +75 -11
- package/editor/components.css +19 -1
- package/editor/index.js +248 -30
- package/package.json +1 -1
- package/styles/ui-cluster.css +19 -1
- package/styles/ui-combobox.css +2 -2
- package/styles/ui-site-header.css +4 -0
- package/vanilla/UiCluster.d.ts +2 -0
- package/vanilla/UiCluster.js +52 -14
- package/vanilla/UiCombobox.d.ts +1 -0
- package/vanilla/UiCombobox.js +38 -34
package/docs/catalog.json
CHANGED
|
@@ -498,7 +498,7 @@
|
|
|
498
498
|
],
|
|
499
499
|
"schemaVersion": 1,
|
|
500
500
|
"package": "@threadlabs/looma",
|
|
501
|
-
"version": "0.
|
|
501
|
+
"version": "0.50.0",
|
|
502
502
|
"groups": [
|
|
503
503
|
{
|
|
504
504
|
"id": "layout",
|
|
@@ -4980,7 +4980,7 @@
|
|
|
4980
4980
|
"tag": "ui-cluster",
|
|
4981
4981
|
"package": "@threadlabs/looma",
|
|
4982
4982
|
"root": "div",
|
|
4983
|
-
"description": "Cluster layout primitive for row-style content with wrapping support. Set `wrap=\"nowrap\"` to keep a small group, such as a meter and its value, on one row.",
|
|
4983
|
+
"description": "Cluster layout primitive for row-style content with wrapping support. Set `wrap=\"nowrap\"` to keep a small group, such as a meter and its value, on one row. Set `maxRows` with an `overflow` slot to show complete rows and reveal the remaining items through your action. The optional `trailing` slot stays visible within the row limit. The `overflow-change` event reports the hidden count. Omit maxRows for ordinary unbounded wrapping.",
|
|
4984
4984
|
"designTokens": {
|
|
4985
4985
|
"sources": [
|
|
4986
4986
|
"packages/looma/src/components/ui-cluster/ui-cluster.html"
|
|
@@ -5077,6 +5077,17 @@
|
|
|
5077
5077
|
"between"
|
|
5078
5078
|
]
|
|
5079
5079
|
},
|
|
5080
|
+
{
|
|
5081
|
+
"name": "max-rows",
|
|
5082
|
+
"property": "maxRows",
|
|
5083
|
+
"description": "Maximum complete visible rows when wrapping. Zero leaves the group unbounded. Supply an overflow slot with a control that opens the complete collection; extra direct items are hidden and leave keyboard navigation. The trailing slot stays visible and counts toward the row cap.",
|
|
5084
|
+
"type": "integer",
|
|
5085
|
+
"valueType": {
|
|
5086
|
+
"kind": "terminal",
|
|
5087
|
+
"name": "integer"
|
|
5088
|
+
},
|
|
5089
|
+
"default": 0
|
|
5090
|
+
},
|
|
5080
5091
|
{
|
|
5081
5092
|
"name": "padding",
|
|
5082
5093
|
"property": "padding",
|
|
@@ -5169,6 +5180,12 @@
|
|
|
5169
5180
|
"between"
|
|
5170
5181
|
]
|
|
5171
5182
|
},
|
|
5183
|
+
{
|
|
5184
|
+
"name": "maxRows",
|
|
5185
|
+
"description": "Maximum complete visible rows when wrapping. Zero leaves the group unbounded. Supply an overflow slot with a control that opens the complete collection; extra direct items are hidden and leave keyboard navigation. The trailing slot stays visible and counts toward the row cap.",
|
|
5186
|
+
"type": "number",
|
|
5187
|
+
"default": 0
|
|
5188
|
+
},
|
|
5172
5189
|
{
|
|
5173
5190
|
"name": "padding",
|
|
5174
5191
|
"description": "Optional internal space for an action group, using the shared spacing scale.",
|
|
@@ -5204,11 +5221,33 @@
|
|
|
5204
5221
|
]
|
|
5205
5222
|
}
|
|
5206
5223
|
],
|
|
5207
|
-
"events": [
|
|
5224
|
+
"events": [
|
|
5225
|
+
{
|
|
5226
|
+
"name": "overflow-change",
|
|
5227
|
+
"detailType": "{ readonly count: number }",
|
|
5228
|
+
"detailSchema": "object",
|
|
5229
|
+
"fields": [
|
|
5230
|
+
{
|
|
5231
|
+
"path": "count",
|
|
5232
|
+
"type": "integer",
|
|
5233
|
+
"required": true
|
|
5234
|
+
}
|
|
5235
|
+
],
|
|
5236
|
+
"detailDocs": "Emitted with the declared detail payload."
|
|
5237
|
+
}
|
|
5238
|
+
],
|
|
5208
5239
|
"slots": [
|
|
5209
5240
|
{
|
|
5210
5241
|
"name": "default",
|
|
5211
5242
|
"description": "Default child content."
|
|
5243
|
+
},
|
|
5244
|
+
{
|
|
5245
|
+
"name": "overflow",
|
|
5246
|
+
"description": "Named content for the overflow region."
|
|
5247
|
+
},
|
|
5248
|
+
{
|
|
5249
|
+
"name": "trailing",
|
|
5250
|
+
"description": "Named content for the trailing region."
|
|
5212
5251
|
}
|
|
5213
5252
|
],
|
|
5214
5253
|
"group": "layout",
|
|
@@ -5272,6 +5311,16 @@
|
|
|
5272
5311
|
"bindings": "",
|
|
5273
5312
|
"frameworks": {}
|
|
5274
5313
|
},
|
|
5314
|
+
{
|
|
5315
|
+
"id": "@threadlabs/looma/ui-cluster/06-bounded-rows",
|
|
5316
|
+
"name": "06-bounded-rows",
|
|
5317
|
+
"title": "Bounded rows with all items available",
|
|
5318
|
+
"description": "Reserve an overflow action and an always-visible trailing action within three rows. The popup contains the complete collection.",
|
|
5319
|
+
"markup": "<ui-container fill>\n <ui-stack>\n <ui-cluster max-rows=\"3\" gap=\"xs\">\n <ui-badge>Research and discovery</ui-badge>\n <ui-badge>Interface design</ui-badge>\n <ui-badge>Content strategy</ui-badge>\n <ui-badge>Accessibility review</ui-badge>\n <ui-badge>Implementation</ui-badge>\n <ui-badge>Testing and delivery</ui-badge>\n <ui-button slot=\"overflow\" id=\"bounded-all-items\" size=\"sm\" variant=\"ghost\">All items…</ui-button>\n <ui-button slot=\"trailing\" size=\"sm\" variant=\"ghost\">Add item</ui-button>\n </ui-cluster>\n <ui-popover for=\"bounded-all-items\" role=\"region\" aria-label=\"All items\">\n <ui-cluster gap=\"xs\">\n <ui-badge>Research and discovery</ui-badge>\n <ui-badge>Interface design</ui-badge>\n <ui-badge>Content strategy</ui-badge>\n <ui-badge>Accessibility review</ui-badge>\n <ui-badge>Implementation</ui-badge>\n <ui-badge>Testing and delivery</ui-badge>\n </ui-cluster>\n </ui-popover>\n </ui-stack>\n</ui-container>",
|
|
5320
|
+
"resizable": false,
|
|
5321
|
+
"bindings": "",
|
|
5322
|
+
"frameworks": {}
|
|
5323
|
+
},
|
|
5275
5324
|
{
|
|
5276
5325
|
"id": "@threadlabs/looma/ui-cluster/99-theme-sampler",
|
|
5277
5326
|
"name": "99-theme-sampler",
|
|
@@ -6035,6 +6084,17 @@
|
|
|
6035
6084
|
"none"
|
|
6036
6085
|
]
|
|
6037
6086
|
},
|
|
6087
|
+
{
|
|
6088
|
+
"name": "grow",
|
|
6089
|
+
"property": "grow",
|
|
6090
|
+
"description": "Let a multiple-selection field wrap and grow with its selected items and typing space. Without grow it stays one horizontally scrolling row.",
|
|
6091
|
+
"type": "boolean",
|
|
6092
|
+
"valueType": {
|
|
6093
|
+
"kind": "terminal",
|
|
6094
|
+
"name": "boolean"
|
|
6095
|
+
},
|
|
6096
|
+
"default": false
|
|
6097
|
+
},
|
|
6038
6098
|
{
|
|
6039
6099
|
"name": "help",
|
|
6040
6100
|
"property": "help",
|
|
@@ -6265,13 +6325,12 @@
|
|
|
6265
6325
|
{
|
|
6266
6326
|
"name": "max-rows",
|
|
6267
6327
|
"property": "maxRows",
|
|
6268
|
-
"description": "
|
|
6328
|
+
"description": "Optional maximum visible rows when grow is enabled. Extra selections scroll vertically inside the field. Omit it for unbounded growth; single-selection fields are unchanged.",
|
|
6269
6329
|
"type": "integer",
|
|
6270
6330
|
"valueType": {
|
|
6271
6331
|
"kind": "terminal",
|
|
6272
6332
|
"name": "integer"
|
|
6273
|
-
}
|
|
6274
|
-
"default": 1
|
|
6333
|
+
}
|
|
6275
6334
|
},
|
|
6276
6335
|
{
|
|
6277
6336
|
"name": "multiple",
|
|
@@ -6481,6 +6540,12 @@
|
|
|
6481
6540
|
"none"
|
|
6482
6541
|
]
|
|
6483
6542
|
},
|
|
6543
|
+
{
|
|
6544
|
+
"name": "grow",
|
|
6545
|
+
"description": "Let a multiple-selection field wrap and grow with its selected items and typing space. Without grow it stays one horizontally scrolling row.",
|
|
6546
|
+
"type": "boolean",
|
|
6547
|
+
"default": false
|
|
6548
|
+
},
|
|
6484
6549
|
{
|
|
6485
6550
|
"name": "help",
|
|
6486
6551
|
"description": "Help text for the field. When set, a help button appears beside the field and opens a tooltip with this text; while it is open, the input is described by it.",
|
|
@@ -6582,9 +6647,8 @@
|
|
|
6582
6647
|
},
|
|
6583
6648
|
{
|
|
6584
6649
|
"name": "maxRows",
|
|
6585
|
-
"description": "
|
|
6586
|
-
"type": "number"
|
|
6587
|
-
"default": 1
|
|
6650
|
+
"description": "Optional maximum visible rows when grow is enabled. Extra selections scroll vertically inside the field. Omit it for unbounded growth; single-selection fields are unchanged.",
|
|
6651
|
+
"type": "number"
|
|
6588
6652
|
},
|
|
6589
6653
|
{
|
|
6590
6654
|
"name": "multiple",
|
|
@@ -7548,8 +7612,8 @@
|
|
|
7548
7612
|
"id": "@threadlabs/looma/ui-combobox/08-multiple-rows",
|
|
7549
7613
|
"name": "08-multiple-rows",
|
|
7550
7614
|
"title": "Wrap selected items before scrolling",
|
|
7551
|
-
"description": "maxRows lets a multiple field grow through three rows before additional selections scroll vertically inside the field. The input remains reachable by keyboard.",
|
|
7552
|
-
"markup": "<ui-container fill>\n <ui-combobox label=\"Topics\" multiple max-rows=\"3\" disclosure placeholder=\"Add a topic…\">\n <option value=\"research\" selected>Research and discovery</option>\n <option value=\"design\" selected>Interface design</option>\n <option value=\"content\" selected>Content strategy</option>\n <option value=\"accessibility\" selected>Accessibility review</option>\n <option value=\"delivery\">Delivery</option>\n </ui-combobox>\n</ui-container>",
|
|
7615
|
+
"description": "grow with maxRows lets a multiple field grow through three rows before additional selections scroll vertically inside the field. The input remains reachable by keyboard.",
|
|
7616
|
+
"markup": "<ui-container fill>\n <ui-combobox label=\"Topics\" multiple grow max-rows=\"3\" disclosure placeholder=\"Add a topic…\">\n <option value=\"research\" selected>Research and discovery</option>\n <option value=\"design\" selected>Interface design</option>\n <option value=\"content\" selected>Content strategy</option>\n <option value=\"accessibility\" selected>Accessibility review</option>\n <option value=\"delivery\">Delivery</option>\n </ui-combobox>\n</ui-container>",
|
|
7553
7617
|
"resizable": false,
|
|
7554
7618
|
"bindings": "",
|
|
7555
7619
|
"frameworks": {}
|
package/editor/components.css
CHANGED
|
@@ -705,6 +705,20 @@
|
|
|
705
705
|
margin: 0 !important;
|
|
706
706
|
}
|
|
707
707
|
|
|
708
|
+
.overflow,
|
|
709
|
+
.trailing {
|
|
710
|
+
display: flex !important;
|
|
711
|
+
align-items: center !important;
|
|
712
|
+
gap: inherit !important;
|
|
713
|
+
min-inline-size: 0;
|
|
714
|
+
max-inline-size: 100%;
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
.overflow[hidden],
|
|
718
|
+
.trailing:empty {
|
|
719
|
+
display: none !important;
|
|
720
|
+
}
|
|
721
|
+
|
|
708
722
|
:scope:where([data-component~="ui-cluster"])[data-ui-cluster-state~="fixed"] {
|
|
709
723
|
flex: none;
|
|
710
724
|
}
|
|
@@ -776,7 +790,11 @@
|
|
|
776
790
|
}
|
|
777
791
|
}
|
|
778
792
|
@scope ([data-component~="ui-cluster"]) to ([data-component]) {
|
|
779
|
-
|
|
793
|
+
:where([data-slotted], [data-slotted] *):is([hidden]) {
|
|
794
|
+
display: none !important;
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
/* A component that sets its display still honours the hidden attribute on its root. */
|
|
780
798
|
}
|
|
781
799
|
/* Generated by HTML Next 1.0.0-alpha.76. Do not edit. */
|
|
782
800
|
@supports (-moz-appearance: none) {
|
package/editor/index.js
CHANGED
|
@@ -2369,8 +2369,8 @@ function setCodeBlockLanguage(editor, pos, value, names) {
|
|
|
2369
2369
|
}
|
|
2370
2370
|
//#endregion
|
|
2371
2371
|
//#region components/ui-button/ui-button.js
|
|
2372
|
-
var ui_button_exports = /* @__PURE__ */ __exportAll({ connect: () => connect$
|
|
2373
|
-
function connect$
|
|
2372
|
+
var ui_button_exports = /* @__PURE__ */ __exportAll({ connect: () => connect$12 });
|
|
2373
|
+
function connect$12(host) {
|
|
2374
2374
|
const onClick = (event) => {
|
|
2375
2375
|
if (!host.props.disabled.value && !host.props.loading.value && !host.props.pending.value) return;
|
|
2376
2376
|
event.preventDefault();
|
|
@@ -2409,12 +2409,12 @@ var T0$16 = [
|
|
|
2409
2409
|
"\n "
|
|
2410
2410
|
];
|
|
2411
2411
|
var T1$16 = ["ui-spinner", ["size", "sm"]];
|
|
2412
|
-
var T2$
|
|
2412
|
+
var T2$12 = [
|
|
2413
2413
|
"",
|
|
2414
2414
|
[],
|
|
2415
2415
|
4
|
|
2416
2416
|
];
|
|
2417
|
-
var T3$
|
|
2417
|
+
var T3$8 = ["", []];
|
|
2418
2418
|
var T4$6 = ["", []];
|
|
2419
2419
|
var T5$5 = [
|
|
2420
2420
|
"",
|
|
@@ -2522,8 +2522,8 @@ var T18$1 = ["", []];
|
|
|
2522
2522
|
var T19$1 = ["", []];
|
|
2523
2523
|
var P0$16;
|
|
2524
2524
|
var P1$16;
|
|
2525
|
-
var P2$
|
|
2526
|
-
var P3$
|
|
2525
|
+
var P2$12;
|
|
2526
|
+
var P3$8;
|
|
2527
2527
|
var P4$6;
|
|
2528
2528
|
var P5$5;
|
|
2529
2529
|
var P6$3;
|
|
@@ -2547,7 +2547,7 @@ var S$18 = {
|
|
|
2547
2547
|
g: "ui-button",
|
|
2548
2548
|
k: 0,
|
|
2549
2549
|
r: readonlyView,
|
|
2550
|
-
a: (host, I) => C$
|
|
2550
|
+
a: (host, I) => C$12(host, I),
|
|
2551
2551
|
b: generatedInputs
|
|
2552
2552
|
};
|
|
2553
2553
|
var A$3 = [
|
|
@@ -2847,7 +2847,7 @@ var D$18 = {
|
|
|
2847
2847
|
}
|
|
2848
2848
|
}
|
|
2849
2849
|
};
|
|
2850
|
-
var C$
|
|
2850
|
+
var C$12 = (host) => activateModule(ui_button_exports, host);
|
|
2851
2851
|
function createUiButton(options = {}, html) {
|
|
2852
2852
|
const { attributes = {}, children = [], slots = {}, ...componentProps } = options;
|
|
2853
2853
|
const v = [
|
|
@@ -2982,7 +2982,7 @@ function createUiButton(options = {}, html) {
|
|
|
2982
2982
|
return { n: (P1$16 ??= buildTemplate(T1$16)).cloneNode(true) };
|
|
2983
2983
|
};
|
|
2984
2984
|
const m2 = (d) => {
|
|
2985
|
-
const n = (P2$
|
|
2985
|
+
const n = (P2$12 ??= buildTemplate(T2$12)).cloneNode(true);
|
|
2986
2986
|
const t0 = n.firstChild;
|
|
2987
2987
|
const r = {
|
|
2988
2988
|
n,
|
|
@@ -3009,7 +3009,7 @@ function createUiButton(options = {}, html) {
|
|
|
3009
3009
|
} else if (r.b0 !== void 0) r.b0;
|
|
3010
3010
|
};
|
|
3011
3011
|
const m3 = (d) => {
|
|
3012
|
-
return { n: (P3$
|
|
3012
|
+
return { n: (P3$8 ??= buildTemplate(T3$8)).cloneNode(true) };
|
|
3013
3013
|
};
|
|
3014
3014
|
const m4 = (d) => {
|
|
3015
3015
|
return { n: (P4$6 ??= buildTemplate(T4$6)).cloneNode(true) };
|
|
@@ -4331,13 +4331,13 @@ function createIdResolver(document, onLate) {
|
|
|
4331
4331
|
}
|
|
4332
4332
|
//#endregion
|
|
4333
4333
|
//#region components/ui-affordance-scope/ui-affordance-scope.js
|
|
4334
|
-
var ui_affordance_scope_exports = /* @__PURE__ */ __exportAll({ connect: () => connect$
|
|
4334
|
+
var ui_affordance_scope_exports = /* @__PURE__ */ __exportAll({ connect: () => connect$11 });
|
|
4335
4335
|
function distance(point, rect) {
|
|
4336
4336
|
const dx = Math.max(rect.left - point.x, 0, point.x - rect.right);
|
|
4337
4337
|
const dy = Math.max(rect.top - point.y, 0, point.y - rect.bottom);
|
|
4338
4338
|
return Math.hypot(dx, dy);
|
|
4339
4339
|
}
|
|
4340
|
-
function connect$
|
|
4340
|
+
function connect$11(host) {
|
|
4341
4341
|
const element = host.element;
|
|
4342
4342
|
const owner = element.ownerDocument.defaultView;
|
|
4343
4343
|
let anchors = [];
|
|
@@ -4429,7 +4429,7 @@ var S$17 = {
|
|
|
4429
4429
|
t: ["b"],
|
|
4430
4430
|
f: import.meta.url,
|
|
4431
4431
|
g: "ui-affordance-scope",
|
|
4432
|
-
a: (host, I) => C$
|
|
4432
|
+
a: (host, I) => C$11(host, I),
|
|
4433
4433
|
b: generatedInputs,
|
|
4434
4434
|
i: [false]
|
|
4435
4435
|
};
|
|
@@ -4455,7 +4455,7 @@ var D$17 = {
|
|
|
4455
4455
|
}
|
|
4456
4456
|
}
|
|
4457
4457
|
};
|
|
4458
|
-
var C$
|
|
4458
|
+
var C$11 = (host) => activateModule(ui_affordance_scope_exports, host);
|
|
4459
4459
|
function createUiAffordanceScope(options = {}, html) {
|
|
4460
4460
|
const { attributes = {}, children = [], slots = {}, ...componentProps } = options;
|
|
4461
4461
|
const element = document.createElement("span");
|
|
@@ -4513,21 +4513,172 @@ function createUiAffordanceScope(options = {}, html) {
|
|
|
4513
4513
|
}
|
|
4514
4514
|
defineComponent("ui-affordance-scope", createUiAffordanceScope, ["guide", "nearRadius"]);
|
|
4515
4515
|
//#endregion
|
|
4516
|
+
//#region components/ui-cluster/ui-cluster.js
|
|
4517
|
+
var ui_cluster_exports = /* @__PURE__ */ __exportAll({ connect: () => connect$10 });
|
|
4518
|
+
/** Bound a wrapping group by complete rows while preserving its overflow action. */
|
|
4519
|
+
function connect$10(host) {
|
|
4520
|
+
const element = host.element;
|
|
4521
|
+
const view = element.ownerDocument.defaultView;
|
|
4522
|
+
const overflow = host.refs.overflow;
|
|
4523
|
+
const trailing = host.refs.trailing;
|
|
4524
|
+
const collapsed = /* @__PURE__ */ new Set();
|
|
4525
|
+
const observed = /* @__PURE__ */ new Set();
|
|
4526
|
+
let limit = 0;
|
|
4527
|
+
let frame = 0;
|
|
4528
|
+
let count = 0;
|
|
4529
|
+
let alive = true;
|
|
4530
|
+
function report(next) {
|
|
4531
|
+
overflow.hidden = next === 0;
|
|
4532
|
+
host.state.overflowCount = next;
|
|
4533
|
+
if (next !== count) host.dispatch("overflow-change", { count: next });
|
|
4534
|
+
count = next;
|
|
4535
|
+
}
|
|
4536
|
+
function restore() {
|
|
4537
|
+
for (const item of collapsed) item.removeAttribute("hidden");
|
|
4538
|
+
collapsed.clear();
|
|
4539
|
+
}
|
|
4540
|
+
function rows(items) {
|
|
4541
|
+
let total = 0;
|
|
4542
|
+
let end = -Infinity;
|
|
4543
|
+
for (const item of items) {
|
|
4544
|
+
const box = item.getBoundingClientRect();
|
|
4545
|
+
if (!box.width || !box.height) continue;
|
|
4546
|
+
if (box.top >= end - .5) total++;
|
|
4547
|
+
end = Math.max(end, box.bottom);
|
|
4548
|
+
}
|
|
4549
|
+
return total;
|
|
4550
|
+
}
|
|
4551
|
+
function measure() {
|
|
4552
|
+
frame = 0;
|
|
4553
|
+
if (!alive || !limit) return;
|
|
4554
|
+
const active = element.ownerDocument.activeElement;
|
|
4555
|
+
restore();
|
|
4556
|
+
overflow.hidden = true;
|
|
4557
|
+
const items = Array.from(element.children).filter((item) => item !== overflow && item !== trailing && !item.hasAttribute("hidden"));
|
|
4558
|
+
for (const item of observed) if (!items.includes(item)) {
|
|
4559
|
+
resize.unobserve(item);
|
|
4560
|
+
observed.delete(item);
|
|
4561
|
+
}
|
|
4562
|
+
for (const item of items) if (!observed.has(item)) {
|
|
4563
|
+
resize.observe(item);
|
|
4564
|
+
observed.add(item);
|
|
4565
|
+
}
|
|
4566
|
+
if (!element.clientWidth || !overflow.childElementCount || getComputedStyle(element).flexWrap === "nowrap" || rows([...items, trailing]) <= limit) {
|
|
4567
|
+
report(0);
|
|
4568
|
+
return;
|
|
4569
|
+
}
|
|
4570
|
+
overflow.hidden = false;
|
|
4571
|
+
const showPrefix = (count) => {
|
|
4572
|
+
for (const [index, item] of items.entries()) {
|
|
4573
|
+
item.toggleAttribute("hidden", index >= count);
|
|
4574
|
+
if (index >= count) collapsed.add(item);
|
|
4575
|
+
else collapsed.delete(item);
|
|
4576
|
+
}
|
|
4577
|
+
};
|
|
4578
|
+
let visible = 0;
|
|
4579
|
+
let upper = items.length;
|
|
4580
|
+
while (visible < upper) {
|
|
4581
|
+
const candidate = Math.ceil((visible + upper) / 2);
|
|
4582
|
+
showPrefix(candidate);
|
|
4583
|
+
if (rows([
|
|
4584
|
+
...items.slice(0, candidate),
|
|
4585
|
+
overflow,
|
|
4586
|
+
trailing
|
|
4587
|
+
]) <= limit) visible = candidate;
|
|
4588
|
+
else upper = candidate - 1;
|
|
4589
|
+
}
|
|
4590
|
+
showPrefix(visible);
|
|
4591
|
+
report(items.length - visible);
|
|
4592
|
+
if (active && Array.from(collapsed).some((item) => item.contains(active))) overflow.querySelector("button, a[href], input, [tabindex=\"0\"]")?.focus({ preventScroll: true });
|
|
4593
|
+
}
|
|
4594
|
+
const schedule = () => {
|
|
4595
|
+
if (alive && limit && !frame) frame = view.requestAnimationFrame(measure);
|
|
4596
|
+
};
|
|
4597
|
+
let resize;
|
|
4598
|
+
let changes;
|
|
4599
|
+
const stop = host.effect(() => {
|
|
4600
|
+
const requested = Number(host.props.maxRows.value);
|
|
4601
|
+
host.props.wrap.value;
|
|
4602
|
+
limit = Number.isFinite(requested) ? Math.max(0, Math.floor(requested)) : 0;
|
|
4603
|
+
resize?.disconnect();
|
|
4604
|
+
observed.clear();
|
|
4605
|
+
changes?.disconnect();
|
|
4606
|
+
element.ownerDocument.fonts?.removeEventListener("loadingdone", schedule);
|
|
4607
|
+
if (limit) {
|
|
4608
|
+
resize ??= new view.ResizeObserver(schedule);
|
|
4609
|
+
changes ??= new view.MutationObserver(schedule);
|
|
4610
|
+
resize.observe(element);
|
|
4611
|
+
resize.observe(overflow);
|
|
4612
|
+
resize.observe(trailing);
|
|
4613
|
+
changes.observe(element, {
|
|
4614
|
+
childList: true,
|
|
4615
|
+
subtree: true,
|
|
4616
|
+
characterData: true
|
|
4617
|
+
});
|
|
4618
|
+
element.ownerDocument.fonts?.addEventListener("loadingdone", schedule);
|
|
4619
|
+
schedule();
|
|
4620
|
+
} else {
|
|
4621
|
+
restore();
|
|
4622
|
+
report(0);
|
|
4623
|
+
}
|
|
4624
|
+
});
|
|
4625
|
+
return () => {
|
|
4626
|
+
alive = false;
|
|
4627
|
+
stop();
|
|
4628
|
+
resize?.disconnect();
|
|
4629
|
+
changes?.disconnect();
|
|
4630
|
+
element.ownerDocument.fonts?.removeEventListener("loadingdone", schedule);
|
|
4631
|
+
if (frame) view.cancelAnimationFrame(frame);
|
|
4632
|
+
restore();
|
|
4633
|
+
};
|
|
4634
|
+
}
|
|
4635
|
+
//#endregion
|
|
4516
4636
|
//#region vanilla/UiCluster.js
|
|
4517
4637
|
var T0$14 = [
|
|
4518
4638
|
"",
|
|
4519
4639
|
[],
|
|
4520
|
-
|
|
4640
|
+
"\n ",
|
|
4641
|
+
4,
|
|
4642
|
+
"\n ",
|
|
4643
|
+
[
|
|
4644
|
+
"span",
|
|
4645
|
+
["class", "overflow"],
|
|
4646
|
+
4
|
|
4647
|
+
],
|
|
4648
|
+
"\n ",
|
|
4649
|
+
[
|
|
4650
|
+
"span",
|
|
4651
|
+
["class", "trailing"],
|
|
4652
|
+
4
|
|
4653
|
+
],
|
|
4654
|
+
"\n "
|
|
4521
4655
|
];
|
|
4522
4656
|
var T1$14 = ["", []];
|
|
4657
|
+
var T2$11 = ["", []];
|
|
4658
|
+
var T3$7 = ["", []];
|
|
4523
4659
|
var P0$14;
|
|
4524
4660
|
var P1$14;
|
|
4661
|
+
var P2$11;
|
|
4662
|
+
var P3$7;
|
|
4525
4663
|
var S$16 = {
|
|
4526
|
-
n: [],
|
|
4527
|
-
t: [],
|
|
4664
|
+
n: ["overflowCount"],
|
|
4665
|
+
t: ["i"],
|
|
4528
4666
|
f: import.meta.url,
|
|
4529
4667
|
g: "ui-cluster",
|
|
4530
|
-
|
|
4668
|
+
d: { "overflow-change": [
|
|
4669
|
+
detailCheck(checkObject([[
|
|
4670
|
+
"count",
|
|
4671
|
+
checkInteger,
|
|
4672
|
+
false
|
|
4673
|
+
]], false)),
|
|
4674
|
+
true,
|
|
4675
|
+
true,
|
|
4676
|
+
false
|
|
4677
|
+
] },
|
|
4678
|
+
x: dispatchDeclared,
|
|
4679
|
+
a: (host, I) => C$10(host, I),
|
|
4680
|
+
b: generatedInputs,
|
|
4681
|
+
i: [0]
|
|
4531
4682
|
};
|
|
4532
4683
|
var D$16 = {
|
|
4533
4684
|
g: "ui-cluster",
|
|
@@ -4581,6 +4732,14 @@ var D$16 = {
|
|
|
4581
4732
|
j: 0,
|
|
4582
4733
|
m: ["p", formatOf(keywordFormat)]
|
|
4583
4734
|
},
|
|
4735
|
+
"maxRows": {
|
|
4736
|
+
"required": false,
|
|
4737
|
+
"default": 0,
|
|
4738
|
+
c: checkInteger,
|
|
4739
|
+
t: "integer",
|
|
4740
|
+
j: 0,
|
|
4741
|
+
m: "i"
|
|
4742
|
+
},
|
|
4584
4743
|
"padding": {
|
|
4585
4744
|
"required": false,
|
|
4586
4745
|
"values": [
|
|
@@ -4620,6 +4779,7 @@ var D$16 = {
|
|
|
4620
4779
|
}
|
|
4621
4780
|
}
|
|
4622
4781
|
};
|
|
4782
|
+
var C$10 = (host) => activateModule(ui_cluster_exports, host);
|
|
4623
4783
|
function createUiCluster(options = {}, html) {
|
|
4624
4784
|
const { attributes = {}, children = [], slots = {}, ...componentProps } = options;
|
|
4625
4785
|
const element = document.createElement("div");
|
|
@@ -4630,6 +4790,8 @@ function createUiCluster(options = {}, html) {
|
|
|
4630
4790
|
element.setAttribute("data-component", "ui-cluster");
|
|
4631
4791
|
element.append((P0$14 ??= buildTemplate(T0$14)).cloneNode(true));
|
|
4632
4792
|
const v = [
|
|
4793
|
+
0,
|
|
4794
|
+
null,
|
|
4633
4795
|
null,
|
|
4634
4796
|
null,
|
|
4635
4797
|
null,
|
|
@@ -4642,9 +4804,20 @@ function createUiCluster(options = {}, html) {
|
|
|
4642
4804
|
const m1 = (d) => {
|
|
4643
4805
|
return { n: (P1$14 ??= buildTemplate(T1$14)).cloneNode(true) };
|
|
4644
4806
|
};
|
|
4807
|
+
const m2 = (d) => {
|
|
4808
|
+
return { n: (P2$11 ??= buildTemplate(T2$11)).cloneNode(true) };
|
|
4809
|
+
};
|
|
4810
|
+
const m3 = (d) => {
|
|
4811
|
+
return { n: (P3$7 ??= buildTemplate(T3$7)).cloneNode(true) };
|
|
4812
|
+
};
|
|
4645
4813
|
const p0 = (r, c, d) => {
|
|
4646
|
-
if (c &
|
|
4647
|
-
const
|
|
4814
|
+
if (c & 1) {
|
|
4815
|
+
const x0 = v[0] === 0;
|
|
4816
|
+
const s0 = toAttribute(x0, "hidden");
|
|
4817
|
+
if (s0 !== r.v0) writeAttribute(r.a1, "hidden", r.v0 = s0);
|
|
4818
|
+
}
|
|
4819
|
+
if (c & 478) {
|
|
4820
|
+
const s1 = hostState([
|
|
4648
4821
|
"fixed",
|
|
4649
4822
|
"padding",
|
|
4650
4823
|
"paddingEnd",
|
|
@@ -4653,16 +4826,40 @@ function createUiCluster(options = {}, html) {
|
|
|
4653
4826
|
"justify",
|
|
4654
4827
|
"wrap"
|
|
4655
4828
|
], [
|
|
4656
|
-
v[1],
|
|
4657
|
-
v[4],
|
|
4658
|
-
v[5],
|
|
4659
4829
|
v[2],
|
|
4660
|
-
v[
|
|
4830
|
+
v[6],
|
|
4831
|
+
v[7],
|
|
4661
4832
|
v[3],
|
|
4662
|
-
v[
|
|
4833
|
+
v[1],
|
|
4834
|
+
v[4],
|
|
4835
|
+
v[8]
|
|
4663
4836
|
]);
|
|
4664
|
-
if (
|
|
4837
|
+
if (s1 !== r.v1) writeAttribute(r.n, "data-ui-cluster-state", (r.v1 = s1) === "" ? null : s1);
|
|
4665
4838
|
}
|
|
4839
|
+
if (r.f1 === void 0) {
|
|
4840
|
+
r.f1 = 1;
|
|
4841
|
+
const at = fillSlot(r.a2, r.e1, "overflow", J, false, void 0, d);
|
|
4842
|
+
if (Array.isArray(at)) (r.z ??= []).push(() => {
|
|
4843
|
+
at[0].l.delete(at[1]);
|
|
4844
|
+
dispose(at[1]);
|
|
4845
|
+
});
|
|
4846
|
+
else if (at !== void 0) {
|
|
4847
|
+
r.b1 = m2(d);
|
|
4848
|
+
at.before(r.b1.n);
|
|
4849
|
+
}
|
|
4850
|
+
} else if (r.b1 !== void 0) r.b1;
|
|
4851
|
+
if (r.f2 === void 0) {
|
|
4852
|
+
r.f2 = 1;
|
|
4853
|
+
const at = fillSlot(r.a4, r.e2, "trailing", J, false, void 0, d);
|
|
4854
|
+
if (Array.isArray(at)) (r.z ??= []).push(() => {
|
|
4855
|
+
at[0].l.delete(at[1]);
|
|
4856
|
+
dispose(at[1]);
|
|
4857
|
+
});
|
|
4858
|
+
else if (at !== void 0) {
|
|
4859
|
+
r.b2 = m3(d);
|
|
4860
|
+
at.before(r.b2.n);
|
|
4861
|
+
}
|
|
4862
|
+
} else if (r.b2 !== void 0) r.b2;
|
|
4666
4863
|
if (r.f0 === void 0) {
|
|
4667
4864
|
r.f0 = 1;
|
|
4668
4865
|
const at = fillSlot(r.a0, r.e0, "", J, false, void 0, d);
|
|
@@ -4676,19 +4873,39 @@ function createUiCluster(options = {}, html) {
|
|
|
4676
4873
|
}
|
|
4677
4874
|
} else if (r.b0 !== void 0) r.b0;
|
|
4678
4875
|
};
|
|
4679
|
-
const t0 = element.firstChild;
|
|
4876
|
+
const t0 = element.firstChild.nextSibling;
|
|
4877
|
+
const t1 = t0.nextSibling.nextSibling.nextSibling;
|
|
4878
|
+
const t2 = t1.firstChild;
|
|
4879
|
+
const t3 = t1.nextSibling.nextSibling;
|
|
4880
|
+
const t4 = t3.firstChild;
|
|
4680
4881
|
const R = {
|
|
4681
4882
|
n: element,
|
|
4682
|
-
|
|
4883
|
+
a1: t1,
|
|
4884
|
+
v0: null,
|
|
4885
|
+
v1: void 0,
|
|
4683
4886
|
a0: t0,
|
|
4684
4887
|
e0: t0.nextSibling,
|
|
4685
4888
|
b0: void 0,
|
|
4686
|
-
f0: void 0
|
|
4889
|
+
f0: void 0,
|
|
4890
|
+
a2: t2,
|
|
4891
|
+
e1: t2.nextSibling,
|
|
4892
|
+
b1: void 0,
|
|
4893
|
+
f1: void 0,
|
|
4894
|
+
a4: t4,
|
|
4895
|
+
e2: t4.nextSibling,
|
|
4896
|
+
b2: void 0,
|
|
4897
|
+
f2: void 0
|
|
4687
4898
|
};
|
|
4688
4899
|
const I = { B };
|
|
4689
4900
|
const J = project(I, children, slots);
|
|
4690
|
-
|
|
4901
|
+
I.R = /* @__PURE__ */ new Set();
|
|
4902
|
+
attachGeneratedController(element, S$16, v, (c, d) => {
|
|
4903
|
+
((c, d) => p0(R, c, d))(c, d);
|
|
4904
|
+
for (const f of I.R) f(c, d);
|
|
4905
|
+
}, void 0, void 0, I);
|
|
4691
4906
|
manageProps(I);
|
|
4907
|
+
I.r["overflow"] = t1;
|
|
4908
|
+
I.r["trailing"] = t3;
|
|
4692
4909
|
return element;
|
|
4693
4910
|
}
|
|
4694
4911
|
defineComponent("ui-cluster", createUiCluster, [
|
|
@@ -4696,6 +4913,7 @@ defineComponent("ui-cluster", createUiCluster, [
|
|
|
4696
4913
|
"fixed",
|
|
4697
4914
|
"gap",
|
|
4698
4915
|
"justify",
|
|
4916
|
+
"maxRows",
|
|
4699
4917
|
"padding",
|
|
4700
4918
|
"paddingEnd",
|
|
4701
4919
|
"wrap"
|
package/package.json
CHANGED
package/styles/ui-cluster.css
CHANGED
|
@@ -18,6 +18,20 @@
|
|
|
18
18
|
margin: 0 !important;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
.overflow,
|
|
22
|
+
.trailing {
|
|
23
|
+
display: flex !important;
|
|
24
|
+
align-items: center !important;
|
|
25
|
+
gap: inherit !important;
|
|
26
|
+
min-inline-size: 0;
|
|
27
|
+
max-inline-size: 100%;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.overflow[hidden],
|
|
31
|
+
.trailing:empty {
|
|
32
|
+
display: none !important;
|
|
33
|
+
}
|
|
34
|
+
|
|
21
35
|
:scope:where([data-component~="ui-cluster"])[data-ui-cluster-state~="fixed"] {
|
|
22
36
|
flex: none;
|
|
23
37
|
}
|
|
@@ -89,5 +103,9 @@
|
|
|
89
103
|
}
|
|
90
104
|
}
|
|
91
105
|
@scope ([data-component~="ui-cluster"]) to ([data-component]) {
|
|
92
|
-
|
|
106
|
+
:where([data-slotted], [data-slotted] *):is([hidden]) {
|
|
107
|
+
display: none !important;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/* A component that sets its display still honours the hidden attribute on its root. */
|
|
93
111
|
}
|