@public-ui/themes 1.5.0-rc.21 → 1.5.0-rc.23

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.mjs CHANGED
@@ -1,4 +1,390 @@
1
- import { KoliBri } from '@public-ui/components';
1
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
2
+
3
+ var loglevel = {exports: {}};
4
+
5
+ /*
6
+ * loglevel - https://github.com/pimterry/loglevel
7
+ *
8
+ * Copyright (c) 2013 Tim Perry
9
+ * Licensed under the MIT license.
10
+ */
11
+
12
+ (function (module) {
13
+ (function (root, definition) {
14
+ if (module.exports) {
15
+ module.exports = definition();
16
+ } else {
17
+ root.log = definition();
18
+ }
19
+ }(commonjsGlobal, function () {
20
+
21
+ // Slightly dubious tricks to cut down minimized file size
22
+ var noop = function() {};
23
+ var undefinedType = "undefined";
24
+ var isIE = (typeof window !== undefinedType) && (typeof window.navigator !== undefinedType) && (
25
+ /Trident\/|MSIE /.test(window.navigator.userAgent)
26
+ );
27
+
28
+ var logMethods = [
29
+ "trace",
30
+ "debug",
31
+ "info",
32
+ "warn",
33
+ "error"
34
+ ];
35
+
36
+ // Cross-browser bind equivalent that works at least back to IE6
37
+ function bindMethod(obj, methodName) {
38
+ var method = obj[methodName];
39
+ if (typeof method.bind === 'function') {
40
+ return method.bind(obj);
41
+ } else {
42
+ try {
43
+ return Function.prototype.bind.call(method, obj);
44
+ } catch (e) {
45
+ // Missing bind shim or IE8 + Modernizr, fallback to wrapping
46
+ return function() {
47
+ return Function.prototype.apply.apply(method, [obj, arguments]);
48
+ };
49
+ }
50
+ }
51
+ }
52
+
53
+ // Trace() doesn't print the message in IE, so for that case we need to wrap it
54
+ function traceForIE() {
55
+ if (console.log) {
56
+ if (console.log.apply) {
57
+ console.log.apply(console, arguments);
58
+ } else {
59
+ // In old IE, native console methods themselves don't have apply().
60
+ Function.prototype.apply.apply(console.log, [console, arguments]);
61
+ }
62
+ }
63
+ if (console.trace) console.trace();
64
+ }
65
+
66
+ // Build the best logging method possible for this env
67
+ // Wherever possible we want to bind, not wrap, to preserve stack traces
68
+ function realMethod(methodName) {
69
+ if (methodName === 'debug') {
70
+ methodName = 'log';
71
+ }
72
+
73
+ if (typeof console === undefinedType) {
74
+ return false; // No method possible, for now - fixed later by enableLoggingWhenConsoleArrives
75
+ } else if (methodName === 'trace' && isIE) {
76
+ return traceForIE;
77
+ } else if (console[methodName] !== undefined) {
78
+ return bindMethod(console, methodName);
79
+ } else if (console.log !== undefined) {
80
+ return bindMethod(console, 'log');
81
+ } else {
82
+ return noop;
83
+ }
84
+ }
85
+
86
+ // These private functions always need `this` to be set properly
87
+
88
+ function replaceLoggingMethods(level, loggerName) {
89
+ /*jshint validthis:true */
90
+ for (var i = 0; i < logMethods.length; i++) {
91
+ var methodName = logMethods[i];
92
+ this[methodName] = (i < level) ?
93
+ noop :
94
+ this.methodFactory(methodName, level, loggerName);
95
+ }
96
+
97
+ // Define log.log as an alias for log.debug
98
+ this.log = this.debug;
99
+ }
100
+
101
+ // In old IE versions, the console isn't present until you first open it.
102
+ // We build realMethod() replacements here that regenerate logging methods
103
+ function enableLoggingWhenConsoleArrives(methodName, level, loggerName) {
104
+ return function () {
105
+ if (typeof console !== undefinedType) {
106
+ replaceLoggingMethods.call(this, level, loggerName);
107
+ this[methodName].apply(this, arguments);
108
+ }
109
+ };
110
+ }
111
+
112
+ // By default, we use closely bound real methods wherever possible, and
113
+ // otherwise we wait for a console to appear, and then try again.
114
+ function defaultMethodFactory(methodName, level, loggerName) {
115
+ /*jshint validthis:true */
116
+ return realMethod(methodName) ||
117
+ enableLoggingWhenConsoleArrives.apply(this, arguments);
118
+ }
119
+
120
+ function Logger(name, defaultLevel, factory) {
121
+ var self = this;
122
+ var currentLevel;
123
+ defaultLevel = defaultLevel == null ? "WARN" : defaultLevel;
124
+
125
+ var storageKey = "loglevel";
126
+ if (typeof name === "string") {
127
+ storageKey += ":" + name;
128
+ } else if (typeof name === "symbol") {
129
+ storageKey = undefined;
130
+ }
131
+
132
+ function persistLevelIfPossible(levelNum) {
133
+ var levelName = (logMethods[levelNum] || 'silent').toUpperCase();
134
+
135
+ if (typeof window === undefinedType || !storageKey) return;
136
+
137
+ // Use localStorage if available
138
+ try {
139
+ window.localStorage[storageKey] = levelName;
140
+ return;
141
+ } catch (ignore) {}
142
+
143
+ // Use session cookie as fallback
144
+ try {
145
+ window.document.cookie =
146
+ encodeURIComponent(storageKey) + "=" + levelName + ";";
147
+ } catch (ignore) {}
148
+ }
149
+
150
+ function getPersistedLevel() {
151
+ var storedLevel;
152
+
153
+ if (typeof window === undefinedType || !storageKey) return;
154
+
155
+ try {
156
+ storedLevel = window.localStorage[storageKey];
157
+ } catch (ignore) {}
158
+
159
+ // Fallback to cookies if local storage gives us nothing
160
+ if (typeof storedLevel === undefinedType) {
161
+ try {
162
+ var cookie = window.document.cookie;
163
+ var location = cookie.indexOf(
164
+ encodeURIComponent(storageKey) + "=");
165
+ if (location !== -1) {
166
+ storedLevel = /^([^;]+)/.exec(cookie.slice(location))[1];
167
+ }
168
+ } catch (ignore) {}
169
+ }
170
+
171
+ // If the stored level is not valid, treat it as if nothing was stored.
172
+ if (self.levels[storedLevel] === undefined) {
173
+ storedLevel = undefined;
174
+ }
175
+
176
+ return storedLevel;
177
+ }
178
+
179
+ function clearPersistedLevel() {
180
+ if (typeof window === undefinedType || !storageKey) return;
181
+
182
+ // Use localStorage if available
183
+ try {
184
+ window.localStorage.removeItem(storageKey);
185
+ return;
186
+ } catch (ignore) {}
187
+
188
+ // Use session cookie as fallback
189
+ try {
190
+ window.document.cookie =
191
+ encodeURIComponent(storageKey) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
192
+ } catch (ignore) {}
193
+ }
194
+
195
+ /*
196
+ *
197
+ * Public logger API - see https://github.com/pimterry/loglevel for details
198
+ *
199
+ */
200
+
201
+ self.name = name;
202
+
203
+ self.levels = { "TRACE": 0, "DEBUG": 1, "INFO": 2, "WARN": 3,
204
+ "ERROR": 4, "SILENT": 5};
205
+
206
+ self.methodFactory = factory || defaultMethodFactory;
207
+
208
+ self.getLevel = function () {
209
+ return currentLevel;
210
+ };
211
+
212
+ self.setLevel = function (level, persist) {
213
+ if (typeof level === "string" && self.levels[level.toUpperCase()] !== undefined) {
214
+ level = self.levels[level.toUpperCase()];
215
+ }
216
+ if (typeof level === "number" && level >= 0 && level <= self.levels.SILENT) {
217
+ currentLevel = level;
218
+ if (persist !== false) { // defaults to true
219
+ persistLevelIfPossible(level);
220
+ }
221
+ replaceLoggingMethods.call(self, level, name);
222
+ if (typeof console === undefinedType && level < self.levels.SILENT) {
223
+ return "No console available for logging";
224
+ }
225
+ } else {
226
+ throw "log.setLevel() called with invalid level: " + level;
227
+ }
228
+ };
229
+
230
+ self.setDefaultLevel = function (level) {
231
+ defaultLevel = level;
232
+ if (!getPersistedLevel()) {
233
+ self.setLevel(level, false);
234
+ }
235
+ };
236
+
237
+ self.resetLevel = function () {
238
+ self.setLevel(defaultLevel, false);
239
+ clearPersistedLevel();
240
+ };
241
+
242
+ self.enableAll = function(persist) {
243
+ self.setLevel(self.levels.TRACE, persist);
244
+ };
245
+
246
+ self.disableAll = function(persist) {
247
+ self.setLevel(self.levels.SILENT, persist);
248
+ };
249
+
250
+ // Initialize with the right level
251
+ var initialLevel = getPersistedLevel();
252
+ if (initialLevel == null) {
253
+ initialLevel = defaultLevel;
254
+ }
255
+ self.setLevel(initialLevel, false);
256
+ }
257
+
258
+ /*
259
+ *
260
+ * Top-level API
261
+ *
262
+ */
263
+
264
+ var defaultLogger = new Logger();
265
+
266
+ var _loggersByName = {};
267
+ defaultLogger.getLogger = function getLogger(name) {
268
+ if ((typeof name !== "symbol" && typeof name !== "string") || name === "") {
269
+ throw new TypeError("You must supply a name when creating a logger.");
270
+ }
271
+
272
+ var logger = _loggersByName[name];
273
+ if (!logger) {
274
+ logger = _loggersByName[name] = new Logger(
275
+ name, defaultLogger.getLevel(), defaultLogger.methodFactory);
276
+ }
277
+ return logger;
278
+ };
279
+
280
+ // Grab the current global log variable in case of overwrite
281
+ var _log = (typeof window !== undefinedType) ? window.log : undefined;
282
+ defaultLogger.noConflict = function() {
283
+ if (typeof window !== undefinedType &&
284
+ window.log === defaultLogger) {
285
+ window.log = _log;
286
+ }
287
+
288
+ return defaultLogger;
289
+ };
290
+
291
+ defaultLogger.getLoggers = function getLoggers() {
292
+ return _loggersByName;
293
+ };
294
+
295
+ // ES6 default export, for compatibility
296
+ defaultLogger['default'] = defaultLogger;
297
+
298
+ return defaultLogger;
299
+ }));
300
+ } (loglevel));
301
+
302
+ const createTranslation=(e,t)=>o=>o(e,t),createTheme=(e,t)=>o=>o(e,t),STORE="object"==typeof window?window:"object"==typeof global?global:"object"==typeof self?self:{};new Map;const STYLING_TASK_QUEUE=new Map,HYDRATED_HISTORY=[],CSS_PROPERTIES_REGISTERED=new Set,CSS_STYLE_CACHE=new Map,REGEX_CSS_PROPERTIES=/--[^;]+/g,REGEX_SPLIT_CSS_PROPERTY=/:/;"object"==typeof STORE.A11yUi&&null!==STORE.A11yUi||(STORE.A11yUi={CSS_STYLE_CACHE:CSS_STYLE_CACHE,HYDRATED_HISTORY:HYDRATED_HISTORY,STYLING_TASK_QUEUE:STYLING_TASK_QUEUE});const extractProperties=(e,t)=>{let o=t.match(REGEX_CSS_PROPERTIES);if(Array.isArray(o)){o=o.filter((e=>REGEX_SPLIT_CSS_PROPERTY.test(e)));const t=document.createElement("style");t.innerHTML=`.${e} {${o.join(";")}}`,document.querySelector("head")?.appendChild(t);}CSS_PROPERTIES_REGISTERED.add(e);},getCssStyle=(e,t)=>"object"==typeof STORE.A11yUi&&null!==STORE.A11yUi&&"object"==typeof STORE.A11yUi.Themes&&null!==STORE.A11yUi.Themes&&"object"==typeof STORE.A11yUi.Themes[e]&&null!==STORE.A11yUi.Themes[e]&&"string"==typeof STORE.A11yUi.Themes[e][t]?STORE.A11yUi.Themes[e][t].replace(/\r?\n/g,""):"",removeStyle=e=>{for(const t of Array.from(e.childNodes)){if(!(t instanceof HTMLStyleElement&&"STYLE"===t.tagName))break;e.removeChild(t);}},patchStyle=(e,t)=>{try{const o=[];t.forEach((e=>{const t=new CSSStyleSheet;t.replaceSync(e),o.push(t);})),e.adoptedStyleSheets=o;}catch(o){t.reverse().forEach((t=>{const o=document.createElement("style");o.innerHTML=t,e.insertBefore(o,e.firstChild);}));}},encroachStyles=(e,t,o)=>{if(!1!==o){const s=[...Array.from(e.childNodes).filter((e=>e instanceof HTMLStyleElement&&"STYLE"===e.tagName))];let r;try{r=[...Array.from(e.adoptedStyleSheets)];}catch(e){r=[];}"before"===o?.mode?(s.reverse().forEach((e=>t.unshift(e.innerHTML))),r.reverse().forEach((e=>t.unshift(Array.from(e.cssRules).map((e=>e.cssText)).join(""))))):"after"===o?.mode&&(s.forEach((e=>t.push(e.innerHTML))),r.forEach((e=>t.push(Array.from(e.cssRules).map((e=>e.cssText)).join("")))));}},setThemeStyleAfterHydrated=(e,t,o)=>{const s=t.name||"default";let r;try{if(null===e.shadowRoot)throw new Error("ShadowRoot is null");r=e.shadowRoot;}catch(t){r=e;}if(CSS_STYLE_CACHE.get(s)?.has(e.tagName))switchStyle(e,r,CSS_STYLE_CACHE.get(s)?.get(e.tagName),o);else {const n=getCssStyle(s,"PROPERTIES"),a=getCssStyle(s,"GLOBAL"),l=getCssStyle(s,e.tagName);!1===CSS_PROPERTIES_REGISTERED.has(s)&&extractProperties(s,a);const i=[n,a,l];encroachStyles(r,i,t.encroachCss),"debug"===t.loglevel&&console.log(e.tagName,i),!0===t.cache&&(!1===CSS_STYLE_CACHE.has(s)&&CSS_STYLE_CACHE.set(s,new Map),CSS_STYLE_CACHE.get(s)?.set(e.tagName,i)),switchStyle(e,r,i,o);}},switchStyle=(e,t,o,s)=>{removeStyle(t),patchStyle(t,o),e.style.display=s;},logHydratedHistory=e=>{"debug"===e.loglevel&&HYDRATED_HISTORY.push({timestamp:Date.now(),numberOfTasks:STYLING_TASK_QUEUE.size});},deleteDoneTask=e=>{STYLING_TASK_QUEUE.delete(e);},loggedDeleteDoneTask=(e,t)=>{deleteDoneTask(e),logHydratedHistory(t);},observerCallback=e=>{for(const t of e)if(STYLING_TASK_QUEUE.has(t.target)&&t.target.classList.contains("hydrated")){const{styleDisplay:e,themeDetails:o}=STYLING_TASK_QUEUE.get(t.target);setThemeStyleAfterHydrated(t.target,o,e),loggedDeleteDoneTask(t.target,o);}};let observer;try{observer=new MutationObserver(observerCallback);}catch(e){observer=null;}class Theme{constructor(e,t,o){this.createTheme=(e,t)=>createTheme(e,t),this.createTranslation=(e,t)=>createTranslation(e,t),this.Prefix=e,this.Key=Object.getOwnPropertyNames(t),this.Tag=Object.getOwnPropertyNames(o);}}
303
+
304
+ var KeyEnum = /* @__PURE__ */ ((KeyEnum2) => {
305
+ KeyEnum2[KeyEnum2["error"] = 0] = "error";
306
+ KeyEnum2[KeyEnum2["warning"] = 1] = "warning";
307
+ KeyEnum2[KeyEnum2["info"] = 2] = "info";
308
+ KeyEnum2[KeyEnum2["success"] = 3] = "success";
309
+ KeyEnum2[KeyEnum2["message"] = 4] = "message";
310
+ KeyEnum2[KeyEnum2["close"] = 5] = "close";
311
+ KeyEnum2[KeyEnum2["form-description"] = 6] = "form-description";
312
+ KeyEnum2[KeyEnum2["of"] = 7] = "of";
313
+ KeyEnum2[KeyEnum2["characters"] = 8] = "characters";
314
+ KeyEnum2[KeyEnum2["new"] = 9] = "new";
315
+ KeyEnum2[KeyEnum2["no-entries"] = 10] = "no-entries";
316
+ KeyEnum2[KeyEnum2["change-order"] = 11] = "change-order";
317
+ KeyEnum2[KeyEnum2["action-running"] = 12] = "action-running";
318
+ KeyEnum2[KeyEnum2["action-done"] = 13] = "action-done";
319
+ KeyEnum2[KeyEnum2["page-first"] = 14] = "page-first";
320
+ KeyEnum2[KeyEnum2["page-back"] = 15] = "page-back";
321
+ KeyEnum2[KeyEnum2["page-next"] = 16] = "page-next";
322
+ KeyEnum2[KeyEnum2["page-last"] = 17] = "page-last";
323
+ KeyEnum2[KeyEnum2["entries-per-site"] = 18] = "entries-per-site";
324
+ KeyEnum2[KeyEnum2["page-current"] = 19] = "page-current";
325
+ KeyEnum2[KeyEnum2["page-selected"] = 20] = "page-selected";
326
+ KeyEnum2[KeyEnum2["page-per-site"] = 21] = "page-per-site";
327
+ KeyEnum2[KeyEnum2["nav-maximize"] = 22] = "nav-maximize";
328
+ KeyEnum2[KeyEnum2["nav-minimize"] = 23] = "nav-minimize";
329
+ KeyEnum2[KeyEnum2["logo-description"] = 24] = "logo-description";
330
+ KeyEnum2[KeyEnum2["open-link-in-tab"] = 25] = "open-link-in-tab";
331
+ KeyEnum2[KeyEnum2["kolibri-logo"] = 26] = "kolibri-logo";
332
+ return KeyEnum2;
333
+ })(KeyEnum || {});
334
+
335
+ var TagEnum = /* @__PURE__ */ ((TagEnum2) => {
336
+ TagEnum2[TagEnum2["abbr"] = 0] = "abbr";
337
+ TagEnum2[TagEnum2["accordion"] = 1] = "accordion";
338
+ TagEnum2[TagEnum2["accordion-group"] = 2] = "accordion-group";
339
+ TagEnum2[TagEnum2["alert"] = 3] = "alert";
340
+ TagEnum2[TagEnum2["avatar"] = 4] = "avatar";
341
+ TagEnum2[TagEnum2["badge"] = 5] = "badge";
342
+ TagEnum2[TagEnum2["breadcrumb"] = 6] = "breadcrumb";
343
+ TagEnum2[TagEnum2["button"] = 7] = "button";
344
+ TagEnum2[TagEnum2["button-group"] = 8] = "button-group";
345
+ TagEnum2[TagEnum2["button-link"] = 9] = "button-link";
346
+ TagEnum2[TagEnum2["card"] = 10] = "card";
347
+ TagEnum2[TagEnum2["details"] = 11] = "details";
348
+ TagEnum2[TagEnum2["dialog"] = 12] = "dialog";
349
+ TagEnum2[TagEnum2["dropdown"] = 13] = "dropdown";
350
+ TagEnum2[TagEnum2["form"] = 14] = "form";
351
+ TagEnum2[TagEnum2["heading"] = 15] = "heading";
352
+ TagEnum2[TagEnum2["icon"] = 16] = "icon";
353
+ TagEnum2[TagEnum2["image"] = 17] = "image";
354
+ TagEnum2[TagEnum2["indented-text"] = 18] = "indented-text";
355
+ TagEnum2[TagEnum2["input-checkbox"] = 19] = "input-checkbox";
356
+ TagEnum2[TagEnum2["input-color"] = 20] = "input-color";
357
+ TagEnum2[TagEnum2["input-date"] = 21] = "input-date";
358
+ TagEnum2[TagEnum2["input-file"] = 22] = "input-file";
359
+ TagEnum2[TagEnum2["input-email"] = 23] = "input-email";
360
+ TagEnum2[TagEnum2["input-number"] = 24] = "input-number";
361
+ TagEnum2[TagEnum2["input-password"] = 25] = "input-password";
362
+ TagEnum2[TagEnum2["input-radio"] = 26] = "input-radio";
363
+ TagEnum2[TagEnum2["input-range"] = 27] = "input-range";
364
+ TagEnum2[TagEnum2["input-text"] = 28] = "input-text";
365
+ TagEnum2[TagEnum2["link"] = 29] = "link";
366
+ TagEnum2[TagEnum2["link-button"] = 30] = "link-button";
367
+ TagEnum2[TagEnum2["link-group"] = 31] = "link-group";
368
+ TagEnum2[TagEnum2["modal"] = 32] = "modal";
369
+ TagEnum2[TagEnum2["nav"] = 33] = "nav";
370
+ TagEnum2[TagEnum2["pagination"] = 34] = "pagination";
371
+ TagEnum2[TagEnum2["popover"] = 35] = "popover";
372
+ TagEnum2[TagEnum2["progress"] = 36] = "progress";
373
+ TagEnum2[TagEnum2["select"] = 37] = "select";
374
+ TagEnum2[TagEnum2["separator"] = 38] = "separator";
375
+ TagEnum2[TagEnum2["skip-nav"] = 39] = "skip-nav";
376
+ TagEnum2[TagEnum2["spin"] = 40] = "spin";
377
+ TagEnum2[TagEnum2["symbol"] = 41] = "symbol";
378
+ TagEnum2[TagEnum2["table"] = 42] = "table";
379
+ TagEnum2[TagEnum2["tabs"] = 43] = "tabs";
380
+ TagEnum2[TagEnum2["textarea"] = 44] = "textarea";
381
+ TagEnum2[TagEnum2["toast"] = 45] = "toast";
382
+ TagEnum2[TagEnum2["toolbar"] = 46] = "toolbar";
383
+ TagEnum2[TagEnum2["tooltip"] = 47] = "tooltip";
384
+ return TagEnum2;
385
+ })(TagEnum || {});
386
+
387
+ const KoliBri = new Theme("kol", KeyEnum, TagEnum);
2
388
 
3
389
  const BAMF = KoliBri.createTheme("bamf", {});
4
390
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@public-ui/themes",
3
- "version": "1.5.0-rc.21",
3
+ "version": "1.5.0-rc.23",
4
4
  "license": "EUPL-1.2",
5
5
  "homepage": "https://public-ui.github.io",
6
6
  "repository": "https://github.com/public-ui/kolibri",
@@ -48,7 +48,7 @@
48
48
  "prepack": "unbuild"
49
49
  },
50
50
  "devDependencies": {
51
- "@public-ui/components": "1.5.0-rc.21",
51
+ "@public-ui/schema": "1.5.0-rc.23",
52
52
  "@types/node": "ts4.9",
53
53
  "@typescript-eslint/eslint-plugin": "5.59.2",
54
54
  "@typescript-eslint/parser": "5.59.2",
@@ -58,7 +58,7 @@
58
58
  "unbuild": "1.2.1"
59
59
  },
60
60
  "peerDependencies": {
61
- "@public-ui/components": "1.5.0-rc.21"
61
+ "@public-ui/components": "1.5.0-rc.23"
62
62
  },
63
63
  "sideEffects": false,
64
64
  "type": "module",