zuii 1.4.30 → 1.4.31
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/core/utils/getName.d.ts +52 -0
- package/dist/core/utils/getName.js +23 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +36 -34
- package/package.json +1 -1
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options pour l'injection dynamique de classes BEM.
|
|
3
|
+
*/
|
|
4
|
+
interface InjectOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Nom de base servant de préfixe BEM (ex: 'cavaliers').
|
|
7
|
+
*/
|
|
8
|
+
name: string;
|
|
9
|
+
/**
|
|
10
|
+
* Liste de sélecteurs CSS à cibler, séparés par des virgules (ex: '.container, .form').
|
|
11
|
+
* Chaque élément trouvé recevra une classe composée : {base}__{selecteur}.
|
|
12
|
+
*/
|
|
13
|
+
selector: string;
|
|
14
|
+
/**
|
|
15
|
+
* Préfixe global optionnel à ajouter avant le nom de base.
|
|
16
|
+
* @default ''
|
|
17
|
+
*/
|
|
18
|
+
classPrefix?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Si vrai, applique aussi le nom de base comme classe simple sur l'élément <body>.
|
|
21
|
+
* @default false
|
|
22
|
+
*/
|
|
23
|
+
targetBody?: boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Injecte automatiquement des classes CSS BEM dans le DOM pour faciliter le styling spécifique par page.
|
|
27
|
+
*
|
|
28
|
+
* ### Démonstration :
|
|
29
|
+
* ```typescript
|
|
30
|
+
* // Si vous appelez la fonction ainsi :
|
|
31
|
+
* injectDynamicPageClass({
|
|
32
|
+
* name: 'cavaliers',
|
|
33
|
+
* selector: '.container, .group, .datagrid'
|
|
34
|
+
* });
|
|
35
|
+
*
|
|
36
|
+
* // Résultat dans le DOM :
|
|
37
|
+
* // <div class="container cavaliers__container">...</div>
|
|
38
|
+
* // <div class="group cavaliers__group">...</div>
|
|
39
|
+
* // <div class="datagrid cavaliers__datagrid">...</div>
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* ### Fonctionnement :
|
|
43
|
+
* 1. Détermine le **nom de base** (via l'option `name`).
|
|
44
|
+
* 2. Pour chaque **sélecteur** fourni (séparé par des virgules) :
|
|
45
|
+
* - Trouve tous les éléments correspondants.
|
|
46
|
+
* - Génère un suffixe propre en retirant les symboles CSS (`.` ou `#`).
|
|
47
|
+
* - Applique la classe générée : `{base}__{suffixe}`.
|
|
48
|
+
*
|
|
49
|
+
* @param {InjectOptions} options - Configuration de l'injection.
|
|
50
|
+
*/
|
|
51
|
+
export declare const injectDynamicPageClass: ({ name, selector, classPrefix, targetBody }: InjectOptions) => void;
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const f = ({
|
|
2
|
+
name: c,
|
|
3
|
+
selector: i,
|
|
4
|
+
classPrefix: n = "",
|
|
5
|
+
targetBody: a = !1
|
|
6
|
+
}) => {
|
|
7
|
+
if (!c)
|
|
8
|
+
throw new Error("Name is required");
|
|
9
|
+
if (!i)
|
|
10
|
+
throw new Error("Selector is required");
|
|
11
|
+
const s = n ? `${n}-${c}` : c, l = (e, t) => {
|
|
12
|
+
const o = t.replace(/^[.#]/, "").trim(), r = o ? `${s}__${o}` : s;
|
|
13
|
+
e.classList.contains(r) || e.classList.add(r);
|
|
14
|
+
};
|
|
15
|
+
a && (document.body.classList.contains(s) || document.body.classList.add(s)), i.split(",").forEach((e) => {
|
|
16
|
+
const t = e.trim();
|
|
17
|
+
if (!t) return;
|
|
18
|
+
document.querySelectorAll(t).forEach((r) => l(r, t));
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
f as injectDynamicPageClass
|
|
23
|
+
};
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -2,22 +2,22 @@ import './core/styles/main.css';/* empty css */
|
|
|
2
2
|
import { Color as t } from "./components/Color/react/index.js";
|
|
3
3
|
import { Button as m } from "./components/Button/react/index.js";
|
|
4
4
|
import { Icon as f, SizeProvider as a, useSize as d } from "./components/Icon/react/index.js";
|
|
5
|
-
import { Group as
|
|
5
|
+
import { Group as n } from "./components/Group/react/index.js";
|
|
6
6
|
import { Avatar as c } from "./components/Avatar/react/index.js";
|
|
7
|
-
import { Badge as
|
|
7
|
+
import { Badge as s } from "./components/Badge/react/index.js";
|
|
8
8
|
import { Divider as S } from "./components/Divider/react/index.js";
|
|
9
|
-
import { ContextMenu as
|
|
10
|
-
import { Form as
|
|
11
|
-
import { Shadow as
|
|
12
|
-
import { Radius as
|
|
9
|
+
import { ContextMenu as C } from "./components/Context-menu/react/index.js";
|
|
10
|
+
import { Form as v } from "./components/Form/react/index.js";
|
|
11
|
+
import { Shadow as D } from "./components/Shadow/react/index.js";
|
|
12
|
+
import { Radius as L } from "./components/Radius/react/index.js";
|
|
13
13
|
import { Dropdown as I } from "./components/Dropdown/react/index.js";
|
|
14
|
-
import { Logo as
|
|
15
|
-
import { Modal as
|
|
16
|
-
import { Placeholder as
|
|
17
|
-
import { Tooltip as
|
|
18
|
-
import { Table as
|
|
19
|
-
import { Accordion as
|
|
20
|
-
import { Tabs as
|
|
14
|
+
import { Logo as P } from "./components/Logo/react/index.js";
|
|
15
|
+
import { Modal as w } from "./components/Modal/react/index.js";
|
|
16
|
+
import { Placeholder as j } from "./components/Placeholder/react/index.js";
|
|
17
|
+
import { Tooltip as y } from "./components/Tooltip/react/index.js";
|
|
18
|
+
import { Table as F } from "./components/Table/react/index.js";
|
|
19
|
+
import { Accordion as N } from "./components/Accordion/react/index.js";
|
|
20
|
+
import { Tabs as q } from "./components/Tab/react/index.js";
|
|
21
21
|
import { Alert as K, AlertBase as O, AlertHeading as Q, AlertLink as U } from "./components/Alert/react/index.js";
|
|
22
22
|
import { Dashboard as W } from "./components/Dashboard/react/index.js";
|
|
23
23
|
import { Nav as Y } from "./components/Nav/react/index.js";
|
|
@@ -26,50 +26,52 @@ import { Auth as oo } from "./components/Auth/react/index.js";
|
|
|
26
26
|
import { Errorpage as eo } from "./components/Errorpage/react/index.js";
|
|
27
27
|
import { Loader as po } from "./components/Loader/react/index.js";
|
|
28
28
|
import { Grid as xo, GridItem as fo, GridSpacer as ao } from "./components/Grid/react/index.js";
|
|
29
|
-
import { Menu as
|
|
29
|
+
import { Menu as no } from "./components/Menu/react/index.js";
|
|
30
30
|
import { Slider as co, SliderItem as uo } from "./components/Slider/react/index.js";
|
|
31
|
-
import { Card as
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
31
|
+
import { Card as Ao } from "./components/Card/react/index.js";
|
|
32
|
+
import { injectDynamicPageClass as go } from "./core/utils/getName.js";
|
|
33
|
+
import { default as ho } from "./node_modules/.pnpm/react-bootstrap@2.10.10_@types_react@19.2.10_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/react-bootstrap/esm/AccordionContext.js";
|
|
34
|
+
import { useAccordionButton as Bo } from "react-bootstrap";
|
|
34
35
|
export {
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
N as Accordion,
|
|
37
|
+
ho as AccordionContext,
|
|
37
38
|
K as Alert,
|
|
38
39
|
O as AlertBase,
|
|
39
40
|
Q as AlertHeading,
|
|
40
41
|
U as AlertLink,
|
|
41
42
|
oo as Auth,
|
|
42
43
|
c as Avatar,
|
|
43
|
-
|
|
44
|
+
s as Badge,
|
|
44
45
|
m as Button,
|
|
45
|
-
|
|
46
|
+
Ao as Card,
|
|
46
47
|
t as Color,
|
|
47
|
-
|
|
48
|
+
C as ContextMenu,
|
|
48
49
|
W as Dashboard,
|
|
49
50
|
S as Divider,
|
|
50
51
|
I as Dropdown,
|
|
51
52
|
eo as Errorpage,
|
|
52
|
-
|
|
53
|
+
v as Form,
|
|
53
54
|
xo as Grid,
|
|
54
55
|
fo as GridItem,
|
|
55
56
|
ao as GridSpacer,
|
|
56
|
-
|
|
57
|
+
n as Group,
|
|
57
58
|
f as Icon,
|
|
58
59
|
_ as LangSelector,
|
|
59
60
|
po as Loader,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
P as Logo,
|
|
62
|
+
no as Menu,
|
|
63
|
+
w as Modal,
|
|
63
64
|
Y as Nav,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
j as Placeholder,
|
|
66
|
+
L as Radius,
|
|
67
|
+
D as Shadow,
|
|
67
68
|
a as SizeProvider,
|
|
68
69
|
co as Slider,
|
|
69
70
|
uo as SliderItem,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
F as Table,
|
|
72
|
+
q as Tabs,
|
|
73
|
+
y as Tooltip,
|
|
74
|
+
go as injectDynamicPageClass,
|
|
75
|
+
Bo as useAccordionButton,
|
|
74
76
|
d as useSize
|
|
75
77
|
};
|