@declarion/react 0.1.67 → 0.1.68

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 (53) hide show
  1. package/dist-lib/api/client.d.ts +17 -0
  2. package/dist-lib/api/data.d.ts +12 -0
  3. package/dist-lib/api/params.d.ts +9 -3
  4. package/dist-lib/components/fields/EmailField.d.ts +1 -1
  5. package/dist-lib/components/fields/PhoneField.d.ts +2 -0
  6. package/dist-lib/components/fields/UrlField.d.ts +1 -1
  7. package/dist-lib/components/fields/cells/factories/badge.d.ts +2 -0
  8. package/dist-lib/components/fields/cells/factories/boolPill.d.ts +2 -0
  9. package/dist-lib/components/fields/cells/factories/code.d.ts +2 -0
  10. package/dist-lib/components/fields/cells/factories/email.d.ts +2 -0
  11. package/dist-lib/components/fields/cells/factories/host-icons.d.ts +9 -0
  12. package/dist-lib/components/fields/cells/factories/link.d.ts +2 -0
  13. package/dist-lib/components/fields/cells/factories/markdown.d.ts +2 -0
  14. package/dist-lib/components/fields/cells/factories/money.d.ts +2 -0
  15. package/dist-lib/components/fields/cells/factories/multilangInline.d.ts +2 -0
  16. package/dist-lib/components/fields/cells/factories/nextRun.d.ts +2 -0
  17. package/dist-lib/components/fields/cells/factories/number.d.ts +2 -0
  18. package/dist-lib/components/fields/cells/factories/passwordMask.d.ts +2 -0
  19. package/dist-lib/components/fields/cells/factories/phone.d.ts +2 -0
  20. package/dist-lib/components/fields/cells/factories/refLink.d.ts +2 -0
  21. package/dist-lib/components/fields/cells/factories/richTextPreview.d.ts +2 -0
  22. package/dist-lib/components/fields/cells/factories/statusPill.d.ts +2 -0
  23. package/dist-lib/components/fields/cells/factories/tagList.d.ts +2 -0
  24. package/dist-lib/components/fields/cells/factories/text.d.ts +2 -0
  25. package/dist-lib/components/fields/cells/factories/timestamp.d.ts +3 -0
  26. package/dist-lib/components/fields/cells/factories/url-helpers.d.ts +12 -0
  27. package/dist-lib/components/fields/cells/factories/url.d.ts +2 -0
  28. package/dist-lib/components/fields/cells/registry.d.ts +18 -0
  29. package/dist-lib/components/fields/index.d.ts +8 -3
  30. package/dist-lib/components/file-widgets/host.d.ts +5 -1
  31. package/dist-lib/components/pages/ExportMenu.d.ts +32 -0
  32. package/dist-lib/components/pages/auth/AuthShell.d.ts +17 -2
  33. package/dist-lib/components/pages/auth/Reset.d.ts +1 -0
  34. package/dist-lib/components/pages/exportRequest.d.ts +71 -0
  35. package/dist-lib/components/primitives/BrandGlyph.d.ts +8 -0
  36. package/dist-lib/components/primitives/BrandLogo.d.ts +1 -5
  37. package/dist-lib/components/primitives/index.d.ts +2 -0
  38. package/dist-lib/components/shared/EmptyState.d.ts +1 -1
  39. package/dist-lib/declarion-glyph.svg +17 -0
  40. package/dist-lib/declarion-react.css +1 -1
  41. package/dist-lib/hooks/useParams.d.ts +42 -1
  42. package/dist-lib/hooks/useUserLocale.d.ts +1 -0
  43. package/dist-lib/index.d.ts +2 -1
  44. package/dist-lib/index.js +4615 -3248
  45. package/dist-lib/index.js.map +1 -1
  46. package/dist-lib/lib/safe-url.d.ts +1 -0
  47. package/dist-lib/lib/timestamp.d.ts +17 -0
  48. package/dist-lib/stores/appearance.d.ts +3 -0
  49. package/dist-lib/types/api.d.ts +45 -0
  50. package/dist-lib/types/fieldType.d.ts +2 -0
  51. package/dist-lib/types/schema.d.ts +53 -0
  52. package/dist-lib/vite/declarion-glyph.svg +17 -0
  53. package/package.json +2 -2
@@ -0,0 +1 @@
1
+ export declare function safeExternalUrl(input: string | undefined | null): string | undefined;
@@ -18,3 +18,20 @@ export declare function formatWireDateTime(date?: Date): string;
18
18
  * Falls back to browser-local formatting for bare datetime strings.
19
19
  */
20
20
  export declare function formatOffsetTimestamp(raw: string): string;
21
+ /**
22
+ * Relative-or-absolute timestamp formatting for the time_ago cell renderer.
23
+ *
24
+ * Returns a short relative phrase ("5 minutes ago", "2 days ago") when the
25
+ * timestamp is within the last 30 days, and an ISO date ("2026-01-15") when
26
+ * older. Linear / Stripe / Datadog convention — avoids the "1y 4mo 12d ago"
27
+ * eyesore for stable historical data.
28
+ *
29
+ * `absolute` is the offset-aware long form intended for the cell's hover
30
+ * tooltip; the user always has access to the precise timestamp.
31
+ *
32
+ * Bare or unparseable input falls back to the raw string for both fields.
33
+ */
34
+ export declare function formatRelativeOrAbsolute(raw: string | Date | null | undefined, now?: Date): {
35
+ text: string;
36
+ absolute: string;
37
+ };
@@ -4,6 +4,7 @@ export type Density = "compact" | "comfortable" | "cozy";
4
4
  export type SidebarMode = "wide" | "collapsed";
5
5
  export type TabsPosition = "top" | "bottom";
6
6
  export type AiSurface = "command" | "panel" | "both" | "off";
7
+ export type FaviconSource = "google" | "direct" | "none";
7
8
  export interface Appearance {
8
9
  theme: ThemeId;
9
10
  accent: AccentId;
@@ -16,6 +17,8 @@ export interface Appearance {
16
17
  radius: number;
17
18
  zebra: boolean;
18
19
  aiSurface: AiSurface;
20
+ /** Favicon source for unknown hosts in URL cells. See ui_favicon_source. */
21
+ faviconSource: FaviconSource;
19
22
  }
20
23
  export declare function applyAppearance(a: Appearance): void;
21
24
  interface AppearanceState extends Appearance {
@@ -99,6 +99,13 @@ export interface PublicParam {
99
99
  description?: LocalizedString;
100
100
  value: unknown;
101
101
  }
102
+ /** Per-app legal/support URL set rendered in the auth-shell footer. */
103
+ export interface PublicLegalLinks {
104
+ security_url?: string;
105
+ privacy_url?: string;
106
+ terms_url?: string;
107
+ docs_url?: string;
108
+ }
102
109
  /** Subset of branding exposed pre-login by /api/params/public. */
103
110
  export interface PublicBranding {
104
111
  app_name?: string;
@@ -108,16 +115,54 @@ export interface PublicBranding {
108
115
  ai_name?: string;
109
116
  wordmark?: string;
110
117
  version_label?: string;
118
+ status_url?: string;
111
119
  auth_tagline?: LocalizedString;
112
120
  auth_subtagline?: LocalizedString;
113
121
  auth_badges?: LocalizedString[];
122
+ legal_entity?: string;
123
+ workspace_domain?: string;
124
+ legal_links?: PublicLegalLinks;
125
+ }
126
+ /**
127
+ * Deploy-time identity exposed pre-login by /api/params/public so the
128
+ * auth shell can render real region/build values (no mockup placeholders).
129
+ * Each field is empty when unconfigured/unset; consumers hide the pill
130
+ * when the entire block is missing or empty.
131
+ */
132
+ export interface PublicMeta {
133
+ version?: string;
134
+ revision?: string;
135
+ build_time?: string;
136
+ region?: string;
114
137
  }
115
138
  /** Envelope returned by GET /api/params/public. */
116
139
  export interface PublicParamsResponse {
117
140
  parameters: PublicParam[];
118
141
  accents?: Record<string, AccentDef>;
119
142
  branding?: PublicBranding;
143
+ meta?: PublicMeta;
144
+ }
145
+ /**
146
+ * Wire envelope for GET /api/params/{code}.
147
+ *
148
+ * The server always responds with HTTP 200. `found:false` means the
149
+ * platform has no value for the code (undeclared, restricted-category,
150
+ * or no value at any resolution layer); the caller substitutes its own
151
+ * default. `found:true` means `value` is authoritative - even if it is
152
+ * null/zero (an explicit nil value is a real value, not absence).
153
+ *
154
+ * The default never crosses the wire; servers don't track caller
155
+ * defaults, so two callers with different defaults always see consistent
156
+ * server state.
157
+ */
158
+ export interface ParamLookup {
159
+ code: string;
160
+ found: boolean;
161
+ value?: unknown;
162
+ source?: "object" | "user" | "role" | "tenant" | "env" | "yaml";
163
+ type?: string;
120
164
  }
165
+ /** @deprecated Prefer `ParamLookup`. Retained for callers still inspecting `source`. */
121
166
  export interface ResolvedParam {
122
167
  code: string;
123
168
  name: LocalizedString;
@@ -0,0 +1,2 @@
1
+ export type FieldType = "uuid" | "string" | "text" | "rich_text" | "int" | "float" | "bool" | "date" | "time" | "timestamp" | "email" | "url" | "phone" | "enum" | "json" | "ref" | "tags" | "multilang" | "multilang_text" | "structure" | "secret" | "password" | "decimal" | "string_array" | "int_array";
2
+ export declare const FIELD_TYPES: readonly FieldType[];
@@ -2,6 +2,18 @@ import { OrderedMap } from "./ordmap";
2
2
  import type { FileFieldDef } from "./files";
3
3
  export { OrderedMap };
4
4
  export type LocalizedString = Record<string, string>;
5
+ /**
6
+ * Per-entity empty-state copy declared in the manifest under
7
+ * `display.empty_state`. Title and Body are localized; LearnMoreURL is a
8
+ * plain string. The SDK falls back to a generic "No <plural> yet" derived
9
+ * from `display.name_plural` when this is absent. Read-only entities never
10
+ * render the legacy "Create your first..." copy regardless of EmptyStateDef.
11
+ */
12
+ export interface EmptyStateDef {
13
+ title?: LocalizedString;
14
+ body?: LocalizedString;
15
+ learn_more_url?: string;
16
+ }
5
17
  /**
6
18
  * Reserved sentinel value for Screen.detail_screen (list screens). Disables
7
19
  * row-click navigation even when the entity declares a canonical detail. Paired
@@ -46,12 +58,22 @@ export interface EntityField {
46
58
  default?: unknown;
47
59
  display?: {
48
60
  name: LocalizedString;
61
+ description?: LocalizedString;
49
62
  width?: number;
50
63
  widget?: string;
51
64
  is_listable?: boolean;
52
65
  is_filterable?: boolean;
53
66
  ref_display_field?: string;
54
67
  span?: number | "full";
68
+ bool_labels?: {
69
+ true: LocalizedString;
70
+ false: LocalizedString;
71
+ };
72
+ value_map?: Record<string, {
73
+ label?: LocalizedString;
74
+ color?: string;
75
+ }>;
76
+ currency?: string;
55
77
  };
56
78
  values?: Array<{
57
79
  code: string;
@@ -192,6 +214,7 @@ export interface Entity {
192
214
  icon: string;
193
215
  display_field?: string;
194
216
  display_template?: string;
217
+ empty_state?: EmptyStateDef;
195
218
  };
196
219
  fields: OrderedMap<EntityField>;
197
220
  soft_delete?: string;
@@ -205,6 +228,32 @@ export interface Entity {
205
228
  associations?: Record<string, AssociationDef>;
206
229
  files?: OrderedMap<FileFieldDef>;
207
230
  detail_screen?: string;
231
+ /** Standard CSV export gate per docs/plans/2026-05-01-standard-table-export.md.
232
+ * Absent block (or absent `enabled`) means export is enabled. Only an
233
+ * explicit `enabled: false` opts out, mirroring the Go ExportEnabled()
234
+ * helper. Same shape ships on Screen for per-screen overrides. */
235
+ export?: ExportConfig;
236
+ /** At most one row visible per caller. Loader requires either a
237
+ * caller-bound `prefilter` or `access: self` to back this. Frontend
238
+ * routes a singleton entity's detail screen at the screen's declared
239
+ * `route:` without a `:id` segment, and skips list-route registration. */
240
+ singleton?: boolean;
241
+ /** Server-enforced WHERE applied unconditionally on every read/write
242
+ * via server/handlers/data_prefilter.go. Values may be literal scalars
243
+ * OR `$caller.*` expressions (`$caller.user_id`, `$caller.tenant_id`)
244
+ * resolved at request time. Security boundary, not a UX hint. */
245
+ prefilter?: Record<string, unknown>;
246
+ /** Hard entity-wide access gate. `"self"` restricts every read/write
247
+ * to rows where the field marked `owner: true` matches the caller's
248
+ * user id (chokepoint + with_check). `"platform_admin"` restricts to
249
+ * platform owner / superadmin roles. Empty = standard RBAC. */
250
+ access?: "self" | "platform_admin";
251
+ /** Whether the entity participates in RBAC permission gating
252
+ * (`entity:<code>:<op>` grants). Mirrors engine.Entity.Permissions. */
253
+ permissions?: boolean;
254
+ }
255
+ export interface ExportConfig {
256
+ enabled?: boolean;
208
257
  }
209
258
  export declare function getPrimaryKeyFields(entity: Entity): string[];
210
259
  export type PkValues = Record<string, string>;
@@ -311,6 +360,10 @@ export interface Screen {
311
360
  inline_edit?: InlineEditConfig;
312
361
  column_overrides?: Record<string, ColumnSpec>;
313
362
  activity_rail?: ActivityRailConfig;
363
+ /** Per-screen override for the CSV export gate. Same shape as Entity.export.
364
+ * Either gate being false hides the toolbar Export menu and makes the
365
+ * POST endpoint return 403 EXPORT_DISABLED. */
366
+ export?: ExportConfig;
314
367
  }
315
368
  export interface QuickPeekConfig {
316
369
  enabled?: boolean;
@@ -0,0 +1,17 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64">
2
+ <!--
3
+ Declarion mark: angular letter "D" with an embedded "=" in the negative
4
+ space of the counter. Encodes the product thesis ("this declaration
5
+ equals this runtime behavior") in the letterform itself. Solid accent
6
+ purple #5B5BD6 — visible on both light surfaces and the dark brand
7
+ panel without prefers-color-scheme tricks. Trademark distinctive,
8
+ scales crisp from favicon (16px) through hero (96px+).
9
+ -->
10
+ <path
11
+ fill-rule="evenodd"
12
+ fill="#5B5BD6"
13
+ d="M 6 6 H 42 L 58 22 V 42 L 42 58 H 6 Z M 18 18 V 46 H 38 L 46 38 V 26 L 38 18 Z"
14
+ />
15
+ <rect x="22" y="28" width="20" height="3" fill="#5B5BD6"/>
16
+ <rect x="22" y="33" width="20" height="3" fill="#5B5BD6"/>
17
+ </svg>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@declarion/react",
3
- "version": "0.1.67",
3
+ "version": "0.1.68",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "description": "React SDK for Declarion, the schema-driven business apps platform.",
@@ -87,7 +87,7 @@
87
87
  },
88
88
  "scripts": {
89
89
  "dev": "vite",
90
- "build": "tsc --noEmit && vite build",
90
+ "build": "tsc -p tsconfig.app.json --noEmit && vite build",
91
91
  "build:lib": "vite build --config vite.lib.config.ts && vite build --config vite.plugin.config.ts && tsc -p tsconfig.lib.json && tsc-alias -p tsconfig.lib.json",
92
92
  "lint": "tsc --noEmit && eslint src",
93
93
  "test": "vitest run",