@mono-lit/helper 0.0.4 → 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.
- package/dist/control-tooltip-7vegYmq3.js +678 -0
- package/dist/{tooltip-FCMRUSLi.js → control-tooltip-C3rA_nSH.js} +12 -119
- package/dist/{data-source-controller-Cf_sMxEh.js → data-source-controller-C6C4ej_M.js} +1 -1
- package/dist/{data-source-options-Bk-UoaZV.js → data-source-options-Cz9fVLK8.js} +3 -2
- package/dist/{data-source-read-Cuqw3LcP.js → data-source-read-i6CYSUEl.js} +2 -1
- package/dist/{excel-DtRpxmxs.js → excel-BPdDt06G.js} +1 -1
- package/dist/{export-B91P6J1y.js → export-DgomqI_3.js} +2 -2
- package/dist/export.js +2 -2
- package/dist/{field-icons-FmyBWa0g.js → field-icons-t8rXRCKs.js} +50 -1
- package/dist/field-tooltip-FyMi9vNM.js +266 -0
- package/dist/field-tooltip.css_raw-DEctHXKm.js +270 -0
- package/dist/field-validation-CHHQi1zl.js +170 -0
- package/dist/field-validation.css_raw-B3Iu33rS.js +178 -0
- package/dist/index.js +4 -3
- package/dist/{index.node-dvrNviMx.js → index.node-DzCuvHLg.js} +1 -1
- package/dist/index.node.js +4 -3
- package/dist/input-format-GrRCJBqV.js +251 -0
- package/dist/input.css_raw-CQu2fAsU.js +5 -0
- package/dist/{mono-data-grid-BHlo1IgR.js → mono-data-grid-KDpu4d4_.js} +5 -4
- package/dist/{mono-form-controller-IYn0MuUQ.js → mono-form-controller-BkMR8g14.js} +18 -3
- package/dist/{reactive-DFCdZbH9.js → normalize-error-BmLbgANw.js} +1 -48
- package/dist/nuxt.js +1 -1
- package/dist/{popup-portal-HWhkd7oy.js → popup-portal-C8ttHDRX.js} +17 -1
- package/dist/{popup-stack-De05Y-mJ.js → popup-stack-C64WCuXq.js} +21 -1
- package/dist/src/components/accordion/accordion-core.d.ts +4 -1
- package/dist/src/components/accordion/mono-accordion.shadow.d.ts +4 -1
- package/dist/src/components/date/date-core.d.ts +3 -0
- package/dist/src/components/date/date-types.d.ts +36 -1
- package/dist/src/components/drawer/drawer-core.d.ts +1 -0
- package/dist/src/components/dropdown-table/dropdown-table-core.d.ts +3 -0
- package/dist/src/components/dropdown-table/dropdown-table-types.d.ts +31 -0
- package/dist/src/components/form/form-types.d.ts +23 -5
- package/dist/src/components/input/index.d.ts +2 -2
- package/dist/src/components/input/index.shadow.d.ts +2 -2
- package/dist/src/components/input/input-core.d.ts +23 -3
- package/dist/src/components/input/input-types.d.ts +84 -9
- package/dist/src/components/input/mono-input.d.ts +3 -2
- package/dist/src/components/input/mono-input.shadow.d.ts +3 -2
- package/dist/src/components/modal/modal-core.d.ts +1 -0
- package/dist/src/components/otp/index.d.ts +5 -0
- package/dist/src/components/otp/index.shadow.d.ts +6 -0
- package/dist/src/components/otp/mono-otp.d.ts +32 -0
- package/dist/src/components/otp/mono-otp.shadow.d.ts +30 -0
- package/dist/src/components/otp/otp-core.d.ts +91 -0
- package/dist/src/components/otp/otp-types.d.ts +161 -0
- package/dist/src/components/otp/otp-utils.d.ts +41 -0
- package/dist/src/components/select/select-core.d.ts +3 -0
- package/dist/src/components/select/select-types.d.ts +31 -0
- package/dist/src/components/slider/index.d.ts +5 -0
- package/dist/src/components/slider/index.shadow.d.ts +6 -0
- package/dist/src/components/slider/mono-slider.d.ts +33 -0
- package/dist/src/components/slider/mono-slider.shadow.d.ts +29 -0
- package/dist/src/components/slider/slider-core.d.ts +77 -0
- package/dist/src/components/slider/slider-math.d.ts +102 -0
- package/dist/src/components/slider/slider-types.d.ts +188 -0
- package/dist/src/components/tag-input/tag-input-core.d.ts +3 -0
- package/dist/src/components/tag-input/tag-input-types.d.ts +31 -0
- package/dist/src/components/textarea/textarea-core.d.ts +3 -0
- package/dist/src/components/textarea/textarea-types.d.ts +31 -0
- package/dist/src/composables/field-bubble.d.ts +34 -0
- package/dist/src/composables/field-icons.d.ts +10 -0
- package/dist/src/composables/field-tooltip.d.ts +52 -0
- package/dist/src/composables/field-validation.d.ts +58 -0
- package/dist/src/composables/popup-portal.d.ts +12 -0
- package/dist/src/composables/popup-stack.d.ts +21 -0
- package/dist/src/entries/index.d.ts +1 -1
- package/dist/src/entries/index.node.d.ts +1 -1
- package/dist/ssr-lit/runtime/components/LitWrapper.vue +11 -11
- package/dist/ssr-lit/runtime/components/LitWrapperClient.vue +11 -11
- package/dist/ssr-lit/runtime/components/LitWrapperServer.vue +38 -38
- package/dist/ssr-lit/runtime/plugins/antiFouc.server.js +25 -25
- package/dist/ssr-lit/runtime/plugins/hydrateSupport.client.js +4 -4
- package/dist/ssr-lit/runtime/plugins/polyfill.client.js +9 -9
- package/dist/ssr-lit/runtime/utils/customElements.js +11 -11
- package/dist/ssr-lit/runtime/utils/litElementRenderer.js +28 -28
- package/dist/{styles-D-ergrfR.js → styles-BODNpZV1.js} +1 -1
- package/dist/tooltip-Drekihf5.js +102 -0
- package/dist/tooltip-loader-3U9FTOXj.js +20 -0
- package/dist/tooltip-loader-Dcp9AUZn.js +23 -0
- package/dist/tooltip.js +3 -1
- package/dist/ui/accordion.js +16 -3
- package/dist/ui/alert.js +2 -2
- package/dist/ui/breadcrumb.js +1 -1
- package/dist/ui/button-dropdown.js +1 -1
- package/dist/ui/chart.js +1 -1
- package/dist/ui/date.js +66 -5
- package/dist/ui/drawer.js +11 -2
- package/dist/ui/dropdown-table.js +60 -5
- package/dist/ui/dropdown.js +3 -2
- package/dist/ui/file-upload.js +1 -1
- package/dist/ui/form.js +1 -1
- package/dist/ui/index.css +8857 -3974
- package/dist/ui/input.js +362 -260
- package/dist/ui/menu.js +1 -1
- package/dist/ui/modal.js +11 -2
- package/dist/ui/otp.js +835 -0
- package/dist/ui/select.js +67 -3
- package/dist/ui/shadow/accordion.js +31 -4
- package/dist/ui/shadow/alert.js +1 -1
- package/dist/ui/shadow/button-dropdown.js +1 -1
- package/dist/ui/shadow/chart.js +4 -4
- package/dist/ui/shadow/date.js +67 -6
- package/dist/ui/shadow/drawer.js +11 -2
- package/dist/ui/shadow/dropdown-table.js +62 -7
- package/dist/ui/shadow/dropdown.js +3 -2
- package/dist/ui/shadow/input.js +367 -261
- package/dist/ui/shadow/modal.js +11 -2
- package/dist/ui/shadow/otp.js +842 -0
- package/dist/ui/shadow/select.js +71 -6
- package/dist/ui/shadow/sidebar.js +2 -2
- package/dist/ui/shadow/slider.js +1082 -0
- package/dist/ui/shadow/table.js +6 -6
- package/dist/ui/shadow/tag-input.js +72 -7
- package/dist/ui/shadow/textarea.js +63 -2
- package/dist/ui/sidebar.js +2 -2
- package/dist/ui/slider.js +1079 -0
- package/dist/ui/table.js +2 -2
- package/dist/ui/tag-input.js +67 -3
- package/dist/ui/textarea.js +62 -1
- package/dist/ui/theme/luma.css +505 -466
- package/dist/ui/theme/lyra.css +505 -466
- package/dist/ui/theme/maia.css +501 -466
- package/dist/ui/theme/mira.css +505 -466
- package/dist/ui/theme/nova.css +503 -466
- package/dist/ui/theme/one.css +742 -699
- package/dist/ui/theme/rhea.css +506 -466
- package/dist/ui/theme/sera.css +507 -466
- package/dist/ui/theme/vega.css +495 -466
- package/dist/{vite-DcyRlTTf.js → vite-CivRCJaf.js} +2 -0
- package/dist/vite.js +1 -1
- package/dist/vue.d.ts +10 -0
- package/package.json +31 -13
- package/dist/input.css_raw-CGESifay.js +0 -5
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { defineComponent, ssrUtils, mergeProps } from "vue";
|
|
3
|
-
import { ssrRenderVNode, ssrRenderAttrs } from "@vue/server-renderer";
|
|
4
|
-
import { LitElementRenderer } from "@lit-labs/ssr/lib/lit-element-renderer.js";
|
|
5
|
-
import { createLitElementRenderer } from "../utils/litElementRenderer";
|
|
6
|
-
export default defineComponent({
|
|
7
|
-
ssrRender(ctx, push, litWrapperInstance, litWrapperAttrs) {
|
|
8
|
-
const [litElementVNode] = litWrapperInstance.slots.default();
|
|
9
|
-
const litElementTagName = String(litElementVNode.type);
|
|
10
|
-
const litElementVNodeProps = litElementVNode.props || {};
|
|
11
|
-
const renderer = createLitElementRenderer(litElementTagName, litElementVNodeProps);
|
|
12
|
-
if (!renderer) {
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
try {
|
|
16
|
-
renderer.connectedCallback();
|
|
17
|
-
const attributes = ssrRenderAttrs(mergeProps(litElementVNodeProps, litWrapperAttrs));
|
|
18
|
-
push(
|
|
19
|
-
`<${litElementTagName}${attributes} defer-hydration="true"><template shadowrootmode="open" shadowroot="open">`
|
|
20
|
-
);
|
|
21
|
-
for (const shadowContent of renderer.renderShadow({
|
|
22
|
-
elementRenderers: [LitElementRenderer],
|
|
23
|
-
customElementInstanceStack: [renderer],
|
|
24
|
-
customElementHostStack: [renderer]
|
|
25
|
-
})) {
|
|
26
|
-
push(shadowContent);
|
|
27
|
-
}
|
|
28
|
-
push(`</template>`);
|
|
29
|
-
const litElementChildren = litElementVNode.children ? Array.isArray(litElementVNode.children) ? litElementVNode.children : [litElementVNode.children] : [];
|
|
30
|
-
litElementChildren.forEach((child) => ssrRenderVNode(push, ssrUtils.normalizeVNode(child), litWrapperInstance));
|
|
31
|
-
push(`</${litElementTagName}>`);
|
|
32
|
-
} catch (e) {
|
|
33
|
-
console.error(e);
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
</script>
|
|
1
|
+
<script>
|
|
2
|
+
import { defineComponent, ssrUtils, mergeProps } from "vue";
|
|
3
|
+
import { ssrRenderVNode, ssrRenderAttrs } from "@vue/server-renderer";
|
|
4
|
+
import { LitElementRenderer } from "@lit-labs/ssr/lib/lit-element-renderer.js";
|
|
5
|
+
import { createLitElementRenderer } from "../utils/litElementRenderer";
|
|
6
|
+
export default defineComponent({
|
|
7
|
+
ssrRender(ctx, push, litWrapperInstance, litWrapperAttrs) {
|
|
8
|
+
const [litElementVNode] = litWrapperInstance.slots.default();
|
|
9
|
+
const litElementTagName = String(litElementVNode.type);
|
|
10
|
+
const litElementVNodeProps = litElementVNode.props || {};
|
|
11
|
+
const renderer = createLitElementRenderer(litElementTagName, litElementVNodeProps);
|
|
12
|
+
if (!renderer) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
try {
|
|
16
|
+
renderer.connectedCallback();
|
|
17
|
+
const attributes = ssrRenderAttrs(mergeProps(litElementVNodeProps, litWrapperAttrs));
|
|
18
|
+
push(
|
|
19
|
+
`<${litElementTagName}${attributes} defer-hydration="true"><template shadowrootmode="open" shadowroot="open">`
|
|
20
|
+
);
|
|
21
|
+
for (const shadowContent of renderer.renderShadow({
|
|
22
|
+
elementRenderers: [LitElementRenderer],
|
|
23
|
+
customElementInstanceStack: [renderer],
|
|
24
|
+
customElementHostStack: [renderer]
|
|
25
|
+
})) {
|
|
26
|
+
push(shadowContent);
|
|
27
|
+
}
|
|
28
|
+
push(`</template>`);
|
|
29
|
+
const litElementChildren = litElementVNode.children ? Array.isArray(litElementVNode.children) ? litElementVNode.children : [litElementVNode.children] : [];
|
|
30
|
+
litElementChildren.forEach((child) => ssrRenderVNode(push, ssrUtils.normalizeVNode(child), litWrapperInstance));
|
|
31
|
+
push(`</${litElementTagName}>`);
|
|
32
|
+
} catch (e) {
|
|
33
|
+
console.error(e);
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
</script>
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { defineNuxtPlugin, useHead } from "#imports";
|
|
2
|
-
export default defineNuxtPlugin(() => {
|
|
3
|
-
useHead({
|
|
4
|
-
style: [
|
|
5
|
-
{
|
|
6
|
-
innerHTML: "body[dsd-pending] { display: none; }"
|
|
7
|
-
}
|
|
8
|
-
],
|
|
9
|
-
script: [
|
|
10
|
-
{
|
|
11
|
-
children: `
|
|
12
|
-
{
|
|
13
|
-
const hasNativeDsd =
|
|
14
|
-
Object.hasOwnProperty.call(HTMLTemplateElement.prototype, "shadowRootMode") ||
|
|
15
|
-
Object.hasOwnProperty.call(HTMLTemplateElement.prototype, "shadowRoot");
|
|
16
|
-
|
|
17
|
-
if (!hasNativeDsd) {
|
|
18
|
-
document.body.setAttribute('dsd-pending', 'true');
|
|
19
|
-
}
|
|
20
|
-
}`,
|
|
21
|
-
tagPosition: "bodyOpen"
|
|
22
|
-
}
|
|
23
|
-
]
|
|
24
|
-
});
|
|
25
|
-
});
|
|
1
|
+
import { defineNuxtPlugin, useHead } from "#imports";
|
|
2
|
+
export default defineNuxtPlugin(() => {
|
|
3
|
+
useHead({
|
|
4
|
+
style: [
|
|
5
|
+
{
|
|
6
|
+
innerHTML: "body[dsd-pending] { display: none; }"
|
|
7
|
+
}
|
|
8
|
+
],
|
|
9
|
+
script: [
|
|
10
|
+
{
|
|
11
|
+
children: `
|
|
12
|
+
{
|
|
13
|
+
const hasNativeDsd =
|
|
14
|
+
Object.hasOwnProperty.call(HTMLTemplateElement.prototype, "shadowRootMode") ||
|
|
15
|
+
Object.hasOwnProperty.call(HTMLTemplateElement.prototype, "shadowRoot");
|
|
16
|
+
|
|
17
|
+
if (!hasNativeDsd) {
|
|
18
|
+
document.body.setAttribute('dsd-pending', 'true');
|
|
19
|
+
}
|
|
20
|
+
}`,
|
|
21
|
+
tagPosition: "bodyOpen"
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "@lit-labs/ssr-client/lit-element-hydrate-support.js";
|
|
2
|
-
import { defineNuxtPlugin } from "#imports";
|
|
3
|
-
export default defineNuxtPlugin(() => {
|
|
4
|
-
});
|
|
1
|
+
import "@lit-labs/ssr-client/lit-element-hydrate-support.js";
|
|
2
|
+
import { defineNuxtPlugin } from "#imports";
|
|
3
|
+
export default defineNuxtPlugin(() => {
|
|
4
|
+
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineNuxtPlugin } from "#imports";
|
|
2
|
-
export default defineNuxtPlugin(async () => {
|
|
3
|
-
const hasNativeDsd = Object.hasOwnProperty.call(HTMLTemplateElement.prototype, "shadowRootMode") || Object.hasOwnProperty.call(HTMLTemplateElement.prototype, "shadowRoot");
|
|
4
|
-
if (!hasNativeDsd) {
|
|
5
|
-
const { hydrateShadowRoots } = await import("@webcomponents/template-shadowroot/template-shadowroot.js");
|
|
6
|
-
hydrateShadowRoots(document.body);
|
|
7
|
-
document.body.removeAttribute("dsd-pending");
|
|
8
|
-
}
|
|
9
|
-
});
|
|
1
|
+
import { defineNuxtPlugin } from "#imports";
|
|
2
|
+
export default defineNuxtPlugin(async () => {
|
|
3
|
+
const hasNativeDsd = Object.hasOwnProperty.call(HTMLTemplateElement.prototype, "shadowRootMode") || Object.hasOwnProperty.call(HTMLTemplateElement.prototype, "shadowRoot");
|
|
4
|
+
if (!hasNativeDsd) {
|
|
5
|
+
const { hydrateShadowRoots } = await import("@webcomponents/template-shadowroot/template-shadowroot.js");
|
|
6
|
+
hydrateShadowRoots(document.body);
|
|
7
|
+
document.body.removeAttribute("dsd-pending");
|
|
8
|
+
}
|
|
9
|
+
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export function isCustomElementTag(name) {
|
|
2
|
-
return typeof name === "string" && /-/.test(name);
|
|
3
|
-
}
|
|
4
|
-
export function getCustomElementConstructor(name) {
|
|
5
|
-
if (typeof customElements !== "undefined" && isCustomElementTag(name)) {
|
|
6
|
-
return customElements.get(name) || null;
|
|
7
|
-
} else if (typeof name === "function") {
|
|
8
|
-
return name;
|
|
9
|
-
}
|
|
10
|
-
return null;
|
|
11
|
-
}
|
|
1
|
+
export function isCustomElementTag(name) {
|
|
2
|
+
return typeof name === "string" && /-/.test(name);
|
|
3
|
+
}
|
|
4
|
+
export function getCustomElementConstructor(name) {
|
|
5
|
+
if (typeof customElements !== "undefined" && isCustomElementTag(name)) {
|
|
6
|
+
return customElements.get(name) || null;
|
|
7
|
+
} else if (typeof name === "function") {
|
|
8
|
+
return name;
|
|
9
|
+
}
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { LitElementRenderer } from "@lit-labs/ssr/lib/lit-element-renderer.js";
|
|
2
|
-
import { getCustomElementConstructor, isCustomElementTag } from "./customElements.js";
|
|
3
|
-
export function createLitElementRenderer(tagName, props) {
|
|
4
|
-
if (!isCustomElementTag(tagName)) {
|
|
5
|
-
return null;
|
|
6
|
-
}
|
|
7
|
-
const renderer = new LitElementRenderer(tagName);
|
|
8
|
-
attachPropsToRenderer(renderer, props);
|
|
9
|
-
return renderer;
|
|
10
|
-
}
|
|
11
|
-
function attachPropsToRenderer(renderer, props) {
|
|
12
|
-
const customElementConstructor = getCustomElementConstructor(renderer.tagName);
|
|
13
|
-
if (props) {
|
|
14
|
-
for (const [key, value] of Object.entries(props)) {
|
|
15
|
-
if (customElementConstructor !== null && typeof customElementConstructor !== "string" && key in customElementConstructor.prototype) {
|
|
16
|
-
const isBooleanProp = customElementConstructor.elementProperties.get(key)?.type === Boolean;
|
|
17
|
-
if (isBooleanProp && value === "") {
|
|
18
|
-
renderer.setProperty(key, true);
|
|
19
|
-
} else {
|
|
20
|
-
renderer.setProperty(key, value);
|
|
21
|
-
}
|
|
22
|
-
} else {
|
|
23
|
-
renderer.setAttribute(key, value);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return renderer;
|
|
28
|
-
}
|
|
1
|
+
import { LitElementRenderer } from "@lit-labs/ssr/lib/lit-element-renderer.js";
|
|
2
|
+
import { getCustomElementConstructor, isCustomElementTag } from "./customElements.js";
|
|
3
|
+
export function createLitElementRenderer(tagName, props) {
|
|
4
|
+
if (!isCustomElementTag(tagName)) {
|
|
5
|
+
return null;
|
|
6
|
+
}
|
|
7
|
+
const renderer = new LitElementRenderer(tagName);
|
|
8
|
+
attachPropsToRenderer(renderer, props);
|
|
9
|
+
return renderer;
|
|
10
|
+
}
|
|
11
|
+
function attachPropsToRenderer(renderer, props) {
|
|
12
|
+
const customElementConstructor = getCustomElementConstructor(renderer.tagName);
|
|
13
|
+
if (props) {
|
|
14
|
+
for (const [key, value] of Object.entries(props)) {
|
|
15
|
+
if (customElementConstructor !== null && typeof customElementConstructor !== "string" && key in customElementConstructor.prototype) {
|
|
16
|
+
const isBooleanProp = customElementConstructor.elementProperties.get(key)?.type === Boolean;
|
|
17
|
+
if (isBooleanProp && value === "") {
|
|
18
|
+
renderer.setProperty(key, true);
|
|
19
|
+
} else {
|
|
20
|
+
renderer.setProperty(key, value);
|
|
21
|
+
}
|
|
22
|
+
} else {
|
|
23
|
+
renderer.setAttribute(key, value);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return renderer;
|
|
28
|
+
}
|
|
@@ -20353,4 +20353,4 @@ function toExcelStyle(style) {
|
|
|
20353
20353
|
}
|
|
20354
20354
|
|
|
20355
20355
|
//#endregion
|
|
20356
|
-
export { flattenInline as a, escapeCellText as c,
|
|
20356
|
+
export { flattenInline as a, escapeCellText as c, __exportAll as d, __toESM as f, toExcelStyle as i, stripDirectives as l, combineStyles as n, parseMarkdown as o, mergeStyles as r, encodeDirective as s, DEFAULT_STYLES as t, __commonJSMin as u };
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { a as hasLiveDocument, i as destroyAllTooltipControllers, r as createTooltipController, u as setMonoTooltipGlobal } from "./control-tooltip-C3rA_nSH.js";
|
|
2
|
+
import "./tooltip-loader-Dcp9AUZn.js";
|
|
3
|
+
|
|
4
|
+
//#region src/components/tooltip/tooltip-declarative.ts
|
|
5
|
+
/** The two text attributes — `message` is an alias of `content`. */
|
|
6
|
+
const TOOLTIP_ATTRIBUTE_SELECTOR = "[mono-tooltip-content], [mono-tooltip-message]";
|
|
7
|
+
let declarative = null;
|
|
8
|
+
/**
|
|
9
|
+
* Per-element options, from `mono-tooltip-<option>` attributes:
|
|
10
|
+
*
|
|
11
|
+
* | attribute | option |
|
|
12
|
+
* | --- | --- |
|
|
13
|
+
* | `mono-tooltip-content` / `-message` | `content` (text) |
|
|
14
|
+
* | `mono-tooltip-placement` / `-variant` / `-color` / `-size` | same name |
|
|
15
|
+
* | `mono-tooltip-trigger` | `"hover focus"`, `"click"`, … |
|
|
16
|
+
* | `mono-tooltip-delay` | `"300"` or `"300 100"` |
|
|
17
|
+
* | `mono-tooltip-offset` / `-padding` | numbers |
|
|
18
|
+
* | `mono-tooltip-max-width` / `-class` | strings |
|
|
19
|
+
* | `mono-tooltip-arrow` / `-flip` / `-shift` / `-interactive` / `-html` / `-disabled` / `-hide-on-click` | booleans — present = on, `"false"` = off |
|
|
20
|
+
*/
|
|
21
|
+
function readTooltipAttributes(el) {
|
|
22
|
+
const get = (name) => el.getAttribute(`mono-tooltip-${name}`);
|
|
23
|
+
const str = (name) => get(name)?.trim() || void 0;
|
|
24
|
+
const bool = (name) => {
|
|
25
|
+
const v = get(name);
|
|
26
|
+
return v === null ? void 0 : v.trim() !== "false";
|
|
27
|
+
};
|
|
28
|
+
const num = (name) => {
|
|
29
|
+
const v = str(name);
|
|
30
|
+
const n = v === void 0 ? NaN : Number(v);
|
|
31
|
+
return Number.isFinite(n) ? n : void 0;
|
|
32
|
+
};
|
|
33
|
+
const list = (name) => str(name)?.split(/[\s,]+/).filter(Boolean);
|
|
34
|
+
const content = get("content") ?? get("message") ?? void 0;
|
|
35
|
+
const delay = list("delay")?.map(Number).filter(Number.isFinite);
|
|
36
|
+
return {
|
|
37
|
+
content,
|
|
38
|
+
placement: str("placement"),
|
|
39
|
+
variant: str("variant"),
|
|
40
|
+
color: str("color"),
|
|
41
|
+
size: str("size"),
|
|
42
|
+
trigger: list("trigger"),
|
|
43
|
+
delay: delay?.length ? delay.length > 1 ? [delay[0], delay[1]] : delay[0] : void 0,
|
|
44
|
+
offset: num("offset"),
|
|
45
|
+
padding: num("padding"),
|
|
46
|
+
maxWidth: str("max-width"),
|
|
47
|
+
class: str("class"),
|
|
48
|
+
arrow: bool("arrow"),
|
|
49
|
+
flip: bool("flip"),
|
|
50
|
+
shift: bool("shift"),
|
|
51
|
+
interactive: bool("interactive"),
|
|
52
|
+
allowHTML: bool("html"),
|
|
53
|
+
disabled: bool("disabled"),
|
|
54
|
+
hideOnClick: bool("hide-on-click")
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Set the app-wide tooltip options AND switch on the `mono-tooltip-*` attributes.
|
|
59
|
+
* Call once — usually in `main.ts`:
|
|
60
|
+
*
|
|
61
|
+
* ```ts
|
|
62
|
+
* app.use(createMonoTooltip({ delay: [300, 0] }))
|
|
63
|
+
* // or simply
|
|
64
|
+
* createMonoTooltip()
|
|
65
|
+
* ```
|
|
66
|
+
*
|
|
67
|
+
* The options WIN over the ones passed to `controlMonoTooltip`; an element's own
|
|
68
|
+
* `mono-tooltip-*` attributes win over them. A later call replaces the previous
|
|
69
|
+
* global options wholesale. `attributes: false` keeps the options but turns the
|
|
70
|
+
* declarative attributes off.
|
|
71
|
+
*/
|
|
72
|
+
function createMonoTooltip(options = {}) {
|
|
73
|
+
setMonoTooltipGlobal(options);
|
|
74
|
+
const wantAttributes = options.attributes !== false;
|
|
75
|
+
if (wantAttributes && !declarative && hasLiveDocument()) declarative = createTooltipController(TOOLTIP_ATTRIBUTE_SELECTOR, {}, readTooltipAttributes);
|
|
76
|
+
else if (!wantAttributes && declarative) {
|
|
77
|
+
declarative.destroy();
|
|
78
|
+
declarative = null;
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
options: { ...options },
|
|
82
|
+
install() {}
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Close and forget every live tooltip controller — the attribute one included
|
|
87
|
+
* (a later `createMonoTooltip()` turns the attributes back on). For tests and a
|
|
88
|
+
* full app teardown; the global options are kept.
|
|
89
|
+
*/
|
|
90
|
+
function destroyAllMonoTooltips() {
|
|
91
|
+
destroyAllTooltipControllers();
|
|
92
|
+
declarative = null;
|
|
93
|
+
}
|
|
94
|
+
/** Drop the global options and turn the attributes off (tests, runtime reconfiguration). */
|
|
95
|
+
function resetMonoTooltip() {
|
|
96
|
+
setMonoTooltipGlobal(null);
|
|
97
|
+
declarative?.destroy();
|
|
98
|
+
declarative = null;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
//#endregion
|
|
102
|
+
export { resetMonoTooltip as a, readTooltipAttributes as i, createMonoTooltip as n, destroyAllMonoTooltips as r, TOOLTIP_ATTRIBUTE_SELECTOR as t };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region src/components/tooltip/tooltip-loader.ts
|
|
2
|
+
/**
|
|
3
|
+
* Cached loader for the OPTIONAL `@floating-ui/dom` peer (which itself depends on
|
|
4
|
+
* `@floating-ui/core` — both are the consumer's to install).
|
|
5
|
+
*
|
|
6
|
+
* Loaded on the FIRST show, never at import: registering a tooltip in
|
|
7
|
+
* `<script setup>` costs nothing until somebody actually hovers. Externalized by
|
|
8
|
+
* `NEVER_BUNDLE` in `tsdown.config.ts`, so the consumer's bundler resolves and splits it.
|
|
9
|
+
*/
|
|
10
|
+
let _floatingPromise = null;
|
|
11
|
+
function loadFloatingUi() {
|
|
12
|
+
_floatingPromise ??= import("@floating-ui/dom").catch((err) => {
|
|
13
|
+
_floatingPromise = null;
|
|
14
|
+
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})` : ""));
|
|
15
|
+
});
|
|
16
|
+
return _floatingPromise;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
export { loadFloatingUi };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { d as __exportAll } from "./styles-BODNpZV1.js";
|
|
2
|
+
|
|
3
|
+
//#region src/components/tooltip/tooltip-loader.ts
|
|
4
|
+
var tooltip_loader_exports = /* @__PURE__ */ __exportAll({ loadFloatingUi: () => loadFloatingUi });
|
|
5
|
+
/**
|
|
6
|
+
* Cached loader for the OPTIONAL `@floating-ui/dom` peer (which itself depends on
|
|
7
|
+
* `@floating-ui/core` — both are the consumer's to install).
|
|
8
|
+
*
|
|
9
|
+
* Loaded on the FIRST show, never at import: registering a tooltip in
|
|
10
|
+
* `<script setup>` costs nothing until somebody actually hovers. Externalized by
|
|
11
|
+
* `NEVER_BUNDLE` in `tsdown.config.ts`, so the consumer's bundler resolves and splits it.
|
|
12
|
+
*/
|
|
13
|
+
let _floatingPromise = null;
|
|
14
|
+
function loadFloatingUi() {
|
|
15
|
+
_floatingPromise ??= import("@floating-ui/dom").catch((err) => {
|
|
16
|
+
_floatingPromise = null;
|
|
17
|
+
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})` : ""));
|
|
18
|
+
});
|
|
19
|
+
return _floatingPromise;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { tooltip_loader_exports as n, loadFloatingUi as t };
|
package/dist/tooltip.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as getMonoTooltipGlobal, l as resolveTooltipOptions, o as monoTooltip, s as DEFAULT_TOOLTIP_OPTIONS, t as controlMonoTooltip } from "./control-tooltip-C3rA_nSH.js";
|
|
2
|
+
import { t as loadFloatingUi } from "./tooltip-loader-Dcp9AUZn.js";
|
|
3
|
+
import { a as resetMonoTooltip, i as readTooltipAttributes, n as createMonoTooltip, r as destroyAllMonoTooltips, t as TOOLTIP_ATTRIBUTE_SELECTOR } from "./tooltip-Drekihf5.js";
|
|
2
4
|
|
|
3
5
|
export { DEFAULT_TOOLTIP_OPTIONS, TOOLTIP_ATTRIBUTE_SELECTOR, controlMonoTooltip, createMonoTooltip, destroyAllMonoTooltips, getMonoTooltipGlobal, loadFloatingUi, monoTooltip, readTooltipAttributes, resetMonoTooltip, resolveTooltipOptions };
|