@netoyed/ux4g-design-system-v3-postcss 1.0.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/dist/index.cjs +395 -0
- package/dist/index.d.cts +414 -0
- package/dist/index.d.ts +414 -0
- package/dist/index.js +361 -0
- package/package.json +30 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// index.js
|
|
30
|
+
var index_exports = {};
|
|
31
|
+
__export(index_exports, {
|
|
32
|
+
default: () => index_default,
|
|
33
|
+
postcss: () => postcss
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(index_exports);
|
|
36
|
+
var import_fast_glob = __toESM(require("fast-glob"), 1);
|
|
37
|
+
var import_fs = __toESM(require("fs"), 1);
|
|
38
|
+
|
|
39
|
+
// ../core/jit/registry.js
|
|
40
|
+
var registry = {
|
|
41
|
+
// --- Spacing ---
|
|
42
|
+
"p": { type: "space", property: "padding" },
|
|
43
|
+
"pt": { type: "space", property: "padding-top" },
|
|
44
|
+
"pr": { type: "space", property: "padding-right" },
|
|
45
|
+
"pb": { type: "space", property: "padding-bottom" },
|
|
46
|
+
"pl": { type: "space", property: "padding-left" },
|
|
47
|
+
"px": { type: "space", property: ["padding-left", "padding-right"] },
|
|
48
|
+
"py": { type: "space", property: ["padding-top", "padding-bottom"] },
|
|
49
|
+
"m": { type: "space", property: "margin" },
|
|
50
|
+
"mt": { type: "space", property: "margin-top" },
|
|
51
|
+
"mr": { type: "space", property: "margin-right" },
|
|
52
|
+
"mb": { type: "space", property: "margin-bottom" },
|
|
53
|
+
"ml": { type: "space", property: "margin-left" },
|
|
54
|
+
"mx": { type: "space", property: ["margin-left", "margin-right"] },
|
|
55
|
+
"my": { type: "space", property: ["margin-top", "margin-bottom"] },
|
|
56
|
+
// --- Colors ---
|
|
57
|
+
"text": { type: "color", property: "color" },
|
|
58
|
+
"bg": { type: "color", property: "background-color" },
|
|
59
|
+
"border": { type: "color", property: "border-color" },
|
|
60
|
+
// --- Typography ---
|
|
61
|
+
"font": { type: "fontDetail", property: "font-weight" },
|
|
62
|
+
"text-size": { type: "text", property: "font-size" },
|
|
63
|
+
"leading": { type: "value", property: "line-height" },
|
|
64
|
+
"tracking": { type: "value", property: "letter-spacing" },
|
|
65
|
+
"align": { type: "static", property: "text-align" },
|
|
66
|
+
// text-center
|
|
67
|
+
// --- Layout ---
|
|
68
|
+
"flex": { type: "static", property: "display", value: "flex" },
|
|
69
|
+
"inline-flex": { type: "static", property: "display", value: "inline-flex" },
|
|
70
|
+
"grid": { type: "static", property: "display", value: "grid" },
|
|
71
|
+
"hidden": { type: "static", property: "display", value: "none" },
|
|
72
|
+
"block": { type: "static", property: "display", value: "block" },
|
|
73
|
+
"inline-block": { type: "static", property: "display", value: "inline-block" },
|
|
74
|
+
"items": { type: "static", property: "align-items" },
|
|
75
|
+
// start, end, center, baseline, stretch
|
|
76
|
+
"justify": { type: "static", property: "justify-content" },
|
|
77
|
+
// start, end, center, between, around, evenly
|
|
78
|
+
"self": { type: "static", property: "align-self" },
|
|
79
|
+
"flex-col": { type: "static", property: "flex-direction", value: "column" },
|
|
80
|
+
"flex-row": { type: "static", property: "flex-direction", value: "row" },
|
|
81
|
+
"flex-wrap": { type: "static", property: "flex-wrap", value: "wrap" },
|
|
82
|
+
"flex-nowrap": { type: "static", property: "flex-wrap", value: "nowrap" },
|
|
83
|
+
"gap": { type: "space", property: "gap" },
|
|
84
|
+
"gap-x": { type: "space", property: "column-gap" },
|
|
85
|
+
"gap-y": { type: "space", property: "row-gap" },
|
|
86
|
+
// --- Sizing ---
|
|
87
|
+
"w": { type: "size", property: "width" },
|
|
88
|
+
"h": { type: "size", property: "height" },
|
|
89
|
+
"min-w": { type: "size", property: "min-width" },
|
|
90
|
+
"min-h": { type: "size", property: "min-height" },
|
|
91
|
+
"max-w": { type: "size", property: "max-width" },
|
|
92
|
+
"max-h": { type: "size", property: "max-height" },
|
|
93
|
+
// --- Borders & Effects ---
|
|
94
|
+
"rounded": { type: "radius", property: "border-radius" },
|
|
95
|
+
"shadow": { type: "shadow", property: "box-shadow" },
|
|
96
|
+
"opacity": { type: "value", property: "opacity" },
|
|
97
|
+
"z": { type: "zIndex", property: "z-index" },
|
|
98
|
+
// --- Position ---
|
|
99
|
+
"absolute": { type: "static", property: "position", value: "absolute" },
|
|
100
|
+
"relative": { type: "static", property: "position", value: "relative" },
|
|
101
|
+
"fixed": { type: "static", property: "position", value: "fixed" },
|
|
102
|
+
"top": { type: "space", property: "top" },
|
|
103
|
+
"right": { type: "space", property: "right" },
|
|
104
|
+
"bottom": { type: "space", property: "bottom" },
|
|
105
|
+
"left": { type: "space", property: "left" }
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
// ../core/jit/generator.js
|
|
109
|
+
function generateUtility(className, config) {
|
|
110
|
+
let bp = null;
|
|
111
|
+
let util = className;
|
|
112
|
+
if (className.includes(":")) {
|
|
113
|
+
[bp, util] = className.split(":");
|
|
114
|
+
}
|
|
115
|
+
let css = "";
|
|
116
|
+
if (!util.startsWith(config.prefix)) return null;
|
|
117
|
+
const coreUtil = util.replace(config.prefix, "");
|
|
118
|
+
for (const [key, def] of Object.entries(registry)) {
|
|
119
|
+
const prefix = `${key}-`;
|
|
120
|
+
if (coreUtil.startsWith(prefix)) {
|
|
121
|
+
const value = coreUtil.slice(prefix.length);
|
|
122
|
+
let varName = "";
|
|
123
|
+
if (def.type === "space") varName = `var(--${config.prefix}space-${value})`;
|
|
124
|
+
else if (def.type === "color") varName = `var(--${config.prefix}color-${value})`;
|
|
125
|
+
else if (def.type === "radius") varName = `var(--${config.prefix}radius-${value || "DEFAULT"})`;
|
|
126
|
+
else if (def.type === "shadow") varName = `var(--${config.prefix}shadow-${value || "DEFAULT"})`;
|
|
127
|
+
else if (def.type === "zIndex") varName = `var(--${config.prefix}zIndex-${value})`;
|
|
128
|
+
else if (def.type === "fontDetail") varName = `var(--${config.prefix}fontWeight-${value})`;
|
|
129
|
+
else if (def.type === "static") {
|
|
130
|
+
if (def.value) {
|
|
131
|
+
if (value !== "" && !def.allowValue) continue;
|
|
132
|
+
varName = def.value;
|
|
133
|
+
} else {
|
|
134
|
+
varName = value;
|
|
135
|
+
}
|
|
136
|
+
} else if (def.type === "size") {
|
|
137
|
+
if (config.theme.spacing[value]) {
|
|
138
|
+
varName = `var(--${config.prefix}space-${value})`;
|
|
139
|
+
} else if (value.includes("/")) {
|
|
140
|
+
const [num, den] = value.split("/");
|
|
141
|
+
varName = `${parseInt(num) / parseInt(den) * 100}%`;
|
|
142
|
+
} else {
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
} else continue;
|
|
146
|
+
const props = Array.isArray(def.property) ? def.property : [def.property];
|
|
147
|
+
const decls = def.type === "static" && def.value ? varName : props.map((p) => `${p}:${varName}`).join(";");
|
|
148
|
+
css = `.${escape(className)}{${decls};}`;
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
if (!css) return null;
|
|
153
|
+
if (bp) {
|
|
154
|
+
const size = config.breakpoints[bp];
|
|
155
|
+
return `@media (min-width:${size}){${css}}`;
|
|
156
|
+
}
|
|
157
|
+
return css;
|
|
158
|
+
}
|
|
159
|
+
function escape(cls) {
|
|
160
|
+
return cls.replace(/:/g, "\\:");
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// ../core/config/defaultConfig.js
|
|
164
|
+
var defaultConfig = {
|
|
165
|
+
/**
|
|
166
|
+
* --------------------------------------------------
|
|
167
|
+
* CORE
|
|
168
|
+
* --------------------------------------------------
|
|
169
|
+
*/
|
|
170
|
+
prefix: "ux4g-",
|
|
171
|
+
/**
|
|
172
|
+
* dev | build | cdn
|
|
173
|
+
* NOTE: CLI command will override this
|
|
174
|
+
*/
|
|
175
|
+
mode: "build",
|
|
176
|
+
/**
|
|
177
|
+
* --------------------------------------------------
|
|
178
|
+
* CONTENT (used for purge / JIT)
|
|
179
|
+
* --------------------------------------------------
|
|
180
|
+
*/
|
|
181
|
+
content: [
|
|
182
|
+
"./index.html",
|
|
183
|
+
"./src/**/*.{js,ts,jsx,tsx,vue,html}",
|
|
184
|
+
"./pages/**/*.{js,ts,jsx,tsx}",
|
|
185
|
+
"./components/**/*.{js,ts,jsx,tsx}",
|
|
186
|
+
"./**/*.php"
|
|
187
|
+
],
|
|
188
|
+
/**
|
|
189
|
+
* --------------------------------------------------
|
|
190
|
+
* THEME (tokens)
|
|
191
|
+
* --------------------------------------------------
|
|
192
|
+
*/
|
|
193
|
+
theme: {
|
|
194
|
+
colors: {
|
|
195
|
+
primary: {
|
|
196
|
+
50: "#EFF6FF",
|
|
197
|
+
500: "#3B82F6",
|
|
198
|
+
700: "#1D4ED8"
|
|
199
|
+
},
|
|
200
|
+
secondary: {
|
|
201
|
+
500: "#9333EA"
|
|
202
|
+
},
|
|
203
|
+
danger: {
|
|
204
|
+
500: "#EF4444"
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
spacing: {
|
|
208
|
+
0: "0px",
|
|
209
|
+
1: "4px",
|
|
210
|
+
2: "8px",
|
|
211
|
+
4: "16px",
|
|
212
|
+
6: "24px",
|
|
213
|
+
8: "32px"
|
|
214
|
+
},
|
|
215
|
+
fontSize: {
|
|
216
|
+
xs: "12px",
|
|
217
|
+
sm: "14px",
|
|
218
|
+
md: "16px",
|
|
219
|
+
lg: "18px",
|
|
220
|
+
xl: "20px"
|
|
221
|
+
},
|
|
222
|
+
fontWeight: {
|
|
223
|
+
regular: 400,
|
|
224
|
+
medium: 500,
|
|
225
|
+
bold: 700
|
|
226
|
+
},
|
|
227
|
+
radius: {
|
|
228
|
+
sm: "4px",
|
|
229
|
+
md: "8px",
|
|
230
|
+
lg: "12px",
|
|
231
|
+
xl: "16px"
|
|
232
|
+
},
|
|
233
|
+
shadow: {
|
|
234
|
+
sm: "0 1px 2px rgba(0,0,0,0.05)",
|
|
235
|
+
md: "0 4px 6px rgba(0,0,0,0.1)"
|
|
236
|
+
},
|
|
237
|
+
zIndex: {
|
|
238
|
+
dropdown: 1e3,
|
|
239
|
+
modal: 1100,
|
|
240
|
+
toast: 1200
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
/**
|
|
244
|
+
* --------------------------------------------------
|
|
245
|
+
* RESPONSIVE
|
|
246
|
+
* --------------------------------------------------
|
|
247
|
+
*/
|
|
248
|
+
breakpoints: {
|
|
249
|
+
sm: "640px",
|
|
250
|
+
md: "768px",
|
|
251
|
+
lg: "1024px",
|
|
252
|
+
xl: "1280px"
|
|
253
|
+
},
|
|
254
|
+
/**
|
|
255
|
+
* --------------------------------------------------
|
|
256
|
+
* DARK MODE / THEMES
|
|
257
|
+
* --------------------------------------------------
|
|
258
|
+
*/
|
|
259
|
+
darkMode: {
|
|
260
|
+
enabled: true,
|
|
261
|
+
strategy: "data-attribute",
|
|
262
|
+
// class | data-attribute
|
|
263
|
+
attribute: "data-theme",
|
|
264
|
+
themes: {
|
|
265
|
+
light: "light",
|
|
266
|
+
dark: "dark"
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
/**
|
|
270
|
+
* --------------------------------------------------
|
|
271
|
+
* SAFELIST (dynamic classes)
|
|
272
|
+
* --------------------------------------------------
|
|
273
|
+
*/
|
|
274
|
+
safelist: [],
|
|
275
|
+
/**
|
|
276
|
+
* --------------------------------------------------
|
|
277
|
+
* COMPONENTS
|
|
278
|
+
* --------------------------------------------------
|
|
279
|
+
*/
|
|
280
|
+
components: {
|
|
281
|
+
button: true,
|
|
282
|
+
card: true,
|
|
283
|
+
input: true,
|
|
284
|
+
modal: false
|
|
285
|
+
},
|
|
286
|
+
/**
|
|
287
|
+
* --------------------------------------------------
|
|
288
|
+
* PLUGINS
|
|
289
|
+
* --------------------------------------------------
|
|
290
|
+
*/
|
|
291
|
+
plugins: [],
|
|
292
|
+
/**
|
|
293
|
+
* --------------------------------------------------
|
|
294
|
+
* OUTPUT
|
|
295
|
+
* --------------------------------------------------
|
|
296
|
+
*/
|
|
297
|
+
output: {
|
|
298
|
+
dir: "dist",
|
|
299
|
+
file: "ux4g.css",
|
|
300
|
+
minify: true,
|
|
301
|
+
sourceMap: false
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
// ../core/config/preflight.js
|
|
306
|
+
var preflight = `
|
|
307
|
+
/* UX4G Preflight (Reset) */
|
|
308
|
+
*, ::before, ::after { box-sizing: border-box; border-width: 0; border-style: solid; border-color: currentColor; }
|
|
309
|
+
html { line-height: 1.5; -webkit-text-size-adjust: 100%; -moz-tab-size: 4; tab-size: 4; font-family: system-ui, sans-serif; }
|
|
310
|
+
body { margin: 0; line-height: inherit; }
|
|
311
|
+
hr { height: 0; color: inherit; border-top-width: 1px; }
|
|
312
|
+
abbr:where([title]) { text-decoration: underline dotted; }
|
|
313
|
+
h1, h2, h3, h4, h5, h6 { font-size: inherit; font-weight: inherit; }
|
|
314
|
+
a { color: inherit; text-decoration: inherit; }
|
|
315
|
+
b, strong { font-weight: bolder; }
|
|
316
|
+
code, kbd, samp, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 1em; }
|
|
317
|
+
small { font-size: 80%; }
|
|
318
|
+
sub, sup { font-size: 75%; line-height: 0; position: relative; vertical-align: baseline; }
|
|
319
|
+
sub { bottom: -0.25em; }
|
|
320
|
+
sup { top: -0.5em; }
|
|
321
|
+
table { text-indent: 0; border-color: inherit; border-collapse: collapse; }
|
|
322
|
+
button, input, optgroup, select, textarea { font-family: inherit; font-size: 100%; line-height: inherit; color: inherit; margin: 0; padding: 0; }
|
|
323
|
+
button, select { text-transform: none; }
|
|
324
|
+
button, [type='button'], [type='reset'], [type='submit'] { -webkit-appearance: button; background-color: transparent; background-image: none; }
|
|
325
|
+
:-moz-focusring { outline: auto; }
|
|
326
|
+
:-moz-ui-invalid { box-shadow: none; }
|
|
327
|
+
progress { vertical-align: baseline; }
|
|
328
|
+
::-webkit-inner-spin-button, ::-webkit-outer-spin-button { height: auto; }
|
|
329
|
+
[type='search'] { -webkit-appearance: textfield; outline-offset: -2px; }
|
|
330
|
+
::-webkit-search-decoration { -webkit-appearance: none; }
|
|
331
|
+
::-webkit-file-upload-button { -webkit-appearance: button; font: inherit; }
|
|
332
|
+
summary { display: list-item; }
|
|
333
|
+
blockquote, dl, dd, h1, h2, h3, h4, h5, h6, hr, figure, p, pre { margin: 0; }
|
|
334
|
+
fieldset { margin: 0; padding: 0; }
|
|
335
|
+
legend { padding: 0; }
|
|
336
|
+
ol, ul, menu { list-style: none; margin: 0; padding: 0; }
|
|
337
|
+
textarea { resize: vertical; }
|
|
338
|
+
input::placeholder, textarea::placeholder { opacity: 1; color: #9ca3af; }
|
|
339
|
+
button, [role="button"] { cursor: pointer; }
|
|
340
|
+
:disabled { cursor: default; }
|
|
341
|
+
img, svg, video, canvas, audio, iframe, embed, object { display: block; vertical-align: middle; }
|
|
342
|
+
img, video { max-width: 100%; height: auto; }
|
|
343
|
+
[hidden] { display: none; }
|
|
344
|
+
`;
|
|
345
|
+
|
|
346
|
+
// index.js
|
|
347
|
+
function deepMerge(target, source) {
|
|
348
|
+
if (typeof source !== "object" || source === null) return source;
|
|
349
|
+
const result = { ...target };
|
|
350
|
+
for (const key of Object.keys(source)) {
|
|
351
|
+
if (Array.isArray(source[key])) {
|
|
352
|
+
result[key] = source[key];
|
|
353
|
+
} else if (typeof source[key] === "object" && typeof target[key] === "object") {
|
|
354
|
+
result[key] = deepMerge(target[key], source[key]);
|
|
355
|
+
} else {
|
|
356
|
+
result[key] = source[key];
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
return result;
|
|
360
|
+
}
|
|
361
|
+
var index_default = (opts = {}) => {
|
|
362
|
+
return {
|
|
363
|
+
postcssPlugin: "ux4g",
|
|
364
|
+
async Once(root, { result }) {
|
|
365
|
+
let config = deepMerge(defaultConfig, opts);
|
|
366
|
+
config.prefix = "ux4g-";
|
|
367
|
+
const files = await (0, import_fast_glob.default)(config.content);
|
|
368
|
+
const foundClasses = /* @__PURE__ */ new Set();
|
|
369
|
+
const prefix = config.prefix.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
370
|
+
const CLASS_REGEX = new RegExp(`(sm:|md:|lg:|xl:)?${prefix}[a-z0-9\\-]+`, "g");
|
|
371
|
+
for (const file of files) {
|
|
372
|
+
const content = import_fs.default.readFileSync(file, "utf8");
|
|
373
|
+
const matches = content.match(CLASS_REGEX);
|
|
374
|
+
if (matches) matches.forEach((c) => foundClasses.add(c));
|
|
375
|
+
}
|
|
376
|
+
let utilitiesCSS = "";
|
|
377
|
+
for (const cls of foundClasses) {
|
|
378
|
+
const css = generateUtility(cls, config);
|
|
379
|
+
if (css) utilitiesCSS += css + "\n";
|
|
380
|
+
}
|
|
381
|
+
root.walkAtRules("ux4g", (rule) => {
|
|
382
|
+
if (rule.params === "base") {
|
|
383
|
+
rule.replaceWith(preflight);
|
|
384
|
+
} else if (rule.params === "utilities") {
|
|
385
|
+
rule.replaceWith(utilitiesCSS);
|
|
386
|
+
}
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
};
|
|
390
|
+
};
|
|
391
|
+
var postcss = true;
|
|
392
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
393
|
+
0 && (module.exports = {
|
|
394
|
+
postcss
|
|
395
|
+
});
|