sibujs 4.5.0 → 4.7.0
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/README.md +1 -1
- package/dist/browser.cjs +326 -133
- package/dist/browser.d.cts +46 -14
- package/dist/browser.d.ts +46 -14
- package/dist/browser.js +8 -6
- package/dist/build.cjs +2094 -1033
- package/dist/build.d.cts +133 -44
- package/dist/build.d.ts +133 -44
- package/dist/build.js +1372 -574
- package/dist/cdn.dev.global.js +10 -10
- package/dist/cdn.full.dev.global.js +11 -11
- package/dist/cdn.full.global.js +10 -10
- package/dist/cdn.global.js +10 -10
- package/dist/{chunk-2DCGACUU.js → chunk-2BPG2XDA.js} +251 -66
- package/dist/{chunk-IXKSNWV5.js → chunk-2INLLLMZ.js} +1 -1
- package/dist/{chunk-4PMLNECI.js → chunk-3QWBSL5R.js} +98 -29
- package/dist/{chunk-KKLW7YWL.js → chunk-4AWA2PVD.js} +275 -144
- package/dist/chunk-5HZXGZ6T.js +24 -0
- package/dist/{chunk-PCT43HW3.js → chunk-7LUJQAOJ.js} +1 -1
- package/dist/{chunk-5DXA2J44.js → chunk-7XHATCIH.js} +5 -2
- package/dist/chunk-BC2SECJD.js +44 -0
- package/dist/{chunk-TBYTO6BS.js → chunk-BSY63EM6.js} +136 -80
- package/dist/{chunk-FTIR4QW2.js → chunk-DKXRACVN.js} +6 -8
- package/dist/{chunk-ONOHFDLG.js → chunk-FNJXNGYZ.js} +3 -3
- package/dist/{chunk-XZZOBQAY.js → chunk-FQRUXCEE.js} +6 -5
- package/dist/{chunk-NIOYEGBQ.js → chunk-HURREPU2.js} +27 -13
- package/dist/chunk-J6FW5TV6.js +233 -0
- package/dist/{chunk-UGRX3S57.js → chunk-JWKYU5GV.js} +22 -4
- package/dist/chunk-NYNYSPK7.js +318 -0
- package/dist/{chunk-RBTPLM32.js → chunk-RUSSKG6G.js} +13 -12
- package/dist/{chunk-7LN645I6.js → chunk-SLM3IA34.js} +3 -3
- package/dist/{chunk-R25EFXXC.js → chunk-TUCPL2HB.js} +3 -3
- package/dist/{chunk-B3WHI2QA.js → chunk-UNWRJRKC.js} +55 -31
- package/dist/{chunk-KEISJXBU.js → chunk-UOL2ECCS.js} +44 -17
- package/dist/{chunk-RJE2BNI4.js → chunk-VZSG24LS.js} +108 -45
- package/dist/{chunk-RIXRAYIU.js → chunk-WEQ3DMVL.js} +10 -4
- package/dist/{chunk-3JZ4L5TJ.js → chunk-WOLJZUFQ.js} +354 -90
- package/dist/{chunk-S373NSMK.js → chunk-XYV3EDB7.js} +283 -123
- package/dist/{chunk-VZKNK2V7.js → chunk-XZR4PXRE.js} +296 -38
- package/dist/{chunk-GW3SCCZG.js → chunk-Z3OHK6QT.js} +153 -110
- package/dist/{chunk-OMJJM3KM.js → chunk-ZVL7TY4K.js} +287 -130
- package/dist/{contracts-DBdg9J_a.d.ts → contracts-CLqzJnOV.d.ts} +36 -17
- package/dist/{contracts-DBdg9J_a.d.cts → contracts-CTOJXu-x.d.cts} +36 -17
- package/dist/{customElement-OB9CIsc5.d.cts → customElement-MmInOW1U.d.cts} +21 -0
- package/dist/{customElement-OB9CIsc5.d.ts → customElement-MmInOW1U.d.ts} +21 -0
- package/dist/data.cjs +410 -155
- package/dist/data.d.cts +166 -12
- package/dist/data.d.ts +166 -12
- package/dist/data.js +12 -9
- package/dist/devtools.cjs +98 -61
- package/dist/devtools.js +7 -8
- package/dist/dispose-GEIG2KOF.js +28 -0
- package/dist/ecosystem.cjs +372 -126
- package/dist/ecosystem.d.cts +20 -3
- package/dist/ecosystem.d.ts +20 -3
- package/dist/ecosystem.js +12 -12
- package/dist/extras.cjs +2366 -909
- package/dist/extras.d.cts +11 -9
- package/dist/extras.d.ts +11 -9
- package/dist/extras.js +39 -28
- package/dist/index.cjs +421 -158
- package/dist/index.d.cts +213 -171
- package/dist/index.d.ts +213 -171
- package/dist/index.js +24 -27
- package/dist/motion.cjs +118 -44
- package/dist/motion.js +5 -5
- package/dist/patterns.cjs +344 -53
- package/dist/patterns.d.cts +28 -9
- package/dist/patterns.d.ts +28 -9
- package/dist/patterns.js +8 -8
- package/dist/performance.cjs +325 -220
- package/dist/performance.d.cts +2 -2
- package/dist/performance.d.ts +2 -2
- package/dist/performance.js +8 -9
- package/dist/plugin-DVgSnTfK.d.cts +112 -0
- package/dist/plugin-DVgSnTfK.d.ts +112 -0
- package/dist/plugins.cjs +664 -233
- package/dist/plugins.d.cts +127 -14
- package/dist/plugins.d.ts +127 -14
- package/dist/plugins.js +96 -42
- package/dist/signal-EotCj4hS.d.cts +110 -0
- package/dist/signal-EotCj4hS.d.ts +110 -0
- package/dist/{ssr-BiPRdZ6n.d.cts → ssr-Bli9XRW5.d.cts} +5 -0
- package/dist/{ssr-BiPRdZ6n.d.ts → ssr-Bli9XRW5.d.ts} +5 -0
- package/dist/{ssr-Y7XOEPEN.js → ssr-XOTUASDO.js} +4 -5
- package/dist/ssr.cjs +229 -84
- package/dist/ssr.d.cts +9 -3
- package/dist/ssr.d.ts +9 -3
- package/dist/ssr.js +11 -12
- package/dist/{startup-BMpaiMhP.d.ts → startup-BLfSeL15.d.cts} +73 -22
- package/dist/{startup-BMpaiMhP.d.cts → startup-BLfSeL15.d.ts} +73 -22
- package/dist/tagFactory-8qL9LCIx.d.cts +156 -0
- package/dist/tagFactory-BL2fymez.d.ts +156 -0
- package/dist/testing.cjs +2503 -2191
- package/dist/testing.d.cts +56 -5
- package/dist/testing.d.ts +56 -5
- package/dist/testing.js +580 -307
- package/dist/types-CJFViL6Q.d.cts +26 -0
- package/dist/types-CJFViL6Q.d.ts +26 -0
- package/dist/ui.cjs +732 -329
- package/dist/ui.d.cts +41 -7
- package/dist/ui.d.ts +41 -7
- package/dist/ui.js +151 -56
- package/dist/widgets.cjs +267 -291
- package/dist/widgets.js +9 -10
- package/package.json +4 -2
- package/dist/chunk-2WLZ6757.js +0 -149
- package/dist/chunk-CCSJMTRN.js +0 -15
- package/dist/chunk-QKRPLZ2V.js +0 -108
- package/dist/chunk-VUF4ALSW.js +0 -60
- package/dist/chunk-WWV3SJ3L.js +0 -131
- package/dist/dispose-46BOMMQJ.js +0 -19
- package/dist/plugin-D30wlGW5.d.cts +0 -71
- package/dist/plugin-D30wlGW5.d.ts +0 -71
- package/dist/tagFactory-DVoDpHye.d.cts +0 -215
- package/dist/tagFactory-DVoDpHye.d.ts +0 -215
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createPlugin
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-J6FW5TV6.js";
|
|
4
4
|
import {
|
|
5
5
|
tagFactory
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-UOL2ECCS.js";
|
|
7
7
|
import {
|
|
8
8
|
derived
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-RUSSKG6G.js";
|
|
10
|
+
import {
|
|
11
|
+
globalSingleton
|
|
12
|
+
} from "./chunk-7ZHH77QA.js";
|
|
10
13
|
import {
|
|
11
14
|
effect
|
|
12
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-WEQ3DMVL.js";
|
|
13
16
|
import {
|
|
14
17
|
batch,
|
|
15
18
|
signal
|
|
16
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-FQRUXCEE.js";
|
|
17
20
|
|
|
18
21
|
// src/ecosystem/adapters/mobx.ts
|
|
19
22
|
function mobXAdapter(options) {
|
|
@@ -111,53 +114,119 @@ function zustandAdapter(options) {
|
|
|
111
114
|
}
|
|
112
115
|
|
|
113
116
|
// src/ecosystem/ui/componentAdapter.ts
|
|
117
|
+
var _themeLayers = globalSingleton(
|
|
118
|
+
/* @__PURE__ */ Symbol.for("sibujs.themeLayers.v1"),
|
|
119
|
+
() => /* @__PURE__ */ new WeakMap()
|
|
120
|
+
);
|
|
121
|
+
function commitThemeProperty(root, name, record) {
|
|
122
|
+
const top = record.layers[record.layers.length - 1];
|
|
123
|
+
if (top) {
|
|
124
|
+
root.style.setProperty(name, top.value);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
_themeLayers.get(root)?.delete(name);
|
|
128
|
+
if (record.original.value === "") root.style.removeProperty(name);
|
|
129
|
+
else root.style.setProperty(name, record.original.value, record.original.priority);
|
|
130
|
+
}
|
|
131
|
+
function setThemeLayer(root, name, handle, value) {
|
|
132
|
+
let properties = _themeLayers.get(root);
|
|
133
|
+
if (!properties) _themeLayers.set(root, properties = /* @__PURE__ */ new Map());
|
|
134
|
+
let record = properties.get(name);
|
|
135
|
+
if (!record) {
|
|
136
|
+
record = {
|
|
137
|
+
original: { value: root.style.getPropertyValue(name), priority: root.style.getPropertyPriority(name) },
|
|
138
|
+
layers: []
|
|
139
|
+
};
|
|
140
|
+
properties.set(name, record);
|
|
141
|
+
}
|
|
142
|
+
const layer = record.layers.find((l) => l.handle === handle);
|
|
143
|
+
if (layer) layer.value = value;
|
|
144
|
+
else record.layers.push({ handle, value });
|
|
145
|
+
commitThemeProperty(root, name, record);
|
|
146
|
+
}
|
|
147
|
+
function removeThemeLayer(root, name, handle) {
|
|
148
|
+
const record = _themeLayers.get(root)?.get(name);
|
|
149
|
+
if (!record) return;
|
|
150
|
+
const index = record.layers.findIndex((l) => l.handle === handle);
|
|
151
|
+
if (index === -1) return;
|
|
152
|
+
record.layers.splice(index, 1);
|
|
153
|
+
commitThemeProperty(root, name, record);
|
|
154
|
+
}
|
|
155
|
+
function ownString(map, key) {
|
|
156
|
+
if (!map || key === void 0 || !Object.hasOwn(map, key)) return void 0;
|
|
157
|
+
const value = map[key];
|
|
158
|
+
return typeof value === "string" ? value : void 0;
|
|
159
|
+
}
|
|
114
160
|
function createTheme(initial) {
|
|
115
161
|
const [getConfig, setConfig] = signal(initial);
|
|
116
162
|
function resolveClass(component, variant) {
|
|
117
163
|
const config = getConfig();
|
|
118
164
|
const overrideKey = variant ? `${component}-${variant}` : component;
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
165
|
+
const override = ownString(config.classOverrides, overrideKey);
|
|
166
|
+
if (override) return override;
|
|
122
167
|
const base = `${config.prefix}-${component}`;
|
|
123
168
|
return variant ? `${base} ${config.prefix}-${component}--${variant}` : base;
|
|
124
169
|
}
|
|
125
170
|
function setTheme(partial) {
|
|
126
171
|
setConfig((prev) => ({ ...prev, ...partial }));
|
|
127
172
|
}
|
|
128
|
-
|
|
173
|
+
function applyTo(root) {
|
|
174
|
+
const handle = {};
|
|
175
|
+
let applied = /* @__PURE__ */ new Set();
|
|
176
|
+
const stop = effect(() => {
|
|
177
|
+
const variables = getConfig().variables ?? {};
|
|
178
|
+
const next = new Set(Object.keys(variables));
|
|
179
|
+
for (const name of applied) {
|
|
180
|
+
if (!next.has(name)) removeThemeLayer(root, name, handle);
|
|
181
|
+
}
|
|
182
|
+
for (const [name, value] of Object.entries(variables)) setThemeLayer(root, name, handle, value);
|
|
183
|
+
applied = next;
|
|
184
|
+
});
|
|
185
|
+
let released = false;
|
|
186
|
+
return () => {
|
|
187
|
+
if (released) return;
|
|
188
|
+
released = true;
|
|
189
|
+
stop();
|
|
190
|
+
for (const name of applied) removeThemeLayer(root, name, handle);
|
|
191
|
+
applied.clear();
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
return { config: getConfig, setTheme, resolveClass, applyTo };
|
|
129
195
|
}
|
|
130
196
|
function componentAdapter(config) {
|
|
131
197
|
const theme = createTheme({ prefix: config.prefix });
|
|
198
|
+
const reprefix = (cls, prefix) => prefix !== config.prefix && cls.startsWith(`${config.prefix}-`) ? `${prefix}-${cls.slice(config.prefix.length + 1)}` : cls;
|
|
132
199
|
const components = {};
|
|
133
200
|
for (const [name, mapping] of Object.entries(config.components)) {
|
|
134
201
|
const factory = tagFactory(mapping.tag || "div");
|
|
135
|
-
components[name] = (props = {}) => {
|
|
202
|
+
components[name] = (props = {}, children) => {
|
|
136
203
|
const { variant, size, class: userClass, ...rest } = props;
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
204
|
+
const themeClasses = () => {
|
|
205
|
+
const current = theme.config();
|
|
206
|
+
const overrides = current.classOverrides ?? {};
|
|
207
|
+
const pick = (key, fallback) => Object.hasOwn(overrides, key) ? overrides[key] : reprefix(fallback, current.prefix);
|
|
208
|
+
const classes = [pick(name, mapping.baseClass)];
|
|
209
|
+
const variantClass = ownString(mapping.variants, variant);
|
|
210
|
+
if (variant && variantClass) {
|
|
211
|
+
classes.push(pick(`${name}-${variant}`, variantClass));
|
|
212
|
+
}
|
|
213
|
+
const sizeClass = ownString(mapping.sizes, size);
|
|
214
|
+
if (size && sizeClass) {
|
|
215
|
+
classes.push(pick(`${name}-${size}`, sizeClass));
|
|
216
|
+
}
|
|
217
|
+
return classes.filter(Boolean).join(" ");
|
|
218
|
+
};
|
|
219
|
+
const finalClass = () => {
|
|
220
|
+
const base = themeClasses();
|
|
221
|
+
const extra = typeof userClass === "function" ? userClass() : userClass;
|
|
222
|
+
return typeof extra === "string" && extra ? `${base} ${extra}` : base;
|
|
223
|
+
};
|
|
155
224
|
const mergedProps = {
|
|
156
225
|
...mapping.defaultProps,
|
|
157
226
|
...rest,
|
|
158
227
|
class: finalClass
|
|
159
228
|
};
|
|
160
|
-
return factory(mergedProps);
|
|
229
|
+
return children === void 0 ? factory(mergedProps) : factory(mergedProps, children);
|
|
161
230
|
};
|
|
162
231
|
}
|
|
163
232
|
return { name: config.name, components, theme };
|