@xoong/ui 0.0.36 → 0.0.39

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xoong/ui",
3
- "version": "0.0.36",
3
+ "version": "0.0.39",
4
4
  "description": "xoong admin set: xoong.css tokens, <xo-table>, <xo-form>, <xo-dialog>, toast, confirm and a declarative History-API router. Depends on @xoong/core, @xoong/data and @xoong/forms.",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -20,9 +20,9 @@
20
20
  "sideEffects": true,
21
21
  "license": "MIT",
22
22
  "dependencies": {
23
- "@xoong/core": "0.0.36",
24
- "@xoong/data": "0.0.36",
25
- "@xoong/forms": "0.0.36"
23
+ "@xoong/core": "0.0.39",
24
+ "@xoong/data": "0.0.39",
25
+ "@xoong/forms": "0.0.39"
26
26
  },
27
27
  "files": [
28
28
  "src"
package/src/mist.css CHANGED
@@ -1329,6 +1329,40 @@
1329
1329
  xo-copy .xo-copyfield input { background: var(--xo-color-subtle); }
1330
1330
  .xo-input-wrap button.xo-input-end, xo-password button.xo-input-end { position: absolute; right: 4px; top: 50%; translate: 0 -50%; }
1331
1331
  .xo-input-wrap button.xo-date-open { position: absolute; }
1332
+ xo-image {
1333
+ border-radius: var(--xo-radius);
1334
+ background: var(--xo-color-subtle);
1335
+ }
1336
+ xo-image[data-state="loading"] {
1337
+ background: linear-gradient(100deg, var(--xo-color-subtle) 30%, var(--xo-color-border) 50%, var(--xo-color-subtle) 70%) 0 0 / 300% 100%;
1338
+ animation: xo-image-shimmer 1.4s linear infinite;
1339
+ }
1340
+ @keyframes xo-image-shimmer { to { background-position: -150% 0; } }
1341
+ @media (prefers-reduced-motion: reduce) {
1342
+ xo-image[data-state="loading"] { animation: none; background: var(--xo-color-subtle); }
1343
+ }
1344
+ xo-image[data-state="empty"]::before, xo-image .xo-image-note::before {
1345
+ content: "";
1346
+ inline-size: 24px;
1347
+ block-size: 24px;
1348
+ background: currentcolor;
1349
+ mask: var(--ic-image) center / contain no-repeat;
1350
+ -webkit-mask: var(--ic-image) center / contain no-repeat;
1351
+ }
1352
+ xo-image[data-state="empty"] {
1353
+ display: grid;
1354
+ place-items: center;
1355
+ color: var(--xo-color-text-2);
1356
+ }
1357
+ xo-image .xo-image-note {
1358
+ display: flex;
1359
+ flex-direction: column;
1360
+ align-items: center;
1361
+ justify-content: center;
1362
+ gap: 8px;
1363
+ font-size: 13px;
1364
+ color: var(--xo-color-text-2);
1365
+ }
1332
1366
 
1333
1367
  /* ---- skin ---- */
1334
1368
  :root { --shadow-sm: 0 1px 2px color-mix(in srgb, var(--xo-color-text) 6%, transparent); --shadow-float: 0 12px 32px color-mix(in srgb, var(--xo-color-text) 14%, transparent), 0 2px 6px color-mix(in srgb, var(--xo-color-text) 8%, transparent); --xo-shadow-pop: var(--shadow-float); --xo-shadow-raised: none; --xo-focus: 2px solid var(--xo-color-accent); --xo-focus-thin: 2px solid var(--xo-color-accent); }
package/src/router.js CHANGED
@@ -60,6 +60,11 @@ class XoRouter extends XoElement {
60
60
  #scrolls = new Map();
61
61
  /** Forms with unsaved changes (they announce it with `xo-dirty`); leaving the page asks first, unless the form says `xo-guard="off"`. */
62
62
  #dirtyForms = new Set();
63
+ // xo-then on a button or form: the data layer asks the page to go on to another path
64
+ #onGo = (/** @type {Event} */ e) => {
65
+ e.preventDefault();
66
+ this.navigate(/** @type {CustomEvent} */ (e).detail.path).catch?.((err) => this.#report(err));
67
+ };
63
68
  #onDirty = (/** @type {Event} */ e) => {
64
69
  const form = /** @type {Element} */ (e.target);
65
70
  if (/** @type {any} */ (e).detail?.dirty && form.getAttribute('xo-guard') !== 'off') this.#dirtyForms.add(form); else this.#dirtyForms.delete(form);
@@ -82,6 +87,7 @@ class XoRouter extends XoElement {
82
87
  disconnected() {
83
88
  document.removeEventListener('click', this.#onClick);
84
89
  document.removeEventListener('xo-dirty', this.#onDirty);
90
+ this.removeEventListener('xo-go', this.#onGo);
85
91
  window.removeEventListener('popstate', this.#onPop);
86
92
  window.removeEventListener('beforeunload', this.#onUnload);
87
93
  setUrlSync(null);
@@ -128,6 +134,7 @@ class XoRouter extends XoElement {
128
134
  this.#pos = window.history.state?.xoPos ?? 0;
129
135
  document.addEventListener('click', this.#onClick);
130
136
  document.addEventListener('xo-dirty', this.#onDirty);
137
+ this.addEventListener('xo-go', this.#onGo);
131
138
  window.addEventListener('popstate', this.#onPop);
132
139
  window.addEventListener('beforeunload', this.#onUnload);
133
140
  this.#vetoes.push(async () => { // a dirty form asks before the page is left (links, Back, navigate)