vim-web 1.0.0-alpha.1 → 1.0.0-alpha.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.
package/dist/vim-web.js CHANGED
@@ -86162,7 +86162,7 @@ function UltraSuggestion() {
86162
86162
  "a",
86163
86163
  {
86164
86164
  className: "vc-text-primary vc-underline vc-font-bold",
86165
- href: "https://docs.vimaec.com/docs/vim-for-windows/configuring-vim-ultra",
86165
+ href: "https://docs.vimaec.com/docs/vim-flex/vim-ultra",
86166
86166
  target: "_blank",
86167
86167
  rel: "noopener noreferrer",
86168
86168
  children: "VIM Ultra"
@@ -86548,19 +86548,48 @@ function GenericBoolField(props) {
86548
86548
  }
86549
86549
  function GenericSelectField(props) {
86550
86550
  const refresher = useRefresher();
86551
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
86552
- "select",
86553
- {
86554
- disabled: props.disabled ?? false,
86555
- value: props.field.state.get(),
86556
- onChange: (e) => {
86557
- refresher.refresh();
86558
- props.field.state.set(e.target.value);
86551
+ const [open, setOpen] = useState(false);
86552
+ const ref = useRef(null);
86553
+ useEffect(() => {
86554
+ if (!open) return;
86555
+ const onPointerDown = (e) => {
86556
+ if (ref.current && !ref.current.contains(e.target)) {
86557
+ setOpen(false);
86558
+ }
86559
+ };
86560
+ document.addEventListener("pointerdown", onPointerDown);
86561
+ return () => document.removeEventListener("pointerdown", onPointerDown);
86562
+ }, [open]);
86563
+ const current = props.field.options.find((o) => o.value === props.field.state.get());
86564
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref, className: "vc-relative vc-w-full", children: [
86565
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
86566
+ "button",
86567
+ {
86568
+ type: "button",
86569
+ disabled: props.disabled ?? false,
86570
+ onClick: () => setOpen((o) => !o),
86571
+ className: "vc-border vc-border-gray-300 vc-py-1 vc-w-full vc-px-1 vc-text-left vc-bg-white vc-cursor-pointer vc-flex vc-items-center vc-justify-between",
86572
+ children: [
86573
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: (current == null ? void 0 : current.label) ?? "" }),
86574
+ /* @__PURE__ */ jsxRuntimeExports.jsx("svg", { className: "vc-w-3 vc-h-3 vc-ml-1 vc-shrink-0", viewBox: "0 0 12 12", fill: "currentColor", children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M2 4l4 4 4-4", stroke: "currentColor", strokeWidth: "2", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }) })
86575
+ ]
86576
+ }
86577
+ ),
86578
+ open && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "vc-absolute vc-left-0 vc-right-0 vc-bottom-full vc-z-50 vc-border vc-border-gray-300 vc-bg-white vc-shadow-lg", children: props.field.options.map((opt) => /* @__PURE__ */ jsxRuntimeExports.jsx(
86579
+ "div",
86580
+ {
86581
+ className: `vc-px-1 vc-py-1 vc-cursor-pointer hover:vc-bg-gray-100 ${opt.value === props.field.state.get() ? "vc-bg-gray-100" : ""}`,
86582
+ onPointerDown: (e) => {
86583
+ e.stopPropagation();
86584
+ props.field.state.set(opt.value);
86585
+ refresher.refresh();
86586
+ setOpen(false);
86587
+ },
86588
+ children: opt.label
86559
86589
  },
86560
- className: "vc-border vc-inline vc-border-gray-300 vc-py-1 vc-w-full vc-px-1",
86561
- children: props.field.options.map((opt) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: opt.value, children: opt.label }, opt.value))
86562
- }
86563
- );
86590
+ opt.value
86591
+ )) })
86592
+ ] });
86564
86593
  }
86565
86594
  function useCustomizer(baseEntries, ref) {
86566
86595
  const customization = useRef();
@@ -87224,20 +87253,48 @@ function renderSettingsToggle(settings2, item) {
87224
87253
  }
87225
87254
  function renderSettingsSelect(settings2, item) {
87226
87255
  const value = item.getter(settings2.value);
87227
- const handleChange = (e) => {
87228
- settings2.update((s) => item.setter(s, e.target.value));
87229
- };
87256
+ const [open, setOpen] = useState(false);
87257
+ const ref = useRef(null);
87258
+ useEffect(() => {
87259
+ if (!open) return;
87260
+ const onPointerDown = (e) => {
87261
+ if (ref.current && !ref.current.contains(e.target)) {
87262
+ setOpen(false);
87263
+ }
87264
+ };
87265
+ document.addEventListener("pointerdown", onPointerDown);
87266
+ return () => document.removeEventListener("pointerdown", onPointerDown);
87267
+ }, [open]);
87268
+ const current = item.options.find((o) => o.value === value);
87230
87269
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: "vc-m-1 vc-block vc-select-none vc-items-center vc-py-1 vc-text-gray-warm", children: [
87231
87270
  item.label,
87232
- /* @__PURE__ */ jsxRuntimeExports.jsx(
87233
- "select",
87234
- {
87235
- value,
87236
- onChange: handleChange,
87237
- className: "vc-ml-2 vc-rounded vc-border vc-border-gray-medium vc-bg-white vc-px-1 vc-py-0.5 vc-text-sm",
87238
- children: item.options.map((opt) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: opt.value, children: opt.label }, opt.value))
87239
- }
87240
- )
87271
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref, className: "vc-relative vc-inline-block vc-ml-2", children: [
87272
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
87273
+ "button",
87274
+ {
87275
+ type: "button",
87276
+ onClick: () => setOpen((o) => !o),
87277
+ className: "vc-rounded vc-border vc-border-gray-medium vc-bg-white vc-px-1 vc-py-0.5 vc-text-sm vc-cursor-pointer vc-text-left vc-inline-flex vc-items-center vc-gap-1",
87278
+ children: [
87279
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: (current == null ? void 0 : current.label) ?? "" }),
87280
+ /* @__PURE__ */ jsxRuntimeExports.jsx("svg", { className: "vc-w-3 vc-h-3 vc-shrink-0", viewBox: "0 0 12 12", children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M2 4l4 4 4-4", stroke: "currentColor", strokeWidth: "2", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }) })
87281
+ ]
87282
+ }
87283
+ ),
87284
+ open && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "vc-absolute vc-left-0 vc-bottom-full vc-z-50 vc-min-w-full vc-rounded vc-border vc-border-gray-medium vc-bg-white vc-shadow-lg vc-text-sm", children: item.options.map((opt) => /* @__PURE__ */ jsxRuntimeExports.jsx(
87285
+ "div",
87286
+ {
87287
+ className: `vc-px-2 vc-py-1 vc-cursor-pointer hover:vc-bg-gray-100 vc-whitespace-nowrap ${opt.value === value ? "vc-bg-gray-100" : ""}`,
87288
+ onPointerDown: (e) => {
87289
+ e.stopPropagation();
87290
+ settings2.update((s) => item.setter(s, opt.value));
87291
+ setOpen(false);
87292
+ },
87293
+ children: opt.label
87294
+ },
87295
+ opt.value
87296
+ )) })
87297
+ ] })
87241
87298
  ] });
87242
87299
  }
87243
87300
  function renderSettingsSubtitle(item) {