@krak-stack/registry 0.11.6 → 0.11.7

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.
Files changed (42) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/components/audit-log-table/classes.d.ts +1 -0
  3. package/dist/components/audit-log-table/html.d.ts +158 -0
  4. package/dist/components/audit-log-table/html.js +3260 -0
  5. package/dist/components/audit-log-table/index.d.ts +37 -0
  6. package/dist/components/audit-log-table/react.d.ts +3 -51
  7. package/dist/components/audit-log-table/react.js +94 -77
  8. package/dist/components/audit-log-table/schema.d.ts +122 -0
  9. package/dist/components/copy-button/html.d.ts +2 -2
  10. package/dist/components/danger-confirmation/index.d.ts +2 -2
  11. package/dist/components/data-table/classes.d.ts +1 -0
  12. package/dist/components/data-table/html.d.ts +12 -12
  13. package/dist/components/data-table/html.js +9 -6
  14. package/dist/components/data-table/react.js +10 -4
  15. package/dist/components/date-input/html.d.ts +2 -2
  16. package/dist/components/editable-text/html.d.ts +2 -2
  17. package/dist/components/editable-text/index.d.ts +4 -4
  18. package/dist/components/editing-locale-switcher/html.d.ts +2 -2
  19. package/dist/components/email-editor/legacy-editor.html.d.ts +6 -6
  20. package/dist/components/form/react.d.ts +5 -5
  21. package/dist/components/locale-switcher/html.d.ts +2 -2
  22. package/dist/components/map-menu/html.d.ts +4 -4
  23. package/dist/components/presence-transition/index.d.ts +2 -2
  24. package/dist/components/select-with-custom-input/html.d.ts +2 -2
  25. package/dist/components/switch/react.d.ts +14 -0
  26. package/dist/components/switch/react.js +55 -0
  27. package/dist/components/theme-switcher/html.d.ts +2 -2
  28. package/dist/components/tracking-notice/classes.d.ts +6 -0
  29. package/dist/components/tracking-notice/html.d.ts +85 -0
  30. package/dist/components/tracking-notice/html.js +354 -0
  31. package/dist/components/tracking-notice/index.d.ts +95 -0
  32. package/dist/components/tracking-notice/react.d.ts +5 -27
  33. package/dist/components/tracking-notice/react.js +189 -59
  34. package/dist/components/tracking-notice/schema.d.ts +45 -0
  35. package/dist/components/upload-attachment/html.d.ts +4 -4
  36. package/dist/components/virtualized-combobox/html.d.ts +3 -3
  37. package/dist/components/webhook-delivery-table/html.js +9 -6
  38. package/dist/components/webhook-delivery-table/react.js +10 -4
  39. package/dist/services/events/browser.js +39 -26
  40. package/dist/services/events/index.js +23 -19
  41. package/dist/services/opentelemetry/web-vitals.js +27 -23
  42. package/package.json +9 -1
@@ -1,7 +1,7 @@
1
1
  // ../../src/components/tracking-notice/react.tsx
2
- import { useState, useSyncExternalStore } from "react";
2
+ import { useLayoutEffect, useState } from "react";
3
3
  import { createPortal } from "react-dom";
4
- import { Effect as Effect2, Schema as Schema3 } from "effect";
4
+ import { Component as Component2, View } from "effect/ui";
5
5
  import { XIcon } from "lucide-react";
6
6
  import { Button } from "@/components/ui/button";
7
7
  import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider/react";
@@ -13,6 +13,19 @@ import {
13
13
  DialogHeader,
14
14
  DialogTitle
15
15
  } from "@/components/ui/dialog";
16
+ import { useModel } from "@krak-stack/registry/effect-ui-adapter/react";
17
+
18
+ // ../../src/components/tracking-notice/classes.ts
19
+ var trackingNoticeClasses = {
20
+ trigger: "text-muted-foreground hover:text-foreground text-sm underline",
21
+ banner: "bg-card fixed inset-x-3 bottom-3 z-40 mx-auto max-w-3xl rounded-xl border p-5 shadow-xl sm:inset-x-6 sm:flex sm:items-center sm:gap-6",
22
+ dismiss: "text-muted-foreground hover:text-foreground absolute top-2 right-2 rounded-sm p-1",
23
+ bannerActions: "mt-4 flex shrink-0 flex-wrap gap-2 sm:mt-0"
24
+ };
25
+
26
+ // ../../src/components/tracking-notice/index.ts
27
+ import { Effect as Effect2, Queue, Schema as Schema4, Stream } from "effect";
28
+ import { Command, Component, Subscription, UiSchema } from "effect/ui";
16
29
 
17
30
  // ../../src/services/opentelemetry/consent.ts
18
31
  import * as Data from "effect/Data";
@@ -77,13 +90,17 @@ var ANALYTICS_CONSENT_COOKIE = "krakstack_analytics_consent";
77
90
  var ANALYTICS_NOTICE_VERSION = "1";
78
91
  var changedEvent = "krakstack:analytics-consent";
79
92
  var lifetime = 180 * 24 * 60 * 60 * 1000;
93
+ var cookiePrefix = `${ANALYTICS_CONSENT_COOKIE}=`;
80
94
  var codec = Schema2.StringFromUriComponent.pipe(Schema2.decodeTo(Schema2.fromJsonString(BrowserAnalyticsPreference)));
81
- var readCookie = (cookie) => cookie.split(";").map((part) => part.trim()).find((part) => part.startsWith(`${ANALYTICS_CONSENT_COOKIE}=`))?.slice(ANALYTICS_CONSENT_COOKIE.length + 1);
95
+ var decodePreference = Schema2.decodeOption(codec);
96
+ var encodePreference = Schema2.encodeSync(codec);
97
+ var decodePrivacySignals = Schema2.decodeUnknownOption(BrowserPrivacySignals);
98
+ var readCookie = (cookie) => cookie.split(";").map((part) => part.trim()).find((part) => part.startsWith(cookiePrefix))?.slice(cookiePrefix.length);
82
99
  var analyticsPreference = (cookie, now = Date.now()) => {
83
100
  const value = readCookie(cookie);
84
101
  if (!value)
85
102
  return;
86
- const decoded = Schema2.decodeOption(codec)(value);
103
+ const decoded = decodePreference(value);
87
104
  if (Option.isNone(decoded))
88
105
  return;
89
106
  const preference = decoded.value;
@@ -92,43 +109,53 @@ var analyticsPreference = (cookie, now = Date.now()) => {
92
109
  var browserPrivacyEnabled = () => {
93
110
  if (globalThis.navigator === undefined)
94
111
  return false;
95
- const value = Schema2.decodeUnknownOption(BrowserPrivacySignals)(navigator);
112
+ const value = decodePrivacySignals(navigator);
96
113
  return navigator.doNotTrack === "1" || navigator.doNotTrack === "yes" || Option.isSome(value) && value.value.globalPrivacyControl === true;
97
114
  };
98
- var browserPreference = () => {
99
- if (globalThis.document === undefined)
100
- return;
101
- const cookie = Effect.runSync(Effect.try({
102
- try: () => document.cookie,
103
- catch: () => new AnalyticsPreferenceStorageError({
104
- message: "Analytics preference storage unavailable"
105
- })
106
- }).pipe(Effect.orElseSucceed(() => "")));
107
- return analyticsPreference(cookie);
108
- };
115
+ var cookieOperation = (operation) => Effect.try({
116
+ try: operation,
117
+ catch: (cause) => new AnalyticsPreferenceStorageError({
118
+ message: "Analytics preference storage unavailable",
119
+ cause
120
+ })
121
+ });
122
+ var browserPreference = () => analyticsPreference(Effect.runSync(cookieOperation(() => globalThis.document?.cookie ?? "").pipe(Effect.orElseSucceed(() => ""))));
109
123
  var consentGeneration = 0;
110
124
  var previousSnapshot;
111
- var analyticsConsentSnapshot = () => {
112
- const preference = browserPreference();
113
- const snapshot = browserPrivacyEnabled() ? "blocked" : preference ? `${preference.choice}:${preference.revision}` : "pending";
125
+ var observeBrowserConsent = () => {
126
+ const blocked = browserPrivacyEnabled();
127
+ const preference = blocked ? undefined : browserPreference();
128
+ const snapshot = blocked ? "blocked" : preference ? `${preference.choice}:${preference.revision}` : "pending";
114
129
  if (snapshot !== previousSnapshot) {
115
130
  consentGeneration++;
116
131
  previousSnapshot = snapshot;
117
132
  }
118
- return snapshot;
133
+ return { preference, snapshot, generation: consentGeneration };
119
134
  };
135
+ var analyticsConsentSnapshot = () => observeBrowserConsent().snapshot;
120
136
  var saveAnalyticsPreference = (choice) => {
137
+ const host = globalThis.document;
138
+ if (host === undefined)
139
+ return false;
121
140
  const issuedAt = Date.now();
122
- const value = Schema2.encodeSync(codec)({
141
+ const revision = Effect.runSync(SecureRandom.SecureRandom.use((random) => random.uuidV7()).pipe(Effect.provide(SecureRandom.layerWebCrypto)));
142
+ const value = encodePreference({
123
143
  choice,
124
- revision: Effect.runSync(SecureRandom.SecureRandom.use((random) => random.uuidV7()).pipe(Effect.provide(SecureRandom.layerWebCrypto))),
144
+ revision,
125
145
  version: ANALYTICS_NOTICE_VERSION,
126
146
  issuedAt,
127
147
  expiresAt: issuedAt + lifetime
128
148
  });
129
- document.cookie = `${ANALYTICS_CONSENT_COOKIE}=${value}; Path=/; Max-Age=${lifetime / 1000}; SameSite=Lax${location.protocol === "https:" ? "; Secure" : ""}`;
149
+ const secure = host.location?.protocol === "https:" ? "; Secure" : "";
150
+ const written = Effect.runSync(cookieOperation(() => {
151
+ host.cookie = `${cookiePrefix}${value}; Path=/; Max-Age=${lifetime / 1000}; SameSite=Lax${secure}`;
152
+ return true;
153
+ }).pipe(Effect.orElseSucceed(() => false)));
154
+ if (!written)
155
+ return false;
156
+ const saved = browserPreference();
130
157
  globalThis.dispatchEvent(new Event(changedEvent));
131
- return analyticsPreference(document.cookie)?.choice === choice;
158
+ return saved?.choice === choice && saved.revision === revision;
132
159
  };
133
160
  var subscribeAnalyticsConsent = (listener) => {
134
161
  let previous = analyticsConsentSnapshot();
@@ -151,14 +178,43 @@ var subscribeAnalyticsConsent = (listener) => {
151
178
  };
152
179
  };
153
180
 
154
- // ../../src/components/tracking-notice/react.tsx
155
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
181
+ // ../../src/components/tracking-notice/schema.ts
182
+ import { Schema as Schema3 } from "effect";
183
+ var Text = Schema3.optional(Schema3.String);
184
+ var Messages = Schema3.Struct({
185
+ preferences: Text,
186
+ title: Text,
187
+ description: Text,
188
+ learnMore: Text,
189
+ details: Text,
190
+ essential: Text,
191
+ privacy: Text,
192
+ accept: Text,
193
+ decline: Text,
194
+ close: Text,
195
+ blocked: Text,
196
+ accepted: Text,
197
+ declined: Text,
198
+ pending: Text,
199
+ error: Text
200
+ }).annotate({ identifier: "TrackingNoticeMessages" });
201
+ var TrackingNoticePropsSchema = Schema3.Struct({
202
+ messages: Schema3.optional(Messages),
203
+ locale: Text,
204
+ privacyHref: Text
205
+ }).annotate({ identifier: "TrackingNoticeProps" });
206
+
207
+ // ../../src/components/tracking-notice/index.ts
208
+ var TrackingChoice = Schema4.Literals(["accepted", "declined"]);
156
209
  var browserPreferences = {
157
210
  subscribe: subscribeAnalyticsConsent,
158
211
  getSnapshot: analyticsConsentSnapshot,
159
212
  save: saveAnalyticsPreference
160
213
  };
161
- var translations = {
214
+
215
+ class ConsentStorageError extends Schema4.TaggedError()("ConsentStorageError", {}) {
216
+ }
217
+ var defaultMessages = {
162
218
  en: {
163
219
  preferences: "Analytics preferences",
164
220
  title: "Help us improve this site",
@@ -194,9 +250,96 @@ var translations = {
194
250
  error: "Impossible d’enregistrer votre préférence. Vérifiez que les témoins sont autorisés et réessayez."
195
251
  }
196
252
  };
253
+ var trackingNoticeMessages = (locale, overrides) => {
254
+ const defaults = locale.split("-")[0] === "fr" ? defaultMessages.fr : defaultMessages.en;
255
+ return {
256
+ ...defaults,
257
+ ...Object.fromEntries(Object.entries(overrides ?? {}).filter(([, value]) => value !== undefined))
258
+ };
259
+ };
260
+ var trackingNoticeStatus = (snapshot, labels) => snapshot === "blocked" ? labels.blocked : snapshot.startsWith("accepted:") ? labels.accepted : snapshot.startsWith("declined:") ? labels.declined : labels.pending;
261
+ var TrackingNoticeMessage = UiSchema.TaggedEnum({
262
+ Opened: {},
263
+ Closed: {},
264
+ Dismissed: {},
265
+ ChoiceRequested: { choice: TrackingChoice },
266
+ Saved: { success: Schema4.Boolean },
267
+ SnapshotChanged: { snapshot: Schema4.String }
268
+ });
269
+ var trackingNoticeOptions = {
270
+ name: "TrackingNotice",
271
+ props: TrackingNoticePropsSchema,
272
+ model: Schema4.Struct({
273
+ open: Schema4.Boolean,
274
+ dismissed: Schema4.Boolean,
275
+ failed: Schema4.Boolean,
276
+ snapshot: Schema4.String
277
+ }).annotate({ identifier: "TrackingNoticeModel" }),
278
+ message: TrackingNoticeMessage,
279
+ restore: false
280
+ };
281
+ var trackingNoticeBehaviours = (preferences) => {
282
+ const watch = Subscription.make("TrackingNotice/Watch", Stream.callback((queue) => Effect2.acquireRelease(Effect2.sync(() => {
283
+ const notify = () => {
284
+ Queue.offerUnsafe(queue, TrackingNoticeMessage.SnapshotChanged({
285
+ snapshot: preferences.getSnapshot()
286
+ }));
287
+ };
288
+ const unsubscribe = preferences.subscribe(notify);
289
+ notify();
290
+ return unsubscribe;
291
+ }), (unsubscribe) => Effect2.sync(unsubscribe))));
292
+ const Save = Command.make("TrackingNotice/Save", { args: { choice: TrackingChoice } }, ({ choice }) => Effect2.try({
293
+ try: () => !(choice === "accepted" && preferences.getSnapshot() === "blocked") && preferences.save(choice),
294
+ catch: () => new ConsentStorageError
295
+ }).pipe(Effect2.orElseSucceed(() => false), Effect2.map((success) => TrackingNoticeMessage.Saved({ success }))));
296
+ const update = Component.define(trackingNoticeOptions).update({
297
+ Opened: ($) => $.evolve({ open: true, failed: false }),
298
+ Closed: ($) => $.evolve({ open: false }),
299
+ Dismissed: ($) => $.evolve({ dismissed: true }),
300
+ ChoiceRequested: ($, { choice }) => $.run(Save.make({ choice })),
301
+ Saved: ($, { success }) => $.evolve({ failed: !success, open: !success && $.model.open }),
302
+ SnapshotChanged: ($, { snapshot }) => $.evolve({ snapshot })
303
+ });
304
+ return {
305
+ init: () => ({
306
+ open: false,
307
+ dismissed: false,
308
+ failed: false,
309
+ snapshot: "server"
310
+ }),
311
+ update,
312
+ subscriptions: () => [watch]
313
+ };
314
+ };
197
315
 
198
- class ConsentStorageError extends Schema3.TaggedError()("ConsentStorageError", {}) {
199
- }
316
+ // ../../src/components/tracking-notice/react.tsx
317
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
318
+ var makeTrackingNoticeModel = (preferences) => Component2.define(trackingNoticeOptions).make({
319
+ ...trackingNoticeBehaviours(preferences),
320
+ view: () => View.text("")
321
+ });
322
+ var bindableTrackingNoticeModel = (initial) => {
323
+ let current = initial;
324
+ const listeners = new Set;
325
+ const notify = () => listeners.forEach((listener) => listener());
326
+ return {
327
+ component: makeTrackingNoticeModel({
328
+ subscribe: (listener) => {
329
+ listeners.add(listener);
330
+ return () => listeners.delete(listener);
331
+ },
332
+ getSnapshot: () => current.getSnapshot(),
333
+ save: (choice) => current.save(choice)
334
+ }),
335
+ bind: (preferences) => {
336
+ current = preferences;
337
+ const unsubscribe = current.subscribe(notify);
338
+ notify();
339
+ return unsubscribe;
340
+ }
341
+ };
342
+ };
200
343
  var TrackingNotice = ({
201
344
  messages,
202
345
  locale: localeOverride,
@@ -204,22 +347,15 @@ var TrackingNotice = ({
204
347
  preferences = browserPreferences
205
348
  } = {}) => {
206
349
  const locale = useKrakstackLocale(localeOverride);
207
- const labels = {
208
- ...locale.split("-")[0] === "fr" ? translations.fr : translations.en,
209
- ...messages
210
- };
211
- const snapshot = useSyncExternalStore(preferences.subscribe, preferences.getSnapshot, () => "server");
212
- const [open, setOpen] = useState(false);
213
- const [dismissed, setDismissed] = useState(false);
214
- const [failed, setFailed] = useState(false);
350
+ const labels = trackingNoticeMessages(locale, messages);
351
+ const [modelBinding] = useState(() => bindableTrackingNoticeModel(preferences));
352
+ useLayoutEffect(() => modelBinding.bind(preferences), [modelBinding, preferences]);
353
+ const {
354
+ model: { open, dismissed, failed, snapshot },
355
+ send
356
+ } = useModel(modelBinding.component, { locale, messages, privacyHref });
215
357
  const save = (choice) => {
216
- const result = Effect2.runSync(Effect2.try({
217
- try: () => preferences.save(choice),
218
- catch: () => new ConsentStorageError
219
- }).pipe(Effect2.orElseSucceed(() => false)));
220
- setFailed(!result);
221
- if (result)
222
- setOpen(false);
358
+ send(TrackingNoticeMessage.ChoiceRequested({ choice }));
223
359
  };
224
360
  const actions = /* @__PURE__ */ jsxs(Fragment, {
225
361
  children: [
@@ -257,27 +393,24 @@ var TrackingNotice = ({
257
393
  }) : null
258
394
  ]
259
395
  });
260
- const status = snapshot === "blocked" ? labels.blocked : snapshot.startsWith("accepted:") ? labels.accepted : snapshot.startsWith("declined:") ? labels.declined : labels.pending;
396
+ const status = trackingNoticeStatus(snapshot, labels);
261
397
  return /* @__PURE__ */ jsxs(Fragment, {
262
398
  children: [
263
399
  /* @__PURE__ */ jsx("button", {
264
400
  type: "button",
265
- className: "text-muted-foreground hover:text-foreground text-sm underline",
266
- onClick: () => {
267
- setFailed(false);
268
- setOpen(true);
269
- },
401
+ className: trackingNoticeClasses.trigger,
402
+ onClick: () => send(TrackingNoticeMessage.Opened()),
270
403
  children: labels.preferences
271
404
  }),
272
405
  snapshot === "pending" && !dismissed && !open ? createPortal(/* @__PURE__ */ jsxs("section", {
273
406
  "aria-label": labels.title,
274
- className: "bg-card fixed inset-x-3 bottom-3 z-40 mx-auto max-w-3xl rounded-xl border p-5 shadow-xl sm:inset-x-6 sm:flex sm:items-center sm:gap-6",
407
+ className: trackingNoticeClasses.banner,
275
408
  children: [
276
409
  /* @__PURE__ */ jsx("button", {
277
410
  type: "button",
278
411
  "aria-label": labels.close,
279
- className: "text-muted-foreground hover:text-foreground absolute top-2 right-2 rounded-sm p-1",
280
- onClick: () => setDismissed(true),
412
+ className: trackingNoticeClasses.dismiss,
413
+ onClick: () => send(TrackingNoticeMessage.Dismissed()),
281
414
  children: /* @__PURE__ */ jsx(XIcon, {
282
415
  className: "size-3.5"
283
416
  })
@@ -301,10 +434,7 @@ var TrackingNotice = ({
301
434
  }) : /* @__PURE__ */ jsx("button", {
302
435
  type: "button",
303
436
  className: "underline",
304
- onClick: () => {
305
- setFailed(false);
306
- setOpen(true);
307
- },
437
+ onClick: () => send(TrackingNoticeMessage.Opened()),
308
438
  children: labels.learnMore
309
439
  })
310
440
  ]
@@ -312,7 +442,7 @@ var TrackingNotice = ({
312
442
  ]
313
443
  }),
314
444
  /* @__PURE__ */ jsx("div", {
315
- className: "mt-4 flex shrink-0 gap-2 sm:mt-0",
445
+ className: trackingNoticeClasses.bannerActions,
316
446
  children: actions
317
447
  }),
318
448
  failed ? /* @__PURE__ */ jsx("p", {
@@ -324,7 +454,7 @@ var TrackingNotice = ({
324
454
  }), document.body) : null,
325
455
  /* @__PURE__ */ jsx(Dialog, {
326
456
  open,
327
- onOpenChange: setOpen,
457
+ onOpenChange: (next) => send(next ? TrackingNoticeMessage.Opened() : TrackingNoticeMessage.Closed()),
328
458
  children: /* @__PURE__ */ jsxs(DialogContent, {
329
459
  children: [
330
460
  /* @__PURE__ */ jsxs(DialogHeader, {
@@ -0,0 +1,45 @@
1
+ import { Schema } from "effect";
2
+ declare const Messages: Schema.Struct<{
3
+ readonly preferences: Schema.optional<Schema.String>;
4
+ readonly title: Schema.optional<Schema.String>;
5
+ readonly description: Schema.optional<Schema.String>;
6
+ readonly learnMore: Schema.optional<Schema.String>;
7
+ readonly details: Schema.optional<Schema.String>;
8
+ readonly essential: Schema.optional<Schema.String>;
9
+ readonly privacy: Schema.optional<Schema.String>;
10
+ readonly accept: Schema.optional<Schema.String>;
11
+ readonly decline: Schema.optional<Schema.String>;
12
+ readonly close: Schema.optional<Schema.String>;
13
+ readonly blocked: Schema.optional<Schema.String>;
14
+ readonly accepted: Schema.optional<Schema.String>;
15
+ readonly declined: Schema.optional<Schema.String>;
16
+ readonly pending: Schema.optional<Schema.String>;
17
+ readonly error: Schema.optional<Schema.String>;
18
+ }>;
19
+ export type TrackingNoticeMessages = {
20
+ readonly [Key in keyof typeof Messages.Type]-?: string;
21
+ };
22
+ export declare const TrackingNoticePropsSchema: Schema.Struct<{
23
+ readonly messages: Schema.optional<Schema.Struct<{
24
+ readonly preferences: Schema.optional<Schema.String>;
25
+ readonly title: Schema.optional<Schema.String>;
26
+ readonly description: Schema.optional<Schema.String>;
27
+ readonly learnMore: Schema.optional<Schema.String>;
28
+ readonly details: Schema.optional<Schema.String>;
29
+ readonly essential: Schema.optional<Schema.String>;
30
+ readonly privacy: Schema.optional<Schema.String>;
31
+ readonly accept: Schema.optional<Schema.String>;
32
+ readonly decline: Schema.optional<Schema.String>;
33
+ readonly close: Schema.optional<Schema.String>;
34
+ readonly blocked: Schema.optional<Schema.String>;
35
+ readonly accepted: Schema.optional<Schema.String>;
36
+ readonly declined: Schema.optional<Schema.String>;
37
+ readonly pending: Schema.optional<Schema.String>;
38
+ readonly error: Schema.optional<Schema.String>;
39
+ }>>;
40
+ readonly locale: Schema.optional<Schema.String>;
41
+ /** Link to an application-owned privacy page. */
42
+ readonly privacyHref: Schema.optional<Schema.String>;
43
+ }>;
44
+ export type TrackingNoticeProps = typeof TrackingNoticePropsSchema.Type;
45
+ export {};
@@ -71,14 +71,14 @@ export declare const UploadAttachment: import("effect/ui/Component").Component<"
71
71
  readonly canRemove?: boolean | undefined;
72
72
  }, null, {
73
73
  readonly _tag: "Cancel";
74
- } | {
75
- readonly _tag: "Retry";
76
74
  } | {
77
75
  readonly _tag: "Remove";
78
- }, {
79
- readonly _tag: "Cancel";
80
76
  } | {
81
77
  readonly _tag: "Retry";
78
+ }, {
79
+ readonly _tag: "Cancel";
82
80
  } | {
83
81
  readonly _tag: "Remove";
82
+ } | {
83
+ readonly _tag: "Retry";
84
84
  }, never, Html.Elements, {}, never>;
@@ -74,9 +74,6 @@ export declare const VirtualizedCombobox: import("effect/ui/Component").Componen
74
74
  readonly id: number;
75
75
  } | null;
76
76
  }, {
77
- readonly _tag: "Highlighted";
78
- readonly value: string;
79
- } | {
80
77
  readonly _tag: "OpenChanged";
81
78
  readonly open: boolean;
82
79
  } | {
@@ -85,6 +82,9 @@ export declare const VirtualizedCombobox: import("effect/ui/Component").Componen
85
82
  } | {
86
83
  readonly _tag: "ValueChanged";
87
84
  readonly value: string | readonly string[] | null;
85
+ } | {
86
+ readonly _tag: "Highlighted";
87
+ readonly value: string;
88
88
  }, {
89
89
  readonly _tag: "OpenChanged";
90
90
  readonly open: boolean;
@@ -510,6 +510,7 @@ var tableClasses = {
510
510
  referenceName: "truncate font-medium",
511
511
  referenceDescription: "text-muted-foreground truncate text-xs"
512
512
  };
513
+ var tableResultsFooterClass = "bg-background text-muted-foreground sticky bottom-0 z-30 shrink-0 border-t px-2 py-2 text-sm";
513
514
  var resolveTableClasses = (overrides) => ({
514
515
  ...tableClasses,
515
516
  ...overrides
@@ -2001,7 +2002,9 @@ var DataTable = Html2.component({
2001
2002
  const dropOnRow = (rowId, group) => group ? DataTableMessage.GroupDropped(group) : reorder ? DataTableMessage.DragDropped({ targetId: rowId }) : undefined;
2002
2003
  const rowActions = reorder || props.rowData.some(({ actions }) => actions?.length);
2003
2004
  const span = Math.max(1, columns.length + Number(!!selection) + Number(rowActions) + Number(draggable));
2004
- const virtual = tableVirtualization(rows.length, features.virtualization, !grouping.length && !gallery && !features.reordering && props.status?.error === undefined && rows.length > 0);
2005
+ const virtualization = features.virtualization;
2006
+ const fillHeight = virtualization && virtualization !== true && virtualization.scroll === "internal";
2007
+ const virtual = tableVirtualization(rows.length, virtualization, !grouping.length && !gallery && !features.reordering && props.status?.error === undefined && rows.length > 0);
2005
2008
  const ids = rows.filter(({ selectable }) => selectable !== false).map(({ id }) => id);
2006
2009
  const selectedHere = ids.filter((id) => selected.has(id)).length;
2007
2010
  const status = props.status;
@@ -2452,7 +2455,7 @@ var DataTable = Html2.component({
2452
2455
  ];
2453
2456
  });
2454
2457
  };
2455
- return h.section.class(cn("grid min-w-0 gap-2", props.className)).onMount(PersistPreferences({
2458
+ return h.section.class(cn("min-w-0 gap-2", fillHeight ? "flex min-h-0 flex-1 flex-col" : "grid", props.className)).onMount(PersistPreferences({
2456
2459
  columns: props.columnDefs.map(({ id }) => id),
2457
2460
  gallery: !!features.gallery,
2458
2461
  preferences: tablePreferences(model)
@@ -2686,7 +2689,7 @@ var DataTable = Html2.component({
2686
2689
  ] : [];
2687
2690
  }) : renderGroups(rows, 0, "")));
2688
2691
  };
2689
- const viewport = () => h.div.class("@container overflow-auto");
2692
+ const viewport = () => h.div.class(cn("@container overflow-auto", fillHeight && "min-h-0 flex-1"));
2690
2693
  if (!virtual)
2691
2694
  return viewport().children(renderTable());
2692
2695
  return VirtualList(h, {
@@ -2698,11 +2701,11 @@ var DataTable = Html2.component({
2698
2701
  overscan: virtual.overscan,
2699
2702
  initialCount: virtual.initialCount
2700
2703
  },
2701
- view: (list) => virtual.scroll === "page" ? h.div.children(renderTable(list)) : list.viewport(viewport().style({
2704
+ view: (list) => virtual.scroll === "page" ? h.div.children(renderTable(list)) : list.viewport(fillHeight ? viewport() : viewport().style({
2702
2705
  maxHeight: `${virtual.height}px`
2703
2706
  })).children(renderTable(list))
2704
2707
  });
2705
- })(), paginationVisible && Pagination(h, {
2708
+ })(), paginationVisible ? Pagination(h, {
2706
2709
  props: {
2707
2710
  locale,
2708
2711
  page,
@@ -2716,7 +2719,7 @@ var DataTable = Html2.component({
2716
2719
  PageChanged: ({ page }) => DataTableMessage.PageRequested({ page }),
2717
2720
  PageSizeChanged: ({ pageSize }) => DataTableMessage.PageSizeRequested({ pageSize })
2718
2721
  }
2719
- }));
2722
+ }) : h.div.attr("role", "status").class(tableResultsFooterClass).children(paginationMessages(locale).results(totalRows)));
2720
2723
  }
2721
2724
  });
2722
2725
 
@@ -656,6 +656,7 @@ var tableClasses = {
656
656
  referenceName: "truncate font-medium",
657
657
  referenceDescription: "text-muted-foreground truncate text-xs"
658
658
  };
659
+ var tableResultsFooterClass = "bg-background text-muted-foreground sticky bottom-0 z-30 shrink-0 border-t px-2 py-2 text-sm";
659
660
  var resolveTableClasses = (overrides) => ({
660
661
  ...tableClasses,
661
662
  ...overrides
@@ -4388,7 +4389,7 @@ var DataTableGallery = ({
4388
4389
  children: renderSections(sections)
4389
4390
  });
4390
4391
  };
4391
- var DataTablePagination = ({
4392
+ var DataTableFooter = ({
4392
4393
  table
4393
4394
  }) => {
4394
4395
  const styles = useContext(DataTableStylesContext);
@@ -4402,8 +4403,13 @@ var DataTablePagination = ({
4402
4403
  send(DataTableMessage.PageRequested({ page }));
4403
4404
  }
4404
4405
  }, [page, pageIndex, pagination, paginationVisible, send]);
4405
- if (!paginationVisible || !pagination)
4406
- return null;
4406
+ if (!paginationVisible || !pagination) {
4407
+ return /* @__PURE__ */ jsx3("div", {
4408
+ className: tableResultsFooterClass,
4409
+ role: "status",
4410
+ children: store.config.labels.results(model.totalRows)
4411
+ });
4412
+ }
4407
4413
  const selected = model.rows.filter((row) => store.state.rowSelection[row.id]).length;
4408
4414
  return /* @__PURE__ */ jsx3("div", {
4409
4415
  "data-table-slot": "pagination",
@@ -4600,7 +4606,7 @@ var HydratedDataTable = (props) => {
4600
4606
  /* @__PURE__ */ jsx3(DataTableContent, {
4601
4607
  table
4602
4608
  }),
4603
- /* @__PURE__ */ jsx3(DataTablePagination, {
4609
+ /* @__PURE__ */ jsx3(DataTableFooter, {
4604
4610
  table
4605
4611
  })
4606
4612
  ]
@@ -157,13 +157,17 @@ var ANALYTICS_CONSENT_COOKIE = "krakstack_analytics_consent";
157
157
  var ANALYTICS_NOTICE_VERSION = "1";
158
158
  var changedEvent = "krakstack:analytics-consent";
159
159
  var lifetime = 180 * 24 * 60 * 60 * 1000;
160
+ var cookiePrefix = `${ANALYTICS_CONSENT_COOKIE}=`;
160
161
  var codec = Schema3.StringFromUriComponent.pipe(Schema3.decodeTo(Schema3.fromJsonString(BrowserAnalyticsPreference)));
161
- var readCookie = (cookie) => cookie.split(";").map((part) => part.trim()).find((part) => part.startsWith(`${ANALYTICS_CONSENT_COOKIE}=`))?.slice(ANALYTICS_CONSENT_COOKIE.length + 1);
162
+ var decodePreference = Schema3.decodeOption(codec);
163
+ var encodePreference = Schema3.encodeSync(codec);
164
+ var decodePrivacySignals = Schema3.decodeUnknownOption(BrowserPrivacySignals);
165
+ var readCookie = (cookie) => cookie.split(";").map((part) => part.trim()).find((part) => part.startsWith(cookiePrefix))?.slice(cookiePrefix.length);
162
166
  var analyticsPreference = (cookie, now = Date.now()) => {
163
167
  const value = readCookie(cookie);
164
168
  if (!value)
165
169
  return;
166
- const decoded = Schema3.decodeOption(codec)(value);
170
+ const decoded = decodePreference(value);
167
171
  if (Option2.isNone(decoded))
168
172
  return;
169
173
  const preference = decoded.value;
@@ -172,49 +176,58 @@ var analyticsPreference = (cookie, now = Date.now()) => {
172
176
  var browserPrivacyEnabled = () => {
173
177
  if (globalThis.navigator === undefined)
174
178
  return false;
175
- const value = Schema3.decodeUnknownOption(BrowserPrivacySignals)(navigator);
179
+ const value = decodePrivacySignals(navigator);
176
180
  return navigator.doNotTrack === "1" || navigator.doNotTrack === "yes" || Option2.isSome(value) && value.value.globalPrivacyControl === true;
177
181
  };
178
- var browserPreference = () => {
179
- if (globalThis.document === undefined)
180
- return;
181
- const cookie = Effect2.runSync(Effect2.try({
182
- try: () => document.cookie,
183
- catch: () => new AnalyticsPreferenceStorageError({
184
- message: "Analytics preference storage unavailable"
185
- })
186
- }).pipe(Effect2.orElseSucceed(() => "")));
187
- return analyticsPreference(cookie);
188
- };
182
+ var cookieOperation = (operation) => Effect2.try({
183
+ try: operation,
184
+ catch: (cause) => new AnalyticsPreferenceStorageError({
185
+ message: "Analytics preference storage unavailable",
186
+ cause
187
+ })
188
+ });
189
+ var browserPreference = () => analyticsPreference(Effect2.runSync(cookieOperation(() => globalThis.document?.cookie ?? "").pipe(Effect2.orElseSucceed(() => ""))));
189
190
  var consentGeneration = 0;
190
191
  var previousSnapshot;
191
- var analyticsConsentSnapshot = () => {
192
- const preference = browserPreference();
193
- const snapshot = browserPrivacyEnabled() ? "blocked" : preference ? `${preference.choice}:${preference.revision}` : "pending";
192
+ var observeBrowserConsent = () => {
193
+ const blocked = browserPrivacyEnabled();
194
+ const preference = blocked ? undefined : browserPreference();
195
+ const snapshot = blocked ? "blocked" : preference ? `${preference.choice}:${preference.revision}` : "pending";
194
196
  if (snapshot !== previousSnapshot) {
195
197
  consentGeneration++;
196
198
  previousSnapshot = snapshot;
197
199
  }
198
- return snapshot;
200
+ return { preference, snapshot, generation: consentGeneration };
199
201
  };
200
- var analyticsAllowed = () => analyticsConsentSnapshot().startsWith("accepted:");
202
+ var analyticsConsentSnapshot = () => observeBrowserConsent().snapshot;
203
+ var analyticsAllowed = () => observeBrowserConsent().preference?.choice === "accepted";
201
204
  var analyticsExportGuard = () => {
202
- const snapshot = analyticsConsentSnapshot();
203
- const generation = consentGeneration;
204
- return () => snapshot.startsWith("accepted:") && analyticsConsentSnapshot() === snapshot && consentGeneration === generation;
205
+ const initial = observeBrowserConsent();
206
+ return () => initial.preference?.choice === "accepted" && observeBrowserConsent().generation === initial.generation;
205
207
  };
206
208
  var saveAnalyticsPreference = (choice) => {
209
+ const host = globalThis.document;
210
+ if (host === undefined)
211
+ return false;
207
212
  const issuedAt = Date.now();
208
- const value = Schema3.encodeSync(codec)({
213
+ const revision = Effect2.runSync(SecureRandom.SecureRandom.use((random) => random.uuidV7()).pipe(Effect2.provide(SecureRandom.layerWebCrypto)));
214
+ const value = encodePreference({
209
215
  choice,
210
- revision: Effect2.runSync(SecureRandom.SecureRandom.use((random) => random.uuidV7()).pipe(Effect2.provide(SecureRandom.layerWebCrypto))),
216
+ revision,
211
217
  version: ANALYTICS_NOTICE_VERSION,
212
218
  issuedAt,
213
219
  expiresAt: issuedAt + lifetime
214
220
  });
215
- document.cookie = `${ANALYTICS_CONSENT_COOKIE}=${value}; Path=/; Max-Age=${lifetime / 1000}; SameSite=Lax${location.protocol === "https:" ? "; Secure" : ""}`;
221
+ const secure = host.location?.protocol === "https:" ? "; Secure" : "";
222
+ const written = Effect2.runSync(cookieOperation(() => {
223
+ host.cookie = `${cookiePrefix}${value}; Path=/; Max-Age=${lifetime / 1000}; SameSite=Lax${secure}`;
224
+ return true;
225
+ }).pipe(Effect2.orElseSucceed(() => false)));
226
+ if (!written)
227
+ return false;
228
+ const saved = browserPreference();
216
229
  globalThis.dispatchEvent(new Event(changedEvent));
217
- return analyticsPreference(document.cookie)?.choice === choice;
230
+ return saved?.choice === choice && saved.revision === revision;
218
231
  };
219
232
  var subscribeAnalyticsConsent = (listener) => {
220
233
  let previous = analyticsConsentSnapshot();