@zeyos/zx 3.0.0 → 4.1.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/CHANGELOG.md +95 -0
- package/DESIGN-SYSTEM.md +87 -71
- package/README.md +16 -37
- package/dist/types/components/app-icon/app-icon.d.ts +88 -0
- package/dist/types/components/app-sidebar/app-sidebar.d.ts +106 -32
- package/dist/types/components/card/card.d.ts +128 -0
- package/dist/types/components/chart/chart.d.ts +1 -0
- package/dist/types/components/filter/filter-model.d.ts +87 -0
- package/dist/types/components/filter/filter.d.ts +331 -0
- package/dist/types/components/launcher/launcher.d.ts +65 -6
- package/dist/types/components/select/select.d.ts +97 -4
- package/dist/types/components/table/table.d.ts +107 -3
- package/dist/types/components/tag-picker/tag-picker.d.ts +16 -0
- package/dist/types/core/dom.d.ts +9 -1
- package/dist/types/core/util.d.ts +9 -0
- package/dist/types/index.d.ts +6 -2
- package/dist/types/{components/app-rail → internal}/app-rail.d.ts +34 -19
- package/dist/types/zeyos/icons.d.ts +24 -2
- package/dist/types/zeyos/index.d.ts +3 -2
- package/dist/types/zeyos/launcher.d.ts +147 -0
- package/dist/types/zeyos/select.d.ts +41 -0
- package/dist/zx-zeyos.esm.js +2018 -113
- package/dist/zx-zeyos.esm.min.js +1 -1
- package/dist/zx.css +815 -16
- package/dist/zx.esm.js +2661 -338
- package/dist/zx.esm.min.js +3 -3
- package/dist/zx.global.js +2661 -338
- package/dist/zx.global.min.js +3 -3
- package/dist/zx.min.css +1 -1
- package/docs/api.json +602 -110
- package/docs/llms.md +181 -123
- package/docs/llms.txt +24 -21
- package/package.json +8 -17
- package/src/components/app-icon/app-icon.css +105 -0
- package/src/components/app-icon/app-icon.js +134 -0
- package/src/components/app-sidebar/app-sidebar.css +12 -0
- package/src/components/app-sidebar/app-sidebar.js +310 -110
- package/src/components/card/card.css +149 -0
- package/src/components/card/card.js +285 -0
- package/src/components/chart/chart.js +8 -3
- package/src/components/filter/filter-model.js +226 -0
- package/src/components/filter/filter.css +147 -0
- package/src/components/filter/filter.js +554 -0
- package/src/components/grid/grid.css +1 -1
- package/src/components/grid/grid.js +14 -4
- package/src/components/launcher/launcher.css +113 -3
- package/src/components/launcher/launcher.js +234 -26
- package/src/components/message/message.css +36 -3
- package/src/components/select/field-adapter.js +9 -4
- package/src/components/select/select.css +161 -10
- package/src/components/select/select.js +361 -48
- package/src/components/table/table.css +85 -0
- package/src/components/table/table.js +426 -31
- package/src/components/tag-picker/tag-picker.css +19 -0
- package/src/components/tag-picker/tag-picker.js +42 -5
- package/src/core/dom.js +21 -1
- package/src/core/util.js +20 -0
- package/src/index.js +9 -2
- package/src/{components/app-rail → internal}/app-rail.js +80 -30
- package/src/zeyos/icons.js +38 -20
- package/src/zeyos/index.js +8 -2
- package/src/zeyos/launcher.js +338 -0
- package/src/zeyos/modules.js +1 -0
- package/src/zeyos/select.js +116 -1
- package/styles/tokens/global.css +1 -1
- package/styles/tokens/modules.css +1 -0
- package/styles/tokens/semantic.css +9 -0
- package/styles/tokens/themes.css +2 -2
- package/styles/zx.css +3 -0
- package/MIGRATION.md +0 -749
- package/dist/types/compat/base.d.ts +0 -156
- package/dist/types/compat/globals.d.ts +0 -20
- package/dist/types/compat/index.d.ts +0 -128
- package/dist/types/compat/map/basic.d.ts +0 -175
- package/dist/types/compat/map/data.d.ts +0 -103
- package/dist/types/compat/map/date-time.d.ts +0 -80
- package/dist/types/compat/map/factory.d.ts +0 -9
- package/dist/types/compat/map/form.d.ts +0 -98
- package/dist/types/compat/map/helpers.d.ts +0 -12
- package/dist/types/compat/map/http.d.ts +0 -36
- package/dist/types/compat/map/layout.d.ts +0 -106
- package/dist/types/compat/map/options.d.ts +0 -80
- package/dist/types/compat/map/select.d.ts +0 -95
- package/dist/types/compat/map/stubs.d.ts +0 -32
- package/dist/types/compat/map/utilities.d.ts +0 -37
- package/dist/types/compat-entry.d.ts +0 -5
- package/dist/zx-compat.esm.js +0 -17848
- package/dist/zx-compat.esm.min.js +0 -1
- package/dist/zx-compat.global.js +0 -29008
- package/dist/zx-compat.global.min.js +0 -3
- package/src/compat/base.js +0 -291
- package/src/compat/globals.js +0 -167
- package/src/compat/index.js +0 -84
- package/src/compat/map/basic.js +0 -464
- package/src/compat/map/data.js +0 -254
- package/src/compat/map/date-time.js +0 -177
- package/src/compat/map/factory.js +0 -45
- package/src/compat/map/form.js +0 -330
- package/src/compat/map/helpers.js +0 -46
- package/src/compat/map/http.js +0 -117
- package/src/compat/map/layout.js +0 -256
- package/src/compat/map/options.js +0 -267
- package/src/compat/map/select.js +0 -198
- package/src/compat/map/stubs.js +0 -26
- package/src/compat/map/utilities.js +0 -113
- package/src/compat-entry.js +0 -11
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
.zx-app-icon {
|
|
2
|
+
--zx-app-icon-size: 36px;
|
|
3
|
+
--zx-app-icon-glyph-size: 52%;
|
|
4
|
+
--zx-app-icon-color: var(--zx-color-accent);
|
|
5
|
+
position: relative;
|
|
6
|
+
isolation: isolate;
|
|
7
|
+
display: inline-grid;
|
|
8
|
+
place-items: center;
|
|
9
|
+
flex: none;
|
|
10
|
+
inline-size: var(--zx-app-icon-size);
|
|
11
|
+
block-size: var(--zx-app-icon-size);
|
|
12
|
+
overflow: hidden;
|
|
13
|
+
border: 1px solid var(--zx-color-glass-border);
|
|
14
|
+
border-radius: max(var(--zx-radius-md), calc(var(--zx-app-icon-size) * .22));
|
|
15
|
+
background: var(--zx-app-icon-color);
|
|
16
|
+
box-shadow: var(--zx-app-icon-shadow);
|
|
17
|
+
color: var(--zx-app-icon-glyph, var(--zx-color-text-invert));
|
|
18
|
+
font-size: var(--zx-app-icon-size);
|
|
19
|
+
vertical-align: middle;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.zx-app-icon[data-glass="subtle"],
|
|
23
|
+
.zx-app-icon[data-glass="strong"] {
|
|
24
|
+
background:
|
|
25
|
+
linear-gradient(145deg, var(--zx-color-glass-highlight), transparent 44%),
|
|
26
|
+
color-mix(in srgb, var(--zx-app-icon-color) var(--zx-glass-color-strength), transparent);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.zx-app-icon[data-glass="strong"] {
|
|
30
|
+
backdrop-filter: blur(var(--zx-glass-blur)) saturate(var(--zx-glass-saturation));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.zx-app-icon[data-glass="none"] {
|
|
34
|
+
border-color: var(--zx-color-border);
|
|
35
|
+
box-shadow: none;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.zx-app-icon[data-glass="none"] .zx-app-icon__shine { display: none; }
|
|
39
|
+
|
|
40
|
+
.zx-app-icon[data-selected] {
|
|
41
|
+
outline: 2px solid var(--zx-color-bg-page);
|
|
42
|
+
box-shadow: 0 0 0 3px var(--zx-color-ring), var(--zx-overlay-shadow);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.zx-app-icon__shine {
|
|
46
|
+
position: absolute;
|
|
47
|
+
z-index: -1;
|
|
48
|
+
inset: 1px 12% auto;
|
|
49
|
+
block-size: 42%;
|
|
50
|
+
border-radius: 999px;
|
|
51
|
+
background: linear-gradient(to bottom, var(--zx-color-glass-highlight-strong), transparent);
|
|
52
|
+
filter: blur(2px);
|
|
53
|
+
pointer-events: none;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.zx-app-icon__glyph {
|
|
57
|
+
display: inline-grid;
|
|
58
|
+
place-items: center;
|
|
59
|
+
inline-size: var(--zx-app-icon-glyph-size);
|
|
60
|
+
block-size: var(--zx-app-icon-glyph-size);
|
|
61
|
+
font-size: var(--zx-app-icon-glyph-size);
|
|
62
|
+
line-height: 1;
|
|
63
|
+
filter: drop-shadow(var(--zx-glass-glyph-shadow));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.zx-app-icon__glyph > .zx-icon,
|
|
67
|
+
.zx-app-icon__glyph > svg,
|
|
68
|
+
.zx-app-icon__glyph > i {
|
|
69
|
+
inline-size: 1em;
|
|
70
|
+
block-size: 1em;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.zx-app-icon__badge {
|
|
74
|
+
position: absolute;
|
|
75
|
+
inset-block-end: 1px;
|
|
76
|
+
inset-inline-end: 1px;
|
|
77
|
+
display: grid;
|
|
78
|
+
place-items: center;
|
|
79
|
+
min-inline-size: 14px;
|
|
80
|
+
block-size: 14px;
|
|
81
|
+
padding-inline: 3px;
|
|
82
|
+
border: 1px solid var(--zx-color-bg-raised);
|
|
83
|
+
border-radius: var(--zx-radius-full);
|
|
84
|
+
background: var(--zx-color-danger);
|
|
85
|
+
color: var(--zx-color-text-invert);
|
|
86
|
+
font-size: 9px;
|
|
87
|
+
font-weight: 700;
|
|
88
|
+
line-height: 1;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@media (prefers-reduced-transparency: reduce) {
|
|
92
|
+
.zx-app-icon[data-glass="strong"] {
|
|
93
|
+
background: var(--zx-app-icon-color);
|
|
94
|
+
backdrop-filter: none;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@media (forced-colors: active) {
|
|
99
|
+
.zx-app-icon {
|
|
100
|
+
border-color: ButtonText;
|
|
101
|
+
background: ButtonFace;
|
|
102
|
+
color: ButtonText;
|
|
103
|
+
box-shadow: none;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { Component } from '../../core/component.js';
|
|
2
|
+
import { h, restoreTarget, snapshotTarget } from '../../core/dom.js';
|
|
3
|
+
import { icon as renderIcon } from '../../core/icons.js';
|
|
4
|
+
import { isCssColor } from '../../core/util.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {Object} AppIconOptions
|
|
8
|
+
* @property {string|Node|(()=>string|Node)|null} [icon=null] Icon name, node, or lazy renderer.
|
|
9
|
+
* @property {string|null} [color=null] Identity colour; falls back to the accent colour.
|
|
10
|
+
* @property {number|string} [size=36] Edge length in pixels or any CSS length.
|
|
11
|
+
* @property {number|string} [iconSize='52%'] Glyph size.
|
|
12
|
+
* @property {string|null} [label=null] Accessible image label; null makes the icon decorative.
|
|
13
|
+
* @property {string|number|null} [badge=null] Optional corner badge.
|
|
14
|
+
* @property {boolean} [selected=false] Whether the icon represents the active application.
|
|
15
|
+
* @property {false|'subtle'|'strong'} [glass='subtle'] CSS-first glass treatment.
|
|
16
|
+
* @property {string|string[]} [class] Additional class names.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Stable application-identity tile with progressive CSS glass treatment.
|
|
21
|
+
* @extends {Component<AppIconOptions>}
|
|
22
|
+
*/
|
|
23
|
+
export class AppIcon extends Component {
|
|
24
|
+
static cssName = 'app-icon';
|
|
25
|
+
|
|
26
|
+
/** @type {Readonly<AppIconOptions>} */
|
|
27
|
+
static defaults = {
|
|
28
|
+
icon: null,
|
|
29
|
+
color: null,
|
|
30
|
+
size: 36,
|
|
31
|
+
iconSize: '52%',
|
|
32
|
+
label: null,
|
|
33
|
+
badge: null,
|
|
34
|
+
selected: false,
|
|
35
|
+
glass: 'subtle',
|
|
36
|
+
class: []
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/** @returns {HTMLElement} */
|
|
40
|
+
render() {
|
|
41
|
+
this._createdRoot = this.el === null;
|
|
42
|
+
const root = /** @type {HTMLElement} */ (this.el ?? h('span'));
|
|
43
|
+
this.el = root;
|
|
44
|
+
this._snapshot = this._createdRoot ? null : snapshotTarget(root);
|
|
45
|
+
this._state = { ...this.options };
|
|
46
|
+
this._appliedClasses = [];
|
|
47
|
+
this._sync();
|
|
48
|
+
return root;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** Updates identity or presentation without replacing the root. @param {Partial<AppIconOptions>} values @returns {this} */
|
|
52
|
+
set(values = {}) {
|
|
53
|
+
if (!values || typeof values !== 'object') return this;
|
|
54
|
+
Object.assign(this._state, values);
|
|
55
|
+
this._sync();
|
|
56
|
+
return this;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** Restores an enhanced target. @returns {void} */
|
|
60
|
+
destroy() {
|
|
61
|
+
const root = this.el;
|
|
62
|
+
const snapshot = this._snapshot;
|
|
63
|
+
super.destroy();
|
|
64
|
+
if (!this._createdRoot && root) restoreTarget(root, snapshot);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** @returns {void} */
|
|
68
|
+
_sync() {
|
|
69
|
+
const state = this._state;
|
|
70
|
+
this.el.classList.remove(...this._appliedClasses);
|
|
71
|
+
this._appliedClasses = [state.class].flat()
|
|
72
|
+
.flatMap((value) => String(value ?? '').split(/\s+/)).filter(Boolean);
|
|
73
|
+
this.el.classList.add(...this._appliedClasses);
|
|
74
|
+
const size = cssLength(state.size, '36px');
|
|
75
|
+
const glyphSize = cssLength(state.iconSize, '52%');
|
|
76
|
+
this.el.style.setProperty('--zx-app-icon-size', size);
|
|
77
|
+
this.el.style.setProperty('--zx-app-icon-glyph-size', glyphSize);
|
|
78
|
+
if (isCssColor(state.color)) this.el.style.setProperty('--zx-app-icon-color', String(state.color));
|
|
79
|
+
else this.el.style.removeProperty('--zx-app-icon-color');
|
|
80
|
+
this.el.dataset.glass = normalizeGlass(state.glass);
|
|
81
|
+
this.el.toggleAttribute('data-selected', Boolean(state.selected));
|
|
82
|
+
|
|
83
|
+
const label = state.label == null ? '' : String(state.label).trim();
|
|
84
|
+
if (label) {
|
|
85
|
+
this.el.setAttribute('role', 'img');
|
|
86
|
+
this.el.setAttribute('aria-label', label);
|
|
87
|
+
this.el.removeAttribute('aria-hidden');
|
|
88
|
+
} else {
|
|
89
|
+
this.el.removeAttribute('role');
|
|
90
|
+
this.el.removeAttribute('aria-label');
|
|
91
|
+
this.el.setAttribute('aria-hidden', 'true');
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const visual = resolveVisual(state.icon);
|
|
95
|
+
const badge = state.badge == null || state.badge === '' ? null : h('span', {
|
|
96
|
+
class: 'zx-app-icon__badge', ariaHidden: 'true'
|
|
97
|
+
}, String(state.badge));
|
|
98
|
+
this.el.replaceChildren(
|
|
99
|
+
h('span', { class: 'zx-app-icon__shine', ariaHidden: 'true' }),
|
|
100
|
+
h('span', { class: 'zx-app-icon__glyph', ariaHidden: 'true' }, visual),
|
|
101
|
+
badge
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Creates an AppIcon element without retaining a component lifecycle handle.
|
|
108
|
+
* @param {AppIconOptions} [options={}] Icon options.
|
|
109
|
+
* @returns {HTMLElement}
|
|
110
|
+
*/
|
|
111
|
+
export function appIcon(options = {}) {
|
|
112
|
+
return new AppIcon(null, options).toElement();
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** @param {AppIconOptions['icon']} value @returns {Node|string|null} */
|
|
116
|
+
function resolveVisual(value) {
|
|
117
|
+
const resolved = typeof value === 'function' ? value() : value;
|
|
118
|
+
if (typeof resolved === 'string') return renderIcon(resolved, { size: '1em' });
|
|
119
|
+
return resolved && typeof resolved === 'object' && typeof resolved.nodeType === 'number'
|
|
120
|
+
? /** @type {Node} */ (resolved) : null;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** @param {unknown} value @param {string} fallback @returns {string} */
|
|
124
|
+
function cssLength(value, fallback) {
|
|
125
|
+
if (typeof value === 'number' && Number.isFinite(value)) return `${Math.max(1, value)}px`;
|
|
126
|
+
const text = String(value ?? '').trim();
|
|
127
|
+
return text && !/[;{}]/.test(text) ? text : fallback;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** @param {unknown} value @returns {'none'|'subtle'|'strong'} */
|
|
131
|
+
function normalizeGlass(value) {
|
|
132
|
+
if (value === false || value === 'none') return 'none';
|
|
133
|
+
return value === 'strong' ? 'strong' : 'subtle';
|
|
134
|
+
}
|
|
@@ -6,6 +6,18 @@
|
|
|
6
6
|
color: var(--zx-color-text);
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
+
.zx-app-sidebar[data-orientation="horizontal"] {
|
|
10
|
+
inline-size: 100%;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.zx-app-sidebar[data-orientation="horizontal"] > .zx-app-sidebar__rail {
|
|
14
|
+
inline-size: 100%;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.zx-app-sidebar__rail.zx-app-rail {
|
|
18
|
+
border: 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
9
21
|
.zx-app-sidebar__expanded {
|
|
10
22
|
display: grid;
|
|
11
23
|
grid-template-rows: auto minmax(0, 1fr) auto;
|