@jirawatpyk/aura-react 4.16.0 → 4.18.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 +66 -3
- package/dist/aura.bundle.js +202 -126
- package/dist/cjs/index.cjs +202 -126
- package/dist/esm/Breadcrumb.js +1 -1
- package/dist/esm/Command.js +73 -51
- package/dist/esm/DataTable.js +27 -11
- package/dist/esm/DatePicker.js +17 -146
- package/dist/esm/FileUpload.js +1 -10
- package/dist/esm/Pagination.js +35 -23
- package/dist/esm/Stat.js +1 -1
- package/dist/esm/StatusPill.js +4 -13
- package/dist/esm/TimePicker.js +1 -12
- package/dist/esm/breakpoints.js +5 -0
- package/dist/esm/colorScheme.js +1 -11
- package/dist/esm/colorSchemeScript.js +19 -0
- package/dist/esm/dates.js +164 -0
- package/dist/esm/locale.js +1 -347
- package/dist/esm/responsive.js +1 -1
- package/dist/esm/status.js +17 -0
- package/dist/esm/strings.js +351 -0
- package/dist/esm/text.js +30 -0
- package/dist/index.d.ts +33 -7
- package/dist/server/index.cjs +791 -0
- package/dist/server/index.d.ts +171 -0
- package/dist/server/index.js +768 -0
- package/dist/styles.css +22 -4
- package/dist/styles.layer.css +1355 -0
- package/package.json +8 -2
|
@@ -0,0 +1,768 @@
|
|
|
1
|
+
// src/dates.ts
|
|
2
|
+
var ERA = /^พ\.ศ\.\s?|\s?(BE|พ\.ศ\.)$/g;
|
|
3
|
+
var pad = function(n2) {
|
|
4
|
+
return (n2 < 10 ? "0" : "") + n2;
|
|
5
|
+
};
|
|
6
|
+
function toISO(d) {
|
|
7
|
+
return d ? d.getFullYear() + "-" + pad(d.getMonth() + 1) + "-" + pad(d.getDate()) : null;
|
|
8
|
+
}
|
|
9
|
+
function fromISO(s) {
|
|
10
|
+
if (!s) return null;
|
|
11
|
+
const m = /^(\d{4})-(\d{2})-(\d{2})$/.exec(s);
|
|
12
|
+
return m ? new Date(+m[1], +m[2] - 1, +m[3]) : null;
|
|
13
|
+
}
|
|
14
|
+
var TAGS = { th: "th-TH", en: "en-GB", sv: "sv-SE" };
|
|
15
|
+
function defaultCalendar(locale) {
|
|
16
|
+
return locale === "th" ? "buddhist" : "gregory";
|
|
17
|
+
}
|
|
18
|
+
function localeTag(locale, calendar) {
|
|
19
|
+
const cal = calendar || defaultCalendar(locale);
|
|
20
|
+
return (TAGS[locale || "en"] || "en-GB") + "-u-ca-" + (cal === "gregory" ? "gregory" : "buddhist");
|
|
21
|
+
}
|
|
22
|
+
var fmtCache = {};
|
|
23
|
+
var PRESETS = {
|
|
24
|
+
short: { day: "numeric", month: "short", year: "numeric" },
|
|
25
|
+
long: { day: "numeric", month: "long", year: "numeric" },
|
|
26
|
+
numeric: { day: "2-digit", month: "2-digit", year: "numeric" }
|
|
27
|
+
};
|
|
28
|
+
function fmt(tag, opts, d) {
|
|
29
|
+
const k = tag + JSON.stringify(opts);
|
|
30
|
+
if (!fmtCache[k]) fmtCache[k] = new Intl.DateTimeFormat(tag, opts);
|
|
31
|
+
return fmtCache[k].format(d);
|
|
32
|
+
}
|
|
33
|
+
function formatDate(iso, opts) {
|
|
34
|
+
const o = opts || {}, d = fromISO(iso);
|
|
35
|
+
if (!d) return "";
|
|
36
|
+
const f = typeof o.format === "object" ? o.format : PRESETS[o.format || "short"];
|
|
37
|
+
const loc = o.locale || "th";
|
|
38
|
+
return fmt(localeTag(loc, o.calendar || defaultCalendar(loc)), f, d).replace(ERA, "");
|
|
39
|
+
}
|
|
40
|
+
var MONTHS = null;
|
|
41
|
+
function monthIndex(word) {
|
|
42
|
+
if (!MONTHS) {
|
|
43
|
+
MONTHS = {};
|
|
44
|
+
["th-TH", "en-GB", "sv-SE"].forEach(function(tag) {
|
|
45
|
+
["short", "long"].forEach(function(w) {
|
|
46
|
+
for (let i = 0; i < 12; i++) {
|
|
47
|
+
const n2 = new Intl.DateTimeFormat(tag, { month: w }).format(new Date(2020, i, 1)).toLowerCase().replace(/\.$/, "");
|
|
48
|
+
MONTHS[n2] = i;
|
|
49
|
+
if (/^[a-zåäö]/.test(n2)) MONTHS[n2.slice(0, 3)] = i;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
const k = word.toLowerCase().replace(/\.$/, "");
|
|
55
|
+
return MONTHS[k] != null ? MONTHS[k] : -1;
|
|
56
|
+
}
|
|
57
|
+
function parseDate(text) {
|
|
58
|
+
const s = String(text || "").trim();
|
|
59
|
+
let m = /^(\d{4})-(\d{1,2})-(\d{1,2})$/.exec(s), y, mo, d;
|
|
60
|
+
if (m) {
|
|
61
|
+
y = +m[1];
|
|
62
|
+
mo = +m[2];
|
|
63
|
+
d = +m[3];
|
|
64
|
+
} else if (m = /^(\d{1,2})[\/.\-](\d{1,2})[\/.\-](\d{4})$/.exec(s)) {
|
|
65
|
+
d = +m[1];
|
|
66
|
+
mo = +m[2];
|
|
67
|
+
y = +m[3];
|
|
68
|
+
} else if ((m = /^(\d{1,2})\s+(\S+)\s+(\d{4})$/.exec(s.replace(ERA, "").trim())) && monthIndex(m[2]) >= 0) {
|
|
69
|
+
d = +m[1];
|
|
70
|
+
mo = monthIndex(m[2]) + 1;
|
|
71
|
+
y = +m[3];
|
|
72
|
+
} else return null;
|
|
73
|
+
if (y >= 2400) y -= 543;
|
|
74
|
+
const dt = new Date(y, mo - 1, d);
|
|
75
|
+
return dt.getMonth() === mo - 1 && dt.getDate() === d ? toISO(dt) : null;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// src/text.ts
|
|
79
|
+
function formatBytes(n2) {
|
|
80
|
+
if (n2 == null) return "";
|
|
81
|
+
if (n2 < 1024) return n2 + " B";
|
|
82
|
+
let u = ["KB", "MB", "GB"], i = -1;
|
|
83
|
+
do {
|
|
84
|
+
n2 /= 1024;
|
|
85
|
+
i++;
|
|
86
|
+
} while (n2 >= 1024 && i < u.length - 1);
|
|
87
|
+
return (n2 >= 10 || Math.round(n2) === n2 ? Math.round(n2) : n2.toFixed(1)) + " " + u[i];
|
|
88
|
+
}
|
|
89
|
+
function pad2(n2) {
|
|
90
|
+
return (n2 < 10 ? "0" : "") + n2;
|
|
91
|
+
}
|
|
92
|
+
function parseTime(text) {
|
|
93
|
+
let s = String(text || "").trim().toLowerCase().replace(/\s*(น\.?|นาฬิกา)$/, "").trim();
|
|
94
|
+
const pm = /\s*(pm|p\.m\.)$/.test(s), am = /\s*(am|a\.m\.)$/.test(s);
|
|
95
|
+
s = s.replace(/\s*(am|pm|a\.m\.|p\.m\.)$/, "");
|
|
96
|
+
const m = /^(\d{1,2})(?:[:.](\d{2}))?$/.exec(s) || /^(\d{1,2})(\d{2})$/.exec(s);
|
|
97
|
+
if (!m) return null;
|
|
98
|
+
let hh = +m[1], mm = m[2] ? +m[2] : 0;
|
|
99
|
+
if (pm && hh < 12) hh += 12;
|
|
100
|
+
if (am && hh === 12) hh = 0;
|
|
101
|
+
if (hh > 23 || mm > 59) return null;
|
|
102
|
+
return pad2(hh) + ":" + pad2(mm);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// src/status.ts
|
|
106
|
+
var TONE_WORDS = {
|
|
107
|
+
ready: ["ready", "done", "complete", "completed", "approved", "live", "passed"],
|
|
108
|
+
progress: ["in progress", "in review", "review", "syncing", "running", "pending"],
|
|
109
|
+
blocked: ["blocked", "failed", "error", "rejected", "on hold", "cancelled"]
|
|
110
|
+
};
|
|
111
|
+
function toneFor(status) {
|
|
112
|
+
const s = String(status == null ? "" : status).trim().toLowerCase();
|
|
113
|
+
for (const t in TONE_WORDS) if (TONE_WORDS[t].indexOf(s) >= 0) return t;
|
|
114
|
+
return "neutral";
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// src/strings.ts
|
|
118
|
+
var n = function(x) {
|
|
119
|
+
return Number(x).toLocaleString("en");
|
|
120
|
+
};
|
|
121
|
+
var nsv = function(x) {
|
|
122
|
+
return Number(x).toLocaleString("sv-SE");
|
|
123
|
+
};
|
|
124
|
+
var STRINGS = {
|
|
125
|
+
en: {
|
|
126
|
+
close: "Close",
|
|
127
|
+
dismiss: "Dismiss",
|
|
128
|
+
dismissToast: "Dismiss notification",
|
|
129
|
+
showPassword: "Show password",
|
|
130
|
+
filters: "Filters",
|
|
131
|
+
search: "Search",
|
|
132
|
+
clearFilters: "Clear all",
|
|
133
|
+
results: function(n2) {
|
|
134
|
+
return n2 === 1 ? "1 result" : n2.toLocaleString("en") + " results";
|
|
135
|
+
},
|
|
136
|
+
commandMenu: "Command menu",
|
|
137
|
+
commandPlaceholder: "Type a command or search\u2026",
|
|
138
|
+
commandHint: "\u2191\u2193 to move \xB7 Enter to open \xB7 Esc to close",
|
|
139
|
+
errorSummary: function(n2) {
|
|
140
|
+
return n2 === 1 ? "Fix 1 field to continue" : "Fix " + n2 + " fields to continue";
|
|
141
|
+
},
|
|
142
|
+
notifications: "Notifications",
|
|
143
|
+
mainNav: "Main",
|
|
144
|
+
breadcrumb: "Breadcrumb",
|
|
145
|
+
navigation: "Navigation",
|
|
146
|
+
openNav: "Open navigation",
|
|
147
|
+
collapseNav: "Collapse sidebar",
|
|
148
|
+
expandNav: "Expand sidebar",
|
|
149
|
+
searching: "Searching\u2026",
|
|
150
|
+
noMatches: "No matches",
|
|
151
|
+
clear: function(what) {
|
|
152
|
+
return "Clear " + (what || "selection");
|
|
153
|
+
},
|
|
154
|
+
keepTyping: function(total) {
|
|
155
|
+
return "Keep typing to narrow " + n(total) + " options";
|
|
156
|
+
},
|
|
157
|
+
sortAsc: "Sort ascending",
|
|
158
|
+
sortDesc: "Sort descending",
|
|
159
|
+
pin: "Pin to left",
|
|
160
|
+
unpin: "Unpin column",
|
|
161
|
+
moveLeft: "Move left",
|
|
162
|
+
moveRight: "Move right",
|
|
163
|
+
hideColumn: "Hide column",
|
|
164
|
+
resetColumns: "Reset columns",
|
|
165
|
+
selectRows: "Select rows",
|
|
166
|
+
selectAllRows: "Select all rows",
|
|
167
|
+
deselectAllRows: "Deselect all rows",
|
|
168
|
+
selectAll: "Select all",
|
|
169
|
+
selectRow: function(k) {
|
|
170
|
+
return "Select " + k;
|
|
171
|
+
},
|
|
172
|
+
selectedCount: function(c) {
|
|
173
|
+
return n(c) + " selected";
|
|
174
|
+
},
|
|
175
|
+
pinned: "Pinned",
|
|
176
|
+
columnOptions: function(label) {
|
|
177
|
+
return label + " column options";
|
|
178
|
+
},
|
|
179
|
+
column: function(label) {
|
|
180
|
+
return label ? label + " column" : "Column";
|
|
181
|
+
},
|
|
182
|
+
columns: "Columns",
|
|
183
|
+
showHideColumns: "Show or hide columns",
|
|
184
|
+
empty: "Nothing here yet",
|
|
185
|
+
loading: "Loading\u2026",
|
|
186
|
+
loadingRows: "Loading rows",
|
|
187
|
+
range: function(a, b, total) {
|
|
188
|
+
return a + "\u2013" + b + " of " + n(total);
|
|
189
|
+
},
|
|
190
|
+
page: function(p, total) {
|
|
191
|
+
return "Page " + p + " of " + total;
|
|
192
|
+
},
|
|
193
|
+
prevPage: "Previous page",
|
|
194
|
+
nextPage: "Next page",
|
|
195
|
+
rowCount: function(c) {
|
|
196
|
+
return n(c) + " rows";
|
|
197
|
+
},
|
|
198
|
+
actions: "Actions",
|
|
199
|
+
optional: "optional",
|
|
200
|
+
timePlaceholder: "hh:mm",
|
|
201
|
+
timeInvalid: "Type a time like 09:30",
|
|
202
|
+
timeOutOfRange: function(a, b) {
|
|
203
|
+
return "Choose a time between " + a + " and " + b;
|
|
204
|
+
},
|
|
205
|
+
dropFiles: "Drag files here or",
|
|
206
|
+
browse: "Choose files",
|
|
207
|
+
browseOne: "Choose a file",
|
|
208
|
+
remove: function(n2) {
|
|
209
|
+
return "Remove " + n2;
|
|
210
|
+
},
|
|
211
|
+
fileTooBig: function(max) {
|
|
212
|
+
return "Larger than " + max;
|
|
213
|
+
},
|
|
214
|
+
fileWrongType: "This file type isn\u2019t accepted",
|
|
215
|
+
tooManyFiles: function(n2) {
|
|
216
|
+
return "Up to " + n2 + " files";
|
|
217
|
+
},
|
|
218
|
+
colorScheme: "Colour scheme",
|
|
219
|
+
increase: "Increase",
|
|
220
|
+
decrease: "Decrease",
|
|
221
|
+
stepDone: "completed",
|
|
222
|
+
stepOf: function(i, total) {
|
|
223
|
+
return "Step " + i + " of " + total;
|
|
224
|
+
},
|
|
225
|
+
schemeLight: "Light",
|
|
226
|
+
schemeDark: "Dark",
|
|
227
|
+
schemeSystem: "System",
|
|
228
|
+
uploading: "Uploading\u2026",
|
|
229
|
+
images: "Images",
|
|
230
|
+
pagination: "Pagination",
|
|
231
|
+
pageN: function(p) {
|
|
232
|
+
return "Page " + p;
|
|
233
|
+
},
|
|
234
|
+
accepts: function(list, max) {
|
|
235
|
+
return [list, max && "up to " + max + " each"].filter(Boolean).join(", ");
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
th: {
|
|
239
|
+
close: "\u0E1B\u0E34\u0E14",
|
|
240
|
+
dismiss: "\u0E1B\u0E34\u0E14",
|
|
241
|
+
dismissToast: "\u0E1B\u0E34\u0E14\u0E01\u0E32\u0E23\u0E41\u0E08\u0E49\u0E07\u0E40\u0E15\u0E37\u0E2D\u0E19",
|
|
242
|
+
showPassword: "\u0E41\u0E2A\u0E14\u0E07\u0E23\u0E2B\u0E31\u0E2A\u0E1C\u0E48\u0E32\u0E19",
|
|
243
|
+
filters: "\u0E15\u0E31\u0E27\u0E01\u0E23\u0E2D\u0E07",
|
|
244
|
+
search: "\u0E04\u0E49\u0E19\u0E2B\u0E32",
|
|
245
|
+
clearFilters: "\u0E25\u0E49\u0E32\u0E07\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14",
|
|
246
|
+
results: function(n2) {
|
|
247
|
+
return n2.toLocaleString("en") + " \u0E23\u0E32\u0E22\u0E01\u0E32\u0E23";
|
|
248
|
+
},
|
|
249
|
+
commandMenu: "\u0E40\u0E21\u0E19\u0E39\u0E04\u0E33\u0E2A\u0E31\u0E48\u0E07",
|
|
250
|
+
commandPlaceholder: "\u0E1E\u0E34\u0E21\u0E1E\u0E4C\u0E04\u0E33\u0E2A\u0E31\u0E48\u0E07\u0E2B\u0E23\u0E37\u0E2D\u0E04\u0E49\u0E19\u0E2B\u0E32\u2026",
|
|
251
|
+
commandHint: "\u2191\u2193 \u0E40\u0E25\u0E37\u0E48\u0E2D\u0E19 \xB7 Enter \u0E40\u0E1B\u0E34\u0E14 \xB7 Esc \u0E1B\u0E34\u0E14",
|
|
252
|
+
errorSummary: function(n2) {
|
|
253
|
+
return "\u0E41\u0E01\u0E49\u0E44\u0E02 " + n2 + " \u0E0A\u0E48\u0E2D\u0E07\u0E01\u0E48\u0E2D\u0E19\u0E44\u0E1B\u0E15\u0E48\u0E2D";
|
|
254
|
+
},
|
|
255
|
+
notifications: "\u0E01\u0E32\u0E23\u0E41\u0E08\u0E49\u0E07\u0E40\u0E15\u0E37\u0E2D\u0E19",
|
|
256
|
+
mainNav: "\u0E40\u0E21\u0E19\u0E39\u0E2B\u0E25\u0E31\u0E01",
|
|
257
|
+
breadcrumb: "\u0E40\u0E2A\u0E49\u0E19\u0E17\u0E32\u0E07",
|
|
258
|
+
navigation: "\u0E40\u0E21\u0E19\u0E39",
|
|
259
|
+
openNav: "\u0E40\u0E1B\u0E34\u0E14\u0E40\u0E21\u0E19\u0E39",
|
|
260
|
+
collapseNav: "\u0E22\u0E48\u0E2D\u0E41\u0E16\u0E1A\u0E40\u0E21\u0E19\u0E39",
|
|
261
|
+
expandNav: "\u0E02\u0E22\u0E32\u0E22\u0E41\u0E16\u0E1A\u0E40\u0E21\u0E19\u0E39",
|
|
262
|
+
searching: "\u0E01\u0E33\u0E25\u0E31\u0E07\u0E04\u0E49\u0E19\u0E2B\u0E32\u2026",
|
|
263
|
+
noMatches: "\u0E44\u0E21\u0E48\u0E1E\u0E1A\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23\u0E17\u0E35\u0E48\u0E15\u0E23\u0E07\u0E01\u0E31\u0E19",
|
|
264
|
+
clear: function(what) {
|
|
265
|
+
return "\u0E25\u0E49\u0E32\u0E07" + (what || "\u0E17\u0E35\u0E48\u0E40\u0E25\u0E37\u0E2D\u0E01");
|
|
266
|
+
},
|
|
267
|
+
keepTyping: function(total) {
|
|
268
|
+
return "\u0E1E\u0E34\u0E21\u0E1E\u0E4C\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E40\u0E1E\u0E37\u0E48\u0E2D\u0E01\u0E23\u0E2D\u0E07\u0E08\u0E32\u0E01 " + n(total) + " \u0E23\u0E32\u0E22\u0E01\u0E32\u0E23";
|
|
269
|
+
},
|
|
270
|
+
sortAsc: "\u0E40\u0E23\u0E35\u0E22\u0E07\u0E08\u0E32\u0E01\u0E19\u0E49\u0E2D\u0E22\u0E44\u0E1B\u0E21\u0E32\u0E01",
|
|
271
|
+
sortDesc: "\u0E40\u0E23\u0E35\u0E22\u0E07\u0E08\u0E32\u0E01\u0E21\u0E32\u0E01\u0E44\u0E1B\u0E19\u0E49\u0E2D\u0E22",
|
|
272
|
+
pin: "\u0E15\u0E23\u0E36\u0E07\u0E44\u0E27\u0E49\u0E0B\u0E49\u0E32\u0E22",
|
|
273
|
+
unpin: "\u0E40\u0E25\u0E34\u0E01\u0E15\u0E23\u0E36\u0E07\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C",
|
|
274
|
+
moveLeft: "\u0E22\u0E49\u0E32\u0E22\u0E44\u0E1B\u0E0B\u0E49\u0E32\u0E22",
|
|
275
|
+
moveRight: "\u0E22\u0E49\u0E32\u0E22\u0E44\u0E1B\u0E02\u0E27\u0E32",
|
|
276
|
+
hideColumn: "\u0E0B\u0E48\u0E2D\u0E19\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C",
|
|
277
|
+
resetColumns: "\u0E04\u0E37\u0E19\u0E04\u0E48\u0E32\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C",
|
|
278
|
+
selectRows: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E41\u0E16\u0E27",
|
|
279
|
+
selectAllRows: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E17\u0E38\u0E01\u0E41\u0E16\u0E27",
|
|
280
|
+
deselectAllRows: "\u0E22\u0E01\u0E40\u0E25\u0E34\u0E01\u0E01\u0E32\u0E23\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E17\u0E38\u0E01\u0E41\u0E16\u0E27",
|
|
281
|
+
selectAll: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14",
|
|
282
|
+
selectRow: function(k) {
|
|
283
|
+
return "\u0E40\u0E25\u0E37\u0E2D\u0E01 " + k;
|
|
284
|
+
},
|
|
285
|
+
selectedCount: function(c) {
|
|
286
|
+
return "\u0E40\u0E25\u0E37\u0E2D\u0E01 " + n(c) + " \u0E23\u0E32\u0E22\u0E01\u0E32\u0E23";
|
|
287
|
+
},
|
|
288
|
+
pinned: "\u0E15\u0E23\u0E36\u0E07\u0E2D\u0E22\u0E39\u0E48",
|
|
289
|
+
columnOptions: function(label) {
|
|
290
|
+
return "\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C " + label;
|
|
291
|
+
},
|
|
292
|
+
column: function(label) {
|
|
293
|
+
return label ? "\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C " + label : "\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C";
|
|
294
|
+
},
|
|
295
|
+
columns: "\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C",
|
|
296
|
+
showHideColumns: "\u0E41\u0E2A\u0E14\u0E07\u0E2B\u0E23\u0E37\u0E2D\u0E0B\u0E48\u0E2D\u0E19\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C",
|
|
297
|
+
empty: "\u0E22\u0E31\u0E07\u0E44\u0E21\u0E48\u0E21\u0E35\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25",
|
|
298
|
+
loading: "\u0E01\u0E33\u0E25\u0E31\u0E07\u0E42\u0E2B\u0E25\u0E14\u2026",
|
|
299
|
+
loadingRows: "\u0E01\u0E33\u0E25\u0E31\u0E07\u0E42\u0E2B\u0E25\u0E14\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25",
|
|
300
|
+
range: function(a, b, total) {
|
|
301
|
+
return a + "\u2013" + b + " \u0E08\u0E32\u0E01 " + n(total);
|
|
302
|
+
},
|
|
303
|
+
page: function(p, total) {
|
|
304
|
+
return "\u0E2B\u0E19\u0E49\u0E32 " + p + " / " + total;
|
|
305
|
+
},
|
|
306
|
+
prevPage: "\u0E2B\u0E19\u0E49\u0E32\u0E01\u0E48\u0E2D\u0E19\u0E2B\u0E19\u0E49\u0E32",
|
|
307
|
+
nextPage: "\u0E2B\u0E19\u0E49\u0E32\u0E16\u0E31\u0E14\u0E44\u0E1B",
|
|
308
|
+
rowCount: function(c) {
|
|
309
|
+
return n(c) + " \u0E41\u0E16\u0E27";
|
|
310
|
+
},
|
|
311
|
+
actions: "\u0E01\u0E32\u0E23\u0E08\u0E31\u0E14\u0E01\u0E32\u0E23",
|
|
312
|
+
optional: "\u0E44\u0E21\u0E48\u0E1A\u0E31\u0E07\u0E04\u0E31\u0E1A",
|
|
313
|
+
timePlaceholder: "\u0E0A\u0E0A:\u0E19\u0E19",
|
|
314
|
+
timeInvalid: "\u0E1E\u0E34\u0E21\u0E1E\u0E4C\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A 09:30",
|
|
315
|
+
timeOutOfRange: function(a, b) {
|
|
316
|
+
return "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E40\u0E27\u0E25\u0E32\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07 " + a + "\u2013" + b + " \u0E19.";
|
|
317
|
+
},
|
|
318
|
+
dropFiles: "\u0E25\u0E32\u0E01\u0E44\u0E1F\u0E25\u0E4C\u0E21\u0E32\u0E27\u0E32\u0E07 \u0E2B\u0E23\u0E37\u0E2D",
|
|
319
|
+
browse: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E1F\u0E25\u0E4C",
|
|
320
|
+
browseOne: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E1F\u0E25\u0E4C",
|
|
321
|
+
remove: function(n2) {
|
|
322
|
+
return "\u0E25\u0E1A " + n2;
|
|
323
|
+
},
|
|
324
|
+
fileTooBig: function(max) {
|
|
325
|
+
return "\u0E44\u0E1F\u0E25\u0E4C\u0E43\u0E2B\u0E0D\u0E48\u0E40\u0E01\u0E34\u0E19 " + max;
|
|
326
|
+
},
|
|
327
|
+
fileWrongType: "\u0E44\u0E21\u0E48\u0E23\u0E2D\u0E07\u0E23\u0E31\u0E1A\u0E44\u0E1F\u0E25\u0E4C\u0E0A\u0E19\u0E34\u0E14\u0E19\u0E35\u0E49",
|
|
328
|
+
tooManyFiles: function(n2) {
|
|
329
|
+
return "\u0E41\u0E19\u0E1A\u0E44\u0E14\u0E49\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19 " + n2 + " \u0E44\u0E1F\u0E25\u0E4C";
|
|
330
|
+
},
|
|
331
|
+
colorScheme: "\u0E42\u0E2B\u0E21\u0E14\u0E2A\u0E35",
|
|
332
|
+
increase: "\u0E40\u0E1E\u0E34\u0E48\u0E21",
|
|
333
|
+
decrease: "\u0E25\u0E14",
|
|
334
|
+
stepDone: "\u0E40\u0E2A\u0E23\u0E47\u0E08\u0E41\u0E25\u0E49\u0E27",
|
|
335
|
+
stepOf: function(i, total) {
|
|
336
|
+
return "\u0E02\u0E31\u0E49\u0E19\u0E17\u0E35\u0E48 " + i + " \u0E08\u0E32\u0E01 " + total;
|
|
337
|
+
},
|
|
338
|
+
schemeLight: "\u0E2A\u0E27\u0E48\u0E32\u0E07",
|
|
339
|
+
schemeDark: "\u0E21\u0E37\u0E14",
|
|
340
|
+
schemeSystem: "\u0E15\u0E32\u0E21\u0E23\u0E30\u0E1A\u0E1A",
|
|
341
|
+
uploading: "\u0E01\u0E33\u0E25\u0E31\u0E07\u0E2D\u0E31\u0E1B\u0E42\u0E2B\u0E25\u0E14\u2026",
|
|
342
|
+
images: "\u0E23\u0E39\u0E1B\u0E20\u0E32\u0E1E",
|
|
343
|
+
pagination: "\u0E40\u0E25\u0E02\u0E2B\u0E19\u0E49\u0E32",
|
|
344
|
+
pageN: function(p) {
|
|
345
|
+
return "\u0E2B\u0E19\u0E49\u0E32 " + p;
|
|
346
|
+
},
|
|
347
|
+
accepts: function(list, max) {
|
|
348
|
+
return [list, max && "\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19 " + max + " \u0E15\u0E48\u0E2D\u0E44\u0E1F\u0E25\u0E4C"].filter(Boolean).join(" \xB7 ");
|
|
349
|
+
}
|
|
350
|
+
},
|
|
351
|
+
sv: {
|
|
352
|
+
close: "St\xE4ng",
|
|
353
|
+
dismiss: "St\xE4ng",
|
|
354
|
+
dismissToast: "St\xE4ng aviseringen",
|
|
355
|
+
showPassword: "Visa l\xF6senord",
|
|
356
|
+
filters: "Filter",
|
|
357
|
+
search: "S\xF6k",
|
|
358
|
+
clearFilters: "Rensa alla",
|
|
359
|
+
results: function(n2) {
|
|
360
|
+
return n2 === 1 ? "1 tr\xE4ff" : n2.toLocaleString("sv-SE") + " tr\xE4ffar";
|
|
361
|
+
},
|
|
362
|
+
commandMenu: "Kommandomeny",
|
|
363
|
+
commandPlaceholder: "Skriv ett kommando eller s\xF6k\u2026",
|
|
364
|
+
commandHint: "\u2191\u2193 flytta \xB7 Enter \xF6ppna \xB7 Esc st\xE4ng",
|
|
365
|
+
errorSummary: function(n2) {
|
|
366
|
+
return n2 === 1 ? "R\xE4tta 1 f\xE4lt f\xF6r att forts\xE4tta" : "R\xE4tta " + n2 + " f\xE4lt f\xF6r att forts\xE4tta";
|
|
367
|
+
},
|
|
368
|
+
notifications: "Aviseringar",
|
|
369
|
+
mainNav: "Huvudmeny",
|
|
370
|
+
breadcrumb: "Br\xF6dsmulor",
|
|
371
|
+
navigation: "Navigering",
|
|
372
|
+
openNav: "\xD6ppna menyn",
|
|
373
|
+
collapseNav: "F\xE4ll ihop sidof\xE4ltet",
|
|
374
|
+
expandNav: "F\xE4ll ut sidof\xE4ltet",
|
|
375
|
+
searching: "S\xF6ker\u2026",
|
|
376
|
+
noMatches: "Inga tr\xE4ffar",
|
|
377
|
+
clear: function(what) {
|
|
378
|
+
return "Rensa " + (what || "urvalet");
|
|
379
|
+
},
|
|
380
|
+
keepTyping: function(total) {
|
|
381
|
+
return "Skriv mer f\xF6r att begr\xE4nsa " + nsv(total) + " alternativ";
|
|
382
|
+
},
|
|
383
|
+
sortAsc: "Sortera stigande",
|
|
384
|
+
sortDesc: "Sortera fallande",
|
|
385
|
+
pin: "F\xE4st till v\xE4nster",
|
|
386
|
+
unpin: "Lossa kolumnen",
|
|
387
|
+
moveLeft: "Flytta v\xE4nster",
|
|
388
|
+
moveRight: "Flytta h\xF6ger",
|
|
389
|
+
hideColumn: "D\xF6lj kolumnen",
|
|
390
|
+
resetColumns: "\xC5terst\xE4ll kolumner",
|
|
391
|
+
selectRows: "V\xE4lj rader",
|
|
392
|
+
selectAllRows: "V\xE4lj alla rader",
|
|
393
|
+
deselectAllRows: "Avmarkera alla rader",
|
|
394
|
+
selectAll: "V\xE4lj alla",
|
|
395
|
+
selectRow: function(k) {
|
|
396
|
+
return "V\xE4lj " + k;
|
|
397
|
+
},
|
|
398
|
+
selectedCount: function(c) {
|
|
399
|
+
return nsv(c) + " valda";
|
|
400
|
+
},
|
|
401
|
+
pinned: "F\xE4st",
|
|
402
|
+
columnOptions: function(label) {
|
|
403
|
+
return "Alternativ f\xF6r kolumnen " + label;
|
|
404
|
+
},
|
|
405
|
+
column: function(label) {
|
|
406
|
+
return label ? "Kolumnen " + label : "Kolumn";
|
|
407
|
+
},
|
|
408
|
+
columns: "Kolumner",
|
|
409
|
+
showHideColumns: "Visa eller d\xF6lj kolumner",
|
|
410
|
+
empty: "Inget h\xE4r \xE4nnu",
|
|
411
|
+
loading: "Laddar\u2026",
|
|
412
|
+
loadingRows: "Laddar rader",
|
|
413
|
+
range: function(a, b, total) {
|
|
414
|
+
return a + "\u2013" + b + " av " + nsv(total);
|
|
415
|
+
},
|
|
416
|
+
page: function(p, total) {
|
|
417
|
+
return "Sida " + p + " av " + total;
|
|
418
|
+
},
|
|
419
|
+
prevPage: "F\xF6reg\xE5ende sida",
|
|
420
|
+
nextPage: "N\xE4sta sida",
|
|
421
|
+
rowCount: function(c) {
|
|
422
|
+
return nsv(c) + " rader";
|
|
423
|
+
},
|
|
424
|
+
actions: "\xC5tg\xE4rder",
|
|
425
|
+
optional: "valfritt",
|
|
426
|
+
timePlaceholder: "tt:mm",
|
|
427
|
+
timeInvalid: "Skriv en tid som 09:30",
|
|
428
|
+
timeOutOfRange: function(a, b) {
|
|
429
|
+
return "V\xE4lj en tid mellan " + a + " och " + b;
|
|
430
|
+
},
|
|
431
|
+
dropFiles: "Dra filer hit eller",
|
|
432
|
+
browse: "V\xE4lj filer",
|
|
433
|
+
browseOne: "V\xE4lj en fil",
|
|
434
|
+
remove: function(n2) {
|
|
435
|
+
return "Ta bort " + n2;
|
|
436
|
+
},
|
|
437
|
+
fileTooBig: function(max) {
|
|
438
|
+
return "St\xF6rre \xE4n " + max;
|
|
439
|
+
},
|
|
440
|
+
fileWrongType: "Den h\xE4r filtypen godtas inte",
|
|
441
|
+
tooManyFiles: function(n2) {
|
|
442
|
+
return "H\xF6gst " + n2 + " filer";
|
|
443
|
+
},
|
|
444
|
+
colorScheme: "F\xE4rgl\xE4ge",
|
|
445
|
+
increase: "\xD6ka",
|
|
446
|
+
decrease: "Minska",
|
|
447
|
+
stepDone: "klart",
|
|
448
|
+
stepOf: function(i, total) {
|
|
449
|
+
return "Steg " + i + " av " + total;
|
|
450
|
+
},
|
|
451
|
+
schemeLight: "Ljust",
|
|
452
|
+
schemeDark: "M\xF6rkt",
|
|
453
|
+
schemeSystem: "System",
|
|
454
|
+
uploading: "Laddar upp\u2026",
|
|
455
|
+
images: "Bilder",
|
|
456
|
+
pagination: "Sidnumrering",
|
|
457
|
+
pageN: function(p) {
|
|
458
|
+
return "Sida " + p;
|
|
459
|
+
},
|
|
460
|
+
accepts: function(list, max) {
|
|
461
|
+
return [list, max && "h\xF6gst " + max + " per fil"].filter(Boolean).join(", ");
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
};
|
|
465
|
+
|
|
466
|
+
// src/theme.ts
|
|
467
|
+
function hexToRgb(hex) {
|
|
468
|
+
let h = String(hex).trim().replace("#", "");
|
|
469
|
+
if (h.length === 3)
|
|
470
|
+
h = h.split("").map(function(c) {
|
|
471
|
+
return c + c;
|
|
472
|
+
}).join("");
|
|
473
|
+
if (!/^[0-9a-f]{6}$/i.test(h)) throw new Error('createTheme: "' + hex + '" is not a #rgb or #rrggbb colour');
|
|
474
|
+
return [0, 2, 4].map(function(i) {
|
|
475
|
+
return parseInt(h.slice(i, i + 2), 16) / 255;
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
function rgbToHex(rgb) {
|
|
479
|
+
return "#" + rgb.map(function(v) {
|
|
480
|
+
const n2 = Math.round(Math.min(1, Math.max(0, v)) * 255);
|
|
481
|
+
return (n2 < 16 ? "0" : "") + n2.toString(16);
|
|
482
|
+
}).join("");
|
|
483
|
+
}
|
|
484
|
+
function lin(c) {
|
|
485
|
+
return c <= 0.04045 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
|
|
486
|
+
}
|
|
487
|
+
function delin(c) {
|
|
488
|
+
return c <= 31308e-7 ? 12.92 * c : 1.055 * Math.pow(c, 1 / 2.4) - 0.055;
|
|
489
|
+
}
|
|
490
|
+
function rgbToOklch(rgb) {
|
|
491
|
+
const r = lin(rgb[0]), g = lin(rgb[1]), b = lin(rgb[2]);
|
|
492
|
+
const l = Math.cbrt(0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b);
|
|
493
|
+
const m = Math.cbrt(0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b);
|
|
494
|
+
const s = Math.cbrt(0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b);
|
|
495
|
+
const L = 0.2104542553 * l + 0.793617785 * m - 0.0040720468 * s;
|
|
496
|
+
const A = 1.9779984951 * l - 2.428592205 * m + 0.4505937099 * s;
|
|
497
|
+
const B = 0.0259040371 * l + 0.7827717662 * m - 0.808675766 * s;
|
|
498
|
+
return [L, Math.sqrt(A * A + B * B), (Math.atan2(B, A) * 180 / Math.PI + 360) % 360];
|
|
499
|
+
}
|
|
500
|
+
function oklchToRgbRaw(L, C, H) {
|
|
501
|
+
const a = C * Math.cos(H * Math.PI / 180), b = C * Math.sin(H * Math.PI / 180);
|
|
502
|
+
const l = Math.pow(L + 0.3963377774 * a + 0.2158037573 * b, 3);
|
|
503
|
+
const m = Math.pow(L - 0.1055613458 * a - 0.0638541728 * b, 3);
|
|
504
|
+
const s = Math.pow(L - 0.0894841775 * a - 1.291485548 * b, 3);
|
|
505
|
+
return [
|
|
506
|
+
4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s,
|
|
507
|
+
-1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s,
|
|
508
|
+
-0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s
|
|
509
|
+
].map(delin);
|
|
510
|
+
}
|
|
511
|
+
function inGamut(rgb) {
|
|
512
|
+
return rgb.every(function(v) {
|
|
513
|
+
return v >= -5e-4 && v <= 1.0005;
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
function oklchToHex(L, C, H) {
|
|
517
|
+
let lo = 0, hi = C, rgb = oklchToRgbRaw(L, C, H);
|
|
518
|
+
if (inGamut(rgb)) return rgbToHex(rgb);
|
|
519
|
+
for (let i = 0; i < 24; i++) {
|
|
520
|
+
const mid = (lo + hi) / 2;
|
|
521
|
+
if (inGamut(oklchToRgbRaw(L, mid, H))) lo = mid;
|
|
522
|
+
else hi = mid;
|
|
523
|
+
}
|
|
524
|
+
return rgbToHex(oklchToRgbRaw(L, lo, H));
|
|
525
|
+
}
|
|
526
|
+
function luminance(hex) {
|
|
527
|
+
const c = hexToRgb(hex).map(lin);
|
|
528
|
+
return 0.2126 * c[0] + 0.7152 * c[1] + 0.0722 * c[2];
|
|
529
|
+
}
|
|
530
|
+
function contrast(a, b) {
|
|
531
|
+
const x = luminance(a), y = luminance(b);
|
|
532
|
+
return (Math.max(x, y) + 0.05) / (Math.min(x, y) + 0.05);
|
|
533
|
+
}
|
|
534
|
+
function mix(a, b, t) {
|
|
535
|
+
const x = hexToRgb(a), y = hexToRgb(b);
|
|
536
|
+
return rgbToHex(
|
|
537
|
+
x.map(function(v, i) {
|
|
538
|
+
return v + (y[i] - v) * t;
|
|
539
|
+
})
|
|
540
|
+
);
|
|
541
|
+
}
|
|
542
|
+
var STEPS = {
|
|
543
|
+
50: [0.975, 0.18],
|
|
544
|
+
100: [0.945, 0.3],
|
|
545
|
+
200: [0.895, 0.5],
|
|
546
|
+
300: [0.81, 0.72],
|
|
547
|
+
400: [0.715, 0.9],
|
|
548
|
+
500: [0.635, 1],
|
|
549
|
+
600: [0.555, 1],
|
|
550
|
+
700: [0.49, 0.95],
|
|
551
|
+
800: [0.43, 0.85],
|
|
552
|
+
900: [0.38, 0.72]
|
|
553
|
+
};
|
|
554
|
+
function scale(hex) {
|
|
555
|
+
const o = rgbToOklch(hexToRgb(hex)), C = Math.max(o[1], 0.02), out = {};
|
|
556
|
+
Object.keys(STEPS).forEach(function(k) {
|
|
557
|
+
out[k] = oklchToHex(STEPS[k][0], C * STEPS[k][1] / 0.95 * (o[1] < 0.03 ? 0.4 : 1), o[2]);
|
|
558
|
+
});
|
|
559
|
+
return out;
|
|
560
|
+
}
|
|
561
|
+
function fit(hex, grounds, target, dir) {
|
|
562
|
+
let o = rgbToOklch(hexToRgb(hex)), L = o[0], c = hex;
|
|
563
|
+
for (let i = 0; i < 80; i++) {
|
|
564
|
+
if (grounds.every(function(g) {
|
|
565
|
+
return contrast(c, g) >= target;
|
|
566
|
+
}))
|
|
567
|
+
return c;
|
|
568
|
+
L = Math.min(1, Math.max(0, L + dir * 0.01));
|
|
569
|
+
c = oklchToHex(L, o[1], o[2]);
|
|
570
|
+
}
|
|
571
|
+
return c;
|
|
572
|
+
}
|
|
573
|
+
function atLuminance(hex, Y) {
|
|
574
|
+
const o = rgbToOklch(hexToRgb(hex)), C = Math.max(o[1], 0.02);
|
|
575
|
+
let lo = 0, hi = 1, c = hex;
|
|
576
|
+
for (let i = 0; i < 30; i++) {
|
|
577
|
+
const mid = (lo + hi) / 2;
|
|
578
|
+
c = oklchToHex(mid, C, o[2]);
|
|
579
|
+
if (luminance(c) < Y) lo = mid;
|
|
580
|
+
else hi = mid;
|
|
581
|
+
}
|
|
582
|
+
return c;
|
|
583
|
+
}
|
|
584
|
+
var CHART_Y = { light: 0.075, dark: 0.46 };
|
|
585
|
+
var SEQ_Y = { light: [0.26, 0.165, 0.1, 0.055, 0.028], dark: [0.14, 0.22, 0.34, 0.5, 0.7] };
|
|
586
|
+
var CHART_2 = "#0a8b7a";
|
|
587
|
+
var ZINC = { 0: "#ffffff", 50: "#fafafa", 100: "#f4f4f5", 800: "#27272a", 900: "#18181b", 950: "#09090b" };
|
|
588
|
+
var INK = "#18181b";
|
|
589
|
+
function createTheme(opts) {
|
|
590
|
+
const o = opts || {};
|
|
591
|
+
if (!o.brand) throw new Error('createTheme: pass { brand: "#rrggbb" }');
|
|
592
|
+
const b = scale(o.brand), s = o.signal ? scale(o.signal) : null;
|
|
593
|
+
const lightGrounds = [ZINC[0], ZINC[50]], darkGrounds = [ZINC[900], ZINC[950]];
|
|
594
|
+
const L = {}, D = {};
|
|
595
|
+
L["fg-accent"] = fit(b[700], lightGrounds, 4.5, -1);
|
|
596
|
+
L["accent-violet"] = L["fg-accent"];
|
|
597
|
+
L["focus-ring"] = fit(b[700], lightGrounds.concat([b[50]]), 3, -1);
|
|
598
|
+
L["bg-selected"] = b[50];
|
|
599
|
+
L["status-progress-bg"] = b[100];
|
|
600
|
+
L["status-progress-fg"] = fit(b[800], [b[100]], 4.5, -1);
|
|
601
|
+
L["alert-info-bg"] = b[50];
|
|
602
|
+
L["alert-info-fg"] = fit(b[800], [b[50]], 4.5, -1);
|
|
603
|
+
L["alert-info-border"] = b[200];
|
|
604
|
+
L["mesh-from"] = b[400];
|
|
605
|
+
L["chart-1"] = atLuminance(o.brand, CHART_Y.light);
|
|
606
|
+
D["chart-1"] = atLuminance(o.brand, CHART_Y.dark);
|
|
607
|
+
SEQ_Y.light.forEach(function(y, i) {
|
|
608
|
+
L["chart-seq-" + (i + 1)] = atLuminance(o.brand, y);
|
|
609
|
+
});
|
|
610
|
+
SEQ_Y.dark.forEach(function(y, i) {
|
|
611
|
+
D["chart-seq-" + (i + 1)] = atLuminance(o.brand, y);
|
|
612
|
+
});
|
|
613
|
+
D["fg-accent"] = fit(b[300], darkGrounds, 4.5, 1);
|
|
614
|
+
D["accent-violet"] = fit(b[400], darkGrounds, 3, 1);
|
|
615
|
+
D["focus-ring"] = fit(b[400], darkGrounds, 3, 1);
|
|
616
|
+
D["bg-selected"] = mix(ZINC[900], b[500], 0.16);
|
|
617
|
+
D["alert-info-bg"] = D["bg-selected"];
|
|
618
|
+
D["alert-info-fg"] = fit(b[300], [D["alert-info-bg"]], 4.5, 1);
|
|
619
|
+
D["alert-info-border"] = mix(ZINC[900], b[400], 0.4);
|
|
620
|
+
D["status-progress-bg"] = mix(ZINC[900], b[500], 0.2);
|
|
621
|
+
D["status-progress-fg"] = fit(b[300], [D["status-progress-bg"]], 4.5, 1);
|
|
622
|
+
if (s) {
|
|
623
|
+
L["accent-dot"] = s[200];
|
|
624
|
+
L["accent-lime"] = s[200];
|
|
625
|
+
L["mesh-to"] = s[200];
|
|
626
|
+
D["accent-dot"] = s[200];
|
|
627
|
+
D["accent-lime"] = s[200];
|
|
628
|
+
D["mesh-to"] = s[200];
|
|
629
|
+
}
|
|
630
|
+
const shadowLight = INK, shadowDark = D["accent-violet"];
|
|
631
|
+
if (o.primary === "brand") {
|
|
632
|
+
L["button-primary-bg"] = fit(b[600], [ZINC[0]], 4.5, -1);
|
|
633
|
+
L["button-primary-fg"] = ZINC[0];
|
|
634
|
+
L["button-primary-bg-hover"] = fit(b[700], [ZINC[0]], 4.5, -1);
|
|
635
|
+
D["button-primary-bg"] = fit(b[400], [ZINC[900]], 4.5, 1);
|
|
636
|
+
D["button-primary-fg"] = ZINC[900];
|
|
637
|
+
D["button-primary-bg-hover"] = fit(b[300], [ZINC[900]], 4.5, 1);
|
|
638
|
+
}
|
|
639
|
+
L["shadow-creative"] = "4px 4px 0px " + shadowLight;
|
|
640
|
+
L["shadow-creative-hover"] = "6px 6px 0px " + shadowLight;
|
|
641
|
+
L["card-shadow-creative"] = "8px 8px 0px " + shadowLight;
|
|
642
|
+
D["shadow-creative"] = "4px 4px 0px " + shadowDark;
|
|
643
|
+
D["shadow-creative-hover"] = "6px 6px 0px " + shadowDark;
|
|
644
|
+
D["card-shadow-creative"] = "8px 8px 0px " + shadowDark;
|
|
645
|
+
const checks = [];
|
|
646
|
+
function check(theme, fg, bg, target, fgHex, bgHex) {
|
|
647
|
+
const r = contrast(fgHex, bgHex);
|
|
648
|
+
checks.push({
|
|
649
|
+
theme,
|
|
650
|
+
pair: fg + " on " + bg,
|
|
651
|
+
ratio: Math.round(r * 100) / 100,
|
|
652
|
+
target,
|
|
653
|
+
pass: r >= target - 5e-3
|
|
654
|
+
});
|
|
655
|
+
}
|
|
656
|
+
[
|
|
657
|
+
["bg-surface", ZINC[0]],
|
|
658
|
+
["bg-canvas", ZINC[50]],
|
|
659
|
+
["bg-selected", L["bg-selected"]]
|
|
660
|
+
].forEach(function(g) {
|
|
661
|
+
check("light", "fg-accent", g[0], 4.5, L["fg-accent"], g[1]);
|
|
662
|
+
check("light", "focus-ring", g[0], 3, L["focus-ring"], g[1]);
|
|
663
|
+
});
|
|
664
|
+
[
|
|
665
|
+
["bg-surface", ZINC[900]],
|
|
666
|
+
["bg-canvas", ZINC[950]],
|
|
667
|
+
["bg-selected", D["bg-selected"]]
|
|
668
|
+
].forEach(function(g) {
|
|
669
|
+
check("dark", "fg-accent", g[0], 4.5, D["fg-accent"], g[1]);
|
|
670
|
+
check("dark", "focus-ring", g[0], 3, D["focus-ring"], g[1]);
|
|
671
|
+
});
|
|
672
|
+
[
|
|
673
|
+
["light", ZINC[0], L],
|
|
674
|
+
["light", ZINC[50], L],
|
|
675
|
+
["dark", ZINC[900], D],
|
|
676
|
+
["dark", ZINC[950], D]
|
|
677
|
+
].forEach(function(g) {
|
|
678
|
+
const t = g[0], ground = g[1], m = g[2], name = ground === ZINC[0] || ground === ZINC[900] ? "bg-surface" : "bg-canvas";
|
|
679
|
+
["chart-1", "chart-seq-1", "chart-seq-5"].forEach(function(k) {
|
|
680
|
+
check(t, k, name, 3, m[k], ground);
|
|
681
|
+
});
|
|
682
|
+
});
|
|
683
|
+
check("light", "chart-1", "chart-2 (lightness step)", 1.8, L["chart-1"], CHART_2);
|
|
684
|
+
check("dark", "chart-1", "chart-2 (lightness step)", 1.8, D["chart-1"], CHART_2);
|
|
685
|
+
check("light", "fg-primary", "bg-selected", 4.5, INK, L["bg-selected"]);
|
|
686
|
+
check("dark", "fg-primary", "bg-selected", 4.5, "#ffffff", D["bg-selected"]);
|
|
687
|
+
check("light", "status-progress-fg", "status-progress-bg", 4.5, L["status-progress-fg"], L["status-progress-bg"]);
|
|
688
|
+
check("dark", "status-progress-fg", "status-progress-bg", 4.5, D["status-progress-fg"], D["status-progress-bg"]);
|
|
689
|
+
check("light", "alert-info-fg", "alert-info-bg", 4.5, L["alert-info-fg"], L["alert-info-bg"]);
|
|
690
|
+
check("dark", "alert-info-fg", "alert-info-bg", 4.5, D["alert-info-fg"], D["alert-info-bg"]);
|
|
691
|
+
if (o.primary === "brand") {
|
|
692
|
+
check("light", "button-primary-fg", "button-primary-bg", 4.5, L["button-primary-fg"], L["button-primary-bg"]);
|
|
693
|
+
check(
|
|
694
|
+
"light",
|
|
695
|
+
"button-primary-fg",
|
|
696
|
+
"button-primary-bg-hover",
|
|
697
|
+
4.5,
|
|
698
|
+
L["button-primary-fg"],
|
|
699
|
+
L["button-primary-bg-hover"]
|
|
700
|
+
);
|
|
701
|
+
check("dark", "button-primary-fg", "button-primary-bg", 4.5, D["button-primary-fg"], D["button-primary-bg"]);
|
|
702
|
+
check(
|
|
703
|
+
"dark",
|
|
704
|
+
"button-primary-fg",
|
|
705
|
+
"button-primary-bg-hover",
|
|
706
|
+
4.5,
|
|
707
|
+
D["button-primary-fg"],
|
|
708
|
+
D["button-primary-bg-hover"]
|
|
709
|
+
);
|
|
710
|
+
}
|
|
711
|
+
if (s) check("light", "ink", "accent-lime (signal)", 4.5, INK, s[200]);
|
|
712
|
+
function css(selector) {
|
|
713
|
+
const light = selector ? selector : ':root, [data-theme="light"]';
|
|
714
|
+
const dark = selector ? selector + ".dark, .dark " + selector + ", " + selector + '[data-theme="dark"], [data-theme="dark"] ' + selector : '.dark, [data-theme="dark"]';
|
|
715
|
+
const system = selector ? '[data-theme="system"] ' + selector + ", " + selector + '[data-theme="system"]' : '[data-theme="system"]';
|
|
716
|
+
function block(sel, m) {
|
|
717
|
+
return sel + " {\n" + Object.keys(m).map(function(k) {
|
|
718
|
+
return " --aura-" + k + ": " + m[k] + ";";
|
|
719
|
+
}).join("\n") + "\n}";
|
|
720
|
+
}
|
|
721
|
+
return "/* AURA theme" + (o.name ? ' "' + o.name + '"' : "") + ": brand " + o.brand + (o.signal ? ", signal " + o.signal : "") + (o.primary === "brand" ? ", brand primary buttons" : "") + ". Load after aura.css. Generated by createTheme. */\n" + block(light, L) + "\n" + block(dark, D) + "\n@media (prefers-color-scheme: dark) {\n" + block(system, D) + "\n}\n";
|
|
722
|
+
}
|
|
723
|
+
return {
|
|
724
|
+
name: o.name || null,
|
|
725
|
+
brand: b,
|
|
726
|
+
signal: s,
|
|
727
|
+
light: L,
|
|
728
|
+
dark: D,
|
|
729
|
+
checks,
|
|
730
|
+
ok: checks.every(function(c) {
|
|
731
|
+
return c.pass;
|
|
732
|
+
}),
|
|
733
|
+
css
|
|
734
|
+
};
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
// src/colorSchemeScript.ts
|
|
738
|
+
var DEFAULT_KEY = "aura-color-scheme";
|
|
739
|
+
function colorSchemeScript(options) {
|
|
740
|
+
const key = JSON.stringify(options && options.storageKey || DEFAULT_KEY);
|
|
741
|
+
const fallback = JSON.stringify(options && options.defaultScheme || "system");
|
|
742
|
+
return "(function(){try{var s=localStorage.getItem(" + key + ");if(s!=='light'&&s!=='dark'&&s!=='system')s=" + fallback + `;var d=document.documentElement;d.setAttribute("data-theme",s);var dark=s==='dark'||(s==='system'&&window.matchMedia('(prefers-color-scheme: dark)').matches);d.classList.toggle("dark",dark);}catch(e){}})();`;
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
// src/breakpoints.ts
|
|
746
|
+
var breakpoints = { sm: 640, md: 768, lg: 1024, xl: 1280 };
|
|
747
|
+
|
|
748
|
+
// src/server.ts
|
|
749
|
+
function formatDate2(iso, opts) {
|
|
750
|
+
const o = Object.assign({}, opts);
|
|
751
|
+
if (!o.locale) o.locale = "en";
|
|
752
|
+
return formatDate(iso, o);
|
|
753
|
+
}
|
|
754
|
+
export {
|
|
755
|
+
STRINGS,
|
|
756
|
+
scale as brandScale,
|
|
757
|
+
breakpoints,
|
|
758
|
+
colorSchemeScript,
|
|
759
|
+
contrast,
|
|
760
|
+
createTheme,
|
|
761
|
+
formatBytes,
|
|
762
|
+
formatDate2 as formatDate,
|
|
763
|
+
fromISO,
|
|
764
|
+
parseDate,
|
|
765
|
+
parseTime,
|
|
766
|
+
toneFor as statusTone,
|
|
767
|
+
toISO
|
|
768
|
+
};
|