@mohamedatia/fly-design-system 1.0.0 → 1.3.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/fesm2022/mohamedatia-fly-design-system.mjs +303 -7
- package/fesm2022/mohamedatia-fly-design-system.mjs.map +1 -1
- package/package.json +1 -1
- package/scss/_fly-theme.scss +9 -0
- package/scss/_theme-auto.scss +8 -0
- package/scss/_theme-dark-vars.scss +38 -0
- package/scss/_theme-dark.scss +6 -0
- package/scss/_theme-light.scss +61 -0
- package/scss/_theme-transparent.scss +41 -0
- package/scss/_tokens.scss +126 -0
- package/types/mohamedatia-fly-design-system.d.ts +174 -3
- package/types/mohamedatia-fly-design-system.d.ts.map +1 -1
|
@@ -1,21 +1,317 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken, signal, computed, Injectable, inject, ErrorHandler, Pipe } from '@angular/core';
|
|
2
3
|
|
|
3
4
|
const WINDOW_DATA = new InjectionToken('WINDOW_DATA');
|
|
4
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Shared AuthService for Business Apps.
|
|
8
|
+
*
|
|
9
|
+
* This is a **read-only signal store** — Business Apps inject it to read the
|
|
10
|
+
* current user and access token. The FlyOS shell populates it after PKCE login
|
|
11
|
+
* and silent refresh. Business Apps must never call setSession() directly.
|
|
12
|
+
*
|
|
13
|
+
* When running as a Module Federation remote, the shell and the Business App
|
|
14
|
+
* share this singleton via the `@mohamedatia/fly-design-system` shared mapping
|
|
15
|
+
* in federation.config.js — so the shell's populated instance is the same
|
|
16
|
+
* object the Business App reads.
|
|
17
|
+
*
|
|
18
|
+
* When running standalone (without the shell), call initFromToken() with a
|
|
19
|
+
* JWT stored in localStorage to hydrate the user.
|
|
20
|
+
*/
|
|
21
|
+
class AuthService {
|
|
22
|
+
_session = signal(null, ...(ngDevMode ? [{ debugName: "_session" }] : /* istanbul ignore next */ []));
|
|
23
|
+
currentUser = computed(() => this._session()?.user ?? null, ...(ngDevMode ? [{ debugName: "currentUser" }] : /* istanbul ignore next */ []));
|
|
24
|
+
accessToken = computed(() => this._session()?.accessToken ?? null, ...(ngDevMode ? [{ debugName: "accessToken" }] : /* istanbul ignore next */ []));
|
|
25
|
+
isAuthenticated = computed(() => {
|
|
26
|
+
const s = this._session();
|
|
27
|
+
return s !== null && s.expiresAt > Date.now();
|
|
28
|
+
}, ...(ngDevMode ? [{ debugName: "isAuthenticated" }] : /* istanbul ignore next */ []));
|
|
29
|
+
/**
|
|
30
|
+
* Called by the shell after a successful login or silent refresh.
|
|
31
|
+
* Business Apps should not call this directly.
|
|
32
|
+
*/
|
|
33
|
+
setSession(user, accessToken, expiresAt) {
|
|
34
|
+
this._session.set({ user, accessToken, expiresAt });
|
|
35
|
+
}
|
|
36
|
+
/** Clears the in-memory session (called by the shell on logout). */
|
|
37
|
+
clearSession() {
|
|
38
|
+
this._session.set(null);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Standalone mode: parse a JWT from localStorage and hydrate the user.
|
|
42
|
+
* Key defaults to "circles_token" but can be overridden.
|
|
43
|
+
*/
|
|
44
|
+
initFromToken(storageKey = 'circles_token') {
|
|
45
|
+
const token = localStorage.getItem(storageKey);
|
|
46
|
+
if (!token)
|
|
47
|
+
return;
|
|
48
|
+
try {
|
|
49
|
+
const base64 = token.split('.')[1].replace(/-/g, '+').replace(/_/g, '/');
|
|
50
|
+
const payload = JSON.parse(decodeURIComponent(atob(base64).split('').map(c => '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2)).join('')));
|
|
51
|
+
const rawRole = payload['role'];
|
|
52
|
+
const roles = Array.isArray(rawRole) ? rawRole : rawRole ? [rawRole] : [];
|
|
53
|
+
const rawApps = payload['apps'];
|
|
54
|
+
const apps = Array.isArray(rawApps) ? rawApps : rawApps ? [rawApps] : [];
|
|
55
|
+
const name = payload['name'] ?? '';
|
|
56
|
+
const nameParts = name.split(' ');
|
|
57
|
+
const user = {
|
|
58
|
+
id: payload['sub'] ?? '',
|
|
59
|
+
tenantId: payload['tenant_id'] ?? payload['tid'] ?? null,
|
|
60
|
+
email: payload['email'] ?? '',
|
|
61
|
+
fullName: name,
|
|
62
|
+
firstName: nameParts[0] ?? '',
|
|
63
|
+
lastName: nameParts.slice(1).join(' '),
|
|
64
|
+
preferredLocale: payload['locale'] ?? 'en',
|
|
65
|
+
roles,
|
|
66
|
+
apps,
|
|
67
|
+
ou: payload['ou'],
|
|
68
|
+
};
|
|
69
|
+
const expiresAt = (payload['exp'] ?? 0) * 1000;
|
|
70
|
+
this.setSession(user, token, expiresAt);
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
// Invalid token — stay unauthenticated
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: AuthService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
77
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: AuthService, providedIn: 'root' });
|
|
78
|
+
}
|
|
79
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: AuthService, decorators: [{
|
|
80
|
+
type: Injectable,
|
|
81
|
+
args: [{ providedIn: 'root' }]
|
|
82
|
+
}] });
|
|
83
|
+
|
|
84
|
+
/** Locales that use RTL layout for `dir` and DS `isRtl` / `direction`. */
|
|
85
|
+
const RTL_LOCALE_SET = new Set(['ar', 'ur']);
|
|
86
|
+
function isRtlLocale(lang) {
|
|
87
|
+
return RTL_LOCALE_SET.has(lang);
|
|
88
|
+
}
|
|
89
|
+
function escapeRegExp(s) {
|
|
90
|
+
return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
91
|
+
}
|
|
92
|
+
/** Accepts flat or nested JSON objects; nested keys become dot paths. Rejects arrays and non-string leaves. */
|
|
93
|
+
function normalizeLocaleJson(raw) {
|
|
94
|
+
if (raw === null || typeof raw !== 'object' || Array.isArray(raw)) {
|
|
95
|
+
throw new Error('Locale bundle must be a JSON object');
|
|
96
|
+
}
|
|
97
|
+
const out = {};
|
|
98
|
+
const walk = (obj, prefix) => {
|
|
99
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
100
|
+
const path = prefix ? `${prefix}.${k}` : k;
|
|
101
|
+
if (typeof v === 'string') {
|
|
102
|
+
out[path] = v;
|
|
103
|
+
}
|
|
104
|
+
else if (v !== null && typeof v === 'object' && !Array.isArray(v)) {
|
|
105
|
+
walk(v, path);
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
throw new Error(`Locale bundle invalid value at "${path}" (expected string or nested object)`);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
walk(raw, '');
|
|
113
|
+
return out;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Shared I18nService for the shell and Business Apps.
|
|
117
|
+
*
|
|
118
|
+
* **Merge order** (later keys win): shell layer → remote bundles in registration order.
|
|
119
|
+
*
|
|
120
|
+
* - Shell: `setShellTranslations()` after loading `locale/{lang}.json` and API overrides.
|
|
121
|
+
* - Remotes: `loadBundle()` per manifest `localeBaseUrl`.
|
|
122
|
+
*/
|
|
123
|
+
class I18nService {
|
|
124
|
+
errorHandler = inject(ErrorHandler, { optional: true });
|
|
125
|
+
_shell = signal({}, ...(ngDevMode ? [{ debugName: "_shell" }] : /* istanbul ignore next */ []));
|
|
126
|
+
_bundles = signal({}, ...(ngDevMode ? [{ debugName: "_bundles" }] : /* istanbul ignore next */ []));
|
|
127
|
+
_bundleOrder = signal([], ...(ngDevMode ? [{ debugName: "_bundleOrder" }] : /* istanbul ignore next */ []));
|
|
128
|
+
_locale = signal('en', ...(ngDevMode ? [{ debugName: "_locale" }] : /* istanbul ignore next */ []));
|
|
129
|
+
_version = signal(0, ...(ngDevMode ? [{ debugName: "_version" }] : /* istanbul ignore next */ []));
|
|
130
|
+
_merged = computed(() => {
|
|
131
|
+
const shell = this._shell();
|
|
132
|
+
const order = this._bundleOrder();
|
|
133
|
+
const bundles = this._bundles();
|
|
134
|
+
let out = { ...shell };
|
|
135
|
+
for (const id of order) {
|
|
136
|
+
const b = bundles[id];
|
|
137
|
+
if (b)
|
|
138
|
+
out = { ...out, ...b };
|
|
139
|
+
}
|
|
140
|
+
return out;
|
|
141
|
+
}, ...(ngDevMode ? [{ debugName: "_merged" }] : /* istanbul ignore next */ []));
|
|
142
|
+
locale = this._locale.asReadonly();
|
|
143
|
+
version = this._version.asReadonly();
|
|
144
|
+
isRtl = computed(() => isRtlLocale(this._locale()), ...(ngDevMode ? [{ debugName: "isRtl" }] : /* istanbul ignore next */ []));
|
|
145
|
+
direction = computed(() => (isRtlLocale(this._locale()) ? 'rtl' : 'ltr'), ...(ngDevMode ? [{ debugName: "direction" }] : /* istanbul ignore next */ []));
|
|
146
|
+
bump() {
|
|
147
|
+
this._version.update((v) => v + 1);
|
|
148
|
+
}
|
|
149
|
+
/** Replace shell strings (desktop `locale/*.json` + `/api/i18n/desktop-shell/{lang}` merged by the shell). */
|
|
150
|
+
setShellTranslations(data, lang) {
|
|
151
|
+
this._shell.set(data);
|
|
152
|
+
this._locale.set(lang);
|
|
153
|
+
this.bump();
|
|
154
|
+
}
|
|
155
|
+
setLanguage(lang) {
|
|
156
|
+
this._locale.set(lang);
|
|
157
|
+
this.bump();
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Fetch `{baseUrl}{lang}.json` and store under `id`. New ids are appended to the merge order.
|
|
161
|
+
*/
|
|
162
|
+
async loadBundle(opts) {
|
|
163
|
+
const { id, baseUrl, lang, signal: abortSignal } = opts;
|
|
164
|
+
try {
|
|
165
|
+
const base = baseUrl.endsWith('/') ? baseUrl : `${baseUrl}/`;
|
|
166
|
+
const url = `${base}${lang}.json`;
|
|
167
|
+
const resp = await fetch(url, { signal: abortSignal });
|
|
168
|
+
if (!resp.ok)
|
|
169
|
+
throw new Error(`HTTP ${resp.status}`);
|
|
170
|
+
const data = normalizeLocaleJson(await resp.json());
|
|
171
|
+
if (abortSignal?.aborted)
|
|
172
|
+
return;
|
|
173
|
+
this._bundles.update((b) => ({ ...b, [id]: data }));
|
|
174
|
+
this._bundleOrder.update((order) => (order.includes(id) ? order : [...order, id]));
|
|
175
|
+
this._locale.set(lang);
|
|
176
|
+
this.bump();
|
|
177
|
+
}
|
|
178
|
+
catch (e) {
|
|
179
|
+
if (abortSignal?.aborted)
|
|
180
|
+
return;
|
|
181
|
+
this.errorHandler?.handleError(e);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
removeBundle(id) {
|
|
185
|
+
this._bundles.update((b) => {
|
|
186
|
+
const next = { ...b };
|
|
187
|
+
delete next[id];
|
|
188
|
+
return next;
|
|
189
|
+
});
|
|
190
|
+
this._bundleOrder.update((order) => order.filter((x) => x !== id));
|
|
191
|
+
this.bump();
|
|
192
|
+
}
|
|
193
|
+
clearRemoteBundles() {
|
|
194
|
+
this._bundles.set({});
|
|
195
|
+
this._bundleOrder.set([]);
|
|
196
|
+
this.bump();
|
|
197
|
+
}
|
|
198
|
+
t(key, params) {
|
|
199
|
+
const val = this._merged()[key] ?? key;
|
|
200
|
+
if (!params)
|
|
201
|
+
return val;
|
|
202
|
+
return Object.entries(params).reduce((result, [k, v]) => {
|
|
203
|
+
const safe = escapeRegExp(k);
|
|
204
|
+
return result.replace(new RegExp(`{{\\s*${safe}\\s*}}`, 'g'), String(v));
|
|
205
|
+
}, val);
|
|
206
|
+
}
|
|
207
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: I18nService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
208
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: I18nService, providedIn: 'root' });
|
|
209
|
+
}
|
|
210
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: I18nService, decorators: [{
|
|
211
|
+
type: Injectable,
|
|
212
|
+
args: [{ providedIn: 'root' }]
|
|
213
|
+
}] });
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Applies `html.light-theme` / `html.dark-theme` / `html.transparent-theme` for DS SCSS.
|
|
217
|
+
* Shell and standalone Business Apps use the same service (federation singleton when shared).
|
|
218
|
+
*/
|
|
219
|
+
class FlyThemeService {
|
|
220
|
+
theme = signal('light', ...(ngDevMode ? [{ debugName: "theme" }] : /* istanbul ignore next */ []));
|
|
221
|
+
applyTheme(mode) {
|
|
222
|
+
this.theme.set(mode);
|
|
223
|
+
const html = document.documentElement;
|
|
224
|
+
html.classList.remove('dark-theme', 'light-theme', 'transparent-theme');
|
|
225
|
+
if (mode === 'dark') {
|
|
226
|
+
html.classList.add('dark-theme');
|
|
227
|
+
}
|
|
228
|
+
else if (mode === 'transparent') {
|
|
229
|
+
html.classList.add('transparent-theme');
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
html.classList.add('light-theme');
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: FlyThemeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
236
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: FlyThemeService, providedIn: 'root' });
|
|
237
|
+
}
|
|
238
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: FlyThemeService, decorators: [{
|
|
239
|
+
type: Injectable,
|
|
240
|
+
args: [{ providedIn: 'root' }]
|
|
241
|
+
}] });
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Abstract interface for the WindowManager.
|
|
245
|
+
* The FlyOS shell provides the concrete implementation; Business Apps
|
|
246
|
+
* inject this token to open, close, and focus windows without depending
|
|
247
|
+
* on the shell's internal implementation.
|
|
248
|
+
*/
|
|
249
|
+
class WindowManagerService {
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* No-op fallback implementation used when running a Business App in
|
|
253
|
+
* standalone mode (outside the FlyOS shell). Logs a warning instead of
|
|
254
|
+
* throwing so standalone dev/test flows are not broken.
|
|
255
|
+
*/
|
|
256
|
+
class StandaloneWindowManagerService extends WindowManagerService {
|
|
257
|
+
openChildWindow(options) {
|
|
258
|
+
console.warn('[WindowManagerService] openChildWindow called in standalone mode — no shell available.', options);
|
|
259
|
+
}
|
|
260
|
+
closeWindow(windowId) {
|
|
261
|
+
console.warn('[WindowManagerService] closeWindow called in standalone mode — no shell available.', windowId);
|
|
262
|
+
}
|
|
263
|
+
focusWindow(windowId) {
|
|
264
|
+
console.warn('[WindowManagerService] focusWindow called in standalone mode — no shell available.', windowId);
|
|
265
|
+
}
|
|
266
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: StandaloneWindowManagerService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
267
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: StandaloneWindowManagerService });
|
|
268
|
+
}
|
|
269
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: StandaloneWindowManagerService, decorators: [{
|
|
270
|
+
type: Injectable
|
|
271
|
+
}] });
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Translates a key using the shared I18nService.
|
|
275
|
+
*
|
|
276
|
+
* @example
|
|
277
|
+
* {{ 'circles.signals.title' | translate }}
|
|
278
|
+
* {{ 'circles.items_count' | translate:{ n: count() } }}
|
|
279
|
+
*/
|
|
280
|
+
class TranslatePipe {
|
|
281
|
+
i18n = inject(I18nService);
|
|
282
|
+
transform(key, params) {
|
|
283
|
+
return this.i18n.t(key, params);
|
|
284
|
+
}
|
|
285
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: TranslatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
286
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.2.5", ngImport: i0, type: TranslatePipe, isStandalone: true, name: "translate", pure: false });
|
|
287
|
+
}
|
|
288
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: TranslatePipe, decorators: [{
|
|
289
|
+
type: Pipe,
|
|
290
|
+
args: [{
|
|
291
|
+
name: 'translate',
|
|
292
|
+
standalone: true,
|
|
293
|
+
pure: false,
|
|
294
|
+
}]
|
|
295
|
+
}] });
|
|
296
|
+
|
|
5
297
|
/*
|
|
6
|
-
* @fly
|
|
298
|
+
* @mohamedatia/fly-design-system — Public API
|
|
299
|
+
* https://www.npmjs.com/package/@mohamedatia/fly-design-system
|
|
7
300
|
*
|
|
8
301
|
* This is the single entry point for Business App developers.
|
|
9
|
-
* Import everything from '@fly
|
|
302
|
+
* Import everything from '@mohamedatia/fly-design-system' — never from relative shell paths.
|
|
303
|
+
*
|
|
304
|
+
* NOTE: This package is published under @mohamedatia/fly-design-system until the @fly
|
|
305
|
+
* npm org is created. It will be republished as @fly/design-system once available.
|
|
10
306
|
*
|
|
11
|
-
* v1.
|
|
12
|
-
*
|
|
13
|
-
*
|
|
307
|
+
* v1.3.0: FlyThemeService (html theme classes), hardened I18nService (AbortSignal, ErrorHandler, RTL helpers).
|
|
308
|
+
* v1.3.1: loadBundle normalizes locale JSON (flat or nested objects; rejects invalid leaves).
|
|
309
|
+
* See BusinessAppsGuide/03-frontend-app.md.
|
|
14
310
|
*/
|
|
15
311
|
|
|
16
312
|
/**
|
|
17
313
|
* Generated bundle index. Do not edit.
|
|
18
314
|
*/
|
|
19
315
|
|
|
20
|
-
export { WINDOW_DATA };
|
|
316
|
+
export { AuthService, FlyThemeService, I18nService, RTL_LOCALE_SET, StandaloneWindowManagerService, TranslatePipe, WINDOW_DATA, WindowManagerService, isRtlLocale };
|
|
21
317
|
//# sourceMappingURL=mohamedatia-fly-design-system.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mohamedatia-fly-design-system.mjs","sources":["../../../projects/design-system/src/lib/models/window.model.ts","../../../projects/design-system/src/public-api.ts","../../../projects/design-system/src/mohamedatia-fly-design-system.ts"],"sourcesContent":["import { InjectionToken, Type } from '@angular/core';\r\n\r\nexport type WindowState = 'normal' | 'minimized' | 'maximized';\r\n\r\nexport interface ChildWindowData {\r\n childComponent: Type<unknown>;\r\n [key: string]: unknown;\r\n}\r\n\r\nexport interface WindowInstance {\r\n id: string;\r\n appId: string;\r\n title: string;\r\n icon: string;\r\n iconBg: string;\r\n state: WindowState;\r\n position: { x: number; y: number };\r\n size: { width: number; height: number };\r\n zIndex: number;\r\n isFocused: boolean;\r\n isClosing?: boolean;\r\n isMinimizing?: boolean;\r\n isRestoring?: boolean;\r\n isMaximizing?: boolean;\r\n isUnmaximizing?: boolean;\r\n parentWindowId?: string;\r\n childData?: ChildWindowData;\r\n}\r\n\r\nexport const WINDOW_DATA = new InjectionToken<WindowInstance>('WINDOW_DATA');\r\n","/*\r\n * @fly/design-system — Public API\r\n *\r\n * This is the single entry point for Business App developers.\r\n * Import everything from '@fly/design-system' — never from relative shell paths.\r\n *\r\n * v1.0.0 exports the core models and tokens needed to integrate with the\r\n * FlyOS desktop shell. Components, directives, and pipes will be added in\r\n * subsequent releases as they are extracted from the shell.\r\n */\r\n\r\n// ─── Models ──────────────────────────────────────────────────────────────────\r\nexport type { DesktopApp } from './lib/models/app.model';\r\nexport type {\r\n WindowInstance,\r\n WindowState,\r\n ChildWindowData,\r\n} from './lib/models/window.model';\r\nexport { WINDOW_DATA } from './lib/models/window.model';\r\n\r\n// ─── Remote App Registration ─────────────────────────────────────────────────\r\nexport type { RemoteAppDef } from './lib/models/remote-app.model';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;MA6Ba,WAAW,GAAG,IAAI,cAAc,CAAiB,aAAa;;AC7B3E;;;;;;;;;AASG;;ACTH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"mohamedatia-fly-design-system.mjs","sources":["../../../projects/design-system/src/lib/models/window.model.ts","../../../projects/design-system/src/lib/services/auth.service.ts","../../../projects/design-system/src/lib/services/i18n.service.ts","../../../projects/design-system/src/lib/services/fly-theme.service.ts","../../../projects/design-system/src/lib/services/window-manager.service.ts","../../../projects/design-system/src/lib/pipes/translate.pipe.ts","../../../projects/design-system/src/public-api.ts","../../../projects/design-system/src/mohamedatia-fly-design-system.ts"],"sourcesContent":["import { InjectionToken, Type } from '@angular/core';\r\n\r\nexport type WindowState = 'normal' | 'minimized' | 'maximized';\r\n\r\nexport interface ChildWindowData {\r\n childComponent: Type<unknown>;\r\n [key: string]: unknown;\r\n}\r\n\r\nexport interface WindowInstance {\r\n id: string;\r\n appId: string;\r\n title: string;\r\n icon: string;\r\n iconBg: string;\r\n state: WindowState;\r\n position: { x: number; y: number };\r\n size: { width: number; height: number };\r\n zIndex: number;\r\n isFocused: boolean;\r\n isClosing?: boolean;\r\n isMinimizing?: boolean;\r\n isRestoring?: boolean;\r\n isMaximizing?: boolean;\r\n isUnmaximizing?: boolean;\r\n parentWindowId?: string;\r\n childData?: ChildWindowData;\r\n /** Populated when remote `loadComponent()` fails (e.g. federation). */\r\n remoteLoadError?: string;\r\n}\r\n\r\nexport const WINDOW_DATA = new InjectionToken<WindowInstance>('WINDOW_DATA');\r\n","import { Injectable, computed, signal } from '@angular/core';\nimport { User } from '../models/user.model';\n\ninterface AuthSession {\n user: User;\n accessToken: string;\n expiresAt: number;\n}\n\n/**\n * Shared AuthService for Business Apps.\n *\n * This is a **read-only signal store** — Business Apps inject it to read the\n * current user and access token. The FlyOS shell populates it after PKCE login\n * and silent refresh. Business Apps must never call setSession() directly.\n *\n * When running as a Module Federation remote, the shell and the Business App\n * share this singleton via the `@mohamedatia/fly-design-system` shared mapping\n * in federation.config.js — so the shell's populated instance is the same\n * object the Business App reads.\n *\n * When running standalone (without the shell), call initFromToken() with a\n * JWT stored in localStorage to hydrate the user.\n */\n@Injectable({ providedIn: 'root' })\nexport class AuthService {\n private _session = signal<AuthSession | null>(null);\n\n readonly currentUser = computed(() => this._session()?.user ?? null);\n readonly accessToken = computed(() => this._session()?.accessToken ?? null);\n readonly isAuthenticated = computed(() => {\n const s = this._session();\n return s !== null && s.expiresAt > Date.now();\n });\n\n /**\n * Called by the shell after a successful login or silent refresh.\n * Business Apps should not call this directly.\n */\n setSession(user: User, accessToken: string, expiresAt: number): void {\n this._session.set({ user, accessToken, expiresAt });\n }\n\n /** Clears the in-memory session (called by the shell on logout). */\n clearSession(): void {\n this._session.set(null);\n }\n\n /**\n * Standalone mode: parse a JWT from localStorage and hydrate the user.\n * Key defaults to \"circles_token\" but can be overridden.\n */\n initFromToken(storageKey = 'circles_token'): void {\n const token = localStorage.getItem(storageKey);\n if (!token) return;\n try {\n const base64 = token.split('.')[1].replace(/-/g, '+').replace(/_/g, '/');\n const payload = JSON.parse(decodeURIComponent(\n atob(base64).split('').map(c => '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2)).join('')\n )) as Record<string, unknown>;\n\n const rawRole = payload['role'];\n const roles = Array.isArray(rawRole) ? rawRole as string[] : rawRole ? [rawRole as string] : [];\n const rawApps = payload['apps'];\n const apps = Array.isArray(rawApps) ? rawApps as string[] : rawApps ? [rawApps as string] : [];\n const name = (payload['name'] as string) ?? '';\n const nameParts = name.split(' ');\n\n const user: User = {\n id: (payload['sub'] as string) ?? '',\n tenantId: (payload['tenant_id'] as string) ?? (payload['tid'] as string) ?? null,\n email: (payload['email'] as string) ?? '',\n fullName: name,\n firstName: nameParts[0] ?? '',\n lastName: nameParts.slice(1).join(' '),\n preferredLocale: (payload['locale'] as string) ?? 'en',\n roles,\n apps,\n ou: payload['ou'] as string | undefined,\n };\n\n const expiresAt = ((payload['exp'] as number) ?? 0) * 1000;\n this.setSession(user, token, expiresAt);\n } catch {\n // Invalid token — stay unauthenticated\n }\n }\n}\n","import { Injectable, computed, signal, inject, ErrorHandler } from '@angular/core';\n\n/** Locales that use RTL layout for `dir` and DS `isRtl` / `direction`. */\nexport const RTL_LOCALE_SET: ReadonlySet<string> = new Set(['ar', 'ur']);\n\nexport function isRtlLocale(lang: string): boolean {\n return RTL_LOCALE_SET.has(lang);\n}\n\nfunction escapeRegExp(s: string): string {\n return s.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\n/** Accepts flat or nested JSON objects; nested keys become dot paths. Rejects arrays and non-string leaves. */\nfunction normalizeLocaleJson(raw: unknown): Record<string, string> {\n if (raw === null || typeof raw !== 'object' || Array.isArray(raw)) {\n throw new Error('Locale bundle must be a JSON object');\n }\n const out: Record<string, string> = {};\n const walk = (obj: Record<string, unknown>, prefix: string): void => {\n for (const [k, v] of Object.entries(obj)) {\n const path = prefix ? `${prefix}.${k}` : k;\n if (typeof v === 'string') {\n out[path] = v;\n } else if (v !== null && typeof v === 'object' && !Array.isArray(v)) {\n walk(v as Record<string, unknown>, path);\n } else {\n throw new Error(`Locale bundle invalid value at \"${path}\" (expected string or nested object)`);\n }\n }\n };\n walk(raw as Record<string, unknown>, '');\n return out;\n}\n\n/** Options for loading a remote or standalone locale JSON bundle. */\nexport interface LoadBundleOptions {\n /** Stable id (e.g. app id from manifest); later loads replace this bundle only. */\n id: string;\n /** Base URL ending with `/`, e.g. `https://app.example.com/locale/` or `/circles-dev/locale/` */\n baseUrl: string;\n lang: string;\n /** When aborted, failures are ignored (e.g. superseded language load). */\n signal?: AbortSignal;\n}\n\n/**\n * Shared I18nService for the shell and Business Apps.\n *\n * **Merge order** (later keys win): shell layer → remote bundles in registration order.\n *\n * - Shell: `setShellTranslations()` after loading `locale/{lang}.json` and API overrides.\n * - Remotes: `loadBundle()` per manifest `localeBaseUrl`.\n */\n@Injectable({ providedIn: 'root' })\nexport class I18nService {\n private readonly errorHandler = inject(ErrorHandler, { optional: true });\n\n private readonly _shell = signal<Record<string, string>>({});\n private readonly _bundles = signal<Record<string, Record<string, string>>>({});\n private readonly _bundleOrder = signal<string[]>([]);\n private readonly _locale = signal<string>('en');\n private readonly _version = signal(0);\n\n private readonly _merged = computed(() => {\n const shell = this._shell();\n const order = this._bundleOrder();\n const bundles = this._bundles();\n let out: Record<string, string> = { ...shell };\n for (const id of order) {\n const b = bundles[id];\n if (b) out = { ...out, ...b };\n }\n return out;\n });\n\n readonly locale = this._locale.asReadonly();\n readonly version = this._version.asReadonly();\n readonly isRtl = computed(() => isRtlLocale(this._locale()));\n readonly direction = computed(() => (isRtlLocale(this._locale()) ? 'rtl' : 'ltr'));\n\n private bump(): void {\n this._version.update((v) => v + 1);\n }\n\n /** Replace shell strings (desktop `locale/*.json` + `/api/i18n/desktop-shell/{lang}` merged by the shell). */\n setShellTranslations(data: Record<string, string>, lang: string): void {\n this._shell.set(data);\n this._locale.set(lang);\n this.bump();\n }\n\n setLanguage(lang: string): void {\n this._locale.set(lang);\n this.bump();\n }\n\n /**\n * Fetch `{baseUrl}{lang}.json` and store under `id`. New ids are appended to the merge order.\n */\n async loadBundle(opts: LoadBundleOptions): Promise<void> {\n const { id, baseUrl, lang, signal: abortSignal } = opts;\n try {\n const base = baseUrl.endsWith('/') ? baseUrl : `${baseUrl}/`;\n const url = `${base}${lang}.json`;\n const resp = await fetch(url, { signal: abortSignal });\n if (!resp.ok) throw new Error(`HTTP ${resp.status}`);\n const data = normalizeLocaleJson(await resp.json());\n if (abortSignal?.aborted) return;\n this._bundles.update((b) => ({ ...b, [id]: data }));\n this._bundleOrder.update((order) => (order.includes(id) ? order : [...order, id]));\n this._locale.set(lang);\n this.bump();\n } catch (e) {\n if (abortSignal?.aborted) return;\n this.errorHandler?.handleError(e);\n }\n }\n\n removeBundle(id: string): void {\n this._bundles.update((b) => {\n const next = { ...b };\n delete next[id];\n return next;\n });\n this._bundleOrder.update((order) => order.filter((x) => x !== id));\n this.bump();\n }\n\n clearRemoteBundles(): void {\n this._bundles.set({});\n this._bundleOrder.set([]);\n this.bump();\n }\n\n t(key: string, params?: Record<string, string | number>): string {\n const val = this._merged()[key] ?? key;\n if (!params) return val;\n return Object.entries(params).reduce((result, [k, v]) => {\n const safe = escapeRegExp(k);\n return result.replace(new RegExp(`{{\\\\s*${safe}\\\\s*}}`, 'g'), String(v));\n }, val);\n }\n}\n","import { Injectable, signal } from '@angular/core';\n\nexport type FlyThemeMode = 'light' | 'dark' | 'transparent';\n\n/**\n * Applies `html.light-theme` / `html.dark-theme` / `html.transparent-theme` for DS SCSS.\n * Shell and standalone Business Apps use the same service (federation singleton when shared).\n */\n@Injectable({ providedIn: 'root' })\nexport class FlyThemeService {\n readonly theme = signal<FlyThemeMode>('light');\n\n applyTheme(mode: FlyThemeMode): void {\n this.theme.set(mode);\n const html = document.documentElement;\n html.classList.remove('dark-theme', 'light-theme', 'transparent-theme');\n if (mode === 'dark') {\n html.classList.add('dark-theme');\n } else if (mode === 'transparent') {\n html.classList.add('transparent-theme');\n } else {\n html.classList.add('light-theme');\n }\n }\n}\n","import { Injectable } from '@angular/core';\n\n/** Options for opening a child window. */\nexport interface OpenWindowOptions {\n /** Unique identifier for the window instance. */\n windowId: string;\n /** Display title shown in the window chrome. */\n title: string;\n /** Route path or URL to load inside the window. */\n route: string;\n /** Initial width in pixels. Defaults to 900. */\n width?: number;\n /** Initial height in pixels. Defaults to 600. */\n height?: number;\n /** Whether the window can be resized. Defaults to true. */\n resizable?: boolean;\n /** Whether the window can be maximised. Defaults to true. */\n maximizable?: boolean;\n /** Arbitrary data passed to the child window via WINDOW_DATA. */\n data?: unknown;\n}\n\n/**\n * Abstract interface for the WindowManager.\n * The FlyOS shell provides the concrete implementation; Business Apps\n * inject this token to open, close, and focus windows without depending\n * on the shell's internal implementation.\n */\nexport abstract class WindowManagerService {\n abstract openChildWindow(options: OpenWindowOptions): void;\n abstract closeWindow(windowId: string): void;\n abstract focusWindow(windowId: string): void;\n}\n\n/**\n * No-op fallback implementation used when running a Business App in\n * standalone mode (outside the FlyOS shell). Logs a warning instead of\n * throwing so standalone dev/test flows are not broken.\n */\n@Injectable()\nexport class StandaloneWindowManagerService extends WindowManagerService {\n openChildWindow(options: OpenWindowOptions): void {\n console.warn('[WindowManagerService] openChildWindow called in standalone mode — no shell available.', options);\n }\n\n closeWindow(windowId: string): void {\n console.warn('[WindowManagerService] closeWindow called in standalone mode — no shell available.', windowId);\n }\n\n focusWindow(windowId: string): void {\n console.warn('[WindowManagerService] focusWindow called in standalone mode — no shell available.', windowId);\n }\n}\n\n","import { Pipe, PipeTransform, inject } from '@angular/core';\nimport { I18nService } from '../services/i18n.service';\n\n/**\n * Translates a key using the shared I18nService.\n *\n * @example\n * {{ 'circles.signals.title' | translate }}\n * {{ 'circles.items_count' | translate:{ n: count() } }}\n */\n@Pipe({\n name: 'translate',\n standalone: true,\n pure: false,\n})\nexport class TranslatePipe implements PipeTransform {\n private readonly i18n = inject(I18nService);\n\n transform(key: string, params?: Record<string, string | number>): string {\n return this.i18n.t(key, params);\n }\n}\n","/*\r\n * @mohamedatia/fly-design-system — Public API\r\n * https://www.npmjs.com/package/@mohamedatia/fly-design-system\r\n *\r\n * This is the single entry point for Business App developers.\r\n * Import everything from '@mohamedatia/fly-design-system' — never from relative shell paths.\r\n *\r\n * NOTE: This package is published under @mohamedatia/fly-design-system until the @fly\r\n * npm org is created. It will be republished as @fly/design-system once available.\r\n *\r\n * v1.3.0: FlyThemeService (html theme classes), hardened I18nService (AbortSignal, ErrorHandler, RTL helpers).\r\n * v1.3.1: loadBundle normalizes locale JSON (flat or nested objects; rejects invalid leaves).\r\n * See BusinessAppsGuide/03-frontend-app.md.\r\n */\r\n\r\n// ─── Models ──────────────────────────────────────────────────────────────────\r\nexport type { DesktopApp } from './lib/models/app.model';\r\nexport type {\r\n WindowInstance,\r\n WindowState,\r\n ChildWindowData,\r\n} from './lib/models/window.model';\r\nexport { WINDOW_DATA } from './lib/models/window.model';\r\nexport type { User } from './lib/models/user.model';\r\n\r\n// ─── Remote App Registration ─────────────────────────────────────────────────\r\nexport type { RemoteAppDef } from './lib/models/remote-app.model';\r\n\r\n// ─── Services ────────────────────────────────────────────────────────────────\r\nexport { AuthService } from './lib/services/auth.service';\r\nexport type { LoadBundleOptions } from './lib/services/i18n.service';\r\nexport { I18nService, RTL_LOCALE_SET, isRtlLocale } from './lib/services/i18n.service';\r\nexport { FlyThemeService, type FlyThemeMode } from './lib/services/fly-theme.service';\r\nexport {\r\n WindowManagerService,\r\n StandaloneWindowManagerService,\r\n type OpenWindowOptions,\r\n} from './lib/services/window-manager.service';\r\n\r\n// ─── Pipes ───────────────────────────────────────────────────────────────────\r\nexport { TranslatePipe } from './lib/pipes/translate.pipe';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;MA+Ba,WAAW,GAAG,IAAI,cAAc,CAAiB,aAAa;;ACtB3E;;;;;;;;;;;;;;AAcG;MAEU,WAAW,CAAA;AACd,IAAA,QAAQ,GAAG,MAAM,CAAqB,IAAI,+EAAC;AAE1C,IAAA,WAAW,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,IAAI,IAAI,kFAAC;AAC3D,IAAA,WAAW,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,QAAQ,EAAE,EAAE,WAAW,IAAI,IAAI,kFAAC;AAClE,IAAA,eAAe,GAAG,QAAQ,CAAC,MAAK;AACvC,QAAA,MAAM,CAAC,GAAG,IAAI,CAAC,QAAQ,EAAE;AACzB,QAAA,OAAO,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE;AAC/C,IAAA,CAAC,sFA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AAA;AACP,IAAA,IAAI,GAAG,MAAM,CAAC,WAAW,CAAC;IAE3C,SAAS,CAAC,GAAW,EAAE,MAAwC,EAAA;QAC7D,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC;IACjC;uGALW,aAAa,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,IAAA,EAAA,CAAA;qGAAb,aAAa,EAAA,YAAA,EAAA,IAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,KAAA,EAAA,CAAA;;2FAAb,aAAa,EAAA,UAAA,EAAA,CAAA;kBALzB,IAAI;AAAC,YAAA,IAAA,EAAA,CAAA;AACJ,oBAAA,IAAI,EAAE,WAAW;AACjB,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,IAAI,EAAE,KAAK;AACZ,iBAAA;;;ACdD;;;;;;;;;;;;;AAaG;;ACbH;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Entry: tokens + html.light-theme / .dark-theme / .transparent-theme + OS auto dark.
|
|
2
|
+
// Use from shell or Business Apps:
|
|
3
|
+
// stylePreprocessorOptions.includePaths → design-system src folder
|
|
4
|
+
// @use 'scss/fly-theme' or @use 'fly-theme' when scss is on the path.
|
|
5
|
+
@use 'tokens';
|
|
6
|
+
@use 'theme-light';
|
|
7
|
+
@use 'theme-dark';
|
|
8
|
+
@use 'theme-transparent';
|
|
9
|
+
@use 'theme-auto';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// ─── Dark Theme Variables (shared mixin to avoid duplication) ────────────────
|
|
2
|
+
@mixin dark-theme-vars {
|
|
3
|
+
--primary-light: rgba(232, 115, 42, 0.18);
|
|
4
|
+
|
|
5
|
+
--surface-ground: #0e0e10;
|
|
6
|
+
--surface-section: rgba(28, 28, 30, 0.85);
|
|
7
|
+
--surface-card: rgba(28, 28, 30, 0.7);
|
|
8
|
+
--surface-border: rgba(255, 255, 255, 0.1);
|
|
9
|
+
--surface-hover: rgba(255, 255, 255, 0.08);
|
|
10
|
+
--text-color: #f2f2f7;
|
|
11
|
+
--text-color-secondary: rgba(242, 242, 247, 0.65);
|
|
12
|
+
|
|
13
|
+
--glass-bg: rgba(25, 25, 28, 0.72);
|
|
14
|
+
--glass-bg-elevated: rgba(38, 38, 42, 0.82);
|
|
15
|
+
--glass-border: rgba(255, 255, 255, 0.12);
|
|
16
|
+
--glass-shadow: 0 8px 40px rgba(0, 0, 0, 0.35);
|
|
17
|
+
--glass-inner-glow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
|
|
18
|
+
|
|
19
|
+
--window-bg: rgba(22, 22, 24, 0.55);
|
|
20
|
+
--window-radius: 46px;
|
|
21
|
+
--window-shadow: 0 24px 80px rgba(0, 0, 0, 0.4);
|
|
22
|
+
--window-border: rgba(255, 255, 255, 0.12);
|
|
23
|
+
|
|
24
|
+
--titlebar-bg: transparent;
|
|
25
|
+
|
|
26
|
+
--dock-bg: rgba(20, 20, 22, 0.55);
|
|
27
|
+
--dock-border: rgba(255, 255, 255, 0.12);
|
|
28
|
+
--dock-blur: 50px;
|
|
29
|
+
|
|
30
|
+
--menubar-bg: rgba(14, 14, 16, 0.6);
|
|
31
|
+
--menubar-border: rgba(255, 255, 255, 0.06);
|
|
32
|
+
--menubar-text: rgba(242, 242, 247, 1);
|
|
33
|
+
|
|
34
|
+
--sidebar-bg: rgba(20, 20, 22, 0.6);
|
|
35
|
+
--sidebar-border: rgba(255, 255, 255, 0.08);
|
|
36
|
+
|
|
37
|
+
--focus-ring: rgba(232, 115, 42, 0.6);
|
|
38
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// ─── Light Theme (default) ───────────────────────────────────────────────────
|
|
2
|
+
:root,
|
|
3
|
+
html.light-theme {
|
|
4
|
+
--primary-color: #E8732A;
|
|
5
|
+
--primary-hover: #D4631E;
|
|
6
|
+
--primary-light: rgba(232, 115, 42, 0.12);
|
|
7
|
+
|
|
8
|
+
--accent-green: var(--system-green);
|
|
9
|
+
--accent-red: var(--system-red);
|
|
10
|
+
--accent-blue: var(--system-blue);
|
|
11
|
+
--accent-orange: #E8732A;
|
|
12
|
+
--accent-yellow: var(--system-yellow);
|
|
13
|
+
|
|
14
|
+
--surface-ground: #f8f9fa;
|
|
15
|
+
--surface-section: #ffffff;
|
|
16
|
+
--surface-card: rgba(255, 255, 255, 0.55);
|
|
17
|
+
--surface-border: rgba(0, 0, 0, 0.06);
|
|
18
|
+
--surface-hover: rgba(0, 0, 0, 0.04);
|
|
19
|
+
--text-color: #111827;
|
|
20
|
+
--text-color-secondary: rgba(17, 24, 39, 0.55);
|
|
21
|
+
|
|
22
|
+
--glass-bg: rgba(255, 255, 255, 0.55);
|
|
23
|
+
--glass-bg-elevated: rgba(255, 255, 255, 0.72);
|
|
24
|
+
--glass-blur: 40px;
|
|
25
|
+
--glass-border: rgba(255, 255, 255, 0.35);
|
|
26
|
+
--glass-shadow: 0 8px 40px rgba(0, 0, 0, 0.08);
|
|
27
|
+
--glass-inner-glow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
|
|
28
|
+
|
|
29
|
+
--card-radius: 20px;
|
|
30
|
+
--card-padding: 20px;
|
|
31
|
+
--card-gap: 14px;
|
|
32
|
+
|
|
33
|
+
--window-bg: var(--material-glass);
|
|
34
|
+
--window-radius: 46px;
|
|
35
|
+
--window-blur: var(--material-glass-blur);
|
|
36
|
+
--window-shadow: 0 24px 80px rgba(0, 0, 0, 0.12);
|
|
37
|
+
--window-border: var(--material-glass-stroke);
|
|
38
|
+
--window-specular: var(--material-glass-specular);
|
|
39
|
+
|
|
40
|
+
--titlebar-bg: transparent;
|
|
41
|
+
--titlebar-height: 92px;
|
|
42
|
+
--titlebar-padding: 0 24px;
|
|
43
|
+
|
|
44
|
+
--dock-bg: rgba(255, 255, 255, 0.15);
|
|
45
|
+
--dock-border: rgba(255, 255, 255, 0.3);
|
|
46
|
+
--dock-blur: 50px;
|
|
47
|
+
|
|
48
|
+
--menubar-bg: rgba(255, 255, 255, 0.55);
|
|
49
|
+
--menubar-border: rgba(0, 0, 0, 0.06);
|
|
50
|
+
--menubar-text: rgba(17, 24, 39, 1);
|
|
51
|
+
--menubar-blur: 40px;
|
|
52
|
+
--menubar-radius: 24px;
|
|
53
|
+
|
|
54
|
+
--sidebar-bg: rgba(255, 255, 255, 0.35);
|
|
55
|
+
--sidebar-border: rgba(255, 255, 255, 0.25);
|
|
56
|
+
--sidebar-width: 60px;
|
|
57
|
+
--sidebar-icon-size: 36px;
|
|
58
|
+
--sidebar-radius: 28px;
|
|
59
|
+
|
|
60
|
+
--focus-ring: rgba(232, 115, 42, 0.5);
|
|
61
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// ─── Transparent / Spatial Theme (visionOS-style) ───────────────────────────
|
|
2
|
+
html.transparent-theme {
|
|
3
|
+
--primary-light: rgba(232, 115, 42, 0.2);
|
|
4
|
+
|
|
5
|
+
--surface-ground: transparent;
|
|
6
|
+
--surface-section: rgba(255, 255, 255, 0.18);
|
|
7
|
+
--surface-card: rgba(255, 255, 255, 0.22);
|
|
8
|
+
--surface-border: rgba(255, 255, 255, 0.16);
|
|
9
|
+
--surface-hover: rgba(0, 0, 0, 0.04);
|
|
10
|
+
--text-color: var(--label-primary);
|
|
11
|
+
--text-color-secondary: var(--label-secondary);
|
|
12
|
+
|
|
13
|
+
--glass-bg: var(--material-glass);
|
|
14
|
+
--glass-bg-elevated: rgba(128, 128, 128, 0.45);
|
|
15
|
+
--glass-blur: var(--material-glass-blur);
|
|
16
|
+
--glass-border: var(--material-glass-stroke);
|
|
17
|
+
--glass-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
|
|
18
|
+
--glass-inner-glow: var(--material-glass-specular);
|
|
19
|
+
|
|
20
|
+
--window-bg: var(--material-glass);
|
|
21
|
+
--window-radius: 46px;
|
|
22
|
+
--window-blur: var(--material-glass-blur);
|
|
23
|
+
--window-shadow: 0 24px 80px rgba(0, 0, 0, 0.15);
|
|
24
|
+
--window-border: var(--material-glass-stroke);
|
|
25
|
+
|
|
26
|
+
--titlebar-bg: transparent;
|
|
27
|
+
|
|
28
|
+
--dock-bg: rgba(128, 128, 128, 0.2);
|
|
29
|
+
--dock-border: var(--material-glass-stroke);
|
|
30
|
+
--dock-blur: var(--material-glass-blur);
|
|
31
|
+
|
|
32
|
+
--menubar-bg: rgba(128, 128, 128, 0.25);
|
|
33
|
+
--menubar-border: var(--material-glass-stroke);
|
|
34
|
+
--menubar-text: var(--label-primary);
|
|
35
|
+
--menubar-blur: var(--material-glass-blur);
|
|
36
|
+
|
|
37
|
+
--sidebar-bg: rgba(128, 128, 128, 0.2);
|
|
38
|
+
--sidebar-border: var(--material-glass-stroke);
|
|
39
|
+
|
|
40
|
+
--focus-ring: rgba(232, 115, 42, 0.6);
|
|
41
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// ─── visionOS System Colors & Design Tokens ─────────────────────────────────
|
|
2
|
+
:root {
|
|
3
|
+
--system-red: #FF453A;
|
|
4
|
+
--system-orange: #FF9F0A;
|
|
5
|
+
--system-yellow: #FFD60A;
|
|
6
|
+
--system-green: #32D74B;
|
|
7
|
+
--system-mint: #66D4CF;
|
|
8
|
+
--system-teal: #6AC4DC;
|
|
9
|
+
--system-cyan: #5AC8F5;
|
|
10
|
+
--system-blue: #0A84FF;
|
|
11
|
+
--system-indigo: #5E5CE6;
|
|
12
|
+
--system-purple: #BF5AF2;
|
|
13
|
+
--system-pink: #FF375F;
|
|
14
|
+
--system-brown: #AC8E68;
|
|
15
|
+
--system-gray: #98989D;
|
|
16
|
+
|
|
17
|
+
// ── Semantic Status Colors ──
|
|
18
|
+
--status-success: var(--system-green);
|
|
19
|
+
--status-warning: var(--system-orange);
|
|
20
|
+
--status-error: var(--system-red);
|
|
21
|
+
--status-info: var(--system-blue);
|
|
22
|
+
--status-pending: var(--system-yellow);
|
|
23
|
+
|
|
24
|
+
// ── visionOS Typography ──
|
|
25
|
+
--font-family: 'SF Pro Display', 'SF Pro', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
|
26
|
+
--font-xl-title1: 700 48px/56px var(--font-family);
|
|
27
|
+
--font-xl-title2: 700 38px/46px var(--font-family);
|
|
28
|
+
--font-large-title: 700 29px/38px var(--font-family);
|
|
29
|
+
--font-title1: 700 24px/32px var(--font-family);
|
|
30
|
+
--font-title2: 700 22px/28px var(--font-family);
|
|
31
|
+
--font-title3: 700 19px/24px var(--font-family);
|
|
32
|
+
--font-headline: 700 17px/22px var(--font-family);
|
|
33
|
+
--font-body: 510 17px/22px var(--font-family);
|
|
34
|
+
--font-callout: 590 15px/20px var(--font-family);
|
|
35
|
+
--font-subheadline: 400 15px/20px var(--font-family);
|
|
36
|
+
--font-footnote: 510 13px/18px var(--font-family);
|
|
37
|
+
--font-caption1: 510 12px/16px var(--font-family);
|
|
38
|
+
--font-caption2: 510 12px/16px var(--font-family);
|
|
39
|
+
|
|
40
|
+
// ── visionOS Label Colors ──
|
|
41
|
+
--label-primary: rgba(255, 255, 255, 0.96);
|
|
42
|
+
--label-secondary: rgba(255, 255, 255, 0.56);
|
|
43
|
+
--label-tertiary: rgba(255, 255, 255, 0.36);
|
|
44
|
+
|
|
45
|
+
// ── visionOS Materials ──
|
|
46
|
+
--material-glass: rgba(128, 128, 128, 0.3);
|
|
47
|
+
--material-glass-blur: 50px;
|
|
48
|
+
--material-glass-stroke: rgba(255, 255, 255, 0.4);
|
|
49
|
+
--material-glass-specular: inset 0px -0.5px 1px rgba(255, 255, 255, 0.3),
|
|
50
|
+
inset 0px -0.5px 1px rgba(255, 255, 255, 0.25),
|
|
51
|
+
inset 1px 1.5px 4px rgba(0, 0, 0, 0.08),
|
|
52
|
+
inset 1px 1.5px 4px rgba(0, 0, 0, 0.1);
|
|
53
|
+
|
|
54
|
+
--material-recessed-bg: linear-gradient(rgba(208, 208, 208, 0.5), rgba(208, 208, 208, 0.5)),
|
|
55
|
+
linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.1));
|
|
56
|
+
--material-recessed-shadow: inset 1px 1.5px 4px rgba(0, 0, 0, 0.1),
|
|
57
|
+
inset 1px 1.5px 4px rgba(0, 0, 0, 0.08),
|
|
58
|
+
inset 0px -0.5px 1px rgba(255, 255, 255, 0.25),
|
|
59
|
+
inset 0px -0.5px 1px rgba(255, 255, 255, 0.3);
|
|
60
|
+
|
|
61
|
+
--material-thin: rgba(255, 255, 255, 0.06);
|
|
62
|
+
--material-regular: rgba(255, 255, 255, 0.12);
|
|
63
|
+
--material-thick: rgba(255, 255, 255, 0.2);
|
|
64
|
+
|
|
65
|
+
--control-idle: rgba(255, 255, 255, 0.06);
|
|
66
|
+
--control-hover: rgba(255, 255, 255, 0.12);
|
|
67
|
+
--control-selected: rgba(255, 255, 255, 1);
|
|
68
|
+
--control-disabled: rgba(255, 255, 255, 0.04);
|
|
69
|
+
|
|
70
|
+
--separator: rgba(255, 255, 255, 0.12);
|
|
71
|
+
|
|
72
|
+
--blur-shadow-small: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
73
|
+
|
|
74
|
+
// ── visionOS Button Tokens ──
|
|
75
|
+
--btn-font-weight: 590;
|
|
76
|
+
--btn-symbol-font-weight: 510;
|
|
77
|
+
--btn-radius-capsule: 500px;
|
|
78
|
+
--btn-radius-rect-lg: 16px;
|
|
79
|
+
--btn-radius-rect-sm: 8px;
|
|
80
|
+
|
|
81
|
+
--btn-sm-height: 32px;
|
|
82
|
+
--btn-sm-padding: 0 12px;
|
|
83
|
+
--btn-sm-font-size: 15px;
|
|
84
|
+
--btn-sm-line-height: 20px;
|
|
85
|
+
--btn-sm-symbol-size: 17px;
|
|
86
|
+
--btn-sm-gap: 2px;
|
|
87
|
+
|
|
88
|
+
--btn-reg-height: 44px;
|
|
89
|
+
--btn-reg-padding: 0 20px;
|
|
90
|
+
--btn-reg-font-size: 17px;
|
|
91
|
+
--btn-reg-line-height: 22px;
|
|
92
|
+
--btn-reg-symbol-size: 19px;
|
|
93
|
+
--btn-reg-gap: 6px;
|
|
94
|
+
|
|
95
|
+
--btn-lg-height: 52px;
|
|
96
|
+
--btn-lg-padding: 0 25px;
|
|
97
|
+
--btn-lg-font-size: 19px;
|
|
98
|
+
--btn-lg-line-height: 24px;
|
|
99
|
+
--btn-lg-symbol-size: 22px;
|
|
100
|
+
--btn-lg-gap: 6px;
|
|
101
|
+
|
|
102
|
+
--btn-symbol-mini: 28px;
|
|
103
|
+
--btn-symbol-mini-font: 13px;
|
|
104
|
+
--btn-symbol-sm: 36px;
|
|
105
|
+
--btn-symbol-sm-font: 15px;
|
|
106
|
+
--btn-symbol-reg: 44px;
|
|
107
|
+
--btn-symbol-reg-font: 19px;
|
|
108
|
+
--btn-symbol-lg: 52px;
|
|
109
|
+
--btn-symbol-lg-font: 22px;
|
|
110
|
+
--btn-symbol-xl: 60px;
|
|
111
|
+
--btn-symbol-xl-font: 26px;
|
|
112
|
+
|
|
113
|
+
--btn-platter-lighten: rgba(255, 255, 255, 0.06);
|
|
114
|
+
--btn-platter-dodge: rgba(94, 94, 94, 0.18);
|
|
115
|
+
--btn-hover-grad-white: rgba(255, 255, 255, 0.07);
|
|
116
|
+
--btn-hover-grad-gray: rgba(94, 94, 94, 0.14);
|
|
117
|
+
--btn-disabled-lighten: rgba(255, 255, 255, 0.04);
|
|
118
|
+
--btn-disabled-dodge: rgba(94, 94, 94, 0.07);
|
|
119
|
+
--btn-disabled-text: rgba(112, 112, 112, 0.5);
|
|
120
|
+
--btn-selected-bg: rgba(255, 255, 255, 0.96);
|
|
121
|
+
--btn-selected-text: #000000;
|
|
122
|
+
|
|
123
|
+
--link-color: #3CD3FE;
|
|
124
|
+
--link-height: 26px;
|
|
125
|
+
--link-font-size: 13px;
|
|
126
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Type, InjectionToken, PipeTransform } from '@angular/core';
|
|
2
3
|
|
|
3
4
|
interface DesktopApp {
|
|
4
5
|
id: string;
|
|
@@ -49,9 +50,24 @@ interface WindowInstance {
|
|
|
49
50
|
isUnmaximizing?: boolean;
|
|
50
51
|
parentWindowId?: string;
|
|
51
52
|
childData?: ChildWindowData;
|
|
53
|
+
/** Populated when remote `loadComponent()` fails (e.g. federation). */
|
|
54
|
+
remoteLoadError?: string;
|
|
52
55
|
}
|
|
53
56
|
declare const WINDOW_DATA: InjectionToken<WindowInstance>;
|
|
54
57
|
|
|
58
|
+
interface User {
|
|
59
|
+
id: string;
|
|
60
|
+
tenantId: string | null;
|
|
61
|
+
email: string;
|
|
62
|
+
fullName: string;
|
|
63
|
+
firstName: string;
|
|
64
|
+
lastName: string;
|
|
65
|
+
preferredLocale: string;
|
|
66
|
+
roles: string[];
|
|
67
|
+
apps: string[];
|
|
68
|
+
ou?: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
55
71
|
/**
|
|
56
72
|
* Describes a Business App remote registered via the Controller App's
|
|
57
73
|
* /api/apps/manifest endpoint. The shell loads the component at runtime
|
|
@@ -63,6 +79,8 @@ interface RemoteAppDef {
|
|
|
63
79
|
remoteEntry: string;
|
|
64
80
|
/** The module key exposed by the remote's federation.config.js, e.g. "./MyAppComponent" */
|
|
65
81
|
exposedModule: string;
|
|
82
|
+
/** Base URL for locale JSON (`{base}{lang}.json`), e.g. `/circles-dev/locale/` or `https://app/locale/` */
|
|
83
|
+
localeBaseUrl?: string;
|
|
66
84
|
nameKey: string;
|
|
67
85
|
descriptionKey: string;
|
|
68
86
|
icon: string;
|
|
@@ -80,6 +98,159 @@ interface RemoteAppDef {
|
|
|
80
98
|
chromeless?: boolean;
|
|
81
99
|
}
|
|
82
100
|
|
|
83
|
-
|
|
84
|
-
|
|
101
|
+
/**
|
|
102
|
+
* Shared AuthService for Business Apps.
|
|
103
|
+
*
|
|
104
|
+
* This is a **read-only signal store** — Business Apps inject it to read the
|
|
105
|
+
* current user and access token. The FlyOS shell populates it after PKCE login
|
|
106
|
+
* and silent refresh. Business Apps must never call setSession() directly.
|
|
107
|
+
*
|
|
108
|
+
* When running as a Module Federation remote, the shell and the Business App
|
|
109
|
+
* share this singleton via the `@mohamedatia/fly-design-system` shared mapping
|
|
110
|
+
* in federation.config.js — so the shell's populated instance is the same
|
|
111
|
+
* object the Business App reads.
|
|
112
|
+
*
|
|
113
|
+
* When running standalone (without the shell), call initFromToken() with a
|
|
114
|
+
* JWT stored in localStorage to hydrate the user.
|
|
115
|
+
*/
|
|
116
|
+
declare class AuthService {
|
|
117
|
+
private _session;
|
|
118
|
+
readonly currentUser: i0.Signal<User | null>;
|
|
119
|
+
readonly accessToken: i0.Signal<string | null>;
|
|
120
|
+
readonly isAuthenticated: i0.Signal<boolean>;
|
|
121
|
+
/**
|
|
122
|
+
* Called by the shell after a successful login or silent refresh.
|
|
123
|
+
* Business Apps should not call this directly.
|
|
124
|
+
*/
|
|
125
|
+
setSession(user: User, accessToken: string, expiresAt: number): void;
|
|
126
|
+
/** Clears the in-memory session (called by the shell on logout). */
|
|
127
|
+
clearSession(): void;
|
|
128
|
+
/**
|
|
129
|
+
* Standalone mode: parse a JWT from localStorage and hydrate the user.
|
|
130
|
+
* Key defaults to "circles_token" but can be overridden.
|
|
131
|
+
*/
|
|
132
|
+
initFromToken(storageKey?: string): void;
|
|
133
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AuthService, never>;
|
|
134
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<AuthService>;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/** Locales that use RTL layout for `dir` and DS `isRtl` / `direction`. */
|
|
138
|
+
declare const RTL_LOCALE_SET: ReadonlySet<string>;
|
|
139
|
+
declare function isRtlLocale(lang: string): boolean;
|
|
140
|
+
/** Options for loading a remote or standalone locale JSON bundle. */
|
|
141
|
+
interface LoadBundleOptions {
|
|
142
|
+
/** Stable id (e.g. app id from manifest); later loads replace this bundle only. */
|
|
143
|
+
id: string;
|
|
144
|
+
/** Base URL ending with `/`, e.g. `https://app.example.com/locale/` or `/circles-dev/locale/` */
|
|
145
|
+
baseUrl: string;
|
|
146
|
+
lang: string;
|
|
147
|
+
/** When aborted, failures are ignored (e.g. superseded language load). */
|
|
148
|
+
signal?: AbortSignal;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Shared I18nService for the shell and Business Apps.
|
|
152
|
+
*
|
|
153
|
+
* **Merge order** (later keys win): shell layer → remote bundles in registration order.
|
|
154
|
+
*
|
|
155
|
+
* - Shell: `setShellTranslations()` after loading `locale/{lang}.json` and API overrides.
|
|
156
|
+
* - Remotes: `loadBundle()` per manifest `localeBaseUrl`.
|
|
157
|
+
*/
|
|
158
|
+
declare class I18nService {
|
|
159
|
+
private readonly errorHandler;
|
|
160
|
+
private readonly _shell;
|
|
161
|
+
private readonly _bundles;
|
|
162
|
+
private readonly _bundleOrder;
|
|
163
|
+
private readonly _locale;
|
|
164
|
+
private readonly _version;
|
|
165
|
+
private readonly _merged;
|
|
166
|
+
readonly locale: i0.Signal<string>;
|
|
167
|
+
readonly version: i0.Signal<number>;
|
|
168
|
+
readonly isRtl: i0.Signal<boolean>;
|
|
169
|
+
readonly direction: i0.Signal<"rtl" | "ltr">;
|
|
170
|
+
private bump;
|
|
171
|
+
/** Replace shell strings (desktop `locale/*.json` + `/api/i18n/desktop-shell/{lang}` merged by the shell). */
|
|
172
|
+
setShellTranslations(data: Record<string, string>, lang: string): void;
|
|
173
|
+
setLanguage(lang: string): void;
|
|
174
|
+
/**
|
|
175
|
+
* Fetch `{baseUrl}{lang}.json` and store under `id`. New ids are appended to the merge order.
|
|
176
|
+
*/
|
|
177
|
+
loadBundle(opts: LoadBundleOptions): Promise<void>;
|
|
178
|
+
removeBundle(id: string): void;
|
|
179
|
+
clearRemoteBundles(): void;
|
|
180
|
+
t(key: string, params?: Record<string, string | number>): string;
|
|
181
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<I18nService, never>;
|
|
182
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<I18nService>;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
type FlyThemeMode = 'light' | 'dark' | 'transparent';
|
|
186
|
+
/**
|
|
187
|
+
* Applies `html.light-theme` / `html.dark-theme` / `html.transparent-theme` for DS SCSS.
|
|
188
|
+
* Shell and standalone Business Apps use the same service (federation singleton when shared).
|
|
189
|
+
*/
|
|
190
|
+
declare class FlyThemeService {
|
|
191
|
+
readonly theme: i0.WritableSignal<FlyThemeMode>;
|
|
192
|
+
applyTheme(mode: FlyThemeMode): void;
|
|
193
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FlyThemeService, never>;
|
|
194
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<FlyThemeService>;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/** Options for opening a child window. */
|
|
198
|
+
interface OpenWindowOptions {
|
|
199
|
+
/** Unique identifier for the window instance. */
|
|
200
|
+
windowId: string;
|
|
201
|
+
/** Display title shown in the window chrome. */
|
|
202
|
+
title: string;
|
|
203
|
+
/** Route path or URL to load inside the window. */
|
|
204
|
+
route: string;
|
|
205
|
+
/** Initial width in pixels. Defaults to 900. */
|
|
206
|
+
width?: number;
|
|
207
|
+
/** Initial height in pixels. Defaults to 600. */
|
|
208
|
+
height?: number;
|
|
209
|
+
/** Whether the window can be resized. Defaults to true. */
|
|
210
|
+
resizable?: boolean;
|
|
211
|
+
/** Whether the window can be maximised. Defaults to true. */
|
|
212
|
+
maximizable?: boolean;
|
|
213
|
+
/** Arbitrary data passed to the child window via WINDOW_DATA. */
|
|
214
|
+
data?: unknown;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Abstract interface for the WindowManager.
|
|
218
|
+
* The FlyOS shell provides the concrete implementation; Business Apps
|
|
219
|
+
* inject this token to open, close, and focus windows without depending
|
|
220
|
+
* on the shell's internal implementation.
|
|
221
|
+
*/
|
|
222
|
+
declare abstract class WindowManagerService {
|
|
223
|
+
abstract openChildWindow(options: OpenWindowOptions): void;
|
|
224
|
+
abstract closeWindow(windowId: string): void;
|
|
225
|
+
abstract focusWindow(windowId: string): void;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* No-op fallback implementation used when running a Business App in
|
|
229
|
+
* standalone mode (outside the FlyOS shell). Logs a warning instead of
|
|
230
|
+
* throwing so standalone dev/test flows are not broken.
|
|
231
|
+
*/
|
|
232
|
+
declare class StandaloneWindowManagerService extends WindowManagerService {
|
|
233
|
+
openChildWindow(options: OpenWindowOptions): void;
|
|
234
|
+
closeWindow(windowId: string): void;
|
|
235
|
+
focusWindow(windowId: string): void;
|
|
236
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<StandaloneWindowManagerService, never>;
|
|
237
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<StandaloneWindowManagerService>;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Translates a key using the shared I18nService.
|
|
242
|
+
*
|
|
243
|
+
* @example
|
|
244
|
+
* {{ 'circles.signals.title' | translate }}
|
|
245
|
+
* {{ 'circles.items_count' | translate:{ n: count() } }}
|
|
246
|
+
*/
|
|
247
|
+
declare class TranslatePipe implements PipeTransform {
|
|
248
|
+
private readonly i18n;
|
|
249
|
+
transform(key: string, params?: Record<string, string | number>): string;
|
|
250
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TranslatePipe, never>;
|
|
251
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<TranslatePipe, "translate", true>;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export { AuthService, FlyThemeService, I18nService, RTL_LOCALE_SET, StandaloneWindowManagerService, TranslatePipe, WINDOW_DATA, WindowManagerService, isRtlLocale };
|
|
255
|
+
export type { ChildWindowData, DesktopApp, FlyThemeMode, LoadBundleOptions, OpenWindowOptions, RemoteAppDef, User, WindowInstance, WindowState };
|
|
85
256
|
//# sourceMappingURL=mohamedatia-fly-design-system.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mohamedatia-fly-design-system.d.ts","sources":["../../../projects/design-system/src/lib/models/app.model.ts","../../../projects/design-system/src/lib/models/window.model.ts","../../../projects/design-system/src/lib/models/remote-app.model.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"mohamedatia-fly-design-system.d.ts","sources":["../../../projects/design-system/src/lib/models/app.model.ts","../../../projects/design-system/src/lib/models/window.model.ts","../../../projects/design-system/src/lib/models/user.model.ts","../../../projects/design-system/src/lib/models/remote-app.model.ts","../../../projects/design-system/src/lib/services/auth.service.ts","../../../projects/design-system/src/lib/services/i18n.service.ts","../../../projects/design-system/src/lib/services/fly-theme.service.ts","../../../projects/design-system/src/lib/services/window-manager.service.ts","../../../projects/design-system/src/lib/pipes/translate.pipe.ts"],"mappings":";;;UAEiB,UAAU;;;;;;yBAMJ,OAAO,CAAC,IAAI;AACjC;;;;AACA;;;;;;;AAID;;ACZK,KAAM,WAAW;UAEN,eAAe;AAC9B,oBAAgB,IAAI;AACpB;AACD;UAEgB,cAAc;;;;;;WAMtB,WAAW;AAClB;;;;AACA;;;;;;;;;;;;gBASY,eAAe;;;AAG5B;AAED,cAAa,WAAW,EAAA,cAAA,CAAA,cAAA;;UC/BP,IAAI;;AAEnB;;;;;;;;;AASD;;ACTD;;;;AAIG;UACc,YAAY;;;;;;;;;;;;AAY3B;;;;AACA;;;;;AAEA,cAAU,UAAU;;AAErB;;ACfD;;;;;;;;;;;;;;AAcG;AACH,cACa,WAAW;;0BAGFA,EAAA,CAAA,MAAA,CAAA,IAAA;0BACAA,EAAA,CAAA,MAAA;8BACIA,EAAA,CAAA,MAAA;AAKxB;;;AAGG;AACH,qBAAiB,IAAI;;AAKrB;AAIA;;;AAGG;AACH;yCA3BW,WAAW;6CAAX,WAAW;AA8DvB;;ACrFD;AACA,cAAa,cAAc,EAAE,WAAW;AAExC,iBAAgB,WAAW;AA8B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