orbital-ds 0.41.0 → 0.44.1
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/AGENTS.md +28 -9
- package/components.manifest.json +6469 -3569
- package/dist/auth-form-B1hgbXkI.d.ts +144 -0
- package/dist/hooks/use-ds-messages.d.ts +7 -0
- package/dist/lib/format.d.ts +57 -0
- package/dist/lib/format.js +177 -0
- package/dist/lib/i18n.d.ts +14 -2
- package/dist/lib/i18n.js +32 -2
- package/dist/lib/locales/de.d.ts +7 -0
- package/dist/lib/locales/de.js +535 -0
- package/dist/lib/locales/fr.d.ts +7 -0
- package/dist/lib/locales/fr.js +535 -0
- package/dist/lib/locales/he.d.ts +7 -0
- package/dist/lib/locales/he.js +535 -0
- package/dist/lib/locales/it.d.ts +7 -0
- package/dist/lib/locales/it.js +535 -0
- package/dist/styles.css +39 -1
- package/dist/ui/a2ui-renderer.d.ts +11 -0
- package/dist/ui/agent-events.d.ts +17 -0
- package/dist/ui/ai-tag.d.ts +16 -0
- package/dist/ui/alert-dialog.d.ts +37 -0
- package/dist/ui/alert.d.ts +1 -1
- package/dist/ui/animated-number.d.ts +11 -0
- package/dist/ui/app-bar.d.ts +22 -0
- package/dist/ui/attachment.d.ts +3 -3
- package/dist/ui/auth-backdrop.d.ts +17 -0
- package/dist/ui/auth-form.d.ts +3 -112
- package/dist/ui/auth-form.js +13 -6
- package/dist/ui/auth-layout.d.ts +38 -0
- package/dist/ui/avatar.d.ts +27 -0
- package/dist/ui/ayuda.d.ts +1 -1
- package/dist/ui/ayuda.js +4 -1
- package/dist/ui/banner.d.ts +1 -1
- package/dist/ui/bottom-nav.d.ts +22 -0
- package/dist/ui/breadcrumb.d.ts +22 -0
- package/dist/ui/breadcrumb.js +1 -1
- package/dist/ui/bubble.d.ts +1 -1
- package/dist/ui/button-group.d.ts +1 -1
- package/dist/ui/button.d.ts +2 -2
- package/dist/ui/calendar.d.ts +13 -0
- package/dist/ui/calendar.js +3 -0
- package/dist/ui/card-stack.d.ts +27 -0
- package/dist/ui/card.d.ts +33 -0
- package/dist/ui/carousel.d.ts +35 -0
- package/dist/ui/carousel.js +10 -5
- package/dist/ui/chain-of-thought.d.ts +15 -0
- package/dist/ui/chart-card.d.ts +19 -0
- package/dist/ui/chart.d.ts +19 -0
- package/dist/ui/chat-composer.d.ts +19 -0
- package/dist/ui/choice-card.d.ts +33 -0
- package/dist/ui/code-block.d.ts +15 -0
- package/dist/ui/combobox.d.ts +48 -0
- package/dist/ui/command-palette.d.ts +18 -0
- package/dist/ui/command.d.ts +34 -0
- package/dist/ui/confirm-action.d.ts +30 -0
- package/dist/ui/confirm-dialog.d.ts +23 -0
- package/dist/ui/content-card.d.ts +14 -0
- package/dist/ui/context-menu.d.ts +35 -0
- package/dist/ui/context-menu.js +1 -1
- package/dist/ui/conversation-list.d.ts +20 -0
- package/dist/ui/copy-button.d.ts +11 -0
- package/dist/ui/date-time.d.ts +40 -0
- package/dist/ui/date-time.js +55 -0
- package/dist/ui/description-list.d.ts +49 -0
- package/dist/ui/description-list.js +86 -0
- package/dist/ui/detail-panel.d.ts +22 -0
- package/dist/ui/dialog.d.ts +35 -0
- package/dist/ui/dock.d.ts +17 -0
- package/dist/ui/drawer.d.ts +41 -0
- package/dist/ui/dropdown-menu.d.ts +32 -0
- package/dist/ui/dropdown-menu.js +1 -1
- package/dist/ui/echart.d.ts +15 -0
- package/dist/ui/entity-list.d.ts +32 -0
- package/dist/ui/field.d.ts +1 -1
- package/dist/ui/form-layout.d.ts +24 -0
- package/dist/ui/gauge.d.ts +26 -0
- package/dist/ui/generated-image.d.ts +19 -0
- package/dist/ui/generated-table.d.ts +18 -0
- package/dist/ui/heatmap-grid.d.ts +20 -0
- package/dist/ui/hero.d.ts +58 -0
- package/dist/ui/hero.js +145 -0
- package/dist/ui/i18n-provider.d.ts +16 -0
- package/dist/ui/input-group.d.ts +1 -1
- package/dist/ui/input-otp.d.ts +23 -0
- package/dist/ui/input.d.ts +16 -0
- package/dist/ui/instruction-editor.d.ts +17 -0
- package/dist/ui/item.d.ts +3 -3
- package/dist/ui/label.d.ts +17 -0
- package/dist/ui/legend.d.ts +25 -0
- package/dist/ui/level-meter.d.ts +12 -0
- package/dist/ui/load-more.d.ts +17 -0
- package/dist/ui/loading-state.d.ts +12 -0
- package/dist/ui/markdown.d.ts +15 -0
- package/dist/ui/marker.d.ts +1 -1
- package/dist/ui/media-card.d.ts +16 -0
- package/dist/ui/menubar.d.ts +39 -0
- package/dist/ui/message-actions.d.ts +9 -0
- package/dist/ui/message-scroller.d.ts +30 -0
- package/dist/ui/message.d.ts +33 -0
- package/dist/ui/mfa-challenge.d.ts +3 -32
- package/dist/ui/mfa-challenge.js +1 -1
- package/dist/ui/mfa-setup.d.ts +1 -1
- package/dist/ui/mosaic.d.ts +23 -0
- package/dist/ui/motion-provider.d.ts +17 -0
- package/dist/ui/native-select.d.ts +22 -0
- package/dist/ui/next-step-card.d.ts +55 -0
- package/dist/ui/next-step-card.js +92 -0
- package/dist/ui/notice-review.d.ts +32 -0
- package/dist/ui/oauth-consent.d.ts +1 -1
- package/dist/ui/page-header.d.ts +46 -4
- package/dist/ui/page-header.js +20 -11
- package/dist/ui/page-loader.d.ts +17 -0
- package/dist/ui/page-shell.d.ts +17 -0
- package/dist/ui/pagination.d.ts +20 -0
- package/dist/ui/pagination.js +2 -2
- package/dist/ui/panel.d.ts +2 -2
- package/dist/ui/password-strength.d.ts +14 -0
- package/dist/ui/popover.d.ts +32 -0
- package/dist/ui/proportion-bar.d.ts +25 -0
- package/dist/ui/quantity.d.ts +25 -0
- package/dist/ui/quantity.js +27 -0
- package/dist/ui/questionnaire.d.ts +38 -0
- package/dist/ui/reasoning.d.ts +14 -0
- package/dist/ui/reveal.d.ts +17 -0
- package/dist/ui/sheet.d.ts +39 -2
- package/dist/ui/sheet.js +6 -2
- package/dist/ui/shield.d.ts +14 -0
- package/dist/ui/show-more.d.ts +14 -0
- package/dist/ui/sidebar.d.ts +5 -3
- package/dist/ui/sidebar.js +7 -3
- package/dist/ui/sparkline.d.ts +1 -1
- package/dist/ui/stat-group.d.ts +32 -0
- package/dist/ui/status-badge.d.ts +2 -2
- package/dist/ui/status-hero.d.ts +18 -0
- package/dist/ui/step-dots.d.ts +12 -0
- package/dist/ui/step-ring.d.ts +14 -0
- package/dist/ui/suggestions.d.ts +9 -0
- package/dist/ui/table.d.ts +26 -0
- package/dist/ui/tabs.d.ts +1 -1
- package/dist/ui/tag-input.d.ts +21 -0
- package/dist/ui/tag-input.js +169 -0
- package/dist/ui/task-loader.d.ts +15 -0
- package/dist/ui/task-progress.d.ts +14 -0
- package/dist/ui/textarea.d.ts +22 -1
- package/dist/ui/textarea.js +7 -1
- package/dist/ui/timeline.d.ts +26 -0
- package/dist/ui/toggle-group.d.ts +24 -0
- package/dist/ui/toggle.d.ts +1 -1
- package/dist/ui/tool-call.d.ts +12 -0
- package/dist/ui/usage-meter.d.ts +42 -0
- package/dist/ui/usage-meter.js +116 -0
- package/dist/ui/week-strip.d.ts +11 -0
- package/dist/ui/week-strip.js +2 -2
- package/dist/ui/workflow-run.d.ts +28 -0
- package/docs/adr/0001-rtl-clases-logicas.md +14 -1
- package/docs/designer/flujo.md +1 -1
- package/docs/designer/patrones.md +40 -1
- package/manifest/actions.json +364 -0
- package/manifest/agents.json +399 -0
- package/manifest/ai.json +128 -0
- package/manifest/auth.json +1547 -0
- package/manifest/chat.json +612 -0
- package/manifest/content.json +2298 -0
- package/manifest/data.json +2904 -0
- package/manifest/feedback.json +1005 -0
- package/manifest/forms.json +1954 -0
- package/manifest/motion.json +196 -0
- package/manifest/navigation.json +1792 -0
- package/manifest/overlays.json +931 -0
- package/package.json +242 -238
- package/scripts/cli.mjs +105 -8
- package/scripts/doctor.mjs +126 -1
- package/scripts/eslint-plugin.mjs +93 -0
- package/scripts/i18n.mjs +1 -1
- package/scripts/manifest.mjs +159 -7
- package/skill/SKILL.md +8 -3
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { MfaMethod, AuthErrorCode, AuthField, PasswordRules, AuthProviderOption, AuthLink } from './lib/auth.js';
|
|
3
|
+
|
|
4
|
+
type MfaChallengePreset = "totp" | "sms" | "email" | "backup-code" | "passkey";
|
|
5
|
+
declare function MfaChallenge({ preset, methods, destination, codeLength, trustDevice, onVerify, onPasskey, onResend, onMethodChange, resendAfter, onCancel, error: errorProp, title, description, className, ...props }: Omit<React.ComponentProps<"div">, "title"> & {
|
|
6
|
+
preset?: MfaChallengePreset;
|
|
7
|
+
/** Métodos activos de la persona (el primero no hace falta repetirlo). */
|
|
8
|
+
methods?: MfaMethod[];
|
|
9
|
+
/** Número o correo ya enmascarado («•••• 4821», «f•••@empresa.com»). */
|
|
10
|
+
destination?: string;
|
|
11
|
+
codeLength?: number;
|
|
12
|
+
/** Casilla «no volver a preguntar en este dispositivo». */
|
|
13
|
+
trustDevice?: boolean;
|
|
14
|
+
onVerify?: (code: string, options: {
|
|
15
|
+
method: MfaMethod;
|
|
16
|
+
trustDevice: boolean;
|
|
17
|
+
}) => AuthResult | Promise<AuthResult>;
|
|
18
|
+
onPasskey?: () => AuthResult | Promise<AuthResult>;
|
|
19
|
+
/** sms y email: reenviar el código. */
|
|
20
|
+
onResend?: (method: MfaMethod) => void | Promise<void>;
|
|
21
|
+
/** Se ha cambiado de método (p. ej. para pedir al servidor que envíe el SMS). */
|
|
22
|
+
onMethodChange?: (method: MfaMethod) => void;
|
|
23
|
+
resendAfter?: number;
|
|
24
|
+
/** Volver (cerrar sesión parcial, volver al inicio). */
|
|
25
|
+
onCancel?: () => void;
|
|
26
|
+
error?: React.ReactNode;
|
|
27
|
+
title?: React.ReactNode;
|
|
28
|
+
description?: React.ReactNode;
|
|
29
|
+
}): React.JSX.Element;
|
|
30
|
+
|
|
31
|
+
type AuthFormPreset = "sign-in" | "social" | "sign-up" | "magic-link" | "email-code" | "sso" | "forgot-password" | "reset-password";
|
|
32
|
+
type AuthIdentifierKind = "email" | "username" | "email-or-username";
|
|
33
|
+
type AuthMessage = AuthErrorCode | React.ReactNode;
|
|
34
|
+
type AuthFormValues = {
|
|
35
|
+
identifier: string;
|
|
36
|
+
password: string;
|
|
37
|
+
name: string;
|
|
38
|
+
confirmPassword: string;
|
|
39
|
+
remember: boolean;
|
|
40
|
+
terms: boolean;
|
|
41
|
+
/** Campos extra (`extraFields`) y todo lo demás del formulario. */
|
|
42
|
+
formData: FormData;
|
|
43
|
+
};
|
|
44
|
+
type AuthOrganization = {
|
|
45
|
+
id: string;
|
|
46
|
+
label: React.ReactNode;
|
|
47
|
+
description?: React.ReactNode;
|
|
48
|
+
icon?: React.ReactNode;
|
|
49
|
+
};
|
|
50
|
+
/** Lo que devuelve un callback: error general, errores por campo o la vista siguiente. */
|
|
51
|
+
type AuthResult = void | undefined | {
|
|
52
|
+
error?: AuthMessage;
|
|
53
|
+
fieldErrors?: Partial<Record<AuthField, AuthMessage>>;
|
|
54
|
+
next?: "password" | "code" | "sent" | "sso" | "redirecting" | "mfa";
|
|
55
|
+
};
|
|
56
|
+
/** Ruta que decide la app para un identificador (home realm discovery). */
|
|
57
|
+
type AuthRoute = void | undefined | {
|
|
58
|
+
method: "password" | "sso" | "passkey" | "email-code" | "magic-link";
|
|
59
|
+
/** Puerta por la que entra: plantilla o gente de fuera (se muestra junto al correo). */
|
|
60
|
+
access?: "internal" | "external";
|
|
61
|
+
/** SSO con varias organizaciones para el mismo dominio: se deja elegir. */
|
|
62
|
+
organizations?: AuthOrganization[];
|
|
63
|
+
error?: AuthMessage;
|
|
64
|
+
};
|
|
65
|
+
declare function AuthForm({ preset, title, description, icon, identifier, defaultIdentifier, identifierFirst, onIdentify, audience, entry, fields, extraFields, passwordRules, showStrength, remember, providers, onProvider, providersPlacement, providersLayout, onPasskey, onSso, ssoBy, lastUsed, mfa, onSubmit, onVerifyCode, onResend, resendAfter, codeLength, error: errorProp, fieldErrors: fieldErrorsProp, links, submitLabel, footer, className, ...props }: Omit<React.ComponentProps<"div">, "title" | "onSubmit"> & {
|
|
66
|
+
preset?: AuthFormPreset;
|
|
67
|
+
title?: React.ReactNode;
|
|
68
|
+
description?: React.ReactNode;
|
|
69
|
+
/** Icono sobre el título (IconTile, logo de la app…). */
|
|
70
|
+
icon?: React.ReactNode;
|
|
71
|
+
/** Qué identifica a la persona. */
|
|
72
|
+
identifier?: AuthIdentifierKind;
|
|
73
|
+
defaultIdentifier?: string;
|
|
74
|
+
/** sign-in: primero el identificador; luego el método que toque. */
|
|
75
|
+
identifierFirst?: boolean;
|
|
76
|
+
/** Home realm discovery: la app dice qué método le toca a ese identificador. */
|
|
77
|
+
onIdentify?: (identifier: string) => AuthRoute | Promise<AuthRoute>;
|
|
78
|
+
/** Quién puede entrar: explica en pantalla, antes de escribir el correo, qué puerta le toca a cada persona. */
|
|
79
|
+
audience?: "internal" | "external" | "mixed";
|
|
80
|
+
/** Inicio del acceso mixto: `identifier` pide el correo y el dominio decide; `doors` ofrece dos puertas sin escribir: «Continuar con SSO» para el personal y «Acceso para personas externas», que abre el formulario de cuenta propia (correo y contraseña, passkey). Necesita `onSso`. */
|
|
81
|
+
entry?: "identifier" | "doors";
|
|
82
|
+
/** Campos y orden (sign-up y reset-password). */
|
|
83
|
+
fields?: AuthField[];
|
|
84
|
+
/** Campos propios de la app, antes del botón (llegan en `formData`). */
|
|
85
|
+
extraFields?: React.ReactNode;
|
|
86
|
+
passwordRules?: PasswordRules;
|
|
87
|
+
/** Barra de fuerza de la contraseña (sign-up y reset-password por defecto). */
|
|
88
|
+
showStrength?: boolean;
|
|
89
|
+
/** Casilla «mantener la sesión iniciada». */
|
|
90
|
+
remember?: boolean;
|
|
91
|
+
/** SSO o redes sociales (la app pone nombre e icono). */
|
|
92
|
+
providers?: AuthProviderOption[];
|
|
93
|
+
onProvider?: (id: string) => void | Promise<AuthResult>;
|
|
94
|
+
providersPlacement?: "top" | "bottom";
|
|
95
|
+
providersLayout?: "stack" | "grid" | "icons";
|
|
96
|
+
/** Entrar con passkey (y autocompletado de passkeys en el campo del identificador). */
|
|
97
|
+
onPasskey?: () => void | Promise<AuthResult>;
|
|
98
|
+
/** SSO de empresa: enlace «usar SSO» en sign-in y envío del preset sso. */
|
|
99
|
+
onSso?: (input: {
|
|
100
|
+
identifier: string;
|
|
101
|
+
organization?: string;
|
|
102
|
+
}) => AuthResult | Promise<AuthResult | {
|
|
103
|
+
organizations: AuthOrganization[];
|
|
104
|
+
}>;
|
|
105
|
+
/** sso: se identifica por correo de trabajo o por organización. */
|
|
106
|
+
ssoBy?: "email" | "organization";
|
|
107
|
+
/**
|
|
108
|
+
* Segundo factor dentro del mismo flujo: cuando un callback devuelve `{ next: "mfa" }` se muestra `MfaChallenge`
|
|
109
|
+
* con estas props (`preset`, `methods`, `destination`, `onVerify`, `onPasskey`…). Sin ella, la app lo pinta aparte.
|
|
110
|
+
*/
|
|
111
|
+
mfa?: Omit<React.ComponentProps<typeof MfaChallenge>, "onCancel">;
|
|
112
|
+
/** Último método usado en este dispositivo: id de proveedor, "passkey", "sso" o "password". */
|
|
113
|
+
lastUsed?: string | null;
|
|
114
|
+
onSubmit?: (values: AuthFormValues) => AuthResult | Promise<AuthResult>;
|
|
115
|
+
/** email-code: verifica el código (se llama al completarse). */
|
|
116
|
+
onVerifyCode?: (code: string, values: {
|
|
117
|
+
identifier: string;
|
|
118
|
+
}) => AuthResult | Promise<AuthResult>;
|
|
119
|
+
/** Reenviar enlace o código. */
|
|
120
|
+
onResend?: (values: {
|
|
121
|
+
identifier: string;
|
|
122
|
+
}) => void | Promise<void>;
|
|
123
|
+
/** Segundos hasta poder reenviar. */
|
|
124
|
+
resendAfter?: number;
|
|
125
|
+
codeLength?: number;
|
|
126
|
+
/** Error controlado por la app. */
|
|
127
|
+
error?: AuthMessage;
|
|
128
|
+
fieldErrors?: Partial<Record<AuthField, AuthMessage>>;
|
|
129
|
+
/** Enlaces: URL o función del router. */
|
|
130
|
+
links?: {
|
|
131
|
+
signIn?: AuthLink;
|
|
132
|
+
email?: AuthLink;
|
|
133
|
+
signUp?: AuthLink;
|
|
134
|
+
requestAccess?: AuthLink;
|
|
135
|
+
forgotPassword?: AuthLink;
|
|
136
|
+
terms?: AuthLink;
|
|
137
|
+
privacy?: AuthLink;
|
|
138
|
+
};
|
|
139
|
+
submitLabel?: React.ReactNode;
|
|
140
|
+
/** Sustituye el pie de enlaces. */
|
|
141
|
+
footer?: React.ReactNode;
|
|
142
|
+
}): React.JSX.Element;
|
|
143
|
+
|
|
144
|
+
export { type AuthResult as A, MfaChallenge as M, type MfaChallengePreset as a, AuthForm as b, type AuthFormPreset as c, type AuthFormValues as d, type AuthOrganization as e, type AuthRoute as f };
|
|
@@ -156,6 +156,8 @@ declare const DsMessagesContext: React.Context<{
|
|
|
156
156
|
voiceError: string;
|
|
157
157
|
voiceRetry: string;
|
|
158
158
|
composerRemoveFile: string;
|
|
159
|
+
tagRemove: string;
|
|
160
|
+
tagAdd: string;
|
|
159
161
|
composerCounter: string;
|
|
160
162
|
composerDrop: string;
|
|
161
163
|
composerUploading: string;
|
|
@@ -235,6 +237,10 @@ declare const DsMessagesContext: React.Context<{
|
|
|
235
237
|
filterAll: string;
|
|
236
238
|
filterClear: string;
|
|
237
239
|
statNoData: string;
|
|
240
|
+
usageOf: string;
|
|
241
|
+
usageUnlimited: string;
|
|
242
|
+
usageRemaining: string;
|
|
243
|
+
usageOver: string;
|
|
238
244
|
heatmapLow: string;
|
|
239
245
|
heatmapHigh: string;
|
|
240
246
|
dataTableFilter: string;
|
|
@@ -317,6 +323,7 @@ declare const DsMessagesContext: React.Context<{
|
|
|
317
323
|
copy: string;
|
|
318
324
|
copied: string;
|
|
319
325
|
copyValue: string;
|
|
326
|
+
helpAbout: string;
|
|
320
327
|
aiGenerated: string;
|
|
321
328
|
bottomNav: string;
|
|
322
329
|
dockLabel: string;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
type DsUnitDisplay = "short" | "long" | "narrow";
|
|
2
|
+
interface DsQuantityOptions {
|
|
3
|
+
/** Etiqueta BCP 47 (p. ej. "es", "pt-BR"). Por defecto, la del entorno. */
|
|
4
|
+
locale?: string;
|
|
5
|
+
/** "si" (1000, GB) por defecto; "binary" (1024, GiB) para memoria o cuando el contrato lo diga. */
|
|
6
|
+
system?: "si" | "binary";
|
|
7
|
+
/** Forma de la unidad: "short" (12 GB), "long" (12 gigabytes), "narrow" (12GB). */
|
|
8
|
+
unitDisplay?: DsUnitDisplay;
|
|
9
|
+
/** Decimales máximos. Por defecto: 1 en bytes y tasas escaladas, 0 en el resto salvo que el valor los traiga. */
|
|
10
|
+
maximumFractionDigits?: number;
|
|
11
|
+
/** Notación compacta para recuentos grandes (1,2 mil). */
|
|
12
|
+
compact?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/** ¿La unidad es de bytes (UCUM)? */
|
|
15
|
+
declare function isByteUnit(unit: string | undefined): boolean;
|
|
16
|
+
/** Pasa un valor en bytes UCUM (`GBy`, `MiBy`…) a bytes. Devuelve null si la unidad no es de bytes. */
|
|
17
|
+
declare function toBytes(value: number, unit: string): number | null;
|
|
18
|
+
/**
|
|
19
|
+
* Formatea un valor con su unidad UCUM en el idioma indicado.
|
|
20
|
+
*
|
|
21
|
+
* formatQuantity(12_000_000_000, "By", { locale: "es" }) → "12 GB"
|
|
22
|
+
* formatQuantity(50, "GBy", { locale: "es" }) → "50 GB"
|
|
23
|
+
* formatQuantity(73.5, "%", { locale: "es" }) → "73,5 %"
|
|
24
|
+
* formatQuantity(3, "{device}") → "3"
|
|
25
|
+
* formatQuantity(null, "By") → null
|
|
26
|
+
*/
|
|
27
|
+
declare function formatQuantity(value: number | null | undefined, unit?: string, options?: DsQuantityOptions): string | null;
|
|
28
|
+
/** Proporción (0..1) como porcentaje: formatRatio(0.24, { locale: "es" }) → "24 %". */
|
|
29
|
+
declare function formatRatio(ratio: number | null | undefined, options?: {
|
|
30
|
+
locale?: string;
|
|
31
|
+
maximumFractionDigits?: number;
|
|
32
|
+
}): string | null;
|
|
33
|
+
type DsDateInput = Date | string | number | null | undefined;
|
|
34
|
+
/** Pasa una fecha (Date, ISO 8601 o milisegundos) a Date; null si no es válida. */
|
|
35
|
+
declare function toDate(input: DsDateInput): Date | null;
|
|
36
|
+
type DsDateStyle = "date" | "datetime" | "time" | "long" | "short";
|
|
37
|
+
/** Fecha absoluta en el idioma indicado. `style` o, para algo concreto, `format` (Intl.DateTimeFormatOptions). */
|
|
38
|
+
declare function formatDate(input: DsDateInput, options?: {
|
|
39
|
+
locale?: string;
|
|
40
|
+
style?: DsDateStyle;
|
|
41
|
+
format?: Intl.DateTimeFormatOptions;
|
|
42
|
+
timeZone?: string;
|
|
43
|
+
}): string | null;
|
|
44
|
+
/**
|
|
45
|
+
* Tiempo relativo («hace 5 minutos», «en 3 días», «ayer») eligiendo la unidad sola.
|
|
46
|
+
* `now` permite fijar el instante de referencia (pruebas, servidor).
|
|
47
|
+
*/
|
|
48
|
+
declare function formatRelativeTime(input: DsDateInput, options?: {
|
|
49
|
+
locale?: string;
|
|
50
|
+
now?: DsDateInput;
|
|
51
|
+
numeric?: "auto" | "always";
|
|
52
|
+
style?: "long" | "short" | "narrow";
|
|
53
|
+
}): string | null;
|
|
54
|
+
/** Cada cuánto conviene refrescar un tiempo relativo según su distancia al presente (ms). */
|
|
55
|
+
declare function relativeTimeRefreshMs(input: DsDateInput, now?: DsDateInput): number;
|
|
56
|
+
|
|
57
|
+
export { type DsDateInput, type DsDateStyle, type DsQuantityOptions, type DsUnitDisplay, formatDate, formatQuantity, formatRatio, formatRelativeTime, isByteUnit, relativeTimeRefreshMs, toBytes, toDate };
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
const BYTE_UNITS = {
|
|
2
|
+
By: 1,
|
|
3
|
+
kBy: 1e3,
|
|
4
|
+
MBy: 1e6,
|
|
5
|
+
GBy: 1e9,
|
|
6
|
+
TBy: 1e12,
|
|
7
|
+
PBy: 1e15,
|
|
8
|
+
KiBy: 1024,
|
|
9
|
+
MiBy: 1024 ** 2,
|
|
10
|
+
GiBy: 1024 ** 3,
|
|
11
|
+
TiBy: 1024 ** 4,
|
|
12
|
+
PiBy: 1024 ** 5
|
|
13
|
+
};
|
|
14
|
+
const BIT_RATE_UNITS = {
|
|
15
|
+
"bit/s": 1,
|
|
16
|
+
"kbit/s": 1e3,
|
|
17
|
+
"Mbit/s": 1e6,
|
|
18
|
+
"Gbit/s": 1e9,
|
|
19
|
+
"By/s": 8,
|
|
20
|
+
"kBy/s": 8e3,
|
|
21
|
+
"MBy/s": 8e6
|
|
22
|
+
};
|
|
23
|
+
const SI_BYTE_STEPS = ["byte", "kilobyte", "megabyte", "gigabyte", "terabyte", "petabyte"];
|
|
24
|
+
const BINARY_BYTE_STEPS = ["B", "KiB", "MiB", "GiB", "TiB", "PiB"];
|
|
25
|
+
const BIT_RATE_STEPS = ["bit-per-second", "kilobit-per-second", "megabit-per-second", "gigabit-per-second"];
|
|
26
|
+
const INTL_UNITS = {
|
|
27
|
+
"%": "percent",
|
|
28
|
+
ms: "millisecond",
|
|
29
|
+
s: "second",
|
|
30
|
+
min: "minute",
|
|
31
|
+
h: "hour",
|
|
32
|
+
d: "day",
|
|
33
|
+
wk: "week",
|
|
34
|
+
mo: "month",
|
|
35
|
+
a: "year",
|
|
36
|
+
m: "meter",
|
|
37
|
+
km: "kilometer",
|
|
38
|
+
cm: "centimeter",
|
|
39
|
+
g: "gram",
|
|
40
|
+
kg: "kilogram",
|
|
41
|
+
L: "liter",
|
|
42
|
+
l: "liter",
|
|
43
|
+
Cel: "celsius",
|
|
44
|
+
"[degF]": "fahrenheit"
|
|
45
|
+
};
|
|
46
|
+
function isFiniteNumber(v) {
|
|
47
|
+
return typeof v === "number" && Number.isFinite(v);
|
|
48
|
+
}
|
|
49
|
+
function isByteUnit(unit) {
|
|
50
|
+
return !!unit && unit in BYTE_UNITS;
|
|
51
|
+
}
|
|
52
|
+
function toBytes(value, unit) {
|
|
53
|
+
const f = BYTE_UNITS[unit];
|
|
54
|
+
return f === void 0 ? null : value * f;
|
|
55
|
+
}
|
|
56
|
+
function scaled(value, base, steps) {
|
|
57
|
+
let n = value;
|
|
58
|
+
let i = 0;
|
|
59
|
+
while (Math.abs(n) >= base && i < steps.length - 1) {
|
|
60
|
+
n /= base;
|
|
61
|
+
i++;
|
|
62
|
+
}
|
|
63
|
+
return { n, step: steps[i] };
|
|
64
|
+
}
|
|
65
|
+
function digitsFor(n, max, fallback) {
|
|
66
|
+
if (max !== void 0) return max;
|
|
67
|
+
return Number.isInteger(n) ? 0 : fallback;
|
|
68
|
+
}
|
|
69
|
+
function formatQuantity(value, unit, options = {}) {
|
|
70
|
+
if (!isFiniteNumber(value)) return null;
|
|
71
|
+
const { locale, system = "si", unitDisplay = "short", maximumFractionDigits, compact } = options;
|
|
72
|
+
if (unit && unit in BYTE_UNITS) {
|
|
73
|
+
const bytes = value * BYTE_UNITS[unit];
|
|
74
|
+
if (system === "binary") {
|
|
75
|
+
const { n: n2, step: step2 } = scaled(bytes, 1024, BINARY_BYTE_STEPS);
|
|
76
|
+
const num = new Intl.NumberFormat(locale, { maximumFractionDigits: digitsFor(n2, maximumFractionDigits, 1) }).format(n2);
|
|
77
|
+
return `${num}\xA0${step2}`;
|
|
78
|
+
}
|
|
79
|
+
const { n, step } = scaled(bytes, 1e3, SI_BYTE_STEPS);
|
|
80
|
+
return new Intl.NumberFormat(locale, {
|
|
81
|
+
style: "unit",
|
|
82
|
+
unit: step,
|
|
83
|
+
unitDisplay,
|
|
84
|
+
maximumFractionDigits: digitsFor(n, maximumFractionDigits, 1)
|
|
85
|
+
}).format(n);
|
|
86
|
+
}
|
|
87
|
+
if (unit && unit in BIT_RATE_UNITS) {
|
|
88
|
+
const { n, step } = scaled(value * BIT_RATE_UNITS[unit], 1e3, BIT_RATE_STEPS);
|
|
89
|
+
return new Intl.NumberFormat(locale, {
|
|
90
|
+
style: "unit",
|
|
91
|
+
unit: step,
|
|
92
|
+
unitDisplay,
|
|
93
|
+
maximumFractionDigits: digitsFor(n, maximumFractionDigits, 1)
|
|
94
|
+
}).format(n);
|
|
95
|
+
}
|
|
96
|
+
const intlUnit = unit ? INTL_UNITS[unit] : void 0;
|
|
97
|
+
if (intlUnit) {
|
|
98
|
+
return new Intl.NumberFormat(locale, {
|
|
99
|
+
style: "unit",
|
|
100
|
+
unit: intlUnit,
|
|
101
|
+
unitDisplay,
|
|
102
|
+
maximumFractionDigits: digitsFor(value, maximumFractionDigits, 2)
|
|
103
|
+
}).format(value);
|
|
104
|
+
}
|
|
105
|
+
const plain = new Intl.NumberFormat(locale, {
|
|
106
|
+
maximumFractionDigits: digitsFor(value, maximumFractionDigits, 2),
|
|
107
|
+
...compact ? { notation: "compact" } : {}
|
|
108
|
+
}).format(value);
|
|
109
|
+
if (!unit || unit === "1" || /^\{.*\}$/.test(unit)) return plain;
|
|
110
|
+
return `${plain}\xA0${unit}`;
|
|
111
|
+
}
|
|
112
|
+
function formatRatio(ratio, options = {}) {
|
|
113
|
+
if (!isFiniteNumber(ratio)) return null;
|
|
114
|
+
return new Intl.NumberFormat(options.locale, {
|
|
115
|
+
style: "percent",
|
|
116
|
+
maximumFractionDigits: options.maximumFractionDigits ?? 0
|
|
117
|
+
}).format(ratio);
|
|
118
|
+
}
|
|
119
|
+
function toDate(input) {
|
|
120
|
+
if (input === null || input === void 0 || input === "") return null;
|
|
121
|
+
const d = input instanceof Date ? input : new Date(input);
|
|
122
|
+
return Number.isNaN(d.getTime()) ? null : d;
|
|
123
|
+
}
|
|
124
|
+
const DATE_STYLES = {
|
|
125
|
+
date: { dateStyle: "medium" },
|
|
126
|
+
datetime: { dateStyle: "medium", timeStyle: "short" },
|
|
127
|
+
time: { timeStyle: "short" },
|
|
128
|
+
long: { dateStyle: "long" },
|
|
129
|
+
short: { dateStyle: "short" }
|
|
130
|
+
};
|
|
131
|
+
function formatDate(input, options = {}) {
|
|
132
|
+
const d = toDate(input);
|
|
133
|
+
if (!d) return null;
|
|
134
|
+
const fmt = options.format ?? DATE_STYLES[options.style ?? "date"];
|
|
135
|
+
return new Intl.DateTimeFormat(options.locale, { ...fmt, ...options.timeZone ? { timeZone: options.timeZone } : {} }).format(d);
|
|
136
|
+
}
|
|
137
|
+
const RELATIVE_STEPS = [
|
|
138
|
+
["second", 60],
|
|
139
|
+
["minute", 60],
|
|
140
|
+
["hour", 24],
|
|
141
|
+
["day", 7],
|
|
142
|
+
["week", 4.345],
|
|
143
|
+
["month", 12],
|
|
144
|
+
["year", Number.POSITIVE_INFINITY]
|
|
145
|
+
];
|
|
146
|
+
function formatRelativeTime(input, options = {}) {
|
|
147
|
+
const d = toDate(input);
|
|
148
|
+
if (!d) return null;
|
|
149
|
+
const now = toDate(options.now) ?? /* @__PURE__ */ new Date();
|
|
150
|
+
let delta = (d.getTime() - now.getTime()) / 1e3;
|
|
151
|
+
const rtf = new Intl.RelativeTimeFormat(options.locale, { numeric: options.numeric ?? "auto", style: options.style ?? "long" });
|
|
152
|
+
for (const [unit, size] of RELATIVE_STEPS) {
|
|
153
|
+
if (Math.abs(delta) < size) return rtf.format(Math.round(delta), unit);
|
|
154
|
+
delta /= size;
|
|
155
|
+
}
|
|
156
|
+
return rtf.format(Math.round(delta), "year");
|
|
157
|
+
}
|
|
158
|
+
function relativeTimeRefreshMs(input, now = /* @__PURE__ */ new Date()) {
|
|
159
|
+
const d = toDate(input);
|
|
160
|
+
const n = toDate(now);
|
|
161
|
+
if (!d || !n) return 0;
|
|
162
|
+
const s = Math.abs(d.getTime() - n.getTime()) / 1e3;
|
|
163
|
+
if (s < 60) return 1e4;
|
|
164
|
+
if (s < 3600) return 6e4;
|
|
165
|
+
if (s < 86400) return 36e5;
|
|
166
|
+
return 0;
|
|
167
|
+
}
|
|
168
|
+
export {
|
|
169
|
+
formatDate,
|
|
170
|
+
formatQuantity,
|
|
171
|
+
formatRatio,
|
|
172
|
+
formatRelativeTime,
|
|
173
|
+
isByteUnit,
|
|
174
|
+
relativeTimeRefreshMs,
|
|
175
|
+
toBytes,
|
|
176
|
+
toDate
|
|
177
|
+
};
|
package/dist/lib/i18n.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/** Idiomas que trae orbital-ds (`he` es de derecha a izquierda: ver `dsDirection`). */
|
|
2
|
+
declare const DS_LOCALES: readonly ["en", "es", "pt-BR", "fr", "it", "de", "he"];
|
|
2
3
|
type DsLocale = (typeof DS_LOCALES)[number];
|
|
3
4
|
declare const DS_DEFAULT_LOCALE: DsLocale;
|
|
4
5
|
declare const en: {
|
|
@@ -155,6 +156,8 @@ declare const en: {
|
|
|
155
156
|
voiceError: string;
|
|
156
157
|
voiceRetry: string;
|
|
157
158
|
composerRemoveFile: string;
|
|
159
|
+
tagRemove: string;
|
|
160
|
+
tagAdd: string;
|
|
158
161
|
composerCounter: string;
|
|
159
162
|
composerDrop: string;
|
|
160
163
|
composerUploading: string;
|
|
@@ -234,6 +237,10 @@ declare const en: {
|
|
|
234
237
|
filterAll: string;
|
|
235
238
|
filterClear: string;
|
|
236
239
|
statNoData: string;
|
|
240
|
+
usageOf: string;
|
|
241
|
+
usageUnlimited: string;
|
|
242
|
+
usageRemaining: string;
|
|
243
|
+
usageOver: string;
|
|
237
244
|
heatmapLow: string;
|
|
238
245
|
heatmapHigh: string;
|
|
239
246
|
dataTableFilter: string;
|
|
@@ -316,6 +323,7 @@ declare const en: {
|
|
|
316
323
|
copy: string;
|
|
317
324
|
copied: string;
|
|
318
325
|
copyValue: string;
|
|
326
|
+
helpAbout: string;
|
|
319
327
|
aiGenerated: string;
|
|
320
328
|
bottomNav: string;
|
|
321
329
|
dockLabel: string;
|
|
@@ -541,5 +549,9 @@ declare function dsFormat(text: string, vars: Record<string, string | number>):
|
|
|
541
549
|
declare function dsMessagesFor(tag?: string | null, overrides?: Partial<DsMessages>): DsMessages;
|
|
542
550
|
declare const DS_RTL_LANGS: readonly ["ar", "he", "fa", "ur", "ps", "sd", "ug", "yi", "dv", "ckb"];
|
|
543
551
|
declare function dsDirection(tag: string | null | undefined): "ltr" | "rtl";
|
|
552
|
+
/** Lado de un panel: `start`/`end` siguen la dirección de lectura; `left`/`right` son físicos. */
|
|
553
|
+
type DsInlineSide = "start" | "end" | "left" | "right";
|
|
554
|
+
/** Traduce un lado lógico al físico según la dirección (`start` = izquierda en ltr, derecha en rtl). */
|
|
555
|
+
declare function dsPhysicalSide(side: DsInlineSide, dir: "ltr" | "rtl"): "left" | "right";
|
|
544
556
|
|
|
545
|
-
export { DS_DEFAULT_LOCALE, DS_LOCALES, DS_RTL_LANGS, type DsLocale, type DsMessageKey, type DsMessages, dsCatalogs, dsDirection, dsFormat, dsMessagesFor, resolveDsLocale };
|
|
557
|
+
export { DS_DEFAULT_LOCALE, DS_LOCALES, DS_RTL_LANGS, type DsInlineSide, type DsLocale, type DsMessageKey, type DsMessages, dsCatalogs, dsDirection, dsFormat, dsMessagesFor, dsPhysicalSide, resolveDsLocale };
|
package/dist/lib/i18n.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { fr } from "./locales/fr.js";
|
|
2
|
+
import { it } from "./locales/it.js";
|
|
3
|
+
import { de } from "./locales/de.js";
|
|
4
|
+
import { he } from "./locales/he.js";
|
|
5
|
+
const DS_LOCALES = ["en", "es", "pt-BR", "fr", "it", "de", "he"];
|
|
2
6
|
const DS_DEFAULT_LOCALE = "en";
|
|
3
7
|
const en = {
|
|
4
8
|
close: "Close",
|
|
@@ -154,6 +158,8 @@ const en = {
|
|
|
154
158
|
voiceError: "Could not use the microphone",
|
|
155
159
|
voiceRetry: "Try again",
|
|
156
160
|
composerRemoveFile: "Remove {name}",
|
|
161
|
+
tagRemove: "Remove {name}",
|
|
162
|
+
tagAdd: "Add a tag",
|
|
157
163
|
composerCounter: "{count} of {max}",
|
|
158
164
|
composerDrop: "Drop files to attach",
|
|
159
165
|
composerUploading: "Uploading\u2026",
|
|
@@ -233,6 +239,10 @@ const en = {
|
|
|
233
239
|
filterAll: "All",
|
|
234
240
|
filterClear: "Clear filters",
|
|
235
241
|
statNoData: "No data",
|
|
242
|
+
usageOf: "{value} of {limit}",
|
|
243
|
+
usageUnlimited: "{value} \xB7 unlimited",
|
|
244
|
+
usageRemaining: "{amount} left",
|
|
245
|
+
usageOver: "{amount} over the limit",
|
|
236
246
|
heatmapLow: "Low",
|
|
237
247
|
heatmapHigh: "High",
|
|
238
248
|
dataTableFilter: "Filter",
|
|
@@ -315,6 +325,7 @@ const en = {
|
|
|
315
325
|
copy: "Copy to clipboard",
|
|
316
326
|
copied: "Copied",
|
|
317
327
|
copyValue: "Copy {value}",
|
|
328
|
+
helpAbout: "What is: {term}",
|
|
318
329
|
aiGenerated: "AI-generated",
|
|
319
330
|
bottomNav: "Main navigation",
|
|
320
331
|
dockLabel: "Main navigation",
|
|
@@ -681,6 +692,8 @@ const es = {
|
|
|
681
692
|
voiceError: "No se pudo usar el micr\xF3fono",
|
|
682
693
|
voiceRetry: "Reintentar",
|
|
683
694
|
composerRemoveFile: "Quitar {name}",
|
|
695
|
+
tagRemove: "Quitar {name}",
|
|
696
|
+
tagAdd: "A\xF1adir etiqueta",
|
|
684
697
|
composerCounter: "{count} de {max}",
|
|
685
698
|
composerDrop: "Suelta los archivos para adjuntarlos",
|
|
686
699
|
composerUploading: "Subiendo\u2026",
|
|
@@ -760,6 +773,10 @@ const es = {
|
|
|
760
773
|
filterAll: "Todos",
|
|
761
774
|
filterClear: "Quitar filtros",
|
|
762
775
|
statNoData: "Sin dato",
|
|
776
|
+
usageOf: "{value} de {limit}",
|
|
777
|
+
usageUnlimited: "{value} \xB7 ilimitado",
|
|
778
|
+
usageRemaining: "Quedan {amount}",
|
|
779
|
+
usageOver: "{amount} por encima del l\xEDmite",
|
|
763
780
|
heatmapLow: "Bajo",
|
|
764
781
|
heatmapHigh: "Alto",
|
|
765
782
|
dataTableFilter: "Filtrar",
|
|
@@ -842,6 +859,7 @@ const es = {
|
|
|
842
859
|
copy: "Copiar al portapapeles",
|
|
843
860
|
copied: "Copiado",
|
|
844
861
|
copyValue: "Copiar {value}",
|
|
862
|
+
helpAbout: "Qu\xE9 es: {term}",
|
|
845
863
|
aiGenerated: "Generado con IA",
|
|
846
864
|
bottomNav: "Navegaci\xF3n principal",
|
|
847
865
|
dockLabel: "Navegaci\xF3n principal",
|
|
@@ -1208,6 +1226,8 @@ const ptBR = {
|
|
|
1208
1226
|
voiceError: "N\xE3o foi poss\xEDvel usar o microfone",
|
|
1209
1227
|
voiceRetry: "Tentar de novo",
|
|
1210
1228
|
composerRemoveFile: "Remover {name}",
|
|
1229
|
+
tagRemove: "Remover {name}",
|
|
1230
|
+
tagAdd: "Adicionar etiqueta",
|
|
1211
1231
|
composerCounter: "{count} de {max}",
|
|
1212
1232
|
composerDrop: "Solte os arquivos para anexar",
|
|
1213
1233
|
composerUploading: "Enviando\u2026",
|
|
@@ -1287,6 +1307,10 @@ const ptBR = {
|
|
|
1287
1307
|
filterAll: "Todos",
|
|
1288
1308
|
filterClear: "Limpar filtros",
|
|
1289
1309
|
statNoData: "Sem dado",
|
|
1310
|
+
usageOf: "{value} de {limit}",
|
|
1311
|
+
usageUnlimited: "{value} \xB7 ilimitado",
|
|
1312
|
+
usageRemaining: "Restam {amount}",
|
|
1313
|
+
usageOver: "{amount} acima do limite",
|
|
1290
1314
|
heatmapLow: "Baixo",
|
|
1291
1315
|
heatmapHigh: "Alto",
|
|
1292
1316
|
dataTableFilter: "Filtrar",
|
|
@@ -1369,6 +1393,7 @@ const ptBR = {
|
|
|
1369
1393
|
copy: "Copiar para a \xE1rea de transfer\xEAncia",
|
|
1370
1394
|
copied: "Copiado",
|
|
1371
1395
|
copyValue: "Copiar {value}",
|
|
1396
|
+
helpAbout: "O que \xE9: {term}",
|
|
1372
1397
|
aiGenerated: "Gerado por IA",
|
|
1373
1398
|
bottomNav: "Navega\xE7\xE3o principal",
|
|
1374
1399
|
dockLabel: "Navega\xE7\xE3o principal",
|
|
@@ -1581,7 +1606,7 @@ const ptBR = {
|
|
|
1581
1606
|
authErrorNetwork: "Sem conex\xE3o. Verifique sua conex\xE3o e tente novamente.",
|
|
1582
1607
|
authErrorUnknown: "Algo deu errado. Tente novamente."
|
|
1583
1608
|
};
|
|
1584
|
-
const dsCatalogs = { en, es, "pt-BR": ptBR };
|
|
1609
|
+
const dsCatalogs = { en, es, "pt-BR": ptBR, fr, it, de, he };
|
|
1585
1610
|
function resolveDsLocale(tag) {
|
|
1586
1611
|
if (!tag) return DS_DEFAULT_LOCALE;
|
|
1587
1612
|
const base = tag.split("-")[0];
|
|
@@ -1598,6 +1623,10 @@ function dsDirection(tag) {
|
|
|
1598
1623
|
const base = (tag ?? "").toLowerCase().split("-")[0];
|
|
1599
1624
|
return DS_RTL_LANGS.includes(base) ? "rtl" : "ltr";
|
|
1600
1625
|
}
|
|
1626
|
+
function dsPhysicalSide(side, dir) {
|
|
1627
|
+
if (side === "left" || side === "right") return side;
|
|
1628
|
+
return side === "start" === (dir === "ltr") ? "left" : "right";
|
|
1629
|
+
}
|
|
1601
1630
|
export {
|
|
1602
1631
|
DS_DEFAULT_LOCALE,
|
|
1603
1632
|
DS_LOCALES,
|
|
@@ -1606,5 +1635,6 @@ export {
|
|
|
1606
1635
|
dsDirection,
|
|
1607
1636
|
dsFormat,
|
|
1608
1637
|
dsMessagesFor,
|
|
1638
|
+
dsPhysicalSide,
|
|
1609
1639
|
resolveDsLocale
|
|
1610
1640
|
};
|