@fairfox/polly 0.73.1 → 0.74.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/mesh.js +32 -12
- package/dist/src/mesh.js.map +6 -5
- package/dist/src/polly-ui/ActionSelect.d.ts +7 -3
- package/dist/src/polly-ui/Dropdown.d.ts +9 -0
- package/dist/src/polly-ui/Select.d.ts +2 -0
- package/dist/src/polly-ui/index.css +29 -5
- package/dist/src/polly-ui/index.js +65 -19
- package/dist/src/polly-ui/index.js.map +5 -5
- package/dist/src/polly-ui/styles.css +29 -5
- package/dist/src/shared/lib/derive-document-id.d.ts +21 -0
- package/dist/src/shared/lib/mesh-state.d.ts +6 -6
- package/dist/src/shared/lib/mesh-webrtc-adapter.d.ts +43 -2
- package/dist/tools/visualize/src/cli.js +365 -21
- package/dist/tools/visualize/src/cli.js.map +8 -6
- package/package.json +1 -1
|
@@ -9,9 +9,11 @@
|
|
|
9
9
|
* <ActionInput> and <ActionForm>, with no synthetic signal or bridging
|
|
10
10
|
* `effect` required.
|
|
11
11
|
*
|
|
12
|
-
* Composes <Dropdown> for the menu. The trigger is
|
|
13
|
-
*
|
|
14
|
-
* interactive element
|
|
12
|
+
* Composes <Dropdown> for the menu. The trigger styling is applied
|
|
13
|
+
* directly to Dropdown's own <button> via `triggerClassName`, so the
|
|
14
|
+
* visible box and the interactive element are one and the same node —
|
|
15
|
+
* no styled <span> nested inside an unstyled <button>. A disabled
|
|
16
|
+
* ActionSelect renders as static text without a caret.
|
|
15
17
|
*/
|
|
16
18
|
import type { JSX } from "preact";
|
|
17
19
|
import { type PassthroughAttrs } from "./internal/passthrough.ts";
|
|
@@ -30,6 +32,8 @@ export type ActionSelectProps = PassthroughAttrs & {
|
|
|
30
32
|
/** Trigger text shown when `value` matches no option. Default: "Select…". */
|
|
31
33
|
placeholder?: string;
|
|
32
34
|
disabled?: boolean;
|
|
35
|
+
/** Apply a comfortable minimum width to the trigger. Default: sizes to content. */
|
|
36
|
+
wide?: boolean;
|
|
33
37
|
className?: string;
|
|
34
38
|
id?: string;
|
|
35
39
|
};
|
|
@@ -24,6 +24,15 @@ export type DropdownProps = {
|
|
|
24
24
|
align?: "left" | "right";
|
|
25
25
|
multiSelect?: boolean;
|
|
26
26
|
className?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Class applied to the trigger <button> in place of Dropdown's own
|
|
29
|
+
* default. Lets a composing component (Select, ActionSelect) style
|
|
30
|
+
* the single interactive element directly, with no styled node
|
|
31
|
+
* nested inside the button.
|
|
32
|
+
*/
|
|
33
|
+
triggerClassName?: string;
|
|
34
|
+
/** Disables the trigger <button>. */
|
|
35
|
+
triggerDisabled?: boolean;
|
|
27
36
|
id?: string;
|
|
28
37
|
};
|
|
29
38
|
export declare function Dropdown(props: DropdownProps): JSX.Element;
|
|
@@ -20,6 +20,8 @@ export type SelectProps<T = string> = {
|
|
|
20
20
|
placeholder?: string;
|
|
21
21
|
multiSelect?: boolean;
|
|
22
22
|
disabled?: boolean;
|
|
23
|
+
/** Apply a comfortable minimum width to the trigger. Default: sizes to content. */
|
|
24
|
+
wide?: boolean;
|
|
23
25
|
className?: string;
|
|
24
26
|
id?: string;
|
|
25
27
|
};
|
|
@@ -156,7 +156,9 @@
|
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
.trigger_daofbw {
|
|
159
|
-
display: inline-
|
|
159
|
+
display: inline-flex;
|
|
160
|
+
align-items: center;
|
|
161
|
+
gap: var(--polly-space-sm);
|
|
160
162
|
padding: var(--polly-space-sm) var(--polly-space-md);
|
|
161
163
|
border: var(--polly-border-width-default) solid var(--polly-border);
|
|
162
164
|
border-radius: var(--polly-radius-sm);
|
|
@@ -166,15 +168,37 @@
|
|
|
166
168
|
color: var(--polly-text);
|
|
167
169
|
text-align: left;
|
|
168
170
|
cursor: pointer;
|
|
171
|
+
max-width: 100%;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.trigger_daofbw:disabled, .trigger_daofbw[aria-disabled="true"] {
|
|
175
|
+
opacity: var(--polly-opacity-disabled);
|
|
176
|
+
cursor: not-allowed;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.triggerWide_daofbw {
|
|
180
|
+
min-width: 140px;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.triggerLabel_daofbw {
|
|
169
184
|
white-space: nowrap;
|
|
170
185
|
overflow: hidden;
|
|
171
186
|
text-overflow: ellipsis;
|
|
172
|
-
|
|
187
|
+
flex: auto;
|
|
188
|
+
min-width: 0;
|
|
173
189
|
}
|
|
174
190
|
|
|
175
|
-
.
|
|
176
|
-
|
|
177
|
-
|
|
191
|
+
.caret_daofbw {
|
|
192
|
+
color: var(--polly-text-muted);
|
|
193
|
+
pointer-events: none;
|
|
194
|
+
flex: none;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.caret_daofbw:before {
|
|
198
|
+
content: "▾";
|
|
199
|
+
display: block;
|
|
200
|
+
font-size: var(--polly-text-xs);
|
|
201
|
+
line-height: 1;
|
|
178
202
|
}
|
|
179
203
|
|
|
180
204
|
.placeholder_daofbw {
|
|
@@ -394,7 +394,17 @@ var dropdownCounter = 0;
|
|
|
394
394
|
var MENU_GAP = 4;
|
|
395
395
|
var VIEWPORT_PADDING = 8;
|
|
396
396
|
function Dropdown(props) {
|
|
397
|
-
const {
|
|
397
|
+
const {
|
|
398
|
+
isOpen,
|
|
399
|
+
trigger,
|
|
400
|
+
children,
|
|
401
|
+
align = "left",
|
|
402
|
+
multiSelect = false,
|
|
403
|
+
className,
|
|
404
|
+
triggerClassName,
|
|
405
|
+
triggerDisabled = false,
|
|
406
|
+
id
|
|
407
|
+
} = props;
|
|
398
408
|
const menuRef = useRef2(null);
|
|
399
409
|
const triggerRef = useRef2(null);
|
|
400
410
|
const idRef = useRef2(`polly-dropdown-${++dropdownCounter}`);
|
|
@@ -507,7 +517,8 @@ function Dropdown(props) {
|
|
|
507
517
|
/* @__PURE__ */ jsxDEV3("button", {
|
|
508
518
|
ref: triggerRef,
|
|
509
519
|
type: "button",
|
|
510
|
-
class: Dropdown_module_default["trigger"],
|
|
520
|
+
class: triggerClassName ?? Dropdown_module_default["trigger"] ?? "",
|
|
521
|
+
disabled: triggerDisabled,
|
|
511
522
|
children: trigger
|
|
512
523
|
}, undefined, false, undefined, this),
|
|
513
524
|
/* @__PURE__ */ jsxDEV3("div", {
|
|
@@ -536,6 +547,9 @@ var Select_module_default = {
|
|
|
536
547
|
select: "select_daofbw",
|
|
537
548
|
label: "label_daofbw",
|
|
538
549
|
trigger: "trigger_daofbw",
|
|
550
|
+
triggerWide: "triggerWide_daofbw",
|
|
551
|
+
triggerLabel: "triggerLabel_daofbw",
|
|
552
|
+
caret: "caret_daofbw",
|
|
539
553
|
placeholder: "placeholder_daofbw",
|
|
540
554
|
actions: "actions_daofbw",
|
|
541
555
|
actionBtn: "actionBtn_daofbw",
|
|
@@ -545,7 +559,7 @@ var Select_module_default = {
|
|
|
545
559
|
};
|
|
546
560
|
|
|
547
561
|
// src/polly-ui/ActionSelect.tsx
|
|
548
|
-
import { jsxDEV as jsxDEV4 } from "preact/jsx-dev-runtime";
|
|
562
|
+
import { jsxDEV as jsxDEV4, Fragment } from "preact/jsx-dev-runtime";
|
|
549
563
|
function labelFor(options, value) {
|
|
550
564
|
for (const opt of options) {
|
|
551
565
|
if (opt.value === value)
|
|
@@ -562,6 +576,7 @@ function ActionSelect(props) {
|
|
|
562
576
|
label,
|
|
563
577
|
placeholder = "Select…",
|
|
564
578
|
disabled = false,
|
|
579
|
+
wide = false,
|
|
565
580
|
className,
|
|
566
581
|
id
|
|
567
582
|
} = props;
|
|
@@ -575,7 +590,12 @@ function ActionSelect(props) {
|
|
|
575
590
|
return;
|
|
576
591
|
dispatchAction(action, { ...actionData ?? {}, value: next });
|
|
577
592
|
};
|
|
578
|
-
const
|
|
593
|
+
const triggerParts = [Select_module_default["trigger"] ?? ""];
|
|
594
|
+
if (isEmpty)
|
|
595
|
+
triggerParts.push(Select_module_default["placeholder"] ?? "");
|
|
596
|
+
if (wide)
|
|
597
|
+
triggerParts.push(Select_module_default["triggerWide"] ?? "");
|
|
598
|
+
const triggerClass = triggerParts.filter(Boolean).join(" ");
|
|
579
599
|
const parts = [Select_module_default["select"] ?? ""];
|
|
580
600
|
if (className)
|
|
581
601
|
parts.push(className);
|
|
@@ -594,13 +614,25 @@ function ActionSelect(props) {
|
|
|
594
614
|
disabled ? /* @__PURE__ */ jsxDEV4("span", {
|
|
595
615
|
class: triggerClass,
|
|
596
616
|
"aria-disabled": "true",
|
|
597
|
-
children:
|
|
617
|
+
children: /* @__PURE__ */ jsxDEV4("span", {
|
|
618
|
+
class: Select_module_default["triggerLabel"],
|
|
619
|
+
children: displayText
|
|
620
|
+
}, undefined, false, undefined, this)
|
|
598
621
|
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV4(Dropdown, {
|
|
599
622
|
isOpen,
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
children:
|
|
603
|
-
|
|
623
|
+
triggerClassName: triggerClass,
|
|
624
|
+
trigger: /* @__PURE__ */ jsxDEV4(Fragment, {
|
|
625
|
+
children: [
|
|
626
|
+
/* @__PURE__ */ jsxDEV4("span", {
|
|
627
|
+
class: Select_module_default["triggerLabel"],
|
|
628
|
+
children: displayText
|
|
629
|
+
}, undefined, false, undefined, this),
|
|
630
|
+
/* @__PURE__ */ jsxDEV4("span", {
|
|
631
|
+
class: Select_module_default["caret"],
|
|
632
|
+
"aria-hidden": "true"
|
|
633
|
+
}, undefined, false, undefined, this)
|
|
634
|
+
]
|
|
635
|
+
}, undefined, true, undefined, this),
|
|
604
636
|
children: options.map((opt) => {
|
|
605
637
|
const isSelected = opt.value === value;
|
|
606
638
|
const optClass = isSelected ? `${Select_module_default["option"]} ${Select_module_default["optionSelected"]}` : Select_module_default["option"];
|
|
@@ -1624,7 +1656,7 @@ function Host() {
|
|
|
1624
1656
|
var ConfirmDialog = { Host, confirm };
|
|
1625
1657
|
// src/polly-ui/Select.tsx
|
|
1626
1658
|
import { useComputed, useSignal as useSignal2 } from "@preact/signals";
|
|
1627
|
-
import { jsxDEV as jsxDEV14 } from "preact/jsx-dev-runtime";
|
|
1659
|
+
import { jsxDEV as jsxDEV14, Fragment as Fragment2 } from "preact/jsx-dev-runtime";
|
|
1628
1660
|
function formatSelected(options, selected) {
|
|
1629
1661
|
if (selected.size === 0)
|
|
1630
1662
|
return "";
|
|
@@ -1643,6 +1675,7 @@ function Select(props) {
|
|
|
1643
1675
|
placeholder = "Select…",
|
|
1644
1676
|
multiSelect = false,
|
|
1645
1677
|
disabled = false,
|
|
1678
|
+
wide = false,
|
|
1646
1679
|
className,
|
|
1647
1680
|
id
|
|
1648
1681
|
} = props;
|
|
@@ -1671,13 +1704,24 @@ function Select(props) {
|
|
|
1671
1704
|
const handleClear = () => {
|
|
1672
1705
|
selected.value = new Set;
|
|
1673
1706
|
};
|
|
1674
|
-
const
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1707
|
+
const triggerParts = [Select_module_default["trigger"] ?? ""];
|
|
1708
|
+
if (isEmpty.value)
|
|
1709
|
+
triggerParts.push(Select_module_default["placeholder"] ?? "");
|
|
1710
|
+
if (wide)
|
|
1711
|
+
triggerParts.push(Select_module_default["triggerWide"] ?? "");
|
|
1712
|
+
const triggerClass = triggerParts.filter(Boolean).join(" ");
|
|
1713
|
+
const triggerContent = /* @__PURE__ */ jsxDEV14(Fragment2, {
|
|
1714
|
+
children: [
|
|
1715
|
+
/* @__PURE__ */ jsxDEV14("span", {
|
|
1716
|
+
class: Select_module_default["triggerLabel"],
|
|
1717
|
+
children: displayText.value
|
|
1718
|
+
}, undefined, false, undefined, this),
|
|
1719
|
+
/* @__PURE__ */ jsxDEV14("span", {
|
|
1720
|
+
class: Select_module_default["caret"],
|
|
1721
|
+
"aria-hidden": "true"
|
|
1722
|
+
}, undefined, false, undefined, this)
|
|
1723
|
+
]
|
|
1724
|
+
}, undefined, true, undefined, this);
|
|
1681
1725
|
const parts = [Select_module_default["select"] ?? ""];
|
|
1682
1726
|
if (className)
|
|
1683
1727
|
parts.push(className);
|
|
@@ -1693,7 +1737,9 @@ function Select(props) {
|
|
|
1693
1737
|
}, undefined, false, undefined, this),
|
|
1694
1738
|
/* @__PURE__ */ jsxDEV14(Dropdown, {
|
|
1695
1739
|
isOpen: isOpen2,
|
|
1696
|
-
trigger:
|
|
1740
|
+
trigger: triggerContent,
|
|
1741
|
+
triggerClassName: triggerClass,
|
|
1742
|
+
triggerDisabled: disabled,
|
|
1697
1743
|
multiSelect,
|
|
1698
1744
|
children: [
|
|
1699
1745
|
multiSelect && /* @__PURE__ */ jsxDEV14("div", {
|
|
@@ -2153,4 +2199,4 @@ export {
|
|
|
2153
2199
|
ActionForm
|
|
2154
2200
|
};
|
|
2155
2201
|
|
|
2156
|
-
//# debugId=
|
|
2202
|
+
//# debugId=D646BF0B09E9BEC064756E2164756E21
|