@ojiepermana/angular 0.1.1 → 21.0.2
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/README.md +41 -249
- package/collection.json +25 -0
- package/fesm2022/ojiepermana-angular-chart.mjs +3714 -0
- package/fesm2022/ojiepermana-angular-chart.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component.mjs +3463 -0
- package/fesm2022/ojiepermana-angular-component.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-generator-api.mjs +67 -0
- package/fesm2022/ojiepermana-angular-generator-api.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-layout.mjs +296 -408
- package/fesm2022/ojiepermana-angular-layout.mjs.map +1 -1
- package/fesm2022/ojiepermana-angular-navigation.mjs +2198 -404
- package/fesm2022/ojiepermana-angular-navigation.mjs.map +1 -1
- package/fesm2022/ojiepermana-angular-theme.mjs +381 -1
- package/fesm2022/ojiepermana-angular-theme.mjs.map +1 -1
- package/fesm2022/ojiepermana-angular.mjs +16 -1
- package/fesm2022/ojiepermana-angular.mjs.map +1 -1
- package/generator/api/README.md +183 -0
- package/generator/api/bin/schematics/init/index.js +88 -0
- package/generator/api/bin/schematics/sdk/index.js +58 -0
- package/generator/api/bin/src/config/loader.js +41 -0
- package/generator/api/bin/src/config/schema.js +56 -0
- package/generator/api/bin/src/emit/client.js +246 -0
- package/generator/api/bin/src/emit/metadata.js +295 -0
- package/generator/api/bin/src/emit/models.js +106 -0
- package/generator/api/bin/src/emit/navigation.js +56 -0
- package/generator/api/bin/src/emit/operations.js +122 -0
- package/generator/api/bin/src/emit/public-api.js +54 -0
- package/generator/api/bin/src/emit/services.js +87 -0
- package/generator/api/bin/src/engine.js +65 -0
- package/generator/api/bin/src/layout/per-domain.js +346 -0
- package/generator/api/bin/src/parser/bundle.js +25 -0
- package/generator/api/bin/src/parser/ir.js +320 -0
- package/generator/api/bin/src/parser/types.js +7 -0
- package/generator/api/bin/src/render/template.js +58 -0
- package/generator/api/bin/src/writer/index.js +69 -0
- package/generator/api/schematics/init/schema.json +19 -0
- package/generator/api/schematics/sdk/schema.json +19 -0
- package/generator/api/sdk.config.example.json +22 -0
- package/generator/guide/README.md +84 -0
- package/generator/guide/bin/schematics/build/index.js +35 -0
- package/generator/guide/bin/schematics/init/index.js +70 -0
- package/generator/guide/bin/src/config/loader.js +50 -0
- package/generator/guide/bin/src/config/schema.js +12 -0
- package/generator/guide/bin/src/engine/component.js +73 -0
- package/generator/guide/bin/src/engine/frontmatter.js +42 -0
- package/generator/guide/bin/src/engine/index.js +42 -0
- package/generator/guide/bin/src/engine/naming.js +39 -0
- package/generator/guide/bin/src/engine/render.js +18 -0
- package/generator/guide/bin/src/engine/routes.js +106 -0
- package/generator/guide/bin/src/engine/walk.js +35 -0
- package/generator/guide/guide.config.example.json +9 -0
- package/generator/guide/schematics/build/schema.json +14 -0
- package/generator/guide/schematics/init/schema.json +19 -0
- package/package.json +58 -38
- package/theme/styles/etos.css +38 -0
- package/theme/styles/index.css +32 -8
- package/theme/styles/themes/brand/etos/color.css +21 -0
- package/theme/styles/themes/brand/etos/style.css +50 -0
- package/theme/styles/themes/library/_components.css +63 -0
- package/theme/styles/themes/library/_layers.css +15 -0
- package/theme/styles/themes/library/_material-overrides.css +254 -0
- package/theme/styles/themes/library/_tokens.css +54 -0
- package/theme/styles/themes/library/color/amber.css +18 -0
- package/theme/styles/themes/library/color/blue.css +23 -0
- package/theme/styles/themes/library/color/green.css +18 -0
- package/theme/styles/themes/library/color/index.css +9 -0
- package/theme/styles/themes/library/color/purple.css +18 -0
- package/theme/styles/themes/library/color/red.css +18 -0
- package/theme/styles/themes/library/style/brutal.css +47 -0
- package/theme/styles/themes/library/style/default.css +51 -0
- package/theme/styles/themes/library/style/index.css +8 -0
- package/theme/styles/themes/library/style/sharp.css +47 -0
- package/theme/styles/themes/library/style/soft.css +47 -0
- package/theme/styles/themes/mode/dark.css +20 -0
- package/theme/styles/themes/mode/index.css +6 -0
- package/theme/styles/themes/mode/light.css +24 -0
- package/theme/styles/themes/taildwind.css +109 -0
- package/types/ojiepermana-angular-chart.d.ts +1094 -0
- package/types/ojiepermana-angular-component.d.ts +1174 -0
- package/types/ojiepermana-angular-generator-api.d.ts +85 -0
- package/types/ojiepermana-angular-layout.d.ts +125 -76
- package/types/ojiepermana-angular-navigation.d.ts +256 -116
- package/types/ojiepermana-angular-theme.d.ts +170 -1
- package/types/ojiepermana-angular.d.ts +2 -1
- package/fesm2022/ojiepermana-angular-internal.mjs +0 -489
- package/fesm2022/ojiepermana-angular-internal.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-navigation-horizontal.mjs +0 -721
- package/fesm2022/ojiepermana-angular-navigation-horizontal.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-navigation-vertical.mjs +0 -1647
- package/fesm2022/ojiepermana-angular-navigation-vertical.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-shell.mjs +0 -19
- package/fesm2022/ojiepermana-angular-shell.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-theme-component.mjs +0 -235
- package/fesm2022/ojiepermana-angular-theme-component.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-theme-directive.mjs +0 -29
- package/fesm2022/ojiepermana-angular-theme-directive.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-theme-service.mjs +0 -241
- package/fesm2022/ojiepermana-angular-theme-service.mjs.map +0 -1
- package/layout/README.md +0 -144
- package/layout/src/component/horizontal/horizontal.css +0 -130
- package/layout/src/component/vertical/vertical.css +0 -75
- package/layout/src/layout.css +0 -16
- package/navigation/README.md +0 -301
- package/navigation/horizontal/README.md +0 -49
- package/shell/README.md +0 -41
- package/styles/index.css +0 -2
- package/styles/resets.css +0 -22
- package/theme/README.md +0 -379
- package/theme/styles/adapters/material-ui/index.css +0 -205
- package/theme/styles/modes/dark.css +0 -84
- package/theme/styles/presets/colors/blue.css +0 -45
- package/theme/styles/presets/colors/brand.css +0 -52
- package/theme/styles/presets/colors/cyan.css +0 -45
- package/theme/styles/presets/colors/green.css +0 -45
- package/theme/styles/presets/colors/index.css +0 -7
- package/theme/styles/presets/colors/orange.css +0 -45
- package/theme/styles/presets/colors/purple.css +0 -45
- package/theme/styles/presets/colors/red.css +0 -45
- package/theme/styles/presets/styles/flat.css +0 -61
- package/theme/styles/presets/styles/glass.css +0 -28
- package/theme/styles/presets/styles/index.css +0 -2
- package/theme/styles/roles/index.css +0 -67
- package/theme/styles/tokens/foundation.css +0 -136
- package/theme/styles/tokens/semantic.css +0 -87
- package/theme/styles/utilities/index.css +0 -88
- package/types/ojiepermana-angular-internal.d.ts +0 -90
- package/types/ojiepermana-angular-navigation-horizontal.d.ts +0 -81
- package/types/ojiepermana-angular-navigation-vertical.d.ts +0 -262
- package/types/ojiepermana-angular-shell.d.ts +0 -14
- package/types/ojiepermana-angular-theme-component.d.ts +0 -46
- package/types/ojiepermana-angular-theme-directive.d.ts +0 -10
- package/types/ojiepermana-angular-theme-service.d.ts +0 -68
- /package/{navigation/vertical → chart}/README.md +0 -0
|
@@ -1,6 +1,386 @@
|
|
|
1
|
-
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken, inject, DestroyRef, signal, computed, effect, Injectable, makeEnvironmentProviders, provideEnvironmentInitializer } from '@angular/core';
|
|
3
|
+
import { DOCUMENT } from '@angular/common';
|
|
4
|
+
import { MAT_RIPPLE_GLOBAL_OPTIONS } from '@angular/material/core';
|
|
5
|
+
import { MAT_FORM_FIELD_DEFAULT_OPTIONS } from '@angular/material/form-field';
|
|
6
|
+
|
|
7
|
+
const MODES = ['light', 'dark'];
|
|
8
|
+
const COLOR_SCHEMES = ['light', 'dark', 'system'];
|
|
9
|
+
const COLORS = ['blue', 'red', 'green', 'purple', 'amber'];
|
|
10
|
+
const STYLES = ['default', 'sharp', 'brutal', 'soft'];
|
|
11
|
+
const BRANDS = ['etos'];
|
|
12
|
+
const MATERIAL_THEME_CONFIG = new InjectionToken('MATERIAL_THEME_CONFIG');
|
|
13
|
+
const DEFAULT_MATERIAL_THEME_CONFIG = {
|
|
14
|
+
defaultMode: 'light',
|
|
15
|
+
defaultBrand: null,
|
|
16
|
+
defaultColor: 'blue',
|
|
17
|
+
defaultStyle: 'default',
|
|
18
|
+
modeStorageKey: 'theme-mode',
|
|
19
|
+
brandStorageKey: 'theme-brand',
|
|
20
|
+
colorStorageKey: 'theme-color',
|
|
21
|
+
styleStorageKey: 'theme-style',
|
|
22
|
+
};
|
|
23
|
+
function isColorScheme(value) {
|
|
24
|
+
return COLOR_SCHEMES.some((scheme) => scheme === value);
|
|
25
|
+
}
|
|
26
|
+
function isThemeColor(value) {
|
|
27
|
+
return COLORS.some((color) => color === value);
|
|
28
|
+
}
|
|
29
|
+
function isThemeStyle(value) {
|
|
30
|
+
return STYLES.some((style) => style === value);
|
|
31
|
+
}
|
|
32
|
+
function isThemeBrand(value) {
|
|
33
|
+
return BRANDS.some((brand) => brand === value);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
class ThemeService {
|
|
37
|
+
document = inject(DOCUMENT);
|
|
38
|
+
destroyRef = inject(DestroyRef);
|
|
39
|
+
config = this.resolveConfig();
|
|
40
|
+
initialBrand = this.readPersistedBrand() ?? this.config.defaultBrand;
|
|
41
|
+
_modePreference = signal(this.readPersistedMode() ?? this.config.defaultMode, ...(ngDevMode ? [{ debugName: "_modePreference" }] : /* istanbul ignore next */ []));
|
|
42
|
+
_brand = signal(this.initialBrand, ...(ngDevMode ? [{ debugName: "_brand" }] : /* istanbul ignore next */ []));
|
|
43
|
+
_color = signal(this.initialBrand ? this.config.defaultColor : (this.readPersistedColor() ?? this.config.defaultColor), ...(ngDevMode ? [{ debugName: "_color" }] : /* istanbul ignore next */ []));
|
|
44
|
+
_style = signal(this.initialBrand ? this.config.defaultStyle : (this.readPersistedStyle() ?? this.config.defaultStyle), ...(ngDevMode ? [{ debugName: "_style" }] : /* istanbul ignore next */ []));
|
|
45
|
+
_systemPrefersDark = signal(this.prefersDark(), ...(ngDevMode ? [{ debugName: "_systemPrefersDark" }] : /* istanbul ignore next */ []));
|
|
46
|
+
scheme = this._modePreference.asReadonly();
|
|
47
|
+
brand = this._brand.asReadonly();
|
|
48
|
+
color = this._color.asReadonly();
|
|
49
|
+
theme = this._color.asReadonly();
|
|
50
|
+
style = this._style.asReadonly();
|
|
51
|
+
mode = computed(() => this.resolveMode(this._modePreference()), ...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
|
|
52
|
+
snapshot = computed(() => ({
|
|
53
|
+
mode: this.mode(),
|
|
54
|
+
brand: this._brand(),
|
|
55
|
+
color: this._color(),
|
|
56
|
+
style: this._style(),
|
|
57
|
+
}), ...(ngDevMode ? [{ debugName: "snapshot" }] : /* istanbul ignore next */ []));
|
|
58
|
+
isDark = computed(() => this.mode() === 'dark', ...(ngDevMode ? [{ debugName: "isDark" }] : /* istanbul ignore next */ []));
|
|
59
|
+
constructor() {
|
|
60
|
+
this.watchSystemScheme();
|
|
61
|
+
effect(() => {
|
|
62
|
+
const root = this.document.documentElement;
|
|
63
|
+
const mode = this.mode();
|
|
64
|
+
const brand = this._brand();
|
|
65
|
+
const color = this._color();
|
|
66
|
+
const style = this._style();
|
|
67
|
+
root.dataset['mode'] = mode;
|
|
68
|
+
root.dataset['theme'] = brand ?? color;
|
|
69
|
+
root.classList.toggle('dark', mode === 'dark');
|
|
70
|
+
this.persistMode(this._modePreference());
|
|
71
|
+
if (brand) {
|
|
72
|
+
root.setAttribute('theme-brand', brand);
|
|
73
|
+
root.removeAttribute('theme-color');
|
|
74
|
+
root.removeAttribute('theme-style');
|
|
75
|
+
delete root.dataset['color'];
|
|
76
|
+
delete root.dataset['style'];
|
|
77
|
+
this.persistBrand(brand);
|
|
78
|
+
this.clearPersistedColor();
|
|
79
|
+
this.clearPersistedStyle();
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
root.removeAttribute('theme-brand');
|
|
83
|
+
root.setAttribute('theme-color', color);
|
|
84
|
+
root.setAttribute('theme-style', style);
|
|
85
|
+
root.dataset['color'] = color;
|
|
86
|
+
root.dataset['style'] = style;
|
|
87
|
+
this.clearPersistedBrand();
|
|
88
|
+
this.persistColor(color);
|
|
89
|
+
this.persistStyle(style);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
setMode(mode) {
|
|
93
|
+
this._modePreference.set(mode);
|
|
94
|
+
}
|
|
95
|
+
setScheme(scheme) {
|
|
96
|
+
this._modePreference.set(scheme);
|
|
97
|
+
}
|
|
98
|
+
setBrand(brand) {
|
|
99
|
+
this._brand.set(brand);
|
|
100
|
+
this._color.set(this.config.defaultColor);
|
|
101
|
+
this._style.set(this.config.defaultStyle);
|
|
102
|
+
}
|
|
103
|
+
setColor(color) {
|
|
104
|
+
if (this._brand()) {
|
|
105
|
+
this._brand.set(null);
|
|
106
|
+
}
|
|
107
|
+
this._color.set(color);
|
|
108
|
+
}
|
|
109
|
+
setTheme(theme) {
|
|
110
|
+
if (isThemeColor(theme)) {
|
|
111
|
+
this.setColor(theme);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
setStyle(style) {
|
|
115
|
+
if (this._brand()) {
|
|
116
|
+
this._brand.set(null);
|
|
117
|
+
}
|
|
118
|
+
this._style.set(style);
|
|
119
|
+
}
|
|
120
|
+
setAll(config) {
|
|
121
|
+
if (config.scheme) {
|
|
122
|
+
this.setScheme(config.scheme);
|
|
123
|
+
}
|
|
124
|
+
if (config.mode) {
|
|
125
|
+
this.setMode(config.mode);
|
|
126
|
+
}
|
|
127
|
+
if (config.brand !== undefined) {
|
|
128
|
+
this.setBrand(config.brand);
|
|
129
|
+
}
|
|
130
|
+
if (config.brand === undefined || config.brand === null) {
|
|
131
|
+
if (config.color) {
|
|
132
|
+
this.setColor(config.color);
|
|
133
|
+
}
|
|
134
|
+
if (config.style) {
|
|
135
|
+
this.setStyle(config.style);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
toggleScheme() {
|
|
140
|
+
this.toggleMode();
|
|
141
|
+
}
|
|
142
|
+
toggleMode() {
|
|
143
|
+
this.setMode(this.mode() === 'dark' ? 'light' : 'dark');
|
|
144
|
+
}
|
|
145
|
+
reset() {
|
|
146
|
+
this._modePreference.set(this.config.defaultMode);
|
|
147
|
+
this._brand.set(this.config.defaultBrand);
|
|
148
|
+
this._color.set(this.config.defaultColor);
|
|
149
|
+
this._style.set(this.config.defaultStyle);
|
|
150
|
+
}
|
|
151
|
+
resolveConfig() {
|
|
152
|
+
const config = inject(MATERIAL_THEME_CONFIG, { optional: true }) ?? {};
|
|
153
|
+
const configuredMode = config.mode ?? config.defaultMode ?? config.defaultScheme;
|
|
154
|
+
const configuredBrand = config.brand ?? config['theme-brand'] ?? config.defaultBrand;
|
|
155
|
+
const configuredColor = config.color ?? config.defaultColor ?? config.defaultTheme;
|
|
156
|
+
const configuredStyle = config.style ?? config.defaultStyle;
|
|
157
|
+
const defaultMode = isColorScheme(configuredMode) ? configuredMode : DEFAULT_MATERIAL_THEME_CONFIG.defaultMode;
|
|
158
|
+
const defaultBrand = isThemeBrand(configuredBrand) ? configuredBrand : DEFAULT_MATERIAL_THEME_CONFIG.defaultBrand;
|
|
159
|
+
const defaultColor = isThemeColor(configuredColor) ? configuredColor : DEFAULT_MATERIAL_THEME_CONFIG.defaultColor;
|
|
160
|
+
const defaultStyle = isThemeStyle(configuredStyle) ? configuredStyle : DEFAULT_MATERIAL_THEME_CONFIG.defaultStyle;
|
|
161
|
+
return {
|
|
162
|
+
defaultMode,
|
|
163
|
+
defaultBrand,
|
|
164
|
+
defaultColor,
|
|
165
|
+
defaultStyle,
|
|
166
|
+
modeStorageKey: config.modeStorageKey ??
|
|
167
|
+
config.schemeStorageKey ??
|
|
168
|
+
config.storageKey ??
|
|
169
|
+
DEFAULT_MATERIAL_THEME_CONFIG.modeStorageKey,
|
|
170
|
+
brandStorageKey: config.brandStorageKey ?? DEFAULT_MATERIAL_THEME_CONFIG.brandStorageKey,
|
|
171
|
+
colorStorageKey: config.colorStorageKey ?? config.themeStorageKey ?? DEFAULT_MATERIAL_THEME_CONFIG.colorStorageKey,
|
|
172
|
+
styleStorageKey: config.styleStorageKey ?? DEFAULT_MATERIAL_THEME_CONFIG.styleStorageKey,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
resolveMode(mode) {
|
|
176
|
+
return mode === 'system' ? (this._systemPrefersDark() ? 'dark' : 'light') : mode;
|
|
177
|
+
}
|
|
178
|
+
prefersDark() {
|
|
179
|
+
const mql = this.document.defaultView?.matchMedia?.('(prefers-color-scheme: dark)');
|
|
180
|
+
return !!mql?.matches;
|
|
181
|
+
}
|
|
182
|
+
watchSystemScheme() {
|
|
183
|
+
const mql = this.document.defaultView?.matchMedia?.('(prefers-color-scheme: dark)');
|
|
184
|
+
if (!mql)
|
|
185
|
+
return;
|
|
186
|
+
const listener = (event) => {
|
|
187
|
+
this._systemPrefersDark.set(event.matches);
|
|
188
|
+
};
|
|
189
|
+
mql.addEventListener('change', listener);
|
|
190
|
+
this.destroyRef.onDestroy(() => mql.removeEventListener('change', listener));
|
|
191
|
+
}
|
|
192
|
+
readPersistedMode() {
|
|
193
|
+
const key = this.config.modeStorageKey;
|
|
194
|
+
if (!key)
|
|
195
|
+
return null;
|
|
196
|
+
try {
|
|
197
|
+
const value = this.document.defaultView?.localStorage?.getItem(key);
|
|
198
|
+
return isColorScheme(value) ? value : null;
|
|
199
|
+
}
|
|
200
|
+
catch {
|
|
201
|
+
return null;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
readPersistedBrand() {
|
|
205
|
+
const key = this.config.brandStorageKey;
|
|
206
|
+
if (!key)
|
|
207
|
+
return null;
|
|
208
|
+
try {
|
|
209
|
+
const value = this.document.defaultView?.localStorage?.getItem(key);
|
|
210
|
+
return isThemeBrand(value) ? value : null;
|
|
211
|
+
}
|
|
212
|
+
catch {
|
|
213
|
+
return null;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
readPersistedColor() {
|
|
217
|
+
const key = this.config.colorStorageKey;
|
|
218
|
+
if (!key)
|
|
219
|
+
return null;
|
|
220
|
+
try {
|
|
221
|
+
const value = this.document.defaultView?.localStorage?.getItem(key);
|
|
222
|
+
return isThemeColor(value) ? value : null;
|
|
223
|
+
}
|
|
224
|
+
catch {
|
|
225
|
+
return null;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
readPersistedStyle() {
|
|
229
|
+
const key = this.config.styleStorageKey;
|
|
230
|
+
if (!key)
|
|
231
|
+
return null;
|
|
232
|
+
try {
|
|
233
|
+
const value = this.document.defaultView?.localStorage?.getItem(key);
|
|
234
|
+
return isThemeStyle(value) ? value : null;
|
|
235
|
+
}
|
|
236
|
+
catch {
|
|
237
|
+
return null;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
persistMode(mode) {
|
|
241
|
+
const key = this.config.modeStorageKey;
|
|
242
|
+
if (!key)
|
|
243
|
+
return;
|
|
244
|
+
try {
|
|
245
|
+
this.document.defaultView?.localStorage?.setItem(key, mode);
|
|
246
|
+
}
|
|
247
|
+
catch {
|
|
248
|
+
/* ignore */
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
persistBrand(brand) {
|
|
252
|
+
const key = this.config.brandStorageKey;
|
|
253
|
+
if (!key)
|
|
254
|
+
return;
|
|
255
|
+
try {
|
|
256
|
+
this.document.defaultView?.localStorage?.setItem(key, brand);
|
|
257
|
+
}
|
|
258
|
+
catch {
|
|
259
|
+
/* ignore */
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
persistColor(color) {
|
|
263
|
+
const key = this.config.colorStorageKey;
|
|
264
|
+
if (!key)
|
|
265
|
+
return;
|
|
266
|
+
try {
|
|
267
|
+
this.document.defaultView?.localStorage?.setItem(key, color);
|
|
268
|
+
}
|
|
269
|
+
catch {
|
|
270
|
+
/* ignore */
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
persistStyle(style) {
|
|
274
|
+
const key = this.config.styleStorageKey;
|
|
275
|
+
if (!key)
|
|
276
|
+
return;
|
|
277
|
+
try {
|
|
278
|
+
this.document.defaultView?.localStorage?.setItem(key, style);
|
|
279
|
+
}
|
|
280
|
+
catch {
|
|
281
|
+
/* ignore */
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
clearPersistedBrand() {
|
|
285
|
+
this.clearPersistedItem(this.config.brandStorageKey);
|
|
286
|
+
}
|
|
287
|
+
clearPersistedColor() {
|
|
288
|
+
this.clearPersistedItem(this.config.colorStorageKey);
|
|
289
|
+
}
|
|
290
|
+
clearPersistedStyle() {
|
|
291
|
+
this.clearPersistedItem(this.config.styleStorageKey);
|
|
292
|
+
}
|
|
293
|
+
clearPersistedItem(key) {
|
|
294
|
+
if (!key)
|
|
295
|
+
return;
|
|
296
|
+
try {
|
|
297
|
+
this.document.defaultView?.localStorage?.removeItem(key);
|
|
298
|
+
}
|
|
299
|
+
catch {
|
|
300
|
+
/* ignore */
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: ThemeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
304
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: ThemeService, providedIn: 'root' });
|
|
305
|
+
}
|
|
306
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: ThemeService, decorators: [{
|
|
307
|
+
type: Injectable,
|
|
308
|
+
args: [{ providedIn: 'root' }]
|
|
309
|
+
}], ctorParameters: () => [] });
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Bootstrap the shared theme for any `@ojiepermana/angular/*` entry point.
|
|
313
|
+
*
|
|
314
|
+
* By default wires up the theme config token and eagerly initializes `ThemeService`
|
|
315
|
+
* so root theme attributes are applied during bootstrap. Opt in
|
|
316
|
+
* to Angular Material defaults (ripple / form-field) via
|
|
317
|
+
* {@link withMaterialDefaults}.
|
|
318
|
+
* Supports shorthand `mode`, `color`, and `style` config keys.
|
|
319
|
+
*
|
|
320
|
+
* @example
|
|
321
|
+
* export const appConfig: ApplicationConfig = {
|
|
322
|
+
* providers: [
|
|
323
|
+
* provideAnimations(),
|
|
324
|
+
* provideMaterialTheme(
|
|
325
|
+
* {
|
|
326
|
+
* mode: 'system',
|
|
327
|
+
* color: 'blue',
|
|
328
|
+
* style: 'soft',
|
|
329
|
+
* },
|
|
330
|
+
* withMaterialDefaults(),
|
|
331
|
+
* ),
|
|
332
|
+
* ],
|
|
333
|
+
* };
|
|
334
|
+
*/
|
|
335
|
+
function provideMaterialTheme(config = {}, ...features) {
|
|
336
|
+
return makeEnvironmentProviders([
|
|
337
|
+
{ provide: MATERIAL_THEME_CONFIG, useValue: config },
|
|
338
|
+
provideEnvironmentInitializer(() => {
|
|
339
|
+
inject(ThemeService);
|
|
340
|
+
}),
|
|
341
|
+
...features.flatMap((f) => f.providers),
|
|
342
|
+
]);
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Opt-in Angular Material defaults tuned for the shared theme layer:
|
|
346
|
+
*
|
|
347
|
+
* - Disables the global Material ripple.
|
|
348
|
+
* - Forces `appearance: 'outline'` + `subscriptSizing: 'dynamic'` on every
|
|
349
|
+
* `mat-form-field`.
|
|
350
|
+
*
|
|
351
|
+
* Only apply when your app actually renders Angular Material components.
|
|
352
|
+
*/
|
|
353
|
+
function withMaterialDefaults() {
|
|
354
|
+
return {
|
|
355
|
+
providers: [
|
|
356
|
+
{ provide: MAT_RIPPLE_GLOBAL_OPTIONS, useValue: { disabled: true } },
|
|
357
|
+
{
|
|
358
|
+
provide: MAT_FORM_FIELD_DEFAULT_OPTIONS,
|
|
359
|
+
useValue: { appearance: 'outline', subscriptSizing: 'dynamic' },
|
|
360
|
+
},
|
|
361
|
+
],
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/*
|
|
366
|
+
* Public API Surface of @ojiepermana/angular/theme
|
|
367
|
+
*
|
|
368
|
+
* The single source of truth for 3-layer design tokens, CSS variables,
|
|
369
|
+
* and the `ThemeService` shared by every `@ojiepermana/angular/*` subpath
|
|
370
|
+
* (shadcn, layout, navigation, ...).
|
|
371
|
+
*
|
|
372
|
+
* Usage:
|
|
373
|
+
* // app.config.ts
|
|
374
|
+
* import { provideMaterialTheme } from '@ojiepermana/angular/theme';
|
|
375
|
+
*
|
|
376
|
+
* // styles.css
|
|
377
|
+
* @import '@ojiepermana/angular/theme/styles';
|
|
378
|
+
* @import 'tailwindcss';
|
|
379
|
+
*/
|
|
2
380
|
|
|
3
381
|
/**
|
|
4
382
|
* Generated bundle index. Do not edit.
|
|
5
383
|
*/
|
|
384
|
+
|
|
385
|
+
export { BRANDS, COLORS, COLOR_SCHEMES, DEFAULT_MATERIAL_THEME_CONFIG, MATERIAL_THEME_CONFIG, MODES, STYLES, ThemeService, isColorScheme, isThemeBrand, isThemeColor, isThemeStyle, provideMaterialTheme, withMaterialDefaults };
|
|
6
386
|
//# sourceMappingURL=ojiepermana-angular-theme.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ojiepermana-angular-theme.mjs","sources":["../../../projects/library/theme/public-api.ts","../../../projects/library/theme/ojiepermana-angular-theme.ts"],"sourcesContent":["/* Domain namespace marker for nested theme entry points. */\n\nexport {};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":"AAAA;;ACAA;;AAEG"}
|
|
1
|
+
{"version":3,"file":"ojiepermana-angular-theme.mjs","sources":["../../../projects/angular/theme/src/lib/core/theme.tokens.ts","../../../projects/angular/theme/src/lib/core/theme.service.ts","../../../projects/angular/theme/src/lib/core/theme.provider.ts","../../../projects/angular/theme/public-api.ts","../../../projects/angular/theme/ojiepermana-angular-theme.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nexport const MODES = ['light', 'dark'] as const;\n\nexport type ThemeMode = (typeof MODES)[number];\n\nexport const COLOR_SCHEMES = ['light', 'dark', 'system'] as const;\n\nexport type ColorScheme = (typeof COLOR_SCHEMES)[number];\n\nexport const COLORS = ['blue', 'red', 'green', 'purple', 'amber'] as const;\n\nexport type ThemeColor = (typeof COLORS)[number];\n\nexport const STYLES = ['default', 'sharp', 'brutal', 'soft'] as const;\n\nexport type ThemeStyle = (typeof STYLES)[number];\n\nexport const BRANDS = ['etos'] as const;\n\nexport type ThemeBrand = (typeof BRANDS)[number];\n\nexport interface ThemeConfig {\n readonly mode: ThemeMode;\n readonly brand: ThemeBrand | null;\n readonly color: ThemeColor;\n readonly style: ThemeStyle;\n}\n\nexport interface MaterialThemeConfig {\n /** Initial mode preference. Supports `system` for first-visit OS detection. */\n readonly mode?: ColorScheme;\n /** Initial brand bundle. When set, it replaces the explicit color and style layers. */\n readonly brand?: ThemeBrand | null;\n /** Alias for `brand` to match the persisted `theme-brand` setting. */\n readonly 'theme-brand'?: ThemeBrand | null;\n /** Initial brand color layer. */\n readonly color?: ThemeColor;\n /** Initial style personality layer. */\n readonly style?: ThemeStyle;\n /** @deprecated Use `mode` instead. */\n readonly defaultMode?: ColorScheme;\n /** Default brand bundle. When set, it replaces the explicit color and style layers. */\n readonly defaultBrand?: ThemeBrand | null;\n /** @deprecated Use `color` instead. */\n readonly defaultColor?: ThemeColor;\n /** @deprecated Use `style` instead. */\n readonly defaultStyle?: ThemeStyle;\n /** @deprecated Use `defaultMode` instead. */\n readonly defaultScheme?: ColorScheme;\n /** @deprecated Use `defaultColor` instead. */\n readonly defaultTheme?: ThemeColor | string;\n /** @deprecated Use `modeStorageKey` instead. */\n readonly storageKey?: string | null;\n /** @deprecated Use `modeStorageKey` instead. */\n readonly schemeStorageKey?: string | null;\n /** @deprecated Use `colorStorageKey` instead. */\n readonly themeStorageKey?: string | null;\n /** localStorage key used to persist the mode preference. Set to `null` to disable persistence. */\n readonly modeStorageKey?: string | null;\n /** localStorage key used to persist the brand bundle. Set to `null` to disable persistence. */\n readonly brandStorageKey?: string | null;\n /** localStorage key used to persist the color layer. Set to `null` to disable persistence. */\n readonly colorStorageKey?: string | null;\n /** localStorage key used to persist the style layer. Set to `null` to disable persistence. */\n readonly styleStorageKey?: string | null;\n}\n\nexport interface ResolvedMaterialThemeConfig {\n readonly defaultMode: ColorScheme;\n readonly defaultBrand: ThemeBrand | null;\n readonly defaultColor: ThemeColor;\n readonly defaultStyle: ThemeStyle;\n readonly modeStorageKey: string | null;\n readonly brandStorageKey: string | null;\n readonly colorStorageKey: string | null;\n readonly styleStorageKey: string | null;\n}\n\nexport const MATERIAL_THEME_CONFIG = new InjectionToken<MaterialThemeConfig>('MATERIAL_THEME_CONFIG');\n\nexport const DEFAULT_MATERIAL_THEME_CONFIG: ResolvedMaterialThemeConfig = {\n defaultMode: 'light',\n defaultBrand: null,\n defaultColor: 'blue',\n defaultStyle: 'default',\n modeStorageKey: 'theme-mode',\n brandStorageKey: 'theme-brand',\n colorStorageKey: 'theme-color',\n styleStorageKey: 'theme-style',\n};\n\nexport function isColorScheme(value: string | null | undefined): value is ColorScheme {\n return COLOR_SCHEMES.some((scheme) => scheme === value);\n}\n\nexport function isThemeColor(value: string | null | undefined): value is ThemeColor {\n return COLORS.some((color) => color === value);\n}\n\nexport function isThemeStyle(value: string | null | undefined): value is ThemeStyle {\n return STYLES.some((style) => style === value);\n}\n\nexport function isThemeBrand(value: string | null | undefined): value is ThemeBrand {\n return BRANDS.some((brand) => brand === value);\n}\n","import { DOCUMENT } from '@angular/common';\nimport { DestroyRef, Injectable, computed, effect, inject, signal } from '@angular/core';\nimport {\n COLOR_SCHEMES,\n DEFAULT_MATERIAL_THEME_CONFIG,\n MATERIAL_THEME_CONFIG,\n type ColorScheme,\n type ResolvedMaterialThemeConfig,\n type ThemeBrand,\n type ThemeColor,\n type ThemeConfig,\n type ThemeMode,\n type ThemeStyle,\n isThemeBrand,\n isColorScheme,\n isThemeColor,\n isThemeStyle,\n} from './theme.tokens';\n\n@Injectable({ providedIn: 'root' })\nexport class ThemeService {\n private readonly document = inject(DOCUMENT);\n private readonly destroyRef = inject(DestroyRef);\n private readonly config = this.resolveConfig();\n private readonly initialBrand = this.readPersistedBrand() ?? this.config.defaultBrand;\n\n private readonly _modePreference = signal<ColorScheme>(this.readPersistedMode() ?? this.config.defaultMode);\n private readonly _brand = signal<ThemeBrand | null>(this.initialBrand);\n private readonly _color = signal<ThemeColor>(\n this.initialBrand ? this.config.defaultColor : (this.readPersistedColor() ?? this.config.defaultColor),\n );\n private readonly _style = signal<ThemeStyle>(\n this.initialBrand ? this.config.defaultStyle : (this.readPersistedStyle() ?? this.config.defaultStyle),\n );\n private readonly _systemPrefersDark = signal<boolean>(this.prefersDark());\n\n readonly scheme = this._modePreference.asReadonly();\n readonly brand = this._brand.asReadonly();\n readonly color = this._color.asReadonly();\n readonly theme = this._color.asReadonly();\n readonly style = this._style.asReadonly();\n readonly mode = computed<ThemeMode>(() => this.resolveMode(this._modePreference()));\n readonly snapshot = computed<ThemeConfig>(() => ({\n mode: this.mode(),\n brand: this._brand(),\n color: this._color(),\n style: this._style(),\n }));\n\n readonly isDark = computed(() => this.mode() === 'dark');\n\n constructor() {\n this.watchSystemScheme();\n\n effect(() => {\n const root = this.document.documentElement;\n const mode = this.mode();\n const brand = this._brand();\n const color = this._color();\n const style = this._style();\n\n root.dataset['mode'] = mode;\n root.dataset['theme'] = brand ?? color;\n root.classList.toggle('dark', mode === 'dark');\n\n this.persistMode(this._modePreference());\n\n if (brand) {\n root.setAttribute('theme-brand', brand);\n root.removeAttribute('theme-color');\n root.removeAttribute('theme-style');\n delete root.dataset['color'];\n delete root.dataset['style'];\n\n this.persistBrand(brand);\n this.clearPersistedColor();\n this.clearPersistedStyle();\n return;\n }\n\n root.removeAttribute('theme-brand');\n root.setAttribute('theme-color', color);\n root.setAttribute('theme-style', style);\n root.dataset['color'] = color;\n root.dataset['style'] = style;\n\n this.clearPersistedBrand();\n this.persistColor(color);\n this.persistStyle(style);\n });\n }\n\n setMode(mode: ThemeMode): void {\n this._modePreference.set(mode);\n }\n\n setScheme(scheme: ColorScheme): void {\n this._modePreference.set(scheme);\n }\n\n setBrand(brand: ThemeBrand | null): void {\n this._brand.set(brand);\n this._color.set(this.config.defaultColor);\n this._style.set(this.config.defaultStyle);\n }\n\n setColor(color: ThemeColor): void {\n if (this._brand()) {\n this._brand.set(null);\n }\n this._color.set(color);\n }\n\n setTheme(theme: ThemeColor | string): void {\n if (isThemeColor(theme)) {\n this.setColor(theme);\n }\n }\n\n setStyle(style: ThemeStyle): void {\n if (this._brand()) {\n this._brand.set(null);\n }\n this._style.set(style);\n }\n\n setAll(config: Partial<ThemeConfig> & { readonly scheme?: ColorScheme }): void {\n if (config.scheme) {\n this.setScheme(config.scheme);\n }\n if (config.mode) {\n this.setMode(config.mode);\n }\n if (config.brand !== undefined) {\n this.setBrand(config.brand);\n }\n if (config.brand === undefined || config.brand === null) {\n if (config.color) {\n this.setColor(config.color);\n }\n if (config.style) {\n this.setStyle(config.style);\n }\n }\n }\n\n toggleScheme(): void {\n this.toggleMode();\n }\n\n toggleMode(): void {\n this.setMode(this.mode() === 'dark' ? 'light' : 'dark');\n }\n\n reset(): void {\n this._modePreference.set(this.config.defaultMode);\n this._brand.set(this.config.defaultBrand);\n this._color.set(this.config.defaultColor);\n this._style.set(this.config.defaultStyle);\n }\n\n private resolveConfig(): ResolvedMaterialThemeConfig {\n const config = inject(MATERIAL_THEME_CONFIG, { optional: true }) ?? {};\n const configuredMode = config.mode ?? config.defaultMode ?? config.defaultScheme;\n const configuredBrand = config.brand ?? config['theme-brand'] ?? config.defaultBrand;\n const configuredColor = config.color ?? config.defaultColor ?? config.defaultTheme;\n const configuredStyle = config.style ?? config.defaultStyle;\n\n const defaultMode = isColorScheme(configuredMode) ? configuredMode : DEFAULT_MATERIAL_THEME_CONFIG.defaultMode;\n const defaultBrand = isThemeBrand(configuredBrand) ? configuredBrand : DEFAULT_MATERIAL_THEME_CONFIG.defaultBrand;\n const defaultColor = isThemeColor(configuredColor) ? configuredColor : DEFAULT_MATERIAL_THEME_CONFIG.defaultColor;\n const defaultStyle = isThemeStyle(configuredStyle) ? configuredStyle : DEFAULT_MATERIAL_THEME_CONFIG.defaultStyle;\n\n return {\n defaultMode,\n defaultBrand,\n defaultColor,\n defaultStyle,\n modeStorageKey:\n config.modeStorageKey ??\n config.schemeStorageKey ??\n config.storageKey ??\n DEFAULT_MATERIAL_THEME_CONFIG.modeStorageKey,\n brandStorageKey: config.brandStorageKey ?? DEFAULT_MATERIAL_THEME_CONFIG.brandStorageKey,\n colorStorageKey:\n config.colorStorageKey ?? config.themeStorageKey ?? DEFAULT_MATERIAL_THEME_CONFIG.colorStorageKey,\n styleStorageKey: config.styleStorageKey ?? DEFAULT_MATERIAL_THEME_CONFIG.styleStorageKey,\n };\n }\n\n private resolveMode(mode: ColorScheme): ThemeMode {\n return mode === 'system' ? (this._systemPrefersDark() ? 'dark' : 'light') : mode;\n }\n\n private prefersDark(): boolean {\n const mql = this.document.defaultView?.matchMedia?.('(prefers-color-scheme: dark)');\n return !!mql?.matches;\n }\n\n private watchSystemScheme(): void {\n const mql = this.document.defaultView?.matchMedia?.('(prefers-color-scheme: dark)');\n if (!mql) return;\n\n const listener = (event: MediaQueryListEvent): void => {\n this._systemPrefersDark.set(event.matches);\n };\n mql.addEventListener('change', listener);\n this.destroyRef.onDestroy(() => mql.removeEventListener('change', listener));\n }\n\n private readPersistedMode(): ColorScheme | null {\n const key = this.config.modeStorageKey;\n if (!key) return null;\n try {\n const value = this.document.defaultView?.localStorage?.getItem(key);\n return isColorScheme(value) ? value : null;\n } catch {\n return null;\n }\n }\n\n private readPersistedBrand(): ThemeBrand | null {\n const key = this.config.brandStorageKey;\n if (!key) return null;\n try {\n const value = this.document.defaultView?.localStorage?.getItem(key);\n return isThemeBrand(value) ? value : null;\n } catch {\n return null;\n }\n }\n\n private readPersistedColor(): ThemeColor | null {\n const key = this.config.colorStorageKey;\n if (!key) return null;\n try {\n const value = this.document.defaultView?.localStorage?.getItem(key);\n return isThemeColor(value) ? value : null;\n } catch {\n return null;\n }\n }\n\n private readPersistedStyle(): ThemeStyle | null {\n const key = this.config.styleStorageKey;\n if (!key) return null;\n try {\n const value = this.document.defaultView?.localStorage?.getItem(key);\n return isThemeStyle(value) ? value : null;\n } catch {\n return null;\n }\n }\n\n private persistMode(mode: ColorScheme): void {\n const key = this.config.modeStorageKey;\n if (!key) return;\n try {\n this.document.defaultView?.localStorage?.setItem(key, mode);\n } catch {\n /* ignore */\n }\n }\n\n private persistBrand(brand: ThemeBrand): void {\n const key = this.config.brandStorageKey;\n if (!key) return;\n try {\n this.document.defaultView?.localStorage?.setItem(key, brand);\n } catch {\n /* ignore */\n }\n }\n\n private persistColor(color: ThemeColor): void {\n const key = this.config.colorStorageKey;\n if (!key) return;\n try {\n this.document.defaultView?.localStorage?.setItem(key, color);\n } catch {\n /* ignore */\n }\n }\n\n private persistStyle(style: ThemeStyle): void {\n const key = this.config.styleStorageKey;\n if (!key) return;\n try {\n this.document.defaultView?.localStorage?.setItem(key, style);\n } catch {\n /* ignore */\n }\n }\n\n private clearPersistedBrand(): void {\n this.clearPersistedItem(this.config.brandStorageKey);\n }\n\n private clearPersistedColor(): void {\n this.clearPersistedItem(this.config.colorStorageKey);\n }\n\n private clearPersistedStyle(): void {\n this.clearPersistedItem(this.config.styleStorageKey);\n }\n\n private clearPersistedItem(key: string | null): void {\n if (!key) return;\n try {\n this.document.defaultView?.localStorage?.removeItem(key);\n } catch {\n /* ignore */\n }\n }\n}\n","import {\n inject,\n type EnvironmentProviders,\n type Provider,\n makeEnvironmentProviders,\n provideEnvironmentInitializer,\n} from '@angular/core';\nimport { MAT_RIPPLE_GLOBAL_OPTIONS } from '@angular/material/core';\nimport { MAT_FORM_FIELD_DEFAULT_OPTIONS } from '@angular/material/form-field';\nimport { ThemeService } from './theme.service';\nimport { MATERIAL_THEME_CONFIG, type MaterialThemeConfig } from './theme.tokens';\n\n/**\n * Opaque feature unit consumed by {@link provideMaterialTheme}. Mirrors\n * Angular's router/http feature pattern so add-ons can be composed without\n * widening the primary provider signature.\n */\nexport interface MaterialThemeFeature {\n readonly providers: Provider[];\n}\n\n/**\n * Bootstrap the shared theme for any `@ojiepermana/angular/*` entry point.\n *\n * By default wires up the theme config token and eagerly initializes `ThemeService`\n * so root theme attributes are applied during bootstrap. Opt in\n * to Angular Material defaults (ripple / form-field) via\n * {@link withMaterialDefaults}.\n * Supports shorthand `mode`, `color`, and `style` config keys.\n *\n * @example\n * export const appConfig: ApplicationConfig = {\n * providers: [\n * provideAnimations(),\n * provideMaterialTheme(\n * {\n * mode: 'system',\n * color: 'blue',\n * style: 'soft',\n * },\n * withMaterialDefaults(),\n * ),\n * ],\n * };\n */\nexport function provideMaterialTheme(\n config: MaterialThemeConfig = {},\n ...features: MaterialThemeFeature[]\n): EnvironmentProviders {\n return makeEnvironmentProviders([\n { provide: MATERIAL_THEME_CONFIG, useValue: config },\n provideEnvironmentInitializer(() => {\n inject(ThemeService);\n }),\n ...features.flatMap((f) => f.providers),\n ]);\n}\n\n/**\n * Opt-in Angular Material defaults tuned for the shared theme layer:\n *\n * - Disables the global Material ripple.\n * - Forces `appearance: 'outline'` + `subscriptSizing: 'dynamic'` on every\n * `mat-form-field`.\n *\n * Only apply when your app actually renders Angular Material components.\n */\nexport function withMaterialDefaults(): MaterialThemeFeature {\n return {\n providers: [\n { provide: MAT_RIPPLE_GLOBAL_OPTIONS, useValue: { disabled: true } },\n {\n provide: MAT_FORM_FIELD_DEFAULT_OPTIONS,\n useValue: { appearance: 'outline', subscriptSizing: 'dynamic' },\n },\n ],\n };\n}\n","/*\n * Public API Surface of @ojiepermana/angular/theme\n *\n * The single source of truth for 3-layer design tokens, CSS variables,\n * and the `ThemeService` shared by every `@ojiepermana/angular/*` subpath\n * (shadcn, layout, navigation, ...).\n *\n * Usage:\n * // app.config.ts\n * import { provideMaterialTheme } from '@ojiepermana/angular/theme';\n *\n * // styles.css\n * @import '@ojiepermana/angular/theme/styles';\n * @import 'tailwindcss';\n */\n\nexport * from './src/lib/core/theme.tokens';\nexport * from './src/lib/core/theme.service';\nexport * from './src/lib/core/theme.provider';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;MAEa,KAAK,GAAG,CAAC,OAAO,EAAE,MAAM;AAI9B,MAAM,aAAa,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ;AAIhD,MAAM,MAAM,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO;AAIzD,MAAM,MAAM,GAAG,CAAC,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM;AAIpD,MAAM,MAAM,GAAG,CAAC,MAAM;MA6DhB,qBAAqB,GAAG,IAAI,cAAc,CAAsB,uBAAuB;AAE7F,MAAM,6BAA6B,GAAgC;AACxE,IAAA,WAAW,EAAE,OAAO;AACpB,IAAA,YAAY,EAAE,IAAI;AAClB,IAAA,YAAY,EAAE,MAAM;AACpB,IAAA,YAAY,EAAE,SAAS;AACvB,IAAA,cAAc,EAAE,YAAY;AAC5B,IAAA,eAAe,EAAE,aAAa;AAC9B,IAAA,eAAe,EAAE,aAAa;AAC9B,IAAA,eAAe,EAAE,aAAa;;AAG1B,SAAU,aAAa,CAAC,KAAgC,EAAA;AAC5D,IAAA,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,MAAM,KAAK,KAAK,CAAC;AACzD;AAEM,SAAU,YAAY,CAAC,KAAgC,EAAA;AAC3D,IAAA,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,KAAK,KAAK,KAAK,KAAK,CAAC;AAChD;AAEM,SAAU,YAAY,CAAC,KAAgC,EAAA;AAC3D,IAAA,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,KAAK,KAAK,KAAK,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MAAM,EAAE;;;ACElC;;;;;;;;;;;;;;;;;;;;;;;AAuBG;SACa,oBAAoB,CAClC,SAA8B,EAAE,EAChC,GAAG,QAAgC,EAAA;AAEnC,IAAA,OAAO,wBAAwB,CAAC;AAC9B,QAAA,EAAE,OAAO,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,EAAE;QACpD,6BAA6B,CAAC,MAAK;YACjC,MAAM,CAAC,YAAY,CAAC;AACtB,QAAA,CAAC,CAAC;AACF,QAAA,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC;AACxC,KAAA,CAAC;AACJ;AAEA;;;;;;;;AAQG;SACa,oBAAoB,GAAA;IAClC,OAAO;AACL,QAAA,SAAS,EAAE;YACT,EAAE,OAAO,EAAE,yBAAyB,EAAE,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE;AACpE,YAAA;AACE,gBAAA,OAAO,EAAE,8BAA8B;gBACvC,QAAQ,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,SAAS,EAAE;AAChE,aAAA;AACF,SAAA;KACF;AACH;;AC7EA;;;;;;;;;;;;;;AAcG;;ACdH;;AAEG;;;;"}
|
|
@@ -1,6 +1,21 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/*
|
|
2
|
+
* Public API Surface of @ojiepermana/angular (primary entry)
|
|
3
|
+
*
|
|
4
|
+
* Components and utilities are shipped via subpath entries:
|
|
5
|
+
* - `@ojiepermana/angular/theme` — design tokens, CSS variables, `ThemeService`, `provideMaterialTheme`
|
|
6
|
+
* - `@ojiepermana/angular/component` — shadcn/ui primitives on top of Material M3
|
|
7
|
+
* - `@ojiepermana/angular/layout` — layout primitives (WIP)
|
|
8
|
+
* - `@ojiepermana/angular/navigation` — navigation primitives (WIP)
|
|
9
|
+
* - `@ojiepermana/angular/chart` — chart primitives (WIP)
|
|
10
|
+
* - `@ojiepermana/angular/generator/api` — OpenAPI → Angular SDK generator (schematics + config types)
|
|
11
|
+
*
|
|
12
|
+
* Consumers should import from the subpaths directly.
|
|
13
|
+
*/
|
|
14
|
+
const MATERIAL_VERSION = '0.0.1';
|
|
2
15
|
|
|
3
16
|
/**
|
|
4
17
|
* Generated bundle index. Do not edit.
|
|
5
18
|
*/
|
|
19
|
+
|
|
20
|
+
export { MATERIAL_VERSION };
|
|
6
21
|
//# sourceMappingURL=ojiepermana-angular.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ojiepermana-angular.mjs","sources":["../../../projects/
|
|
1
|
+
{"version":3,"file":"ojiepermana-angular.mjs","sources":["../../../projects/angular/public-api.ts","../../../projects/angular/ojiepermana-angular.ts"],"sourcesContent":["/*\n * Public API Surface of @ojiepermana/angular (primary entry)\n *\n * Components and utilities are shipped via subpath entries:\n * - `@ojiepermana/angular/theme` — design tokens, CSS variables, `ThemeService`, `provideMaterialTheme`\n * - `@ojiepermana/angular/component` — shadcn/ui primitives on top of Material M3\n * - `@ojiepermana/angular/layout` — layout primitives (WIP)\n * - `@ojiepermana/angular/navigation` — navigation primitives (WIP)\n * - `@ojiepermana/angular/chart` — chart primitives (WIP)\n * - `@ojiepermana/angular/generator/api` — OpenAPI → Angular SDK generator (schematics + config types)\n *\n * Consumers should import from the subpaths directly.\n */\n\nexport const MATERIAL_VERSION = '0.0.1';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":"AAAA;;;;;;;;;;;;AAYG;AAEI,MAAM,gBAAgB,GAAG;;ACdhC;;AAEG;;;;"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
# SDK Generator
|
|
2
|
+
|
|
3
|
+
OpenAPI → Angular SDK generator shipped as the secondary entrypoint
|
|
4
|
+
`@ojiepermana/angular/generator/api`.
|
|
5
|
+
|
|
6
|
+
It generates a **lightweight Angular SDK** from any OpenAPI 3.x spec (including
|
|
7
|
+
3.2.0): typed `HttpClient` services, tree-shakeable fn modules, optional
|
|
8
|
+
metadata (permissions / validators), and a navigation tree.
|
|
9
|
+
|
|
10
|
+
## Local development in this repo
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
# 1. Build the schematic runtime
|
|
14
|
+
bun run gen:sdk:build
|
|
15
|
+
|
|
16
|
+
# 2. Scaffold a workspace config
|
|
17
|
+
bun run gen:sdk:init
|
|
18
|
+
|
|
19
|
+
# 3. Edit sdk.config.json, then generate
|
|
20
|
+
bun run gen:sdk
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Consumer usage after publish
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# inside an Angular workspace that installed @ojiepermana/angular
|
|
27
|
+
ng generate @ojiepermana/angular:sdk-init
|
|
28
|
+
ng generate @ojiepermana/angular:sdk
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Schematics
|
|
32
|
+
|
|
33
|
+
The entrypoint exposes two schematics, registered in the parent collection at [`projects/angular/collection.json`](../../collection.json):
|
|
34
|
+
|
|
35
|
+
| Schematic | Script | Purpose |
|
|
36
|
+
| ---------- | ---------------------- | --------------------------------------------------------------- |
|
|
37
|
+
| `sdk-init` | `bun run gen:sdk:init` | Create `sdk.config.json` at the workspace root from the example |
|
|
38
|
+
| `sdk` | `bun run gen:sdk` | Run the generator using `sdk.config.json` |
|
|
39
|
+
|
|
40
|
+
Both can be invoked directly with `ng generate` too:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
bunx ng generate ./projects/angular/collection.json:sdk-init [--force] [--path=custom/sdk.config.json]
|
|
44
|
+
bunx ng generate ./projects/angular/collection.json:sdk [--dry-run] [--config=sdk.config.json] [--target=1]
|
|
45
|
+
|
|
46
|
+
# after publish / inside a consuming workspace:
|
|
47
|
+
ng generate @ojiepermana/angular:sdk-init [--force] [--path=custom/sdk.config.json]
|
|
48
|
+
ng generate @ojiepermana/angular:sdk [--dry-run] [--config=sdk.config.json] [--target=1]
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### `init` options
|
|
52
|
+
|
|
53
|
+
| Option | Type | Default | Description |
|
|
54
|
+
| --------- | ------- | ----------------- | --------------------------------------------- |
|
|
55
|
+
| `--path` | string | `sdk.config.json` | Destination path, relative to workspace root. |
|
|
56
|
+
| `--force` | boolean | `false` | Overwrite the file if it already exists. |
|
|
57
|
+
|
|
58
|
+
### `sdk` options
|
|
59
|
+
|
|
60
|
+
| Option | Type | Default | Description |
|
|
61
|
+
| ----------- | ------ | ----------------- | ------------------------------------------------------------------ |
|
|
62
|
+
| `--config` | string | `sdk.config.json` | Path to the config file, relative to workspace root. |
|
|
63
|
+
| `--target` | string | _(all)_ | Only generate one target. Accepts a 1-based index or `clientName`. |
|
|
64
|
+
| `--dry-run` | flag | — | Preview file operations without writing anything. |
|
|
65
|
+
|
|
66
|
+
## Config shape
|
|
67
|
+
|
|
68
|
+
```jsonc
|
|
69
|
+
{
|
|
70
|
+
"$schema": "./node_modules/@ojiepermana/angular/generator/api/schematics/sdk/schema.json",
|
|
71
|
+
"targets": [
|
|
72
|
+
{
|
|
73
|
+
"input": "./openapi.yaml",
|
|
74
|
+
"output": "./sdk",
|
|
75
|
+
"mode": "standalone", // "standalone" | "library" | "secondary-entrypoint"
|
|
76
|
+
"clientName": "Api",
|
|
77
|
+
"packageName": "@my-scope/sdk", // only used in "library" mode
|
|
78
|
+
"packageVersion": "0.0.1", // only used in "library" mode
|
|
79
|
+
"rootUrl": "http://127.0.0.1:8080",
|
|
80
|
+
"splitByDomain": false, // optional, default false — see "Per-domain layout"
|
|
81
|
+
"splitDepth": "service", // "service" (default) | "tag"
|
|
82
|
+
"features": {
|
|
83
|
+
"models": true,
|
|
84
|
+
"operations": true,
|
|
85
|
+
"services": true,
|
|
86
|
+
"client": true,
|
|
87
|
+
"metadata": true,
|
|
88
|
+
"navigation": true,
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Multiple targets are supported — one config run can emit several SDKs.
|
|
96
|
+
|
|
97
|
+
## Per-domain layout
|
|
98
|
+
|
|
99
|
+
By default the generator emits a flat layout (`models/`, `fn/`, `services/`, …
|
|
100
|
+
all at the output root). Set `splitByDomain: true` to reorganise the output
|
|
101
|
+
into one folder per domain, derived from OpenAPI tags. Cross-domain models and
|
|
102
|
+
client primitives land in `shared/`.
|
|
103
|
+
|
|
104
|
+
```jsonc
|
|
105
|
+
{
|
|
106
|
+
"splitByDomain": true,
|
|
107
|
+
"splitDepth": "service", // or "tag"
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
`splitDepth` controls granularity. It is only read when `splitByDomain` is
|
|
112
|
+
`true`.
|
|
113
|
+
|
|
114
|
+
| `splitDepth` | Folder strategy | Example (spec with tags `Access/Role`, `Access/Permission`, `Storage/GCS`, `Storage/S3`, `Auth`) |
|
|
115
|
+
| ------------ | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
|
|
116
|
+
| `service` | One folder per **root** tag (each tag's `parent` chain collapses to its root). One folder per backend service. | `access/` (holds Role + Permission + Role-Permission + …), `storage/` (holds GCS + S3), `auth/`, `shared/`, root `public-api.ts` |
|
|
117
|
+
| `tag` | One folder per **leaf** tag, nested under the parent chain. Keeps fine-grained separation while staying grouped. | `access/role/`, `access/permission/`, `access/role-permission/`, `storage/gcs/`, `storage/s3/`, `auth/`, `shared/`, root `public-api.ts` |
|
|
118
|
+
|
|
119
|
+
Every domain folder contains `services/`, `fn/`, `models/`, `permissions/`,
|
|
120
|
+
and its own `public-api.ts` (which re-exports `shared/public-api` for
|
|
121
|
+
convenience). The root `public-api.ts` aggregates `shared` plus every domain,
|
|
122
|
+
so consumers can still do `import { UserService } from './sdk'` regardless of
|
|
123
|
+
layout.
|
|
124
|
+
|
|
125
|
+
Model ownership rule (per-domain mode):
|
|
126
|
+
|
|
127
|
+
- A model used by exactly one domain → emitted inside that domain's `models/`.
|
|
128
|
+
- A model shared across two or more domains → emitted inside `shared/models/`.
|
|
129
|
+
- Client primitives (`ApiConfiguration`, `BaseService`, `RequestBuilder`,
|
|
130
|
+
`StrictHttpResponse`, `Api`), metadata, validators, and the top-level
|
|
131
|
+
`permissions/index.ts` always live under `shared/`.
|
|
132
|
+
|
|
133
|
+
Example consumption when using `mode: 'library'` with `splitByDomain: true`:
|
|
134
|
+
|
|
135
|
+
```ts
|
|
136
|
+
import { RoleService } from '@my-scope/sdk/access';
|
|
137
|
+
import { ApprovalInstanceService, SubmitRequest } from '@my-scope/sdk/approval';
|
|
138
|
+
import { GCSService } from '@my-scope/sdk/storage'; // splitDepth: 'service'
|
|
139
|
+
import { GCSService } from '@my-scope/sdk/storage/gcs'; // splitDepth: 'tag'
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Output modes
|
|
143
|
+
|
|
144
|
+
| Mode | What it emits | Use when… |
|
|
145
|
+
| ---------------------- | ----------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
|
|
146
|
+
| `standalone` | A plain folder (no `ng-package.json`). | You consume the SDK via path alias / `tsconfig.paths` inside the same app. |
|
|
147
|
+
| `library` | Standalone output **plus** `ng-package.json`, `package.json` (peerDeps), and `README.md`. | You want to build it with ng-packagr and publish to npm. |
|
|
148
|
+
| `secondary-entrypoint` | Standalone output **plus** a minimal `ng-package.json` pointing at `public-api.ts`. | You drop the folder inside an existing library so ng-packagr picks it up as a subpath. |
|
|
149
|
+
|
|
150
|
+
## Feature flags
|
|
151
|
+
|
|
152
|
+
All default to `true`. Turn off anything you don't need to shrink the output.
|
|
153
|
+
|
|
154
|
+
| Flag | Emits |
|
|
155
|
+
| ------------ | ------------------------------------------------------------------------------------------ |
|
|
156
|
+
| `models` | `models/*.ts` — flat interfaces, enum aliases, array aliases. |
|
|
157
|
+
| `operations` | `fn/<tag>/<operation-id>.ts` — tree-shakeable request functions with `.PATH`. |
|
|
158
|
+
| `services` | `services/<tag>.service.ts` — `@Injectable({providedIn:'root'})` wrappers. |
|
|
159
|
+
| `client` | `api-configuration.ts`, `base-service.ts`, `request-builder.ts`, `api.ts`. |
|
|
160
|
+
| `metadata` | `permissions/*`, `validators/*`, `metadata.ts`, `openapi-helpers.ts`. |
|
|
161
|
+
| `navigation` | `api.navigation.ts` — `NavigationItem[]` ready for `NavigationService.registerItems(...)`. |
|
|
162
|
+
|
|
163
|
+
## Pipeline
|
|
164
|
+
|
|
165
|
+
```
|
|
166
|
+
sdk.config.json → loader → spec (YAML/JSON) → IR → emitters → writer → Angular CLI Tree
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
- `src/config/` — config schema + loader (supports JSONC and `.js`/`.cjs`).
|
|
170
|
+
- `src/parser/` — OpenAPI → intermediate representation.
|
|
171
|
+
- `src/emit/` — one module per output concern (models, operations, services, client, metadata, navigation, public-api).
|
|
172
|
+
- `src/layout/` — post-emit layout transforms (e.g. `splitByDomain` reorganisation).
|
|
173
|
+
- `src/writer/` — mode wrappers (standalone / library / secondary entrypoint).
|
|
174
|
+
- `public-api.ts` — published TypeScript entrypoint for `@ojiepermana/angular/generator/api`.
|
|
175
|
+
- `schematics/init/` — creates `sdk.config.json` from the example template.
|
|
176
|
+
- `schematics/sdk/` — orchestrates engine and writes virtual files into the CLI `Tree`.
|
|
177
|
+
|
|
178
|
+
## Generated runtime conventions
|
|
179
|
+
|
|
180
|
+
- Tree-shakeable: `import { listUsers } from './sdk/fn/user/list-users'` pulls only one HTTP call.
|
|
181
|
+
- Services: every operation gets `op()` (body `Observable<T>`) and `op$Response()` (full `StrictHttpResponse<T>`).
|
|
182
|
+
- `RequestBuilder` is intentionally minimal — no `style`/`explode` logic — to keep the output lightweight.
|
|
183
|
+
- All files carry a `DO NOT EDIT` banner and `/* eslint-disable */`.
|