@hypermedia-components/core 0.1.0 → 0.1.1
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/field-errors.js +21 -2
- package/dist/hc-combobox.css +1 -1
- package/dist/hc-command.css +1 -1
- package/dist/hc-datagrid.css +3 -3
- package/dist/hc-dialog.css +1 -1
- package/dist/hc-drawer.css +1 -1
- package/dist/hc-hovercard.css +1 -1
- package/dist/hc-menu.css +1 -1
- package/dist/hc-multicombobox.css +1 -1
- package/dist/hc-navmenu.css +1 -1
- package/dist/hc-popover.css +1 -1
- package/dist/hc-switch.css +1 -1
- package/dist/hc-tabs.css +2 -2
- package/dist/hc-toast.css +1 -1
- package/dist/hc.behaviors.min.js +2 -2
- package/dist/hc.core.css +10 -0
- package/dist/hc.core.min.css +1 -1
- package/dist/hc.css +26 -16
- package/dist/hc.min.css +1 -1
- package/dist/hc.min.js +2 -2
- package/dist/hc.tokens.core.css +10 -0
- package/dist/hc.tokens.css +10 -0
- package/dist/i18n.js +15 -8
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/locales/ja.d.ts +3 -0
- package/dist/locales/ja.js +44 -0
- package/package.json +11 -6
- package/src/tokens/README.md +9 -1
- package/src/tokens/semantic.tokens.json +8 -0
- package/src/tokens/theme.dark.tokens.json +8 -0
package/dist/field-errors.js
CHANGED
|
@@ -27,8 +27,11 @@
|
|
|
27
27
|
// control is focused (opt out with `data-focus="none"` on the alert).
|
|
28
28
|
//
|
|
29
29
|
// Message resolution per item: `data-message-key` found in the i18n
|
|
30
|
-
// catalog → `t(key, { field, code })`; otherwise
|
|
31
|
-
// otherwise `t('fieldErrors.unknown')`. Localize once
|
|
30
|
+
// catalog → `t(key, { field, code, ...data-message-params })`; otherwise
|
|
31
|
+
// the item's own text; otherwise `t('fieldErrors.unknown')`. Localize once
|
|
32
|
+
// via `setMessages()`. `data-message-params` is an optional JSON object of
|
|
33
|
+
// server-provided interpolation values (constraint declarations, validation
|
|
34
|
+
// row columns) for translations with placeholders beyond {field}/{code}.
|
|
32
35
|
//
|
|
33
36
|
// Server errors are stale the moment the user edits the field or
|
|
34
37
|
// resubmits: cleared on first `input`/`change` per field, on `submit` /
|
|
@@ -85,6 +88,22 @@ function resolveMessage(item) {
|
|
|
85
88
|
field: item.getAttribute('data-field') ?? '',
|
|
86
89
|
code: item.getAttribute('data-code') ?? '',
|
|
87
90
|
};
|
|
91
|
+
// Optional server-provided interpolation params (a JSON object), so a
|
|
92
|
+
// catalog translation may use placeholders beyond {field}/{code} — e.g.
|
|
93
|
+
// data-message-params='{"stock": 5}' for "在庫 {stock} を超えています。".
|
|
94
|
+
// Item params win over the implicit field/code; malformed or non-object
|
|
95
|
+
// JSON degrades to the attribute being ignored.
|
|
96
|
+
const raw = item.getAttribute('data-message-params');
|
|
97
|
+
if (raw) {
|
|
98
|
+
try {
|
|
99
|
+
const extra = JSON.parse(raw);
|
|
100
|
+
if (extra && typeof extra === 'object' && !Array.isArray(extra)) {
|
|
101
|
+
Object.assign(params, extra);
|
|
102
|
+
}
|
|
103
|
+
} catch {
|
|
104
|
+
/* malformed JSON — keep the default params */
|
|
105
|
+
}
|
|
106
|
+
}
|
|
88
107
|
if (key && hasMessage(key)) return t(key, params);
|
|
89
108
|
const text = item.textContent.trim();
|
|
90
109
|
if (text) return text;
|
package/dist/hc-combobox.css
CHANGED
package/dist/hc-command.css
CHANGED
package/dist/hc-datagrid.css
CHANGED
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
/* Contextual shadow cast by a frozen column's trailing edge — its
|
|
39
39
|
direction flips per edge (see the frozen-edge rules below), so it
|
|
40
40
|
stays a CSS-local var, not a theme token. */
|
|
41
|
-
--hc-datagrid-freeze-shadow: 2px 0 4px -2px
|
|
41
|
+
--hc-datagrid-freeze-shadow: 2px 0 4px -2px var(--hc-shadow-edge);
|
|
42
42
|
|
|
43
43
|
position: relative;
|
|
44
44
|
border: 1px solid var(--hc-datagrid-border);
|
|
@@ -173,7 +173,7 @@
|
|
|
173
173
|
|
|
174
174
|
/* RTL: the freeze line falls on the other (inline-end) side. */
|
|
175
175
|
.hc-datagrid:dir(rtl) {
|
|
176
|
-
--hc-datagrid-freeze-shadow: -2px 0 4px -2px
|
|
176
|
+
--hc-datagrid-freeze-shadow: -2px 0 4px -2px var(--hc-shadow-edge);
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
/* ---- States ----
|
|
@@ -355,7 +355,7 @@
|
|
|
355
355
|
line-height: 1.4;
|
|
356
356
|
white-space: normal;
|
|
357
357
|
overflow-wrap: anywhere;
|
|
358
|
-
box-shadow:
|
|
358
|
+
box-shadow: var(--hc-shadow-lg);
|
|
359
359
|
pointer-events: none;
|
|
360
360
|
}
|
|
361
361
|
|
package/dist/hc-dialog.css
CHANGED
package/dist/hc-drawer.css
CHANGED
package/dist/hc-hovercard.css
CHANGED
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
color: var(--hc-hovercard-fg);
|
|
41
41
|
inline-size: max-content;
|
|
42
42
|
max-inline-size: var(--hc-hovercard-max-width);
|
|
43
|
-
box-shadow:
|
|
43
|
+
box-shadow: var(--hc-shadow-lg);
|
|
44
44
|
|
|
45
45
|
/* Shared directional placement (hc-anchored.css). */
|
|
46
46
|
--hc-anchored-offset: var(--hc-hovercard-offset);
|
package/dist/hc-menu.css
CHANGED
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
color: var(--hc-menu-fg);
|
|
35
35
|
min-inline-size: var(--hc-menu-min-width);
|
|
36
36
|
max-inline-size: var(--hc-menu-max-width);
|
|
37
|
-
box-shadow:
|
|
37
|
+
box-shadow: var(--hc-shadow-lg);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
/* Anchor Positioning path. installMenu injects the matching
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
min-inline-size: var(--hc-multicombobox-listbox-min-width);
|
|
118
118
|
max-block-size: var(--hc-multicombobox-listbox-max-height);
|
|
119
119
|
overflow-y: auto;
|
|
120
|
-
box-shadow:
|
|
120
|
+
box-shadow: var(--hc-shadow-lg);
|
|
121
121
|
list-style: none;
|
|
122
122
|
}
|
|
123
123
|
|
package/dist/hc-navmenu.css
CHANGED
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
background: var(--hc-navmenu-panel-bg);
|
|
78
78
|
color: var(--hc-navmenu-panel-fg);
|
|
79
79
|
min-inline-size: var(--hc-navmenu-panel-min-width);
|
|
80
|
-
box-shadow:
|
|
80
|
+
box-shadow: var(--hc-shadow-lg);
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
/* Links inside a panel stack as a readable list. */
|
package/dist/hc-popover.css
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
color: var(--hc-popover-fg);
|
|
15
15
|
min-inline-size: var(--hc-popover-min-width);
|
|
16
16
|
max-inline-size: var(--hc-popover-max-width);
|
|
17
|
-
box-shadow:
|
|
17
|
+
box-shadow: var(--hc-shadow-lg);
|
|
18
18
|
|
|
19
19
|
/* Shared directional placement (hc-anchored.css). Anchoring is opt-in via
|
|
20
20
|
* data-side + installPopover; a bare popover stays browser-positioned. */
|
package/dist/hc-switch.css
CHANGED
package/dist/hc-tabs.css
CHANGED
|
@@ -226,12 +226,12 @@
|
|
|
226
226
|
|
|
227
227
|
.hc-tabs__scroll[data-dir="start"] {
|
|
228
228
|
inset-inline-start: 0;
|
|
229
|
-
box-shadow: 4px 0 6px -4px
|
|
229
|
+
box-shadow: 4px 0 6px -4px var(--hc-shadow-edge);
|
|
230
230
|
}
|
|
231
231
|
|
|
232
232
|
.hc-tabs__scroll[data-dir="end"] {
|
|
233
233
|
inset-inline-end: 0;
|
|
234
|
-
box-shadow: -4px 0 6px -4px
|
|
234
|
+
box-shadow: -4px 0 6px -4px var(--hc-shadow-edge);
|
|
235
235
|
}
|
|
236
236
|
|
|
237
237
|
.hc-tabs__scroll::before {
|
package/dist/hc-toast.css
CHANGED
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
border: 1px solid var(--hc-toast-info-border);
|
|
67
67
|
background: var(--hc-toast-info-bg);
|
|
68
68
|
color: var(--hc-toast-info-fg);
|
|
69
|
-
box-shadow:
|
|
69
|
+
box-shadow: var(--hc-shadow-md);
|
|
70
70
|
|
|
71
71
|
/* Horizontal drag is the swipe-to-dismiss gesture; the behavior animates
|
|
72
72
|
* the snap-back / fly-out via these transitions. */
|