blue-web 1.13.0 → 1.14.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 CHANGED
@@ -24,14 +24,25 @@ import "blue-web/dist/js/progress.js"
24
24
  // ...
25
25
  ```
26
26
 
27
+ **Important:** Since 1.14.0 JavaScript files are compiled as ES modules. When you embed them in HTML using the `<script>` don't forget the `type="module"` attribute.
28
+
27
29
  You can also use a CDN like unpkg.com. Only recommended for testing, not for production.
28
30
 
29
31
  ```html
30
- <script src="https://unpkg.com/blue-web@latest/dist/js/dialog.js"></script>
31
- <script src="https://unpkg.com/blue-web@latest/dist/js/progress.js"></script>
32
+ <script type="module" src="https://unpkg.com/blue-web@latest/dist/js/dialog.js"></script>
33
+ <script type="module" src="https://unpkg.com/blue-web@latest/dist/js/progress.js"></script>
32
34
  <!-- ... -->
33
35
  ```
34
36
 
37
+ JavaScript files are compiled as ES modules. This allows you to use import functions like this:
38
+
39
+ ```html
40
+ <script type="module">
41
+ import { tell } from "https://unpkg.com/blue-web@latest/dist/js/dialog.js"
42
+ tell("You are awesome!")
43
+ </script>
44
+ ```
45
+
35
46
  ## Customization and theming
36
47
 
37
48
  Since Blue Web is based on Bootstrap, you can customize many things by overriding Sass or CSS variables. For more information, see the [Bootstrap documentation](https://getbootstrap.com/docs/5.3/customize/overview/). Blue Web also provides some additional variables that you can use and override. Take a look at [dist/styles/\_variables.scss](https://github.com/bruegmann/blue-web/blob/main/dist/styles/_variables.scss) to see all of them.
@@ -0,0 +1 @@
1
+ (()=>{"use strict";window.blueWeb=window.blueWeb||{},window.blueWeb.actions={init:function(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;function n(){for(const e of i.children)e.style.display="none";for(const e of t.children)e.style.display="",e.classList.add("BLUE-actions-collapse-visible");let n=0;for(const s of i.children){if(s.style.display="",t.children[n].style.display="none",t.children[n].classList.remove("BLUE-actions-collapse-visible"),e.scrollWidth>e.clientWidth){s.style.display="none",t.children[n].style.display="",t.children[n].classList.add("BLUE-actions-collapse-visible");break}n++}}i||(i=e.querySelector(".BLUE-actions-menu")),t||(t=e.querySelector(".BLUE-actions-collapse-menu")),n();const s=new ResizeObserver((()=>{requestAnimationFrame(n)}));s.observe(e);const l=i=>{if(!e)return;const t=e.querySelectorAll("details[open]");!t||t.length<=0||t.forEach((e=>{e.contains(i.target)||e.removeAttribute("open")}))};return document.addEventListener("click",l),{updateActions:n,resizeObserver:s,destroy(){s.disconnect(),document.removeEventListener("click",l)}}}}})();
@@ -0,0 +1,5 @@
1
+ export declare function init(actionsElement: HTMLElement, menu?: HTMLElement | undefined, collapseMenu?: HTMLElement | undefined): {
2
+ updateActions: () => void;
3
+ resizeObserver: ResizeObserver;
4
+ destroy(): void;
5
+ };
@@ -0,0 +1,61 @@
1
+ export function init(actionsElement) {
2
+ let menu = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
3
+ let collapseMenu = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
4
+ if (!menu) menu = actionsElement.querySelector(".BLUE-actions-menu");
5
+ if (!collapseMenu) collapseMenu = actionsElement.querySelector(".BLUE-actions-collapse-menu");
6
+ function updateActions() {
7
+ // reset
8
+ for (const item of menu.children) {
9
+ ;
10
+ item.style.display = "none";
11
+ }
12
+ for (const item of collapseMenu.children) {
13
+ ;
14
+ item.style.display = "";
15
+ item.classList.add("BLUE-actions-collapse-visible");
16
+ }
17
+ let i = 0;
18
+ for (const item of menu.children) {
19
+ ;
20
+ item.style.display = "";
21
+ collapseMenu.children[i].style.display = "none";
22
+ collapseMenu.children[i].classList.remove("BLUE-actions-collapse-visible");
23
+ if (actionsElement.scrollWidth > actionsElement.clientWidth) {
24
+ ;
25
+ item.style.display = "none";
26
+ collapseMenu.children[i].style.display = "";
27
+ collapseMenu.children[i].classList.add("BLUE-actions-collapse-visible");
28
+ break;
29
+ }
30
+ i++;
31
+ }
32
+ }
33
+ updateActions();
34
+ const resizeObserver = new ResizeObserver(() => {
35
+ requestAnimationFrame(updateActions);
36
+ });
37
+ resizeObserver.observe(actionsElement);
38
+ const outsideClickHandler = event => {
39
+ if (!actionsElement) return;
40
+ const openDetails = actionsElement.querySelectorAll("details[open]");
41
+ if (!openDetails || openDetails.length <= 0) return;
42
+ openDetails.forEach(details => {
43
+ if (!details.contains(event.target)) {
44
+ details.removeAttribute("open");
45
+ }
46
+ });
47
+ };
48
+ document.addEventListener("click", outsideClickHandler);
49
+ return {
50
+ updateActions,
51
+ resizeObserver,
52
+ destroy() {
53
+ resizeObserver.disconnect();
54
+ document.removeEventListener("click", outsideClickHandler);
55
+ }
56
+ };
57
+ }
58
+ window.blueWeb = window.blueWeb || {};
59
+ window.blueWeb.actions = {
60
+ init
61
+ };
@@ -1,20 +1,12 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.set = exports.init = exports.getStored = exports.getPreferred = void 0;
7
- const getStored = () => localStorage.getItem("blue-web-color-mode");
8
- exports.getStored = getStored;
9
- const getPreferred = () => {
1
+ export const getStored = () => localStorage.getItem("blue-web-color-mode");
2
+ export const getPreferred = () => {
10
3
  const stored = getStored();
11
4
  if (stored) {
12
5
  return stored;
13
6
  }
14
7
  return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
15
8
  };
16
- exports.getPreferred = getPreferred;
17
- const set = colorMode => {
9
+ export const set = colorMode => {
18
10
  if (colorMode === "auto") {
19
11
  localStorage.removeItem("blue-web-color-mode");
20
12
  } else {
@@ -22,8 +14,7 @@ const set = colorMode => {
22
14
  }
23
15
  init();
24
16
  };
25
- exports.set = set;
26
- const init = () => {
17
+ export const init = () => {
27
18
  const colorMode = getPreferred();
28
19
  if (colorMode === "auto" && window.matchMedia("(prefers-color-scheme: dark)").matches) {
29
20
  document.documentElement.setAttribute("data-bs-theme", "dark");
@@ -31,7 +22,6 @@ const init = () => {
31
22
  document.documentElement.setAttribute("data-bs-theme", colorMode);
32
23
  }
33
24
  };
34
- exports.init = init;
35
25
  const onMatchMediaChange = () => {
36
26
  localStorage.removeItem("blue-web-color-mode");
37
27
  init();
package/dist/js/dialog.js CHANGED
@@ -1,36 +1,28 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.ask = ask;
7
- exports.tell = tell;
8
- exports.verify = verify;
9
- var _utils = require("./utils");
10
- var _shared = require("./shared");
11
- async function ask(text) {
1
+ import { guid } from "./utils";
2
+ import { getPhrase } from "./shared";
3
+ export async function ask(text) {
12
4
  let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
13
5
  return await dialog("ask", text, options);
14
6
  }
15
- async function tell(text) {
7
+ export async function tell(text) {
16
8
  let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
17
9
  await dialog("tell", text, options);
18
10
  }
19
- async function verify(text) {
11
+ export async function verify(text) {
20
12
  let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
21
13
  return (await dialog("verify", text, options)) === true;
22
14
  }
23
15
  async function dialog(dialogType, text) {
24
16
  let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
25
17
  let {
26
- title = (0, _shared.getPhrase)("Message"),
18
+ title = getPhrase("Message"),
27
19
  icon = undefined,
28
20
  switchPrimaryBtn = false,
29
- acceptBtnText = dialogType === "verify" ? (0, _shared.getPhrase)("Yes") : "OK",
30
- cancelBtnText = dialogType === "verify" ? (0, _shared.getPhrase)("No") : (0, _shared.getPhrase)("Cancel"),
21
+ acceptBtnText = dialogType === "verify" ? getPhrase("Yes") : "OK",
22
+ cancelBtnText = dialogType === "verify" ? getPhrase("No") : getPhrase("Cancel"),
31
23
  inputType = "text"
32
24
  } = options;
33
- const id = (0, _utils.guid)();
25
+ const id = guid();
34
26
  const addToDom = () => {
35
27
  document.body.insertAdjacentHTML("beforeend", /* HTML */`<dialog class="blue-modal modal" id="${id}" aria-labelledby="${id}-label">
36
28
  <div class="modal-dialog">
@@ -1,13 +1,7 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.EditView = void 0;
7
1
  /**
8
2
  * EditView is a Custom Element that displays a edit view of its content and allows the user to confirm or dismiss the changes.
9
3
  */
10
- class EditView extends HTMLElement {
4
+ export class EditView extends HTMLElement {
11
5
  connectedCallback() {
12
6
  this.render();
13
7
  }
@@ -59,5 +53,4 @@ class EditView extends HTMLElement {
59
53
  }));
60
54
  }
61
55
  }
62
- exports.EditView = EditView;
63
56
  customElements.define("edit-view", EditView);
@@ -1,9 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
1
  window.blueWeb = window.blueWeb || {};
8
2
  window.blueWeb.progress = {
9
3
  progress: 0
@@ -58,4 +52,4 @@ window.blueWeb.progress = {
58
52
  }, 500);
59
53
  }
60
54
  };
61
- var _default = exports.default = window.blueWeb.progress;
55
+ export default window.blueWeb.progress;
@@ -1,9 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.ReadView = void 0;
7
1
  const DRAG_THRESHOLD = 5;
8
2
 
9
3
  /**
@@ -25,7 +19,7 @@ const DRAG_THRESHOLD = 5;
25
19
  * setEditing(true)
26
20
  * })
27
21
  */
28
- class ReadView extends HTMLElement {
22
+ export class ReadView extends HTMLElement {
29
23
  startX = 0;
30
24
  startY = 0;
31
25
  constructor() {
@@ -126,5 +120,4 @@ class ReadView extends HTMLElement {
126
120
  }
127
121
  }
128
122
  }
129
- exports.ReadView = ReadView;
130
123
  customElements.define("read-view", ReadView);
package/dist/js/shared.js CHANGED
@@ -1,9 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getPhrase = getPhrase;
7
1
  const phrases = {
8
2
  Cancel: ["Cancel", "Abbrechen"],
9
3
  Yes: ["Yes", "Ja"],
@@ -14,7 +8,7 @@ const phrases = {
14
8
  Error: ["Error", "Fehler"],
15
9
  Information: ["Information", "Information"]
16
10
  };
17
- function getPhrase(keyword) {
11
+ export function getPhrase(keyword) {
18
12
  let countryCode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
19
13
  let _phrases = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
20
14
  countryCode = countryCode || navigator.language.toLowerCase().indexOf("de") > -1 ? "de-DE" : "en-US";
@@ -1,10 +1,4 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.SideLayout = void 0;
7
- class SideLayout extends HTMLElement {
1
+ export class SideLayout extends HTMLElement {
8
2
  constructor() {
9
3
  super();
10
4
  this.attachShadow({
@@ -173,5 +167,4 @@ class SideLayout extends HTMLElement {
173
167
  }
174
168
  }
175
169
  }
176
- exports.SideLayout = SideLayout;
177
170
  customElements.define("side-layout", SideLayout);
package/dist/js/utils.js CHANGED
@@ -1,30 +1,16 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.fetchData = fetchData;
7
- exports.finishLoading = finishLoading;
8
- exports.guid = void 0;
9
- exports.hideSuccess = hideSuccess;
10
- exports.resetAlertMessage = resetAlertMessage;
11
- exports.scrollToTop = scrollToTop;
12
- exports.setAlertMessage = setAlertMessage;
13
- exports.showSuccess = showSuccess;
14
- exports.startLoading = startLoading;
15
- function startLoading() {
1
+ export function startLoading() {
16
2
  ;
17
3
  document.querySelector(".blue-loading").style.display = "block";
18
4
  }
19
- function finishLoading() {
5
+ export function finishLoading() {
20
6
  ;
21
7
  document.querySelector(".blue-loading").style.display = "";
22
8
  }
23
- function showSuccess() {
9
+ export function showSuccess() {
24
10
  ;
25
11
  document.querySelector(".blue-status-success").style.display = "flex";
26
12
  }
27
- function hideSuccess() {
13
+ export function hideSuccess() {
28
14
  ;
29
15
  document.querySelector(".blue-status-success").style.display = "";
30
16
  }
@@ -34,7 +20,7 @@ function hideSuccess() {
34
20
  * When using React, you should use `StatusProvider` instead: https://bruegmann.github.io/blue-react/v9/component/StatusProvider
35
21
  * @param alertClassName Leave empty to reset messages of any status type
36
22
  */
37
- function resetAlertMessage(alertClassName) {
23
+ export function resetAlertMessage(alertClassName) {
38
24
  if (!alertClassName) {
39
25
  ;
40
26
  ["loading", "success", "info", "warning", "danger"].forEach(status => {
@@ -54,7 +40,7 @@ function resetAlertMessage(alertClassName) {
54
40
  /**
55
41
  * When using React, you should use `StatusProvider` instead: https://bruegmann.github.io/blue-react/v9/component/StatusProvider
56
42
  */
57
- function setAlertMessage(message) {
43
+ export function setAlertMessage(message) {
58
44
  let alertClassName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "info";
59
45
  let close = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
60
46
  let detailText = arguments.length > 3 ? arguments[3] : undefined;
@@ -82,9 +68,8 @@ function setAlertMessage(message) {
82
68
  function s4() {
83
69
  return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
84
70
  }
85
- const guid = () => s4() + s4() + "-" + s4() + "-" + s4() + "-" + s4() + "-" + s4() + s4() + s4();
86
- exports.guid = guid;
87
- function scrollToTop() {
71
+ export const guid = () => s4() + s4() + "-" + s4() + "-" + s4() + "-" + s4() + "-" + s4() + s4() + s4();
72
+ export function scrollToTop() {
88
73
  const routerPage = document.querySelector(".router-page.active");
89
74
  routerPage.scroll({
90
75
  behavior: "smooth",
@@ -103,7 +88,7 @@ const httpStatusCodes = {
103
88
  500: "Internal Server Error",
104
89
  502: "Bad Gateway"
105
90
  };
106
- function fetchData(input, init) {
91
+ export function fetchData(input, init) {
107
92
  let showErrorDetail = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
108
93
  let onError = arguments.length > 3 ? arguments[3] : undefined;
109
94
  return fetch(input, init).then(response => {
package/dist/merged.scss CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Blue Web v1.13.0 (https://bruegmann.github.io/blue-web)
2
+ * Blue Web v1.14.0 (https://bruegmann.github.io/blue-web)
3
3
  * Licensed under GNU General Public License v3.0 (https://github.com/bruegmann/blue-web/blob/master/LICENSE).
4
4
  */
5
5
 
@@ -11378,11 +11378,6 @@ body {
11378
11378
  var(--bs-btn-padding-x, 0.75rem) + var(--bs-btn-border-width, 1px)
11379
11379
  );
11380
11380
 
11381
- display: inline;
11382
- left: 0;
11383
- right: 0;
11384
- top: 0;
11385
- padding: 0;
11386
11381
  max-height: $normal-size;
11387
11382
  overflow: hidden;
11388
11383
 
@@ -11395,6 +11390,9 @@ body {
11395
11390
  }
11396
11391
 
11397
11392
  &.open {
11393
+ left: 0;
11394
+ right: 0;
11395
+ top: 0;
11398
11396
  background-color: var(--blue-menu-item-dropdown-bg);
11399
11397
  }
11400
11398
 
@@ -11433,16 +11431,6 @@ body {
11433
11431
  }
11434
11432
  }
11435
11433
 
11436
- .blue-actions-menu-toggle > span:first-child {
11437
- transform: rotate(90deg);
11438
- }
11439
-
11440
- .blue-actions-menu-item {
11441
- display: flex;
11442
- align-items: center;
11443
- color: inherit;
11444
- }
11445
-
11446
11434
  .blue-caret {
11447
11435
  /* treat like a font icon */
11448
11436
  font-family: "blueicon" !important;
@@ -12239,6 +12227,62 @@ dialog.blue-modal:has(.offcanvas-start) {
12239
12227
  }
12240
12228
  }
12241
12229
 
12230
+ .BLUE-actions {
12231
+ display: flex;
12232
+ white-space: nowrap;
12233
+ }
12234
+
12235
+ .BLUE-actions-menu {
12236
+ display: flex;
12237
+ max-width: 100%;
12238
+ }
12239
+
12240
+ .BLUE-actions-collapse {
12241
+ position: relative;
12242
+ }
12243
+
12244
+ .BLUE-actions-collapse:not(:has(.BLUE-actions-collapse-visible)) {
12245
+ display: none;
12246
+ }
12247
+
12248
+ .BLUE-actions-collapse-menu {
12249
+ position: absolute;
12250
+ }
12251
+
12252
+
12253
+ /* Make DevExpress components look more like Bootstrap/Blue */
12254
+ [class^="dxbl-"] {
12255
+ --dxbl-text-edit-border-radius: var(--bs-border-radius) !important;
12256
+ --dxbl-text-edit-padding-x: 0.75rem !important;
12257
+ --dxbl-text-edit-padding-y: 0.375rem !important;
12258
+ --dxbl-text-edit-line-height: 1.5 !important;
12259
+ --dxbl-text-edit-focus-shadow-spread: 0.25rem !important;
12260
+ --dxbl-listbox-border-radius: var(--bs-border-radius) !important;
12261
+ --dxbl-toolbar-font-size: var(--bs-body-font-size) !important;
12262
+ --dxbl-toolbar-btn-border-radius: var(--bs-border-radius) !important;
12263
+ --dxbl-dropdown-border-radius: var(--bs-border-radius) !important;
12264
+ --dxbl-btn-border-radius: var(--bs-border-radius) !important;
12265
+ --dxbl-btn-padding-x: 0.75rem !important;
12266
+ --dxbl-btn-padding-y: 0.375rem !important;
12267
+ }
12268
+
12269
+ .dxbl-grid {
12270
+ --dxbl-grid-font-size: 1rem;
12271
+ border: none;
12272
+ }
12273
+
12274
+ .dxbl-text-edit {
12275
+ font-size: 1rem;
12276
+ }
12277
+
12278
+ .dxbl-toolbar {
12279
+ --dxbl-toolbar-font-size: var(--bs-body-font-size) !important;
12280
+ font-size: var(--dxbl-toolbar-font-size);
12281
+ }
12282
+
12283
+ body.modal-open .dxbl-popup-cell[style="z-index: 1050;"] {
12284
+ z-index: 1056 !important;
12285
+ }
12242
12286
 
12243
12287
  :root {
12244
12288
  --bs-font-sans-serif: Inter, #{$font-family-sans-serif};