@magmonium/one 0.4.30 → 0.4.32
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/assets/button_groups/nav_user_actions.json +1 -0
- package/assets/button_groups/notification_filter.json +2 -13
- package/assets/buttons/nav_user_edit_profile.json +5 -0
- package/assets/docs/en/app-release.md +0 -11
- package/assets/i18n/af.json +10 -2
- package/assets/i18n/am.json +10 -1
- package/assets/i18n/ar.json +10 -2
- package/assets/i18n/as.json +11 -2
- package/assets/i18n/az.json +11 -2
- package/assets/i18n/ba.json +8 -0
- package/assets/i18n/be.json +11 -2
- package/assets/i18n/bg.json +11 -2
- package/assets/i18n/bn.json +11 -2
- package/assets/i18n/br.json +7 -0
- package/assets/i18n/bs.json +10 -2
- package/assets/i18n/ca.json +10 -2
- package/assets/i18n/ceb.json +9 -2
- package/assets/i18n/cnr.json +8 -0
- package/assets/i18n/co.json +7 -1
- package/assets/i18n/cs.json +9 -2
- package/assets/i18n/cy.json +11 -2
- package/assets/i18n/da.json +7 -1
- package/assets/i18n/de.json +8 -2
- package/assets/i18n/doi.json +9 -0
- package/assets/i18n/el.json +10 -2
- package/assets/i18n/en.json +21 -4
- package/assets/i18n/eo.json +9 -2
- package/assets/i18n/es.json +9 -2
- package/assets/i18n/et.json +8 -2
- package/assets/i18n/eu.json +9 -2
- package/assets/i18n/fa.json +10 -2
- package/assets/i18n/fi.json +9 -2
- package/assets/i18n/fr.json +9 -2
- package/assets/i18n/fy.json +6 -2
- package/assets/i18n/ga.json +10 -2
- package/assets/i18n/gd.json +9 -2
- package/assets/i18n/gl.json +8 -1
- package/assets/i18n/gu.json +11 -2
- package/assets/i18n/ha.json +7 -1
- package/assets/i18n/haw.json +8 -2
- package/assets/i18n/he.json +8 -0
- package/assets/i18n/hi.json +10 -2
- package/assets/i18n/hmn.json +6 -2
- package/assets/i18n/hr.json +10 -2
- package/assets/i18n/hu.json +10 -2
- package/assets/i18n/hy.json +11 -2
- package/assets/i18n/id.json +10 -2
- package/assets/i18n/ig.json +8 -1
- package/assets/i18n/ilo.json +6 -0
- package/assets/i18n/is.json +10 -2
- package/assets/i18n/it.json +9 -2
- package/assets/i18n/iw.json +9 -1
- package/assets/i18n/ja.json +8 -1
- package/assets/i18n/jw.json +8 -2
- package/assets/i18n/ka.json +10 -2
- package/assets/i18n/kk.json +10 -2
- package/assets/i18n/km.json +10 -2
- package/assets/i18n/kn.json +11 -2
- package/assets/i18n/ko.json +8 -1
- package/assets/i18n/kok.json +9 -0
- package/assets/i18n/ku.json +10 -2
- package/assets/i18n/ky.json +9 -1
- package/assets/i18n/la.json +6 -1
- package/assets/i18n/lb.json +6 -2
- package/assets/i18n/lo.json +10 -2
- package/assets/i18n/lt.json +10 -2
- package/assets/i18n/lv.json +10 -2
- package/assets/i18n/mai.json +9 -0
- package/assets/i18n/mg.json +8 -2
- package/assets/i18n/mi.json +8 -2
- package/assets/i18n/mk.json +10 -2
- package/assets/i18n/ml.json +11 -2
- package/assets/i18n/mn.json +10 -2
- package/assets/i18n/mr.json +11 -2
- package/assets/i18n/ms.json +9 -2
- package/assets/i18n/mt.json +9 -2
- package/assets/i18n/my.json +10 -2
- package/assets/i18n/ne.json +10 -2
- package/assets/i18n/nl.json +6 -2
- package/assets/i18n/no.json +8 -2
- package/assets/i18n/ny.json +9 -2
- package/assets/i18n/or.json +10 -1
- package/assets/i18n/pa.json +11 -2
- package/assets/i18n/pl.json +8 -2
- package/assets/i18n/ps.json +8 -1
- package/assets/i18n/pt.json +9 -2
- package/assets/i18n/ro.json +9 -2
- package/assets/i18n/ru.json +9 -2
- package/assets/i18n/sa.json +9 -0
- package/assets/i18n/sat.json +9 -0
- package/assets/i18n/sd.json +11 -2
- package/assets/i18n/si.json +10 -2
- package/assets/i18n/sk.json +6 -1
- package/assets/i18n/sl.json +10 -2
- package/assets/i18n/sm.json +7 -1
- package/assets/i18n/sn.json +6 -2
- package/assets/i18n/so.json +8 -1
- package/assets/i18n/sq.json +10 -2
- package/assets/i18n/sr.json +10 -2
- package/assets/i18n/st.json +8 -2
- package/assets/i18n/su.json +8 -2
- package/assets/i18n/sv.json +8 -2
- package/assets/i18n/sw.json +10 -2
- package/assets/i18n/ta.json +11 -2
- package/assets/i18n/te.json +11 -2
- package/assets/i18n/tg.json +11 -2
- package/assets/i18n/th.json +10 -1
- package/assets/i18n/tl.json +8 -2
- package/assets/i18n/tr.json +10 -2
- package/assets/i18n/uk.json +11 -2
- package/assets/i18n/ur.json +11 -2
- package/assets/i18n/uz.json +10 -2
- package/assets/i18n/vi.json +10 -1
- package/assets/i18n/xh.json +11 -2
- package/assets/i18n/yi.json +10 -1
- package/assets/i18n/yo.json +9 -1
- package/assets/i18n/zh.json +9 -1
- package/assets/i18n/zu.json +11 -2
- package/assets/index.json +1 -1
- package/fesm2022/magmonium-one-attribute-value-DMI0yJpL.mjs +255 -0
- package/fesm2022/magmonium-one-attribute-value-DMI0yJpL.mjs.map +1 -0
- package/fesm2022/magmonium-one-base-checkbox-C9dvZ2IH.mjs +77 -0
- package/fesm2022/magmonium-one-base-checkbox-C9dvZ2IH.mjs.map +1 -0
- package/fesm2022/magmonium-one-base-dropdown-U-cWl3p9.mjs +604 -0
- package/fesm2022/magmonium-one-base-dropdown-U-cWl3p9.mjs.map +1 -0
- package/fesm2022/magmonium-one-base-input-CLBOTOUs.mjs +183 -0
- package/fesm2022/magmonium-one-base-input-CLBOTOUs.mjs.map +1 -0
- package/fesm2022/magmonium-one-base-text-Zb0oLNRX.mjs +94 -0
- package/fesm2022/magmonium-one-base-text-Zb0oLNRX.mjs.map +1 -0
- package/fesm2022/magmonium-one-button-Bwzaxxn3.mjs +1281 -0
- package/fesm2022/magmonium-one-button-Bwzaxxn3.mjs.map +1 -0
- package/fesm2022/magmonium-one-checkbox-CPQ9m291.mjs +365 -0
- package/fesm2022/magmonium-one-checkbox-CPQ9m291.mjs.map +1 -0
- package/fesm2022/magmonium-one-color-utl-CAbZLKB5.mjs +449 -0
- package/fesm2022/magmonium-one-color-utl-CAbZLKB5.mjs.map +1 -0
- package/fesm2022/magmonium-one-directives-BVKX77zM.mjs +1285 -0
- package/fesm2022/magmonium-one-directives-BVKX77zM.mjs.map +1 -0
- package/fesm2022/magmonium-one-file.service-Bo06pU3_.mjs +65 -0
- package/fesm2022/magmonium-one-file.service-Bo06pU3_.mjs.map +1 -0
- package/fesm2022/magmonium-one-group-D4yYrVP3.mjs +428 -0
- package/fesm2022/magmonium-one-group-D4yYrVP3.mjs.map +1 -0
- package/fesm2022/magmonium-one-header-DmN8M1a3.mjs +380 -0
- package/fesm2022/magmonium-one-header-DmN8M1a3.mjs.map +1 -0
- package/fesm2022/magmonium-one-icon-Ep14YeRY.mjs +833 -0
- package/fesm2022/magmonium-one-icon-Ep14YeRY.mjs.map +1 -0
- package/fesm2022/magmonium-one-image-editor-BX4eNd4u.mjs +438 -0
- package/fesm2022/magmonium-one-image-editor-BX4eNd4u.mjs.map +1 -0
- package/fesm2022/magmonium-one-image-frame-BTSaUSAi.mjs +116 -0
- package/fesm2022/magmonium-one-image-frame-BTSaUSAi.mjs.map +1 -0
- package/fesm2022/magmonium-one-input-DqHPorA1.mjs +39 -0
- package/fesm2022/magmonium-one-input-DqHPorA1.mjs.map +1 -0
- package/fesm2022/magmonium-one-label-D2gjTbKX.mjs +574 -0
- package/fesm2022/magmonium-one-label-D2gjTbKX.mjs.map +1 -0
- package/fesm2022/magmonium-one-m-ref-Bq0gQbKE.mjs +147 -0
- package/fesm2022/magmonium-one-m-ref-Bq0gQbKE.mjs.map +1 -0
- package/fesm2022/magmonium-one-menu-BM9f2knw.mjs +887 -0
- package/fesm2022/magmonium-one-menu-BM9f2knw.mjs.map +1 -0
- package/fesm2022/magmonium-one-multi-range-a3ZVTy7i.mjs +458 -0
- package/fesm2022/magmonium-one-multi-range-a3ZVTy7i.mjs.map +1 -0
- package/fesm2022/magmonium-one-options-asset-CDEXIif6.mjs +97 -0
- package/fesm2022/magmonium-one-options-asset-CDEXIif6.mjs.map +1 -0
- package/fesm2022/magmonium-one-otp-DO4oTeSK.mjs +261 -0
- package/fesm2022/magmonium-one-otp-DO4oTeSK.mjs.map +1 -0
- package/fesm2022/magmonium-one-password-D3oTo41c.mjs +217 -0
- package/fesm2022/magmonium-one-password-D3oTo41c.mjs.map +1 -0
- package/fesm2022/magmonium-one-radio-CkaWESS3.mjs +111 -0
- package/fesm2022/magmonium-one-radio-CkaWESS3.mjs.map +1 -0
- package/fesm2022/magmonium-one-range-D_WEKrli.mjs +216 -0
- package/fesm2022/magmonium-one-range-D_WEKrli.mjs.map +1 -0
- package/fesm2022/magmonium-one-rolldown-runtime-DpJrqANO.mjs +11 -0
- package/fesm2022/magmonium-one-selector-BowevmOd.mjs +1065 -0
- package/fesm2022/magmonium-one-selector-BowevmOd.mjs.map +1 -0
- package/fesm2022/magmonium-one-size-converter-BfT0Aw0g.mjs +1060 -0
- package/fesm2022/magmonium-one-size-converter-BfT0Aw0g.mjs.map +1 -0
- package/fesm2022/magmonium-one-text-B4xKn-EQ.mjs +406 -0
- package/fesm2022/magmonium-one-text-B4xKn-EQ.mjs.map +1 -0
- package/fesm2022/magmonium-one-text-output-CfVeqYM7.mjs +296 -0
- package/fesm2022/magmonium-one-text-output-CfVeqYM7.mjs.map +1 -0
- package/fesm2022/magmonium-one-theme-Xgsx8bJs.mjs +1 -0
- package/fesm2022/magmonium-one-toggle-D2XEbN-b.mjs +231 -0
- package/fesm2022/magmonium-one-toggle-D2XEbN-b.mjs.map +1 -0
- package/fesm2022/magmonium-one.mjs +49250 -2
- package/fesm2022/magmonium-one.mjs.map +1 -1
- package/package.json +8 -8
- package/types/magmonium-one.d.ts +13909 -9533
- package/assets/menu/user_header.json +0 -27
- package/fesm2022/magmonium-one-image-editor-QPOy7XQt.mjs +0 -290
- package/fesm2022/magmonium-one-image-editor-QPOy7XQt.mjs.map +0 -1
- package/fesm2022/magmonium-one-magmonium-one-BTi-rHpF.mjs +0 -41583
- package/fesm2022/magmonium-one-magmonium-one-BTi-rHpF.mjs.map +0 -1
- package/fesm2022/magmonium-one-otp-BcNCgGpz.mjs +0 -201
- package/fesm2022/magmonium-one-otp-BcNCgGpz.mjs.map +0 -1
- package/fesm2022/magmonium-one-password-BDcSzmV_.mjs +0 -105
- package/fesm2022/magmonium-one-password-BDcSzmV_.mjs.map +0 -1
- package/fesm2022/magmonium-one-toggle-bLWTwEHE.mjs +0 -62
- package/fesm2022/magmonium-one-toggle-bLWTwEHE.mjs.map +0 -1
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { B as IS_DESIGN_MODE, p as AssetStore, v as HttpService } from "./magmonium-one-size-converter-BfT0Aw0g.mjs";
|
|
2
|
+
import { m as ThemeStore, t as applyColorsToElement } from "./magmonium-one-color-utl-CAbZLKB5.mjs";
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
import { ChangeDetectionStrategy, Component, ElementRef, computed, effect, inject, input, model, signal, untracked } from "@angular/core";
|
|
5
|
+
import { catchError, of } from "rxjs";
|
|
6
|
+
import { rxResource } from "@angular/core/rxjs-interop";
|
|
7
|
+
function resolveConfigAsset(assetStore, subFolder, name, isOne, remoteBaseUrl) {
|
|
8
|
+
if (!name) return of({});
|
|
9
|
+
const parts = [subFolder, name].filter((part) => typeof part !== "undefined");
|
|
10
|
+
const type = parts.length > 1 ? parts.slice(0, -1).join("/") : parts[0];
|
|
11
|
+
const assetName = parts[parts.length - 1];
|
|
12
|
+
return assetStore.resolve(type, assetName, isOne, remoteBaseUrl).pipe(catchError(() => of({})));
|
|
13
|
+
}
|
|
14
|
+
var ConfigComponent = class ConfigComponent {
|
|
15
|
+
config = model(...ngDevMode ? [void 0, { debugName: "config" }] : /* istanbul ignore next */ []);
|
|
16
|
+
name = input(...ngDevMode ? [void 0, { debugName: "name" }] : /* istanbul ignore next */ []);
|
|
17
|
+
baseUrl = input(...ngDevMode ? [void 0, { debugName: "baseUrl" }] : /* istanbul ignore next */ []);
|
|
18
|
+
subFolder = void 0;
|
|
19
|
+
resolvesConfigAsset = true;
|
|
20
|
+
one = input(void 0, ...ngDevMode ? [{ debugName: "one" }] : /* istanbul ignore next */ []);
|
|
21
|
+
elementRef = inject(ElementRef);
|
|
22
|
+
isFromOne = computed(() => {
|
|
23
|
+
if (this.one() || this.config()?.one) return true;
|
|
24
|
+
return this.elementRef.nativeElement.tagName.startsWith("M-ONE");
|
|
25
|
+
}, ...ngDevMode ? [{ debugName: "isFromOne" }] : /* istanbul ignore next */ []);
|
|
26
|
+
themeStore = inject(ThemeStore);
|
|
27
|
+
isDesignMode = !!inject(IS_DESIGN_MODE, { optional: true });
|
|
28
|
+
pallet = signal(void 0, ...ngDevMode ? [{ debugName: "pallet" }] : /* istanbul ignore next */ []);
|
|
29
|
+
remote = input(...ngDevMode ? [void 0, { debugName: "remote" }] : /* istanbul ignore next */ []);
|
|
30
|
+
assetStore = inject(AssetStore);
|
|
31
|
+
http = inject(HttpService);
|
|
32
|
+
previousName = signal(void 0, ...ngDevMode ? [{ debugName: "previousName" }] : /* istanbul ignore next */ []);
|
|
33
|
+
remoteBaseUrl = computed(() => {
|
|
34
|
+
const remoteId = this.remote() ?? this.config()?.remote;
|
|
35
|
+
return remoteId ? this.http.buildWcAssetBaseUrl(remoteId) : void 0;
|
|
36
|
+
}, ...ngDevMode ? [{ debugName: "remoteBaseUrl" }] : /* istanbul ignore next */ []);
|
|
37
|
+
assetsPath = computed(() => {
|
|
38
|
+
const name = this.name();
|
|
39
|
+
if (!name || !this.resolvesConfigAsset) return void 0;
|
|
40
|
+
return {
|
|
41
|
+
name,
|
|
42
|
+
isOne: this.isFromOne(),
|
|
43
|
+
remoteBaseUrl: this.remoteBaseUrl()
|
|
44
|
+
};
|
|
45
|
+
}, ...ngDevMode ? [{ debugName: "assetsPath" }] : /* istanbul ignore next */ []);
|
|
46
|
+
storedConfig = rxResource({
|
|
47
|
+
params: () => this.assetsPath(),
|
|
48
|
+
stream: ({ params }) => resolveConfigAsset(this.assetStore, this.subFolder, params?.name, params?.isOne ?? false, params?.remoteBaseUrl)
|
|
49
|
+
});
|
|
50
|
+
declaredName = computed(() => this.storedConfig.value()?.name, ...ngDevMode ? [{ debugName: "declaredName" }] : /* istanbul ignore next */ []);
|
|
51
|
+
manualConfig = signal({}, ...ngDevMode ? [{ debugName: "manualConfig" }] : /* istanbul ignore next */ []);
|
|
52
|
+
_internalConfigWritePending = signal(false, ...ngDevMode ? [{ debugName: "_internalConfigWritePending" }] : /* istanbul ignore next */ []);
|
|
53
|
+
resolveComponentOverrides() {
|
|
54
|
+
return {};
|
|
55
|
+
}
|
|
56
|
+
constructor() {
|
|
57
|
+
effect(this.syncManualConfig);
|
|
58
|
+
effect(this.updateConfig);
|
|
59
|
+
effect(this.updatePallet);
|
|
60
|
+
}
|
|
61
|
+
syncManualConfig = () => {
|
|
62
|
+
const current = this.config();
|
|
63
|
+
if (!current) return;
|
|
64
|
+
untracked(() => {
|
|
65
|
+
if (this._internalConfigWritePending()) {
|
|
66
|
+
this._internalConfigWritePending.set(false);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const prev = this.manualConfig();
|
|
70
|
+
const merged = { ...current };
|
|
71
|
+
if ([.../* @__PURE__ */ new Set([...Object.keys(merged), ...Object.keys(prev)])].some((k) => {
|
|
72
|
+
return Object.prototype.hasOwnProperty.call(merged, k) !== Object.prototype.hasOwnProperty.call(prev, k) || merged[k] !== prev[k];
|
|
73
|
+
})) this.manualConfig.set(merged);
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
get defaultColor() {
|
|
77
|
+
return "mm";
|
|
78
|
+
}
|
|
79
|
+
updatePallet = () => {
|
|
80
|
+
const config = this.config();
|
|
81
|
+
if (!config) return;
|
|
82
|
+
const color = this.resolveComponentOverrides().color ?? config.color ?? this.defaultColor;
|
|
83
|
+
this.pallet.set(applyColorsToElement(color, this.themeStore.color(), this.elementRef.nativeElement));
|
|
84
|
+
};
|
|
85
|
+
updateConfig = () => {
|
|
86
|
+
const currentName = untracked(() => this.name());
|
|
87
|
+
const prevName = untracked(() => this.previousName());
|
|
88
|
+
const storedConfigValue = this.storedConfig.value();
|
|
89
|
+
const isLoading = this.storedConfig.isLoading();
|
|
90
|
+
const manual = this.manualConfig();
|
|
91
|
+
const componentOverrides = this.resolveComponentOverrides();
|
|
92
|
+
if (currentName !== prevName && prevName !== void 0) {
|
|
93
|
+
this.manualConfig.set({});
|
|
94
|
+
this._internalConfigWritePending.set(true);
|
|
95
|
+
this.config.set({
|
|
96
|
+
...storedConfigValue ?? {},
|
|
97
|
+
...componentOverrides,
|
|
98
|
+
name: currentName,
|
|
99
|
+
remote: this.remote() ?? storedConfigValue?.remote,
|
|
100
|
+
isLoading
|
|
101
|
+
});
|
|
102
|
+
} else untracked(() => {
|
|
103
|
+
const currentConfig = this.config();
|
|
104
|
+
const merged = {
|
|
105
|
+
...storedConfigValue ?? {},
|
|
106
|
+
...manual,
|
|
107
|
+
...componentOverrides,
|
|
108
|
+
name: currentName ?? currentConfig?.name,
|
|
109
|
+
baseUrl: this.baseUrl() ?? currentConfig?.baseUrl,
|
|
110
|
+
remote: this.remote() ?? storedConfigValue?.remote ?? currentConfig?.remote,
|
|
111
|
+
isLoading
|
|
112
|
+
};
|
|
113
|
+
const prev = currentConfig ?? {};
|
|
114
|
+
if ([.../* @__PURE__ */ new Set([...Object.keys(merged), ...Object.keys(prev)])].every((k) => {
|
|
115
|
+
return Object.prototype.hasOwnProperty.call(merged, k) === Object.prototype.hasOwnProperty.call(prev, k) && merged[k] === prev[k];
|
|
116
|
+
})) return;
|
|
117
|
+
this._internalConfigWritePending.set(true);
|
|
118
|
+
this.config.set(merged);
|
|
119
|
+
});
|
|
120
|
+
this.previousName.set(currentName);
|
|
121
|
+
};
|
|
122
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
123
|
+
minVersion: "12.0.0",
|
|
124
|
+
version: "22.2.1",
|
|
125
|
+
ngImport: i0,
|
|
126
|
+
type: ConfigComponent,
|
|
127
|
+
deps: [],
|
|
128
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
129
|
+
});
|
|
130
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
131
|
+
minVersion: "17.1.0",
|
|
132
|
+
version: "22.2.1",
|
|
133
|
+
type: ConfigComponent,
|
|
134
|
+
isStandalone: true,
|
|
135
|
+
selector: "m-config",
|
|
136
|
+
inputs: {
|
|
137
|
+
config: {
|
|
138
|
+
classPropertyName: "config",
|
|
139
|
+
publicName: "config",
|
|
140
|
+
isSignal: true,
|
|
141
|
+
isRequired: false,
|
|
142
|
+
transformFunction: null
|
|
143
|
+
},
|
|
144
|
+
name: {
|
|
145
|
+
classPropertyName: "name",
|
|
146
|
+
publicName: "name",
|
|
147
|
+
isSignal: true,
|
|
148
|
+
isRequired: false,
|
|
149
|
+
transformFunction: null
|
|
150
|
+
},
|
|
151
|
+
baseUrl: {
|
|
152
|
+
classPropertyName: "baseUrl",
|
|
153
|
+
publicName: "baseUrl",
|
|
154
|
+
isSignal: true,
|
|
155
|
+
isRequired: false,
|
|
156
|
+
transformFunction: null
|
|
157
|
+
},
|
|
158
|
+
one: {
|
|
159
|
+
classPropertyName: "one",
|
|
160
|
+
publicName: "one",
|
|
161
|
+
isSignal: true,
|
|
162
|
+
isRequired: false,
|
|
163
|
+
transformFunction: null
|
|
164
|
+
},
|
|
165
|
+
remote: {
|
|
166
|
+
classPropertyName: "remote",
|
|
167
|
+
publicName: "remote",
|
|
168
|
+
isSignal: true,
|
|
169
|
+
isRequired: false,
|
|
170
|
+
transformFunction: null
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
outputs: { config: "configChange" },
|
|
174
|
+
ngImport: i0,
|
|
175
|
+
template: ``,
|
|
176
|
+
isInline: true,
|
|
177
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
178
|
+
});
|
|
179
|
+
};
|
|
180
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
181
|
+
minVersion: "12.0.0",
|
|
182
|
+
version: "22.2.1",
|
|
183
|
+
ngImport: i0,
|
|
184
|
+
type: ConfigComponent,
|
|
185
|
+
decorators: [{
|
|
186
|
+
type: Component,
|
|
187
|
+
args: [{
|
|
188
|
+
imports: [],
|
|
189
|
+
selector: "m-config",
|
|
190
|
+
template: ``,
|
|
191
|
+
changeDetection: ChangeDetectionStrategy.OnPush
|
|
192
|
+
}]
|
|
193
|
+
}],
|
|
194
|
+
ctorParameters: () => [],
|
|
195
|
+
propDecorators: {
|
|
196
|
+
config: [{
|
|
197
|
+
type: i0.Input,
|
|
198
|
+
args: [{
|
|
199
|
+
isSignal: true,
|
|
200
|
+
alias: "config",
|
|
201
|
+
required: false
|
|
202
|
+
}]
|
|
203
|
+
}, {
|
|
204
|
+
type: i0.Output,
|
|
205
|
+
args: ["configChange"]
|
|
206
|
+
}],
|
|
207
|
+
name: [{
|
|
208
|
+
type: i0.Input,
|
|
209
|
+
args: [{
|
|
210
|
+
isSignal: true,
|
|
211
|
+
alias: "name",
|
|
212
|
+
required: false
|
|
213
|
+
}]
|
|
214
|
+
}],
|
|
215
|
+
baseUrl: [{
|
|
216
|
+
type: i0.Input,
|
|
217
|
+
args: [{
|
|
218
|
+
isSignal: true,
|
|
219
|
+
alias: "baseUrl",
|
|
220
|
+
required: false
|
|
221
|
+
}]
|
|
222
|
+
}],
|
|
223
|
+
one: [{
|
|
224
|
+
type: i0.Input,
|
|
225
|
+
args: [{
|
|
226
|
+
isSignal: true,
|
|
227
|
+
alias: "one",
|
|
228
|
+
required: false
|
|
229
|
+
}]
|
|
230
|
+
}],
|
|
231
|
+
remote: [{
|
|
232
|
+
type: i0.Input,
|
|
233
|
+
args: [{
|
|
234
|
+
isSignal: true,
|
|
235
|
+
alias: "remote",
|
|
236
|
+
required: false
|
|
237
|
+
}]
|
|
238
|
+
}]
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
const toAttrBool = (value) => {
|
|
242
|
+
if (value === void 0) return void 0;
|
|
243
|
+
if (typeof value === "boolean") return value;
|
|
244
|
+
return value.trim().toLowerCase() !== "false";
|
|
245
|
+
};
|
|
246
|
+
const toAttrNumber = (value) => {
|
|
247
|
+
if (value === void 0 || typeof value === "number") return value;
|
|
248
|
+
const trimmed = value.trim();
|
|
249
|
+
if (trimmed === "") return void 0;
|
|
250
|
+
const numeric = Number(trimmed);
|
|
251
|
+
return Number.isNaN(numeric) ? value : numeric;
|
|
252
|
+
};
|
|
253
|
+
export { resolveConfigAsset as i, toAttrNumber as n, ConfigComponent as r, toAttrBool as t };
|
|
254
|
+
|
|
255
|
+
//# sourceMappingURL=magmonium-one-attribute-value-DMI0yJpL.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"magmonium-one-attribute-value-DMI0yJpL.mjs","names":[],"sources":["../../../../libs/one/src/lib/shared/functions/config/resolve-config-asset.ts","../../../../libs/one/src/lib/shared/lib/components/config-component.ts","../../../../libs/one/src/lib/shared/functions/config/attribute-value.ts"],"sourcesContent":["import { catchError, Observable, of } from 'rxjs';\nimport { AssetStore } from '../../stores/asset.store';\nimport { Config } from '../../type/config/config-type';\n\n/**\n * Resolves a config asset by name via `AssetStore`, outside any component\n * injection context — callable from directives, stores, or components alike.\n */\nexport function resolveConfigAsset<T extends Config = Config>(\n assetStore: InstanceType<typeof AssetStore>,\n subFolder: string | undefined,\n name: string | undefined,\n isOne: boolean,\n remoteBaseUrl: string | undefined\n): Observable<Partial<T>> {\n if (!name) return of({});\n\n const parts = [subFolder, name].filter(\n (part): part is string => typeof part !== 'undefined'\n );\n const type = parts.length > 1 ? parts.slice(0, -1).join('/') : parts[0];\n const assetName = parts[parts.length - 1];\n\n return assetStore\n .resolve<Partial<T>>(type, assetName, isOne, remoteBaseUrl)\n .pipe(catchError(() => of({})));\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n effect,\n ElementRef,\n inject,\n input,\n model,\n signal,\n untracked,\n} from '@angular/core';\nimport { rxResource } from '@angular/core/rxjs-interop';\nimport { AssetStore } from '../../stores/asset.store';\nimport { Config } from '../../type/config/config-type';\nimport { resolveConfigAsset } from '../../functions/config/resolve-config-asset';\nimport { applyColorsToElement, ColorPallet } from '../theme/lib/color-utl';\nimport { ThemeStore } from '../theme/lib/theme-store';\nimport { HttpService } from '../../services/http';\nimport { IS_DESIGN_MODE } from '../../config/tokens';\n\n@Component({\n imports: [],\n selector: 'm-config',\n template: ``,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ConfigComponent<T extends Config = Config> {\n config = model<Partial<T>>();\n name = input<string | undefined>();\n baseUrl = input<string | undefined>();\n protected readonly subFolder: string | undefined = undefined;\n // Off for components whose settings are written on the tag: a Section Form\n // and its Items take every key as an attribute (ADR 0010), so their `name`\n // is the data key a form models by and not a `forms/*.yml` or\n // `fields/*.yml` to fetch. Config assets stay with <m-form> and its\n // <m-input-wrapper>, the pair that is reached by name alone.\n protected readonly resolvesConfigAsset: boolean = true;\n one = input<boolean | undefined>(undefined);\n protected readonly elementRef = inject(ElementRef);\n protected readonly isFromOne = computed(() => {\n if (this.one() || this.config()?.one) {\n return true;\n }\n return this.elementRef.nativeElement.tagName.startsWith('M-ONE');\n });\n protected readonly themeStore = inject(ThemeStore);\n\n // True when this component sits inside a visual editor's canvas (DesignMode).\n // Subclasses use it to render editor-only affordances — placeholder boxes for\n // otherwise zero-sized nodes, drop outlines, inert interactions.\n protected readonly isDesignMode = !!inject(IS_DESIGN_MODE, {\n optional: true,\n });\n\n protected readonly pallet = signal<ColorPallet | undefined>(undefined);\n\n remote = input<string | undefined>();\n protected readonly assetStore = inject(AssetStore);\n private readonly http = inject(HttpService);\n private readonly previousName = signal<string | undefined>(undefined);\n // Protected: a subclass resolving an asset of its own — a Field's accepted\n // shapes — has to reach the same Remote its config came from.\n protected readonly remoteBaseUrl = computed<string | undefined>(() => {\n const remoteId = this.remote() ?? this.config()?.remote;\n return remoteId ? this.http.buildWcAssetBaseUrl(remoteId) : undefined;\n });\n private readonly assetsPath = computed<\n | {\n name: string;\n isOne: boolean;\n remoteBaseUrl: string | undefined;\n }\n | undefined\n >(() => {\n const name = this.name();\n if (!name || !this.resolvesConfigAsset) return undefined;\n return {\n name,\n isOne: this.isFromOne(),\n remoteBaseUrl: this.remoteBaseUrl(),\n };\n });\n private readonly storedConfig = rxResource({\n params: () => this.assetsPath(),\n stream: ({ params }) =>\n resolveConfigAsset<T>(\n this.assetStore,\n this.subFolder,\n params?.name,\n params?.isOne ?? false,\n params?.remoteBaseUrl\n ),\n });\n\n // The `name` the resolved asset declares for itself, which is not always the\n // filename it was found under: fields/label_key.yml declares `label`, so a\n // picker asset and a plain textarea asset can drive one config key. Exposed\n // because `config().name` is stamped with the filename — that is what\n // resolves the asset — and a subclass binding to the declared key needs the\n // other half.\n protected readonly declaredName = computed(\n () => (this.storedConfig.value() as Config | undefined)?.name\n );\n\n // Keep track of manual updates cumulatively to support delta updates\n private readonly manualConfig = signal<Partial<T>>({});\n // Prevents syncManualConfig from treating internal updateConfig writes as external input\n private readonly _internalConfigWritePending = signal(false);\n\n /** Override in subclasses to provide component-level config overrides from individual inputs. */\n protected resolveComponentOverrides(): Partial<T> {\n return {};\n }\n\n constructor() {\n effect(this.syncManualConfig);\n effect(this.updateConfig);\n effect(this.updatePallet);\n }\n\n private readonly syncManualConfig = () => {\n const current = this.config();\n if (!current) return;\n\n untracked(() => {\n // Skip writes that originated from updateConfig — they are already merged\n if (this._internalConfigWritePending()) {\n this._internalConfigWritePending.set(false);\n return;\n }\n\n const prev = this.manualConfig();\n\n const merged = {\n ...current,\n };\n\n const allKeys = new Set([...Object.keys(merged), ...Object.keys(prev)]);\n const changed = [...allKeys].some((k) => {\n const inMerged = Object.prototype.hasOwnProperty.call(merged, k);\n const inPrev = Object.prototype.hasOwnProperty.call(prev, k);\n return (\n inMerged !== inPrev ||\n (merged as Record<string, unknown>)[k] !==\n (prev as Record<string, unknown>)[k]\n );\n });\n\n if (changed) {\n this.manualConfig.set(merged);\n }\n });\n };\n\n protected get defaultColor(): string {\n return 'mm';\n }\n\n private readonly updatePallet = (): void => {\n const config = this.config();\n if (!config) {\n return;\n }\n // Scalar inputs override the resolved config everywhere else. Apply the\n // same precedence to the host palette so its contrast and opposite values\n // cannot lag behind an explicit `color` input.\n const color =\n this.resolveComponentOverrides().color ??\n config.color ??\n this.defaultColor;\n this.pallet.set(\n applyColorsToElement(\n color,\n this.themeStore.color(),\n this.elementRef.nativeElement\n )\n );\n };\n\n private readonly updateConfig = () => {\n const currentName = untracked(() => this.name());\n const prevName = untracked(() => this.previousName());\n const storedConfigValue = this.storedConfig.value();\n const isLoading = this.storedConfig.isLoading();\n const manual = this.manualConfig();\n const componentOverrides = this.resolveComponentOverrides();\n\n const nameChanged = currentName !== prevName && prevName !== undefined;\n\n if (nameChanged) {\n // Clear manual config on name change to start fresh with new asset\n this.manualConfig.set({});\n this._internalConfigWritePending.set(true);\n this.config.set({\n ...((storedConfigValue ?? {}) as T),\n ...componentOverrides,\n name: currentName,\n remote: this.remote() ?? (storedConfigValue as Partial<T>)?.remote,\n isLoading,\n } as T);\n } else {\n untracked(() => {\n const currentConfig = this.config();\n const merged = {\n ...((storedConfigValue ?? {}) as Partial<T>),\n ...(manual as T),\n ...componentOverrides,\n name: currentName ?? currentConfig?.name,\n baseUrl: this.baseUrl() ?? currentConfig?.baseUrl,\n remote:\n this.remote() ??\n (storedConfigValue as Partial<T>)?.remote ??\n currentConfig?.remote,\n isLoading,\n } as T;\n\n const prev = currentConfig ?? {};\n const allKeys = new Set([...Object.keys(merged), ...Object.keys(prev)]);\n const same = [...allKeys].every((k) => {\n const inMerged = Object.prototype.hasOwnProperty.call(merged, k);\n const inPrev = Object.prototype.hasOwnProperty.call(prev, k);\n return (\n inMerged === inPrev &&\n (merged as Record<string, unknown>)[k] ===\n (prev as Record<string, unknown>)[k]\n );\n });\n if (same) return;\n\n this._internalConfigWritePending.set(true);\n this.config.set(merged);\n });\n }\n this.previousName.set(currentName);\n };\n}\n","// A component's scalar settings ride on its tag (ADR 0010), and an attribute\n// is a string even when the value is not. These are what a\n// `resolveComponentOverrides()` runs an attribute through before folding it\n// into the config the component would otherwise have read from a YAML asset.\n\n/**\n * A bare attribute (`required`, `fullWidth`) arrives as '', which is HTML for\n * \"present\" — the one spelling that has to mean true rather than empty. Only\n * the literal string 'false' reads as false, so `[required]=\"false\"` and\n * `required=\"false\"` agree; without that, a non-empty string would reach a\n * `boolean` input as truthy and an unticked toggle would render as ticked.\n */\nexport const toAttrBool = (\n value: boolean | string | undefined\n): boolean | undefined => {\n if (value === undefined) return undefined;\n if (typeof value === 'boolean') return value;\n return value.trim().toLowerCase() !== 'false';\n};\n\n/**\n * A numeric string becomes a number so the inputs reading these get the type\n * they expect. Anything else passes through as written — `maxWidth: 50%` and a\n * date format are legitimately non-numeric, and an empty attribute is an unset\n * rather than a zero.\n */\nexport const toAttrNumber = (\n value: number | string | undefined\n): number | string | undefined => {\n if (value === undefined || typeof value === 'number') return value;\n const trimmed = value.trim();\n if (trimmed === '') return undefined;\n const numeric = Number(trimmed);\n return Number.isNaN(numeric) ? value : numeric;\n};\n"],"mappings":";;;;;;AAQA,SAAgB,mBACd,YACA,WACA,MACA,OACA,eAAiC;CAEjC,IAAI,CAAC,MAAM,OAAO,GAAG,CAAA,CAAE;CAEvB,MAAM,QAAQ,CAAC,WAAW,IAAI,CAAC,CAAC,QAC7B,SAAyB,OAAO,SAAS,WAAW;CAEvD,MAAM,OAAO,MAAM,SAAS,IAAI,MAAM,MAAM,GAAG,EAAE,CAAC,CAAC,KAAK,GAAG,IAAI,MAAM;CACrE,MAAM,YAAY,MAAM,MAAM,SAAS;CAEvC,OAAO,WACJ,QAAoB,MAAM,WAAW,OAAO,aAAa,CAAC,CAC1D,KAAK,iBAAiB,GAAG,CAAA,CAAE,CAAC,CAAC;AAClC;ACCA,IAAa,kBAAb,MAAa,gBAAe;CAC1B,SAAS,MAAmB,GAAA,YAAA,CAAA,QAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;C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,UACuB;CACvB,IAAI,UAAU,QAAW,OAAO;CAChC,IAAI,OAAO,UAAU,WAAW,OAAO;CACvC,OAAO,MAAM,KAAI,CAAE,CAAC,YAAW,MAAO;AACxC;AAQA,MAAa,gBACX,UAC+B;CAC/B,IAAI,UAAU,UAAa,OAAO,UAAU,UAAU,OAAO;CAC7D,MAAM,UAAU,MAAM,KAAI;CAC1B,IAAI,YAAY,IAAI,OAAO;CAC3B,MAAM,UAAU,OAAO,OAAO;CAC9B,OAAO,OAAO,MAAM,OAAO,IAAI,QAAQ;AACzC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { t as BaseInputComponent } from "./magmonium-one-base-input-CLBOTOUs.mjs";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
import { Directive, afterRenderEffect, model, viewChild } from "@angular/core";
|
|
4
|
+
var BaseCheckboxInputComponent = class BaseCheckboxInputComponent extends BaseInputComponent {
|
|
5
|
+
value = void 0;
|
|
6
|
+
checked = model(false);
|
|
7
|
+
inputElement = viewChild("inputElement", ...ngDevMode ? [{ debugName: "inputElement" }] : /* istanbul ignore next */ []);
|
|
8
|
+
constructor() {
|
|
9
|
+
super();
|
|
10
|
+
afterRenderEffect(() => {
|
|
11
|
+
if (this.focused() && this.inputElement()) this.inputElement()?.nativeElement.focus();
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
setValue = (value) => {
|
|
15
|
+
this.checked.set(value);
|
|
16
|
+
this.touched.set(true);
|
|
17
|
+
};
|
|
18
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
19
|
+
minVersion: "12.0.0",
|
|
20
|
+
version: "22.2.1",
|
|
21
|
+
ngImport: i0,
|
|
22
|
+
type: BaseCheckboxInputComponent,
|
|
23
|
+
deps: [],
|
|
24
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
25
|
+
});
|
|
26
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
27
|
+
minVersion: "17.2.0",
|
|
28
|
+
version: "22.2.1",
|
|
29
|
+
type: BaseCheckboxInputComponent,
|
|
30
|
+
isStandalone: true,
|
|
31
|
+
inputs: { checked: {
|
|
32
|
+
classPropertyName: "checked",
|
|
33
|
+
publicName: "checked",
|
|
34
|
+
isSignal: true,
|
|
35
|
+
isRequired: false,
|
|
36
|
+
transformFunction: null
|
|
37
|
+
} },
|
|
38
|
+
outputs: { checked: "checkedChange" },
|
|
39
|
+
viewQueries: [{
|
|
40
|
+
propertyName: "inputElement",
|
|
41
|
+
first: true,
|
|
42
|
+
predicate: ["inputElement"],
|
|
43
|
+
descendants: true,
|
|
44
|
+
isSignal: true
|
|
45
|
+
}],
|
|
46
|
+
usesInheritance: true,
|
|
47
|
+
ngImport: i0
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
51
|
+
minVersion: "12.0.0",
|
|
52
|
+
version: "22.2.1",
|
|
53
|
+
ngImport: i0,
|
|
54
|
+
type: BaseCheckboxInputComponent,
|
|
55
|
+
decorators: [{ type: Directive }],
|
|
56
|
+
ctorParameters: () => [],
|
|
57
|
+
propDecorators: {
|
|
58
|
+
checked: [{
|
|
59
|
+
type: i0.Input,
|
|
60
|
+
args: [{
|
|
61
|
+
isSignal: true,
|
|
62
|
+
alias: "checked",
|
|
63
|
+
required: false
|
|
64
|
+
}]
|
|
65
|
+
}, {
|
|
66
|
+
type: i0.Output,
|
|
67
|
+
args: ["checkedChange"]
|
|
68
|
+
}],
|
|
69
|
+
inputElement: [{
|
|
70
|
+
type: i0.ViewChild,
|
|
71
|
+
args: ["inputElement", { isSignal: true }]
|
|
72
|
+
}]
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
export { BaseCheckboxInputComponent as t };
|
|
76
|
+
|
|
77
|
+
//# sourceMappingURL=magmonium-one-base-checkbox-C9dvZ2IH.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"magmonium-one-base-checkbox-C9dvZ2IH.mjs","names":[],"sources":["../../../../libs/one/src/lib/shared/ui/input/ui/checkbox/base-checkbox.ts"],"sourcesContent":["import {\n afterRenderEffect,\n Directive,\n ElementRef,\n model,\n ModelSignal,\n viewChild,\n} from '@angular/core';\nimport { FormCheckboxControl } from '@angular/forms/signals';\nimport { BaseInputComponent } from '../../lib/base-input';\nimport { Input } from '../../model/input';\n\n@Directive()\nexport class BaseCheckboxInputComponent\n extends BaseInputComponent<Input>\n implements FormCheckboxControl\n{\n public value = undefined;\n /** Required by FormCheckboxControl interface */\n public readonly checked: ModelSignal<boolean> = model<boolean>(\n false\n ) as ModelSignal<boolean>;\n\n private inputElement =\n viewChild<ElementRef<HTMLInputElement>>('inputElement');\n\n constructor() {\n super();\n afterRenderEffect(() => {\n if (this.focused() && this.inputElement()) {\n this.inputElement()?.nativeElement.focus();\n }\n });\n }\n\n protected readonly setValue = (value: boolean) => {\n this.checked.set(value);\n this.touched.set(true);\n };\n}\n"],"mappings":";;;AAaA,IAAa,6BAAb,MAAa,mCACH,mBAAyB;CAG1B,QAAQ;CAEC,UAAgC,MAC9C,KAAK;CAGC,eACN,UAAwC,gBAAe,GAAA,YAAA,CAAA,EAAA,WAAA,eAAA,CAAA,+BAAA,CAAA,CAAA;CAEzD,cAAA;EACE,MAAK;EACL,wBAAuB;GACrB,IAAI,KAAK,QAAO,KAAM,KAAK,aAAY,GACrC,KAAK,aAAY,CAAE,EAAE,cAAc,MAAK;EAE5C,CAAC;CACH;CAEmB,YAAY,UAAkB;EAC/C,KAAK,QAAQ,IAAI,KAAK;EACtB,KAAK,QAAQ,IAAI,IAAI;CACvB;CAzBW,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAA0B,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAA1B,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAA0B,cAAA;EAAA,QAAA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