@magmonium/one 0.4.99 → 0.4.101

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/fesm2022/{magmonium-one-attribute-value-CPh-lJPV.mjs → magmonium-one-attribute-value-BXEWw7xP.mjs} +3 -3
  2. package/fesm2022/{magmonium-one-attribute-value-CPh-lJPV.mjs.map → magmonium-one-attribute-value-BXEWw7xP.mjs.map} +1 -1
  3. package/fesm2022/{magmonium-one-base-checkbox-LdM6dqF_.mjs → magmonium-one-base-checkbox-CIUMxkzu.mjs} +2 -2
  4. package/fesm2022/{magmonium-one-base-checkbox-LdM6dqF_.mjs.map → magmonium-one-base-checkbox-CIUMxkzu.mjs.map} +1 -1
  5. package/fesm2022/{magmonium-one-base-dropdown-CmUfiOAb.mjs → magmonium-one-base-dropdown-BMsV5USo.mjs} +9 -11
  6. package/fesm2022/magmonium-one-base-dropdown-BMsV5USo.mjs.map +1 -0
  7. package/fesm2022/{magmonium-one-size-converter-BqkALIWA.mjs → magmonium-one-base-input-BeyBAbV4.mjs} +190 -3
  8. package/fesm2022/magmonium-one-base-input-BeyBAbV4.mjs.map +1 -0
  9. package/fesm2022/{magmonium-one-base-text-ChjG3GNw.mjs → magmonium-one-base-text-BBeMl8XM.mjs} +2 -2
  10. package/fesm2022/{magmonium-one-base-text-ChjG3GNw.mjs.map → magmonium-one-base-text-BBeMl8XM.mjs.map} +1 -1
  11. package/fesm2022/{magmonium-one-button-C5dk4R_m.mjs → magmonium-one-button-DC_fLy-J.mjs} +34 -8
  12. package/fesm2022/magmonium-one-button-DC_fLy-J.mjs.map +1 -0
  13. package/fesm2022/{magmonium-one-checkbox-BXNvtkzo.mjs → magmonium-one-checkbox-C85FEuTs.mjs} +5 -6
  14. package/fesm2022/magmonium-one-checkbox-C85FEuTs.mjs.map +1 -0
  15. package/fesm2022/{magmonium-one-color-utl-BA51l-Rw.mjs → magmonium-one-color-utl-DMLkkE-z.mjs} +2 -2
  16. package/fesm2022/{magmonium-one-color-utl-BA51l-Rw.mjs.map → magmonium-one-color-utl-DMLkkE-z.mjs.map} +1 -1
  17. package/fesm2022/{magmonium-one-directives-hJ7wkmQn.mjs → magmonium-one-directives-CJK7xDPK.mjs} +4 -4
  18. package/fesm2022/{magmonium-one-directives-hJ7wkmQn.mjs.map → magmonium-one-directives-CJK7xDPK.mjs.map} +1 -1
  19. package/fesm2022/{magmonium-one-group-bRamdzPO.mjs → magmonium-one-group-qu3xLiI8.mjs} +16 -9
  20. package/fesm2022/magmonium-one-group-qu3xLiI8.mjs.map +1 -0
  21. package/fesm2022/{magmonium-one-header-BZzD8uTJ.mjs → magmonium-one-header-BC-74GOn.mjs} +5 -4
  22. package/fesm2022/{magmonium-one-header-BZzD8uTJ.mjs.map → magmonium-one-header-BC-74GOn.mjs.map} +1 -1
  23. package/fesm2022/{magmonium-one-icon-CH-g8CUR.mjs → magmonium-one-icon-CXFTG4mD.mjs} +4 -4
  24. package/fesm2022/{magmonium-one-icon-CH-g8CUR.mjs.map → magmonium-one-icon-CXFTG4mD.mjs.map} +1 -1
  25. package/fesm2022/{magmonium-one-image-editor-BV0x-SA3.mjs → magmonium-one-image-editor-BAF7cdC2.mjs} +5 -4
  26. package/fesm2022/{magmonium-one-image-editor-BV0x-SA3.mjs.map → magmonium-one-image-editor-BAF7cdC2.mjs.map} +1 -1
  27. package/fesm2022/{magmonium-one-label-D-wnA_Fl.mjs → magmonium-one-label-BNxbDSwc.mjs} +2 -2
  28. package/fesm2022/{magmonium-one-label-D-wnA_Fl.mjs.map → magmonium-one-label-BNxbDSwc.mjs.map} +1 -1
  29. package/fesm2022/{magmonium-one-m-ref-DLIAzywu.mjs → magmonium-one-m-ref-CoK96ogW.mjs} +2 -2
  30. package/fesm2022/{magmonium-one-m-ref-DLIAzywu.mjs.map → magmonium-one-m-ref-CoK96ogW.mjs.map} +1 -1
  31. package/fesm2022/{magmonium-one-menu-CJjjxFfu.mjs → magmonium-one-menu-D_HAqfel.mjs} +7 -6
  32. package/fesm2022/{magmonium-one-menu-CJjjxFfu.mjs.map → magmonium-one-menu-D_HAqfel.mjs.map} +1 -1
  33. package/fesm2022/{magmonium-one-multi-range-C0S7udf5.mjs → magmonium-one-multi-range-DqtW4U_x.mjs} +5 -4
  34. package/fesm2022/magmonium-one-multi-range-DqtW4U_x.mjs.map +1 -0
  35. package/fesm2022/{magmonium-one-options-asset-BNd1hbLw.mjs → magmonium-one-options-asset-DWjdYQe0.mjs} +2 -2
  36. package/fesm2022/{magmonium-one-options-asset-BNd1hbLw.mjs.map → magmonium-one-options-asset-DWjdYQe0.mjs.map} +1 -1
  37. package/fesm2022/{magmonium-one-otp-CeSz8ZZ2.mjs → magmonium-one-otp-DOPvjYJz.mjs} +5 -5
  38. package/fesm2022/{magmonium-one-otp-CeSz8ZZ2.mjs.map → magmonium-one-otp-DOPvjYJz.mjs.map} +1 -1
  39. package/fesm2022/{magmonium-one-password-BKdXAZ_p.mjs → magmonium-one-password-BqdyEDF6.mjs} +7 -6
  40. package/fesm2022/{magmonium-one-password-BKdXAZ_p.mjs.map → magmonium-one-password-BqdyEDF6.mjs.map} +1 -1
  41. package/fesm2022/{magmonium-one-radio-DlS31qJG.mjs → magmonium-one-radio-DGTbRRXb.mjs} +3 -3
  42. package/fesm2022/{magmonium-one-radio-DlS31qJG.mjs.map → magmonium-one-radio-DGTbRRXb.mjs.map} +1 -1
  43. package/fesm2022/{magmonium-one-range-CR8go24u.mjs → magmonium-one-range-Dw4YACtP.mjs} +4 -4
  44. package/fesm2022/{magmonium-one-range-CR8go24u.mjs.map → magmonium-one-range-Dw4YACtP.mjs.map} +1 -1
  45. package/fesm2022/{magmonium-one-selector-BK48N5us.mjs → magmonium-one-selector-QB49Ju9l.mjs} +4 -4
  46. package/fesm2022/{magmonium-one-selector-BK48N5us.mjs.map → magmonium-one-selector-QB49Ju9l.mjs.map} +1 -1
  47. package/fesm2022/{magmonium-one-text-4zWYsKpH.mjs → magmonium-one-text-CMULvvAr.mjs} +6 -7
  48. package/fesm2022/{magmonium-one-text-4zWYsKpH.mjs.map → magmonium-one-text-CMULvvAr.mjs.map} +1 -1
  49. package/fesm2022/{magmonium-one-text-output-E6pe3IOL.mjs → magmonium-one-text-output-DiA4R1pw.mjs} +4 -4
  50. package/fesm2022/{magmonium-one-text-output-E6pe3IOL.mjs.map → magmonium-one-text-output-DiA4R1pw.mjs.map} +1 -1
  51. package/fesm2022/magmonium-one-theme-DEgFM1wD.mjs +1 -0
  52. package/fesm2022/{magmonium-one-toggle-BPInV6K-.mjs → magmonium-one-toggle-sUSXzxMl.mjs} +3 -5
  53. package/fesm2022/magmonium-one-toggle-sUSXzxMl.mjs.map +1 -0
  54. package/fesm2022/magmonium-one.mjs +109 -47
  55. package/fesm2022/magmonium-one.mjs.map +1 -1
  56. package/package.json +1 -1
  57. package/types/magmonium-one.d.ts +64 -38
  58. package/fesm2022/magmonium-one-base-dropdown-CmUfiOAb.mjs.map +0 -1
  59. package/fesm2022/magmonium-one-base-input-B92NOmxz.mjs +0 -183
  60. package/fesm2022/magmonium-one-base-input-B92NOmxz.mjs.map +0 -1
  61. package/fesm2022/magmonium-one-button-C5dk4R_m.mjs.map +0 -1
  62. package/fesm2022/magmonium-one-checkbox-BXNvtkzo.mjs.map +0 -1
  63. package/fesm2022/magmonium-one-group-bRamdzPO.mjs.map +0 -1
  64. package/fesm2022/magmonium-one-multi-range-C0S7udf5.mjs.map +0 -1
  65. package/fesm2022/magmonium-one-size-converter-BqkALIWA.mjs.map +0 -1
  66. package/fesm2022/magmonium-one-theme-BtQyLRdQ.mjs +0 -1
  67. package/fesm2022/magmonium-one-toggle-BPInV6K-.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"magmonium-one-icon-CH-g8CUR.mjs","names":["catchError"],"sources":["../../../../libs/one/src/lib/shared/ui/icon/type/magmonium.ts","../../../../libs/one/src/lib/shared/ui/icon/model/shared-icons.ts","../../../../libs/one/src/lib/shared/ui/icon/lib/lib-icon.ts","../../../../libs/one/src/lib/shared/config/size-context.token.ts","../../../../libs/one/src/lib/shared/lib/app-identity/app-logo-icon.ts","../../../../libs/one/src/lib/shared/ui/icon/ui/icon.ts","../../../../libs/one/src/lib/shared/ui/icon/lib/custom-icon.ts","../../../../libs/one/src/lib/shared/ui/icon/ui/custom-icon.ts","../../../../libs/one/src/lib/shared/ui/icon/ui/custom-icon-edit.ts"],"sourcesContent":["export const MAGMONIUM = `\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"-15 -15 120 165\">\n <g>\n <path fill=\"#color\" style=\"opacity: 0.7;\" d=\"M5 5 L5 65 L85 65 Z\" />\n <path fill=\"#color\" style=\"opacity: 0.3;\" d=\"M85 5 L5 65 L85 65 Z\" />\n </g>\n <g>\n <path fill=\"#color\" style=\"opacity: 0.3;\" d=\"M5 70 L85 70 L5 130 Z\" />\n <path fill=\"#color\" style=\"opacity: 0.7;\" d=\"M85 70 L5 70 L85 130 Z\" />\n </g>\n </svg>\n `;\n","// AUTO-GENERATED by assets:compile — do not edit manually\nexport const SHARED_ICONS = [\n 'accordion_chevron',\n 'account_balance_wallet',\n 'activity',\n 'add-image',\n 'adjust',\n 'alert-circle',\n 'analytics',\n 'apps',\n 'arrow-down',\n 'arrow-left',\n 'arrow-left-right',\n 'arrow-right',\n 'arrow-up',\n 'arrow_back',\n 'bell',\n 'bold',\n 'books',\n 'calendar',\n 'calendar-open',\n 'camera',\n 'chat',\n 'check',\n 'chevron-down',\n 'chevron-left',\n 'chevron-right',\n 'chevron-up',\n 'chevron_left',\n 'chevrons-down',\n 'chevrons-left',\n 'chevrons-right',\n 'chevrons-up',\n 'clipboard',\n 'code',\n 'coins',\n 'color-picker',\n 'copy',\n 'copyright',\n 'corner-left-up',\n 'currency_exchange',\n 'dot',\n 'download',\n 'ellipsis-vertical',\n 'exclamation-triangle',\n 'eye',\n 'eye_close',\n 'file-code',\n 'file-data',\n 'file-image',\n 'file-markup',\n 'file-style',\n 'file-text',\n 'fixed',\n 'flower',\n 'folder',\n 'games',\n 'gear',\n 'heading',\n 'heart',\n 'heart_filled',\n 'help',\n 'hero',\n 'info',\n 'install',\n 'instrument',\n 'investments',\n 'italic',\n 'language',\n 'layers',\n 'layouts',\n 'link',\n 'link-broken',\n 'list',\n 'loading',\n 'loading-bars',\n 'loading-dots',\n 'loading-logo',\n 'loading-pulse',\n 'location',\n 'lock',\n 'logo',\n 'magazines',\n 'mail',\n 'menu',\n 'mic',\n 'minus',\n 'monitor',\n 'more',\n 'notification',\n 'notification_off',\n 'open',\n 'pause',\n 'pencil',\n 'play',\n 'plus',\n 'posts',\n 'quote',\n 'redo',\n 'reload',\n 'reset',\n 'save',\n 'scissors',\n 'search',\n 'section',\n 'security',\n 'settings',\n 'shield',\n 'smartphone',\n 'sort-alpha-asc',\n 'sort-alpha-desc',\n 'sparkles',\n 'square',\n 'star',\n 'store',\n 'strategies',\n 'strikethrough',\n 'sun',\n 'table',\n 'tablet',\n 'target',\n 'theme',\n 'trash',\n 'trash-2',\n 'trending-down',\n 'trending-up',\n 'undo',\n 'user',\n 'users',\n 'wallet_manager',\n 'wallet_owner',\n 'wallet_shareholder',\n 'wand',\n 'wifi',\n 'wrench',\n 'x',\n 'zap',\n];\n","import { Icon, MAGMONIUM } from '../type/icon';\nimport { ElementRef } from '@angular/core';\nimport { SHARED_ICONS } from '../model/shared-icons';\nexport { SHARED_ICONS };\n\nexport function isOneIcon(element: ElementRef<HTMLElement>, config?: Icon) {\n if (typeof config?.one !== 'undefined') {\n return !!config.one;\n }\n\n // cast SHARED_ICONS to a generic string array for runtime includes check\n if (config?.name && (SHARED_ICONS as readonly string[]).includes(config.name)) {\n return true;\n }\n\n const tagName = element.nativeElement.tagName;\n return tagName === 'M-ONE-ICON';\n}\n\nfunction textToSvg(str = MAGMONIUM, color: string): string {\n if (typeof str !== 'string') return str as unknown as string;\n return str.replace(/#color/g, color).replace(/currentColor/g, color);\n}\n\nexport function svgElementFromString(str: string, color: string): SVGElement {\n const parser = new DOMParser();\n const doc = parser.parseFromString(textToSvg(str, color), 'image/svg+xml');\n const svg = doc.documentElement;\n\n if (svg && svg.nodeName === 'svg') {\n return svg as unknown as SVGElement;\n }\n\n const errorSvg = parser.parseFromString(textToSvg(MAGMONIUM, color), 'image/svg+xml');\n return errorSvg.documentElement as unknown as SVGElement;\n}\n","import { inject, InjectionToken, Provider, Signal, Type } from '@angular/core';\nimport { Size } from '../enum/scaling/size';\n\n/**\n * The Size in force for a subtree. Provided by the only components that may\n * declare one — Section, ButtonGroup, and the markup-composed SectionButtonGroup\n * (the last two are one seat, ADR 0008) — and injected `{ optional: true }` by\n * each of them (so a declarer falls back to the nearest one above it) and by\n * the few primitives whose size is a box dimension rather than a font size.\n *\n * Most components need nothing: a declarer also sets `font-size` on its own\n * host, so anything measured in `em` follows through ordinary CSS inheritance.\n * The token exists for what inheritance cannot do — a ButtonGroup or\n * SectionButtonGroup overriding its Section, and Icon sizing a square glyph.\n * See ADR 0008.\n */\nexport interface SizeContext {\n readonly size: Signal<Size>;\n}\n\nexport const SIZE_CONTEXT = new InjectionToken<SizeContext>('SIZE_CONTEXT');\n\nexport interface SizeDeclarer {\n readonly resolvedSize: Signal<Size>;\n}\n\n/**\n * Publishes a declarer's resolved Size to its subtree. Goes in `providers` and\n * never `viewProviders`: a Section's Cols and a ButtonGroup's Buttons are\n * projected content, which only `providers` reaches.\n */\nexport function provideSizeContext(\n declarer: Type<SizeDeclarer>\n): Provider {\n return {\n provide: SIZE_CONTEXT,\n useFactory: (): SizeContext => ({ size: inject(declarer).resolvedSize }),\n };\n}\n\n/**\n * The Size in force above a declarer. `skipSelf` because a declarer provides\n * SIZE_CONTEXT itself, and injecting its own provider would be circular — what\n * it wants is the nearest declarer *above* it, so that a Section with no Size\n * of its own takes its parent Section's and a ButtonGroup takes its Section's.\n */\nexport function injectParentSize(): SizeContext | null {\n return inject(SIZE_CONTEXT, { optional: true, skipSelf: true });\n}\n","/**\n * The reserved icon name that draws the running app's own AppLogo as a glyph\n * (GLOSSARY.md AppLogoIcon). Never an IconAsset or a file in `icons/`: `m-icon`\n * reads it from APP_LOGO_SOURCE instead of fetching anything. Its own file so\n * codegen can read it without Angular.\n */\nexport const APP_LOGO_ICON = 'app_logo';\n","import {\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n computed,\n effect,\n ElementRef,\n inject,\n input,\n model,\n untracked,\n} from '@angular/core';\nimport { Icon, MAGMONIUM } from '../type/icon';\nimport { isOneIcon, svgElementFromString } from '../lib/lib-icon';\nimport { SIZE_CONTEXT } from '../../../config/size-context.token';\nimport { resolveIconSize } from '../../../functions/size/size-converter';\nimport { AssetStore } from '../../../stores/asset.store';\nimport { HttpService } from '../../../services/http';\nimport { rxResource } from '@angular/core/rxjs-interop';\nimport { catchError } from 'rxjs/operators';\nimport { of } from 'rxjs';\nimport { applyColorsToElement, ThemeStore } from '../../../lib/theme';\nimport { ICON_SOURCE } from '../../../config/tokens';\nimport { APP_LOGO_ICON } from '../../../lib/app-identity/app-logo-icon';\nimport {\n APP_LOGO_SOURCE,\n AppLogoSource,\n} from '../../../lib/app-identity/app-logo-source';\nimport { logoGlyphMaskUrl } from '../../../lib/app-identity/logo-glyph';\n\n@Component({\n selector: 'm-icon, m-one-icon',\n template: `<ng-content></ng-content>`,\n styleUrls: ['./icon.sass'],\n host: {\n '[class.has-color]': 'resolvedConfig()?.color',\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class IconComponent {\n // Kept for the callers that hand an Icon a whole object rather than write it\n // out — a Button naming its own glyph, a SectionFormItem passing a Field's.\n config = model<Icon | undefined>(undefined);\n\n // `name` is the SVG's filename in `mag_assets/icons/`, not a config asset:\n // an Icon resolves artwork, so it is the one primitive whose name points at\n // a picture rather than at a description of itself (ADR 0010). `size` is a\n // free length (number → em), not a Size — Size stays on Section / ButtonGroup\n // (ADR 0008); set here only to overwrite the box SIZE_CONTEXT would give.\n readonly name = input<string | undefined>();\n readonly color = input<string | undefined>();\n readonly size = input<number | string | undefined>();\n readonly one = input<boolean | undefined>();\n readonly baseUrl = input<string | undefined>();\n readonly remote = input<string | undefined>();\n readonly shadow = input<boolean | undefined, unknown>(undefined, {\n transform: booleanAttribute,\n });\n\n // Attributes win over the bound object, and an omitted one leaves the\n // object's key standing rather than blanking it.\n protected readonly resolvedConfig = computed<Icon | undefined>(() => {\n const config = this.config();\n const overrides: Icon = {};\n const name = this.name();\n if (name !== undefined) overrides.name = name;\n const color = this.color();\n if (color !== undefined) overrides.color = color;\n const one = this.one();\n if (one !== undefined) overrides.one = one;\n const baseUrl = this.baseUrl();\n if (baseUrl !== undefined) overrides.baseUrl = baseUrl;\n const remote = this.remote();\n if (remote !== undefined) overrides.remote = remote;\n const shadow = this.shadow();\n if (shadow !== undefined) overrides.shadow = shadow;\n if (!config && !Object.keys(overrides).length) return undefined;\n return { ...config, ...overrides };\n });\n\n private readonly elementRef = inject(ElementRef);\n // Icon sizes a square glyph through width/height, which no amount of\n // inherited font-size can set — so it is one of the few primitives that\n // reads the Size in force directly (ADR 0008).\n private readonly sizeContext = inject(SIZE_CONTEXT, { optional: true });\n private readonly assetStore = inject(AssetStore);\n private readonly http = inject(HttpService);\n private currentSvgElement: Element | null = null;\n private readonly themeStore = inject(ThemeStore);\n private readonly isOneIcon = computed(() =>\n isOneIcon(this.elementRef, this.resolvedConfig())\n );\n private readonly remoteBaseUrl = computed<string | undefined>(() => {\n const remoteId = this.resolvedConfig()?.remote;\n return remoteId ? this.http.buildWcAssetBaseUrl(remoteId) : undefined;\n });\n\n // Icons supplied by name from memory (e.g. a visual editor's unsaved glyphs).\n // Read as a signal rather than through the resource below so that changing the\n // markup under an unchanged name repaints every icon already using it.\n private readonly iconSource = inject(ICON_SOURCE, { optional: true });\n private readonly inlineSvg = computed(() => {\n const name = this.resolvedConfig()?.name;\n return name ? this.iconSource?.()?.[name] : undefined;\n });\n\n // `app_logo` draws the running app's own AppLogo (GLOSSARY.md AppLogoIcon):\n // nothing to fetch, and the LogoGlyph is painted through a mask rather than\n // inserted, so its markup never reaches the page (nx ADR 0007).\n private readonly appLogoSource = inject(APP_LOGO_SOURCE);\n private readonly appLogo = computed(() =>\n this.resolvedConfig()?.name === APP_LOGO_ICON\n ? this.appLogoSource() ?? {}\n : undefined\n );\n\n private readonly text = rxResource({\n params: computed(\n () => ({\n name: this.resolvedConfig()?.name,\n isOneIcon: untracked(() => this.isOneIcon()),\n remoteBaseUrl: this.remoteBaseUrl(),\n }),\n { equal: (a, b) => a?.name === b?.name && a?.remoteBaseUrl === b?.remoteBaseUrl }\n ),\n stream: ({ params: { name, isOneIcon, remoteBaseUrl } }) => {\n if (name === APP_LOGO_ICON) return of(undefined);\n if (!name) return untracked(() =>\n this.assetStore.resolve<string>('icons', 'logo', true).pipe(catchError(() => of(MAGMONIUM)))\n );\n // Skips the request entirely for an in-memory glyph — there is no asset\n // behind it, so fetching only ever produces a 404 and the fallback logo.\n const inline = untracked(() => this.inlineSvg());\n if (inline) return of(inline);\n return untracked(() =>\n this.assetStore\n .resolve<string>('icons', name, isOneIcon, remoteBaseUrl)\n .pipe(catchError(() => of(MAGMONIUM)))\n );\n },\n });\n\n private readonly pallet = computed(() =>\n applyColorsToElement(\n this.resolvedConfig()?.color ?? this.themeStore.color()?.mm ?? '#fff',\n this.themeStore.color(),\n this.elementRef.nativeElement\n )\n );\n\n constructor() {\n effect(this.updateElement);\n effect(this.applySize);\n effect(this.applyShadow);\n }\n\n // On the host, not the glyph: a filter on the masked AppLogoIcon would be\n // clipped by its own mask. Sized off the icon box so it scales with it.\n private readonly applyShadow = (): void => {\n const style = this.elementRef.nativeElement.style;\n if (!this.resolvedConfig()?.shadow) {\n style.removeProperty('filter');\n return;\n }\n const color =\n this.pallet()?.color ?? this.themeStore.color()?.mm ?? '#fff';\n style.setProperty(\n 'filter',\n `drop-shadow(0 calc(var(--m-icon-size, 1em) * 0.08) calc(var(--m-icon-size, 1em) * 0.06) color-mix(in srgb, ${color} 80%, black))`\n );\n };\n\n private readonly applySize = (): void => {\n this.elementRef.nativeElement.style.setProperty(\n '--m-icon-size',\n resolveIconSize(this.size(), this.sizeContext?.size())\n );\n };\n\n private readonly updateElement = (): void => {\n const element = this.elementRef.nativeElement;\n if (this.currentSvgElement) {\n this.currentSvgElement.remove();\n this.currentSvgElement = null;\n }\n const color = this.pallet()?.color ?? this.themeStore.color()?.mm ?? '#fff';\n const appLogo = this.appLogo();\n const mark = appLogo ? appLogoElement(appLogo, color) : null;\n if (mark) {\n this.currentSvgElement = mark;\n element.prepend(mark);\n return;\n }\n const svg = svgElementFromString(\n this.inlineSvg() ?? (this.text.value() as string),\n color\n );\n if (!svg) return;\n this.currentSvgElement = svg;\n svg.removeAttribute('width');\n svg.removeAttribute('height');\n svg.style.width = 'var(--m-icon-size, 1em)';\n svg.style.height = 'var(--m-icon-size, 1em)';\n svg.style.flexShrink = '0';\n svg.removeAttribute('stroke-width');\n svg.style.setProperty('stroke-width', '2px');\n svg.querySelectorAll('*').forEach((el) => {\n el.removeAttribute('stroke-width');\n if (el instanceof HTMLElement || el instanceof SVGElement) {\n el.style.removeProperty('stroke-width');\n }\n });\n element.prepend(svg);\n };\n}\n\n// Inline styles, like the SVG above: an element built here carries no\n// encapsulation attribute, so the component's sass never reaches it.\n// Null when there is nothing to draw at all — no glyph, no file, no name —\n// so the icon falls through to the Magmonium mark rather than an empty box.\nconst appLogoElement = (\n logo: AppLogoSource,\n color: string\n): HTMLElement | null => {\n const mark = document.createElement('span');\n mark.className = 'm-icon__app-logo';\n const style = mark.style;\n style.width = 'var(--m-icon-size, 1em)';\n style.height = 'var(--m-icon-size, 1em)';\n style.flexShrink = '0';\n const mask = logo.glyph\n ? logoGlyphMaskUrl(logo.glyph)\n : logo.src\n ? `url(\"${encodeURI(logo.src)}\")`\n : undefined;\n if (mask) {\n style.backgroundColor = color;\n style.setProperty('mask-image', mask);\n style.setProperty('mask-size', 'contain');\n style.setProperty('mask-repeat', 'no-repeat');\n style.setProperty('mask-position', 'center');\n return mark;\n }\n // No LogoGlyph yet: the first letter, as an AppLogo shows it.\n const letter = (logo.name?.trim().charAt(0) ?? '').toUpperCase();\n if (!letter) return null;\n mark.textContent = letter;\n style.display = 'inline-flex';\n style.alignItems = 'center';\n style.justifyContent = 'center';\n style.color = color;\n style.fontSize = 'calc(var(--m-icon-size, 1em) * 0.8)';\n style.fontWeight = '600';\n style.lineHeight = '1';\n return mark;\n};\n","import { CustomIcon } from '../type/icon';\nimport { ThemeColor } from '@magmonium/cli';\n\nfunction genColor(colors: ThemeColor, color: string) {\n return colors[color as keyof ThemeColor] ?? color;\n}\n\nexport function isLargeImage(svg: CustomIcon): boolean {\n const width = svg.width || 0;\n const height = svg.height || 0;\n const area = width * height;\n return area > 2000000 || width > 2000 || height > 2000;\n}\n\nexport function genViewPort(svg: CustomIcon | undefined) {\n if (!svg) return '0 0 0 0';\n const width = svg.width || 0;\n const height = svg.height || 0;\n return `0 0 ${width} ${height}`;\n}\n\nexport function computedFillColor(\n svg: CustomIcon,\n colors?: ThemeColor,\n fillColor?: string\n) {\n const { lineColor, backgroundColor, invertSvg } = svg.edit;\n if (!colors) {\n return fillColor ?? backgroundColor;\n }\n return genColor(\n colors,\n invertSvg ? lineColor : (fillColor ?? backgroundColor)\n );\n}\n\nexport function computeLineColor(\n svg: CustomIcon,\n colors?: ThemeColor,\n strokeColor?: string\n) {\n const { lineColor, backgroundColor, invertSvg } = svg.edit;\n if (!colors) {\n return strokeColor ?? lineColor;\n }\n return genColor(\n colors,\n invertSvg ? backgroundColor : (strokeColor ?? lineColor)\n );\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n inject,\n input,\n} from '@angular/core';\nimport { CustomIcon } from '../type/icon';\nimport {\n computedFillColor,\n computeLineColor,\n genViewPort,\n isLargeImage,\n} from '../lib/custom-icon';\nimport { ThemeStore } from '../../../lib/theme';\n\n@Component({\n selector: 'm-custom-icon',\n template: `\n <!-- eslint-disable local/no-raw-svg -->\n @if (svg(); as svg) {\n <svg\n xmlns=\"http:/www.w3.org/2000/svg\"\n [attr.viewBox]=\"viewBox()\"\n [attr.width]=\"svg.width\"\n [attr.height]=\"svg.height\"\n preserveAspectRatio=\"xMidYMid meet\"\n >\n @if (_fillColor(); as fillColor) {\n <rect\n [attr.width]=\"svg.width\"\n [attr.height]=\"svg.height\"\n [attr.fill]=\"fillColor\"\n />\n }\n @if (_strokeColor(); as stroke) {\n @for (path of svg?.paths; track $index) {\n <path\n class=\"svg-path\"\n [attr.d]=\"path\"\n [attr.fill]=\"'none'\"\n [attr.stroke]=\"stroke\"\n [attr.stroke-linecap]=\"svg?.edit?.linecap\"\n [attr.stroke-linejoin]=\"svg?.edit?.linejoin\"\n [attr.stroke-width]=\"svg.edit.strokeWidth\"\n [attr.vector-effect]=\"vectorEffect()\"\n />\n }\n }\n </svg>\n }\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class CustomIconClass {\n svg = input.required<CustomIcon>();\n strokeColor = input<string | undefined>(undefined);\n fillColor = input<string | undefined>(undefined);\n strokeWidth = input<number | undefined>(undefined);\n\n protected readonly viewBox = computed(() => genViewPort(this.svg()));\n protected readonly vectorEffect = computed(() => {\n return isLargeImage(this.svg()) ? 'non-scaling-stroke' : null;\n });\n private readonly themeStore = inject(ThemeStore);\n protected readonly _fillColor = computed(() =>\n computedFillColor(this.svg(), this.themeStore.color(), this.fillColor())\n );\n protected readonly _strokeColor = computed(() => {\n return computeLineColor(\n this.svg(),\n this.themeStore.color(),\n this.strokeColor()\n );\n });\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n HostListener,\n computed,\n inject,\n input,\n model,\n} from '@angular/core';\nimport { CustomIcon } from '../type/icon';\nimport {\n computedFillColor,\n computeLineColor,\n genViewPort,\n isLargeImage,\n} from '../lib/custom-icon';\nimport { ThemeStore } from '../../../lib/theme';\n\n@Component({\n selector: 'm-custom-icon-edit',\n imports: [],\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n <!-- eslint-disable local/no-raw-svg -->\n @if (svg(); as svg) {\n <svg\n xmlns=\"http:/www.w3.org/2000/svg\"\n [attr.viewBox]=\"_viewBox()\"\n [attr.width]=\"svg.width\"\n [attr.height]=\"svg.height\"\n preserveAspectRatio=\"xMidYMid meet\"\n >\n @if (_fillColor(); as fillColor) {\n <rect\n [attr.width]=\"svg.width\"\n [attr.height]=\"svg.height\"\n [attr.fill]=\"fillColor\"\n />\n }\n @for (path of svg.paths; track $index) {\n <path\n class=\"svg-path\"\n (click)=\"_onPathClick($index)\"\n [class.interactive]=\"svg.edit.canInteract\"\n [class.selected]=\"_selectedIndex.includes($index)\"\n [attr.d]=\"path\"\n [attr.fill]=\"'none'\"\n [attr.stroke]=\"_strokeColor()\"\n [attr.stroke-linecap]=\"svg.edit.linecap\"\n [attr.stroke-linejoin]=\"svg.edit.linejoin\"\n [attr.stroke-width]=\"svg.edit.strokeWidth\"\n [attr.vector-effect]=\"_vectorEffect()\"\n />\n }\n </svg>\n }\n `,\n styleUrl: './custom-icon-edit.sass',\n})\nexport class CustomIconEditComponent {\n svg = model<CustomIcon | undefined>(undefined);\n strokeColor = input<string | undefined>(undefined);\n fillColor = input<string | undefined>(undefined);\n\n private readonly themeStore = inject(ThemeStore);\n\n @HostListener('window:keydown', ['$event'])\n onKeydown(event: KeyboardEvent) {\n if (!this.svg()?.edit?.canInteract || this._selectedIndex.length === 0) {\n return;\n }\n if (event.key === ' ') {\n event.preventDefault();\n this.deleteSelectedPaths();\n } else if (event.key === 'Escape') {\n event.preventDefault();\n this._selectedIndex = [];\n }\n }\n\n protected readonly _viewBox = computed(() => genViewPort(this.svg()));\n\n protected readonly _vectorEffect = computed(() => {\n const svg = this.svg();\n return svg && isLargeImage(svg) ? 'non-scaling-stroke' : null;\n });\n\n protected readonly _fillColor = computed(() => {\n const svg = this.svg();\n if (!svg) return undefined;\n return computedFillColor(svg, this.themeStore.color(), this.fillColor());\n });\n\n protected readonly _strokeColor = computed(() => {\n const svg = this.svg();\n if (!svg) return undefined;\n return computeLineColor(svg, this.themeStore.color(), this.strokeColor());\n });\n\n protected readonly _onPathClick = (index: number) => {\n if (!this.svg()?.edit?.canInteract) return;\n this._selectedIndex = Array.from(new Set([...this._selectedIndex, index]));\n };\n\n readonly deleteSelectedPaths = () => {\n this.svg.update((prev) => {\n if (!prev) return prev;\n return {\n ...prev,\n paths: prev.paths.filter((_, i) => !this._selectedIndex.includes(i)),\n };\n });\n this._selectedIndex = [];\n };\n\n protected _selectedIndex: number[] = [];\n}\n"],"mappings":";;;;;;;;AAAA,MAAa,YAAY;;;;;;;;;;;;ACCzB,MAAa,eAAe;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD;ACpID,SAAgB,UAAU,SAAkC,QAAa;CACvE,IAAI,OAAO,QAAQ,QAAQ,aACzB,OAAO,CAAC,CAAC,OAAO;CAIlB,IAAI,QAAQ,QAAS,aAAmC,SAAS,OAAO,IAAI,GAC1E,OAAO;CAIT,OADgB,QAAQ,cAAc,YACnB;AACrB;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;;;;;;;;;EAkCT,UAAA;EAAA,QAAA,CAAA,ueAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAGU,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAuB,YAAA,CAAA;EAzCnC,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAoB,SACrB,CAAA;GAAE,iBACM,wBAAwB;GAAM,UACrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCT,QAAA,CAAA,ueAAA;EAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAUA,MAAA;GAAa,MAAA,CAAA,kBAAkB,CAAC,QAAQ,CAAC"}
1
+ {"version":3,"file":"magmonium-one-icon-CXFTG4mD.mjs","names":["catchError"],"sources":["../../../../libs/one/src/lib/shared/ui/icon/type/magmonium.ts","../../../../libs/one/src/lib/shared/ui/icon/model/shared-icons.ts","../../../../libs/one/src/lib/shared/ui/icon/lib/lib-icon.ts","../../../../libs/one/src/lib/shared/config/size-context.token.ts","../../../../libs/one/src/lib/shared/lib/app-identity/app-logo-icon.ts","../../../../libs/one/src/lib/shared/ui/icon/ui/icon.ts","../../../../libs/one/src/lib/shared/ui/icon/lib/custom-icon.ts","../../../../libs/one/src/lib/shared/ui/icon/ui/custom-icon.ts","../../../../libs/one/src/lib/shared/ui/icon/ui/custom-icon-edit.ts"],"sourcesContent":["export const MAGMONIUM = `\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"-15 -15 120 165\">\n <g>\n <path fill=\"#color\" style=\"opacity: 0.7;\" d=\"M5 5 L5 65 L85 65 Z\" />\n <path fill=\"#color\" style=\"opacity: 0.3;\" d=\"M85 5 L5 65 L85 65 Z\" />\n </g>\n <g>\n <path fill=\"#color\" style=\"opacity: 0.3;\" d=\"M5 70 L85 70 L5 130 Z\" />\n <path fill=\"#color\" style=\"opacity: 0.7;\" d=\"M85 70 L5 70 L85 130 Z\" />\n </g>\n </svg>\n `;\n","// AUTO-GENERATED by assets:compile — do not edit manually\nexport const SHARED_ICONS = [\n 'accordion_chevron',\n 'account_balance_wallet',\n 'activity',\n 'add-image',\n 'adjust',\n 'alert-circle',\n 'analytics',\n 'apps',\n 'arrow-down',\n 'arrow-left',\n 'arrow-left-right',\n 'arrow-right',\n 'arrow-up',\n 'arrow_back',\n 'bell',\n 'bold',\n 'books',\n 'calendar',\n 'calendar-open',\n 'camera',\n 'chat',\n 'check',\n 'chevron-down',\n 'chevron-left',\n 'chevron-right',\n 'chevron-up',\n 'chevron_left',\n 'chevrons-down',\n 'chevrons-left',\n 'chevrons-right',\n 'chevrons-up',\n 'clipboard',\n 'code',\n 'coins',\n 'color-picker',\n 'copy',\n 'copyright',\n 'corner-left-up',\n 'currency_exchange',\n 'dot',\n 'download',\n 'ellipsis-vertical',\n 'exclamation-triangle',\n 'eye',\n 'eye_close',\n 'file-code',\n 'file-data',\n 'file-image',\n 'file-markup',\n 'file-style',\n 'file-text',\n 'fixed',\n 'flower',\n 'folder',\n 'games',\n 'gear',\n 'heading',\n 'heart',\n 'heart_filled',\n 'help',\n 'hero',\n 'info',\n 'install',\n 'instrument',\n 'investments',\n 'italic',\n 'language',\n 'layers',\n 'layouts',\n 'link',\n 'link-broken',\n 'list',\n 'loading',\n 'loading-bars',\n 'loading-dots',\n 'loading-logo',\n 'loading-pulse',\n 'location',\n 'lock',\n 'logo',\n 'magazines',\n 'mail',\n 'menu',\n 'mic',\n 'minus',\n 'monitor',\n 'more',\n 'notification',\n 'notification_off',\n 'open',\n 'pause',\n 'pencil',\n 'play',\n 'plus',\n 'posts',\n 'quote',\n 'redo',\n 'reload',\n 'reset',\n 'save',\n 'scissors',\n 'search',\n 'section',\n 'security',\n 'settings',\n 'shield',\n 'smartphone',\n 'sort-alpha-asc',\n 'sort-alpha-desc',\n 'sparkles',\n 'square',\n 'star',\n 'store',\n 'strategies',\n 'strikethrough',\n 'sun',\n 'table',\n 'tablet',\n 'target',\n 'theme',\n 'trash',\n 'trash-2',\n 'trending-down',\n 'trending-up',\n 'undo',\n 'user',\n 'users',\n 'wallet_manager',\n 'wallet_owner',\n 'wallet_shareholder',\n 'wand',\n 'wifi',\n 'wrench',\n 'x',\n 'zap',\n];\n","import { Icon, MAGMONIUM } from '../type/icon';\nimport { ElementRef } from '@angular/core';\nimport { SHARED_ICONS } from '../model/shared-icons';\nexport { SHARED_ICONS };\n\nexport function isOneIcon(element: ElementRef<HTMLElement>, config?: Icon) {\n if (typeof config?.one !== 'undefined') {\n return !!config.one;\n }\n\n // cast SHARED_ICONS to a generic string array for runtime includes check\n if (config?.name && (SHARED_ICONS as readonly string[]).includes(config.name)) {\n return true;\n }\n\n const tagName = element.nativeElement.tagName;\n return tagName === 'M-ONE-ICON';\n}\n\nfunction textToSvg(str = MAGMONIUM, color: string): string {\n if (typeof str !== 'string') return str as unknown as string;\n return str.replace(/#color/g, color).replace(/currentColor/g, color);\n}\n\nexport function svgElementFromString(str: string, color: string): SVGElement {\n const parser = new DOMParser();\n const doc = parser.parseFromString(textToSvg(str, color), 'image/svg+xml');\n const svg = doc.documentElement;\n\n if (svg && svg.nodeName === 'svg') {\n return svg as unknown as SVGElement;\n }\n\n const errorSvg = parser.parseFromString(textToSvg(MAGMONIUM, color), 'image/svg+xml');\n return errorSvg.documentElement as unknown as SVGElement;\n}\n","import { inject, InjectionToken, Provider, Signal, Type } from '@angular/core';\nimport { Size } from '../enum/scaling/size';\n\n/**\n * The Size in force for a subtree. Provided by the only components that may\n * declare one — Section, ButtonGroup, and the markup-composed SectionButtonGroup\n * (the last two are one seat, ADR 0008) — and injected `{ optional: true }` by\n * each of them (so a declarer falls back to the nearest one above it) and by\n * the few primitives whose size is a box dimension rather than a font size.\n *\n * Most components need nothing: a declarer also sets `font-size` on its own\n * host, so anything measured in `em` follows through ordinary CSS inheritance.\n * The token exists for what inheritance cannot do — a ButtonGroup or\n * SectionButtonGroup overriding its Section, and Icon sizing a square glyph.\n * See ADR 0008.\n */\nexport interface SizeContext {\n readonly size: Signal<Size>;\n}\n\nexport const SIZE_CONTEXT = new InjectionToken<SizeContext>('SIZE_CONTEXT');\n\nexport interface SizeDeclarer {\n readonly resolvedSize: Signal<Size>;\n}\n\n/**\n * Publishes a declarer's resolved Size to its subtree. Goes in `providers` and\n * never `viewProviders`: a Section's Cols and a ButtonGroup's Buttons are\n * projected content, which only `providers` reaches.\n */\nexport function provideSizeContext(\n declarer: Type<SizeDeclarer>\n): Provider {\n return {\n provide: SIZE_CONTEXT,\n useFactory: (): SizeContext => ({ size: inject(declarer).resolvedSize }),\n };\n}\n\n/**\n * The Size in force above a declarer. `skipSelf` because a declarer provides\n * SIZE_CONTEXT itself, and injecting its own provider would be circular — what\n * it wants is the nearest declarer *above* it, so that a Section with no Size\n * of its own takes its parent Section's and a ButtonGroup takes its Section's.\n */\nexport function injectParentSize(): SizeContext | null {\n return inject(SIZE_CONTEXT, { optional: true, skipSelf: true });\n}\n","/**\n * The reserved icon name that draws the running app's own AppLogo as a glyph\n * (GLOSSARY.md AppLogoIcon). Never an IconAsset or a file in `icons/`: `m-icon`\n * reads it from APP_LOGO_SOURCE instead of fetching anything. Its own file so\n * codegen can read it without Angular.\n */\nexport const APP_LOGO_ICON = 'app_logo';\n","import {\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n computed,\n effect,\n ElementRef,\n inject,\n input,\n model,\n untracked,\n} from '@angular/core';\nimport { Icon, MAGMONIUM } from '../type/icon';\nimport { isOneIcon, svgElementFromString } from '../lib/lib-icon';\nimport { SIZE_CONTEXT } from '../../../config/size-context.token';\nimport { resolveIconSize } from '../../../functions/size/size-converter';\nimport { AssetStore } from '../../../stores/asset.store';\nimport { HttpService } from '../../../services/http';\nimport { rxResource } from '@angular/core/rxjs-interop';\nimport { catchError } from 'rxjs/operators';\nimport { of } from 'rxjs';\nimport { applyColorsToElement, ThemeStore } from '../../../lib/theme';\nimport { ICON_SOURCE } from '../../../config/tokens';\nimport { APP_LOGO_ICON } from '../../../lib/app-identity/app-logo-icon';\nimport {\n APP_LOGO_SOURCE,\n AppLogoSource,\n} from '../../../lib/app-identity/app-logo-source';\nimport { logoGlyphMaskUrl } from '../../../lib/app-identity/logo-glyph';\n\n@Component({\n selector: 'm-icon, m-one-icon',\n template: `<ng-content></ng-content>`,\n styleUrls: ['./icon.sass'],\n host: {\n '[class.has-color]': 'resolvedConfig()?.color',\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class IconComponent {\n // Kept for the callers that hand an Icon a whole object rather than write it\n // out — a Button naming its own glyph, a SectionFormItem passing a Field's.\n config = model<Icon | undefined>(undefined);\n\n // `name` is the SVG's filename in `mag_assets/icons/`, not a config asset:\n // an Icon resolves artwork, so it is the one primitive whose name points at\n // a picture rather than at a description of itself (ADR 0010). `size` is a\n // free length (number → em), not a Size — Size stays on Section / ButtonGroup\n // (ADR 0008); set here only to overwrite the box SIZE_CONTEXT would give.\n readonly name = input<string | undefined>();\n readonly color = input<string | undefined>();\n readonly size = input<number | string | undefined>();\n readonly one = input<boolean | undefined>();\n readonly baseUrl = input<string | undefined>();\n readonly remote = input<string | undefined>();\n readonly shadow = input<boolean | undefined, unknown>(undefined, {\n transform: booleanAttribute,\n });\n\n // Attributes win over the bound object, and an omitted one leaves the\n // object's key standing rather than blanking it.\n protected readonly resolvedConfig = computed<Icon | undefined>(() => {\n const config = this.config();\n const overrides: Icon = {};\n const name = this.name();\n if (name !== undefined) overrides.name = name;\n const color = this.color();\n if (color !== undefined) overrides.color = color;\n const one = this.one();\n if (one !== undefined) overrides.one = one;\n const baseUrl = this.baseUrl();\n if (baseUrl !== undefined) overrides.baseUrl = baseUrl;\n const remote = this.remote();\n if (remote !== undefined) overrides.remote = remote;\n const shadow = this.shadow();\n if (shadow !== undefined) overrides.shadow = shadow;\n if (!config && !Object.keys(overrides).length) return undefined;\n return { ...config, ...overrides };\n });\n\n private readonly elementRef = inject(ElementRef);\n // Icon sizes a square glyph through width/height, which no amount of\n // inherited font-size can set — so it is one of the few primitives that\n // reads the Size in force directly (ADR 0008).\n private readonly sizeContext = inject(SIZE_CONTEXT, { optional: true });\n private readonly assetStore = inject(AssetStore);\n private readonly http = inject(HttpService);\n private currentSvgElement: Element | null = null;\n private readonly themeStore = inject(ThemeStore);\n private readonly isOneIcon = computed(() =>\n isOneIcon(this.elementRef, this.resolvedConfig())\n );\n private readonly remoteBaseUrl = computed<string | undefined>(() => {\n const remoteId = this.resolvedConfig()?.remote;\n return remoteId ? this.http.buildWcAssetBaseUrl(remoteId) : undefined;\n });\n\n // Icons supplied by name from memory (e.g. a visual editor's unsaved glyphs).\n // Read as a signal rather than through the resource below so that changing the\n // markup under an unchanged name repaints every icon already using it.\n private readonly iconSource = inject(ICON_SOURCE, { optional: true });\n private readonly inlineSvg = computed(() => {\n const name = this.resolvedConfig()?.name;\n return name ? this.iconSource?.()?.[name] : undefined;\n });\n\n // `app_logo` draws the running app's own AppLogo (GLOSSARY.md AppLogoIcon):\n // nothing to fetch, and the LogoGlyph is painted through a mask rather than\n // inserted, so its markup never reaches the page (nx ADR 0007).\n private readonly appLogoSource = inject(APP_LOGO_SOURCE);\n private readonly appLogo = computed(() =>\n this.resolvedConfig()?.name === APP_LOGO_ICON\n ? this.appLogoSource() ?? {}\n : undefined\n );\n\n private readonly text = rxResource({\n params: computed(\n () => ({\n name: this.resolvedConfig()?.name,\n isOneIcon: untracked(() => this.isOneIcon()),\n remoteBaseUrl: this.remoteBaseUrl(),\n }),\n { equal: (a, b) => a?.name === b?.name && a?.remoteBaseUrl === b?.remoteBaseUrl }\n ),\n stream: ({ params: { name, isOneIcon, remoteBaseUrl } }) => {\n if (name === APP_LOGO_ICON) return of(undefined);\n if (!name) return untracked(() =>\n this.assetStore.resolve<string>('icons', 'logo', true).pipe(catchError(() => of(MAGMONIUM)))\n );\n // Skips the request entirely for an in-memory glyph — there is no asset\n // behind it, so fetching only ever produces a 404 and the fallback logo.\n const inline = untracked(() => this.inlineSvg());\n if (inline) return of(inline);\n return untracked(() =>\n this.assetStore\n .resolve<string>('icons', name, isOneIcon, remoteBaseUrl)\n .pipe(catchError(() => of(MAGMONIUM)))\n );\n },\n });\n\n private readonly pallet = computed(() =>\n applyColorsToElement(\n this.resolvedConfig()?.color ?? this.themeStore.color()?.mm ?? '#fff',\n this.themeStore.color(),\n this.elementRef.nativeElement\n )\n );\n\n constructor() {\n effect(this.updateElement);\n effect(this.applySize);\n effect(this.applyShadow);\n }\n\n // On the host, not the glyph: a filter on the masked AppLogoIcon would be\n // clipped by its own mask. Sized off the icon box so it scales with it.\n private readonly applyShadow = (): void => {\n const style = this.elementRef.nativeElement.style;\n if (!this.resolvedConfig()?.shadow) {\n style.removeProperty('filter');\n return;\n }\n const color =\n this.pallet()?.color ?? this.themeStore.color()?.mm ?? '#fff';\n style.setProperty(\n 'filter',\n `drop-shadow(0 calc(var(--m-icon-size, 1em) * 0.08) calc(var(--m-icon-size, 1em) * 0.06) color-mix(in srgb, ${color} 80%, black))`\n );\n };\n\n private readonly applySize = (): void => {\n this.elementRef.nativeElement.style.setProperty(\n '--m-icon-size',\n resolveIconSize(this.size(), this.sizeContext?.size())\n );\n };\n\n private readonly updateElement = (): void => {\n const element = this.elementRef.nativeElement;\n if (this.currentSvgElement) {\n this.currentSvgElement.remove();\n this.currentSvgElement = null;\n }\n const color = this.pallet()?.color ?? this.themeStore.color()?.mm ?? '#fff';\n const appLogo = this.appLogo();\n const mark = appLogo ? appLogoElement(appLogo, color) : null;\n if (mark) {\n this.currentSvgElement = mark;\n element.prepend(mark);\n return;\n }\n const svg = svgElementFromString(\n this.inlineSvg() ?? (this.text.value() as string),\n color\n );\n if (!svg) return;\n this.currentSvgElement = svg;\n svg.removeAttribute('width');\n svg.removeAttribute('height');\n svg.style.width = 'var(--m-icon-size, 1em)';\n svg.style.height = 'var(--m-icon-size, 1em)';\n svg.style.flexShrink = '0';\n svg.removeAttribute('stroke-width');\n svg.style.setProperty('stroke-width', '2px');\n svg.querySelectorAll('*').forEach((el) => {\n el.removeAttribute('stroke-width');\n if (el instanceof HTMLElement || el instanceof SVGElement) {\n el.style.removeProperty('stroke-width');\n }\n });\n element.prepend(svg);\n };\n}\n\n// Inline styles, like the SVG above: an element built here carries no\n// encapsulation attribute, so the component's sass never reaches it.\n// Null when there is nothing to draw at all — no glyph, no file, no name —\n// so the icon falls through to the Magmonium mark rather than an empty box.\nconst appLogoElement = (\n logo: AppLogoSource,\n color: string\n): HTMLElement | null => {\n const mark = document.createElement('span');\n mark.className = 'm-icon__app-logo';\n const style = mark.style;\n style.width = 'var(--m-icon-size, 1em)';\n style.height = 'var(--m-icon-size, 1em)';\n style.flexShrink = '0';\n const mask = logo.glyph\n ? logoGlyphMaskUrl(logo.glyph)\n : logo.src\n ? `url(\"${encodeURI(logo.src)}\")`\n : undefined;\n if (mask) {\n style.backgroundColor = color;\n style.setProperty('mask-image', mask);\n style.setProperty('mask-size', 'contain');\n style.setProperty('mask-repeat', 'no-repeat');\n style.setProperty('mask-position', 'center');\n return mark;\n }\n // No LogoGlyph yet: the first letter, as an AppLogo shows it.\n const letter = (logo.name?.trim().charAt(0) ?? '').toUpperCase();\n if (!letter) return null;\n mark.textContent = letter;\n style.display = 'inline-flex';\n style.alignItems = 'center';\n style.justifyContent = 'center';\n style.color = color;\n style.fontSize = 'calc(var(--m-icon-size, 1em) * 0.8)';\n style.fontWeight = '600';\n style.lineHeight = '1';\n return mark;\n};\n","import { CustomIcon } from '../type/icon';\nimport { ThemeColor } from '@magmonium/cli';\n\nfunction genColor(colors: ThemeColor, color: string) {\n return colors[color as keyof ThemeColor] ?? color;\n}\n\nexport function isLargeImage(svg: CustomIcon): boolean {\n const width = svg.width || 0;\n const height = svg.height || 0;\n const area = width * height;\n return area > 2000000 || width > 2000 || height > 2000;\n}\n\nexport function genViewPort(svg: CustomIcon | undefined) {\n if (!svg) return '0 0 0 0';\n const width = svg.width || 0;\n const height = svg.height || 0;\n return `0 0 ${width} ${height}`;\n}\n\nexport function computedFillColor(\n svg: CustomIcon,\n colors?: ThemeColor,\n fillColor?: string\n) {\n const { lineColor, backgroundColor, invertSvg } = svg.edit;\n if (!colors) {\n return fillColor ?? backgroundColor;\n }\n return genColor(\n colors,\n invertSvg ? lineColor : (fillColor ?? backgroundColor)\n );\n}\n\nexport function computeLineColor(\n svg: CustomIcon,\n colors?: ThemeColor,\n strokeColor?: string\n) {\n const { lineColor, backgroundColor, invertSvg } = svg.edit;\n if (!colors) {\n return strokeColor ?? lineColor;\n }\n return genColor(\n colors,\n invertSvg ? backgroundColor : (strokeColor ?? lineColor)\n );\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n inject,\n input,\n} from '@angular/core';\nimport { CustomIcon } from '../type/icon';\nimport {\n computedFillColor,\n computeLineColor,\n genViewPort,\n isLargeImage,\n} from '../lib/custom-icon';\nimport { ThemeStore } from '../../../lib/theme';\n\n@Component({\n selector: 'm-custom-icon',\n template: `\n <!-- eslint-disable local/no-raw-svg -->\n @if (svg(); as svg) {\n <svg\n xmlns=\"http:/www.w3.org/2000/svg\"\n [attr.viewBox]=\"viewBox()\"\n [attr.width]=\"svg.width\"\n [attr.height]=\"svg.height\"\n preserveAspectRatio=\"xMidYMid meet\"\n >\n @if (_fillColor(); as fillColor) {\n <rect\n [attr.width]=\"svg.width\"\n [attr.height]=\"svg.height\"\n [attr.fill]=\"fillColor\"\n />\n }\n @if (_strokeColor(); as stroke) {\n @for (path of svg?.paths; track $index) {\n <path\n class=\"svg-path\"\n [attr.d]=\"path\"\n [attr.fill]=\"'none'\"\n [attr.stroke]=\"stroke\"\n [attr.stroke-linecap]=\"svg?.edit?.linecap\"\n [attr.stroke-linejoin]=\"svg?.edit?.linejoin\"\n [attr.stroke-width]=\"svg.edit.strokeWidth\"\n [attr.vector-effect]=\"vectorEffect()\"\n />\n }\n }\n </svg>\n }\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class CustomIconClass {\n svg = input.required<CustomIcon>();\n strokeColor = input<string | undefined>(undefined);\n fillColor = input<string | undefined>(undefined);\n strokeWidth = input<number | undefined>(undefined);\n\n protected readonly viewBox = computed(() => genViewPort(this.svg()));\n protected readonly vectorEffect = computed(() => {\n return isLargeImage(this.svg()) ? 'non-scaling-stroke' : null;\n });\n private readonly themeStore = inject(ThemeStore);\n protected readonly _fillColor = computed(() =>\n computedFillColor(this.svg(), this.themeStore.color(), this.fillColor())\n );\n protected readonly _strokeColor = computed(() => {\n return computeLineColor(\n this.svg(),\n this.themeStore.color(),\n this.strokeColor()\n );\n });\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n HostListener,\n computed,\n inject,\n input,\n model,\n} from '@angular/core';\nimport { CustomIcon } from '../type/icon';\nimport {\n computedFillColor,\n computeLineColor,\n genViewPort,\n isLargeImage,\n} from '../lib/custom-icon';\nimport { ThemeStore } from '../../../lib/theme';\n\n@Component({\n selector: 'm-custom-icon-edit',\n imports: [],\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n <!-- eslint-disable local/no-raw-svg -->\n @if (svg(); as svg) {\n <svg\n xmlns=\"http:/www.w3.org/2000/svg\"\n [attr.viewBox]=\"_viewBox()\"\n [attr.width]=\"svg.width\"\n [attr.height]=\"svg.height\"\n preserveAspectRatio=\"xMidYMid meet\"\n >\n @if (_fillColor(); as fillColor) {\n <rect\n [attr.width]=\"svg.width\"\n [attr.height]=\"svg.height\"\n [attr.fill]=\"fillColor\"\n />\n }\n @for (path of svg.paths; track $index) {\n <path\n class=\"svg-path\"\n (click)=\"_onPathClick($index)\"\n [class.interactive]=\"svg.edit.canInteract\"\n [class.selected]=\"_selectedIndex.includes($index)\"\n [attr.d]=\"path\"\n [attr.fill]=\"'none'\"\n [attr.stroke]=\"_strokeColor()\"\n [attr.stroke-linecap]=\"svg.edit.linecap\"\n [attr.stroke-linejoin]=\"svg.edit.linejoin\"\n [attr.stroke-width]=\"svg.edit.strokeWidth\"\n [attr.vector-effect]=\"_vectorEffect()\"\n />\n }\n </svg>\n }\n `,\n styleUrl: './custom-icon-edit.sass',\n})\nexport class CustomIconEditComponent {\n svg = model<CustomIcon | undefined>(undefined);\n strokeColor = input<string | undefined>(undefined);\n fillColor = input<string | undefined>(undefined);\n\n private readonly themeStore = inject(ThemeStore);\n\n @HostListener('window:keydown', ['$event'])\n onKeydown(event: KeyboardEvent) {\n if (!this.svg()?.edit?.canInteract || this._selectedIndex.length === 0) {\n return;\n }\n if (event.key === ' ') {\n event.preventDefault();\n this.deleteSelectedPaths();\n } else if (event.key === 'Escape') {\n event.preventDefault();\n this._selectedIndex = [];\n }\n }\n\n protected readonly _viewBox = computed(() => genViewPort(this.svg()));\n\n protected readonly _vectorEffect = computed(() => {\n const svg = this.svg();\n return svg && isLargeImage(svg) ? 'non-scaling-stroke' : null;\n });\n\n protected readonly _fillColor = computed(() => {\n const svg = this.svg();\n if (!svg) return undefined;\n return computedFillColor(svg, this.themeStore.color(), this.fillColor());\n });\n\n protected readonly _strokeColor = computed(() => {\n const svg = this.svg();\n if (!svg) return undefined;\n return computeLineColor(svg, this.themeStore.color(), this.strokeColor());\n });\n\n protected readonly _onPathClick = (index: number) => {\n if (!this.svg()?.edit?.canInteract) return;\n this._selectedIndex = Array.from(new Set([...this._selectedIndex, index]));\n };\n\n readonly deleteSelectedPaths = () => {\n this.svg.update((prev) => {\n if (!prev) return prev;\n return {\n ...prev,\n paths: prev.paths.filter((_, i) => !this._selectedIndex.includes(i)),\n };\n });\n this._selectedIndex = [];\n };\n\n protected _selectedIndex: number[] = [];\n}\n"],"mappings":";;;;;;;;AAAA,MAAa,YAAY;;;;;;;;;;;;ACCzB,MAAa,eAAe;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA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AAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAuB,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAvB,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAuB,cAAA;EAAA,UAAA;EAAA,QAAA;GAAA,KAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,aAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,WAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,SAAA,EAAA,KAAA,YAAA;EAAA,MAAA,EAAA,WAAA,EAAA,kBAAA,oBAAA,EAAA;EAAA,UAAA;EAAA,UArCxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkCT,UAAA;EAAA,QAAA,CAAA,ueAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAGU,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAuB,YAAA,CAAA;EAzCnC,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAoB,SACrB,CAAA;GAAE,iBACM,wBAAwB;GAAM,UACrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCT,QAAA,CAAA,ueAAA;EAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAUA,MAAA;GAAa,MAAA,CAAA,kBAAkB,CAAC,QAAQ,CAAC"}
@@ -1,7 +1,7 @@
1
- import { t as ButtonComponent } from "./magmonium-one-button-C5dk4R_m.mjs";
1
+ import { t as ButtonComponent } from "./magmonium-one-button-DC_fLy-J.mjs";
2
2
  import { t as InputType } from "./magmonium-one-input-DqHPorA1.mjs";
3
- import { t as HeaderComponent } from "./magmonium-one-header-BZzD8uTJ.mjs";
4
- import { t as RangeInputComponent } from "./magmonium-one-range-CR8go24u.mjs";
3
+ import { t as HeaderComponent } from "./magmonium-one-header-BC-74GOn.mjs";
4
+ import { t as RangeInputComponent } from "./magmonium-one-range-Dw4YACtP.mjs";
5
5
  import { a as initialFraming, c as parseRatio, i as encodeFramed, l as renameForType, n as cropRect, r as drawFramed, s as outputSize, t as clampFraming } from "./magmonium-one-image-frame-BTSaUSAi.mjs";
6
6
  import { MODAL_REF } from "./magmonium-one.mjs";
7
7
  import * as i0 from "@angular/core";
@@ -305,6 +305,7 @@ var ImageEditorComponent = class ImageEditorComponent {
305
305
  "icon",
306
306
  "isRightIcon",
307
307
  "iconOnly",
308
+ "size",
308
309
  "stacked",
309
310
  "imgSrc",
310
311
  "nonClickable",
@@ -435,4 +436,4 @@ i0.ɵɵngDeclareClassMetadata({
435
436
  });
436
437
  export { ImageEditorComponent };
437
438
 
438
- //# sourceMappingURL=magmonium-one-image-editor-BV0x-SA3.mjs.map
439
+ //# sourceMappingURL=magmonium-one-image-editor-BAF7cdC2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"magmonium-one-image-editor-BV0x-SA3.mjs","names":[],"sources":["../../../../libs/one/src/lib/shared/ui/input/ui/file-upload-input/image-editor.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n computed,\n DestroyRef,\n effect,\n ElementRef,\n inject,\n input,\n signal,\n viewChild,\n} from '@angular/core';\nimport { ButtonComponent } from '../../../button/ui/button';\nimport { HeaderComponent } from '../../../header';\nimport { RangeInputComponent } from '../range/range';\nimport { InputType, RangeInput } from '../../model/input';\nimport { MODAL_REF, ModalRef } from '../../../../config/modal-ref';\nimport {\n clampFraming,\n cropRect,\n drawFramed,\n encodeFramed,\n Framing,\n FrameSize,\n initialFraming,\n MAX_ZOOM,\n MIN_ZOOM,\n outputSize,\n parseRatio,\n renameForType,\n} from './image-frame';\n\n/**\n * What an ImageEditor closes with. The framed file on an apply, `unreadable`\n * when the picture never decoded, and neither for a dismissal — a flat object\n * rather than a union, so the web-component build (no `strict`) reads it too.\n */\nexport type ImageEditorResult = { file?: File; unreadable?: boolean };\n\ntype Point = { x: number; y: number };\n\nconst WHEEL_ZOOM_RATE = 0.0015;\n\nconst distance = (a: Point, b: Point): number =>\n Math.hypot(a.x - b.x, a.y - b.y);\n\n@Component({\n selector: 'm-image-editor',\n template: `\n <div class=\"image-editor\">\n <m-header\n [level]=\"3\"\n label=\"edit-image-size\"\n [params]=\"sizeParams()\"\n />\n <div\n #stage\n class=\"image-editor__stage\"\n [style.aspect-ratio]=\"aspect()\"\n [style.--m-image-editor-aspect]=\"aspect()\"\n [class.image-editor__stage--panning]=\"isPanning()\"\n (pointerdown)=\"onPointerDown($event)\"\n (pointermove)=\"onPointerMove($event)\"\n (pointerup)=\"onPointerUp($event)\"\n (pointercancel)=\"onPointerUp($event)\"\n (wheel)=\"onWheel($event)\"\n >\n @if (sourceUrl(); as url) {\n <img\n class=\"image-editor__image\"\n [src]=\"url\"\n alt=\"\"\n draggable=\"false\"\n [style.width.px]=\"imageBox().width\"\n [style.height.px]=\"imageBox().height\"\n [style.transform]=\"imageBox().transform\"\n />\n }\n </div>\n <m-range\n [config]=\"zoomConfig()\"\n [value]=\"zoomPercent()\"\n (valueChange)=\"onZoom($event)\"\n />\n <!-- asset: buttons/okay.yml. No cancel beside it: the Modal's own close\n is the cancel, and it drops the image the same way. -->\n <m-one-button\n name=\"okay\"\n label=\"apply\"\n [disabled]=\"!source() || isApplying()\"\n (clicked)=\"apply()\"\n />\n </div>\n `,\n imports: [ButtonComponent, HeaderComponent, RangeInputComponent],\n styleUrl: './image-editor.sass',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ImageEditorComponent {\n readonly file = input.required<File>();\n readonly ratio = input.required<string>();\n readonly width = input.required<number>();\n\n readonly #modalRef = inject<ModalRef<ImageEditorResult | undefined>>(MODAL_REF);\n private readonly stage = viewChild<ElementRef<HTMLDivElement>>('stage');\n\n protected readonly source = signal<ImageBitmap | undefined>(undefined);\n protected readonly sourceUrl = signal<string | undefined>(undefined);\n protected readonly isApplying = signal(false);\n private readonly framing = signal<Framing>({ cx: 0, cy: 0, zoom: MIN_ZOOM });\n private readonly stageWidth = signal(0);\n private readonly pointers = new Map<number, Point>();\n protected readonly isPanning = signal(false);\n #settled = false;\n\n protected readonly zoomConfig = computed<RangeInput>(() => ({\n name: 'zoom',\n label: 'zoom',\n type: InputType.RANGE,\n min: MIN_ZOOM * 100,\n max: MAX_ZOOM * 100,\n }));\n\n protected readonly aspect = computed(() => parseRatio(this.ratio()) ?? 1);\n\n private readonly output = computed<FrameSize | undefined>(() =>\n outputSize(this.ratio(), this.width())\n );\n\n protected readonly sizeParams = computed(() => {\n const size = this.output();\n return {\n width: String(size?.width ?? ''),\n height: String(size?.height ?? ''),\n };\n });\n\n private readonly imageSize = computed<FrameSize | undefined>(() => {\n const bitmap = this.source();\n return bitmap ? { width: bitmap.width, height: bitmap.height } : undefined;\n });\n\n protected readonly zoomPercent = computed(() =>\n String(Math.round(this.framing().zoom * 100))\n );\n\n /** The whole picture laid out so the box shows exactly the crop. */\n protected readonly imageBox = computed(() => {\n const image = this.imageSize();\n const stage = this.stageWidth();\n if (!image || !stage) return { width: 0, height: 0, transform: 'none' };\n const rect = cropRect(image, this.aspect(), this.framing());\n const scale = stage / rect.width;\n return {\n width: image.width * scale,\n height: image.height * scale,\n transform: `translate(${-rect.x * scale}px, ${-rect.y * scale}px)`,\n };\n });\n\n private readonly load = effect((onCleanup) => {\n const file = this.file();\n let cancelled = false;\n const url = URL.createObjectURL(file);\n this.sourceUrl.set(url);\n // EXIF orientation applied here, so the geometry below and the <img> the\n // stage draws agree on which way is up.\n createImageBitmap(file, { imageOrientation: 'from-image' })\n .then((bitmap) => {\n if (cancelled) {\n bitmap.close();\n return;\n }\n this.framing.set(\n initialFraming({ width: bitmap.width, height: bitmap.height })\n );\n this.source.set(bitmap);\n })\n .catch(() => {\n if (!cancelled) this.settle({ unreadable: true });\n });\n onCleanup(() => {\n cancelled = true;\n URL.revokeObjectURL(url);\n this.source()?.close();\n });\n });\n\n private readonly measure = effect((onCleanup) => {\n const stage = this.stage()?.nativeElement;\n if (!stage) return;\n this.stageWidth.set(stage.clientWidth);\n if (typeof ResizeObserver === 'undefined') return;\n const observer = new ResizeObserver(([entry]) =>\n this.stageWidth.set(entry.contentRect.width)\n );\n observer.observe(stage);\n onCleanup(() => observer.disconnect());\n });\n\n // The Modal's own close affordance destroys the body without a word, and a\n // dismissal is a cancel: whoever opened the editor is still waiting.\n private readonly reportDismissal = inject(DestroyRef).onDestroy(() =>\n this.settle(undefined)\n );\n\n protected onPointerDown = (event: PointerEvent): void => {\n if (!this.source()) return;\n (event.currentTarget as HTMLElement).setPointerCapture?.(event.pointerId);\n this.pointers.set(event.pointerId, { x: event.clientX, y: event.clientY });\n this.isPanning.set(true);\n };\n\n protected onPointerMove = (event: PointerEvent): void => {\n const previous = this.pointers.get(event.pointerId);\n if (!previous) return;\n const next = { x: event.clientX, y: event.clientY };\n const others = [...this.pointers.entries()].filter(\n ([id]) => id !== event.pointerId\n );\n if (others.length === 1) {\n // Pinch: the gap between two fingers is the zoom.\n const anchor = others[0][1];\n const before = distance(previous, anchor);\n if (before > 0) this.zoomBy(distance(next, anchor) / before);\n } else if (others.length === 0) {\n this.panBy(next.x - previous.x, next.y - previous.y);\n }\n this.pointers.set(event.pointerId, next);\n };\n\n protected onPointerUp = (event: PointerEvent): void => {\n this.pointers.delete(event.pointerId);\n this.isPanning.set(this.pointers.size > 0);\n };\n\n protected onWheel = (event: WheelEvent): void => {\n if (!this.source()) return;\n event.preventDefault();\n this.zoomBy(Math.exp(-event.deltaY * WHEEL_ZOOM_RATE));\n };\n\n protected onZoom = (percent: string): void => {\n const zoom = Number(percent) / 100;\n if (!Number.isFinite(zoom)) return;\n this.updateFraming((framing) => ({ ...framing, zoom }));\n };\n\n protected apply = async (): Promise<void> => {\n const bitmap = this.source();\n const image = this.imageSize();\n const output = this.output();\n if (!bitmap || !image || !output || this.isApplying()) return;\n this.isApplying.set(true);\n try {\n const rect = cropRect(image, this.aspect(), this.framing());\n const blob = await encodeFramed(drawFramed(bitmap, rect, output));\n const original = this.file();\n this.settle({\n file: new File([blob], renameForType(original.name, blob.type), {\n type: blob.type,\n lastModified: Date.now(),\n }),\n });\n } catch {\n this.settle({ unreadable: true });\n }\n };\n\n /** Screen pixels dragged, moved into source pixels at the current scale. */\n private panBy = (dx: number, dy: number): void => {\n const image = this.imageSize();\n const stage = this.stageWidth();\n if (!image || !stage) return;\n const rect = cropRect(image, this.aspect(), this.framing());\n const perPixel = rect.width / stage;\n this.updateFraming((framing) => ({\n ...framing,\n cx: framing.cx - dx * perPixel,\n cy: framing.cy - dy * perPixel,\n }));\n };\n\n private zoomBy = (factor: number): void => {\n this.updateFraming((framing) => ({\n ...framing,\n zoom: framing.zoom * factor,\n }));\n };\n\n private updateFraming = (change: (framing: Framing) => Framing): void => {\n const image = this.imageSize();\n if (!image) return;\n this.framing.update((framing) =>\n clampFraming(image, this.aspect(), change(framing))\n );\n };\n\n private settle = (result: ImageEditorResult | undefined): void => {\n if (this.#settled) return;\n this.#settled = true;\n this.#modalRef.close(result);\n };\n}\n"],"mappings":";;;;;;;;AAyCA,MAAM,kBAAkB;AAExB,MAAM,YAAY,GAAU,MAC1B,KAAK,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;AAsDjC,IAAa,uBAAb,MAAa,qBAAoB;CACtB,OAAO,MAAM,SAAgB,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAC7B,QAAQ,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAChC,QAAQ,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAEhC,YA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AAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,SAAO,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
1
+ {"version":3,"file":"magmonium-one-image-editor-BAF7cdC2.mjs","names":[],"sources":["../../../../libs/one/src/lib/shared/ui/input/ui/file-upload-input/image-editor.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n computed,\n DestroyRef,\n effect,\n ElementRef,\n inject,\n input,\n signal,\n viewChild,\n} from '@angular/core';\nimport { ButtonComponent } from '../../../button/ui/button';\nimport { HeaderComponent } from '../../../header';\nimport { RangeInputComponent } from '../range/range';\nimport { InputType, RangeInput } from '../../model/input';\nimport { MODAL_REF, ModalRef } from '../../../../config/modal-ref';\nimport {\n clampFraming,\n cropRect,\n drawFramed,\n encodeFramed,\n Framing,\n FrameSize,\n initialFraming,\n MAX_ZOOM,\n MIN_ZOOM,\n outputSize,\n parseRatio,\n renameForType,\n} from './image-frame';\n\n/**\n * What an ImageEditor closes with. The framed file on an apply, `unreadable`\n * when the picture never decoded, and neither for a dismissal — a flat object\n * rather than a union, so the web-component build (no `strict`) reads it too.\n */\nexport type ImageEditorResult = { file?: File; unreadable?: boolean };\n\ntype Point = { x: number; y: number };\n\nconst WHEEL_ZOOM_RATE = 0.0015;\n\nconst distance = (a: Point, b: Point): number =>\n Math.hypot(a.x - b.x, a.y - b.y);\n\n@Component({\n selector: 'm-image-editor',\n template: `\n <div class=\"image-editor\">\n <m-header\n [level]=\"3\"\n label=\"edit-image-size\"\n [params]=\"sizeParams()\"\n />\n <div\n #stage\n class=\"image-editor__stage\"\n [style.aspect-ratio]=\"aspect()\"\n [style.--m-image-editor-aspect]=\"aspect()\"\n [class.image-editor__stage--panning]=\"isPanning()\"\n (pointerdown)=\"onPointerDown($event)\"\n (pointermove)=\"onPointerMove($event)\"\n (pointerup)=\"onPointerUp($event)\"\n (pointercancel)=\"onPointerUp($event)\"\n (wheel)=\"onWheel($event)\"\n >\n @if (sourceUrl(); as url) {\n <img\n class=\"image-editor__image\"\n [src]=\"url\"\n alt=\"\"\n draggable=\"false\"\n [style.width.px]=\"imageBox().width\"\n [style.height.px]=\"imageBox().height\"\n [style.transform]=\"imageBox().transform\"\n />\n }\n </div>\n <m-range\n [config]=\"zoomConfig()\"\n [value]=\"zoomPercent()\"\n (valueChange)=\"onZoom($event)\"\n />\n <!-- asset: buttons/okay.yml. No cancel beside it: the Modal's own close\n is the cancel, and it drops the image the same way. -->\n <m-one-button\n name=\"okay\"\n label=\"apply\"\n [disabled]=\"!source() || isApplying()\"\n (clicked)=\"apply()\"\n />\n </div>\n `,\n imports: [ButtonComponent, HeaderComponent, RangeInputComponent],\n styleUrl: './image-editor.sass',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ImageEditorComponent {\n readonly file = input.required<File>();\n readonly ratio = input.required<string>();\n readonly width = input.required<number>();\n\n readonly #modalRef = inject<ModalRef<ImageEditorResult | undefined>>(MODAL_REF);\n private readonly stage = viewChild<ElementRef<HTMLDivElement>>('stage');\n\n protected readonly source = signal<ImageBitmap | undefined>(undefined);\n protected readonly sourceUrl = signal<string | undefined>(undefined);\n protected readonly isApplying = signal(false);\n private readonly framing = signal<Framing>({ cx: 0, cy: 0, zoom: MIN_ZOOM });\n private readonly stageWidth = signal(0);\n private readonly pointers = new Map<number, Point>();\n protected readonly isPanning = signal(false);\n #settled = false;\n\n protected readonly zoomConfig = computed<RangeInput>(() => ({\n name: 'zoom',\n label: 'zoom',\n type: InputType.RANGE,\n min: MIN_ZOOM * 100,\n max: MAX_ZOOM * 100,\n }));\n\n protected readonly aspect = computed(() => parseRatio(this.ratio()) ?? 1);\n\n private readonly output = computed<FrameSize | undefined>(() =>\n outputSize(this.ratio(), this.width())\n );\n\n protected readonly sizeParams = computed(() => {\n const size = this.output();\n return {\n width: String(size?.width ?? ''),\n height: String(size?.height ?? ''),\n };\n });\n\n private readonly imageSize = computed<FrameSize | undefined>(() => {\n const bitmap = this.source();\n return bitmap ? { width: bitmap.width, height: bitmap.height } : undefined;\n });\n\n protected readonly zoomPercent = computed(() =>\n String(Math.round(this.framing().zoom * 100))\n );\n\n /** The whole picture laid out so the box shows exactly the crop. */\n protected readonly imageBox = computed(() => {\n const image = this.imageSize();\n const stage = this.stageWidth();\n if (!image || !stage) return { width: 0, height: 0, transform: 'none' };\n const rect = cropRect(image, this.aspect(), this.framing());\n const scale = stage / rect.width;\n return {\n width: image.width * scale,\n height: image.height * scale,\n transform: `translate(${-rect.x * scale}px, ${-rect.y * scale}px)`,\n };\n });\n\n private readonly load = effect((onCleanup) => {\n const file = this.file();\n let cancelled = false;\n const url = URL.createObjectURL(file);\n this.sourceUrl.set(url);\n // EXIF orientation applied here, so the geometry below and the <img> the\n // stage draws agree on which way is up.\n createImageBitmap(file, { imageOrientation: 'from-image' })\n .then((bitmap) => {\n if (cancelled) {\n bitmap.close();\n return;\n }\n this.framing.set(\n initialFraming({ width: bitmap.width, height: bitmap.height })\n );\n this.source.set(bitmap);\n })\n .catch(() => {\n if (!cancelled) this.settle({ unreadable: true });\n });\n onCleanup(() => {\n cancelled = true;\n URL.revokeObjectURL(url);\n this.source()?.close();\n });\n });\n\n private readonly measure = effect((onCleanup) => {\n const stage = this.stage()?.nativeElement;\n if (!stage) return;\n this.stageWidth.set(stage.clientWidth);\n if (typeof ResizeObserver === 'undefined') return;\n const observer = new ResizeObserver(([entry]) =>\n this.stageWidth.set(entry.contentRect.width)\n );\n observer.observe(stage);\n onCleanup(() => observer.disconnect());\n });\n\n // The Modal's own close affordance destroys the body without a word, and a\n // dismissal is a cancel: whoever opened the editor is still waiting.\n private readonly reportDismissal = inject(DestroyRef).onDestroy(() =>\n this.settle(undefined)\n );\n\n protected onPointerDown = (event: PointerEvent): void => {\n if (!this.source()) return;\n (event.currentTarget as HTMLElement).setPointerCapture?.(event.pointerId);\n this.pointers.set(event.pointerId, { x: event.clientX, y: event.clientY });\n this.isPanning.set(true);\n };\n\n protected onPointerMove = (event: PointerEvent): void => {\n const previous = this.pointers.get(event.pointerId);\n if (!previous) return;\n const next = { x: event.clientX, y: event.clientY };\n const others = [...this.pointers.entries()].filter(\n ([id]) => id !== event.pointerId\n );\n if (others.length === 1) {\n // Pinch: the gap between two fingers is the zoom.\n const anchor = others[0][1];\n const before = distance(previous, anchor);\n if (before > 0) this.zoomBy(distance(next, anchor) / before);\n } else if (others.length === 0) {\n this.panBy(next.x - previous.x, next.y - previous.y);\n }\n this.pointers.set(event.pointerId, next);\n };\n\n protected onPointerUp = (event: PointerEvent): void => {\n this.pointers.delete(event.pointerId);\n this.isPanning.set(this.pointers.size > 0);\n };\n\n protected onWheel = (event: WheelEvent): void => {\n if (!this.source()) return;\n event.preventDefault();\n this.zoomBy(Math.exp(-event.deltaY * WHEEL_ZOOM_RATE));\n };\n\n protected onZoom = (percent: string): void => {\n const zoom = Number(percent) / 100;\n if (!Number.isFinite(zoom)) return;\n this.updateFraming((framing) => ({ ...framing, zoom }));\n };\n\n protected apply = async (): Promise<void> => {\n const bitmap = this.source();\n const image = this.imageSize();\n const output = this.output();\n if (!bitmap || !image || !output || this.isApplying()) return;\n this.isApplying.set(true);\n try {\n const rect = cropRect(image, this.aspect(), this.framing());\n const blob = await encodeFramed(drawFramed(bitmap, rect, output));\n const original = this.file();\n this.settle({\n file: new File([blob], renameForType(original.name, blob.type), {\n type: blob.type,\n lastModified: Date.now(),\n }),\n });\n } catch {\n this.settle({ unreadable: true });\n }\n };\n\n /** Screen pixels dragged, moved into source pixels at the current scale. */\n private panBy = (dx: number, dy: number): void => {\n const image = this.imageSize();\n const stage = this.stageWidth();\n if (!image || !stage) return;\n const rect = cropRect(image, this.aspect(), this.framing());\n const perPixel = rect.width / stage;\n this.updateFraming((framing) => ({\n ...framing,\n cx: framing.cx - dx * perPixel,\n cy: framing.cy - dy * perPixel,\n }));\n };\n\n private zoomBy = (factor: number): void => {\n this.updateFraming((framing) => ({\n ...framing,\n zoom: framing.zoom * factor,\n }));\n };\n\n private updateFraming = (change: (framing: Framing) => Framing): void => {\n const image = this.imageSize();\n if (!image) return;\n this.framing.update((framing) =>\n clampFraming(image, this.aspect(), change(framing))\n );\n };\n\n private settle = (result: ImageEditorResult | undefined): void => {\n if (this.#settled) return;\n this.#settled = true;\n this.#modalRef.close(result);\n };\n}\n"],"mappings":";;;;;;;;AAyCA,MAAM,kBAAkB;AAExB,MAAM,YAAY,GAAU,MAC1B,KAAK,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;AAsDjC,IAAa,uBAAb,MAAa,qBAAoB;CACtB,OAAO,MAAM,SAAgB,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAC7B,QAAQ,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAChC,QAAQ,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAEhC,YAAY,OAAgD,SAAS;CAC7D,QAAQ,UAAsC,SAAQ,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAEpD,SAAS,OAAgC,QAAU,GAAA,YAAA,CAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CACnD,YAAY,OAA2B,QAAU,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CACjD,aAAa,OAAO,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,aAAA,CAAA,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CAAA;AAAA,CAAA"}
@@ -1,4 +1,4 @@
1
- import { b as HttpService, c as TranslatePipe, l as TranslateService } from "./magmonium-one-size-converter-BqkALIWA.mjs";
1
+ import { S as HttpService, d as TranslateService, u as TranslatePipe } from "./magmonium-one-base-input-BeyBAbV4.mjs";
2
2
  import * as i0 from "@angular/core";
3
3
  import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Pipe, inject, input } from "@angular/core";
4
4
  import { interval } from "rxjs";
@@ -655,4 +655,4 @@ i0.ɵɵngDeclareClassMetadata({
655
655
  });
656
656
  export { TimeAgoPipe as _, nextSectionTableSort as a, sectionTableFrozenCount as c, SectionTableSortDirection as d, AssetUrlPipe as f, MoneyPipe as g, PercentagePipe as h, defaultSectionTableSort as i, sortSectionTableRows as l, SignColorPipe as m, ToListPipe as n, sectionTableColumnId as o, CompactNumberPipe as p, SectionTableSortPipe as r, sectionTableColumnWidths as s, LabelComponent as t, SECTION_TABLE_VARIANTS as u };
657
657
 
658
- //# sourceMappingURL=magmonium-one-label-D-wnA_Fl.mjs.map
658
+ //# sourceMappingURL=magmonium-one-label-BNxbDSwc.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"magmonium-one-label-D-wnA_Fl.mjs","names":[],"sources":["../../../../libs/one/src/lib/shared/pipe/time-ago.ts","../../../../libs/one/src/lib/shared/pipe/money.fn.ts","../../../../libs/one/src/lib/shared/pipe/money.ts","../../../../libs/one/src/lib/shared/pipe/percentage.ts","../../../../libs/one/src/lib/shared/pipe/sign-color.ts","../../../../libs/one/src/lib/shared/pipe/compact-number.ts","../../../../libs/one/src/lib/shared/pipe/asset-url.ts","../../../../libs/one/src/lib/shared/ui/section/type/section-table.ts","../../../../libs/one/src/lib/shared/ui/section/lib/functions/section-table.ts","../../../../libs/one/src/lib/shared/pipe/section-table-sort.ts","../../../../libs/one/src/lib/shared/pipe/to-list.ts","../../../../libs/one/src/lib/shared/ui/input/ui/label.ts"],"sourcesContent":["import { ChangeDetectorRef, inject, OnDestroy, Pipe, PipeTransform } from '@angular/core';\nimport { TranslateService } from '../services/translate';\nimport { interval, Subscription } from 'rxjs';\n\nconst SECONDS_IN_MINUTE = 60;\nconst SECONDS_IN_HOUR = 3600;\nconst SECONDS_IN_DAY = 86400;\nconst SECONDS_IN_MONTH = 2592000;\nconst SECONDS_IN_YEAR = 31536000;\n\n@Pipe({\n name: 'timeAgo',\n pure: false,\n})\nexport class TimeAgoPipe implements PipeTransform, OnDestroy {\n private readonly translateService = inject(TranslateService);\n private readonly cdr = inject(ChangeDetectorRef);\n private timerSubscription: Subscription | null = null;\n private lastValue: string | Date | undefined = undefined;\n\n transform(value: string | Date | undefined): string {\n if (!value) return '';\n\n if (value !== this.lastValue) {\n this.lastValue = value;\n this.setupTimer();\n }\n\n const date = typeof value === 'string' ? new Date(value) : value;\n const now = new Date();\n const seconds = Math.floor((now.getTime() - date.getTime()) / 1000);\n\n if (seconds < SECONDS_IN_MINUTE) {\n return this.translateService.translate('just-now');\n }\n\n let count: number;\n let unit: string;\n\n if (seconds < SECONDS_IN_HOUR) {\n count = Math.floor(seconds / SECONDS_IN_MINUTE);\n unit = count === 1 ? 'minute' : 'minutes';\n } else if (seconds < SECONDS_IN_DAY) {\n count = Math.floor(seconds / SECONDS_IN_HOUR);\n unit = count === 1 ? 'hour' : 'hours';\n } else if (seconds < SECONDS_IN_MONTH) {\n count = Math.floor(seconds / SECONDS_IN_DAY);\n unit = count === 1 ? 'day' : 'days';\n } else if (seconds < SECONDS_IN_YEAR) {\n count = Math.floor(seconds / SECONDS_IN_MONTH);\n unit = count === 1 ? 'month' : 'months';\n } else {\n count = Math.floor(seconds / SECONDS_IN_YEAR);\n unit = count === 1 ? 'year' : 'years';\n }\n\n return this.translateService.translate(\n `time-ago?count=${count}&unit=${unit}`\n );\n }\n\n private setupTimer(): void {\n this.clearTimer();\n // Update every 30 seconds to keep the display fresh without overloading change detection.\n this.timerSubscription = interval(30000).subscribe(() => {\n this.cdr.detectChanges();\n });\n }\n\n private clearTimer(): void {\n if (this.timerSubscription) {\n this.timerSubscription.unsubscribe();\n this.timerSubscription = null;\n }\n }\n\n ngOnDestroy(): void {\n this.clearTimer();\n }\n}\n","export type MoneySystem = 'IN' | 'INTL';\n\nexport interface MoneyResult {\n amount: string;\n labelKey: string;\n}\n\ninterface Threshold {\n min: number;\n labelKey: string;\n overflowAt: number;\n}\n\nconst IN_THRESHOLDS: Threshold[] = [\n { min: 1_00_00_000, labelKey: 'cr', overflowAt: Infinity },\n { min: 1_00_000, labelKey: 'l', overflowAt: 100 },\n { min: 1_000, labelKey: 'k', overflowAt: 100 },\n];\n\nconst INTL_THRESHOLDS: Threshold[] = [\n { min: 1_000_000_000_000, labelKey: 't', overflowAt: Infinity },\n { min: 1_000_000_000, labelKey: 'b', overflowAt: 1_000 },\n { min: 1_000_000, labelKey: 'm', overflowAt: 1_000 },\n { min: 1_000, labelKey: 'k', overflowAt: 1_000 },\n];\n\n/**\n * Formats a non-negative finite number into a compact denomination result.\n * @param value Must be a non-negative finite number. Negative values and NaN\n * should be handled by the caller before invoking this function.\n */\nexport const formatMoney = (\n value: number,\n system: MoneySystem\n): MoneyResult => {\n const thresholds = system === 'IN' ? IN_THRESHOLDS : INTL_THRESHOLDS;\n\n for (let i = 0; i < thresholds.length; i++) {\n const { min, labelKey, overflowAt } = thresholds[i];\n if (value >= min) {\n const rounded = parseFloat((value / min).toFixed(1));\n if (rounded >= overflowAt && i > 0) {\n const higher = thresholds[i - 1];\n return {\n amount: parseFloat((value / higher.min).toFixed(1)).toString(),\n labelKey: higher.labelKey,\n };\n }\n return { amount: rounded.toString(), labelKey };\n }\n }\n\n return { amount: parseFloat(value.toFixed(2)).toString(), labelKey: '' };\n};\n","import { inject, Pipe, PipeTransform } from '@angular/core';\nimport { TranslateService } from '../services/translate';\nimport { formatMoney, MoneySystem } from './money.fn';\n\n@Pipe({\n name: 'money',\n pure: false,\n})\nexport class MoneyPipe implements PipeTransform {\n private readonly translateService = inject(TranslateService);\n\n transform(\n value: number | undefined | null,\n system: MoneySystem = 'IN',\n symbol = '₹',\n forceSign = false,\n mod = false\n ): string {\n if (value == null || isNaN(value)) return '';\n if (value === 0) return `${symbol}0`;\n\n const isNegative = value < 0;\n const absValue = Math.abs(value);\n const { amount, labelKey } = formatMoney(absValue, system);\n const label = labelKey\n ? ` ${this.translateService.translate(labelKey)}`\n : '';\n\n // `mod` prints the modulus: no sign at all, so `forceSign` has nothing to add.\n const sign = mod ? '' : isNegative ? '-' : forceSign ? '+' : '';\n return `${sign}${symbol}${amount}${label}`;\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\n\n/**\n * Renders a number already expressed in percent units as a `%` reading —\n * `42` becomes `42.00%`, never `4200%`. A ratio is the caller's to multiply,\n * the way `MoneyPipe` takes an amount rather than a currency object.\n *\n * Two decimals by default: a percentage carries the fraction that separates\n * two near-equal readings, and a caller wanting the whole number asks for\n * `decimals: 0`.\n *\n * Pure, unlike the other three: it reads no language and no clock, so its\n * output depends on its arguments alone.\n */\n@Pipe({\n name: 'percentage',\n})\nexport class PercentagePipe implements PipeTransform {\n transform(\n value: number | undefined | null,\n decimals = 2,\n forceSign = false\n ): string {\n if (value == null || isNaN(value)) return '';\n\n const digits = Math.max(0, Math.trunc(decimals));\n const rendered = Math.abs(value).toFixed(digits);\n // A rounded-to-zero negative would otherwise print `-0%`.\n const isNegative = value < 0 && Number(rendered) !== 0;\n\n const sign = isNegative\n ? '-'\n : forceSign && Number(rendered) !== 0\n ? '+'\n : '';\n return `${sign}${rendered}%`;\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\n\n/**\n * Reads a number's sign as a colour — `success` above zero, `error` below — for\n * the `color` input `m-text-output` resolves against the active theme, so a\n * gain and a loss follow the theme rather than freezing one theme's hex.\n *\n * Zero, `null`, `undefined` and `NaN` answer `undefined`: no colour is the\n * component's own default, and a flat reading is neither a gain nor a loss.\n *\n * Pure, like `PercentagePipe`: its output depends on its arguments alone.\n */\n@Pipe({\n name: 'signColor',\n})\nexport class SignColorPipe implements PipeTransform {\n transform(\n value: number | undefined | null,\n positive = 'success',\n negative = 'error'\n ): string | undefined {\n if (value == null || isNaN(value) || value === 0) return undefined;\n return value > 0 ? positive : negative;\n }\n}\n","import { inject, Pipe, PipeTransform } from '@angular/core';\nimport { TranslateService } from '../services/translate';\nimport { formatMoney, MoneySystem } from './money.fn';\n\n/**\n * Renders a large number as a compact denominated reading — `12500` becomes\n * `12.5 k`, `1250000` becomes `12.5 l` (or `1.3 m` on the `INTL` ladder).\n * `MoneyPipe` without the currency symbol: a count of views, rows or users is\n * no amount of money, but it climbs the same thresholds.\n *\n * Named `compactNumber` rather than `number` so it never collides with\n * Angular's own `DecimalPipe` in a template that imports both.\n *\n * Impure for `MoneyPipe`'s reason: the denomination label is a translation key\n * resolved in the active language.\n */\n@Pipe({\n name: 'compactNumber',\n pure: false,\n})\nexport class CompactNumberPipe implements PipeTransform {\n private readonly translateService = inject(TranslateService);\n\n transform(\n value: number | undefined | null,\n system: MoneySystem = 'IN',\n forceSign = false\n ): string {\n if (value == null || isNaN(value)) return '';\n if (value === 0) return '0';\n\n const { amount, labelKey } = formatMoney(Math.abs(value), system);\n // Below the first threshold a tiny value can still round to `0`.\n if (Number(amount) === 0) return '0';\n\n const label = labelKey\n ? ` ${this.translateService.translate(labelKey)}`\n : '';\n const sign = value < 0 ? '-' : forceSign ? '+' : '';\n return `${sign}${amount}${label}`;\n }\n}\n","import { inject, Pipe, PipeTransform } from '@angular/core';\nimport { HttpService } from '../services/http';\n\n@Pipe({\n name: 'assetUrl',\n})\nexport class AssetUrlPipe implements PipeTransform {\n private readonly http = inject(HttpService);\n\n transform(value: string | null | undefined): string {\n return this.http.getAssetUrl(value);\n }\n}\n","import { Config } from '../../../type/config/config-type';\n\nexport type SectionTableAlign = 'left' | 'center' | 'right';\n\n/** What a sorting column compares its values as. */\nexport type SectionTableDataType = 'text' | 'number' | 'date';\n\n/**\n * Which way a SectionTable sorts. An enum rather than a union so a generated\n * Screen keeping the direction keeps it as this vocabulary, the way it keeps\n * the column as its SortEnum (m-one-ui ADR 0203). Its values are the words the\n * union always held, so a stored or compared `'asc'` still reads the same.\n */\nexport enum SectionTableSortDirection {\n Asc = 'asc',\n Desc = 'desc',\n}\n\n/**\n * A SectionTable's look. It never draws a panel border: `zebra` shades every\n * other row, `compact` and `spacious` tighten or loosen the cell padding,\n * `border` draws a thick rule along its top and a thinner one along its\n * bottom.\n */\nexport type SectionTableVariant =\n | 'default'\n | 'zebra'\n | 'compact'\n | 'spacious'\n | 'border';\n\nexport const SECTION_TABLE_VARIANTS: readonly SectionTableVariant[] = [\n 'default',\n 'zebra',\n 'compact',\n 'spacious',\n 'border',\n];\n\n/**\n * One entry in a SectionTable's configured heading (GLOSSARY.md\n * SectionTableColumn). The cells beneath it line up by position, so nothing\n * here says how a cell renders — a cell renders what was put in it.\n *\n * `Id` is the vocabulary of column ids — `string` unless a caller narrows it.\n * A generated Screen narrows it to the enum of its sorting columns' ids, so\n * the `sortChange` it binds already carries that enum (m-one-ui ADR 0203).\n */\nexport type SectionTableColumn<Id extends string = string> = {\n /**\n * The column's position when unset. A sorting column's `id` is the key of\n * the row it sorts by, and must be written (m-one-ui ADR 0148).\n */\n id?: Id;\n /** A translation key. */\n label?: string;\n align?: SectionTableAlign;\n /** 1–12: its share of the table's width. Unset columns divide what is left. */\n span?: number;\n sortable?: boolean;\n dataType?: SectionTableDataType;\n /**\n * The rows start sorted by this column. Needs a written `id`, as `sortable`\n * does; the first such column wins.\n */\n defaultSort?: boolean;\n /** The default sort's direction: ascending when set, descending when not. */\n ascending?: boolean;\n /** Freezes this column and every column before it to the left edge. */\n freeze?: boolean;\n /** Starts folded, with a toggle in its heading (GLOSSARY.md Squeeze). */\n squeeze?: boolean;\n};\n\n/** The sort in force: which column, and which way. */\nexport type SectionTableSort<Id extends string = string> = {\n id: Id;\n direction: SectionTableSortDirection;\n dataType?: SectionTableDataType;\n};\n\nexport type SectionTableConfig<Id extends string = string> = Config & {\n columns?: SectionTableColumn<Id>[];\n sticky?: boolean;\n /** 1em outside the table, above and below — beyond a `border` rule. */\n margin?: boolean;\n variant?: SectionTableVariant;\n};\n","import {\n SectionTableColumn,\n SectionTableSort,\n SectionTableSortDirection,\n} from '../../type/section-table';\n\n/** A column's id, falling back to its position (m-one-ui ADR 0148). */\nexport const sectionTableColumnId = <Id extends string>(\n column: SectionTableColumn<Id>,\n index: number\n): Id | string => column.id || String(index);\n\n/**\n * Each column's width as a CSS length: a `span` is its twelfth-share of the\n * table, and a column without one gets `undefined` so the `<table>` divides\n * what the spanned columns left.\n */\nexport const sectionTableColumnWidths = (\n columns: readonly SectionTableColumn[]\n): (string | undefined)[] =>\n columns.map(({ span }) => {\n if (span == null || !Number.isFinite(span)) return undefined;\n const clamped = Math.min(12, Math.max(1, Math.round(span)));\n return `${(clamped * 100) / 12}%`;\n });\n\n/**\n * How many leading columns are frozen: freezing a column freezes every column\n * before it, because a frozen column pinned past an unfrozen one would slide\n * over it.\n */\nexport const sectionTableFrozenCount = (\n columns: readonly SectionTableColumn[]\n): number => {\n let last = -1;\n columns.forEach((column, i) => {\n if (column.freeze) last = i;\n });\n return last + 1;\n};\n\n/** The next sort after a click on the column with `id`. */\nexport const nextSectionTableSort = <Id extends string>(\n current: SectionTableSort<Id> | null,\n id: Id,\n dataType: SectionTableSort['dataType']\n): SectionTableSort<Id> =>\n current?.id === id\n ? {\n id,\n dataType,\n direction:\n current.direction === SectionTableSortDirection.Asc\n ? SectionTableSortDirection.Desc\n : SectionTableSortDirection.Asc,\n }\n : { id, dataType, direction: SectionTableSortDirection.Asc };\n\n/** The sort a table starts with: its first `defaultSort` column's, if any. */\nexport const defaultSectionTableSort = <Id extends string>(\n columns: readonly SectionTableColumn<Id>[]\n): SectionTableSort<Id> | null => {\n const column = columns.find((one) => one.defaultSort);\n // A default sort needs a written id, as a sorting column does (ADR 0148):\n // one left positional names no key of the row, and sorts by nothing.\n if (!column?.id) return null;\n return {\n id: column.id,\n dataType: column.dataType,\n direction: column.ascending\n ? SectionTableSortDirection.Asc\n : SectionTableSortDirection.Desc,\n };\n};\n\nconst readPath =(row: unknown, path: string): unknown =>\n path\n .split('.')\n .reduce<unknown>(\n (value, key) =>\n value != null && typeof value === 'object'\n ? (value as Record<string, unknown>)[key]\n : undefined,\n row\n );\n\nconst comparable = (\n value: unknown,\n dataType: SectionTableSort['dataType']\n): number | string | undefined => {\n if (value == null || value === '') return undefined;\n if (dataType === 'number') {\n const n = typeof value === 'number' ? value : Number(value);\n return Number.isNaN(n) ? undefined : n;\n }\n if (dataType === 'date') {\n const t =\n value instanceof Date ? value.getTime() : new Date(String(value)).getTime();\n return Number.isNaN(t) ? undefined : t;\n }\n return String(value).toLocaleLowerCase();\n};\n\n/**\n * A copy of `rows` ordered by `sort`, the input untouched. Missing values sink\n * to the end in either direction — an empty cell is not the smallest value.\n */\nexport const sortSectionTableRows = <T>(\n rows: readonly T[] | null | undefined,\n sort: SectionTableSort | null | undefined\n): T[] => {\n const list = [...(rows ?? [])];\n if (!sort) return list;\n const sign = sort.direction === SectionTableSortDirection.Asc ? 1 : -1;\n return list\n .map((row, i) => ({ row, i, key: comparable(readPath(row, sort.id), sort.dataType) }))\n .sort((a, b) => {\n if (a.key === undefined || b.key === undefined) {\n if (a.key === b.key) return a.i - b.i;\n return a.key === undefined ? 1 : -1;\n }\n const diff =\n typeof a.key === 'number' && typeof b.key === 'number'\n ? a.key - b.key\n : String(a.key).localeCompare(String(b.key));\n return diff === 0 ? a.i - b.i : diff * sign;\n })\n .map(({ row }) => row);\n};\n","import { Pipe, PipeTransform } from '@angular/core';\nimport type { SectionTableSort } from '../ui/section/type/section-table';\nimport { sortSectionTableRows } from '../ui/section/lib/functions/section-table';\n\n/**\n * A SectionTable's sort applied to a Repeat's collection:\n * `@for (row of (rows | sectionTableSort: table.sort()); …)`. The `@for` is the\n * Repeat's, not the table's, so the table reorders a collection it does not\n * own through this and nothing else (m-one-ui ADR 0148).\n *\n * Pure: a new order needs a new sort or a new collection, never a mutated one.\n */\n@Pipe({\n name: 'sectionTableSort',\n})\nexport class SectionTableSortPipe implements PipeTransform {\n transform<T>(\n rows: readonly T[] | null | undefined,\n sort: SectionTableSort | null | undefined\n ): T[] {\n return sortSectionTableRows(rows, sort);\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\n\n/**\n * One value as the one-item list a collection input holds — `id | toList`\n * hands `[id]` to an input typed `string[]`. An absent value is an empty list,\n * never `[undefined]`.\n *\n * A pipe rather than an inline `[id]`: an array literal in a template binding\n * is what `no-inline-config-template` rejects (ADR 0010). Pure, so the list is\n * rebuilt only when the value changes and the input sees a stable reference.\n */\n@Pipe({\n name: 'toList',\n})\nexport class ToListPipe implements PipeTransform {\n transform<T>(value: T | undefined | null): T[] {\n return value == null ? [] : [value];\n }\n}\n","import { ChangeDetectionStrategy, Component, input } from '@angular/core';\nimport { TranslatePipe } from '../../../pipe';\n\n@Component({\n selector: 'm-label',\n template: `\n <label\n [class.required]=\"required()\"\n [class.disabled]=\"disabled()\"\n [attr.for]=\"for() || null\"\n >\n @if (color()) {\n <span class=\"label__swatch\" [style.background]=\"color()\"></span>\n }\n @if (noTranslate()) {\n {{ placeholder() }}\n } @else {\n {{ placeholder() | translate: params() }}\n }\n </label>\n `,\n imports: [TranslatePipe],\n styleUrl: './label.sass',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class LabelComponent {\n for = input<string>();\n placeholder = input<string>();\n // The label's [MessageVariable] values — a Field whose label is a sentence\n // with a datum in it (m-one-ui ADR 0066).\n params = input<Record<string, string> | undefined>();\n required = input<boolean>();\n disabled = input<boolean>();\n color = input<string>();\n // Authored text rather than an i18n key — an option label mapped from a row\n // the app holds, which the dictionary has never heard of.\n noTranslate = input<boolean>();\n}\n\n"],"mappings":";;;;AAIA,MAAM,oBAAoB;AAC1B,MAAM,kBAAkB;AACxB,MAAM,iBAAiB;AACvB,MAAM,mBAAmB;AACzB,MAAM,kBAAkB;AAMxB,IAAa,cAAb,MA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;EAAA,CAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAIZ,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAc,YAAA,CAAA;EAtB1B,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAS,UACT;;;;;;;;;;;;;;;;GAeT,SACQ,CAAC,aAAa;GAAC,iBAEP,wBAAwB;GAAM,QAAA,CAAA,w8CAAA;EAAA,CAAA"}
1
+ {"version":3,"file":"magmonium-one-label-BNxbDSwc.mjs","names":[],"sources":["../../../../libs/one/src/lib/shared/pipe/time-ago.ts","../../../../libs/one/src/lib/shared/pipe/money.fn.ts","../../../../libs/one/src/lib/shared/pipe/money.ts","../../../../libs/one/src/lib/shared/pipe/percentage.ts","../../../../libs/one/src/lib/shared/pipe/sign-color.ts","../../../../libs/one/src/lib/shared/pipe/compact-number.ts","../../../../libs/one/src/lib/shared/pipe/asset-url.ts","../../../../libs/one/src/lib/shared/ui/section/type/section-table.ts","../../../../libs/one/src/lib/shared/ui/section/lib/functions/section-table.ts","../../../../libs/one/src/lib/shared/pipe/section-table-sort.ts","../../../../libs/one/src/lib/shared/pipe/to-list.ts","../../../../libs/one/src/lib/shared/ui/input/ui/label.ts"],"sourcesContent":["import { ChangeDetectorRef, inject, OnDestroy, Pipe, PipeTransform } from '@angular/core';\nimport { TranslateService } from '../services/translate';\nimport { interval, Subscription } from 'rxjs';\n\nconst SECONDS_IN_MINUTE = 60;\nconst SECONDS_IN_HOUR = 3600;\nconst SECONDS_IN_DAY = 86400;\nconst SECONDS_IN_MONTH = 2592000;\nconst SECONDS_IN_YEAR = 31536000;\n\n@Pipe({\n name: 'timeAgo',\n pure: false,\n})\nexport class TimeAgoPipe implements PipeTransform, OnDestroy {\n private readonly translateService = inject(TranslateService);\n private readonly cdr = inject(ChangeDetectorRef);\n private timerSubscription: Subscription | null = null;\n private lastValue: string | Date | undefined = undefined;\n\n transform(value: string | Date | undefined): string {\n if (!value) return '';\n\n if (value !== this.lastValue) {\n this.lastValue = value;\n this.setupTimer();\n }\n\n const date = typeof value === 'string' ? new Date(value) : value;\n const now = new Date();\n const seconds = Math.floor((now.getTime() - date.getTime()) / 1000);\n\n if (seconds < SECONDS_IN_MINUTE) {\n return this.translateService.translate('just-now');\n }\n\n let count: number;\n let unit: string;\n\n if (seconds < SECONDS_IN_HOUR) {\n count = Math.floor(seconds / SECONDS_IN_MINUTE);\n unit = count === 1 ? 'minute' : 'minutes';\n } else if (seconds < SECONDS_IN_DAY) {\n count = Math.floor(seconds / SECONDS_IN_HOUR);\n unit = count === 1 ? 'hour' : 'hours';\n } else if (seconds < SECONDS_IN_MONTH) {\n count = Math.floor(seconds / SECONDS_IN_DAY);\n unit = count === 1 ? 'day' : 'days';\n } else if (seconds < SECONDS_IN_YEAR) {\n count = Math.floor(seconds / SECONDS_IN_MONTH);\n unit = count === 1 ? 'month' : 'months';\n } else {\n count = Math.floor(seconds / SECONDS_IN_YEAR);\n unit = count === 1 ? 'year' : 'years';\n }\n\n return this.translateService.translate(\n `time-ago?count=${count}&unit=${unit}`\n );\n }\n\n private setupTimer(): void {\n this.clearTimer();\n // Update every 30 seconds to keep the display fresh without overloading change detection.\n this.timerSubscription = interval(30000).subscribe(() => {\n this.cdr.detectChanges();\n });\n }\n\n private clearTimer(): void {\n if (this.timerSubscription) {\n this.timerSubscription.unsubscribe();\n this.timerSubscription = null;\n }\n }\n\n ngOnDestroy(): void {\n this.clearTimer();\n }\n}\n","export type MoneySystem = 'IN' | 'INTL';\n\nexport interface MoneyResult {\n amount: string;\n labelKey: string;\n}\n\ninterface Threshold {\n min: number;\n labelKey: string;\n overflowAt: number;\n}\n\nconst IN_THRESHOLDS: Threshold[] = [\n { min: 1_00_00_000, labelKey: 'cr', overflowAt: Infinity },\n { min: 1_00_000, labelKey: 'l', overflowAt: 100 },\n { min: 1_000, labelKey: 'k', overflowAt: 100 },\n];\n\nconst INTL_THRESHOLDS: Threshold[] = [\n { min: 1_000_000_000_000, labelKey: 't', overflowAt: Infinity },\n { min: 1_000_000_000, labelKey: 'b', overflowAt: 1_000 },\n { min: 1_000_000, labelKey: 'm', overflowAt: 1_000 },\n { min: 1_000, labelKey: 'k', overflowAt: 1_000 },\n];\n\n/**\n * Formats a non-negative finite number into a compact denomination result.\n * @param value Must be a non-negative finite number. Negative values and NaN\n * should be handled by the caller before invoking this function.\n */\nexport const formatMoney = (\n value: number,\n system: MoneySystem\n): MoneyResult => {\n const thresholds = system === 'IN' ? IN_THRESHOLDS : INTL_THRESHOLDS;\n\n for (let i = 0; i < thresholds.length; i++) {\n const { min, labelKey, overflowAt } = thresholds[i];\n if (value >= min) {\n const rounded = parseFloat((value / min).toFixed(1));\n if (rounded >= overflowAt && i > 0) {\n const higher = thresholds[i - 1];\n return {\n amount: parseFloat((value / higher.min).toFixed(1)).toString(),\n labelKey: higher.labelKey,\n };\n }\n return { amount: rounded.toString(), labelKey };\n }\n }\n\n return { amount: parseFloat(value.toFixed(2)).toString(), labelKey: '' };\n};\n","import { inject, Pipe, PipeTransform } from '@angular/core';\nimport { TranslateService } from '../services/translate';\nimport { formatMoney, MoneySystem } from './money.fn';\n\n@Pipe({\n name: 'money',\n pure: false,\n})\nexport class MoneyPipe implements PipeTransform {\n private readonly translateService = inject(TranslateService);\n\n transform(\n value: number | undefined | null,\n system: MoneySystem = 'IN',\n symbol = '₹',\n forceSign = false,\n mod = false\n ): string {\n if (value == null || isNaN(value)) return '';\n if (value === 0) return `${symbol}0`;\n\n const isNegative = value < 0;\n const absValue = Math.abs(value);\n const { amount, labelKey } = formatMoney(absValue, system);\n const label = labelKey\n ? ` ${this.translateService.translate(labelKey)}`\n : '';\n\n // `mod` prints the modulus: no sign at all, so `forceSign` has nothing to add.\n const sign = mod ? '' : isNegative ? '-' : forceSign ? '+' : '';\n return `${sign}${symbol}${amount}${label}`;\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\n\n/**\n * Renders a number already expressed in percent units as a `%` reading —\n * `42` becomes `42.00%`, never `4200%`. A ratio is the caller's to multiply,\n * the way `MoneyPipe` takes an amount rather than a currency object.\n *\n * Two decimals by default: a percentage carries the fraction that separates\n * two near-equal readings, and a caller wanting the whole number asks for\n * `decimals: 0`.\n *\n * Pure, unlike the other three: it reads no language and no clock, so its\n * output depends on its arguments alone.\n */\n@Pipe({\n name: 'percentage',\n})\nexport class PercentagePipe implements PipeTransform {\n transform(\n value: number | undefined | null,\n decimals = 2,\n forceSign = false\n ): string {\n if (value == null || isNaN(value)) return '';\n\n const digits = Math.max(0, Math.trunc(decimals));\n const rendered = Math.abs(value).toFixed(digits);\n // A rounded-to-zero negative would otherwise print `-0%`.\n const isNegative = value < 0 && Number(rendered) !== 0;\n\n const sign = isNegative\n ? '-'\n : forceSign && Number(rendered) !== 0\n ? '+'\n : '';\n return `${sign}${rendered}%`;\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\n\n/**\n * Reads a number's sign as a colour — `success` above zero, `error` below — for\n * the `color` input `m-text-output` resolves against the active theme, so a\n * gain and a loss follow the theme rather than freezing one theme's hex.\n *\n * Zero, `null`, `undefined` and `NaN` answer `undefined`: no colour is the\n * component's own default, and a flat reading is neither a gain nor a loss.\n *\n * Pure, like `PercentagePipe`: its output depends on its arguments alone.\n */\n@Pipe({\n name: 'signColor',\n})\nexport class SignColorPipe implements PipeTransform {\n transform(\n value: number | undefined | null,\n positive = 'success',\n negative = 'error'\n ): string | undefined {\n if (value == null || isNaN(value) || value === 0) return undefined;\n return value > 0 ? positive : negative;\n }\n}\n","import { inject, Pipe, PipeTransform } from '@angular/core';\nimport { TranslateService } from '../services/translate';\nimport { formatMoney, MoneySystem } from './money.fn';\n\n/**\n * Renders a large number as a compact denominated reading — `12500` becomes\n * `12.5 k`, `1250000` becomes `12.5 l` (or `1.3 m` on the `INTL` ladder).\n * `MoneyPipe` without the currency symbol: a count of views, rows or users is\n * no amount of money, but it climbs the same thresholds.\n *\n * Named `compactNumber` rather than `number` so it never collides with\n * Angular's own `DecimalPipe` in a template that imports both.\n *\n * Impure for `MoneyPipe`'s reason: the denomination label is a translation key\n * resolved in the active language.\n */\n@Pipe({\n name: 'compactNumber',\n pure: false,\n})\nexport class CompactNumberPipe implements PipeTransform {\n private readonly translateService = inject(TranslateService);\n\n transform(\n value: number | undefined | null,\n system: MoneySystem = 'IN',\n forceSign = false\n ): string {\n if (value == null || isNaN(value)) return '';\n if (value === 0) return '0';\n\n const { amount, labelKey } = formatMoney(Math.abs(value), system);\n // Below the first threshold a tiny value can still round to `0`.\n if (Number(amount) === 0) return '0';\n\n const label = labelKey\n ? ` ${this.translateService.translate(labelKey)}`\n : '';\n const sign = value < 0 ? '-' : forceSign ? '+' : '';\n return `${sign}${amount}${label}`;\n }\n}\n","import { inject, Pipe, PipeTransform } from '@angular/core';\nimport { HttpService } from '../services/http';\n\n@Pipe({\n name: 'assetUrl',\n})\nexport class AssetUrlPipe implements PipeTransform {\n private readonly http = inject(HttpService);\n\n transform(value: string | null | undefined): string {\n return this.http.getAssetUrl(value);\n }\n}\n","import { Config } from '../../../type/config/config-type';\n\nexport type SectionTableAlign = 'left' | 'center' | 'right';\n\n/** What a sorting column compares its values as. */\nexport type SectionTableDataType = 'text' | 'number' | 'date';\n\n/**\n * Which way a SectionTable sorts. An enum rather than a union so a generated\n * Screen keeping the direction keeps it as this vocabulary, the way it keeps\n * the column as its SortEnum (m-one-ui ADR 0203). Its values are the words the\n * union always held, so a stored or compared `'asc'` still reads the same.\n */\nexport enum SectionTableSortDirection {\n Asc = 'asc',\n Desc = 'desc',\n}\n\n/**\n * A SectionTable's look. It never draws a panel border: `zebra` shades every\n * other row, `compact` and `spacious` tighten or loosen the cell padding,\n * `border` draws a thick rule along its top and a thinner one along its\n * bottom.\n */\nexport type SectionTableVariant =\n | 'default'\n | 'zebra'\n | 'compact'\n | 'spacious'\n | 'border';\n\nexport const SECTION_TABLE_VARIANTS: readonly SectionTableVariant[] = [\n 'default',\n 'zebra',\n 'compact',\n 'spacious',\n 'border',\n];\n\n/**\n * One entry in a SectionTable's configured heading (GLOSSARY.md\n * SectionTableColumn). The cells beneath it line up by position, so nothing\n * here says how a cell renders — a cell renders what was put in it.\n *\n * `Id` is the vocabulary of column ids — `string` unless a caller narrows it.\n * A generated Screen narrows it to the enum of its sorting columns' ids, so\n * the `sortChange` it binds already carries that enum (m-one-ui ADR 0203).\n */\nexport type SectionTableColumn<Id extends string = string> = {\n /**\n * The column's position when unset. A sorting column's `id` is the key of\n * the row it sorts by, and must be written (m-one-ui ADR 0148).\n */\n id?: Id;\n /** A translation key. */\n label?: string;\n align?: SectionTableAlign;\n /** 1–12: its share of the table's width. Unset columns divide what is left. */\n span?: number;\n sortable?: boolean;\n dataType?: SectionTableDataType;\n /**\n * The rows start sorted by this column. Needs a written `id`, as `sortable`\n * does; the first such column wins.\n */\n defaultSort?: boolean;\n /** The default sort's direction: ascending when set, descending when not. */\n ascending?: boolean;\n /** Freezes this column and every column before it to the left edge. */\n freeze?: boolean;\n /** Starts folded, with a toggle in its heading (GLOSSARY.md Squeeze). */\n squeeze?: boolean;\n};\n\n/** The sort in force: which column, and which way. */\nexport type SectionTableSort<Id extends string = string> = {\n id: Id;\n direction: SectionTableSortDirection;\n dataType?: SectionTableDataType;\n};\n\nexport type SectionTableConfig<Id extends string = string> = Config & {\n columns?: SectionTableColumn<Id>[];\n sticky?: boolean;\n /** 1em outside the table, above and below — beyond a `border` rule. */\n margin?: boolean;\n variant?: SectionTableVariant;\n};\n","import {\n SectionTableColumn,\n SectionTableSort,\n SectionTableSortDirection,\n} from '../../type/section-table';\n\n/** A column's id, falling back to its position (m-one-ui ADR 0148). */\nexport const sectionTableColumnId = <Id extends string>(\n column: SectionTableColumn<Id>,\n index: number\n): Id | string => column.id || String(index);\n\n/**\n * Each column's width as a CSS length: a `span` is its twelfth-share of the\n * table, and a column without one gets `undefined` so the `<table>` divides\n * what the spanned columns left.\n */\nexport const sectionTableColumnWidths = (\n columns: readonly SectionTableColumn[]\n): (string | undefined)[] =>\n columns.map(({ span }) => {\n if (span == null || !Number.isFinite(span)) return undefined;\n const clamped = Math.min(12, Math.max(1, Math.round(span)));\n return `${(clamped * 100) / 12}%`;\n });\n\n/**\n * How many leading columns are frozen: freezing a column freezes every column\n * before it, because a frozen column pinned past an unfrozen one would slide\n * over it.\n */\nexport const sectionTableFrozenCount = (\n columns: readonly SectionTableColumn[]\n): number => {\n let last = -1;\n columns.forEach((column, i) => {\n if (column.freeze) last = i;\n });\n return last + 1;\n};\n\n/** The next sort after a click on the column with `id`. */\nexport const nextSectionTableSort = <Id extends string>(\n current: SectionTableSort<Id> | null,\n id: Id,\n dataType: SectionTableSort['dataType']\n): SectionTableSort<Id> =>\n current?.id === id\n ? {\n id,\n dataType,\n direction:\n current.direction === SectionTableSortDirection.Asc\n ? SectionTableSortDirection.Desc\n : SectionTableSortDirection.Asc,\n }\n : { id, dataType, direction: SectionTableSortDirection.Asc };\n\n/** The sort a table starts with: its first `defaultSort` column's, if any. */\nexport const defaultSectionTableSort = <Id extends string>(\n columns: readonly SectionTableColumn<Id>[]\n): SectionTableSort<Id> | null => {\n const column = columns.find((one) => one.defaultSort);\n // A default sort needs a written id, as a sorting column does (ADR 0148):\n // one left positional names no key of the row, and sorts by nothing.\n if (!column?.id) return null;\n return {\n id: column.id,\n dataType: column.dataType,\n direction: column.ascending\n ? SectionTableSortDirection.Asc\n : SectionTableSortDirection.Desc,\n };\n};\n\nconst readPath =(row: unknown, path: string): unknown =>\n path\n .split('.')\n .reduce<unknown>(\n (value, key) =>\n value != null && typeof value === 'object'\n ? (value as Record<string, unknown>)[key]\n : undefined,\n row\n );\n\nconst comparable = (\n value: unknown,\n dataType: SectionTableSort['dataType']\n): number | string | undefined => {\n if (value == null || value === '') return undefined;\n if (dataType === 'number') {\n const n = typeof value === 'number' ? value : Number(value);\n return Number.isNaN(n) ? undefined : n;\n }\n if (dataType === 'date') {\n const t =\n value instanceof Date ? value.getTime() : new Date(String(value)).getTime();\n return Number.isNaN(t) ? undefined : t;\n }\n return String(value).toLocaleLowerCase();\n};\n\n/**\n * A copy of `rows` ordered by `sort`, the input untouched. Missing values sink\n * to the end in either direction — an empty cell is not the smallest value.\n */\nexport const sortSectionTableRows = <T>(\n rows: readonly T[] | null | undefined,\n sort: SectionTableSort | null | undefined\n): T[] => {\n const list = [...(rows ?? [])];\n if (!sort) return list;\n const sign = sort.direction === SectionTableSortDirection.Asc ? 1 : -1;\n return list\n .map((row, i) => ({ row, i, key: comparable(readPath(row, sort.id), sort.dataType) }))\n .sort((a, b) => {\n if (a.key === undefined || b.key === undefined) {\n if (a.key === b.key) return a.i - b.i;\n return a.key === undefined ? 1 : -1;\n }\n const diff =\n typeof a.key === 'number' && typeof b.key === 'number'\n ? a.key - b.key\n : String(a.key).localeCompare(String(b.key));\n return diff === 0 ? a.i - b.i : diff * sign;\n })\n .map(({ row }) => row);\n};\n","import { Pipe, PipeTransform } from '@angular/core';\nimport type { SectionTableSort } from '../ui/section/type/section-table';\nimport { sortSectionTableRows } from '../ui/section/lib/functions/section-table';\n\n/**\n * A SectionTable's sort applied to a Repeat's collection:\n * `@for (row of (rows | sectionTableSort: table.sort()); …)`. The `@for` is the\n * Repeat's, not the table's, so the table reorders a collection it does not\n * own through this and nothing else (m-one-ui ADR 0148).\n *\n * Pure: a new order needs a new sort or a new collection, never a mutated one.\n */\n@Pipe({\n name: 'sectionTableSort',\n})\nexport class SectionTableSortPipe implements PipeTransform {\n transform<T>(\n rows: readonly T[] | null | undefined,\n sort: SectionTableSort | null | undefined\n ): T[] {\n return sortSectionTableRows(rows, sort);\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\n\n/**\n * One value as the one-item list a collection input holds — `id | toList`\n * hands `[id]` to an input typed `string[]`. An absent value is an empty list,\n * never `[undefined]`.\n *\n * A pipe rather than an inline `[id]`: an array literal in a template binding\n * is what `no-inline-config-template` rejects (ADR 0010). Pure, so the list is\n * rebuilt only when the value changes and the input sees a stable reference.\n */\n@Pipe({\n name: 'toList',\n})\nexport class ToListPipe implements PipeTransform {\n transform<T>(value: T | undefined | null): T[] {\n return value == null ? [] : [value];\n }\n}\n","import { ChangeDetectionStrategy, Component, input } from '@angular/core';\nimport { TranslatePipe } from '../../../pipe';\n\n@Component({\n selector: 'm-label',\n template: `\n <label\n [class.required]=\"required()\"\n [class.disabled]=\"disabled()\"\n [attr.for]=\"for() || null\"\n >\n @if (color()) {\n <span class=\"label__swatch\" [style.background]=\"color()\"></span>\n }\n @if (noTranslate()) {\n {{ placeholder() }}\n } @else {\n {{ placeholder() | translate: params() }}\n }\n </label>\n `,\n imports: [TranslatePipe],\n styleUrl: './label.sass',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class LabelComponent {\n for = input<string>();\n placeholder = input<string>();\n // The label's [MessageVariable] values — a Field whose label is a sentence\n // with a datum in it (m-one-ui ADR 0066).\n params = input<Record<string, string> | undefined>();\n required = input<boolean>();\n disabled = input<boolean>();\n color = input<string>();\n // Authored text rather than an i18n key — an option label mapped from a row\n // the app holds, which the dictionary has never heard of.\n noTranslate = input<boolean>();\n}\n\n"],"mappings":";;;;AAIA,MAAM,oBAAoB;AAC1B,MAAM,kBAAkB;AACxB,MAAM,iBAAiB;AACvB,MAAM,mBAAmB;AACzB,MAAM,kBAAkB;AAMxB,IAAa,cAAb,MAAa,YAAW;CACL,mBAAmB,OAAO,gBAAgB;CAC1C,MAAM,OAAO,iBAAiB;CACvC,oBAAyC;CACzC,YAAuC;CAE/C,UAAU,OAAgC;EACxC,IAAI,CAAC,OAAO,OAAO;EAEnB,IAAI,UAAU,KAAK,WAAW;GAC5B,KAAK,YAAY;GACjB,KAAK,WAAU;EACjB;EAEA,MAAM,OAAO,OAAO,UAAU,WAAW,IAAI,KAAK,KAAK,IAAI;EAE3D,MAAM,UAAU,KAAK,wBAAO,IADZ,KACY,EAAA,CAAI,QAAO,IAAK,KAAK,QAAO,KAAM,GAAI;EAElE,IAAI,UAAU,mBACZ,OAAO,KAAK,iBAAiB,UA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yBAbV4.mjs";
2
2
  import * as i0 from "@angular/core";
3
3
  import { Directive, ElementRef, HostListener, Renderer2, computed, effect, inject, input } from "@angular/core";
4
4
  var MRefDirective = class MRefDirective {
@@ -144,4 +144,4 @@ i0.ɵɵngDeclareClassMetadata({
144
144
  });
145
145
  export { MRefDirective as t };
146
146
 
147
- //# sourceMappingURL=magmonium-one-m-ref-DLIAzywu.mjs.map
147
+ //# sourceMappingURL=magmonium-one-m-ref-CoK96ogW.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"magmonium-one-m-ref-DLIAzywu.mjs","names":[],"sources":["../../../../libs/one/src/lib/shared/directives/m-ref/m-ref.ts"],"sourcesContent":["import {\n computed,\n Directive,\n effect,\n ElementRef,\n HostListener,\n inject,\n input,\n Renderer2,\n} from '@angular/core';\nimport { NAV_STORE_REF } from '../../config/tokens';\n\n/**\n * NavRef link. `mRef` names a target by NavId and nothing else — the NavKind on\n * that node decides whether following it routes or opens a panel, so this\n * directive never chooses. See libs/one/GLOSSARY.md (NavRef) and ADR 0014.\n */\n@Directive({\n selector: '[mRef]',\n})\nexport class MRefDirective {\n /** NavId of the target. */\n mRef = input.required<string>();\n mRefLinkActive = input<string>();\n mRefToggle = input<boolean>(false);\n /** Values for dynamic segments on the way to the target. */\n mRefParams = input<Record<string, string | number> | undefined>();\n\n #navRef = inject(NAV_STORE_REF, { optional: true });\n #renderer = inject(Renderer2);\n #elementRef = inject(ElementRef);\n\n /**\n * The Nav the panel shows — the one that answered the address rather than\n * the address's own key, so a row still knows itself when the panel was\n * opened over a page (`/page~settings` → `root_settings`), or the one a\n * Browse moved it onto.\n */\n #currentNavId = computed<string | undefined>(\n () => this.#navRef?.panelNavId?.() ?? this.#navRef?.id()\n );\n\n /**\n * Whether the instance this link names is the one being stood on. Every row a\n * `dynamic` Nav resolved carries the same NavId, so NavId equality alone\n * marked the whole list active; a link naming no instance is not making a\n * claim about one and stays matched on its NavId alone.\n */\n #paramsMatch = computed<boolean>(() => {\n const params = this.mRefParams();\n if (!params) return true;\n const routeParams = this.#navRef?.routeParams?.();\n if (!routeParams) return false;\n return Object.entries(params).every(\n ([name, value]) => routeParams[name] === String(value)\n );\n });\n\n /** Exact hit only — what a toggle re-clicks, and never an ancestor. */\n #currentlySelected = computed<boolean>(\n () => this.mRef() === this.#currentNavId() && this.#paramsMatch()\n );\n\n /**\n * Where the User stands, which a Browse does not move: the panel may be\n * showing root's rows while the Address still stands under one of them, and\n * that row stays marked (GLOSSARY.md Browse).\n */\n #standingNavId = computed<string | undefined>(\n () => this.#navRef?.standingNavId?.() ?? this.#currentNavId()\n );\n\n /**\n * The row the open Nav came through. A menu lists the Nav Menu Owner's\n * children, and the User may be standing deeper than a row — on a leaf that\n * handed the panel back up, or on that row's own `default` — so the row is\n * marked when the current NavId is it or under it. Comparing for equality\n * alone left such a list with nothing marked at all.\n */\n #currentlyActive = computed<boolean>(() => {\n const target = this.mRef();\n const current = this.#standingNavId();\n if (!target || !current) return false;\n if (current !== target && !current.startsWith(`${target}_`)) return false;\n return this.#paramsMatch();\n });\n\n constructor() {\n effect(() => {\n const activeClass = this.mRefLinkActive();\n const isSelected = this.#currentlyActive();\n if (!activeClass) return;\n\n if (isSelected) {\n this.#renderer.addClass(this.#elementRef.nativeElement, activeClass);\n } else {\n this.#renderer.removeClass(this.#elementRef.nativeElement, activeClass);\n }\n });\n }\n\n @HostListener('click', ['$event'])\n onHostClick(event: MouseEvent) {\n const navId = this.mRef();\n if (!navId) return;\n event.preventDefault();\n\n if (this.mRefToggle() && this.#currentlySelected()) {\n this.#navRef?.setSelected(undefined);\n return;\n }\n this.#navRef?.setSelected(navId, this.mRefParams());\n }\n}\n"],"mappings":";;;AAoBA,IAAa,gBAAb,MAAa,cAAa;CAExB,OAAO,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAC/B,iBAAiB,MAAe,GAAA,YAAA,CAAA,QAAA,EAAA,WAAA,iBAAA,CAAA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;CAAA,UAAA;CAAA,MAAA;CAAa,YAAA,CAAA;EAHzB,MAAA;EAAU,MAAA,CAAA,EACT,UAAU,SACX,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkFE,MAAA;GAAa,MAAA,CAAA,SAAS,CAAC,QAAQ,CAAC"}
1
+ {"version":3,"file":"magmonium-one-m-ref-CoK96ogW.mjs","names":[],"sources":["../../../../libs/one/src/lib/shared/directives/m-ref/m-ref.ts"],"sourcesContent":["import {\n computed,\n Directive,\n effect,\n ElementRef,\n HostListener,\n inject,\n input,\n Renderer2,\n} from '@angular/core';\nimport { NAV_STORE_REF } from '../../config/tokens';\n\n/**\n * NavRef link. `mRef` names a target by NavId and nothing else — the NavKind on\n * that node decides whether following it routes or opens a panel, so this\n * directive never chooses. See libs/one/GLOSSARY.md (NavRef) and ADR 0014.\n */\n@Directive({\n selector: '[mRef]',\n})\nexport class MRefDirective {\n /** NavId of the target. */\n mRef = input.required<string>();\n mRefLinkActive = input<string>();\n mRefToggle = input<boolean>(false);\n /** Values for dynamic segments on the way to the target. */\n mRefParams = input<Record<string, string | number> | undefined>();\n\n #navRef = inject(NAV_STORE_REF, { optional: true });\n #renderer = inject(Renderer2);\n #elementRef = inject(ElementRef);\n\n /**\n * The Nav the panel shows — the one that answered the address rather than\n * the address's own key, so a row still knows itself when the panel was\n * opened over a page (`/page~settings` → `root_settings`), or the one a\n * Browse moved it onto.\n */\n #currentNavId = computed<string | undefined>(\n () => this.#navRef?.panelNavId?.() ?? this.#navRef?.id()\n );\n\n /**\n * Whether the instance this link names is the one being stood on. Every row a\n * `dynamic` Nav resolved carries the same NavId, so NavId equality alone\n * marked the whole list active; a link naming no instance is not making a\n * claim about one and stays matched on its NavId alone.\n */\n #paramsMatch = computed<boolean>(() => {\n const params = this.mRefParams();\n if (!params) return true;\n const routeParams = this.#navRef?.routeParams?.();\n if (!routeParams) return false;\n return Object.entries(params).every(\n ([name, value]) => routeParams[name] === String(value)\n );\n });\n\n /** Exact hit only — what a toggle re-clicks, and never an ancestor. */\n #currentlySelected = computed<boolean>(\n () => this.mRef() === this.#currentNavId() && this.#paramsMatch()\n );\n\n /**\n * Where the User stands, which a Browse does not move: the panel may be\n * showing root's rows while the Address still stands under one of them, and\n * that row stays marked (GLOSSARY.md Browse).\n */\n #standingNavId = computed<string | undefined>(\n () => this.#navRef?.standingNavId?.() ?? this.#currentNavId()\n );\n\n /**\n * The row the open Nav came through. A menu lists the Nav Menu Owner's\n * children, and the User may be standing deeper than a row — on a leaf that\n * handed the panel back up, or on that row's own `default` — so the row is\n * marked when the current NavId is it or under it. Comparing for equality\n * alone left such a list with nothing marked at all.\n */\n #currentlyActive = computed<boolean>(() => {\n const target = this.mRef();\n const current = this.#standingNavId();\n if (!target || !current) return false;\n if (current !== target && !current.startsWith(`${target}_`)) return false;\n return this.#paramsMatch();\n });\n\n constructor() {\n effect(() => {\n const activeClass = this.mRefLinkActive();\n const isSelected = this.#currentlyActive();\n if (!activeClass) return;\n\n if (isSelected) {\n this.#renderer.addClass(this.#elementRef.nativeElement, activeClass);\n } else {\n this.#renderer.removeClass(this.#elementRef.nativeElement, activeClass);\n }\n });\n }\n\n @HostListener('click', ['$event'])\n onHostClick(event: MouseEvent) {\n const navId = this.mRef();\n if (!navId) return;\n event.preventDefault();\n\n if (this.mRefToggle() && this.#currentlySelected()) {\n this.#navRef?.setSelected(undefined);\n return;\n }\n this.#navRef?.setSelected(navId, this.mRefParams());\n }\n}\n"],"mappings":";;;AAoBA,IAAa,gBAAb,MAAa,cAAa;CAExB,OAAO,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAC/B,iBAAiB,MAAe,GAAA,YAAA,CAAA,QAAA,EAAA,WAAA,iBAAA,CAAA,+BAAA,CAAA,CAAA;CAChC,aAAa,MAAe,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,aAAA,CAAA,+BAAA,CAAA,CAAA;CAElC,aAA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;;;;;;;;;;;;;;;;;;;;GAkFE,MAAA;GAAa,MAAA,CAAA,SAAS,CAAC,QAAQ,CAAC"}
@@ -1,8 +1,8 @@
1
- import { Y as NAV_STORE_REF, b as HttpService, c as TranslatePipe, ot as Assets } from "./magmonium-one-size-converter-BqkALIWA.mjs";
2
- import { t as SelectorDirective } from "./magmonium-one-selector-BK48N5us.mjs";
3
- import { r as IconComponent } from "./magmonium-one-icon-CH-g8CUR.mjs";
4
- import { r as ConfigComponent } from "./magmonium-one-attribute-value-CPh-lJPV.mjs";
5
- import { t as ButtonComponent } from "./magmonium-one-button-C5dk4R_m.mjs";
1
+ import { S as HttpService, Z as NAV_STORE_REF, ct as Assets, u as TranslatePipe } from "./magmonium-one-base-input-BeyBAbV4.mjs";
2
+ import { t as SelectorDirective } from "./magmonium-one-selector-QB49Ju9l.mjs";
3
+ import { r as IconComponent } from "./magmonium-one-icon-CXFTG4mD.mjs";
4
+ import { r as ConfigComponent } from "./magmonium-one-attribute-value-BXEWw7xP.mjs";
5
+ import { t as ButtonComponent } from "./magmonium-one-button-DC_fLy-J.mjs";
6
6
  import * as i0 from "@angular/core";
7
7
  import { ChangeDetectionStrategy, Component, ElementRef, afterRenderEffect, computed, inject, input, inputBinding, model, output, outputBinding, signal, untracked, viewChild } from "@angular/core";
8
8
  import { of } from "rxjs";
@@ -765,6 +765,7 @@ var ContextMenuComponent = class ContextMenuComponent extends ConfigComponent {
765
765
  "icon",
766
766
  "isRightIcon",
767
767
  "iconOnly",
768
+ "size",
768
769
  "stacked",
769
770
  "imgSrc",
770
771
  "nonClickable",
@@ -885,4 +886,4 @@ i0.ɵɵngDeclareClassMetadata({
885
886
  });
886
887
  export { ContextMenuBoxComponent as n, MenuComponent as r, ContextMenuComponent as t };
887
888
 
888
- //# sourceMappingURL=magmonium-one-menu-CJjjxFfu.mjs.map
889
+ //# sourceMappingURL=magmonium-one-menu-D_HAqfel.mjs.map