vim-web 0.3.44-dev.72 → 0.3.44-dev.74
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/types/react-viewers/generic/genericField.d.ts +2 -0
- package/dist/types/react-viewers/generic/inputNumber.d.ts +1 -0
- package/dist/types/react-viewers/helpers/reactUtils.d.ts +12 -0
- package/dist/vim-web.iife.js +34 -10
- package/dist/vim-web.iife.js.map +1 -1
- package/dist/vim-web.js +34 -10
- package/dist/vim-web.js.map +1 -1
- package/package.json +1 -1
package/dist/vim-web.js
CHANGED
|
@@ -74567,6 +74567,26 @@ async function getFamilyTypeNameMap(document2) {
|
|
|
74567
74567
|
})
|
|
74568
74568
|
);
|
|
74569
74569
|
}
|
|
74570
|
+
class MutableState {
|
|
74571
|
+
constructor(initial) {
|
|
74572
|
+
__publicField(this, "_value");
|
|
74573
|
+
__publicField(this, "_onChange", new distExports.SimpleEventDispatcher());
|
|
74574
|
+
this._value = initial;
|
|
74575
|
+
}
|
|
74576
|
+
get() {
|
|
74577
|
+
return this._value;
|
|
74578
|
+
}
|
|
74579
|
+
set(value) {
|
|
74580
|
+
if (value === this._value) return;
|
|
74581
|
+
this._value = value;
|
|
74582
|
+
this._onChange.dispatch(value);
|
|
74583
|
+
}
|
|
74584
|
+
confirm() {
|
|
74585
|
+
}
|
|
74586
|
+
get onChange() {
|
|
74587
|
+
return this._onChange.asEvent();
|
|
74588
|
+
}
|
|
74589
|
+
}
|
|
74570
74590
|
function useRefresher() {
|
|
74571
74591
|
const [refresh, setRefresh] = useState(false);
|
|
74572
74592
|
return {
|
|
@@ -74801,6 +74821,7 @@ function useArgFuncRef(fn) {
|
|
|
74801
74821
|
}
|
|
74802
74822
|
const reactUtils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
74803
74823
|
__proto__: null,
|
|
74824
|
+
MutableState,
|
|
74804
74825
|
useActionRef,
|
|
74805
74826
|
useArgActionRef,
|
|
74806
74827
|
useArgFuncRef,
|
|
@@ -75638,6 +75659,7 @@ function InputNumber(props) {
|
|
|
75638
75659
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
75639
75660
|
"input",
|
|
75640
75661
|
{
|
|
75662
|
+
disabled: props.disabled ?? false,
|
|
75641
75663
|
type: "number",
|
|
75642
75664
|
value: inputValue,
|
|
75643
75665
|
onChange: handleChange,
|
|
@@ -75647,9 +75669,11 @@ function InputNumber(props) {
|
|
|
75647
75669
|
);
|
|
75648
75670
|
}
|
|
75649
75671
|
function GenericEntry(field) {
|
|
75672
|
+
if (field.visible() === false) return null;
|
|
75650
75673
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
75651
75674
|
"div",
|
|
75652
75675
|
{
|
|
75676
|
+
style: {},
|
|
75653
75677
|
className: "vim-sectionbox-offsets-entry vc-text-xs vc-flex vc-items-center vc-justify-between vc-my-2",
|
|
75654
75678
|
children: [
|
|
75655
75679
|
/* @__PURE__ */ jsxRuntimeExports.jsx("dt", { className: "vc-w-1/2 vc-inline", children: field.label }),
|
|
@@ -75662,11 +75686,11 @@ function GenericEntry(field) {
|
|
|
75662
75686
|
function GenericField(props) {
|
|
75663
75687
|
switch (props.field.type) {
|
|
75664
75688
|
case "number":
|
|
75665
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(InputNumber, { state: props.field.state });
|
|
75689
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(InputNumber, { state: props.field.state, disabled: !props.field.enabled() });
|
|
75666
75690
|
case "text":
|
|
75667
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(GenericTextField, { field: props.field });
|
|
75691
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(GenericTextField, { state: props.field.state, disabled: !props.field.enabled() });
|
|
75668
75692
|
case "bool":
|
|
75669
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(GenericBoolField, { field: props.field });
|
|
75693
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(GenericBoolField, { state: props.field.state, disabled: !props.field.enabled() });
|
|
75670
75694
|
default:
|
|
75671
75695
|
return null;
|
|
75672
75696
|
}
|
|
@@ -75676,15 +75700,15 @@ function GenericTextField(props) {
|
|
|
75676
75700
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
75677
75701
|
"input",
|
|
75678
75702
|
{
|
|
75679
|
-
id: props.field.id,
|
|
75680
75703
|
type: "text",
|
|
75681
|
-
|
|
75704
|
+
disabled: props.disabled ?? false,
|
|
75705
|
+
value: props.state.get(),
|
|
75682
75706
|
onChange: (e) => {
|
|
75683
75707
|
refresher.refresh();
|
|
75684
|
-
props.
|
|
75708
|
+
props.state.set(e.target.value);
|
|
75685
75709
|
},
|
|
75686
75710
|
className: "vc-border vc-inline vc-border-gray-300 vc-py-1 vc-w-full vc-px-1",
|
|
75687
|
-
onBlur: () => props.
|
|
75711
|
+
onBlur: () => props.state.confirm()
|
|
75688
75712
|
}
|
|
75689
75713
|
);
|
|
75690
75714
|
}
|
|
@@ -75693,12 +75717,12 @@ function GenericBoolField(props) {
|
|
|
75693
75717
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
75694
75718
|
"input",
|
|
75695
75719
|
{
|
|
75696
|
-
id: props.field.id,
|
|
75697
75720
|
type: "checkbox",
|
|
75698
|
-
|
|
75721
|
+
disabled: props.disabled ?? false,
|
|
75722
|
+
checked: props.state.get(),
|
|
75699
75723
|
onChange: (e) => {
|
|
75700
75724
|
refresher.refresh();
|
|
75701
|
-
props.
|
|
75725
|
+
props.state.set(e.target.checked);
|
|
75702
75726
|
},
|
|
75703
75727
|
className: "vc-border vc-inline vc-border-gray-300 vc-py-1 vc-w-full vc-px-1"
|
|
75704
75728
|
}
|