@nice2dev/ui-core 1.1.6 → 1.1.9
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 +125 -0
- package/dist/core/cssColor.d.ts +12 -0
- package/dist/core/hooks.d.ts +3 -2
- package/dist/core/marks.d.ts +40 -0
- package/dist/core/theme.d.ts +1 -1
- package/dist/core/traceless.d.ts +1 -0
- package/dist/core/useControllableState.d.ts +20 -4
- package/dist/index.cjs +26 -26
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +8214 -7991
- package/package.json +2 -2
- package/dist/core/NiceFieldStatus.d.ts.map +0 -1
- package/dist/core/NiceInlineHelp.d.ts.map +0 -1
- package/dist/core/NiceThemeProvider.d.ts.map +0 -1
- package/dist/core/NiceThemeVariants.d.ts.map +0 -1
- package/dist/core/NiceUserPreferences.d.ts.map +0 -1
- package/dist/core/a11y-advanced.d.ts.map +0 -1
- package/dist/core/a11y.d.ts.map +0 -1
- package/dist/core/access-control.d.ts.map +0 -1
- package/dist/core/adapters.d.ts.map +0 -1
- package/dist/core/ai.d.ts.map +0 -1
- package/dist/core/animations.d.ts.map +0 -1
- package/dist/core/colorBlind.d.ts.map +0 -1
- package/dist/core/datasource-advanced.d.ts.map +0 -1
- package/dist/core/datasource-aggregation.d.ts.map +0 -1
- package/dist/core/datasource-hooks.d.ts.map +0 -1
- package/dist/core/datasource-offline.d.ts.map +0 -1
- package/dist/core/datasource.d.ts.map +0 -1
- package/dist/core/deprecation.d.ts.map +0 -1
- package/dist/core/displayMode.d.ts.map +0 -1
- package/dist/core/displayStyle.d.ts.map +0 -1
- package/dist/core/filterToSql.d.ts.map +0 -1
- package/dist/core/helpContext.d.ts.map +0 -1
- package/dist/core/hooks.d.ts.map +0 -1
- package/dist/core/i18n.d.ts.map +0 -1
- package/dist/core/i18nDictionaries.d.ts.map +0 -1
- package/dist/core/icons.d.ts.map +0 -1
- package/dist/core/icuMessageFormat.d.ts.map +0 -1
- package/dist/core/leak-detector.d.ts.map +0 -1
- package/dist/core/omniverkTypes.d.ts.map +0 -1
- package/dist/core/pluginSystem.d.ts.map +0 -1
- package/dist/core/profiling.d.ts.map +0 -1
- package/dist/core/responsive.d.ts.map +0 -1
- package/dist/core/rtl.d.ts.map +0 -1
- package/dist/core/sanitizeHtml.d.ts.map +0 -1
- package/dist/core/spatialNav.d.ts.map +0 -1
- package/dist/core/standardProps.d.ts.map +0 -1
- package/dist/core/testing.d.ts.map +0 -1
- package/dist/core/theme.d.ts.map +0 -1
- package/dist/core/themeGallery.d.ts.map +0 -1
- package/dist/core/themePacks.d.ts.map +0 -1
- package/dist/core/themePacksExtended.d.ts.map +0 -1
- package/dist/core/themePresets.d.ts.map +0 -1
- package/dist/core/themeVariants.d.ts.map +0 -1
- package/dist/core/touch.d.ts.map +0 -1
- package/dist/core/traceless.d.ts.map +0 -1
- package/dist/core/tutorials.d.ts.map +0 -1
- package/dist/core/types.d.ts.map +0 -1
- package/dist/core/useControllableState.d.ts.map +0 -1
- package/dist/core/useGamepad.d.ts.map +0 -1
- package/dist/core/useThemeIsDark.d.ts.map +0 -1
- package/dist/core/validation.d.ts.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/performance/concurrent.d.ts.map +0 -1
- package/dist/performance/images.d.ts.map +0 -1
- package/dist/performance/index.d.ts.map +0 -1
- package/dist/performance/memory.d.ts.map +0 -1
- package/dist/performance/virtualization.d.ts.map +0 -1
- package/dist/performance/workers.d.ts.map +0 -1
- package/dist/viewSchema.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,130 @@
|
|
|
1
1
|
# @nice2dev/ui-core — Changelog
|
|
2
2
|
|
|
3
|
+
## 1.1.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 1.1.9 — themes reach the controls again, every control has a rendered demo, no breaking changes.
|
|
8
|
+
|
|
9
|
+
**Theming.** `NiceThemeProvider`, `applyTheme` and `NiceThemePreview` write the `--nice-*` tokens
|
|
10
|
+
again, so a theme recolours the controls and not only the app's own CSS — since 1.1.7 only
|
|
11
|
+
light/dark switched. The provider's scope wins over values set on `:root`, as it did before 1.1.7:
|
|
12
|
+
put a brand colour into the theme rather than on `<html>`. Alias tokens are computed in the theme
|
|
13
|
+
scope, not only on `:root`. About 1,600 places that used a text token as a background or border, or
|
|
14
|
+
a surface token as text colour, now use the token of the right role. `--nice-warning-light` and
|
|
15
|
+
`--nice-danger-light` are the light shade of the status colour, like `--nice-success-light`
|
|
16
|
+
(new: `--nice-color-warning-light`, `--nice-color-error-light`); backgrounds use `--nice-*-bg`.
|
|
17
|
+
|
|
18
|
+
**Styles that never shipped.** Six stylesheets in `@nice2dev/ui` were unreachable from its entry
|
|
19
|
+
point, so `NiceLiveDataGrid`, `NiceTaskInbox`, `NiceBPMNDesigner`, `NiceInstanceMonitor`,
|
|
20
|
+
`NiceIntegrationHub`, `NiceRulesEngine` and `NiceVideoEditor` rendered unstyled; eleven more
|
|
21
|
+
components had no stylesheet at all; `workflow.css` read its spacing scale as pixels; and
|
|
22
|
+
`NiceModuleGrid` was styled for a `<table>` it does not render.
|
|
23
|
+
|
|
24
|
+
**Language.** `useNiceTranslation()` returns `{ t, lang }` and dates are formatted in the interface
|
|
25
|
+
language rather than the browser's (`ui-presentations` adds `useNiceLang()`). `NiceInvoiceLineEditor`
|
|
26
|
+
takes its currency and units from the active language unless you pass them. `NiceAuditLog`,
|
|
27
|
+
`NiceRecordingPanel`, the four game-engine editors and `NiceTemplateEditor` are translated, the
|
|
28
|
+
game-engine dictionary is actually registered, and 136 ui-audio strings have English defaults
|
|
29
|
+
instead of rendering raw keys.
|
|
30
|
+
|
|
31
|
+
**Canvas and document colours.** Canvas never resolves `var()`: the QR and barcode generators drew a
|
|
32
|
+
black rectangle, the whiteboard lost its colours and light presets parsed to `NaN`. Data colours are
|
|
33
|
+
resolved first now. Colours stored in documents — slide templates, theme presets, brand kits,
|
|
34
|
+
exports — are literals, so a saved document looks the same in every theme.
|
|
35
|
+
|
|
36
|
+
**Fixes found by the new demos.** All 895 controls now have a rendered showcase demo, and roughly
|
|
37
|
+
every third new demo exposed a bug. `ui-platform`: the service worker re-registered on every
|
|
38
|
+
render, a screen permission prompt appeared on mount, reconnects and start-up tasks ran twice,
|
|
39
|
+
valid EAN-13 codes were rejected. `ui-ai`: `createProviderFromConfig` dropped the endpoint path —
|
|
40
|
+
OpenAI, Anthropic and Groq were called without `/v1` and Azure always threw — and the theme
|
|
41
|
+
generator failed on every request. `ui-communication`: the local participant appeared twice in a
|
|
42
|
+
conference and `activeConversationId` was ignored. `ui-buildings`: automation days were saved as
|
|
43
|
+
indices (both forms are read now), the row toggle changed the selected rule instead of the clicked
|
|
44
|
+
one, and floor-plan devices were drawn in the corner. `ui-mobile`: `NiceTouchTable` rendered invalid
|
|
45
|
+
table markup. `ui-diagrams`: arrowheads grew with the stroke width and transition clicks never fired.
|
|
46
|
+
`ui-3d`: opening a code editor before the 3D view broke the whole app. `ui-presentations`: the editor
|
|
47
|
+
clipped slides in columns narrower than 800 px.
|
|
48
|
+
|
|
49
|
+
**Additive API only.** `@nice2dev/ui-platform` now exports its hooks, provider aliases and Props / Ref
|
|
50
|
+
types. Nothing was renamed or removed.
|
|
51
|
+
|
|
52
|
+
## 1.1.8
|
|
53
|
+
|
|
54
|
+
### Patch Changes
|
|
55
|
+
|
|
56
|
+
- 1.1.8 — old problems closed, no breaking changes.
|
|
57
|
+
|
|
58
|
+
**English-first UI.** Text that was hardcoded Polish now goes through `t()` with an English
|
|
59
|
+
default: the planning views, the whole of `@nice2dev/ui-printing`, smart home, backup, the
|
|
60
|
+
navigation and settings panels, `@nice2dev/ui-buildings` end to end, the photo editor and the
|
|
61
|
+
presentation Q&A panel. The dictionary gains 566 keys in en, pl, de, fr, es and uk, so an app
|
|
62
|
+
with `locale="pl"` reads as before. Three prop defaults changed with it:
|
|
63
|
+
`NiceInvoiceLineEditor` (`currencySymbol` `'zł'` → `'$'`, `units` → English) and
|
|
64
|
+
`NiceTimeoutFeedback`'s two messages.
|
|
65
|
+
|
|
66
|
+
**Icons.** No emoji, unicode glyphs or inline `<svg>` are used as icons any more — not in JSX,
|
|
67
|
+
not in `icon:` data fields, not on canvas. Ten icons in `icons-business` / `icons-education`
|
|
68
|
+
that drew their artwork as `<text>` use paths now, and the behaviour-tree palette names resolve
|
|
69
|
+
to real `NiceIcon` builtins (`shield` and `repeat` are new; 176 in total).
|
|
70
|
+
|
|
71
|
+
**Fixes.** The shadcn adapter reads the host's `--primary` / `--accent` again instead of
|
|
72
|
+
producing invalid `hsl(#hex)`; `ui-diagrams` ships the 21 translation keys its components were
|
|
73
|
+
already asking for; `--nice-font-size-2xl` is declared; `NiceScheduler` warns in development
|
|
74
|
+
when it ignores a `currentDate`, `view` or `events` change; `ui-buildings` typechecks clean and
|
|
75
|
+
`DeviceProtocol` accepts `'mqtt'`.
|
|
76
|
+
|
|
77
|
+
**Docs.** `doc.json` no longer lists CSS variables no component implements; eleven components
|
|
78
|
+
document the tokens their stylesheets really read.
|
|
79
|
+
|
|
80
|
+
## 1.1.7
|
|
81
|
+
|
|
82
|
+
### Patch Changes
|
|
83
|
+
|
|
84
|
+
- Close the three items left open in the 1.1.6 response to OmniVerk.
|
|
85
|
+
|
|
86
|
+
**Every value control works without state in the parent.** The `audit-controllable-state` gate
|
|
87
|
+
counted 87 value props that were required with no `default*`, so the control could not render from a
|
|
88
|
+
manifest without data. It now reports 0 and gates CI at `--max=0`. 48 controls gained `default*` props
|
|
89
|
+
through `useControllableState` (existing `value` + handler call sites behave as before); 33 read-only
|
|
90
|
+
data lists are optional with a stable empty default; 4 props paired with a handler only by name are
|
|
91
|
+
optional; `NiceWhiteboard` and `NiceMetricsDashboard` render an empty state until a session or
|
|
92
|
+
dashboard arrives. Additive API only — nothing renamed or removed.
|
|
93
|
+
|
|
94
|
+
- `NicePivotGrid.fields`, `NiceScheduler.events` and `NiceGitHooks.hooks` are controlled only together
|
|
95
|
+
with their change handler, as `NiceScheduler` already documented for `currentDate`/`view`. A bare
|
|
96
|
+
prop stays an initial value; prop plus handler now always wins (later prop updates used to be
|
|
97
|
+
ignored). `NiceGitHooks.onHookChange` is now called; `onHooksChange` and
|
|
98
|
+
`NiceLocaleManager.onTranslationsChange` are new.
|
|
99
|
+
- `NiceCodeEditor` / `NiceCodeDiffEditor` no longer report a value written from the prop back through
|
|
100
|
+
`onChange`, and call the latest handler rather than the one captured at mount.
|
|
101
|
+
- `NiceHtmlEditor` no longer rewrites its content on every render (React 19 compares the
|
|
102
|
+
`dangerouslySetInnerHTML` object, not its string), which moved the caret; the HTML source and
|
|
103
|
+
Markdown views can be closed again.
|
|
104
|
+
- Selections seeded once from the first item (access manager, automation/scene editors, git diff
|
|
105
|
+
viewer, ribbon, setup wizard) follow data that arrives after mount.
|
|
106
|
+
- `useControllableState`: new `fallbackValue` seed that never triggers the value/default clash warning;
|
|
107
|
+
two functional updates in one tick no longer lose the first; `onChange` is called with one argument
|
|
108
|
+
when there is no meta. `UseControllableStateOptions` is now a union type alias.
|
|
109
|
+
|
|
110
|
+
**`--nice-*` is the source of truth for design tokens.** Controls read only `--nice-*` (9,225 reads in
|
|
111
|
+
339 files). The unprefixed names (`--color-primary`, `--bg-primary`, `--text-muted`, …) stay declared
|
|
112
|
+
as aliases pointing at the Nice tokens, so reading them works, but setting them no longer repaints Nice
|
|
113
|
+
controls. Apps that relied on that can import `@nice2dev/ui/css/legacy-bg-text-aliases.css` after
|
|
114
|
+
`style.css` (removed in 1.2), or set `--nice-color-primary` and friends directly. 13 tokens that were
|
|
115
|
+
read and never declared (`--color-danger`, `--text-on-primary`, `--color-white`, …) are defined; the
|
|
116
|
+
dark blocks define the canonical names, so `.nice-dark` on `<body>` no longer leaves them on light
|
|
117
|
+
values; `--nice-primary-bg` and `--nice-selected-bg` are a primary tint instead of falling through to
|
|
118
|
+
grey. New gate `audit-token-names`.
|
|
119
|
+
|
|
120
|
+
**Node ESM and `require()`.** `@nice2dev/spatial-core` imports from plain Node ESM (51 relative
|
|
121
|
+
specifiers gained extensions, enforced by `nodenext`), and so does `@nice2dev/ui-buildings`, which
|
|
122
|
+
failed through it. `require()` works for `ui-3d`, `ui-graphics` and `game-engine`. The package-exports
|
|
123
|
+
gate now loads every entry in both module systems.
|
|
124
|
+
|
|
125
|
+
**Hygiene.** Sources are prettier-formatted and CI gates on it; 640 stale `.d.ts` files were removed
|
|
126
|
+
from source trees (never published).
|
|
127
|
+
|
|
3
128
|
## 1.1.6
|
|
4
129
|
|
|
5
130
|
No changes in this release.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canvas and WebGL APIs take a colour string but do not understand CSS custom properties:
|
|
3
|
+
* `ctx.fillStyle = 'var(--nice-bg, #fff)'` is silently ignored and the previous colour
|
|
4
|
+
* stays. `resolveCssColor` turns a `var(--name, fallback)` into the value it has on
|
|
5
|
+
* `element` (pass the canvas, so a theme scoped to a wrapper applies), falling back
|
|
6
|
+
* through nested `var()` fallbacks. Any other string is returned unchanged. An element
|
|
7
|
+
* that is not in the document (an offscreen canvas) resolves against the root.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ctx.fillStyle = resolveCssColor('var(--nice-bg-primary, #fff)', ctx.canvas);
|
|
11
|
+
*/
|
|
12
|
+
export declare function resolveCssColor(color: string, element?: Element | OffscreenCanvas | null): string;
|
package/dist/core/hooks.d.ts
CHANGED
|
@@ -143,8 +143,9 @@ export declare function useBrandColors(imageSource: string | HTMLImageElement |
|
|
|
143
143
|
*
|
|
144
144
|
* @example
|
|
145
145
|
* ```tsx
|
|
146
|
-
* const palette = generatePaletteFromColor('
|
|
147
|
-
* // {
|
|
146
|
+
* const palette = generatePaletteFromColor('#3b82f6');
|
|
147
|
+
* // { lightest: '#…', …, base: '#3b82f6', …, text: '#000000', textInverse: '#ffffff' }
|
|
148
|
+
* // — hex in, hex out (the input is parsed as #rrggbb)
|
|
148
149
|
* ```
|
|
149
150
|
*/
|
|
150
151
|
export declare function generatePaletteFromColor(baseColor: string): {
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* CSS-drawn marks — the SOURCE OF TRUTH (TODO_1.1.9 B6).
|
|
4
|
+
*
|
|
5
|
+
* Eight packages (`social`, `templates`, `ui-security`, `licensing`, `ui-mobile`,
|
|
6
|
+
* `ui-platform`, `ui-science`, `auth`) ship with `dependencies: {}` — react and react-dom
|
|
7
|
+
* peers only — so they cannot reach `@nice2dev/icons` for a glyph. Each had grown its own
|
|
8
|
+
* copy of the same shapes, in three different unit systems: `licensing/src/marks.tsx` in
|
|
9
|
+
* `em`, `auth`'s refresh ring in `px` inside `NiceCaptcha.css`, `social/src/shapes.tsx` as
|
|
10
|
+
* `clip-path`. Three implementations of one open ring is exactly the drift B6 named.
|
|
11
|
+
*
|
|
12
|
+
* This module is that one implementation. Packages that depend on `@nice2dev/ui-core`
|
|
13
|
+
* import it from here; the dependency-free ones carry a GENERATED copy, kept identical by
|
|
14
|
+
* `scripts/audit-marks-sync.mjs` (gate `P1.8 marks-sync`, regenerate with `--write`).
|
|
15
|
+
*
|
|
16
|
+
* Units are `em` throughout, so a mark scales with the control it sits in — the `px`
|
|
17
|
+
* version did not. Colour is always `currentColor`, which keeps a mark on the foreground
|
|
18
|
+
* side of the token roles the P1.5 ratchets enforce. Every mark is `aria-hidden`: the
|
|
19
|
+
* accessible name belongs to the button or label that contains it, never to the mark.
|
|
20
|
+
*
|
|
21
|
+
* This is the sanctioned exception to the "icons come from @nice2dev/icons only" rule in
|
|
22
|
+
* CLAUDE.md: it applies where an icon dependency is not available at all, and it draws
|
|
23
|
+
* geometry with borders rather than substituting a glyph or an emoji.
|
|
24
|
+
*/
|
|
25
|
+
export interface NiceMarkProps {
|
|
26
|
+
/** Merged over the mark's own inline style. */
|
|
27
|
+
style?: React.CSSProperties;
|
|
28
|
+
}
|
|
29
|
+
/** Tick, drawn as two borders of a rotated box. */
|
|
30
|
+
export declare const CheckMark: React.FC<NiceMarkProps>;
|
|
31
|
+
/** Open ring, read as "reload"; the button it sits in carries the accessible name. */
|
|
32
|
+
export declare const RefreshMark: React.FC<NiceMarkProps>;
|
|
33
|
+
/** Chevron for expand / collapse affordances. */
|
|
34
|
+
export declare const ChevronMark: React.FC<NiceMarkProps & {
|
|
35
|
+
direction: 'up' | 'down';
|
|
36
|
+
}>;
|
|
37
|
+
/** Filled dot, for status and presence indicators. */
|
|
38
|
+
export declare const DotMark: React.FC<NiceMarkProps>;
|
|
39
|
+
/** Close affordance: two strokes crossed, instead of a `×` glyph. */
|
|
40
|
+
export declare const CloseMark: React.FC<NiceMarkProps>;
|
package/dist/core/theme.d.ts
CHANGED
|
@@ -42,7 +42,7 @@ export interface NiceThemeBackgrounds {
|
|
|
42
42
|
export interface NiceThemeBackgroundImage {
|
|
43
43
|
/** Background type */
|
|
44
44
|
type?: 'none' | 'solid' | 'gradient' | 'image' | 'pattern';
|
|
45
|
-
/** CSS gradient string (e.g. 'linear-gradient(135deg, var(--nice-accent, #667eea) 0%, var(--nice-accent-
|
|
45
|
+
/** CSS gradient string (e.g. 'linear-gradient(135deg, var(--nice-accent, #667eea) 0%, var(--nice-color-accent-hover, #764ba2) 100%)') */
|
|
46
46
|
gradient?: string;
|
|
47
47
|
/** Image URL */
|
|
48
48
|
imageUrl?: string;
|
package/dist/core/traceless.d.ts
CHANGED
|
@@ -1,14 +1,30 @@
|
|
|
1
1
|
import type { NiceChangeMeta, NiceOnChange } from './standardProps';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Where uncontrolled state is seeded from. Two roles that used to share one field:
|
|
4
|
+
* `defaultValue` is the consumer's raw `default*` prop (the only thing the
|
|
5
|
+
* value+default clash warning looks at), `fallbackValue` is the control's own
|
|
6
|
+
* empty seed (`''`, `[]`, `0`) and never triggers a warning. One of them must be
|
|
7
|
+
* a `T`, so the returned value is always a `T`.
|
|
8
|
+
*/
|
|
9
|
+
export type UseControllableStateSeed<T> = {
|
|
5
10
|
/** Initial value used in uncontrolled mode. */
|
|
6
11
|
defaultValue: T;
|
|
12
|
+
/** Seed used when `defaultValue` is undefined. */
|
|
13
|
+
fallbackValue?: T;
|
|
14
|
+
} | {
|
|
15
|
+
/** The consumer's `default*` prop, possibly undefined. */
|
|
16
|
+
defaultValue?: T | undefined;
|
|
17
|
+
/** Seed used when `defaultValue` is undefined. Never triggers the clash warning. */
|
|
18
|
+
fallbackValue: T;
|
|
19
|
+
};
|
|
20
|
+
export type UseControllableStateOptions<T, TEvent = unknown> = {
|
|
21
|
+
/** Controlled value. When defined, hook is in controlled mode. */
|
|
22
|
+
value?: T;
|
|
7
23
|
/** Change callback invoked in both modes. */
|
|
8
24
|
onChange?: NiceOnChange<T, TEvent>;
|
|
9
25
|
/** Component name (used for dev warnings). */
|
|
10
26
|
componentName?: string;
|
|
11
|
-
}
|
|
27
|
+
} & UseControllableStateSeed<T>;
|
|
12
28
|
export type UseControllableStateReturn<T, TEvent = unknown> = readonly [
|
|
13
29
|
T,
|
|
14
30
|
(next: T | ((prev: T) => T), meta?: NiceChangeMeta<TEvent>) => void,
|