@mono-lit/helper 0.0.3 → 0.0.5

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 (135) hide show
  1. package/dist/control-tooltip-7vegYmq3.js +678 -0
  2. package/dist/{tooltip-FCMRUSLi.js → control-tooltip-C3rA_nSH.js} +12 -119
  3. package/dist/{data-source-controller-Cf_sMxEh.js → data-source-controller-C6C4ej_M.js} +1 -1
  4. package/dist/{data-source-options-Bk-UoaZV.js → data-source-options-Cz9fVLK8.js} +3 -2
  5. package/dist/{data-source-read-Cuqw3LcP.js → data-source-read-i6CYSUEl.js} +2 -1
  6. package/dist/{excel-DtRpxmxs.js → excel-BPdDt06G.js} +1 -1
  7. package/dist/{export-B91P6J1y.js → export-DgomqI_3.js} +2 -2
  8. package/dist/export.js +2 -2
  9. package/dist/{field-icons-FmyBWa0g.js → field-icons-t8rXRCKs.js} +50 -1
  10. package/dist/field-tooltip-FyMi9vNM.js +266 -0
  11. package/dist/field-tooltip.css_raw-DEctHXKm.js +270 -0
  12. package/dist/field-validation-CHHQi1zl.js +170 -0
  13. package/dist/field-validation.css_raw-B3Iu33rS.js +178 -0
  14. package/dist/index.js +4 -3
  15. package/dist/{index.node-dvrNviMx.js → index.node-DzCuvHLg.js} +1 -1
  16. package/dist/index.node.js +4 -3
  17. package/dist/input-format-GrRCJBqV.js +251 -0
  18. package/dist/input.css_raw-CQu2fAsU.js +5 -0
  19. package/dist/{mono-data-grid-BHlo1IgR.js → mono-data-grid-KDpu4d4_.js} +5 -4
  20. package/dist/{mono-form-controller-IYn0MuUQ.js → mono-form-controller-BkMR8g14.js} +18 -3
  21. package/dist/{reactive-DFCdZbH9.js → normalize-error-BmLbgANw.js} +1 -48
  22. package/dist/nuxt.js +36 -8
  23. package/dist/{popup-portal-HWhkd7oy.js → popup-portal-C8ttHDRX.js} +17 -1
  24. package/dist/{popup-stack-De05Y-mJ.js → popup-stack-C64WCuXq.js} +21 -1
  25. package/dist/src/components/accordion/accordion-core.d.ts +4 -1
  26. package/dist/src/components/accordion/mono-accordion.shadow.d.ts +4 -1
  27. package/dist/src/components/date/date-core.d.ts +3 -0
  28. package/dist/src/components/date/date-types.d.ts +36 -1
  29. package/dist/src/components/drawer/drawer-core.d.ts +1 -0
  30. package/dist/src/components/dropdown-table/dropdown-table-core.d.ts +3 -0
  31. package/dist/src/components/dropdown-table/dropdown-table-types.d.ts +31 -0
  32. package/dist/src/components/form/form-types.d.ts +23 -5
  33. package/dist/src/components/input/index.d.ts +2 -2
  34. package/dist/src/components/input/index.shadow.d.ts +2 -2
  35. package/dist/src/components/input/input-core.d.ts +23 -3
  36. package/dist/src/components/input/input-types.d.ts +84 -9
  37. package/dist/src/components/input/mono-input.d.ts +3 -2
  38. package/dist/src/components/input/mono-input.shadow.d.ts +3 -2
  39. package/dist/src/components/modal/modal-core.d.ts +1 -0
  40. package/dist/src/components/otp/index.d.ts +5 -0
  41. package/dist/src/components/otp/index.shadow.d.ts +6 -0
  42. package/dist/src/components/otp/mono-otp.d.ts +32 -0
  43. package/dist/src/components/otp/mono-otp.shadow.d.ts +30 -0
  44. package/dist/src/components/otp/otp-core.d.ts +91 -0
  45. package/dist/src/components/otp/otp-types.d.ts +161 -0
  46. package/dist/src/components/otp/otp-utils.d.ts +41 -0
  47. package/dist/src/components/select/select-core.d.ts +3 -0
  48. package/dist/src/components/select/select-types.d.ts +31 -0
  49. package/dist/src/components/slider/index.d.ts +5 -0
  50. package/dist/src/components/slider/index.shadow.d.ts +6 -0
  51. package/dist/src/components/slider/mono-slider.d.ts +33 -0
  52. package/dist/src/components/slider/mono-slider.shadow.d.ts +29 -0
  53. package/dist/src/components/slider/slider-core.d.ts +77 -0
  54. package/dist/src/components/slider/slider-math.d.ts +102 -0
  55. package/dist/src/components/slider/slider-types.d.ts +188 -0
  56. package/dist/src/components/tag-input/tag-input-core.d.ts +3 -0
  57. package/dist/src/components/tag-input/tag-input-types.d.ts +31 -0
  58. package/dist/src/components/textarea/textarea-core.d.ts +3 -0
  59. package/dist/src/components/textarea/textarea-types.d.ts +31 -0
  60. package/dist/src/composables/field-bubble.d.ts +34 -0
  61. package/dist/src/composables/field-icons.d.ts +10 -0
  62. package/dist/src/composables/field-tooltip.d.ts +52 -0
  63. package/dist/src/composables/field-validation.d.ts +58 -0
  64. package/dist/src/composables/popup-portal.d.ts +12 -0
  65. package/dist/src/composables/popup-stack.d.ts +21 -0
  66. package/dist/src/entries/index.d.ts +1 -1
  67. package/dist/src/entries/index.node.d.ts +1 -1
  68. package/dist/src/nuxt/index.d.ts +2 -2
  69. package/dist/src/nuxt/ssr-lit/index.d.ts +4 -0
  70. package/dist/ssr-lit/runtime/components/LitWrapper.vue +11 -0
  71. package/dist/ssr-lit/runtime/components/LitWrapperClient.vue +11 -0
  72. package/dist/ssr-lit/runtime/components/LitWrapperServer.vue +38 -0
  73. package/dist/ssr-lit/runtime/plugins/antiFouc.server.js +25 -0
  74. package/dist/ssr-lit/runtime/plugins/hydrateSupport.client.js +4 -0
  75. package/dist/ssr-lit/runtime/plugins/polyfill.client.js +9 -0
  76. package/dist/ssr-lit/runtime/utils/customElements.js +11 -0
  77. package/dist/ssr-lit/runtime/utils/litElementRenderer.js +28 -0
  78. package/dist/{styles-D-ergrfR.js → styles-BODNpZV1.js} +1 -1
  79. package/dist/tooltip-Drekihf5.js +102 -0
  80. package/dist/tooltip-loader-3U9FTOXj.js +20 -0
  81. package/dist/tooltip-loader-Dcp9AUZn.js +23 -0
  82. package/dist/tooltip.js +3 -1
  83. package/dist/ui/accordion.js +16 -3
  84. package/dist/ui/alert.js +2 -2
  85. package/dist/ui/breadcrumb.js +1 -1
  86. package/dist/ui/button-dropdown.js +1 -1
  87. package/dist/ui/chart.js +1 -1
  88. package/dist/ui/date.js +66 -5
  89. package/dist/ui/drawer.js +11 -2
  90. package/dist/ui/dropdown-table.js +60 -5
  91. package/dist/ui/dropdown.js +3 -2
  92. package/dist/ui/file-upload.js +1 -1
  93. package/dist/ui/form.js +1 -1
  94. package/dist/ui/index.css +8857 -3974
  95. package/dist/ui/input.js +362 -260
  96. package/dist/ui/menu.js +1 -1
  97. package/dist/ui/modal.js +11 -2
  98. package/dist/ui/otp.js +835 -0
  99. package/dist/ui/select.js +67 -3
  100. package/dist/ui/shadow/accordion.js +31 -4
  101. package/dist/ui/shadow/alert.js +1 -1
  102. package/dist/ui/shadow/button-dropdown.js +1 -1
  103. package/dist/ui/shadow/chart.js +4 -4
  104. package/dist/ui/shadow/date.js +67 -6
  105. package/dist/ui/shadow/drawer.js +11 -2
  106. package/dist/ui/shadow/dropdown-table.js +62 -7
  107. package/dist/ui/shadow/dropdown.js +3 -2
  108. package/dist/ui/shadow/input.js +367 -261
  109. package/dist/ui/shadow/modal.js +11 -2
  110. package/dist/ui/shadow/otp.js +842 -0
  111. package/dist/ui/shadow/select.js +71 -6
  112. package/dist/ui/shadow/sidebar.js +2 -2
  113. package/dist/ui/shadow/slider.js +1082 -0
  114. package/dist/ui/shadow/table.js +6 -6
  115. package/dist/ui/shadow/tag-input.js +72 -7
  116. package/dist/ui/shadow/textarea.js +63 -2
  117. package/dist/ui/sidebar.js +2 -2
  118. package/dist/ui/slider.js +1079 -0
  119. package/dist/ui/table.js +2 -2
  120. package/dist/ui/tag-input.js +67 -3
  121. package/dist/ui/textarea.js +62 -1
  122. package/dist/ui/theme/luma.css +505 -466
  123. package/dist/ui/theme/lyra.css +505 -466
  124. package/dist/ui/theme/maia.css +501 -466
  125. package/dist/ui/theme/mira.css +505 -466
  126. package/dist/ui/theme/nova.css +503 -466
  127. package/dist/ui/theme/one.css +742 -699
  128. package/dist/ui/theme/rhea.css +506 -466
  129. package/dist/ui/theme/sera.css +507 -466
  130. package/dist/ui/theme/vega.css +495 -466
  131. package/dist/{vite-DcyRlTTf.js → vite-CivRCJaf.js} +2 -0
  132. package/dist/vite.js +1 -1
  133. package/dist/vue.d.ts +10 -0
  134. package/package.json +30 -15
  135. package/dist/input.css_raw-CGESifay.js +0 -5
@@ -1,5 +1,7 @@
1
+ import { d as __exportAll } from "./styles-BODNpZV1.js";
1
2
  import { n as unwrapReactive, t as resolveMaybeReactive } from "./reactive-Dtd-esHO.js";
2
- import { a as unregisterPopupLayer, r as registerPopupLayer } from "./popup-stack-De05Y-mJ.js";
3
+ import { i as registerPopupLayer, o as unregisterPopupLayer } from "./popup-stack-C64WCuXq.js";
4
+ import { t as loadFloatingUi } from "./tooltip-loader-Dcp9AUZn.js";
3
5
 
4
6
  //#region src/components/tooltip/tooltip-config.ts
5
7
  const DEFAULT_TOOLTIP_OPTIONS = {
@@ -46,27 +48,16 @@ function resolveTooltipOptions(local, anchor) {
46
48
  return out;
47
49
  }
48
50
 
49
- //#endregion
50
- //#region src/components/tooltip/tooltip-loader.ts
51
- /**
52
- * Cached loader for the OPTIONAL `@floating-ui/dom` peer (which itself depends on
53
- * `@floating-ui/core` — both are the consumer's to install).
54
- *
55
- * Loaded on the FIRST show, never at import: registering a tooltip in
56
- * `<script setup>` costs nothing until somebody actually hovers. Externalized by
57
- * `NEVER_BUNDLE` in `tsdown.config.ts`, so the consumer's bundler resolves and splits it.
58
- */
59
- let _floatingPromise = null;
60
- function loadFloatingUi() {
61
- _floatingPromise ??= import("@floating-ui/dom").catch((err) => {
62
- _floatingPromise = null;
63
- throw new Error("[mono-tooltip] needs the optional peer dependencies \"@floating-ui/dom\" and \"@floating-ui/core\". Install them in your app: pnpm add @floating-ui/dom @floating-ui/core" + (err?.message ? ` (original error: ${err.message})` : ""));
64
- });
65
- return _floatingPromise;
66
- }
67
-
68
51
  //#endregion
69
52
  //#region src/components/tooltip/control-tooltip.ts
53
+ var control_tooltip_exports = /* @__PURE__ */ __exportAll({
54
+ ANCHOR_ATTR_PREFIX: () => ANCHOR_ATTR_PREFIX,
55
+ controlMonoTooltip: () => controlMonoTooltip,
56
+ createTooltipController: () => createTooltipController,
57
+ destroyAllTooltipControllers: () => destroyAllTooltipControllers,
58
+ hasLiveDocument: () => hasLiveDocument,
59
+ monoTooltip: () => monoTooltip
60
+ });
70
61
  /** Grace period so an INTERACTIVE tooltip can be reached across the offset gap. */
71
62
  const INTERACTIVE_HIDE_GRACE = 120;
72
63
  /** Longest the exit transition may take before the element is removed anyway. */
@@ -701,102 +692,4 @@ function destroyAllTooltipControllers() {
701
692
  }
702
693
 
703
694
  //#endregion
704
- //#region src/components/tooltip/tooltip-declarative.ts
705
- /** The two text attributes — `message` is an alias of `content`. */
706
- const TOOLTIP_ATTRIBUTE_SELECTOR = "[mono-tooltip-content], [mono-tooltip-message]";
707
- let declarative = null;
708
- /**
709
- * Per-element options, from `mono-tooltip-<option>` attributes:
710
- *
711
- * | attribute | option |
712
- * | --- | --- |
713
- * | `mono-tooltip-content` / `-message` | `content` (text) |
714
- * | `mono-tooltip-placement` / `-variant` / `-color` / `-size` | same name |
715
- * | `mono-tooltip-trigger` | `"hover focus"`, `"click"`, … |
716
- * | `mono-tooltip-delay` | `"300"` or `"300 100"` |
717
- * | `mono-tooltip-offset` / `-padding` | numbers |
718
- * | `mono-tooltip-max-width` / `-class` | strings |
719
- * | `mono-tooltip-arrow` / `-flip` / `-shift` / `-interactive` / `-html` / `-disabled` / `-hide-on-click` | booleans — present = on, `"false"` = off |
720
- */
721
- function readTooltipAttributes(el) {
722
- const get = (name) => el.getAttribute(`mono-tooltip-${name}`);
723
- const str = (name) => get(name)?.trim() || void 0;
724
- const bool = (name) => {
725
- const v = get(name);
726
- return v === null ? void 0 : v.trim() !== "false";
727
- };
728
- const num = (name) => {
729
- const v = str(name);
730
- const n = v === void 0 ? NaN : Number(v);
731
- return Number.isFinite(n) ? n : void 0;
732
- };
733
- const list = (name) => str(name)?.split(/[\s,]+/).filter(Boolean);
734
- const content = get("content") ?? get("message") ?? void 0;
735
- const delay = list("delay")?.map(Number).filter(Number.isFinite);
736
- return {
737
- content,
738
- placement: str("placement"),
739
- variant: str("variant"),
740
- color: str("color"),
741
- size: str("size"),
742
- trigger: list("trigger"),
743
- delay: delay?.length ? delay.length > 1 ? [delay[0], delay[1]] : delay[0] : void 0,
744
- offset: num("offset"),
745
- padding: num("padding"),
746
- maxWidth: str("max-width"),
747
- class: str("class"),
748
- arrow: bool("arrow"),
749
- flip: bool("flip"),
750
- shift: bool("shift"),
751
- interactive: bool("interactive"),
752
- allowHTML: bool("html"),
753
- disabled: bool("disabled"),
754
- hideOnClick: bool("hide-on-click")
755
- };
756
- }
757
- /**
758
- * Set the app-wide tooltip options AND switch on the `mono-tooltip-*` attributes.
759
- * Call once — usually in `main.ts`:
760
- *
761
- * ```ts
762
- * app.use(createMonoTooltip({ delay: [300, 0] }))
763
- * // or simply
764
- * createMonoTooltip()
765
- * ```
766
- *
767
- * The options WIN over the ones passed to `controlMonoTooltip`; an element's own
768
- * `mono-tooltip-*` attributes win over them. A later call replaces the previous
769
- * global options wholesale. `attributes: false` keeps the options but turns the
770
- * declarative attributes off.
771
- */
772
- function createMonoTooltip(options = {}) {
773
- setMonoTooltipGlobal(options);
774
- const wantAttributes = options.attributes !== false;
775
- if (wantAttributes && !declarative && hasLiveDocument()) declarative = createTooltipController(TOOLTIP_ATTRIBUTE_SELECTOR, {}, readTooltipAttributes);
776
- else if (!wantAttributes && declarative) {
777
- declarative.destroy();
778
- declarative = null;
779
- }
780
- return {
781
- options: { ...options },
782
- install() {}
783
- };
784
- }
785
- /**
786
- * Close and forget every live tooltip controller — the attribute one included
787
- * (a later `createMonoTooltip()` turns the attributes back on). For tests and a
788
- * full app teardown; the global options are kept.
789
- */
790
- function destroyAllMonoTooltips() {
791
- destroyAllTooltipControllers();
792
- declarative = null;
793
- }
794
- /** Drop the global options and turn the attributes off (tests, runtime reconfiguration). */
795
- function resetMonoTooltip() {
796
- setMonoTooltipGlobal(null);
797
- declarative?.destroy();
798
- declarative = null;
799
- }
800
-
801
- //#endregion
802
- export { resetMonoTooltip as a, loadFloatingUi as c, resolveTooltipOptions as d, readTooltipAttributes as i, DEFAULT_TOOLTIP_OPTIONS as l, createMonoTooltip as n, controlMonoTooltip as o, destroyAllMonoTooltips as r, monoTooltip as s, TOOLTIP_ATTRIBUTE_SELECTOR as t, getMonoTooltipGlobal as u };
695
+ export { hasLiveDocument as a, getMonoTooltipGlobal as c, destroyAllTooltipControllers as i, resolveTooltipOptions as l, control_tooltip_exports as n, monoTooltip as o, createTooltipController as r, DEFAULT_TOOLTIP_OPTIONS as s, controlMonoTooltip as t, setMonoTooltipGlobal as u };
@@ -1,4 +1,4 @@
1
- import { a as describeError, l as isCanceled } from "./reactive-DFCdZbH9.js";
1
+ import { n as describeError, o as isCanceled } from "./normalize-error-BmLbgANw.js";
2
2
 
3
3
  //#region src/composables/data-source-controller.ts
4
4
  /**
@@ -1,6 +1,7 @@
1
1
  import { n as isPath, r as mergePatch, t as getFieldValue } from "./field-path-BabiMrrA.js";
2
- import { A as compileFilterPredicate, O as andFilters, h as mergeSearchFields, k as andPredicates, t as resolveMaybeReactive } from "./reactive-DFCdZbH9.js";
3
- import { i as searchFilterOf, s as flattenLeaves, t as isDataSourceLike } from "./data-source-read-Cuqw3LcP.js";
2
+ import { D as compileFilterPredicate, E as andPredicates, T as andFilters, f as mergeSearchFields } from "./normalize-error-BmLbgANw.js";
3
+ import { i as searchFilterOf, s as flattenLeaves, t as isDataSourceLike } from "./data-source-read-i6CYSUEl.js";
4
+ import { t as resolveMaybeReactive } from "./reactive-Dtd-esHO.js";
4
5
  import { s as odataStringToArray, t as arrayToODataString } from "./filter-odata-Bi27XUpQ.js";
5
6
 
6
7
  //#region src/components/table/array-source.ts
@@ -1,5 +1,6 @@
1
1
  import { c as toODataClause, n as isPath, t as getFieldValue } from "./field-path-BabiMrrA.js";
2
- import { O as andFilters, n as unwrapReactive } from "./reactive-DFCdZbH9.js";
2
+ import { T as andFilters } from "./normalize-error-BmLbgANw.js";
3
+ import { n as unwrapReactive } from "./reactive-Dtd-esHO.js";
3
4
 
4
5
  //#region src/components/table/grouping.ts
5
6
  /**
@@ -1,4 +1,4 @@
1
- import { a as flattenInline, i as toExcelStyle, n as combineStyles, r as mergeStyles } from "./styles-D-ergrfR.js";
1
+ import { a as flattenInline, i as toExcelStyle, n as combineStyles, r as mergeStyles } from "./styles-BODNpZV1.js";
2
2
 
3
3
  //#region src/export/sheet-name.ts
4
4
  /**
@@ -1,6 +1,6 @@
1
1
  import { a as stripDirectives, i as escapeCellText, n as parseMarkdown, o as __commonJSMin, r as encodeDirective, s as __toESM } from "./markdown-uGlE_OfJ.js";
2
- import { n as unwrapReactive } from "./reactive-DFCdZbH9.js";
3
- import { n as isReadableSource, r as readAllRows } from "./data-source-read-Cuqw3LcP.js";
2
+ import { n as isReadableSource, r as readAllRows } from "./data-source-read-i6CYSUEl.js";
3
+ import { n as unwrapReactive } from "./reactive-Dtd-esHO.js";
4
4
  import { t as DEFAULT_STYLES } from "./excel-BXzr3uI1.js";
5
5
 
6
6
  //#region src/export/download.ts
package/dist/export.js CHANGED
@@ -1,4 +1,4 @@
1
- import { c as escapeCellText, d as __toESM, l as stripDirectives, o as parseMarkdown, s as encodeDirective, t as DEFAULT_STYLES, u as __commonJSMin } from "./styles-D-ergrfR.js";
1
+ import { c as escapeCellText, f as __toESM, l as stripDirectives, o as parseMarkdown, s as encodeDirective, t as DEFAULT_STYLES, u as __commonJSMin } from "./styles-BODNpZV1.js";
2
2
  import { n as isReadableSource, r as readAllRows } from "./data-source-read-FxqzQkk2.js";
3
3
  import { n as unwrapReactive } from "./reactive-Dtd-esHO.js";
4
4
 
@@ -2341,7 +2341,7 @@ async function exportTable(options) {
2341
2341
  }
2342
2342
  let workbookPromise = null;
2343
2343
  const workbook = () => {
2344
- workbookPromise ??= import("./excel-DtRpxmxs.js").then(({ renderExcel }) => renderExcel(parseMarkdown(rendered), {
2344
+ workbookPromise ??= import("./excel-BPdDt06G.js").then(({ renderExcel }) => renderExcel(parseMarkdown(rendered), {
2345
2345
  ...options,
2346
2346
  back: options.detail?.back,
2347
2347
  sheets: detailSheets.map((s) => ({
@@ -83,6 +83,55 @@ function refreshIcon() {
83
83
  />
84
84
  </svg>`;
85
85
  }
86
+ /**
87
+ * ⓘ — the label's "more information" affordance (`tooltip` prop). The
88
+ * `mdi:information-outline` path, so the shadow builds draw exactly what the
89
+ * light build's `i-mdi-information-outline` mask paints.
90
+ */
91
+ function infoIcon() {
92
+ return html`<svg
93
+ mono-icon
94
+ viewBox="0 0 24 24"
95
+ width="16"
96
+ height="16"
97
+ fill="currentColor"
98
+ aria-hidden="true"
99
+ >
100
+ <path
101
+ d="M11 9h2V7h-2m1 13c-4.41 0-8-3.59-8-8s3.59-8 8-8s8 3.59 8 8s-3.59 8-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10a10 10 0 0 0 10-10A10 10 0 0 0 12 2m-1 15h2v-6h-2z"
102
+ />
103
+ </svg>`;
104
+ }
105
+ /** `validation-position="icon"` — mdi alert-circle-outline (invalid / warning). */
106
+ function alertCircleIcon() {
107
+ return html`<svg
108
+ mono-icon
109
+ viewBox="0 0 24 24"
110
+ width="16"
111
+ height="16"
112
+ fill="currentColor"
113
+ aria-hidden="true"
114
+ >
115
+ <path
116
+ d="M11 15h2v2h-2zm0-8h2v6h-2zm1-5C6.47 2 2 6.5 2 12a10 10 0 0 0 10 10a10 10 0 0 0 10-10A10 10 0 0 0 12 2m0 18a8 8 0 0 1-8-8a8 8 0 0 1 8-8a8 8 0 0 1 8 8a8 8 0 0 1-8 8"
117
+ />
118
+ </svg>`;
119
+ }
120
+ /** `validation-position="icon"` — mdi check-circle-outline (valid). */
121
+ function checkCircleIcon() {
122
+ return html`<svg
123
+ mono-icon
124
+ viewBox="0 0 24 24"
125
+ width="16"
126
+ height="16"
127
+ fill="currentColor"
128
+ aria-hidden="true"
129
+ >
130
+ <path
131
+ d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10s10-4.5 10-10S17.5 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8s8 3.59 8 8s-3.59 8-8 8m4.59-12.42L10 14.17l-2.59-2.58L6 13l4 4l8-8z"
132
+ />
133
+ </svg>`;
134
+ }
86
135
 
87
136
  //#endregion
88
- export { spinnerIcon as a, refreshIcon as i, chevronIcon as n, closeIcon as r, caretIcon as t };
137
+ export { closeIcon as a, spinnerIcon as c, chevronIcon as i, caretIcon as n, infoIcon as o, checkCircleIcon as r, refreshIcon as s, alertCircleIcon as t };
@@ -0,0 +1,266 @@
1
+ import { o as infoIcon } from "./field-icons-t8rXRCKs.js";
2
+ import { html, nothing } from "lit";
3
+ import { ref } from "lit/directives/ref.js";
4
+
5
+ //#region src/composables/field-bubble.ts
6
+ /** Gap between anchor and bubble, and the bubble's minimum distance to the viewport edge. */
7
+ const GAP = 8;
8
+ const EDGE = 8;
9
+ /** Grace period for moving the pointer from the anchor onto the bubble. */
10
+ const HIDE_DELAY = 120;
11
+ let _uid = 0;
12
+ var FieldBubble = class {
13
+ constructor(options = {}) {
14
+ this.id = `mono-field-bubble-${++_uid}`;
15
+ this._anchor = null;
16
+ this._bubble = null;
17
+ this._open = false;
18
+ this.setAnchor = (el) => {
19
+ this._anchor = el ?? null;
20
+ };
21
+ this.setBubble = (el) => {
22
+ if ((el ?? null) !== this._bubble) this.hide();
23
+ this._bubble = el ?? null;
24
+ };
25
+ this.show = () => {
26
+ this.cancelHide();
27
+ const bubble = this._bubble;
28
+ if (!bubble || !bubble.isConnected || !this._anchor) return;
29
+ if (!this._open) {
30
+ this._open = true;
31
+ bubble.setAttribute("mono-open", "");
32
+ try {
33
+ if (typeof bubble.showPopover === "function" && !bubble.matches(":popover-open")) bubble.showPopover();
34
+ } catch {}
35
+ window.addEventListener("scroll", this.place, true);
36
+ window.addEventListener("resize", this.place);
37
+ }
38
+ this.place();
39
+ };
40
+ this.hide = () => {
41
+ this.cancelHide();
42
+ if (!this._open) return;
43
+ this._open = false;
44
+ window.removeEventListener("scroll", this.place, true);
45
+ window.removeEventListener("resize", this.place);
46
+ const bubble = this._bubble;
47
+ if (!bubble) return;
48
+ bubble.removeAttribute("mono-open");
49
+ try {
50
+ if (typeof bubble.hidePopover === "function" && bubble.matches(":popover-open")) bubble.hidePopover();
51
+ } catch {}
52
+ };
53
+ this.scheduleHide = () => {
54
+ this.cancelHide();
55
+ this._hideTimer = setTimeout(this.hide, HIDE_DELAY);
56
+ };
57
+ this.cancelHide = () => {
58
+ if (this._hideTimer !== void 0) clearTimeout(this._hideTimer);
59
+ this._hideTimer = void 0;
60
+ };
61
+ this.onPointerLeave = (e) => {
62
+ if (e.pointerType === "touch") return;
63
+ this.scheduleHide();
64
+ };
65
+ this.onKeydown = (e) => {
66
+ if (e.key === "Escape" && this._open) {
67
+ e.stopPropagation();
68
+ this.hide();
69
+ }
70
+ };
71
+ this.place = () => {
72
+ const anchor = this._anchor;
73
+ const bubble = this._bubble;
74
+ if (!this._open || !anchor || !bubble) return;
75
+ const r = anchor.getBoundingClientRect();
76
+ const vw = document.documentElement.clientWidth || window.innerWidth;
77
+ const vh = window.innerHeight;
78
+ const bw = bubble.offsetWidth;
79
+ const bh = bubble.offsetHeight;
80
+ const above = r.top - GAP - bh;
81
+ const below = r.bottom + GAP;
82
+ const fitsAbove = above >= EDGE;
83
+ const fitsBelow = below + bh <= vh - EDGE;
84
+ const side = this._side === "top" ? fitsAbove || !fitsBelow ? "top" : "bottom" : fitsBelow || !fitsAbove ? "bottom" : "top";
85
+ const top = side === "top" ? above : below;
86
+ const target = this._align === "center" ? r.left + r.width / 2 : r.left + Math.min(16, r.width / 2);
87
+ const ideal = this._align === "center" ? target - bw / 2 : r.left;
88
+ const left = Math.min(Math.max(ideal, EDGE), Math.max(EDGE, vw - EDGE - bw));
89
+ bubble.style.top = `${Math.round(top)}px`;
90
+ bubble.style.left = `${Math.round(left)}px`;
91
+ bubble.style.setProperty("--_mono-field-tip-arrow-x", `${Math.round(target - left)}px`);
92
+ bubble.setAttribute("mono-side", side);
93
+ };
94
+ this._side = options.side ?? "top";
95
+ this._align = options.align ?? "center";
96
+ }
97
+ get isOpen() {
98
+ return this._open;
99
+ }
100
+ };
101
+
102
+ //#endregion
103
+ //#region src/composables/field-tooltip.ts
104
+ /** `controlMonoTooltip` once floating-ui is known to load, else `null`. Probed once per page. */
105
+ let _probe = null;
106
+ function probeTooltip() {
107
+ _probe ??= (async () => {
108
+ try {
109
+ const [{ loadFloatingUi }, { controlMonoTooltip }] = await Promise.all([import("./tooltip-loader-Dcp9AUZn.js").then((n) => n.n), import("./control-tooltip-C3rA_nSH.js").then((n) => n.n)]);
110
+ await loadFloatingUi();
111
+ return controlMonoTooltip;
112
+ } catch {
113
+ return null;
114
+ }
115
+ })();
116
+ return _probe;
117
+ }
118
+ /** `string` → `{ content }`; anything without content → `null` (renders nothing). */
119
+ function normalizeFieldTooltip(value) {
120
+ if (!value) return null;
121
+ if (typeof value === "string") return value.trim() ? { content: value } : null;
122
+ if (typeof value !== "object") return null;
123
+ const { content } = value;
124
+ if (content === void 0 || content === null || content === "") return null;
125
+ return value;
126
+ }
127
+ /** Which bubble a prop value gets: the built-in one, the floating-ui addon, or none. */
128
+ function tooltipMode(value) {
129
+ if (!normalizeFieldTooltip(value)) return null;
130
+ return typeof value === "string" ? "simple" : "floating";
131
+ }
132
+ /** A click on the bubble is still inside the `<label>` and the icon: neither should react. */
133
+ const stopBubbleClick = (e) => {
134
+ e.preventDefault();
135
+ e.stopPropagation();
136
+ };
137
+ const stopLabelActivation = (e) => {
138
+ e.preventDefault();
139
+ };
140
+ var FieldTooltipController = class {
141
+ constructor(host, read) {
142
+ this.host = host;
143
+ this.read = read;
144
+ this._fn = null;
145
+ this._ctrl = null;
146
+ this._el = null;
147
+ this._applied = null;
148
+ this._raw = null;
149
+ this._connected = false;
150
+ this._bubble = new FieldBubble({
151
+ side: "top",
152
+ align: "center"
153
+ });
154
+ this._setEl = (el) => {
155
+ if ((el ?? null) !== this._el) this._unbind();
156
+ this._el = el ?? null;
157
+ this._bubble.setAnchor(this._el);
158
+ };
159
+ this._onIconClick = (e) => {
160
+ stopLabelActivation(e);
161
+ this._bubble.show();
162
+ };
163
+ host.addController(this);
164
+ }
165
+ hostConnected() {
166
+ this._connected = true;
167
+ }
168
+ hostDisconnected() {
169
+ this._connected = false;
170
+ this._bubble.hide();
171
+ this._unbind();
172
+ }
173
+ hostUpdated() {
174
+ if (tooltipMode(this.read()) === "floating") this._ensureProbe();
175
+ this._sync();
176
+ }
177
+ /** The ⓘ for the end of the label row, or `nothing`. */
178
+ render() {
179
+ const raw = this.read();
180
+ const mode = tooltipMode(raw);
181
+ if (mode === "simple") return this._renderSimple(raw);
182
+ if (mode !== "floating" || !this._fn) return nothing;
183
+ return html`<span
184
+ mono-label-tooltip
185
+ tabindex="0"
186
+ role="img"
187
+ aria-label="More information"
188
+ @click=${stopLabelActivation}
189
+ ${ref(this._setEl)}
190
+ >${this._icon()}</span>`;
191
+ }
192
+ /**
193
+ * Plain text: the icon carries its own bubble. `aria-describedby` reads the
194
+ * text to screen readers on focus; hover, focus or a tap shows it, Escape
195
+ * dismisses it, and the pointer may move onto it without it closing.
196
+ */
197
+ _renderSimple(text) {
198
+ return html`<span
199
+ mono-label-tooltip
200
+ tabindex="0"
201
+ role="img"
202
+ aria-label="More information"
203
+ aria-describedby=${this._bubble.id}
204
+ @click=${this._onIconClick}
205
+ @pointerenter=${this._bubble.show}
206
+ @pointerleave=${this._bubble.onPointerLeave}
207
+ @focus=${this._bubble.show}
208
+ @blur=${this._bubble.hide}
209
+ @keydown=${this._bubble.onKeydown}
210
+ ${ref(this._setEl)}
211
+ >${this._icon()}<span
212
+ mono-field-bubble
213
+ mono-label-tooltip-bubble
214
+ id=${this._bubble.id}
215
+ role="tooltip"
216
+ popover="manual"
217
+ @pointerenter=${this._bubble.cancelHide}
218
+ @pointerleave=${this._bubble.onPointerLeave}
219
+ @click=${stopBubbleClick}
220
+ ${ref(this._bubble.setBubble)}
221
+ >${text}</span></span>`;
222
+ }
223
+ /**
224
+ * Light build: the UnoCSS `i-mdi-information-outline` mask (shipped in
225
+ * `ui/index.css`). Shadow build: the same path inline — the page's icon CSS
226
+ * cannot reach a shadow root.
227
+ */
228
+ _icon() {
229
+ if (this.host.renderRoot instanceof ShadowRoot) return infoIcon();
230
+ return html`<span class="mono-icon i-mdi-information-outline" mono-icon aria-hidden="true"></span>`;
231
+ }
232
+ _ensureProbe() {
233
+ if (this._fn || typeof document === "undefined") return;
234
+ probeTooltip().then((fn) => {
235
+ if (!fn || this._fn) return;
236
+ this._fn = fn;
237
+ this.host.requestUpdate();
238
+ });
239
+ }
240
+ _sync() {
241
+ const raw = this.read();
242
+ if (tooltipMode(raw) !== "floating") return this._unbind();
243
+ if (this._ctrl && this._raw === raw) return;
244
+ const options = normalizeFieldTooltip(raw);
245
+ if (!this._fn || !this._connected || !this._el || !options) return this._unbind();
246
+ if (this._ctrl) {
247
+ const blanked = {};
248
+ for (const key of Object.keys(this._applied ?? {})) blanked[key] = void 0;
249
+ this._ctrl.update({
250
+ ...blanked,
251
+ ...options
252
+ });
253
+ } else this._ctrl = this._fn(this._el, options);
254
+ this._applied = options;
255
+ this._raw = raw;
256
+ }
257
+ _unbind() {
258
+ this._ctrl?.destroy();
259
+ this._ctrl = null;
260
+ this._applied = null;
261
+ this._raw = null;
262
+ }
263
+ };
264
+
265
+ //#endregion
266
+ export { FieldBubble as n, FieldTooltipController as t };