@almadar/ui 2.48.4 → 2.48.5

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.
@@ -1,6 +1,5 @@
1
- import React2, { createContext, useCallback, useState, useEffect, useMemo, useContext, useRef, useSyncExternalStore } from 'react';
2
- import { EventBusContext } from '@almadar/ui/providers';
3
- import 'react/jsx-runtime';
1
+ import React, { createContext, useCallback, useState, useEffect, useMemo, useContext, useRef, useSyncExternalStore } from 'react';
2
+ import { EventBusContext, SelectionContext } from '@almadar/ui/providers';
4
3
  import { useQueryClient, useMutation, useQuery } from '@tanstack/react-query';
5
4
 
6
5
  function useOrbitalHistory(options) {
@@ -870,22 +869,13 @@ function useDeepAgentGeneration() {
870
869
  // lib/logger.ts
871
870
  var LEVEL_PRIORITY = { DEBUG: 0, INFO: 1, WARN: 2, ERROR: 3 };
872
871
  var ENV = typeof process !== "undefined" && process.env ? process.env : {};
873
- var VITE_ENV = typeof globalThis !== "undefined" && globalThis.__vite_env__ ? globalThis.__vite_env__ : {};
874
- function getViteEnv(key) {
875
- try {
876
- const meta = (0, eval)('typeof import.meta !== "undefined" && import.meta');
877
- return meta ? meta.env?.[key] : void 0;
878
- } catch {
879
- return void 0;
880
- }
881
- }
882
- function envGet(key, viteKey) {
883
- return ENV[key] ?? (viteKey ? getViteEnv(viteKey) : void 0) ?? VITE_ENV[viteKey ?? key];
872
+ function envGet(key) {
873
+ return ENV[key] ?? ENV[`VITE_${key}`];
884
874
  }
885
- var NODE_ENV = envGet("NODE_ENV", "VITE_NODE_ENV") ?? "development";
886
- var CONFIGURED_LEVEL = (envGet("LOG_LEVEL", "VITE_LOG_LEVEL") ?? (NODE_ENV === "production" ? "info" : "debug")).toUpperCase();
875
+ var NODE_ENV = envGet("NODE_ENV") ?? "development";
876
+ var CONFIGURED_LEVEL = (envGet("LOG_LEVEL") ?? (NODE_ENV === "production" ? "info" : "debug")).toUpperCase();
887
877
  var MIN_PRIORITY = LEVEL_PRIORITY[CONFIGURED_LEVEL] ?? 0;
888
- var DEBUG_FILTER = (envGet("ALMADAR_DEBUG", "VITE_ALMADAR_DEBUG") ?? "").split(",").map((s) => s.trim()).filter(Boolean);
878
+ var DEBUG_FILTER = (envGet("ALMADAR_DEBUG") ?? "").split(",").map((s) => s.trim()).filter(Boolean);
889
879
  function matchesNamespace(namespace) {
890
880
  if (DEBUG_FILTER.length === 0) return true;
891
881
  return DEBUG_FILTER.some((pattern) => {
@@ -1167,9 +1157,6 @@ function useUISlotManager() {
1167
1157
  getContent
1168
1158
  };
1169
1159
  }
1170
- var SelectionContext = createContext(null);
1171
-
1172
- // hooks/useUIEvents.ts
1173
1160
  var UI_PREFIX = "UI:";
1174
1161
  function useUIEvents(dispatch, validEvents, eventBusInstance) {
1175
1162
  const defaultEventBus = useEventBus();
@@ -1255,7 +1242,7 @@ function EntityDataProvider({
1255
1242
  adapter,
1256
1243
  children
1257
1244
  }) {
1258
- return React2.createElement(
1245
+ return React.createElement(
1259
1246
  EntityDataContext.Provider,
1260
1247
  { value: adapter },
1261
1248
  children
@@ -430,22 +430,13 @@ function clearTraits() {
430
430
  // lib/logger.ts
431
431
  var LEVEL_PRIORITY = { DEBUG: 0, INFO: 1, WARN: 2, ERROR: 3 };
432
432
  var ENV = typeof process !== "undefined" && process.env ? process.env : {};
433
- var VITE_ENV = typeof globalThis !== "undefined" && globalThis.__vite_env__ ? globalThis.__vite_env__ : {};
434
- function getViteEnv(key) {
435
- try {
436
- const meta = (0, eval)('typeof import.meta !== "undefined" && import.meta');
437
- return meta ? meta.env?.[key] : void 0;
438
- } catch {
439
- return void 0;
440
- }
441
- }
442
- function envGet(key, viteKey) {
443
- return ENV[key] ?? (viteKey ? getViteEnv(viteKey) : void 0) ?? VITE_ENV[viteKey ?? key];
433
+ function envGet(key) {
434
+ return ENV[key] ?? ENV[`VITE_${key}`];
444
435
  }
445
- var NODE_ENV = envGet("NODE_ENV", "VITE_NODE_ENV") ?? "development";
446
- var CONFIGURED_LEVEL = (envGet("LOG_LEVEL", "VITE_LOG_LEVEL") ?? (NODE_ENV === "production" ? "info" : "debug")).toUpperCase();
436
+ var NODE_ENV = envGet("NODE_ENV") ?? "development";
437
+ var CONFIGURED_LEVEL = (envGet("LOG_LEVEL") ?? (NODE_ENV === "production" ? "info" : "debug")).toUpperCase();
447
438
  var MIN_PRIORITY = LEVEL_PRIORITY[CONFIGURED_LEVEL] ?? 0;
448
- var DEBUG_FILTER = (envGet("ALMADAR_DEBUG", "VITE_ALMADAR_DEBUG") ?? "").split(",").map((s) => s.trim()).filter(Boolean);
439
+ var DEBUG_FILTER = (envGet("ALMADAR_DEBUG") ?? "").split(",").map((s) => s.trim()).filter(Boolean);
449
440
  function matchesNamespace(namespace) {
450
441
  if (DEBUG_FILTER.length === 0) return true;
451
442
  return DEBUG_FILTER.some((pattern) => {
package/dist/lib/index.js CHANGED
@@ -428,22 +428,13 @@ function clearTraits() {
428
428
  // lib/logger.ts
429
429
  var LEVEL_PRIORITY = { DEBUG: 0, INFO: 1, WARN: 2, ERROR: 3 };
430
430
  var ENV = typeof process !== "undefined" && process.env ? process.env : {};
431
- var VITE_ENV = typeof globalThis !== "undefined" && globalThis.__vite_env__ ? globalThis.__vite_env__ : {};
432
- function getViteEnv(key) {
433
- try {
434
- const meta = (0, eval)('typeof import.meta !== "undefined" && import.meta');
435
- return meta ? meta.env?.[key] : void 0;
436
- } catch {
437
- return void 0;
438
- }
439
- }
440
- function envGet(key, viteKey) {
441
- return ENV[key] ?? (viteKey ? getViteEnv(viteKey) : void 0) ?? VITE_ENV[viteKey ?? key];
431
+ function envGet(key) {
432
+ return ENV[key] ?? ENV[`VITE_${key}`];
442
433
  }
443
- var NODE_ENV = envGet("NODE_ENV", "VITE_NODE_ENV") ?? "development";
444
- var CONFIGURED_LEVEL = (envGet("LOG_LEVEL", "VITE_LOG_LEVEL") ?? (NODE_ENV === "production" ? "info" : "debug")).toUpperCase();
434
+ var NODE_ENV = envGet("NODE_ENV") ?? "development";
435
+ var CONFIGURED_LEVEL = (envGet("LOG_LEVEL") ?? (NODE_ENV === "production" ? "info" : "debug")).toUpperCase();
445
436
  var MIN_PRIORITY = LEVEL_PRIORITY[CONFIGURED_LEVEL] ?? 0;
446
- var DEBUG_FILTER = (envGet("ALMADAR_DEBUG", "VITE_ALMADAR_DEBUG") ?? "").split(",").map((s) => s.trim()).filter(Boolean);
437
+ var DEBUG_FILTER = (envGet("ALMADAR_DEBUG") ?? "").split(",").map((s) => s.trim()).filter(Boolean);
447
438
  function matchesNamespace(namespace) {
448
439
  if (DEBUG_FILTER.length === 0) return true;
449
440
  return DEBUG_FILTER.some((pattern) => {
@@ -2510,22 +2510,13 @@ function cn(...inputs) {
2510
2510
  // lib/logger.ts
2511
2511
  var LEVEL_PRIORITY = { DEBUG: 0, INFO: 1, WARN: 2, ERROR: 3 };
2512
2512
  var ENV = typeof process !== "undefined" && process.env ? process.env : {};
2513
- var VITE_ENV = typeof globalThis !== "undefined" && globalThis.__vite_env__ ? globalThis.__vite_env__ : {};
2514
- function getViteEnv(key) {
2515
- try {
2516
- const meta = (0, eval)('typeof import.meta !== "undefined" && import.meta');
2517
- return meta ? meta.env?.[key] : void 0;
2518
- } catch {
2519
- return void 0;
2520
- }
2521
- }
2522
- function envGet(key, viteKey) {
2523
- return ENV[key] ?? (viteKey ? getViteEnv(viteKey) : void 0) ?? VITE_ENV[viteKey ?? key];
2513
+ function envGet(key) {
2514
+ return ENV[key] ?? ENV[`VITE_${key}`];
2524
2515
  }
2525
- var NODE_ENV = envGet("NODE_ENV", "VITE_NODE_ENV") ?? "development";
2526
- var CONFIGURED_LEVEL = (envGet("LOG_LEVEL", "VITE_LOG_LEVEL") ?? (NODE_ENV === "production" ? "info" : "debug")).toUpperCase();
2516
+ var NODE_ENV = envGet("NODE_ENV") ?? "development";
2517
+ var CONFIGURED_LEVEL = (envGet("LOG_LEVEL") ?? (NODE_ENV === "production" ? "info" : "debug")).toUpperCase();
2527
2518
  var MIN_PRIORITY = LEVEL_PRIORITY[CONFIGURED_LEVEL] ?? 0;
2528
- var DEBUG_FILTER = (envGet("ALMADAR_DEBUG", "VITE_ALMADAR_DEBUG") ?? "").split(",").map((s) => s.trim()).filter(Boolean);
2519
+ var DEBUG_FILTER = (envGet("ALMADAR_DEBUG") ?? "").split(",").map((s) => s.trim()).filter(Boolean);
2529
2520
  function matchesNamespace(namespace) {
2530
2521
  if (DEBUG_FILTER.length === 0) return true;
2531
2522
  return DEBUG_FILTER.some((pattern) => {
@@ -2486,22 +2486,13 @@ function cn(...inputs) {
2486
2486
  // lib/logger.ts
2487
2487
  var LEVEL_PRIORITY = { DEBUG: 0, INFO: 1, WARN: 2, ERROR: 3 };
2488
2488
  var ENV = typeof process !== "undefined" && process.env ? process.env : {};
2489
- var VITE_ENV = typeof globalThis !== "undefined" && globalThis.__vite_env__ ? globalThis.__vite_env__ : {};
2490
- function getViteEnv(key) {
2491
- try {
2492
- const meta = (0, eval)('typeof import.meta !== "undefined" && import.meta');
2493
- return meta ? meta.env?.[key] : void 0;
2494
- } catch {
2495
- return void 0;
2496
- }
2497
- }
2498
- function envGet(key, viteKey) {
2499
- return ENV[key] ?? (viteKey ? getViteEnv(viteKey) : void 0) ?? VITE_ENV[viteKey ?? key];
2489
+ function envGet(key) {
2490
+ return ENV[key] ?? ENV[`VITE_${key}`];
2500
2491
  }
2501
- var NODE_ENV = envGet("NODE_ENV", "VITE_NODE_ENV") ?? "development";
2502
- var CONFIGURED_LEVEL = (envGet("LOG_LEVEL", "VITE_LOG_LEVEL") ?? (NODE_ENV === "production" ? "info" : "debug")).toUpperCase();
2492
+ var NODE_ENV = envGet("NODE_ENV") ?? "development";
2493
+ var CONFIGURED_LEVEL = (envGet("LOG_LEVEL") ?? (NODE_ENV === "production" ? "info" : "debug")).toUpperCase();
2503
2494
  var MIN_PRIORITY = LEVEL_PRIORITY[CONFIGURED_LEVEL] ?? 0;
2504
- var DEBUG_FILTER = (envGet("ALMADAR_DEBUG", "VITE_ALMADAR_DEBUG") ?? "").split(",").map((s) => s.trim()).filter(Boolean);
2495
+ var DEBUG_FILTER = (envGet("ALMADAR_DEBUG") ?? "").split(",").map((s) => s.trim()).filter(Boolean);
2505
2496
  function matchesNamespace(namespace) {
2506
2497
  if (DEBUG_FILTER.length === 0) return true;
2507
2498
  return DEBUG_FILTER.some((pattern) => {
@@ -321,22 +321,13 @@ var ThemeProvider = ({
321
321
  // lib/logger.ts
322
322
  var LEVEL_PRIORITY = { DEBUG: 0, INFO: 1, WARN: 2, ERROR: 3 };
323
323
  var ENV = typeof process !== "undefined" && process.env ? process.env : {};
324
- var VITE_ENV = typeof globalThis !== "undefined" && globalThis.__vite_env__ ? globalThis.__vite_env__ : {};
325
- function getViteEnv(key) {
326
- try {
327
- const meta = (0, eval)('typeof import.meta !== "undefined" && import.meta');
328
- return meta ? meta.env?.[key] : void 0;
329
- } catch {
330
- return void 0;
331
- }
332
- }
333
- function envGet(key, viteKey) {
334
- return ENV[key] ?? (viteKey ? getViteEnv(viteKey) : void 0) ?? VITE_ENV[viteKey ?? key];
324
+ function envGet(key) {
325
+ return ENV[key] ?? ENV[`VITE_${key}`];
335
326
  }
336
- var NODE_ENV = envGet("NODE_ENV", "VITE_NODE_ENV") ?? "development";
337
- var CONFIGURED_LEVEL = (envGet("LOG_LEVEL", "VITE_LOG_LEVEL") ?? (NODE_ENV === "production" ? "info" : "debug")).toUpperCase();
327
+ var NODE_ENV = envGet("NODE_ENV") ?? "development";
328
+ var CONFIGURED_LEVEL = (envGet("LOG_LEVEL") ?? (NODE_ENV === "production" ? "info" : "debug")).toUpperCase();
338
329
  var MIN_PRIORITY = LEVEL_PRIORITY[CONFIGURED_LEVEL] ?? 0;
339
- var DEBUG_FILTER = (envGet("ALMADAR_DEBUG", "VITE_ALMADAR_DEBUG") ?? "").split(",").map((s) => s.trim()).filter(Boolean);
330
+ var DEBUG_FILTER = (envGet("ALMADAR_DEBUG") ?? "").split(",").map((s) => s.trim()).filter(Boolean);
340
331
  function matchesNamespace(namespace) {
341
332
  if (DEBUG_FILTER.length === 0) return true;
342
333
  return DEBUG_FILTER.some((pattern) => {
@@ -275,22 +275,13 @@ var ThemeProvider = ({
275
275
  // lib/logger.ts
276
276
  var LEVEL_PRIORITY = { DEBUG: 0, INFO: 1, WARN: 2, ERROR: 3 };
277
277
  var ENV = typeof process !== "undefined" && process.env ? process.env : {};
278
- var VITE_ENV = typeof globalThis !== "undefined" && globalThis.__vite_env__ ? globalThis.__vite_env__ : {};
279
- function getViteEnv(key) {
280
- try {
281
- const meta = (0, eval)('typeof import.meta !== "undefined" && import.meta');
282
- return meta ? meta.env?.[key] : void 0;
283
- } catch {
284
- return void 0;
285
- }
286
- }
287
- function envGet(key, viteKey) {
288
- return ENV[key] ?? (viteKey ? getViteEnv(viteKey) : void 0) ?? VITE_ENV[viteKey ?? key];
278
+ function envGet(key) {
279
+ return ENV[key] ?? ENV[`VITE_${key}`];
289
280
  }
290
- var NODE_ENV = envGet("NODE_ENV", "VITE_NODE_ENV") ?? "development";
291
- var CONFIGURED_LEVEL = (envGet("LOG_LEVEL", "VITE_LOG_LEVEL") ?? (NODE_ENV === "production" ? "info" : "debug")).toUpperCase();
281
+ var NODE_ENV = envGet("NODE_ENV") ?? "development";
282
+ var CONFIGURED_LEVEL = (envGet("LOG_LEVEL") ?? (NODE_ENV === "production" ? "info" : "debug")).toUpperCase();
292
283
  var MIN_PRIORITY = LEVEL_PRIORITY[CONFIGURED_LEVEL] ?? 0;
293
- var DEBUG_FILTER = (envGet("ALMADAR_DEBUG", "VITE_ALMADAR_DEBUG") ?? "").split(",").map((s) => s.trim()).filter(Boolean);
284
+ var DEBUG_FILTER = (envGet("ALMADAR_DEBUG") ?? "").split(",").map((s) => s.trim()).filter(Boolean);
294
285
  function matchesNamespace(namespace) {
295
286
  if (DEBUG_FILTER.length === 0) return true;
296
287
  return DEBUG_FILTER.some((pattern) => {
@@ -12,11 +12,30 @@
12
12
  * @packageDocumentation
13
13
  */
14
14
  import React from 'react';
15
+ import type { OrbitalSchema, EntityData } from '@almadar/core';
15
16
  export interface OrbPreviewProps {
16
- /** The orbital schema. Accepts a JSON string or an OrbitalSchema object. */
17
- schema: string | import('@almadar/core').OrbitalSchema;
18
- /** Mock entity data keyed by entity name. */
19
- mockData?: Record<string, unknown[]>;
17
+ /**
18
+ * The orbital schema. Accepts a JSON string or an `OrbitalSchema` object
19
+ * from `@almadar/core` (the validated `.orb` program type).
20
+ */
21
+ schema: string | OrbitalSchema;
22
+ /**
23
+ * Mock entity rows keyed by entity name. The `EntityData` type from
24
+ * `@almadar/core` is `Record<string, EntityRow[]>` where each row is a
25
+ * `{ id?: string } & Record<string, FieldValue>`. Ignored if `autoMock`
26
+ * is set.
27
+ */
28
+ mockData?: EntityData;
29
+ /**
30
+ * When true, run the schema through `prepareSchemaForPreview` before
31
+ * rendering: auto-generate mock entity rows and flip two-state INIT
32
+ * machines so the data state is initial. This is the same pipeline the
33
+ * playground uses, so consumers (docs MDX, playground) all share one path.
34
+ *
35
+ * Ignored when `serverUrl` is set — server-driven previews provide their
36
+ * own data.
37
+ */
38
+ autoMock?: boolean;
20
39
  /** Preview container height. Default: '400px'. */
21
40
  height?: string;
22
41
  /** CSS class for the outer container. */
@@ -33,10 +52,11 @@ export interface OrbPreviewProps {
33
52
  * @example
34
53
  * ```tsx
35
54
  * <OrbPreview schema={orbJsonString} height="300px" />
55
+ * <OrbPreview schema={schema} autoMock />
36
56
  * <OrbPreview schema={schema} serverUrl="/api/orbitals" />
37
57
  * ```
38
58
  */
39
- export declare function OrbPreview({ schema, mockData, height, className, serverUrl, }: OrbPreviewProps): React.ReactElement;
59
+ export declare function OrbPreview({ schema, mockData, autoMock, height, className, serverUrl, }: OrbPreviewProps): React.ReactElement;
40
60
  export declare namespace OrbPreview {
41
61
  var displayName: string;
42
62
  }