@nice2dev/ui-api 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 CHANGED
@@ -1,5 +1,106 @@
1
1
  # @nice2dev/ui-api
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
+ No changes in this release.
55
+
56
+ ## 1.1.7
57
+
58
+ ### Patch Changes
59
+
60
+ - Close the three items left open in the 1.1.6 response to OmniVerk.
61
+
62
+ **Every value control works without state in the parent.** The `audit-controllable-state` gate
63
+ counted 87 value props that were required with no `default*`, so the control could not render from a
64
+ manifest without data. It now reports 0 and gates CI at `--max=0`. 48 controls gained `default*` props
65
+ through `useControllableState` (existing `value` + handler call sites behave as before); 33 read-only
66
+ data lists are optional with a stable empty default; 4 props paired with a handler only by name are
67
+ optional; `NiceWhiteboard` and `NiceMetricsDashboard` render an empty state until a session or
68
+ dashboard arrives. Additive API only — nothing renamed or removed.
69
+
70
+ - `NicePivotGrid.fields`, `NiceScheduler.events` and `NiceGitHooks.hooks` are controlled only together
71
+ with their change handler, as `NiceScheduler` already documented for `currentDate`/`view`. A bare
72
+ prop stays an initial value; prop plus handler now always wins (later prop updates used to be
73
+ ignored). `NiceGitHooks.onHookChange` is now called; `onHooksChange` and
74
+ `NiceLocaleManager.onTranslationsChange` are new.
75
+ - `NiceCodeEditor` / `NiceCodeDiffEditor` no longer report a value written from the prop back through
76
+ `onChange`, and call the latest handler rather than the one captured at mount.
77
+ - `NiceHtmlEditor` no longer rewrites its content on every render (React 19 compares the
78
+ `dangerouslySetInnerHTML` object, not its string), which moved the caret; the HTML source and
79
+ Markdown views can be closed again.
80
+ - Selections seeded once from the first item (access manager, automation/scene editors, git diff
81
+ viewer, ribbon, setup wizard) follow data that arrives after mount.
82
+ - `useControllableState`: new `fallbackValue` seed that never triggers the value/default clash warning;
83
+ two functional updates in one tick no longer lose the first; `onChange` is called with one argument
84
+ when there is no meta. `UseControllableStateOptions` is now a union type alias.
85
+
86
+ **`--nice-*` is the source of truth for design tokens.** Controls read only `--nice-*` (9,225 reads in
87
+ 339 files). The unprefixed names (`--color-primary`, `--bg-primary`, `--text-muted`, …) stay declared
88
+ as aliases pointing at the Nice tokens, so reading them works, but setting them no longer repaints Nice
89
+ controls. Apps that relied on that can import `@nice2dev/ui/css/legacy-bg-text-aliases.css` after
90
+ `style.css` (removed in 1.2), or set `--nice-color-primary` and friends directly. 13 tokens that were
91
+ read and never declared (`--color-danger`, `--text-on-primary`, `--color-white`, …) are defined; the
92
+ dark blocks define the canonical names, so `.nice-dark` on `<body>` no longer leaves them on light
93
+ values; `--nice-primary-bg` and `--nice-selected-bg` are a primary tint instead of falling through to
94
+ grey. New gate `audit-token-names`.
95
+
96
+ **Node ESM and `require()`.** `@nice2dev/spatial-core` imports from plain Node ESM (51 relative
97
+ specifiers gained extensions, enforced by `nodenext`), and so does `@nice2dev/ui-buildings`, which
98
+ failed through it. `require()` works for `ui-3d`, `ui-graphics` and `game-engine`. The package-exports
99
+ gate now loads every entry in both module systems.
100
+
101
+ **Hygiene.** Sources are prettier-formatted and CI gates on it; 640 stale `.d.ts` files were removed
102
+ from source trees (never published).
103
+
3
104
  ## 1.1.6
4
105
 
5
106
  No changes in this release.
@@ -1,25 +1,25 @@
1
1
  import { jsxs as m, jsx as e } from "react/jsx-runtime";
2
- import { A as g } from "./index-HyLjDY_p.js";
2
+ import { x as g } from "./index-COUwI_-v.js";
3
3
  import { forwardRef as be, useRef as V, useState as f, useMemo as _e, useCallback as l, useEffect as q, useImperativeHandle as xe } from "react";
4
- function ye(o, r) {
4
+ function ye(r, o) {
5
5
  var a;
6
- const t = ((a = o.split(".").pop()) == null ? void 0 : a.toLowerCase().split("?")[0]) ?? "";
7
- return t === "pdf" ? "pdf" : ["jpg", "jpeg", "png", "gif", "bmp", "webp", "svg", "ico", "tiff", "tif"].includes(t) ? "image" : ["mp4", "webm", "ogg", "mov", "avi", "mkv"].includes(t) ? "video" : ["mp3", "wav", "flac", "aac", "m4a", "ogg"].includes(t) ? "audio" : ["doc", "docx", "xls", "xlsx", "ppt", "pptx", "odt", "ods", "odp"].includes(t) ? "office" : t === "html" || t === "htm" ? "html" : ["txt", "log", "md", "json", "xml", "csv", "yaml", "yml"].includes(t) ? "text" : "unknown";
6
+ const n = ((a = r.split(".").pop()) == null ? void 0 : a.toLowerCase().split("?")[0]) ?? "";
7
+ return n === "pdf" ? "pdf" : ["jpg", "jpeg", "png", "gif", "bmp", "webp", "svg", "ico", "tiff", "tif"].includes(n) ? "image" : ["mp4", "webm", "ogg", "mov", "avi", "mkv"].includes(n) ? "video" : ["mp3", "wav", "flac", "aac", "m4a", "ogg"].includes(n) ? "audio" : ["doc", "docx", "xls", "xlsx", "ppt", "pptx", "odt", "ods", "odp"].includes(n) ? "office" : n === "html" || n === "htm" ? "html" : ["txt", "log", "md", "json", "xml", "csv", "yaml", "yml"].includes(n) ? "text" : "unknown";
8
8
  }
9
- function ke(o) {
10
- if (o === 0)
9
+ function ke(r) {
10
+ if (r === 0)
11
11
  return "0 B";
12
- const r = 1024, t = ["B", "KB", "MB", "GB"], a = Math.floor(Math.log(o) / Math.log(r));
13
- return parseFloat((o / Math.pow(r, a)).toFixed(1)) + " " + t[a];
12
+ const o = 1024, n = ["B", "KB", "MB", "GB"], a = Math.floor(Math.log(r) / Math.log(o));
13
+ return parseFloat((r / Math.pow(o, a)).toFixed(1)) + " " + n[a];
14
14
  }
15
- function Ce(o) {
16
- const r = Math.floor(o / 3600), t = Math.floor(o % 3600 / 60), a = Math.floor(o % 60);
17
- return r > 0 ? `${r}:${t.toString().padStart(2, "0")}:${a.toString().padStart(2, "0")}` : `${t}:${a.toString().padStart(2, "0")}`;
15
+ function Ce(r) {
16
+ const o = Math.floor(r / 3600), n = Math.floor(r % 3600 / 60), a = Math.floor(r % 60);
17
+ return o > 0 ? `${o}:${n.toString().padStart(2, "0")}:${a.toString().padStart(2, "0")}` : `${n}:${a.toString().padStart(2, "0")}`;
18
18
  }
19
19
  function Ne({
20
- src: o,
21
- page: r,
22
- zoom: t,
20
+ src: r,
21
+ page: o,
22
+ zoom: n,
23
23
  rotation: a,
24
24
  onPageChange: u,
25
25
  onLoad: d,
@@ -41,11 +41,11 @@ function Ne({
41
41
  );
42
42
  }
43
43
  p ? s.GlobalWorkerOptions.workerSrc = p : s.version && (s.GlobalWorkerOptions.workerSrc = `https://cdnjs.cloudflare.com/ajax/libs/pdf.js/${s.version}/pdf.worker.min.js`);
44
- const b = await s.getDocument(o).promise;
44
+ const b = await s.getDocument(r).promise;
45
45
  if (x)
46
46
  return;
47
47
  z.current = b, J(b.numPages), d({
48
- name: o.split("/").pop() ?? "document.pdf",
48
+ name: r.split("/").pop() ?? "document.pdf",
49
49
  type: "pdf",
50
50
  mimeType: "application/pdf",
51
51
  pageCount: b.numPages
@@ -56,7 +56,7 @@ function Ne({
56
56
  })(), () => {
57
57
  x = !0;
58
58
  };
59
- }, [o, p, d, h]), q(() => {
59
+ }, [r, p, d, h]), q(() => {
60
60
  const x = z.current, s = v.current;
61
61
  if (!x || !s || _ === 0)
62
62
  return;
@@ -65,10 +65,10 @@ function Ne({
65
65
  if (!U) {
66
66
  B(!0);
67
67
  try {
68
- const P = Math.max(1, Math.min(r, _)), M = await x.getPage(P);
68
+ const P = Math.max(1, Math.min(o, _)), M = await x.getPage(P);
69
69
  if (b)
70
70
  return;
71
- const y = M.getViewport({ scale: t, rotation: a }), E = s.getContext("2d");
71
+ const y = M.getViewport({ scale: n, rotation: a }), E = s.getContext("2d");
72
72
  if (!E)
73
73
  return;
74
74
  s.height = y.height, s.width = y.width, await M.render({
@@ -84,12 +84,12 @@ function Ne({
84
84
  })(), () => {
85
85
  b = !0;
86
86
  };
87
- }, [r, t, a, _, U]), /* @__PURE__ */ e("div", { className: "nice-document-viewer__pdf", children: /* @__PURE__ */ e("canvas", { ref: v, className: "nice-document-viewer__pdf-canvas" }) });
87
+ }, [o, n, a, _, U]), /* @__PURE__ */ e("div", { className: "nice-document-viewer__pdf", children: /* @__PURE__ */ e("canvas", { ref: v, className: "nice-document-viewer__pdf-canvas" }) });
88
88
  }
89
89
  function ze({
90
- src: o,
91
- zoom: r,
92
- rotation: t,
90
+ src: r,
91
+ zoom: o,
92
+ rotation: n,
93
93
  onLoad: a,
94
94
  onError: u
95
95
  }) {
@@ -97,50 +97,50 @@ function ze({
97
97
  (z) => {
98
98
  const _ = z.currentTarget;
99
99
  h(!0), a({
100
- name: o.split("/").pop() ?? "image",
100
+ name: r.split("/").pop() ?? "image",
101
101
  type: "image",
102
102
  width: _.naturalWidth,
103
103
  height: _.naturalHeight
104
104
  });
105
105
  },
106
- [o, a]
106
+ [r, a]
107
107
  ), v = l(() => {
108
108
  u(new Error("Failed to load image"));
109
109
  }, [u]);
110
110
  return /* @__PURE__ */ e("div", { className: "nice-document-viewer__image", children: /* @__PURE__ */ e(
111
111
  "img",
112
112
  {
113
- src: o,
113
+ src: r,
114
114
  alt: "Document",
115
115
  onLoad: p,
116
116
  onError: v,
117
117
  style: {
118
- transform: `scale(${r}) rotate(${t}deg)`,
118
+ transform: `scale(${o}) rotate(${n}deg)`,
119
119
  opacity: d ? 1 : 0
120
120
  },
121
121
  draggable: !1
122
122
  }
123
123
  ) });
124
124
  }
125
- function Ee({ src: o, type: r, onLoad: t, onError: a }) {
125
+ function Ee({ src: r, type: o, onLoad: n, onError: a }) {
126
126
  const u = V(null), d = l(() => {
127
127
  const p = u.current;
128
128
  if (!p)
129
129
  return;
130
130
  const v = {
131
- name: o.split("/").pop() ?? (r === "video" ? "video" : "audio"),
132
- type: r,
131
+ name: r.split("/").pop() ?? (o === "video" ? "video" : "audio"),
132
+ type: o,
133
133
  duration: p.duration
134
134
  };
135
- r === "video" && "videoWidth" in p && (v.width = p.videoWidth, v.height = p.videoHeight), t(v);
136
- }, [o, r, t]), h = l(() => {
137
- a(new Error(`Failed to load ${r}`));
138
- }, [r, a]);
139
- return r === "video" ? /* @__PURE__ */ e("div", { className: "nice-document-viewer__video", children: /* @__PURE__ */ e(
135
+ o === "video" && "videoWidth" in p && (v.width = p.videoWidth, v.height = p.videoHeight), n(v);
136
+ }, [r, o, n]), h = l(() => {
137
+ a(new Error(`Failed to load ${o}`));
138
+ }, [o, a]);
139
+ return o === "video" ? /* @__PURE__ */ e("div", { className: "nice-document-viewer__video", children: /* @__PURE__ */ e(
140
140
  "video",
141
141
  {
142
142
  ref: u,
143
- src: o,
143
+ src: r,
144
144
  controls: !0,
145
145
  onLoadedMetadata: d,
146
146
  onError: h
@@ -149,20 +149,20 @@ function Ee({ src: o, type: r, onLoad: t, onError: a }) {
149
149
  "audio",
150
150
  {
151
151
  ref: u,
152
- src: o,
152
+ src: r,
153
153
  controls: !0,
154
154
  onLoadedMetadata: d,
155
155
  onError: h
156
156
  }
157
157
  ) });
158
158
  }
159
- function Le({ src: o, viewerUrl: r, onLoad: t }) {
160
- const [a, u] = f(!1), d = `${r ?? "https://view.officeapps.live.com/op/embed.aspx?src="}${encodeURIComponent(o)}`, h = l(() => {
161
- u(!0), t({
162
- name: o.split("/").pop() ?? "document",
159
+ function Le({ src: r, viewerUrl: o, onLoad: n }) {
160
+ const [a, u] = f(!1), d = `${o ?? "https://view.officeapps.live.com/op/embed.aspx?src="}${encodeURIComponent(r)}`, h = l(() => {
161
+ u(!0), n({
162
+ name: r.split("/").pop() ?? "document",
163
163
  type: "office"
164
164
  });
165
- }, [o, t]);
165
+ }, [r, n]);
166
166
  return /* @__PURE__ */ e("div", { className: "nice-document-viewer__office", children: /* @__PURE__ */ e(
167
167
  "iframe",
168
168
  {
@@ -173,45 +173,45 @@ function Le({ src: o, viewerUrl: r, onLoad: t }) {
173
173
  }
174
174
  ) });
175
175
  }
176
- function je({ src: o, onLoad: r, onError: t }) {
176
+ function je({ src: r, onLoad: o, onError: n }) {
177
177
  const [a, u] = f(null);
178
178
  return q(() => {
179
- fetch(o).then((d) => {
179
+ fetch(r).then((d) => {
180
180
  if (!d.ok)
181
181
  throw new Error("Failed to fetch text");
182
182
  return d.text();
183
183
  }).then((d) => {
184
- u(d), r({
185
- name: o.split("/").pop() ?? "text",
184
+ u(d), o({
185
+ name: r.split("/").pop() ?? "text",
186
186
  type: "text",
187
187
  size: d.length
188
188
  });
189
189
  }).catch((d) => {
190
- t(d instanceof Error ? d : new Error("Failed to load text"));
190
+ n(d instanceof Error ? d : new Error("Failed to load text"));
191
191
  });
192
- }, [o, r, t]), a === null ? /* @__PURE__ */ e("div", { className: "nice-document-viewer__loading", children: "Loading..." }) : /* @__PURE__ */ e("div", { className: "nice-document-viewer__text", children: /* @__PURE__ */ e("pre", { children: a }) });
192
+ }, [r, o, n]), a === null ? /* @__PURE__ */ e("div", { className: "nice-document-viewer__loading", children: "Loading..." }) : /* @__PURE__ */ e("div", { className: "nice-document-viewer__text", children: /* @__PURE__ */ e("pre", { children: a }) });
193
193
  }
194
- function Pe({ src: o, onLoad: r }) {
195
- const t = l(() => {
196
- r({
197
- name: o.split("/").pop() ?? "page.html",
194
+ function Pe({ src: r, onLoad: o }) {
195
+ const n = l(() => {
196
+ o({
197
+ name: r.split("/").pop() ?? "page.html",
198
198
  type: "html"
199
199
  });
200
- }, [o, r]);
200
+ }, [r, o]);
201
201
  return /* @__PURE__ */ e("div", { className: "nice-document-viewer__html", children: /* @__PURE__ */ e(
202
202
  "iframe",
203
203
  {
204
- src: o,
205
- onLoad: t,
204
+ src: r,
205
+ onLoad: n,
206
206
  title: "HTML Document",
207
207
  sandbox: "allow-same-origin allow-scripts"
208
208
  }
209
209
  ) });
210
210
  }
211
211
  const $e = be(
212
- function(o, r) {
212
+ function(r, o) {
213
213
  const {
214
- src: t,
214
+ src: n,
215
215
  type: a,
216
216
  name: u,
217
217
  height: d = 600,
@@ -232,28 +232,28 @@ const $e = be(
232
232
  onError: E,
233
233
  onPageChange: I,
234
234
  onZoomChange: W,
235
- pdfWorkerUrl: re,
235
+ pdfWorkerUrl: oe,
236
236
  officeViewerUrl: ie,
237
237
  loading: ae,
238
238
  errorContent: Y,
239
239
  className: ce,
240
240
  "data-testid": de
241
- } = o, Q = V(null), [n, le] = f(null), [k, se] = f(_), [L, ue] = f(p), [ee, me] = f(0), [H, te] = f(!1), [T, pe] = f(null), [fe, ne] = f(!0), C = _e(() => a ?? ye(t), [t, a]), j = l(
241
+ } = r, Q = V(null), [t, le] = f(null), [k, se] = f(_), [L, ue] = f(p), [ee, me] = f(0), [H, ne] = f(!1), [T, pe] = f(null), [fe, te] = f(!0), C = _e(() => a ?? ye(n), [n, a]), j = l(
242
242
  (i) => {
243
- le(i), ne(!1), y == null || y(i);
243
+ le(i), te(!1), y == null || y(i);
244
244
  },
245
245
  [y]
246
246
  ), A = l(
247
247
  (i) => {
248
- pe(i), ne(!1), E == null || E(i);
248
+ pe(i), te(!1), E == null || E(i);
249
249
  },
250
250
  [E]
251
251
  ), w = l(
252
252
  (i) => {
253
- const c = (n == null ? void 0 : n.pageCount) ?? 1, Z = Math.max(1, Math.min(i, c));
253
+ const c = (t == null ? void 0 : t.pageCount) ?? 1, Z = Math.max(1, Math.min(i, c));
254
254
  se(Z), I == null || I(Z);
255
255
  },
256
- [n == null ? void 0 : n.pageCount, I]
256
+ [t == null ? void 0 : t.pageCount, I]
257
257
  ), D = l(() => w(k + 1), [k, w]), F = l(() => w(k - 1), [k, w]), N = l(
258
258
  (i) => {
259
259
  const c = Math.max(v, Math.min(i, z));
@@ -264,13 +264,13 @@ const $e = be(
264
264
  me((c) => (c + i) % 360);
265
265
  }, []), O = l(() => {
266
266
  const i = document.createElement("a");
267
- i.href = t, i.download = u ?? (n == null ? void 0 : n.name) ?? "document", document.body.appendChild(i), i.click(), document.body.removeChild(i);
268
- }, [t, u, n == null ? void 0 : n.name]), X = l(() => {
269
- const i = window.open(t, "_blank");
267
+ i.href = n, i.download = u ?? (t == null ? void 0 : t.name) ?? "document", document.body.appendChild(i), i.click(), document.body.removeChild(i);
268
+ }, [n, u, t == null ? void 0 : t.name]), X = l(() => {
269
+ const i = window.open(n, "_blank");
270
270
  i && (i.onload = () => i.print());
271
- }, [t]), S = l(() => {
271
+ }, [n]), S = l(() => {
272
272
  var i, c, Z;
273
- Q.current && (H ? ((i = document.exitFullscreen) == null || i.call(document), te(!1)) : ((Z = (c = Q.current).requestFullscreen) == null || Z.call(c), te(!0)));
273
+ Q.current && (H ? ((i = document.exitFullscreen) == null || i.call(document), ne(!1)) : ((Z = (c = Q.current).requestFullscreen) == null || Z.call(c), ne(!0)));
274
274
  }, [H]);
275
275
  q(() => {
276
276
  if (!M)
@@ -289,7 +289,7 @@ const $e = be(
289
289
  w(1);
290
290
  break;
291
291
  case "End":
292
- w((n == null ? void 0 : n.pageCount) ?? 1);
292
+ w((t == null ? void 0 : t.pageCount) ?? 1);
293
293
  break;
294
294
  case "+":
295
295
  case "=":
@@ -312,13 +312,13 @@ const $e = be(
312
312
  D,
313
313
  F,
314
314
  w,
315
- n == null ? void 0 : n.pageCount,
315
+ t == null ? void 0 : t.pageCount,
316
316
  $,
317
317
  K,
318
318
  R,
319
319
  S
320
320
  ]), xe(
321
- r,
321
+ o,
322
322
  () => ({
323
323
  goToPage: w,
324
324
  nextPage: D,
@@ -331,7 +331,7 @@ const $e = be(
331
331
  download: O,
332
332
  print: X,
333
333
  toggleFullscreen: S,
334
- getInfo: () => n
334
+ getInfo: () => t
335
335
  }),
336
336
  [
337
337
  w,
@@ -345,7 +345,7 @@ const $e = be(
345
345
  O,
346
346
  X,
347
347
  S,
348
- n
348
+ t
349
349
  ]
350
350
  );
351
351
  const he = () => {
@@ -360,21 +360,21 @@ const $e = be(
360
360
  return /* @__PURE__ */ e(
361
361
  Ne,
362
362
  {
363
- src: t,
363
+ src: n,
364
364
  page: k,
365
365
  zoom: L,
366
366
  rotation: ee,
367
367
  onPageChange: w,
368
368
  onLoad: j,
369
369
  onError: A,
370
- workerUrl: re
370
+ workerUrl: oe
371
371
  }
372
372
  );
373
373
  case "image":
374
374
  return /* @__PURE__ */ e(
375
375
  ze,
376
376
  {
377
- src: t,
377
+ src: n,
378
378
  zoom: L,
379
379
  rotation: ee,
380
380
  onLoad: j,
@@ -383,13 +383,13 @@ const $e = be(
383
383
  );
384
384
  case "video":
385
385
  case "audio":
386
- return /* @__PURE__ */ e(Ee, { src: t, type: C, onLoad: j, onError: A });
386
+ return /* @__PURE__ */ e(Ee, { src: n, type: C, onLoad: j, onError: A });
387
387
  case "office":
388
- return /* @__PURE__ */ e(Le, { src: t, viewerUrl: ie, onLoad: j });
388
+ return /* @__PURE__ */ e(Le, { src: n, viewerUrl: ie, onLoad: j });
389
389
  case "text":
390
- return /* @__PURE__ */ e(je, { src: t, onLoad: j, onError: A });
390
+ return /* @__PURE__ */ e(je, { src: n, onLoad: j, onError: A });
391
391
  case "html":
392
- return /* @__PURE__ */ e(Pe, { src: t, onLoad: j });
392
+ return /* @__PURE__ */ e(Pe, { src: n, onLoad: j });
393
393
  default:
394
394
  return /* @__PURE__ */ m("div", { className: "nice-document-viewer__unknown", children: [
395
395
  /* @__PURE__ */ m("span", { children: [
@@ -399,7 +399,7 @@ const $e = be(
399
399
  /* @__PURE__ */ e("button", { type: "button", onClick: O, children: "Download" })
400
400
  ] });
401
401
  }
402
- }, ve = U && C === "pdf" && ((n == null ? void 0 : n.pageCount) ?? 0) > 1, we = B && (C === "pdf" || C === "image"), ge = P && (C === "pdf" || C === "image");
402
+ }, ve = U && C === "pdf" && ((t == null ? void 0 : t.pageCount) ?? 0) > 1, we = B && (C === "pdf" || C === "image"), ge = P && (C === "pdf" || C === "image");
403
403
  return /* @__PURE__ */ m(
404
404
  "div",
405
405
  {
@@ -429,18 +429,18 @@ const $e = be(
429
429
  value: k,
430
430
  onChange: (i) => w(parseInt(i.target.value, 10)),
431
431
  min: 1,
432
- max: (n == null ? void 0 : n.pageCount) ?? 1
432
+ max: (t == null ? void 0 : t.pageCount) ?? 1
433
433
  }
434
434
  ),
435
435
  "/ ",
436
- (n == null ? void 0 : n.pageCount) ?? 1
436
+ (t == null ? void 0 : t.pageCount) ?? 1
437
437
  ] }),
438
438
  /* @__PURE__ */ e(
439
439
  "button",
440
440
  {
441
441
  type: "button",
442
442
  onClick: D,
443
- disabled: k >= ((n == null ? void 0 : n.pageCount) ?? 1),
443
+ disabled: k >= ((t == null ? void 0 : t.pageCount) ?? 1),
444
444
  "aria-label": "Next page",
445
445
  children: /* @__PURE__ */ e(g, { name: "chevron-right", size: 16 })
446
446
  }
@@ -471,31 +471,31 @@ const $e = be(
471
471
  fe && !T && (ae ?? /* @__PURE__ */ e("div", { className: "nice-document-viewer__loading", children: "Loading..." })),
472
472
  he()
473
473
  ] }),
474
- n && /* @__PURE__ */ m("div", { className: "nice-document-viewer__info", children: [
475
- /* @__PURE__ */ e("span", { className: "nice-document-viewer__name", children: u ?? n.name }),
476
- n.size && /* @__PURE__ */ e("span", { className: "nice-document-viewer__size", children: ke(n.size) }),
477
- n.width && n.height && /* @__PURE__ */ m("span", { className: "nice-document-viewer__dimensions", children: [
478
- n.width,
474
+ t && /* @__PURE__ */ m("div", { className: "nice-document-viewer__info", children: [
475
+ /* @__PURE__ */ e("span", { className: "nice-document-viewer__name", children: u ?? t.name }),
476
+ t.size && /* @__PURE__ */ e("span", { className: "nice-document-viewer__size", children: ke(t.size) }),
477
+ t.width && t.height && /* @__PURE__ */ m("span", { className: "nice-document-viewer__dimensions", children: [
478
+ t.width,
479
479
  " × ",
480
- n.height
480
+ t.height
481
481
  ] }),
482
- n.duration && /* @__PURE__ */ e("span", { className: "nice-document-viewer__duration", children: Ce(n.duration) })
482
+ t.duration && /* @__PURE__ */ e("span", { className: "nice-document-viewer__duration", children: Ce(t.duration) })
483
483
  ] })
484
484
  ]
485
485
  }
486
486
  );
487
487
  }
488
- ), oe = "nice-document-viewer-styles";
489
- if (typeof document < "u" && !document.getElementById(oe)) {
490
- const o = document.createElement("style");
491
- o.id = oe, o.textContent = `
488
+ ), re = "nice-document-viewer-styles";
489
+ if (typeof document < "u" && !document.getElementById(re)) {
490
+ const r = document.createElement("style");
491
+ r.id = re, r.textContent = `
492
492
  .nice-document-viewer {
493
493
  display: flex;
494
494
  flex-direction: column;
495
- border: 1px solid var(--border-color, #e5e7eb);
495
+ border: 1px solid var(--nice-border-color, #e5e7eb);
496
496
  border-radius: var(--nice-radius-sm, 4px);
497
497
  overflow: hidden;
498
- background: var(--bg-primary, #ffffff);
498
+ background: var(--nice-bg-primary, #ffffff);
499
499
  }
500
500
 
501
501
  .nice-document-viewer--fullscreen {
@@ -514,8 +514,8 @@ if (typeof document < "u" && !document.getElementById(oe)) {
514
514
  align-items: center;
515
515
  justify-content: space-between;
516
516
  padding: var(--nice-space-2, 8px) var(--nice-space-3, 12px);
517
- background: var(--bg-primary, #ffffff);
518
- border-bottom: 1px solid var(--border-color, #e5e7eb);
517
+ background: var(--nice-bg-primary, #ffffff);
518
+ border-bottom: 1px solid var(--nice-border-color, #e5e7eb);
519
519
  flex-shrink: 0;
520
520
  }
521
521
 
@@ -529,15 +529,15 @@ if (typeof document < "u" && !document.getElementById(oe)) {
529
529
 
530
530
  .nice-document-viewer__toolbar button {
531
531
  padding: var(--nice-space-1-5, 6px) var(--nice-space-2-5, 10px);
532
- border: 1px solid var(--border-color, #e5e7eb);
532
+ border: 1px solid var(--nice-border-color, #e5e7eb);
533
533
  border-radius: var(--nice-radius-sm, 4px);
534
- background: var(--bg-primary, #ffffff);
534
+ background: var(--nice-bg-primary, #ffffff);
535
535
  cursor: pointer;
536
536
  font-size: 14px;
537
537
  }
538
538
 
539
539
  .nice-document-viewer__toolbar button:hover:not(:disabled) {
540
- background: var(--hover-bg, color-mix(in srgb, var(--text-primary, #000) 4%, transparent));
540
+ background: var(--nice-hover-bg, color-mix(in srgb, var(--nice-text-primary, #000) 4%, transparent));
541
541
  }
542
542
 
543
543
  .nice-document-viewer__toolbar button:disabled {
@@ -556,7 +556,7 @@ if (typeof document < "u" && !document.getElementById(oe)) {
556
556
  .nice-document-viewer__pagination input {
557
557
  width: 50px;
558
558
  padding: var(--nice-space-1, 4px);
559
- border: 1px solid var(--border-color, #e5e7eb);
559
+ border: 1px solid var(--nice-border-color, #e5e7eb);
560
560
  border-radius: var(--nice-radius-sm, 4px);
561
561
  text-align: center;
562
562
  }
@@ -585,7 +585,7 @@ if (typeof document < "u" && !document.getElementById(oe)) {
585
585
  justify-content: center;
586
586
  gap: var(--nice-space-3, 12px);
587
587
  padding: var(--nice-space-10, 40px);
588
- color: var(--text-secondary, #475569);
588
+ color: var(--nice-text-secondary, #475569);
589
589
  }
590
590
 
591
591
  .nice-document-viewer__error span {
@@ -640,7 +640,7 @@ if (typeof document < "u" && !document.getElementById(oe)) {
640
640
  height: 100%;
641
641
  overflow: auto;
642
642
  padding: var(--nice-space-4, 16px);
643
- background: var(--bg-primary, #ffffff);
643
+ background: var(--nice-bg-primary, #ffffff);
644
644
  }
645
645
 
646
646
  .nice-document-viewer__text pre {
@@ -656,18 +656,18 @@ if (typeof document < "u" && !document.getElementById(oe)) {
656
656
  align-items: center;
657
657
  gap: var(--nice-space-4, 16px);
658
658
  padding: var(--nice-space-1-5, 6px) var(--nice-space-3, 12px);
659
- background: var(--bg-primary, #ffffff);
660
- border-top: 1px solid var(--border-color, #e5e7eb);
659
+ background: var(--nice-bg-primary, #ffffff);
660
+ border-top: 1px solid var(--nice-border-color, #e5e7eb);
661
661
  font-size: 12px;
662
- color: var(--text-secondary, #475569);
662
+ color: var(--nice-text-secondary, #475569);
663
663
  flex-shrink: 0;
664
664
  }
665
665
 
666
666
  .nice-document-viewer__name {
667
667
  font-weight: 500;
668
- color: var(--text-primary, #0f172a);
668
+ color: var(--nice-text-primary, #0f172a);
669
669
  }
670
- `, document.head.appendChild(o);
670
+ `, document.head.appendChild(r);
671
671
  }
672
672
  export {
673
673
  $e as NiceDocumentViewer