@krak-stack/registry 0.11.6 → 0.11.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.
Files changed (123) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/README.md +39 -0
  3. package/dist/components/app-switcher/html.d.ts +2 -2
  4. package/dist/components/asset-input/html.d.ts +70 -0
  5. package/dist/components/asset-input/html.js +1549 -0
  6. package/dist/components/asset-input/index.d.ts +280 -0
  7. package/dist/components/asset-input/react.d.ts +32 -0
  8. package/dist/components/asset-input/react.js +2269 -0
  9. package/dist/components/asset-input/schema.d.ts +93 -0
  10. package/dist/components/asset-input/upload.d.ts +15 -0
  11. package/dist/components/asset-table/html.d.ts +110 -0
  12. package/dist/components/asset-table/html.js +4934 -0
  13. package/dist/components/asset-table/index.d.ts +225 -0
  14. package/dist/components/asset-table/react.d.ts +21 -0
  15. package/dist/components/asset-table/react.js +8241 -0
  16. package/dist/components/asset-table/schema.d.ts +73 -0
  17. package/dist/components/audit-log-table/classes.d.ts +1 -0
  18. package/dist/components/audit-log-table/html.d.ts +158 -0
  19. package/dist/components/audit-log-table/html.js +3294 -0
  20. package/dist/components/audit-log-table/index.d.ts +37 -0
  21. package/dist/components/audit-log-table/react.d.ts +3 -51
  22. package/dist/components/audit-log-table/react.js +130 -89
  23. package/dist/components/audit-log-table/schema.d.ts +122 -0
  24. package/dist/components/danger-confirmation/html.d.ts +2 -2
  25. package/dist/components/danger-confirmation/index.d.ts +2 -2
  26. package/dist/components/data-table/classes.d.ts +3 -0
  27. package/dist/components/data-table/html.d.ts +70 -12
  28. package/dist/components/data-table/html.js +56 -19
  29. package/dist/components/data-table/index.d.ts +51 -1
  30. package/dist/components/data-table/react.d.ts +1 -0
  31. package/dist/components/data-table/react.js +46 -16
  32. package/dist/components/data-table/schema.d.ts +93 -3
  33. package/dist/components/docs/html.js +22 -4
  34. package/dist/components/docs/react.js +33 -2
  35. package/dist/components/editable-text/html.d.ts +2 -2
  36. package/dist/components/editable-text/index.d.ts +4 -4
  37. package/dist/components/effect-form/react.js +343 -138
  38. package/dist/components/email-editor/legacy-editor.html.d.ts +6 -6
  39. package/dist/components/file-input/classes.d.ts +1 -1
  40. package/dist/components/file-input/file-type.d.ts +1 -0
  41. package/dist/components/file-input/html.d.ts +8 -1
  42. package/dist/components/file-input/html.js +170 -12
  43. package/dist/components/file-input/index.d.ts +1 -0
  44. package/dist/components/file-input/react.d.ts +9 -1
  45. package/dist/components/file-input/react.js +277 -127
  46. package/dist/components/file-input/schema.d.ts +1 -0
  47. package/dist/components/form/react.js +343 -138
  48. package/dist/components/icon-input/html.js +19 -5
  49. package/dist/components/icon-input/react.js +70 -13
  50. package/dist/components/map-menu/html.d.ts +6 -0
  51. package/dist/components/map-menu/html.js +13 -8
  52. package/dist/components/map-menu/index.d.ts +5 -4
  53. package/dist/components/map-menu/react.d.ts +28 -17
  54. package/dist/components/map-menu/react.js +84 -178
  55. package/dist/components/map-menu/schema.d.ts +6 -0
  56. package/dist/components/map-menu/shared.d.ts +4 -0
  57. package/dist/components/permissions-input/classes.d.ts +8 -0
  58. package/dist/components/permissions-input/html.d.ts +41 -0
  59. package/dist/components/permissions-input/html.js +130 -0
  60. package/dist/components/permissions-input/index.d.ts +80 -0
  61. package/dist/components/permissions-input/react.d.ts +7 -0
  62. package/dist/components/permissions-input/react.js +201 -0
  63. package/dist/components/permissions-input/schema.d.ts +33 -0
  64. package/dist/components/phone-number-input/html.js +48 -14
  65. package/dist/components/phone-number-input/react.js +67 -10
  66. package/dist/components/search-menu/html.d.ts +2 -2
  67. package/dist/components/select-with-custom-input/html.d.ts +2 -2
  68. package/dist/components/sidebar-layout/html.d.ts +3 -2
  69. package/dist/components/sidebar-layout/html.js +20 -2
  70. package/dist/components/sidebar-layout/index.d.ts +1 -0
  71. package/dist/components/sidebar-layout/react.js +33 -2
  72. package/dist/components/switch/react.d.ts +14 -0
  73. package/dist/components/switch/react.js +55 -0
  74. package/dist/components/theme-switcher/html.d.ts +2 -2
  75. package/dist/components/time-input/html.d.ts +2 -2
  76. package/dist/components/timezone-input/html.js +48 -14
  77. package/dist/components/timezone-input/react.js +67 -10
  78. package/dist/components/tracking-notice/classes.d.ts +6 -0
  79. package/dist/components/tracking-notice/html.d.ts +85 -0
  80. package/dist/components/tracking-notice/html.js +354 -0
  81. package/dist/components/tracking-notice/index.d.ts +95 -0
  82. package/dist/components/tracking-notice/react.d.ts +5 -27
  83. package/dist/components/tracking-notice/react.js +189 -59
  84. package/dist/components/tracking-notice/schema.d.ts +45 -0
  85. package/dist/components/upload-attachment/classes.d.ts +3 -2
  86. package/dist/components/upload-attachment/html.d.ts +5 -5
  87. package/dist/components/upload-attachment/html.js +7 -5
  88. package/dist/components/upload-attachment/react.d.ts +3 -1
  89. package/dist/components/upload-attachment/react.js +25 -17
  90. package/dist/components/virtualized-combobox/classes.d.ts +12 -0
  91. package/dist/components/virtualized-combobox/html.d.ts +42 -0
  92. package/dist/components/virtualized-combobox/html.js +48 -14
  93. package/dist/components/virtualized-combobox/index.d.ts +55 -4
  94. package/dist/components/virtualized-combobox/react.d.ts +6 -2
  95. package/dist/components/virtualized-combobox/react.js +67 -10
  96. package/dist/components/virtualized-combobox/schema.d.ts +60 -4
  97. package/dist/components/webhook-delivery-table/html.js +56 -19
  98. package/dist/components/webhook-delivery-table/react.js +46 -16
  99. package/dist/lib/access/index.d.ts +61 -0
  100. package/dist/lib/access/index.js +92 -0
  101. package/dist/lib/access/table/classes.d.ts +13 -0
  102. package/dist/lib/access/table/html.d.ts +39 -0
  103. package/dist/lib/access/table/html.js +157 -0
  104. package/dist/lib/access/table/index.d.ts +32 -0
  105. package/dist/lib/access/table/react.d.ts +3 -0
  106. package/dist/lib/access/table/react.js +195 -0
  107. package/dist/lib/access/table/schema.d.ts +43 -0
  108. package/dist/lib/docs.integrations.server.js +23 -1
  109. package/dist/lib/docs.js +33 -2
  110. package/dist/lib/docs.server.js +29 -2
  111. package/dist/lib/documentation-toolkit.js +23 -1
  112. package/dist/lib/effect-ui-adapter/use-model.d.ts +1 -1
  113. package/dist/lib/effect-ui-adapter/use-model.js +19 -11
  114. package/dist/lib/lucide-effect.d.ts +19 -19
  115. package/dist/lib/lucide-effect.js +38 -38
  116. package/dist/services/assets/library.d.ts +221 -0
  117. package/dist/services/assets/schema.d.ts +3 -0
  118. package/dist/services/assets/url.d.ts +12 -0
  119. package/dist/services/assets/use-library.d.ts +20 -0
  120. package/dist/services/events/browser.js +39 -26
  121. package/dist/services/events/index.js +23 -19
  122. package/dist/services/opentelemetry/web-vitals.js +27 -23
  123. package/package.json +21 -1
@@ -624,15 +624,15 @@ var cloudflareGeolocation = (headers) => ({
624
624
  region: Option4.getOrUndefined(Schema7.decodeUnknownOption(EventRegion)(headers["cf-region-code"])),
625
625
  city: Option4.getOrUndefined(Schema7.decodeUnknownOption(EventCity)(decodeCloudflareCity(headers["cf-ipcity"])))
626
626
  });
627
- var geolocationAttributes = (location2) => {
627
+ var geolocationAttributes = (location) => {
628
628
  const attributes = {};
629
- if (location2?.country) {
630
- attributes["geo.country.iso_code"] = location2.country;
631
- if (location2.region)
632
- attributes["geo.region.iso_code"] = `${location2.country}-${location2.region}`;
629
+ if (location?.country) {
630
+ attributes["geo.country.iso_code"] = location.country;
631
+ if (location.region)
632
+ attributes["geo.region.iso_code"] = `${location.country}-${location.region}`;
633
633
  }
634
- if (location2?.city)
635
- attributes["geo.locality.name"] = location2.city;
634
+ if (location?.city)
635
+ attributes["geo.locality.name"] = location.city;
636
636
  return attributes;
637
637
  };
638
638
  var deviceContext = (userAgent) => {
@@ -692,13 +692,17 @@ class AnalyticsPreferenceStorageError extends Data.TaggedError("AnalyticsPrefere
692
692
  var ANALYTICS_CONSENT_COOKIE = "krakstack_analytics_consent";
693
693
  var ANALYTICS_NOTICE_VERSION = "1";
694
694
  var lifetime = 180 * 24 * 60 * 60 * 1000;
695
+ var cookiePrefix = `${ANALYTICS_CONSENT_COOKIE}=`;
695
696
  var codec = Schema8.StringFromUriComponent.pipe(Schema8.decodeTo(Schema8.fromJsonString(BrowserAnalyticsPreference)));
696
- var readCookie = (cookie) => cookie.split(";").map((part) => part.trim()).find((part) => part.startsWith(`${ANALYTICS_CONSENT_COOKIE}=`))?.slice(ANALYTICS_CONSENT_COOKIE.length + 1);
697
+ var decodePreference = Schema8.decodeOption(codec);
698
+ var encodePreference = Schema8.encodeSync(codec);
699
+ var decodePrivacySignals = Schema8.decodeUnknownOption(BrowserPrivacySignals);
700
+ var readCookie = (cookie) => cookie.split(";").map((part) => part.trim()).find((part) => part.startsWith(cookiePrefix))?.slice(cookiePrefix.length);
697
701
  var analyticsPreference = (cookie, now = Date.now()) => {
698
702
  const value = readCookie(cookie);
699
703
  if (!value)
700
704
  return;
701
- const decoded = Schema8.decodeOption(codec)(value);
705
+ const decoded = decodePreference(value);
702
706
  if (Option5.isNone(decoded))
703
707
  return;
704
708
  const preference = decoded.value;
@@ -877,15 +881,15 @@ class Events extends Context4.Service()("krakstack/events/Events", {
877
881
  };
878
882
  }) : undefined;
879
883
  const resolveGeolocation = Effect8.fnUntraced(function* (request) {
880
- const location2 = configuration.geolocation === "cloudflare" ? cloudflareGeolocation(request.headers) : configuration.geolocation ? yield* configuration.geolocation(request) : null;
881
- return yield* Schema9.decodeEffect(Schema9.NullOr(EventGeolocation))(location2);
884
+ const location = configuration.geolocation === "cloudflare" ? cloudflareGeolocation(request.headers) : configuration.geolocation ? yield* configuration.geolocation(request) : null;
885
+ return yield* Schema9.decodeEffect(Schema9.NullOr(EventGeolocation))(location);
882
886
  }, Effect8.mapError(() => new EventGeolocationError({})));
883
- const resolveRequestContext = Effect8.fnUntraced(function* (request, now, location2) {
887
+ const resolveRequestContext = Effect8.fnUntraced(function* (request, now, location) {
884
888
  const userAgent = request.headers["user-agent"]?.slice(0, 2048) ?? "";
885
- const visitorId = location2?.ip && userAgent ? yield* dailyVisitorId({
889
+ const visitorId = location?.ip && userAgent ? yield* dailyVisitorId({
886
890
  serviceName: configuration.serviceName,
887
891
  secret: options.secret,
888
- ip: location2.ip,
892
+ ip: location.ip,
889
893
  userAgent,
890
894
  day: DateTime3.formatIsoDate(now)
891
895
  }) : undefined;
@@ -902,7 +906,7 @@ class Events extends Context4.Service()("krakstack/events/Events", {
902
906
  identity["session.id"] = sessionId;
903
907
  return {
904
908
  ...deviceContext(userAgent),
905
- ...geolocationAttributes(location2),
909
+ ...geolocationAttributes(location),
906
910
  "analytics.identity.mode": visitorId ? "daily" : "unattributed",
907
911
  ...identity
908
912
  };
@@ -1013,14 +1017,14 @@ class Events extends Context4.Service()("krakstack/events/Events", {
1013
1017
  attributes["app.event.source"] = "server";
1014
1018
  attributes["app.event.category"] = category;
1015
1019
  const span = yield* Effect8.currentSpan.pipe(Effect8.option);
1016
- const location2 = Option6.isSome(request) && (!options.requireConsent || hasAnalyticsConsent(request.value.headers.cookie ?? "", request.value.headers)) ? yield* resolveGeolocation(request.value).pipe(Effect8.mapError(() => new EventsPersistenceError({ operation: "geolocation" }))) : null;
1020
+ const location = Option6.isSome(request) && (!options.requireConsent || hasAnalyticsConsent(request.value.headers.cookie ?? "", request.value.headers)) ? yield* resolveGeolocation(request.value).pipe(Effect8.mapError(() => new EventsPersistenceError({ operation: "geolocation" }))) : null;
1017
1021
  const entry = {
1018
1022
  eventName: event.name,
1019
1023
  timeUnixNano: (BigInt(event.timestamp ? DateTime3.toEpochMillis(event.timestamp) : now) * 1000000n).toString(),
1020
1024
  observedTimeUnixNano: (BigInt(now) * 1000000n).toString()
1021
1025
  };
1022
1026
  return yield* Effect8.gen(function* () {
1023
- const requestContext = Option6.isSome(request) && (!options.requireConsent || hasAnalyticsConsent(request.value.headers.cookie ?? "", request.value.headers)) ? yield* resolveRequestContext(request.value, receivedAt, location2) : {};
1027
+ const requestContext = Option6.isSome(request) && (!options.requireConsent || hasAnalyticsConsent(request.value.headers.cookie ?? "", request.value.headers)) ? yield* resolveRequestContext(request.value, receivedAt, location) : {};
1024
1028
  const validated = yield* Schema9.decodeUnknownEffect(EventLogRecord)({
1025
1029
  ...entry,
1026
1030
  attributes: OtlpResource3.entriesToAttributes(Object.entries({ ...requestContext, ...attributes })),
@@ -1228,9 +1232,9 @@ class Events extends Context4.Service()("krakstack/events/Events", {
1228
1232
  ...identityAttributes(trustedIdentity),
1229
1233
  ...trustedActor
1230
1234
  };
1231
- const location2 = yield* resolveGeolocation(request).pipe(Effect8.mapError(() => new OtlpProcessingError({ status: 503 })));
1235
+ const location = yield* resolveGeolocation(request).pipe(Effect8.mapError(() => new OtlpProcessingError({ status: 503 })));
1232
1236
  const ingest = Effect8.gen(function* () {
1233
- const requestContext = yield* resolveRequestContext(request, now, location2);
1237
+ const requestContext = yield* resolveRequestContext(request, now, location);
1234
1238
  let index = 0;
1235
1239
  const resourceLogs = payload.resourceLogs.map((resource) => ({
1236
1240
  ...resource,
@@ -155,13 +155,17 @@ var ANALYTICS_CONSENT_COOKIE = "krakstack_analytics_consent";
155
155
  var ANALYTICS_NOTICE_VERSION = "1";
156
156
  var changedEvent = "krakstack:analytics-consent";
157
157
  var lifetime = 180 * 24 * 60 * 60 * 1000;
158
+ var cookiePrefix = `${ANALYTICS_CONSENT_COOKIE}=`;
158
159
  var codec = Schema3.StringFromUriComponent.pipe(Schema3.decodeTo(Schema3.fromJsonString(BrowserAnalyticsPreference)));
159
- var readCookie = (cookie) => cookie.split(";").map((part) => part.trim()).find((part) => part.startsWith(`${ANALYTICS_CONSENT_COOKIE}=`))?.slice(ANALYTICS_CONSENT_COOKIE.length + 1);
160
+ var decodePreference = Schema3.decodeOption(codec);
161
+ var encodePreference = Schema3.encodeSync(codec);
162
+ var decodePrivacySignals = Schema3.decodeUnknownOption(BrowserPrivacySignals);
163
+ var readCookie = (cookie) => cookie.split(";").map((part) => part.trim()).find((part) => part.startsWith(cookiePrefix))?.slice(cookiePrefix.length);
160
164
  var analyticsPreference = (cookie, now = Date.now()) => {
161
165
  const value = readCookie(cookie);
162
166
  if (!value)
163
167
  return;
164
- const decoded = Schema3.decodeOption(codec)(value);
168
+ const decoded = decodePreference(value);
165
169
  if (Option2.isNone(decoded))
166
170
  return;
167
171
  const preference = decoded.value;
@@ -170,37 +174,37 @@ var analyticsPreference = (cookie, now = Date.now()) => {
170
174
  var browserPrivacyEnabled = () => {
171
175
  if (globalThis.navigator === undefined)
172
176
  return false;
173
- const value = Schema3.decodeUnknownOption(BrowserPrivacySignals)(navigator);
177
+ const value = decodePrivacySignals(navigator);
174
178
  return navigator.doNotTrack === "1" || navigator.doNotTrack === "yes" || Option2.isSome(value) && value.value.globalPrivacyControl === true;
175
179
  };
176
- var browserPreference = () => {
177
- if (globalThis.document === undefined)
178
- return;
179
- const cookie = Effect2.runSync(Effect2.try({
180
- try: () => document.cookie,
181
- catch: () => new AnalyticsPreferenceStorageError({
182
- message: "Analytics preference storage unavailable"
183
- })
184
- }).pipe(Effect2.orElseSucceed(() => "")));
185
- return analyticsPreference(cookie);
186
- };
180
+ var cookieOperation = (operation) => Effect2.try({
181
+ try: operation,
182
+ catch: (cause) => new AnalyticsPreferenceStorageError({
183
+ message: "Analytics preference storage unavailable",
184
+ cause
185
+ })
186
+ });
187
+ var browserPreference = () => analyticsPreference(Effect2.runSync(cookieOperation(() => globalThis.document?.cookie ?? "").pipe(Effect2.orElseSucceed(() => ""))));
187
188
  var consentGeneration = 0;
188
189
  var previousSnapshot;
189
- var analyticsConsentSnapshot = () => {
190
- const preference = browserPreference();
191
- const snapshot = browserPrivacyEnabled() ? "blocked" : preference ? `${preference.choice}:${preference.revision}` : "pending";
190
+ var observeBrowserConsent = () => {
191
+ const blocked = browserPrivacyEnabled();
192
+ const preference = blocked ? undefined : browserPreference();
193
+ const snapshot = blocked ? "blocked" : preference ? `${preference.choice}:${preference.revision}` : "pending";
192
194
  if (snapshot !== previousSnapshot) {
193
195
  consentGeneration++;
194
196
  previousSnapshot = snapshot;
195
197
  }
196
- return snapshot;
198
+ return { preference, snapshot, generation: consentGeneration };
199
+ };
200
+ var analyticsConsentSnapshot = () => observeBrowserConsent().snapshot;
201
+ var analyticsAcceptedBefore = (timestamp) => {
202
+ const { preference } = observeBrowserConsent();
203
+ return preference?.choice === "accepted" && preference.issuedAt <= timestamp;
197
204
  };
198
- var analyticsAllowed = () => analyticsConsentSnapshot().startsWith("accepted:");
199
- var analyticsAcceptedBefore = (timestamp) => analyticsAllowed() && (browserPreference()?.issuedAt ?? Infinity) <= timestamp;
200
205
  var analyticsExportGuard = () => {
201
- const snapshot = analyticsConsentSnapshot();
202
- const generation = consentGeneration;
203
- return () => snapshot.startsWith("accepted:") && analyticsConsentSnapshot() === snapshot && consentGeneration === generation;
206
+ const initial = observeBrowserConsent();
207
+ return () => initial.preference?.choice === "accepted" && observeBrowserConsent().generation === initial.generation;
204
208
  };
205
209
  var subscribeAnalyticsConsent = (listener) => {
206
210
  let previous = analyticsConsentSnapshot();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krak-stack/registry",
3
- "version": "0.11.6",
3
+ "version": "0.11.9",
4
4
  "description": "Tree-shakable KrakStack components and Effect services.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -17,6 +17,18 @@
17
17
  "type": "module",
18
18
  "sideEffects": false,
19
19
  "exports": {
20
+ "./access": {
21
+ "types": "./dist/lib/access/index.d.ts",
22
+ "import": "./dist/lib/access/index.js"
23
+ },
24
+ "./access/table/react": {
25
+ "types": "./dist/lib/access/table/react.d.ts",
26
+ "import": "./dist/lib/access/table/react.js"
27
+ },
28
+ "./access/table/html": {
29
+ "types": "./dist/lib/access/table/html.d.ts",
30
+ "import": "./dist/lib/access/table/html.js"
31
+ },
20
32
  "./hint": {
21
33
  "types": "./dist/components/hint/react.d.ts",
22
34
  "import": "./dist/components/hint/react.js"
@@ -65,6 +77,14 @@
65
77
  "types": "./dist/components/audit-log-table/react.d.ts",
66
78
  "import": "./dist/components/audit-log-table/react.js"
67
79
  },
80
+ "./audit-log-table/html": {
81
+ "types": "./dist/components/audit-log-table/html.d.ts",
82
+ "import": "./dist/components/audit-log-table/html.js"
83
+ },
84
+ "./tracking-notice/html": {
85
+ "types": "./dist/components/tracking-notice/html.d.ts",
86
+ "import": "./dist/components/tracking-notice/html.js"
87
+ },
68
88
  "./events/tracking-notice": {
69
89
  "types": "./dist/components/tracking-notice/react.d.ts",
70
90
  "import": "./dist/components/tracking-notice/react.js"