@lobehub/ui 5.46.1 → 5.46.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.
@@ -48,11 +48,25 @@ const installGlobalFocusRing = (doc = document) => {
48
48
  "range",
49
49
  "color",
50
50
  "file"
51
- ].includes(next.type) || !next.matches(":focus-visible") || next.getClientRects().length !== 1) return;
51
+ ].includes(next.type) || !next.matches(":focus-visible")) return;
52
52
  const element = next;
53
+ let scope = element.parentElement;
54
+ while (scope && win.getComputedStyle(scope).contain === "none") scope = scope.parentElement;
55
+ const ringParent = scope || doc.body;
56
+ const moved = ring.parentElement !== ringParent;
57
+ if (moved) ringParent.append(ring);
53
58
  const computed = win.getComputedStyle(element);
54
- const rect = element.getBoundingClientRect();
55
- if (!rect.width || !rect.height || computed.visibility !== "visible") return;
59
+ const borderRadius = computed.borderRadius;
60
+ const color = computed.getPropertyValue("--lobe-focus-ring-color").trim() || computed.getPropertyValue("--ant-color-info").trim() || "#1677ff";
61
+ const styleChanged = ring.style.borderRadius !== borderRadius || ring.style.getPropertyValue("--lobe-focus-ring-color") !== color;
62
+ if (styleChanged) {
63
+ ring.style.borderRadius = borderRadius;
64
+ ring.style.setProperty("--lobe-focus-ring-color", color);
65
+ }
66
+ if (moved || styleChanged) {
67
+ schedule();
68
+ return;
69
+ }
56
70
  const saved = ["anchor-name", "outline"].map((property) => ({
57
71
  priority: element.style.getPropertyPriority(property),
58
72
  property,
@@ -62,8 +76,6 @@ const installGlobalFocusRing = (doc = document) => {
62
76
  const anchor = computed.getPropertyValue("anchor-name").trim();
63
77
  const assignedAnchor = anchor && anchor !== "none" ? `${anchor}, --lobe-global-focus` : "--lobe-global-focus";
64
78
  element.style.setProperty("anchor-name", assignedAnchor, "important");
65
- ring.style.borderRadius = computed.borderRadius;
66
- ring.style.setProperty("--lobe-focus-ring-color", computed.getPropertyValue("--lobe-focus-ring-color").trim() || computed.getPropertyValue("--ant-color-info").trim() || "#1677ff");
67
79
  restoreTarget = () => {
68
80
  for (const { property, value, priority } of saved) {
69
81
  const assigned = property === "anchor-name" ? assignedAnchor : "none";
@@ -76,6 +88,11 @@ const installGlobalFocusRing = (doc = document) => {
76
88
  else element.setAttribute("data-lobe-focus-ring", oldMarker);
77
89
  }
78
90
  };
91
+ const rect = element.getBoundingClientRect();
92
+ if (element.getClientRects().length !== 1 || !rect.width || !rect.height || computed.visibility !== "visible") {
93
+ clear();
94
+ return;
95
+ }
79
96
  try {
80
97
  ring.showPopover();
81
98
  const bounds = ring.getBoundingClientRect();
@@ -101,6 +118,7 @@ const installGlobalFocusRing = (doc = document) => {
101
118
  sync();
102
119
  });
103
120
  };
121
+ const focus = () => win.queueMicrotask(sync);
104
122
  const blur = () => {
105
123
  win.cancelAnimationFrame(frame);
106
124
  frame = 0;
@@ -113,7 +131,7 @@ const installGlobalFocusRing = (doc = document) => {
113
131
  childList: true,
114
132
  subtree: true
115
133
  });
116
- doc.addEventListener("focusin", sync, true);
134
+ doc.addEventListener("focusin", focus, true);
117
135
  doc.addEventListener("focusout", schedule, true);
118
136
  doc.addEventListener("keydown", schedule, true);
119
137
  doc.addEventListener("pointerdown", schedule, true);
@@ -124,7 +142,7 @@ const installGlobalFocusRing = (doc = document) => {
124
142
  disposed = true;
125
143
  win.cancelAnimationFrame(frame);
126
144
  observer.disconnect();
127
- doc.removeEventListener("focusin", sync, true);
145
+ doc.removeEventListener("focusin", focus, true);
128
146
  doc.removeEventListener("focusout", schedule, true);
129
147
  doc.removeEventListener("keydown", schedule, true);
130
148
  doc.removeEventListener("pointerdown", schedule, true);
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../src/GlobalFocusRing/index.ts"],"sourcesContent":["import { globalFocusRingCSS } from './style';\n\nconst installations = new WeakMap<Document, { dispose: () => void; users: number }>();\n\n/** Install once per document. The returned cleanup is safe for nested providers and Strict Mode. */\nexport const installGlobalFocusRing = (doc: Document = document): (() => void) => {\n const existing = installations.get(doc);\n if (existing) {\n existing.users += 1;\n let released = false;\n return () => {\n if (released) return;\n released = true;\n if (--existing.users === 0) existing.dispose();\n };\n }\n\n const win = doc.defaultView;\n if (\n !win ||\n !doc.body ||\n !win.CSS?.supports('top', 'anchor(top)') ||\n !win.CSS.supports('position-visibility', 'anchors-visible') ||\n !('showPopover' in doc.createElement('div'))\n )\n return () => {};\n\n const sheet = doc.createElement('style');\n sheet.textContent = globalFocusRingCSS;\n const ring = doc.createElement('div');\n ring.setAttribute('data-lobe-global-focus-ring', '');\n ring.setAttribute('aria-hidden', 'true');\n ring.setAttribute('popover', 'manual');\n doc.head.append(sheet);\n doc.body.append(ring);\n\n let target: HTMLElement | undefined;\n let restoreTarget: (() => void) | undefined;\n let frame = 0;\n let disposed = false;\n\n const clear = () => {\n if (ring.matches(':popover-open')) ring.hidePopover();\n restoreTarget?.();\n restoreTarget = undefined;\n target = undefined;\n };\n\n const sync = () => {\n if (disposed) return;\n const next = doc.activeElement;\n if (\n next === target &&\n next?.matches(':focus-visible') &&\n next.isConnected &&\n ring.matches(':popover-open')\n )\n return;\n clear();\n // Shadow roots and fragmented inline text retain their own focus treatment.\n if (\n !next ||\n next === doc.body ||\n next.namespaceURI !== 'http://www.w3.org/1999/xhtml' ||\n next.shadowRoot ||\n next.closest('[data-lobe-focus-ring=\"off\"]') ||\n next.matches('textarea') ||\n (next as HTMLElement).isContentEditable ||\n (next.matches('input') &&\n ![\n 'button',\n 'submit',\n 'reset',\n 'image',\n 'checkbox',\n 'radio',\n 'range',\n 'color',\n 'file',\n ].includes((next as HTMLInputElement).type)) ||\n !next.matches(':focus-visible') ||\n next.getClientRects().length !== 1\n )\n return;\n\n const element = next as HTMLElement;\n const computed = win.getComputedStyle(element);\n const rect = element.getBoundingClientRect();\n if (!rect.width || !rect.height || computed.visibility !== 'visible') return;\n\n const saved = ['anchor-name', 'outline'].map((property) => ({\n priority: element.style.getPropertyPriority(property),\n property,\n value: element.style.getPropertyValue(property),\n }));\n const oldMarker = element.getAttribute('data-lobe-focus-ring');\n const anchor = computed.getPropertyValue('anchor-name').trim();\n const assignedAnchor =\n anchor && anchor !== 'none' ? `${anchor}, --lobe-global-focus` : '--lobe-global-focus';\n element.style.setProperty('anchor-name', assignedAnchor, 'important');\n ring.style.borderRadius = computed.borderRadius;\n ring.style.setProperty(\n '--lobe-focus-ring-color',\n computed.getPropertyValue('--lobe-focus-ring-color').trim() ||\n computed.getPropertyValue('--ant-color-info').trim() ||\n '#1677ff',\n );\n\n restoreTarget = () => {\n for (const { property, value, priority } of saved) {\n const assigned = property === 'anchor-name' ? assignedAnchor : 'none';\n if (element.style.getPropertyValue(property) !== assigned) continue;\n if (value) element.style.setProperty(property, value, priority);\n else element.style.removeProperty(property);\n }\n if (element.getAttribute('data-lobe-focus-ring') === 'managed') {\n if (oldMarker === null) element.removeAttribute('data-lobe-focus-ring');\n else element.setAttribute('data-lobe-focus-ring', oldMarker);\n }\n };\n try {\n ring.showPopover();\n // Do not suppress a working native outline when an anchor cannot resolve.\n const bounds = ring.getBoundingClientRect();\n if (\n Math.max(\n ...(['top', 'right', 'bottom', 'left'] as const).map((edge) =>\n Math.abs(bounds[edge] - rect[edge]),\n ),\n ) > 1\n ) {\n clear();\n return;\n }\n element.style.setProperty('outline', 'none', 'important');\n element.setAttribute('data-lobe-focus-ring', 'managed');\n target = element;\n } catch {\n clear();\n }\n };\n\n const schedule = () => {\n if (!frame)\n frame = win.requestAnimationFrame(() => {\n frame = 0;\n sync();\n });\n };\n const blur = () => {\n win.cancelAnimationFrame(frame);\n frame = 0;\n if (ring.matches(':popover-open')) ring.hidePopover();\n };\n const observer = new MutationObserver(() => {\n if (target && !target.isConnected) clear();\n });\n observer.observe(doc.body, { childList: true, subtree: true });\n doc.addEventListener('focusin', sync, true);\n doc.addEventListener('focusout', schedule, true);\n doc.addEventListener('keydown', schedule, true);\n doc.addEventListener('pointerdown', schedule, true);\n win.addEventListener('blur', blur);\n win.addEventListener('focus', schedule);\n\n const installation = {\n dispose: () => {\n disposed = true;\n win.cancelAnimationFrame(frame);\n observer.disconnect();\n doc.removeEventListener('focusin', sync, true);\n doc.removeEventListener('focusout', schedule, true);\n doc.removeEventListener('keydown', schedule, true);\n doc.removeEventListener('pointerdown', schedule, true);\n win.removeEventListener('blur', blur);\n win.removeEventListener('focus', schedule);\n clear();\n ring.remove();\n sheet.remove();\n installations.delete(doc);\n },\n users: 0,\n };\n installations.set(doc, installation);\n sync();\n return installGlobalFocusRing(doc);\n};\n"],"mappings":";;AAEA,MAAM,gCAAgB,IAAI,QAA0D;;AAGpF,MAAa,0BAA0B,MAAgB,aAA2B;CAChF,MAAM,WAAW,cAAc,IAAI,GAAG;CACtC,IAAI,UAAU;EACZ,SAAS,SAAS;EAClB,IAAI,WAAW;EACf,aAAa;GACX,IAAI,UAAU;GACd,WAAW;GACX,IAAI,EAAE,SAAS,UAAU,GAAG,SAAS,QAAQ;EAC/C;CACF;CAEA,MAAM,MAAM,IAAI;CAChB,IACE,CAAC,OACD,CAAC,IAAI,QACL,CAAC,IAAI,KAAK,SAAS,OAAO,aAAa,KACvC,CAAC,IAAI,IAAI,SAAS,uBAAuB,iBAAiB,KAC1D,EAAE,iBAAiB,IAAI,cAAc,KAAK,IAE1C,aAAa,CAAC;CAEhB,MAAM,QAAQ,IAAI,cAAc,OAAO;CACvC,MAAM,cAAc;CACpB,MAAM,OAAO,IAAI,cAAc,KAAK;CACpC,KAAK,aAAa,+BAA+B,EAAE;CACnD,KAAK,aAAa,eAAe,MAAM;CACvC,KAAK,aAAa,WAAW,QAAQ;CACrC,IAAI,KAAK,OAAO,KAAK;CACrB,IAAI,KAAK,OAAO,IAAI;CAEpB,IAAI;CACJ,IAAI;CACJ,IAAI,QAAQ;CACZ,IAAI,WAAW;CAEf,MAAM,cAAc;EAClB,IAAI,KAAK,QAAQ,eAAe,GAAG,KAAK,YAAY;EACpD,gBAAgB;EAChB,gBAAgB,KAAA;EAChB,SAAS,KAAA;CACX;CAEA,MAAM,aAAa;EACjB,IAA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,SAAS,QAAQ;CAoBtC,cAAc,IAAI,KAAK;EAjBrB,eAAe;GACb,WAAW;GACX,IAAI,qBAAqB,KAAK;GAC9B,SAAS,WAAW;GACpB,IAAI,oBAAoB,WAAW,MAAM,IAAI;GAC7C,IAAI,oBAAoB,YAAY,UAAU,IAAI;GAClD,IAAI,oBAAoB,WAAW,UAAU,IAAI;GACjD,IAAI,oBAAoB,eAAe,UAAU,IAAI;GACrD,IAAI,oBAAoB,QAAQ,IAAI;GACpC,IAAI,oBAAoB,SAAS,QAAQ;GACzC,MAAM;GACN,KAAK,OAAO;GACZ,MAAM,OAAO;GACb,cAAc,OAAO,GAAG;EAC1B;EACA,OAAO;CAEyB,CAAC;CACnC,KAAK;CACL,OAAO,uBAAuB,GAAG;AACnC"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/GlobalFocusRing/index.ts"],"sourcesContent":["import { globalFocusRingCSS } from './style';\n\nconst installations = new WeakMap<Document, { dispose: () => void; users: number }>();\n\n/** Install once per document. The returned cleanup is safe for nested providers and Strict Mode. */\nexport const installGlobalFocusRing = (doc: Document = document): (() => void) => {\n const existing = installations.get(doc);\n if (existing) {\n existing.users += 1;\n let released = false;\n return () => {\n if (released) return;\n released = true;\n if (--existing.users === 0) existing.dispose();\n };\n }\n\n const win = doc.defaultView;\n if (\n !win ||\n !doc.body ||\n !win.CSS?.supports('top', 'anchor(top)') ||\n !win.CSS.supports('position-visibility', 'anchors-visible') ||\n !('showPopover' in doc.createElement('div'))\n )\n return () => {};\n\n const sheet = doc.createElement('style');\n sheet.textContent = globalFocusRingCSS;\n const ring = doc.createElement('div');\n ring.setAttribute('data-lobe-global-focus-ring', '');\n ring.setAttribute('aria-hidden', 'true');\n ring.setAttribute('popover', 'manual');\n doc.head.append(sheet);\n doc.body.append(ring);\n\n let target: HTMLElement | undefined;\n let restoreTarget: (() => void) | undefined;\n let frame = 0;\n let disposed = false;\n\n const clear = () => {\n if (ring.matches(':popover-open')) ring.hidePopover();\n restoreTarget?.();\n restoreTarget = undefined;\n target = undefined;\n };\n\n const sync = () => {\n if (disposed) return;\n const next = doc.activeElement;\n if (\n next === target &&\n next?.matches(':focus-visible') &&\n next.isConnected &&\n ring.matches(':popover-open')\n )\n return;\n clear();\n // Shadow roots and fragmented inline text retain their own focus treatment.\n if (\n !next ||\n next === doc.body ||\n next.namespaceURI !== 'http://www.w3.org/1999/xhtml' ||\n next.shadowRoot ||\n next.closest('[data-lobe-focus-ring=\"off\"]') ||\n next.matches('textarea') ||\n (next as HTMLElement).isContentEditable ||\n (next.matches('input') &&\n ![\n 'button',\n 'submit',\n 'reset',\n 'image',\n 'checkbox',\n 'radio',\n 'range',\n 'color',\n 'file',\n ].includes((next as HTMLInputElement).type)) ||\n !next.matches(':focus-visible')\n )\n return;\n\n const element = next as HTMLElement;\n let scope = element.parentElement;\n while (scope && win.getComputedStyle(scope).contain === 'none') scope = scope.parentElement;\n // Anchor names do not cross CSS containment, while a popover still escapes its clipping.\n const ringParent = scope || doc.body;\n const moved = ring.parentElement !== ringParent;\n if (moved) ringParent.append(ring);\n\n const computed = win.getComputedStyle(element);\n const borderRadius = computed.borderRadius;\n const color =\n computed.getPropertyValue('--lobe-focus-ring-color').trim() ||\n computed.getPropertyValue('--ant-color-info').trim() ||\n '#1677ff';\n const styleChanged =\n ring.style.borderRadius !== borderRadius ||\n ring.style.getPropertyValue('--lobe-focus-ring-color') !== color;\n if (styleChanged) {\n ring.style.borderRadius = borderRadius;\n ring.style.setProperty('--lobe-focus-ring-color', color);\n }\n if (moved || styleChanged) {\n schedule();\n return;\n }\n\n const saved = ['anchor-name', 'outline'].map((property) => ({\n priority: element.style.getPropertyPriority(property),\n property,\n value: element.style.getPropertyValue(property),\n }));\n const oldMarker = element.getAttribute('data-lobe-focus-ring');\n const anchor = computed.getPropertyValue('anchor-name').trim();\n const assignedAnchor =\n anchor && anchor !== 'none' ? `${anchor}, --lobe-global-focus` : '--lobe-global-focus';\n element.style.setProperty('anchor-name', assignedAnchor, 'important');\n\n restoreTarget = () => {\n for (const { property, value, priority } of saved) {\n const assigned = property === 'anchor-name' ? assignedAnchor : 'none';\n if (element.style.getPropertyValue(property) !== assigned) continue;\n if (value) element.style.setProperty(property, value, priority);\n else element.style.removeProperty(property);\n }\n if (element.getAttribute('data-lobe-focus-ring') === 'managed') {\n if (oldMarker === null) element.removeAttribute('data-lobe-focus-ring');\n else element.setAttribute('data-lobe-focus-ring', oldMarker);\n }\n };\n const rect = element.getBoundingClientRect();\n if (\n element.getClientRects().length !== 1 ||\n !rect.width ||\n !rect.height ||\n computed.visibility !== 'visible'\n ) {\n clear();\n return;\n }\n try {\n ring.showPopover();\n // Do not suppress a working native outline when an anchor cannot resolve.\n const bounds = ring.getBoundingClientRect();\n if (\n Math.max(\n ...(['top', 'right', 'bottom', 'left'] as const).map((edge) =>\n Math.abs(bounds[edge] - rect[edge]),\n ),\n ) > 1\n ) {\n clear();\n return;\n }\n element.style.setProperty('outline', 'none', 'important');\n element.setAttribute('data-lobe-focus-ring', 'managed');\n target = element;\n } catch {\n clear();\n }\n };\n\n const schedule = () => {\n if (!frame)\n frame = win.requestAnimationFrame(() => {\n frame = 0;\n sync();\n });\n };\n const focus = () => win.queueMicrotask(sync);\n const blur = () => {\n win.cancelAnimationFrame(frame);\n frame = 0;\n if (ring.matches(':popover-open')) ring.hidePopover();\n };\n const observer = new MutationObserver(() => {\n if (target && !target.isConnected) clear();\n });\n observer.observe(doc.body, { childList: true, subtree: true });\n doc.addEventListener('focusin', focus, true);\n doc.addEventListener('focusout', schedule, true);\n doc.addEventListener('keydown', schedule, true);\n doc.addEventListener('pointerdown', schedule, true);\n win.addEventListener('blur', blur);\n win.addEventListener('focus', schedule);\n\n const installation = {\n dispose: () => {\n disposed = true;\n win.cancelAnimationFrame(frame);\n observer.disconnect();\n doc.removeEventListener('focusin', focus, true);\n doc.removeEventListener('focusout', schedule, true);\n doc.removeEventListener('keydown', schedule, true);\n doc.removeEventListener('pointerdown', schedule, true);\n win.removeEventListener('blur', blur);\n win.removeEventListener('focus', schedule);\n clear();\n ring.remove();\n sheet.remove();\n installations.delete(doc);\n },\n users: 0,\n };\n installations.set(doc, installation);\n sync();\n return installGlobalFocusRing(doc);\n};\n"],"mappings":";;AAEA,MAAM,gCAAgB,IAAI,QAA0D;;AAGpF,MAAa,0BAA0B,MAAgB,aAA2B;CAChF,MAAM,WAAW,cAAc,IAAI,GAAG;CACtC,IAAI,UAAU;EACZ,SAAS,SAAS;EAClB,IAAI,WAAW;EACf,aAAa;GACX,IAAI,UAAU;GACd,WAAW;GACX,IAAI,EAAE,SAAS,UAAU,GAAG,SAAS,QAAQ;EAC/C;CACF;CAEA,MAAM,MAAM,IAAI;CAChB,IACE,CAAC,OACD,CAAC,IAAI,QACL,CAAC,IAAI,KAAK,SAAS,OAAO,aAAa,KACvC,CAAC,IAAI,IAAI,SAAS,uBAAuB,iBAAiB,KAC1D,EAAE,iBAAiB,IAAI,cAAc,KAAK,IAE1C,aAAa,CAAC;CAEhB,MAAM,QAAQ,IAAI,cAAc,OAAO;CACvC,MAAM,cAAc;CACpB,MAAM,OAAO,IAAI,cAAc,KAAK;CACpC,KAAK,aAAa,+BAA+B,EAAE;CACnD,KAAK,aAAa,eAAe,MAAM;CACvC,KAAK,aAAa,WAAW,QAAQ;CACrC,IAAI,KAAK,OAAO,KAAK;CACrB,IAAI,KAAK,OAAO,IAAI;CAEpB,IAAI;CACJ,IAAI;CACJ,IAAI,QAAQ;CACZ,IAAI,WAAW;CAEf,MAAM,cAAc;EAClB,IAAI,KAAK,QAAQ,eAAe,GAAG,KAAK,YAAY;EACpD,gBAAgB;EAChB,gBAAgB,KAAA;EAChB,SAAS,KAAA;CACX;CAEA,MAAM,aAAa;EACjB,IAAI,UAAU;EACd,MAAM,OAAO,IAAI;EACjB,IACE,SAAS,UACT,MAAM,QAAQ,gBAAgB,KAC9B,KAAK,eACL,KAAK,QAAQ,eAAe,GAE5B;EACF,MAAM;EAEN,IACE,CAAC,QACD,SAA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MAAM;CAC3C,CAAC;CACD,SAAS,QAAQ,IAAI,MAAM;EAAE,WAAW;EAAM,SAAS;CAAK,CAAC;CAC7D,IAAI,iBAAiB,WAAW,OAAO,IAAI;CAC3C,IAAI,iBAAiB,YAAY,UAAU,IAAI;CAC/C,IAAI,iBAAiB,WAAW,UAAU,IAAI;CAC9C,IAAI,iBAAiB,eAAe,UAAU,IAAI;CAClD,IAAI,iBAAiB,QAAQ,IAAI;CACjC,IAAI,iBAAiB,SAAS,QAAQ;CAoBtC,cAAc,IAAI,KAAK;EAjBrB,eAAe;GACb,WAAW;GACX,IAAI,qBAAqB,KAAK;GAC9B,SAAS,WAAW;GACpB,IAAI,oBAAoB,WAAW,OAAO,IAAI;GAC9C,IAAI,oBAAoB,YAAY,UAAU,IAAI;GAClD,IAAI,oBAAoB,WAAW,UAAU,IAAI;GACjD,IAAI,oBAAoB,eAAe,UAAU,IAAI;GACrD,IAAI,oBAAoB,QAAQ,IAAI;GACpC,IAAI,oBAAoB,SAAS,QAAQ;GACzC,MAAM;GACN,KAAK,OAAO;GACZ,MAAM,OAAO;GACb,cAAc,OAAO,GAAG;EAC1B;EACA,OAAO;CAEyB,CAAC;CACnC,KAAK;CACL,OAAO,uBAAuB,GAAG;AACnC"}
@@ -24,7 +24,7 @@ declare const styles: {
24
24
  declare const rootVariants: (props?: ({
25
25
  shadow?: boolean | null | undefined;
26
26
  size?: "large" | "middle" | "small" | null | undefined;
27
- variant?: "filled" | "borderless" | "outlined" | null | undefined;
27
+ variant?: "borderless" | "filled" | "outlined" | null | undefined;
28
28
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
29
29
  //#endregion
30
30
  export { rootVariants, styles };
@@ -42,7 +42,7 @@ declare const variants: (props?: ({
42
42
  mark?: boolean | null | undefined;
43
43
  shiny?: boolean | null | undefined;
44
44
  strong?: boolean | null | undefined;
45
- type?: "danger" | "success" | "info" | "warning" | "secondary" | null | undefined;
45
+ type?: "danger" | "warning" | "success" | "info" | "secondary" | null | undefined;
46
46
  underline?: boolean | null | undefined;
47
47
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
48
48
  //#endregion
@@ -1,5 +1,7 @@
1
1
  //#region src/eslint/index.ts
2
2
  const DEPRECATED_UI_COMPONENTS = [
3
+ "Accordion",
4
+ "AccordionItem",
3
5
  "ActionIcon",
4
6
  "Alert",
5
7
  "AutoComplete",
@@ -7,6 +9,7 @@ const DEPRECATED_UI_COMPONENTS = [
7
9
  "Button",
8
10
  "Checkbox",
9
11
  "CheckboxGroup",
12
+ "Collapse",
10
13
  "DraggablePanel",
11
14
  "DraggablePanelBody",
12
15
  "DraggablePanelContainer",
@@ -67,6 +70,8 @@ const restrictedImports = { rules: { "no-restricted-imports": ["error", {
67
70
  "antd/es/auto-complete/*",
68
71
  "antd/es/checkbox",
69
72
  "antd/es/checkbox/*",
73
+ "antd/es/collapse",
74
+ "antd/es/collapse/*",
70
75
  "antd/es/dropdown",
71
76
  "antd/es/dropdown/*",
72
77
  "antd/es/message",
@@ -87,6 +92,8 @@ const restrictedImports = { rules: { "no-restricted-imports": ["error", {
87
92
  "antd/lib/auto-complete/*",
88
93
  "antd/lib/checkbox",
89
94
  "antd/lib/checkbox/*",
95
+ "antd/lib/collapse",
96
+ "antd/lib/collapse/*",
90
97
  "antd/lib/dropdown",
91
98
  "antd/lib/dropdown/*",
92
99
  "antd/lib/message",
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../src/eslint/index.ts"],"sourcesContent":["const DEPRECATED_UI_COMPONENTS = [\n 'ActionIcon',\n 'Alert',\n 'AutoComplete',\n 'Avatar',\n 'Button',\n 'Checkbox',\n 'CheckboxGroup',\n 'DraggablePanel',\n 'DraggablePanelBody',\n 'DraggablePanelContainer',\n 'DraggablePanelFooter',\n 'DraggablePanelHeader',\n 'Drawer',\n 'Dropdown',\n 'FormSubmitFooter',\n 'FormTitle',\n 'InputOPT',\n 'Modal',\n 'Radio',\n 'RadioGroup',\n 'Segmented',\n 'Select',\n 'Skeleton',\n 'SkeletonAvatar',\n 'SkeletonBlock',\n 'SkeletonButton',\n 'SkeletonParagraph',\n 'SkeletonTags',\n 'SkeletonTitle',\n 'Slider',\n 'SliderWithInput',\n 'Switch',\n 'Tabs',\n 'Tag',\n 'Text',\n];\n\nconst DEPRECATED_ANTD_COMPONENT_PATHS = [\n 'antd/es/alert',\n 'antd/es/alert/*',\n 'antd/es/auto-complete',\n 'antd/es/auto-complete/*',\n 'antd/es/checkbox',\n 'antd/es/checkbox/*',\n 'antd/es/dropdown',\n 'antd/es/dropdown/*',\n 'antd/es/message',\n 'antd/es/message/*',\n 'antd/es/notification',\n 'antd/es/notification/*',\n 'antd/es/radio',\n 'antd/es/radio/*',\n 'antd/es/skeleton',\n 'antd/es/skeleton/*',\n 'antd/es/slider',\n 'antd/es/slider/*',\n 'antd/es/switch',\n 'antd/es/switch/*',\n 'antd/lib/alert',\n 'antd/lib/alert/*',\n 'antd/lib/auto-complete',\n 'antd/lib/auto-complete/*',\n 'antd/lib/checkbox',\n 'antd/lib/checkbox/*',\n 'antd/lib/dropdown',\n 'antd/lib/dropdown/*',\n 'antd/lib/message',\n 'antd/lib/message/*',\n 'antd/lib/notification',\n 'antd/lib/notification/*',\n 'antd/lib/radio',\n 'antd/lib/radio/*',\n 'antd/lib/skeleton',\n 'antd/lib/skeleton/*',\n 'antd/lib/slider',\n 'antd/lib/slider/*',\n 'antd/lib/switch',\n 'antd/lib/switch/*',\n];\n\nexport const restrictedImports = {\n rules: {\n 'no-restricted-imports': [\n 'error',\n {\n paths: [\n {\n importNames: DEPRECATED_UI_COMPONENTS,\n message:\n 'The antd-based wrapper is deprecated. Import from \"@lobehub/ui/base-ui\" instead.',\n name: '@lobehub/ui',\n },\n {\n importNames: ['createStyles'],\n message:\n '`createStyles` is banned in this project. Use `createStaticStyles` from \"antd-style\" instead.',\n name: 'antd-style',\n },\n {\n importNames: DEPRECATED_UI_COMPONENTS,\n message: 'Direct antd import is deprecated. Import from \"@lobehub/ui/base-ui\" instead.',\n name: 'antd',\n },\n {\n importNames: ['message', 'notification'],\n message: 'antd feedback APIs are deprecated. Use `toast` from \"@lobehub/ui/base-ui\".',\n name: 'antd',\n },\n ],\n patterns: [\n {\n group: DEPRECATED_ANTD_COMPONENT_PATHS,\n message:\n 'Direct antd component import is deprecated. Import from \"@lobehub/ui/base-ui\" instead.',\n },\n ],\n },\n ],\n },\n};\n\nexport default [restrictedImports];\n"],"mappings":";AAAA,MAAM,2BAA2B;CAC/B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AA6CA,MAAa,oBAAoB,EAC/B,OAAO,EACL,yBAAyB,CACvB,SACA;CACE,OAAO;EACL;GACE,aAAa;GACb,SACE;GACF,MAAM;EACR;EACA;GACE,aAAa,CAAC,cAAc;GAC5B,SACE;GACF,MAAM;EACR;EACA;GACE,aAAa;GACb,SAAS;GACT,MAAM;EACR;EACA;GACE,aAAa,CAAC,WAAW,cAAc;GACvC,SAAS;GACT,MAAM;EACR;CACF;CACA,UAAU,CACR;EACE,OAAO;GAzEjB;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EAkCiB;EACP,SACE;CACJ,CACF;AACF,CACF,EACF,EACF;AAEA,IAAA,iBAAe,CAAC,iBAAiB"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/eslint/index.ts"],"sourcesContent":["const DEPRECATED_UI_COMPONENTS = [\n 'Accordion',\n 'AccordionItem',\n 'ActionIcon',\n 'Alert',\n 'AutoComplete',\n 'Avatar',\n 'Button',\n 'Checkbox',\n 'CheckboxGroup',\n 'Collapse',\n 'DraggablePanel',\n 'DraggablePanelBody',\n 'DraggablePanelContainer',\n 'DraggablePanelFooter',\n 'DraggablePanelHeader',\n 'Drawer',\n 'Dropdown',\n 'FormSubmitFooter',\n 'FormTitle',\n 'InputOPT',\n 'Modal',\n 'Radio',\n 'RadioGroup',\n 'Segmented',\n 'Select',\n 'Skeleton',\n 'SkeletonAvatar',\n 'SkeletonBlock',\n 'SkeletonButton',\n 'SkeletonParagraph',\n 'SkeletonTags',\n 'SkeletonTitle',\n 'Slider',\n 'SliderWithInput',\n 'Switch',\n 'Tabs',\n 'Tag',\n 'Text',\n];\n\nconst DEPRECATED_ANTD_COMPONENT_PATHS = [\n 'antd/es/alert',\n 'antd/es/alert/*',\n 'antd/es/auto-complete',\n 'antd/es/auto-complete/*',\n 'antd/es/checkbox',\n 'antd/es/checkbox/*',\n 'antd/es/collapse',\n 'antd/es/collapse/*',\n 'antd/es/dropdown',\n 'antd/es/dropdown/*',\n 'antd/es/message',\n 'antd/es/message/*',\n 'antd/es/notification',\n 'antd/es/notification/*',\n 'antd/es/radio',\n 'antd/es/radio/*',\n 'antd/es/skeleton',\n 'antd/es/skeleton/*',\n 'antd/es/slider',\n 'antd/es/slider/*',\n 'antd/es/switch',\n 'antd/es/switch/*',\n 'antd/lib/alert',\n 'antd/lib/alert/*',\n 'antd/lib/auto-complete',\n 'antd/lib/auto-complete/*',\n 'antd/lib/checkbox',\n 'antd/lib/checkbox/*',\n 'antd/lib/collapse',\n 'antd/lib/collapse/*',\n 'antd/lib/dropdown',\n 'antd/lib/dropdown/*',\n 'antd/lib/message',\n 'antd/lib/message/*',\n 'antd/lib/notification',\n 'antd/lib/notification/*',\n 'antd/lib/radio',\n 'antd/lib/radio/*',\n 'antd/lib/skeleton',\n 'antd/lib/skeleton/*',\n 'antd/lib/slider',\n 'antd/lib/slider/*',\n 'antd/lib/switch',\n 'antd/lib/switch/*',\n];\n\nexport const restrictedImports = {\n rules: {\n 'no-restricted-imports': [\n 'error',\n {\n paths: [\n {\n importNames: DEPRECATED_UI_COMPONENTS,\n message:\n 'The antd-based wrapper is deprecated. Import from \"@lobehub/ui/base-ui\" instead.',\n name: '@lobehub/ui',\n },\n {\n importNames: ['createStyles'],\n message:\n '`createStyles` is banned in this project. Use `createStaticStyles` from \"antd-style\" instead.',\n name: 'antd-style',\n },\n {\n importNames: DEPRECATED_UI_COMPONENTS,\n message: 'Direct antd import is deprecated. Import from \"@lobehub/ui/base-ui\" instead.',\n name: 'antd',\n },\n {\n importNames: ['message', 'notification'],\n message: 'antd feedback APIs are deprecated. Use `toast` from \"@lobehub/ui/base-ui\".',\n name: 'antd',\n },\n ],\n patterns: [\n {\n group: DEPRECATED_ANTD_COMPONENT_PATHS,\n message:\n 'Direct antd component import is deprecated. Import from \"@lobehub/ui/base-ui\" instead.',\n },\n ],\n },\n ],\n },\n};\n\nexport default [restrictedImports];\n"],"mappings":";AAAA,MAAM,2BAA2B;CAC/B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAiDA,MAAa,oBAAoB,EAC/B,OAAO,EACL,yBAAyB,CACvB,SACA;CACE,OAAO;EACL;GACE,aAAa;GACb,SACE;GACF,MAAM;EACR;EACA;GACE,aAAa,CAAC,cAAc;GAC5B,SACE;GACF,MAAM;EACR;EACA;GACE,aAAa;GACb,SAAS;GACT,MAAM;EACR;EACA;GACE,aAAa,CAAC,WAAW,cAAc;GACvC,SAAS;GACT,MAAM;EACR;CACF;CACA,UAAU,CACR;EACE,OAAO;GA7EjB;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EAkCiB;EACP,SACE;CACJ,CACF;AACF,CACF,EACF,EACF;AAEA,IAAA,iBAAe,CAAC,iBAAiB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "5.46.1",
3
+ "version": "5.46.2",
4
4
  "description": "Lobe UI is an open-source UI component library for building AIGC web apps",
5
5
  "keywords": [
6
6
  "lobehub",