@mhmo91/schmancy 0.4.52 → 0.4.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{avatar-2RMudsVg.js → avatar-BXx1oJMG.js} +5 -5
- package/dist/{avatar-2RMudsVg.js.map → avatar-BXx1oJMG.js.map} +1 -1
- package/dist/badge.js +1 -1
- package/dist/{checkbox-BSYgpRsc.js → checkbox-c3DzDvWH.js} +5 -5
- package/dist/{checkbox-BSYgpRsc.js.map → checkbox-c3DzDvWH.js.map} +1 -1
- package/dist/checkbox.js +1 -1
- package/dist/content-drawer.js +1 -1
- package/dist/{delay-D415_oVH.js → delay-DtVBjjLV.js} +11 -11
- package/dist/{delay-D415_oVH.js.map → delay-DtVBjjLV.js.map} +1 -1
- package/dist/delay.js +1 -1
- package/dist/{dropdown-content-DOnGrBxV.js → dropdown-content-DNJhJCdV.js} +4 -4
- package/dist/{dropdown-content-DOnGrBxV.js.map → dropdown-content-DNJhJCdV.js.map} +1 -1
- package/dist/dropdown.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +41 -39
- package/dist/index.js.map +1 -1
- package/dist/nav-drawer.js +1 -1
- package/dist/number-B7aCRYnH.cjs +2 -0
- package/dist/number-B7aCRYnH.cjs.map +1 -0
- package/dist/number-BhTiptLA.js +99 -0
- package/dist/number-BhTiptLA.js.map +1 -0
- package/dist/teleport.js +1 -1
- package/dist/{typewriter-DMKxup-I.js → typewriter-CXadCi-4.js} +2 -2
- package/dist/{typewriter-DMKxup-I.js.map → typewriter-CXadCi-4.js.map} +1 -1
- package/dist/typewriter.js +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +6 -4
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
- package/types/src/utils/index.d.ts +1 -0
- package/types/src/utils/number.d.ts +105 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown-content-DOnGrBxV.js","sources":["../src/dropdown/dropdown-component.ts","../src/dropdown/dropdown-content.ts"],"sourcesContent":["import { autoUpdate, computePosition, flip, offset, shift } from '@floating-ui/dom'\nimport { $LitElement } from '@mixins/index'\nimport { css, html } from 'lit'\nimport { customElement, property, query, queryAssignedElements, state } from 'lit/decorators.js'\nimport { filter, fromEvent, takeUntil } from 'rxjs'\n\n/**\n * A dropdown component that displays content when triggered.\n *\n * @element schmancy-dropdown\n * @slot trigger - The element that triggers the dropdown\n * @slot - Default slot for the dropdown content\n */\n@customElement('schmancy-dropdown')\nexport class SchmancyDropdown extends $LitElement(css`\n\t:host {\n\t\tdisplay: inline-block;\n\t\tposition: relative;\n\t}\n`) {\n\t/**\n\t * Whether the dropdown is currently open\n\t */\n\t@property({ type: Boolean, reflect: true })\n\topen = false\n\n\t/**\n\t * Placement of the dropdown relative to the trigger\n\t */\n\t@property({ type: String })\n\tplacement:\n\t\t| 'top'\n\t\t| 'top-start'\n\t\t| 'top-end'\n\t\t| 'right'\n\t\t| 'right-start'\n\t\t| 'right-end'\n\t\t| 'bottom'\n\t\t| 'bottom-start'\n\t\t| 'bottom-end'\n\t\t| 'left'\n\t\t| 'left-start'\n\t\t| 'left-end' = 'bottom-start'\n\n\t/**\n\t * Offset distance in pixels\n\t */\n\t@property({ type: Number })\n\tdistance = 8\n\n\t@query('.trigger-container') triggerContainer!: HTMLElement\n\t@query('.dropdown-content-container') contentContainer!: HTMLElement\n\t@queryAssignedElements({ flatten: true }) contentElements!: HTMLElement[]\n\t@state() private portal: HTMLElement | null = null\n\n\t@queryAssignedElements({ slot: 'trigger', flatten: true })\n\ttriggerElements!: Array<HTMLElement>\n\n\tprivate cleanupPositioner?: () => void\n\n\tconnectedCallback() {\n\t\tsuper.connectedCallback()\n\n\t\t// Create portal container for teleporting content to document body\n\t\tthis.setupPortal()\n\n\t\t// Listen for document clicks to close dropdown when clicking outside\n\t\tfromEvent<MouseEvent>(document, 'click')\n\t\t\t.pipe(\n\t\t\t\tfilter(event => this.open && !this.isEventFromSelf(event)),\n\t\t\t\ttakeUntil(this.disconnecting),\n\t\t\t)\n\t\t\t.subscribe(() => {\n\t\t\t\tthis.open = false\n\t\t\t})\n\n\t\t// Listen for escape key to close dropdown\n\t\tfromEvent<KeyboardEvent>(document, 'keydown')\n\t\t\t.pipe(\n\t\t\t\tfilter(event => this.open && event.key === 'Escape'),\n\t\t\t\ttakeUntil(this.disconnecting),\n\t\t\t)\n\t\t\t.subscribe(() => {\n\t\t\t\tthis.open = false\n\t\t\t})\n\t}\n\n\t/**\n\t * Set up the portal element for teleporting content\n\t */\n\tprivate setupPortal() {\n\t\t// Check if portal container exists\n\t\tlet portalContainer = document.getElementById('schmancy-portal-container')\n\n\t\t// Create portal container if it doesn't exist\n\t\tif (!portalContainer) {\n\t\t\tportalContainer = document.createElement('div')\n\t\t\tportalContainer.id = 'schmancy-portal-container'\n\t\t\tportalContainer.style.position = 'fixed'\n\t\t\tportalContainer.style.zIndex = '10000'\n\t\t\tportalContainer.style.top = '0'\n\t\t\tportalContainer.style.left = '0'\n\t\t\tportalContainer.style.pointerEvents = 'none'\n\t\t\tdocument.body.appendChild(portalContainer)\n\t\t}\n\n\t\t// Create portal for this specific dropdown\n\t\tconst portal = document.createElement('div')\n\t\tportal.className = 'schmancy-dropdown-portal'\n\t\tportal.style.position = 'absolute'\n\t\tportal.style.pointerEvents = 'auto'\n\t\tportal.style.display = 'none'\n\t\tportalContainer.appendChild(portal)\n\n\t\tthis.portal = portal\n\t}\n\n\t/**\n\t * Check if an event originated from within this component\n\t */\n\tprivate isEventFromSelf(event: Event): boolean {\n\t\treturn event.composedPath().some(el => el === this)\n\t}\n\n\tdisconnectedCallback() {\n\t\tthis.cleanupPositioner?.()\n\n\t\t// Remove portal when component is disconnected\n\t\tif (this.portal) {\n\t\t\tthis.portal.remove()\n\t\t\tthis.portal = null\n\t\t}\n\n\t\tsuper.disconnectedCallback()\n\t}\n\n\t/**\n\t * Toggle the dropdown open state\n\t */\n\ttoggle() {\n\t\tthis.open = !this.open\n\t}\n\n\tupdated(changedProps: Map<string, any>) {\n\t\tsuper.updated(changedProps)\n\n\t\tif (changedProps.has('open')) {\n\t\t\tif (this.open) {\n\t\t\t\tthis.setupPositioner()\n\t\t\t} else {\n\t\t\t\tthis.cleanupPositioner?.()\n\n\t\t\t\t// Hide portal when dropdown is closed\n\t\t\t\tif (this.portal) {\n\t\t\t\t\tthis.portal.style.display = 'none'\n\t\t\t\t\tthis.portal.innerHTML = ''\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Setup floating UI positioning with teleportation\n\t */\n\tprivate setupPositioner() {\n\t\tif (!this.triggerContainer || !this.portal) return\n\n\t\t// Show the portal\n\t\tthis.portal.style.display = 'block'\n\n\t\t// Move content to portal\n\t\tthis.teleportContentToPortal()\n\n\t\t// Setup positioning\n\t\tthis.cleanupPositioner = autoUpdate(this.triggerContainer, this.portal, () => {\n\t\t\tcomputePosition(this.triggerContainer, this.portal, {\n\t\t\t\tplacement: this.placement,\n\t\t\t\tmiddleware: [\n\t\t\t\t\toffset(this.distance),\n\t\t\t\t\tflip({\n\t\t\t\t\t\tfallbackPlacements: ['top-start', 'bottom-start'],\n\t\t\t\t\t}),\n\t\t\t\t\tshift({ padding: 0 }),\n\t\t\t\t],\n\t\t\t}).then(({ x, y }) => {\n\t\t\t\t// Update portal position\n\t\t\t\tObject.assign(this.portal.style, {\n\t\t\t\t\tleft: `${x}px`,\n\t\t\t\t\ttop: `${y - 8}px`,\n\t\t\t\t})\n\t\t\t})\n\t\t})\n\t}\n\n\t/**\n\t * Move slotted content to the portal\n\t */\n\tprivate teleportContentToPortal() {\n\t\tif (!this.portal) return\n\n\t\t// Clear existing content\n\t\tthis.portal.innerHTML = ''\n\n\t\t// Clone and move slotted content to portal\n\t\tthis.contentElements.forEach(element => {\n\t\t\t// Get computed styles to ensure portal content matches original styling\n\t\t\tconst clonedElement = element.cloneNode(true) as HTMLElement\n\n\t\t\t// Ensure dropdown-content elements maintain their styles when teleported\n\t\t\tif (element.tagName.toLowerCase() === 'schmancy-dropdown-content') {\n\t\t\t\tclonedElement.addEventListener('slotchange', () => {\n\t\t\t\t\t// Propagate any slot changes to class changes on children\n\t\t\t\t\tconst contentDiv = clonedElement.shadowRoot?.querySelector('[part=\"content\"]')\n\t\t\t\t\tif (contentDiv) {\n\t\t\t\t\t\tcontentDiv.classList.add('schmancy-dropdown-content')\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tthis.portal?.appendChild(clonedElement)\n\t\t})\n\t}\n\n\t/**\n\t * Handle trigger click to toggle dropdown\n\t */\n\tprivate handleTriggerClick(e: Event) {\n\t\te.stopPropagation()\n\t\tthis.toggle()\n\t}\n\n\trender() {\n\t\treturn html`\n\t\t\t<div class=\"trigger-container\" @click=${this.handleTriggerClick}>\n\t\t\t\t<slot name=\"trigger\"></slot>\n\t\t\t</div>\n\n\t\t\t<div class=\"dropdown-content-container\" ?hidden=${!this.open}>\n\t\t\t\t<slot\n\t\t\t\t\t@slotchange=${() => {\n\t\t\t\t\t\tif (this.open) {\n\t\t\t\t\t\t\tthis.teleportContentToPortal()\n\t\t\t\t\t\t\tthis.setupPositioner()\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t></slot>\n\t\t\t</div>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-dropdown': SchmancyDropdown\n\t}\n}\n","import { TailwindElement } from '@mixins/index'\nimport { css, html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\n/**\n * Content container for the schmancy-dropdown component.\n *\n * @element schmancy-dropdown-content\n * @slot - Default slot for dropdown content\n */\n@customElement('schmancy-dropdown-content')\nexport class SchmancyDropdownContent extends TailwindElement(css`\n\t:host {\n\t\tdisplay: block;\n\t\tposition: absolute;\n\t\tz-index: 1000;\n\t\tmin-width: 10rem;\n\t\tmargin: 0;\n\t\ttext-align: left;\n\t\tlist-style: none;\n\t\tbackground-color: var(--schmancy-sys-color-surface-container);\n\t\tbackground-clip: padding-box;\n\t\tborder-radius: 0.375rem;\n\t\tbox-shadow: var(--schmancy-sys-elevation-3);\n\t\twill-change: transform;\n\t\ttransform-origin: top left;\n\t\tanimation: dropdownAnimation 0.1s ease-out forwards;\n\t}\n\n\t:host([hidden]) {\n\t\tdisplay: none;\n\t}\n\n\t@keyframes dropdownAnimation {\n\t\tfrom {\n\t\t\topacity: 0;\n\t\t\ttransform: scale(0.95);\n\t\t}\n\t\tto {\n\t\t\topacity: 1;\n\t\t\ttransform: scale(1);\n\t\t}\n\t}\n\n\t/* Apply styles to content both in the component and when teleported to the portal */\n\t.schmancy-dropdown-content {\n\t\tbackground-color: var(--schmancy-sys-color-surface-container);\n\t\tborder-radius: 0.375rem;\n\t\tbox-shadow: var(--schmancy-sys-elevation-3);\n\t\twill-change: transform;\n\t\ttransform-origin: top left;\n\t\tanimation: dropdownAnimation 0.1s ease-out forwards;\n\t}\n`) {\n\t/**\n\t * Width of the dropdown content\n\t */\n\t@property({ type: String })\n\twidth: string = 'auto'\n\n\t/**\n\t * Maximum height of the dropdown content\n\t */\n\t@property({ type: String })\n\tmaxHeight: string = '80vh'\n\n\t/**\n\t * Whether to render with a shadow\n\t */\n\t@property({ type: Boolean })\n\tshadow: boolean = true\n\n\t/**\n\t * Border radius style\n\t */\n\t@property({ type: String })\n\tradius: 'none' | 'sm' | 'md' | 'lg' | 'full' = 'md'\n\n\trender() {\n\t\tconst classes = {\n\t\t\t'schmancy-dropdown-content': true,\n\t\t\t'overflow-auto': true,\n\t\t\t'shadow-none': !this.shadow,\n\t\t\t'rounded-none': this.radius === 'none',\n\t\t\t'rounded-sm': this.radius === 'sm',\n\t\t\t'rounded-md': this.radius === 'md',\n\t\t\t'rounded-lg': this.radius === 'lg',\n\t\t\t'rounded-full': this.radius === 'full',\n\t\t}\n\n\t\tconst styles = {\n\t\t\twidth: this.width,\n\t\t\tmaxHeight: this.maxHeight,\n\t\t}\n\n\t\treturn html`\n\t\t\t<div class=${this.classMap(classes)} style=${this.styleMap(styles)} part=\"content\">\n\t\t\t\t<slot></slot>\n\t\t\t</div>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-dropdown-content': SchmancyDropdownContent\n\t}\n}\n"],"names":["SchmancyDropdown","$LitElement","css","constructor","super","arguments","this","open","placement","distance","portal","connectedCallback","setupPortal","fromEvent","document","pipe","filter","isEventFromSelf","event","takeUntil","disconnecting","subscribe","key","portalContainer","getElementById","createElement","id","style","position","zIndex","top","left","pointerEvents","body","appendChild","className","display","composedPath","some","el","disconnectedCallback","cleanupPositioner","remove","toggle","changedProps","updated","has","setupPositioner","innerHTML","triggerContainer","teleportContentToPortal","autoUpdate","computePosition","middleware","offset","flip","fallbackPlacements","shift","padding","then","x","y","Object","assign","contentElements","forEach","element","clonedElement","cloneNode","tagName","toLowerCase","addEventListener","contentDiv","shadowRoot","querySelector","classList","add","e","stopPropagation","render","html","handleTriggerClick","__decorateClass","property","type","Boolean","reflect","prototype","String","Number","query","queryAssignedElements","flatten","state","slot","customElement","SchmancyDropdownContent","TailwindElement","width","maxHeight","shadow","radius","classes","styles","classMap","styleMap"],"mappings":";;;;;;;;;;;;AAcO,IAAMA,IAAN,cAA+BC,EAAYC;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,CAA3C,EAAA;AAAA,EAAA,cAAAC;AAAAC,UAAAA,GAAAC,SAAAA,GAUNC,KAAAC,WAMAD,KAAAE,YAYgB,gBAMhBF,KAAAG,WAAW,GAKFH,KAAQI,SAA6B;AAAA,EAAA;AAAA,EAO9C,oBAAAC;AACCP,UAAMO,kBAAAA,GAGNL,KAAKM,YAAAA,GAGLC,EAAsBC,UAAU,OAAA,EAC9BC,KACAC,SAAgBV,KAAKC,QAAAA,CAASD,KAAKW,gBAAgBC,CAAAA,CAAAA,GACnDC,EAAUb,KAAKc,aAAAA,CAAAA,EAEfC,UAAU,MAAA;AACVf,WAAKC,OAAAA;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;"}
|
|
1
|
+
{"version":3,"file":"dropdown-content-DNJhJCdV.js","sources":["../src/dropdown/dropdown-component.ts","../src/dropdown/dropdown-content.ts"],"sourcesContent":["import { autoUpdate, computePosition, flip, offset, shift } from '@floating-ui/dom'\nimport { $LitElement } from '@mixins/index'\nimport { css, html } from 'lit'\nimport { customElement, property, query, queryAssignedElements, state } from 'lit/decorators.js'\nimport { filter, fromEvent, takeUntil } from 'rxjs'\n\n/**\n * A dropdown component that displays content when triggered.\n *\n * @element schmancy-dropdown\n * @slot trigger - The element that triggers the dropdown\n * @slot - Default slot for the dropdown content\n */\n@customElement('schmancy-dropdown')\nexport class SchmancyDropdown extends $LitElement(css`\n\t:host {\n\t\tdisplay: inline-block;\n\t\tposition: relative;\n\t}\n`) {\n\t/**\n\t * Whether the dropdown is currently open\n\t */\n\t@property({ type: Boolean, reflect: true })\n\topen = false\n\n\t/**\n\t * Placement of the dropdown relative to the trigger\n\t */\n\t@property({ type: String })\n\tplacement:\n\t\t| 'top'\n\t\t| 'top-start'\n\t\t| 'top-end'\n\t\t| 'right'\n\t\t| 'right-start'\n\t\t| 'right-end'\n\t\t| 'bottom'\n\t\t| 'bottom-start'\n\t\t| 'bottom-end'\n\t\t| 'left'\n\t\t| 'left-start'\n\t\t| 'left-end' = 'bottom-start'\n\n\t/**\n\t * Offset distance in pixels\n\t */\n\t@property({ type: Number })\n\tdistance = 8\n\n\t@query('.trigger-container') triggerContainer!: HTMLElement\n\t@query('.dropdown-content-container') contentContainer!: HTMLElement\n\t@queryAssignedElements({ flatten: true }) contentElements!: HTMLElement[]\n\t@state() private portal: HTMLElement | null = null\n\n\t@queryAssignedElements({ slot: 'trigger', flatten: true })\n\ttriggerElements!: Array<HTMLElement>\n\n\tprivate cleanupPositioner?: () => void\n\n\tconnectedCallback() {\n\t\tsuper.connectedCallback()\n\n\t\t// Create portal container for teleporting content to document body\n\t\tthis.setupPortal()\n\n\t\t// Listen for document clicks to close dropdown when clicking outside\n\t\tfromEvent<MouseEvent>(document, 'click')\n\t\t\t.pipe(\n\t\t\t\tfilter(event => this.open && !this.isEventFromSelf(event)),\n\t\t\t\ttakeUntil(this.disconnecting),\n\t\t\t)\n\t\t\t.subscribe(() => {\n\t\t\t\tthis.open = false\n\t\t\t})\n\n\t\t// Listen for escape key to close dropdown\n\t\tfromEvent<KeyboardEvent>(document, 'keydown')\n\t\t\t.pipe(\n\t\t\t\tfilter(event => this.open && event.key === 'Escape'),\n\t\t\t\ttakeUntil(this.disconnecting),\n\t\t\t)\n\t\t\t.subscribe(() => {\n\t\t\t\tthis.open = false\n\t\t\t})\n\t}\n\n\t/**\n\t * Set up the portal element for teleporting content\n\t */\n\tprivate setupPortal() {\n\t\t// Check if portal container exists\n\t\tlet portalContainer = document.getElementById('schmancy-portal-container')\n\n\t\t// Create portal container if it doesn't exist\n\t\tif (!portalContainer) {\n\t\t\tportalContainer = document.createElement('div')\n\t\t\tportalContainer.id = 'schmancy-portal-container'\n\t\t\tportalContainer.style.position = 'fixed'\n\t\t\tportalContainer.style.zIndex = '10000'\n\t\t\tportalContainer.style.top = '0'\n\t\t\tportalContainer.style.left = '0'\n\t\t\tportalContainer.style.pointerEvents = 'none'\n\t\t\tdocument.body.appendChild(portalContainer)\n\t\t}\n\n\t\t// Create portal for this specific dropdown\n\t\tconst portal = document.createElement('div')\n\t\tportal.className = 'schmancy-dropdown-portal'\n\t\tportal.style.position = 'absolute'\n\t\tportal.style.pointerEvents = 'auto'\n\t\tportal.style.display = 'none'\n\t\tportalContainer.appendChild(portal)\n\n\t\tthis.portal = portal\n\t}\n\n\t/**\n\t * Check if an event originated from within this component\n\t */\n\tprivate isEventFromSelf(event: Event): boolean {\n\t\treturn event.composedPath().some(el => el === this)\n\t}\n\n\tdisconnectedCallback() {\n\t\tthis.cleanupPositioner?.()\n\n\t\t// Remove portal when component is disconnected\n\t\tif (this.portal) {\n\t\t\tthis.portal.remove()\n\t\t\tthis.portal = null\n\t\t}\n\n\t\tsuper.disconnectedCallback()\n\t}\n\n\t/**\n\t * Toggle the dropdown open state\n\t */\n\ttoggle() {\n\t\tthis.open = !this.open\n\t}\n\n\tupdated(changedProps: Map<string, any>) {\n\t\tsuper.updated(changedProps)\n\n\t\tif (changedProps.has('open')) {\n\t\t\tif (this.open) {\n\t\t\t\tthis.setupPositioner()\n\t\t\t} else {\n\t\t\t\tthis.cleanupPositioner?.()\n\n\t\t\t\t// Hide portal when dropdown is closed\n\t\t\t\tif (this.portal) {\n\t\t\t\t\tthis.portal.style.display = 'none'\n\t\t\t\t\tthis.portal.innerHTML = ''\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Setup floating UI positioning with teleportation\n\t */\n\tprivate setupPositioner() {\n\t\tif (!this.triggerContainer || !this.portal) return\n\n\t\t// Show the portal\n\t\tthis.portal.style.display = 'block'\n\n\t\t// Move content to portal\n\t\tthis.teleportContentToPortal()\n\n\t\t// Setup positioning\n\t\tthis.cleanupPositioner = autoUpdate(this.triggerContainer, this.portal, () => {\n\t\t\tcomputePosition(this.triggerContainer, this.portal, {\n\t\t\t\tplacement: this.placement,\n\t\t\t\tmiddleware: [\n\t\t\t\t\toffset(this.distance),\n\t\t\t\t\tflip({\n\t\t\t\t\t\tfallbackPlacements: ['top-start', 'bottom-start'],\n\t\t\t\t\t}),\n\t\t\t\t\tshift({ padding: 0 }),\n\t\t\t\t],\n\t\t\t}).then(({ x, y }) => {\n\t\t\t\t// Update portal position\n\t\t\t\tObject.assign(this.portal.style, {\n\t\t\t\t\tleft: `${x}px`,\n\t\t\t\t\ttop: `${y - 8}px`,\n\t\t\t\t})\n\t\t\t})\n\t\t})\n\t}\n\n\t/**\n\t * Move slotted content to the portal\n\t */\n\tprivate teleportContentToPortal() {\n\t\tif (!this.portal) return\n\n\t\t// Clear existing content\n\t\tthis.portal.innerHTML = ''\n\n\t\t// Clone and move slotted content to portal\n\t\tthis.contentElements.forEach(element => {\n\t\t\t// Get computed styles to ensure portal content matches original styling\n\t\t\tconst clonedElement = element.cloneNode(true) as HTMLElement\n\n\t\t\t// Ensure dropdown-content elements maintain their styles when teleported\n\t\t\tif (element.tagName.toLowerCase() === 'schmancy-dropdown-content') {\n\t\t\t\tclonedElement.addEventListener('slotchange', () => {\n\t\t\t\t\t// Propagate any slot changes to class changes on children\n\t\t\t\t\tconst contentDiv = clonedElement.shadowRoot?.querySelector('[part=\"content\"]')\n\t\t\t\t\tif (contentDiv) {\n\t\t\t\t\t\tcontentDiv.classList.add('schmancy-dropdown-content')\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tthis.portal?.appendChild(clonedElement)\n\t\t})\n\t}\n\n\t/**\n\t * Handle trigger click to toggle dropdown\n\t */\n\tprivate handleTriggerClick(e: Event) {\n\t\te.stopPropagation()\n\t\tthis.toggle()\n\t}\n\n\trender() {\n\t\treturn html`\n\t\t\t<div class=\"trigger-container\" @click=${this.handleTriggerClick}>\n\t\t\t\t<slot name=\"trigger\"></slot>\n\t\t\t</div>\n\n\t\t\t<div class=\"dropdown-content-container\" ?hidden=${!this.open}>\n\t\t\t\t<slot\n\t\t\t\t\t@slotchange=${() => {\n\t\t\t\t\t\tif (this.open) {\n\t\t\t\t\t\t\tthis.teleportContentToPortal()\n\t\t\t\t\t\t\tthis.setupPositioner()\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t></slot>\n\t\t\t</div>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-dropdown': SchmancyDropdown\n\t}\n}\n","import { TailwindElement } from '@mixins/index'\nimport { css, html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\n/**\n * Content container for the schmancy-dropdown component.\n *\n * @element schmancy-dropdown-content\n * @slot - Default slot for dropdown content\n */\n@customElement('schmancy-dropdown-content')\nexport class SchmancyDropdownContent extends TailwindElement(css`\n\t:host {\n\t\tdisplay: block;\n\t\tposition: absolute;\n\t\tz-index: 1000;\n\t\tmin-width: 10rem;\n\t\tmargin: 0;\n\t\ttext-align: left;\n\t\tlist-style: none;\n\t\tbackground-color: var(--schmancy-sys-color-surface-container);\n\t\tbackground-clip: padding-box;\n\t\tborder-radius: 0.375rem;\n\t\tbox-shadow: var(--schmancy-sys-elevation-3);\n\t\twill-change: transform;\n\t\ttransform-origin: top left;\n\t\tanimation: dropdownAnimation 0.1s ease-out forwards;\n\t}\n\n\t:host([hidden]) {\n\t\tdisplay: none;\n\t}\n\n\t@keyframes dropdownAnimation {\n\t\tfrom {\n\t\t\topacity: 0;\n\t\t\ttransform: scale(0.95);\n\t\t}\n\t\tto {\n\t\t\topacity: 1;\n\t\t\ttransform: scale(1);\n\t\t}\n\t}\n\n\t/* Apply styles to content both in the component and when teleported to the portal */\n\t.schmancy-dropdown-content {\n\t\tbackground-color: var(--schmancy-sys-color-surface-container);\n\t\tborder-radius: 0.375rem;\n\t\tbox-shadow: var(--schmancy-sys-elevation-3);\n\t\twill-change: transform;\n\t\ttransform-origin: top left;\n\t\tanimation: dropdownAnimation 0.1s ease-out forwards;\n\t}\n`) {\n\t/**\n\t * Width of the dropdown content\n\t */\n\t@property({ type: String })\n\twidth: string = 'auto'\n\n\t/**\n\t * Maximum height of the dropdown content\n\t */\n\t@property({ type: String })\n\tmaxHeight: string = '80vh'\n\n\t/**\n\t * Whether to render with a shadow\n\t */\n\t@property({ type: Boolean })\n\tshadow: boolean = true\n\n\t/**\n\t * Border radius style\n\t */\n\t@property({ type: String })\n\tradius: 'none' | 'sm' | 'md' | 'lg' | 'full' = 'md'\n\n\trender() {\n\t\tconst classes = {\n\t\t\t'schmancy-dropdown-content': true,\n\t\t\t'overflow-auto': true,\n\t\t\t'shadow-none': !this.shadow,\n\t\t\t'rounded-none': this.radius === 'none',\n\t\t\t'rounded-sm': this.radius === 'sm',\n\t\t\t'rounded-md': this.radius === 'md',\n\t\t\t'rounded-lg': this.radius === 'lg',\n\t\t\t'rounded-full': this.radius === 'full',\n\t\t}\n\n\t\tconst styles = {\n\t\t\twidth: this.width,\n\t\t\tmaxHeight: this.maxHeight,\n\t\t}\n\n\t\treturn html`\n\t\t\t<div class=${this.classMap(classes)} style=${this.styleMap(styles)} part=\"content\">\n\t\t\t\t<slot></slot>\n\t\t\t</div>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-dropdown-content': SchmancyDropdownContent\n\t}\n}\n"],"names":["SchmancyDropdown","$LitElement","css","constructor","super","arguments","this","open","placement","distance","portal","connectedCallback","setupPortal","fromEvent","document","pipe","filter","isEventFromSelf","event","takeUntil","disconnecting","subscribe","key","portalContainer","getElementById","createElement","id","style","position","zIndex","top","left","pointerEvents","body","appendChild","className","display","composedPath","some","el","disconnectedCallback","cleanupPositioner","remove","toggle","changedProps","updated","has","setupPositioner","innerHTML","triggerContainer","teleportContentToPortal","autoUpdate","computePosition","middleware","offset","flip","fallbackPlacements","shift","padding","then","x","y","Object","assign","contentElements","forEach","element","clonedElement","cloneNode","tagName","toLowerCase","addEventListener","contentDiv","shadowRoot","querySelector","classList","add","e","stopPropagation","render","html","handleTriggerClick","__decorateClass","property","type","Boolean","reflect","prototype","String","Number","query","queryAssignedElements","flatten","state","slot","customElement","SchmancyDropdownContent","TailwindElement","width","maxHeight","shadow","radius","classes","styles","classMap","styleMap"],"mappings":";;;;;;;;;;;;AAcO,IAAMA,IAAN,cAA+BC,EAAYC;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,CAA3C,EAAA;AAAA,EAAA,cAAAC;AAAAC,UAAAA,GAAAC,SAAAA,GAUNC,KAAAC,WAMAD,KAAAE,YAYgB,gBAMhBF,KAAAG,WAAW,GAKFH,KAAQI,SAA6B;AAAA,EAAA;AAAA,EAO9C,oBAAAC;AACCP,UAAMO,kBAAAA,GAGNL,KAAKM,YAAAA,GAGLC,EAAsBC,UAAU,OAAA,EAC9BC,KACAC,SAAgBV,KAAKC,QAAAA,CAASD,KAAKW,gBAAgBC,CAAAA,CAAAA,GACn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A,UAAA,CAAA,GAjEYS,IAANd,EAAA,CADNa,EAAc,2BAAA,CAAA,GACFC,CAAAA;"}
|
package/dist/dropdown.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),require("./animated-text-CtXY3MHV.cjs");const c=require("./area.component-DQ_erV9e.cjs"),t=require("./utils-C9nzOWpR.cjs");require("./autocomplete-CrhgxhFI.cjs");const r=require("./avatar-nwqyt3uc.cjs"),w=require("./boat-B_xZilsk.cjs");require("./spinner-CV62BBoF.cjs");const b=require("./icon-button-DbvjV5zJ.cjs");require("./media-CIuTybvD.cjs");const T=require("./checkbox-BAuVXvYL.cjs");require("./chips-Dg2otqDI.cjs");const I=require("./circular-progress-DZUJU-z3.cjs"),S=require("./code-preview-CYHNaPek.cjs"),M=require("./payment-card-form-ccF9dfGC.cjs"),d=require("./date-range-9NUFmKqd.cjs"),R=require("./date-range-inline-Czq1wHs1.cjs"),g=require("./delay-FgtrEHdo.cjs"),l=require("./dialog-content-tGl9B67L.cjs"),p=require("./dialog-service-JNWTLfAy.cjs"),u=require("./ripple-C2BHbhcS.cjs");require("./divider-2yg9r1tF.cjs");const s=require("./dropdown-content-DJ4CA3ug.cjs"),f=require("./timezone-UBBApQoU.cjs");require("./form-Dpokur4M.cjs"),require("./icon-mhchC8Qw.cjs");const C=require("./input-DzNoI9qU.cjs"),o=require("./flex-DWnX0ZPR.cjs"),h=require("./list-DRbkWHho.cjs");require("./menu-DEbZxoXr.cjs");const i=require("./notification-service-B6nHqzq5.cjs");require("./option-BPmOG_Hw.cjs"),require("./progress-BqZ7yHQe.cjs");const O=require("./radio-button-WmbuT_YW.cjs"),A=require("./rxjs-utils.cjs");require("rxjs"),require("./index-DyJ0oDpR.cjs");const N=require("./select-CPnSionr.cjs"),m=require("./sheet-eCDoMdHF.cjs"),P=require("./slider-DBNoXRWS.cjs"),y=require("./schmancy-steps-container-CjAsrjKf.cjs"),a=require("./context-object-K_1gDFu-.cjs"),e=require("./selector-hook-DB8RFC1y.cjs"),j=require("./surface-ClfeUI6q.cjs"),D=require("./table-Rqnb4AJl.cjs");require("./tabs-compatibility-B1bE7hSG.cjs"),require("./textarea-Dlnyyrbq.cjs");const n=require("./theme.component-RtV3l-Ns.cjs"),v=require("./theme.interface-Xg5Zi46a.cjs");require("./theme-button-Cao8AH8r.cjs");const q=require("./tooltip-WpE4e-fO.cjs"),x=require("./tree-Dn0t7MUR.cjs"),E=require("./types.cjs"),B=require("./typewriter-Fq4uV6Gm.cjs"),H=require("./typography-BhCrqK_b.cjs"),F=require("./intersection-CVvaDv96.cjs"),Y=require("./search-DWW8IoOp.cjs");exports.FINDING_MORTIES=c.FINDING_MORTIES,exports.HERE_RICKY=c.HERE_RICKY,exports.HISTORY_STRATEGY=c.HISTORY_STRATEGY,Object.defineProperty(exports,"SchmancyArea",{enumerable:!0,get:()=>c.SchmancyArea}),exports.area=c.area,exports.routerHistory=c.routerHistory,exports.buildQueryString=t.buildQueryString,exports.compareActiveRoutes=t.compareActiveRoutes,exports.compareCustomElementConstructors=t.compareCustomElementConstructors,exports.compareRouteActions=t.compareRouteActions,exports.createRouteCacheKey=t.createRouteCacheKey,exports.debounce=t.debounce,exports.decodeRouteState=t.decodeRouteState,exports.deepMerge=t.deepMerge,exports.encodeRouteState=t.encodeRouteState,exports.extractQueryParams=t.extractQueryParams,exports.getTagName=t.getTagName,exports.isObject=t.isObject,exports.normalizeTagName=t.normalizeTagName,exports.sanitizeRouteState=t.sanitizeRouteState,exports.$drawer=r.$drawer,exports.HereMorty=r.HereMorty,Object.defineProperty(exports,"ScBadgeV2",{enumerable:!0,get:()=>r.ScBadgeV2}),Object.defineProperty(exports,"SchmancyAvatar",{enumerable:!0,get:()=>r.SchmancyAvatar}),Object.defineProperty(exports,"SchmancyBadgeV2",{enumerable:!0,get:()=>r.SchmancyBadgeV2}),Object.defineProperty(exports,"SchmancyContentDrawer",{enumerable:!0,get:()=>r.SchmancyContentDrawer}),exports.SchmancyContentDrawerID=r.SchmancyContentDrawerID,Object.defineProperty(exports,"SchmancyContentDrawerMain",{enumerable:!0,get:()=>r.SchmancyContentDrawerMain}),exports.SchmancyContentDrawerMaxHeight=r.SchmancyContentDrawerMaxHeight,exports.SchmancyContentDrawerMinWidth=r.SchmancyContentDrawerMinWidth,Object.defineProperty(exports,"SchmancyContentDrawerSheet",{enumerable:!0,get:()=>r.SchmancyContentDrawerSheet}),exports.SchmancyContentDrawerSheetMode=r.SchmancyContentDrawerSheetMode,exports.SchmancyContentDrawerSheetState=r.SchmancyContentDrawerSheetState,Object.defineProperty(exports,"SchmancyDrawerAppbar",{enumerable:!0,get:()=>r.SchmancyDrawerAppbar}),exports.SchmancyDrawerNavbarMode=r.SchmancyDrawerNavbarMode,exports.SchmancyDrawerNavbarState=r.SchmancyDrawerNavbarState,Object.defineProperty(exports,"SchmancyNavigationDrawer",{enumerable:!0,get:()=>r.SchmancyNavigationDrawer}),Object.defineProperty(exports,"SchmancyNavigationDrawerContent",{enumerable:!0,get:()=>r.SchmancyNavigationDrawerContent}),Object.defineProperty(exports,"SchmancyNavigationDrawerSidebar",{enumerable:!0,get:()=>r.SchmancyNavigationDrawerSidebar}),Object.defineProperty(exports,"SchmancyTeleportation",{enumerable:!0,get:()=>r.SchmancyTeleportation}),exports.WhereAreYouRicky=r.WhereAreYouRicky,exports.schmancyContentDrawer=r.schmancyContentDrawer,exports.schmancyNavDrawer=r.schmancyNavDrawer,exports.teleport=r.teleport,Object.defineProperty(exports,"SchmancyBoat",{enumerable:!0,get:()=>w.SchmancyBoat}),Object.defineProperty(exports,"SchmancyButton",{enumerable:!0,get:()=>b.SchmancyButton}),Object.defineProperty(exports,"SchmnacyIconButton",{enumerable:!0,get:()=>b.SchmnacyIconButton}),Object.defineProperty(exports,"SchmancyCheckbox",{enumerable:!0,get:()=>T.SchmancyCheckbox}),Object.defineProperty(exports,"SchmancyCircularProgress",{enumerable:!0,get:()=>I.SchmancyCircularProgress}),Object.defineProperty(exports,"SchmancyCode",{enumerable:!0,get:()=>S.SchmancyCode}),Object.defineProperty(exports,"SchmancyCodeHighlight",{enumerable:!0,get:()=>S.SchmancyCode}),Object.defineProperty(exports,"SchmancyCodePreview",{enumerable:!0,get:()=>S.SchmancyCodePreview}),Object.defineProperty(exports,"SchmancyPaymentCardForm",{enumerable:!0,get:()=>M.SchmancyPaymentCardForm}),Object.defineProperty(exports,"SchmancyDateRange",{enumerable:!0,get:()=>d.SchmancyDateRange}),exports.validateInitialDateRange=d.validateInitialDateRange,Object.defineProperty(exports,"SchmancyDateRangeInline",{enumerable:!0,get:()=>R.SchmancyDateRangeInline}),Object.defineProperty(exports,"SchmancyDelay",{enumerable:!0,get:()=>g.SchmancyDelay}),exports.delayContext=g.delayContext,Object.defineProperty(exports,"ConfirmDialog",{enumerable:!0,get:()=>l.ConfirmDialog}),Object.defineProperty(exports,"SchmancyDialog",{enumerable:!0,get:()=>l.SchmancyDialog}),Object.defineProperty(exports,"SchmancyDialogContent",{enumerable:!0,get:()=>l.SchmancyDialogContent}),exports.$dialog=p.$dialog,exports.DialogService=p.DialogService,exports.color=u.color,exports.fullHeight=u.fullHeight,exports.ripple=u.ripple,Object.defineProperty(exports,"SchmancyDropdown",{enumerable:!0,get:()=>s.SchmancyDropdown}),Object.defineProperty(exports,"SchmancyDropdownContent",{enumerable:!0,get:()=>s.SchmancyDropdownContent}),Object.defineProperty(exports,"SchmancyCountriesSelect",{enumerable:!0,get:()=>f.SchmancyCountriesSelect}),Object.defineProperty(exports,"SchmancyTimezonesSelect",{enumerable:!0,get:()=>f.SchmancyTimezonesSelect}),Object.defineProperty(exports,"SchmancyInput",{enumerable:!0,get:()=>C.SchmancyInput}),Object.defineProperty(exports,"SchmancyInputCompat",{enumerable:!0,get:()=>C.SchmancyInputCompat}),Object.defineProperty(exports,"SchmancyFlex",{enumerable:!0,get:()=>o.SchmancyFlex}),Object.defineProperty(exports,"SchmancyFlexV2",{enumerable:!0,get:()=>o.SchmancyFlexV2}),Object.defineProperty(exports,"SchmancyGrid",{enumerable:!0,get:()=>o.SchmancyGrid}),Object.defineProperty(exports,"SchmancyScroll",{enumerable:!0,get:()=>o.SchmancyScroll}),Object.defineProperty(exports,"List",{enumerable:!0,get:()=>h.List}),Object.defineProperty(exports,"SchmancyListItem",{enumerable:!0,get:()=>h.SchmancyListItem}),exports.SchmancyListTypeContext=h.SchmancyListTypeContext,exports.$notify=i.$notify,exports.NotificationAudioService=i.NotificationAudioService,Object.defineProperty(exports,"SchmancyNotification",{enumerable:!0,get:()=>i.SchmancyNotification}),Object.defineProperty(exports,"SchmancyNotificationContainer",{enumerable:!0,get:()=>i.SchmancyNotificationContainer}),Object.defineProperty(exports,"RadioButton",{enumerable:!0,get:()=>O.RadioButton}),Object.defineProperty(exports,"RadioGroup",{enumerable:!0,get:()=>O.RadioGroup}),exports.mutationObserver=A.mutationObserver,Object.defineProperty(exports,"SchmancySelect",{enumerable:!0,get:()=>N.SchmancySelect}),exports.SchmancySheetPosition=m.SchmancySheetPosition,exports.SheetHereMorty=m.SheetHereMorty,exports.SheetWhereAreYouRicky=m.SheetWhereAreYouRicky,exports.sheet=m.sheet,Object.defineProperty(exports,"SchmancySlide",{enumerable:!0,get:()=>P.SchmancySlide}),Object.defineProperty(exports,"SchmancySlider",{enumerable:!0,get:()=>P.SchmancySlider}),Object.defineProperty(exports,"SchmancyStep",{enumerable:!0,get:()=>y.SchmancyStep}),Object.defineProperty(exports,"SchmancyStepsContainer",{enumerable:!0,get:()=>y.SchmancyStepsContainer}),exports.StepsController=y.StepsController,exports.stepsContext=y.stepsContext,exports.BaseStore=a.BaseStore,exports.IndexedDBStorageManager=a.IndexedDBStorageManager,exports.LocalStorageManager=a.LocalStorageManager,exports.MemoryStorageManager=a.MemoryStorageManager,exports.SchmancyArrayStore=a.SchmancyArrayStore,exports.SchmancyStoreObject=a.SchmancyStoreObject,exports.SessionStorageManager=a.SessionStorageManager,exports.StoreError=a.StoreError,exports.createStorageManager=a.createStorageManager,exports.compareValues=e.compareValues,exports.createArrayContext=e.createArrayContext,exports.createCollectionSelector=e.createCollectionSelector,exports.createCompoundSelector=e.createCompoundSelector,exports.createContext=e.createContext,exports.createCountSelector=e.createCountSelector,exports.createEntriesSelector=e.createEntriesSelector,exports.createFilterSelector=e.createFilterSelector,exports.createFindSelector=e.createFindSelector,exports.createItemSelector=e.createItemSelector,exports.createItemsSelector=e.createItemsSelector,exports.createKeysSelector=e.createKeysSelector,exports.createMapSelector=e.createMapSelector,exports.createOptimizedSelector=e.createOptimizedSelector,exports.createSelector=e.createSelector,exports.createSortSelector=e.createSortSelector,exports.createTestArrayContext=e.createTestArrayContext,exports.filterArray=e.filterArray,exports.filterArrayItems=e.filterArrayItems,exports.filterMap=e.filterMap,exports.filterMapItems=e.filterMapItems,exports.getFieldValue=e.getFieldValue,exports.isArray=e.isArray,exports.isDate=e.isDate,exports.isIterable=e.isIterable,exports.isMap=e.isMap,exports.isNil=e.isNil,exports.isNumber=e.isNumber,exports.isPlainObject=e.isPlainObject,exports.isSet=e.isSet,exports.isString=e.isString,exports.select=e.select,exports.selectItem=e.selectItem,Object.defineProperty(exports,"SchmancySurface",{enumerable:!0,get:()=>j.SchmancySurface}),exports.SchmancySurfaceTypeContext=j.SchmancySurfaceTypeContext,Object.defineProperty(exports,"SchmancyDataTable",{enumerable:!0,get:()=>D.SchmancyDataTable}),Object.defineProperty(exports,"SchmancyTableRow",{enumerable:!0,get:()=>D.SchmancyTableRow}),Object.defineProperty(exports,"SchmancyThemeComponent",{enumerable:!0,get:()=>n.SchmancyThemeComponent}),exports.ThemeHereIAm=n.ThemeHereIAm,exports.ThemeWhereAreYou=n.ThemeWhereAreYou,exports.formateTheme=n.formateTheme,exports.tailwindStyles=n.tailwindStyles,exports.SchmancyTheme=v.SchmancyTheme,Object.defineProperty(exports,"SchmancyTooltip",{enumerable:!0,get:()=>q.SchmancyTooltip}),exports.tooltip=q.tooltip,Object.defineProperty(exports,"SchmancyTree",{enumerable:!0,get:()=>x.SchmancyTree}),exports.SchmancyEvents=E.SchmancyEvents,Object.defineProperty(exports,"TypewriterElement",{enumerable:!0,get:()=>B.TypewriterElement}),Object.defineProperty(exports,"SchmancyTypography",{enumerable:!0,get:()=>H.SchmancyTypography}),exports.intersection$=F.intersection$,exports.similarity=Y.similarity;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),require("./animated-text-CtXY3MHV.cjs");const c=require("./area.component-DQ_erV9e.cjs"),t=require("./utils-C9nzOWpR.cjs");require("./autocomplete-CrhgxhFI.cjs");const r=require("./avatar-nwqyt3uc.cjs"),w=require("./boat-B_xZilsk.cjs");require("./spinner-CV62BBoF.cjs");const b=require("./icon-button-DbvjV5zJ.cjs");require("./media-CIuTybvD.cjs");const T=require("./checkbox-BAuVXvYL.cjs");require("./chips-Dg2otqDI.cjs");const I=require("./circular-progress-DZUJU-z3.cjs"),S=require("./code-preview-CYHNaPek.cjs"),M=require("./payment-card-form-ccF9dfGC.cjs"),d=require("./date-range-9NUFmKqd.cjs"),R=require("./date-range-inline-Czq1wHs1.cjs"),g=require("./delay-FgtrEHdo.cjs"),l=require("./dialog-content-tGl9B67L.cjs"),p=require("./dialog-service-JNWTLfAy.cjs"),u=require("./ripple-C2BHbhcS.cjs");require("./divider-2yg9r1tF.cjs");const s=require("./dropdown-content-DJ4CA3ug.cjs"),f=require("./timezone-UBBApQoU.cjs");require("./form-Dpokur4M.cjs"),require("./icon-mhchC8Qw.cjs");const C=require("./input-DzNoI9qU.cjs"),o=require("./flex-DWnX0ZPR.cjs"),h=require("./list-DRbkWHho.cjs");require("./menu-DEbZxoXr.cjs");const i=require("./notification-service-B6nHqzq5.cjs");require("./option-BPmOG_Hw.cjs"),require("./progress-BqZ7yHQe.cjs");const O=require("./radio-button-WmbuT_YW.cjs"),A=require("./rxjs-utils.cjs");require("rxjs"),require("./index-DyJ0oDpR.cjs");const N=require("./select-CPnSionr.cjs"),m=require("./sheet-eCDoMdHF.cjs"),P=require("./slider-DBNoXRWS.cjs"),y=require("./schmancy-steps-container-CjAsrjKf.cjs"),a=require("./context-object-K_1gDFu-.cjs"),e=require("./selector-hook-DB8RFC1y.cjs"),j=require("./surface-ClfeUI6q.cjs"),D=require("./table-Rqnb4AJl.cjs");require("./tabs-compatibility-B1bE7hSG.cjs"),require("./textarea-Dlnyyrbq.cjs");const n=require("./theme.component-RtV3l-Ns.cjs"),v=require("./theme.interface-Xg5Zi46a.cjs");require("./theme-button-Cao8AH8r.cjs");const q=require("./tooltip-WpE4e-fO.cjs"),x=require("./tree-Dn0t7MUR.cjs"),E=require("./types.cjs"),B=require("./typewriter-Fq4uV6Gm.cjs"),H=require("./typography-BhCrqK_b.cjs"),F=require("./intersection-CVvaDv96.cjs"),Y=require("./number-B7aCRYnH.cjs"),V=require("./search-DWW8IoOp.cjs");exports.FINDING_MORTIES=c.FINDING_MORTIES,exports.HERE_RICKY=c.HERE_RICKY,exports.HISTORY_STRATEGY=c.HISTORY_STRATEGY,Object.defineProperty(exports,"SchmancyArea",{enumerable:!0,get:()=>c.SchmancyArea}),exports.area=c.area,exports.routerHistory=c.routerHistory,exports.buildQueryString=t.buildQueryString,exports.compareActiveRoutes=t.compareActiveRoutes,exports.compareCustomElementConstructors=t.compareCustomElementConstructors,exports.compareRouteActions=t.compareRouteActions,exports.createRouteCacheKey=t.createRouteCacheKey,exports.debounce=t.debounce,exports.decodeRouteState=t.decodeRouteState,exports.deepMerge=t.deepMerge,exports.encodeRouteState=t.encodeRouteState,exports.extractQueryParams=t.extractQueryParams,exports.getTagName=t.getTagName,exports.isObject=t.isObject,exports.normalizeTagName=t.normalizeTagName,exports.sanitizeRouteState=t.sanitizeRouteState,exports.$drawer=r.$drawer,exports.HereMorty=r.HereMorty,Object.defineProperty(exports,"ScBadgeV2",{enumerable:!0,get:()=>r.ScBadgeV2}),Object.defineProperty(exports,"SchmancyAvatar",{enumerable:!0,get:()=>r.SchmancyAvatar}),Object.defineProperty(exports,"SchmancyBadgeV2",{enumerable:!0,get:()=>r.SchmancyBadgeV2}),Object.defineProperty(exports,"SchmancyContentDrawer",{enumerable:!0,get:()=>r.SchmancyContentDrawer}),exports.SchmancyContentDrawerID=r.SchmancyContentDrawerID,Object.defineProperty(exports,"SchmancyContentDrawerMain",{enumerable:!0,get:()=>r.SchmancyContentDrawerMain}),exports.SchmancyContentDrawerMaxHeight=r.SchmancyContentDrawerMaxHeight,exports.SchmancyContentDrawerMinWidth=r.SchmancyContentDrawerMinWidth,Object.defineProperty(exports,"SchmancyContentDrawerSheet",{enumerable:!0,get:()=>r.SchmancyContentDrawerSheet}),exports.SchmancyContentDrawerSheetMode=r.SchmancyContentDrawerSheetMode,exports.SchmancyContentDrawerSheetState=r.SchmancyContentDrawerSheetState,Object.defineProperty(exports,"SchmancyDrawerAppbar",{enumerable:!0,get:()=>r.SchmancyDrawerAppbar}),exports.SchmancyDrawerNavbarMode=r.SchmancyDrawerNavbarMode,exports.SchmancyDrawerNavbarState=r.SchmancyDrawerNavbarState,Object.defineProperty(exports,"SchmancyNavigationDrawer",{enumerable:!0,get:()=>r.SchmancyNavigationDrawer}),Object.defineProperty(exports,"SchmancyNavigationDrawerContent",{enumerable:!0,get:()=>r.SchmancyNavigationDrawerContent}),Object.defineProperty(exports,"SchmancyNavigationDrawerSidebar",{enumerable:!0,get:()=>r.SchmancyNavigationDrawerSidebar}),Object.defineProperty(exports,"SchmancyTeleportation",{enumerable:!0,get:()=>r.SchmancyTeleportation}),exports.WhereAreYouRicky=r.WhereAreYouRicky,exports.schmancyContentDrawer=r.schmancyContentDrawer,exports.schmancyNavDrawer=r.schmancyNavDrawer,exports.teleport=r.teleport,Object.defineProperty(exports,"SchmancyBoat",{enumerable:!0,get:()=>w.SchmancyBoat}),Object.defineProperty(exports,"SchmancyButton",{enumerable:!0,get:()=>b.SchmancyButton}),Object.defineProperty(exports,"SchmnacyIconButton",{enumerable:!0,get:()=>b.SchmnacyIconButton}),Object.defineProperty(exports,"SchmancyCheckbox",{enumerable:!0,get:()=>T.SchmancyCheckbox}),Object.defineProperty(exports,"SchmancyCircularProgress",{enumerable:!0,get:()=>I.SchmancyCircularProgress}),Object.defineProperty(exports,"SchmancyCode",{enumerable:!0,get:()=>S.SchmancyCode}),Object.defineProperty(exports,"SchmancyCodeHighlight",{enumerable:!0,get:()=>S.SchmancyCode}),Object.defineProperty(exports,"SchmancyCodePreview",{enumerable:!0,get:()=>S.SchmancyCodePreview}),Object.defineProperty(exports,"SchmancyPaymentCardForm",{enumerable:!0,get:()=>M.SchmancyPaymentCardForm}),Object.defineProperty(exports,"SchmancyDateRange",{enumerable:!0,get:()=>d.SchmancyDateRange}),exports.validateInitialDateRange=d.validateInitialDateRange,Object.defineProperty(exports,"SchmancyDateRangeInline",{enumerable:!0,get:()=>R.SchmancyDateRangeInline}),Object.defineProperty(exports,"SchmancyDelay",{enumerable:!0,get:()=>g.SchmancyDelay}),exports.delayContext=g.delayContext,Object.defineProperty(exports,"ConfirmDialog",{enumerable:!0,get:()=>l.ConfirmDialog}),Object.defineProperty(exports,"SchmancyDialog",{enumerable:!0,get:()=>l.SchmancyDialog}),Object.defineProperty(exports,"SchmancyDialogContent",{enumerable:!0,get:()=>l.SchmancyDialogContent}),exports.$dialog=p.$dialog,exports.DialogService=p.DialogService,exports.color=u.color,exports.fullHeight=u.fullHeight,exports.ripple=u.ripple,Object.defineProperty(exports,"SchmancyDropdown",{enumerable:!0,get:()=>s.SchmancyDropdown}),Object.defineProperty(exports,"SchmancyDropdownContent",{enumerable:!0,get:()=>s.SchmancyDropdownContent}),Object.defineProperty(exports,"SchmancyCountriesSelect",{enumerable:!0,get:()=>f.SchmancyCountriesSelect}),Object.defineProperty(exports,"SchmancyTimezonesSelect",{enumerable:!0,get:()=>f.SchmancyTimezonesSelect}),Object.defineProperty(exports,"SchmancyInput",{enumerable:!0,get:()=>C.SchmancyInput}),Object.defineProperty(exports,"SchmancyInputCompat",{enumerable:!0,get:()=>C.SchmancyInputCompat}),Object.defineProperty(exports,"SchmancyFlex",{enumerable:!0,get:()=>o.SchmancyFlex}),Object.defineProperty(exports,"SchmancyFlexV2",{enumerable:!0,get:()=>o.SchmancyFlexV2}),Object.defineProperty(exports,"SchmancyGrid",{enumerable:!0,get:()=>o.SchmancyGrid}),Object.defineProperty(exports,"SchmancyScroll",{enumerable:!0,get:()=>o.SchmancyScroll}),Object.defineProperty(exports,"List",{enumerable:!0,get:()=>h.List}),Object.defineProperty(exports,"SchmancyListItem",{enumerable:!0,get:()=>h.SchmancyListItem}),exports.SchmancyListTypeContext=h.SchmancyListTypeContext,exports.$notify=i.$notify,exports.NotificationAudioService=i.NotificationAudioService,Object.defineProperty(exports,"SchmancyNotification",{enumerable:!0,get:()=>i.SchmancyNotification}),Object.defineProperty(exports,"SchmancyNotificationContainer",{enumerable:!0,get:()=>i.SchmancyNotificationContainer}),Object.defineProperty(exports,"RadioButton",{enumerable:!0,get:()=>O.RadioButton}),Object.defineProperty(exports,"RadioGroup",{enumerable:!0,get:()=>O.RadioGroup}),exports.mutationObserver=A.mutationObserver,Object.defineProperty(exports,"SchmancySelect",{enumerable:!0,get:()=>N.SchmancySelect}),exports.SchmancySheetPosition=m.SchmancySheetPosition,exports.SheetHereMorty=m.SheetHereMorty,exports.SheetWhereAreYouRicky=m.SheetWhereAreYouRicky,exports.sheet=m.sheet,Object.defineProperty(exports,"SchmancySlide",{enumerable:!0,get:()=>P.SchmancySlide}),Object.defineProperty(exports,"SchmancySlider",{enumerable:!0,get:()=>P.SchmancySlider}),Object.defineProperty(exports,"SchmancyStep",{enumerable:!0,get:()=>y.SchmancyStep}),Object.defineProperty(exports,"SchmancyStepsContainer",{enumerable:!0,get:()=>y.SchmancyStepsContainer}),exports.StepsController=y.StepsController,exports.stepsContext=y.stepsContext,exports.BaseStore=a.BaseStore,exports.IndexedDBStorageManager=a.IndexedDBStorageManager,exports.LocalStorageManager=a.LocalStorageManager,exports.MemoryStorageManager=a.MemoryStorageManager,exports.SchmancyArrayStore=a.SchmancyArrayStore,exports.SchmancyStoreObject=a.SchmancyStoreObject,exports.SessionStorageManager=a.SessionStorageManager,exports.StoreError=a.StoreError,exports.createStorageManager=a.createStorageManager,exports.compareValues=e.compareValues,exports.createArrayContext=e.createArrayContext,exports.createCollectionSelector=e.createCollectionSelector,exports.createCompoundSelector=e.createCompoundSelector,exports.createContext=e.createContext,exports.createCountSelector=e.createCountSelector,exports.createEntriesSelector=e.createEntriesSelector,exports.createFilterSelector=e.createFilterSelector,exports.createFindSelector=e.createFindSelector,exports.createItemSelector=e.createItemSelector,exports.createItemsSelector=e.createItemsSelector,exports.createKeysSelector=e.createKeysSelector,exports.createMapSelector=e.createMapSelector,exports.createOptimizedSelector=e.createOptimizedSelector,exports.createSelector=e.createSelector,exports.createSortSelector=e.createSortSelector,exports.createTestArrayContext=e.createTestArrayContext,exports.filterArray=e.filterArray,exports.filterArrayItems=e.filterArrayItems,exports.filterMap=e.filterMap,exports.filterMapItems=e.filterMapItems,exports.getFieldValue=e.getFieldValue,exports.isArray=e.isArray,exports.isDate=e.isDate,exports.isIterable=e.isIterable,exports.isMap=e.isMap,exports.isNil=e.isNil,exports.isNumber=e.isNumber,exports.isPlainObject=e.isPlainObject,exports.isSet=e.isSet,exports.isString=e.isString,exports.select=e.select,exports.selectItem=e.selectItem,Object.defineProperty(exports,"SchmancySurface",{enumerable:!0,get:()=>j.SchmancySurface}),exports.SchmancySurfaceTypeContext=j.SchmancySurfaceTypeContext,Object.defineProperty(exports,"SchmancyDataTable",{enumerable:!0,get:()=>D.SchmancyDataTable}),Object.defineProperty(exports,"SchmancyTableRow",{enumerable:!0,get:()=>D.SchmancyTableRow}),Object.defineProperty(exports,"SchmancyThemeComponent",{enumerable:!0,get:()=>n.SchmancyThemeComponent}),exports.ThemeHereIAm=n.ThemeHereIAm,exports.ThemeWhereAreYou=n.ThemeWhereAreYou,exports.formateTheme=n.formateTheme,exports.tailwindStyles=n.tailwindStyles,exports.SchmancyTheme=v.SchmancyTheme,Object.defineProperty(exports,"SchmancyTooltip",{enumerable:!0,get:()=>q.SchmancyTooltip}),exports.tooltip=q.tooltip,Object.defineProperty(exports,"SchmancyTree",{enumerable:!0,get:()=>x.SchmancyTree}),exports.SchmancyEvents=E.SchmancyEvents,Object.defineProperty(exports,"TypewriterElement",{enumerable:!0,get:()=>B.TypewriterElement}),Object.defineProperty(exports,"SchmancyTypography",{enumerable:!0,get:()=>H.SchmancyTypography}),exports.intersection$=F.intersection$,exports.Numbers=Y.Numbers,exports.similarity=V.similarity;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import "./animated-text-D26Fv13t.js";
|
|
2
|
-
import { F as d, H as g, b as u, S as D, a as
|
|
3
|
-
import { l as I, h as M, c as R, f as A, j as
|
|
2
|
+
import { F as d, H as g, b as u, S as D, a as b, r as w } from "./area.component-BCcq9Nb7.js";
|
|
3
|
+
import { l as I, h as M, c as R, f as A, j as N, a as v, b as H, d as B, e as E, k as F, g as O, i as $, n as j, s as k } from "./utils-03Coa8AW.js";
|
|
4
4
|
import "./autocomplete-CkycjWy4.js";
|
|
5
|
-
import { $ as P, H as Y, a as z, r as G, S as V, g as W, d as K, h as _, e as q, f as Q, i as J, b as U, c as X, k as Z, m as aa, n as ea, o as ra, l as ta, p as oa, q as sa, W as ca, s as na, j as ma, t as Sa } from "./avatar-
|
|
6
|
-
import { S as
|
|
5
|
+
import { $ as P, H as Y, a as z, r as G, S as V, g as W, d as K, h as _, e as q, f as Q, i as J, b as U, c as X, k as Z, m as aa, n as ea, o as ra, l as ta, p as oa, q as sa, W as ca, s as na, j as ma, t as Sa } from "./avatar-BXx1oJMG.js";
|
|
6
|
+
import { S as pa } from "./boat-C_BvtlNQ.js";
|
|
7
7
|
import "./spinner-CbA-FXRK.js";
|
|
8
8
|
import { S as ha, a as la } from "./icon-button-BGvSPuE-.js";
|
|
9
9
|
import "./media-BO-aZBTp.js";
|
|
10
|
-
import { S as xa } from "./checkbox-
|
|
10
|
+
import { S as xa } from "./checkbox-c3DzDvWH.js";
|
|
11
11
|
import "./chips-Dn8RpKCE.js";
|
|
12
12
|
import { S as da } from "./circular-progress-B1RjFzcp.js";
|
|
13
|
-
import { S as ua, S as Da, a as
|
|
14
|
-
import { S as
|
|
13
|
+
import { S as ua, S as Da, a as ba } from "./code-preview-JlSLKkKg.js";
|
|
14
|
+
import { S as Ta } from "./payment-card-form-Cs5bP5Di.js";
|
|
15
15
|
import { S as Ma, v as Ra } from "./date-range-8o_f5N7V.js";
|
|
16
|
-
import { S as
|
|
17
|
-
import { S as Ha, d as Ba } from "./delay-
|
|
16
|
+
import { S as Na } from "./date-range-inline-B_K4YPtB.js";
|
|
17
|
+
import { S as Ha, d as Ba } from "./delay-DtVBjjLV.js";
|
|
18
18
|
import { C as Fa, S as Oa, a as $a } from "./dialog-content-C_paCOeM.js";
|
|
19
19
|
import { $ as ka, D as La } from "./dialog-service-DZv4KB89.js";
|
|
20
20
|
import { c as Ya, f as za, r as Ga } from "./ripple-BumgqsDT.js";
|
|
21
21
|
import "./divider-Dn26vIou.js";
|
|
22
|
-
import { S as Wa, a as Ka } from "./dropdown-content-
|
|
22
|
+
import { S as Wa, a as Ka } from "./dropdown-content-DNJhJCdV.js";
|
|
23
23
|
import { S as qa, a as Qa } from "./timezone-Cvsd--fr.js";
|
|
24
24
|
import "./form-Cots2cbN.js";
|
|
25
25
|
import "./icon-BZxC9aoA.js";
|
|
@@ -27,7 +27,7 @@ import { S as Ua, a as Xa } from "./input-Cpo-ws8k.js";
|
|
|
27
27
|
import { S as ae, c as ee, a as re, b as te } from "./flex-DV2W2Zgu.js";
|
|
28
28
|
import { L as se, a as ce, S as ne } from "./list-BTyoQ42F.js";
|
|
29
29
|
import "./menu-DWCDQvGY.js";
|
|
30
|
-
import { $ as Se, N as ie, S as
|
|
30
|
+
import { $ as Se, N as ie, S as pe, a as ye } from "./notification-service-L_h9_d4v.js";
|
|
31
31
|
import "./option-vRGeXw_u.js";
|
|
32
32
|
import "./progress-DM_jha7D.js";
|
|
33
33
|
import { a as le, R as fe } from "./radio-button-YDzqdRA-.js";
|
|
@@ -35,25 +35,26 @@ import { mutationObserver as Ce } from "./rxjs-utils.js";
|
|
|
35
35
|
import "rxjs";
|
|
36
36
|
import "./index-CuY8m6ta.js";
|
|
37
37
|
import { S as ge } from "./select-rwocpGs2.js";
|
|
38
|
-
import { S as De, b as
|
|
38
|
+
import { S as De, b as be, a as we, s as Te } from "./sheet-Cw2qLdzN.js";
|
|
39
39
|
import { S as Me, a as Re } from "./slider-C7Z1bPq7.js";
|
|
40
|
-
import { S as
|
|
40
|
+
import { S as Ne, a as ve, b as He, s as Be } from "./schmancy-steps-container-CoARMXfB.js";
|
|
41
41
|
import { B as Fe, I as Oe, L as $e, M as je, S as ke, a as Le, b as Pe, d as Ye, c as ze } from "./context-object-CDDP4bTk.js";
|
|
42
|
-
import { p as Ve, a as We, v as Ke, G as _e, c as qe, E as Qe, z as Je, C as Ue, B as Xe, x as Ze, w as ar, y as er, D as rr, F as tr, u as or, A as sr, b as cr, r as nr, d as mr, q as Sr, f as ir, g as
|
|
43
|
-
import { a as
|
|
42
|
+
import { p as Ve, a as We, v as Ke, G as _e, c as qe, E as Qe, z as Je, C as Ue, B as Xe, x as Ze, w as ar, y as er, D as rr, F as tr, u as or, A as sr, b as cr, r as nr, d as mr, q as Sr, f as ir, g as pr, i as yr, j as hr, k as lr, l as fr, o as xr, h as Cr, n as dr, m as gr, e as ur, s as Dr, t as br } from "./selector-hook-CIpuCUbr.js";
|
|
43
|
+
import { a as Tr, S as Ir } from "./surface-By8o7nWa.js";
|
|
44
44
|
import { a as Rr, S as Ar } from "./table-CvMo5lOi.js";
|
|
45
45
|
import "./tabs-compatibility-BEXurIiZ.js";
|
|
46
46
|
import "./textarea-DM3lgEUp.js";
|
|
47
|
-
import { S as
|
|
47
|
+
import { S as vr, a as Hr, T as Br, f as Er, t as Fr } from "./theme.component-ColRTbY5.js";
|
|
48
48
|
import { S as $r } from "./theme.interface-C5Kj6WjD.js";
|
|
49
49
|
import "./theme-button-C4JWRMiC.js";
|
|
50
50
|
import { S as kr, t as Lr } from "./tooltip-nwQwCEgl.js";
|
|
51
51
|
import { S as Yr } from "./tree-BDmB7KmQ.js";
|
|
52
52
|
import { SchmancyEvents as Gr } from "./types.js";
|
|
53
|
-
import { T as Wr } from "./typewriter-
|
|
53
|
+
import { T as Wr } from "./typewriter-CXadCi-4.js";
|
|
54
54
|
import { S as _r } from "./typography-DYCOngD7.js";
|
|
55
55
|
import { i as Qr } from "./intersection-CJxzz8c-.js";
|
|
56
|
-
import {
|
|
56
|
+
import { N as Ur } from "./number-BhTiptLA.js";
|
|
57
|
+
import { s as Zr } from "./search-6Hr7K1gh.js";
|
|
57
58
|
export {
|
|
58
59
|
ka as $dialog,
|
|
59
60
|
P as $drawer,
|
|
@@ -70,6 +71,7 @@ export {
|
|
|
70
71
|
$e as LocalStorageManager,
|
|
71
72
|
je as MemoryStorageManager,
|
|
72
73
|
ie as NotificationAudioService,
|
|
74
|
+
Ur as Numbers,
|
|
73
75
|
le as RadioButton,
|
|
74
76
|
fe as RadioGroup,
|
|
75
77
|
z as ScBadgeV2,
|
|
@@ -77,13 +79,13 @@ export {
|
|
|
77
79
|
ke as SchmancyArrayStore,
|
|
78
80
|
G as SchmancyAvatar,
|
|
79
81
|
V as SchmancyBadgeV2,
|
|
80
|
-
|
|
82
|
+
pa as SchmancyBoat,
|
|
81
83
|
ha as SchmancyButton,
|
|
82
84
|
xa as SchmancyCheckbox,
|
|
83
85
|
da as SchmancyCircularProgress,
|
|
84
86
|
ua as SchmancyCode,
|
|
85
87
|
Da as SchmancyCodeHighlight,
|
|
86
|
-
|
|
88
|
+
ba as SchmancyCodePreview,
|
|
87
89
|
W as SchmancyContentDrawer,
|
|
88
90
|
K as SchmancyContentDrawerID,
|
|
89
91
|
_ as SchmancyContentDrawerMain,
|
|
@@ -95,7 +97,7 @@ export {
|
|
|
95
97
|
qa as SchmancyCountriesSelect,
|
|
96
98
|
Rr as SchmancyDataTable,
|
|
97
99
|
Ma as SchmancyDateRange,
|
|
98
|
-
|
|
100
|
+
Na as SchmancyDateRangeInline,
|
|
99
101
|
Ha as SchmancyDelay,
|
|
100
102
|
Oa as SchmancyDialog,
|
|
101
103
|
$a as SchmancyDialogContent,
|
|
@@ -115,38 +117,38 @@ export {
|
|
|
115
117
|
ra as SchmancyNavigationDrawer,
|
|
116
118
|
ta as SchmancyNavigationDrawerContent,
|
|
117
119
|
oa as SchmancyNavigationDrawerSidebar,
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
120
|
+
pe as SchmancyNotification,
|
|
121
|
+
ye as SchmancyNotificationContainer,
|
|
122
|
+
Ta as SchmancyPaymentCardForm,
|
|
121
123
|
te as SchmancyScroll,
|
|
122
124
|
ge as SchmancySelect,
|
|
123
125
|
De as SchmancySheetPosition,
|
|
124
126
|
Me as SchmancySlide,
|
|
125
127
|
Re as SchmancySlider,
|
|
126
|
-
|
|
127
|
-
|
|
128
|
+
Ne as SchmancyStep,
|
|
129
|
+
ve as SchmancyStepsContainer,
|
|
128
130
|
Le as SchmancyStoreObject,
|
|
129
|
-
|
|
131
|
+
Tr as SchmancySurface,
|
|
130
132
|
Ir as SchmancySurfaceTypeContext,
|
|
131
133
|
Ar as SchmancyTableRow,
|
|
132
134
|
sa as SchmancyTeleportation,
|
|
133
135
|
$r as SchmancyTheme,
|
|
134
|
-
|
|
136
|
+
vr as SchmancyThemeComponent,
|
|
135
137
|
Qa as SchmancyTimezonesSelect,
|
|
136
138
|
kr as SchmancyTooltip,
|
|
137
139
|
Yr as SchmancyTree,
|
|
138
140
|
_r as SchmancyTypography,
|
|
139
141
|
la as SchmnacyIconButton,
|
|
140
142
|
Pe as SessionStorageManager,
|
|
141
|
-
|
|
142
|
-
|
|
143
|
+
be as SheetHereMorty,
|
|
144
|
+
we as SheetWhereAreYouRicky,
|
|
143
145
|
He as StepsController,
|
|
144
146
|
Ye as StoreError,
|
|
145
147
|
Hr as ThemeHereIAm,
|
|
146
148
|
Br as ThemeWhereAreYou,
|
|
147
149
|
Wr as TypewriterElement,
|
|
148
150
|
ca as WhereAreYouRicky,
|
|
149
|
-
|
|
151
|
+
b as area,
|
|
150
152
|
I as buildQueryString,
|
|
151
153
|
Ya as color,
|
|
152
154
|
M as compareActiveRoutes,
|
|
@@ -166,12 +168,12 @@ export {
|
|
|
166
168
|
er as createKeysSelector,
|
|
167
169
|
rr as createMapSelector,
|
|
168
170
|
tr as createOptimizedSelector,
|
|
169
|
-
|
|
171
|
+
N as createRouteCacheKey,
|
|
170
172
|
or as createSelector,
|
|
171
173
|
sr as createSortSelector,
|
|
172
174
|
ze as createStorageManager,
|
|
173
175
|
cr as createTestArrayContext,
|
|
174
|
-
|
|
176
|
+
v as debounce,
|
|
175
177
|
H as decodeRouteState,
|
|
176
178
|
B as deepMerge,
|
|
177
179
|
Ba as delayContext,
|
|
@@ -183,10 +185,10 @@ export {
|
|
|
183
185
|
ir as filterMapItems,
|
|
184
186
|
Er as formateTheme,
|
|
185
187
|
za as fullHeight,
|
|
186
|
-
|
|
188
|
+
pr as getFieldValue,
|
|
187
189
|
O as getTagName,
|
|
188
190
|
Qr as intersection$,
|
|
189
|
-
|
|
191
|
+
yr as isArray,
|
|
190
192
|
hr as isDate,
|
|
191
193
|
lr as isIterable,
|
|
192
194
|
fr as isMap,
|
|
@@ -199,14 +201,14 @@ export {
|
|
|
199
201
|
Ce as mutationObserver,
|
|
200
202
|
j as normalizeTagName,
|
|
201
203
|
Ga as ripple,
|
|
202
|
-
|
|
204
|
+
w as routerHistory,
|
|
203
205
|
k as sanitizeRouteState,
|
|
204
206
|
na as schmancyContentDrawer,
|
|
205
207
|
ma as schmancyNavDrawer,
|
|
206
208
|
Dr as select,
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
209
|
+
br as selectItem,
|
|
210
|
+
Te as sheet,
|
|
211
|
+
Zr as similarity,
|
|
210
212
|
Be as stepsContext,
|
|
211
213
|
Fr as tailwindStyles,
|
|
212
214
|
Sa as teleport,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/nav-drawer.js
CHANGED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";exports.Numbers=class{roundNumber(t,n=2){const r=Math.pow(10,n);return Math.round(t*r)/r}formatNumber(t,n="de-DE",r={}){return new Intl.NumberFormat(n,r).format(t)}parseToPureNumber(t,n=","){const r=t.replace(n,".");return parseFloat(r)}doIt(t,n=2,r="de-DE",u={}){const o=this.roundNumber(t,n);return this.formatNumber(o,r,u)}formatCurrency(t,n="€"){return`${n}${this.doIt(t)}`}formatDelta(t,n="€"){return`${t>0?"↑":t<0?"↓":"→"} ${n}${this.doIt(Math.abs(t))}`}getDeltaClass(t){return t>0?"text-error-default":t<0?"text-primary-default":"text-neutral"}toMixedFraction(t,n=16,r=4){const u=t<0;t=Math.abs(t);const o=Math.floor(t);let d=t-o;if(d<1/Math.pow(10,n))return u?`-${o}`:`${o}`;const{numerator:s,denominator:$}=this.decimalToFraction(d,n,r);return o===0?u?`-${s}/${$}`:`${s}/${$}`:u?`-${o} ${s}/${$}`:`${o} ${s}/${$}`}decimalToFraction(t,n,r=4){if(t===0)return{numerator:0,denominator:1};let u=1/0,o=0,d=1;const s=[];r>=5&&s.push({n:1,d:5},{n:2,d:5},{n:3,d:5},{n:4,d:5}),r>=6&&s.push({n:1,d:6},{n:5,d:6}),r>=8&&s.push({n:1,d:8},{n:3,d:8},{n:5,d:8},{n:7,d:8}),r>=10&&s.push({n:1,d:10},{n:3,d:10},{n:7,d:10},{n:9,d:10}),r>=12&&s.push({n:1,d:12},{n:5,d:12},{n:7,d:12},{n:11,d:12}),r>=16&&s.push({n:1,d:16},{n:3,d:16},{n:5,d:16},{n:7,d:16},{n:9,d:16},{n:11,d:16},{n:13,d:16},{n:15,d:16});const $=[{n:1,d:2},{n:1,d:3},{n:2,d:3},{n:1,d:4},{n:3,d:4},...s];for(const e of $)if(e.d<=r){const c=Math.abs(t-e.n/e.d);if(c<u&&(u=c,o=e.n,d=e.d,c<1/Math.pow(10,n)))return{numerator:e.n,denominator:e.d}}for(let e=1;e<=r;e++){const c=Math.round(t*e),i=Math.abs(t-c/e);i<u&&(u=i,o=c,d=e)}if(u>1/Math.pow(10,n/2)&&r>4){let e=1,c=0,i=0,a=1,h=t;do{let p=Math.floor(h),l=e;if(e=p*e+c,c=l,l=i,i=p*i+a,a=l,h=1/(h-p),Math.abs(t-e/i)<1/Math.pow(10,n)||i>r)return i>r?{numerator:o,denominator:d}:{numerator:e,denominator:i}}while(h!==1/0);o=e,d=i}const m=this.findGCD(o,d);return{numerator:o/m,denominator:d/m}}findGCD(t,n){return n===0?t:this.findGCD(n,t%n)}formatMixedFraction(t,n="ascii",r=16,u=4){const o=this.toMixedFraction(t,r,u);if(n==="ascii")return o;const d=o.startsWith("-"),s=d?o.substring(1):o,$=s.includes(" ");if(!s.includes("/"))return o;let m="",e=s;if($){const a=s.split(" ");m=a[0],e=a[1]}const[c,i]=e.split("/");if(n==="unicode"){const a=this.getUnicodeFraction(parseInt(c),parseInt(i));return a?d?`-${m}${$?" ":""}${a}`:`${m}${$?" ":""}${a}`:o}if(n==="superscript"){const a=this.toSuperscript(c),h=this.toSubscript(i);return $?d?`-${m} ${a}⁄${h}`:`${m} ${a}⁄${h}`:d?`-${a}⁄${h}`:`${a}⁄${h}`}return o}getUnicodeFraction(t,n){return{"1/4":"¼","1/2":"½","3/4":"¾","1/3":"⅓","2/3":"⅔","1/5":"⅕","2/5":"⅖","3/5":"⅗","4/5":"⅘","1/6":"⅙","5/6":"⅚","1/7":"⅐","1/8":"⅛","3/8":"⅜","5/8":"⅝","7/8":"⅞","1/9":"⅑","1/10":"⅒"}[`${t}/${n}`]||null}toSuperscript(t){const n={0:"⁰",1:"¹",2:"²",3:"³",4:"⁴",5:"⁵",6:"⁶",7:"⁷",8:"⁸",9:"⁹","-":"⁻"};return t.split("").map(r=>n[r]||r).join("")}toSubscript(t){const n={0:"₀",1:"₁",2:"₂",3:"₃",4:"₄",5:"₅",6:"₆",7:"₇",8:"₈",9:"₉","-":"₋"};return t.split("").map(r=>n[r]||r).join("")}};
|
|
2
|
+
//# sourceMappingURL=number-B7aCRYnH.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number-B7aCRYnH.cjs","sources":["../src/utils/number.ts"],"sourcesContent":["export class Numbers {\n /**\n * Rounds a number to the specified number of decimal places.\n * @param {number} number - The number to round.\n * @param {number} [decimalPlaces=2] - The number of decimal places to round to.\n * @returns {number} - The rounded number.\n */\n roundNumber(number: number, decimalPlaces: number = 2): number {\n const factor = Math.pow(10, decimalPlaces);\n return Math.round(number * factor) / factor;\n }\n\n /**\n * Formats a number according to the specified locale and options.\n * @param {number} number - The number to format.\n * @param {string} [locale='de-DE'] - The locale string (e.g., 'de-DE' for German).\n * @param {Intl.NumberFormatOptions} [options={}] - Additional formatting options.\n * @returns {string} - The formatted number as a string.\n */\n formatNumber(\n number: number,\n locale: string = \"de-DE\",\n options: Intl.NumberFormatOptions = {},\n ): string {\n return new Intl.NumberFormat(locale, options).format(number);\n }\n\n /**\n * Parses a string with a specified decimal separator into a number.\n * @param {string} numberString - The string to parse.\n * @param {string} [decimalSeparator=','] - The decimal separator used in the string.\n * @returns {number} - The parsed number.\n */\n parseToPureNumber(\n numberString: string,\n decimalSeparator: string = \",\",\n ): number {\n const normalizedString = numberString.replace(decimalSeparator, \".\");\n return parseFloat(normalizedString);\n }\n\n /**\n * Rounds a number to the specified decimal places and formats it according to the specified locale and options.\n * @param {number} number - The number to process.\n * @param {number} [decimalPlaces=2] - The number of decimal places to round to.\n * @param {string} [locale='de-DE'] - The locale string.\n * @param {Intl.NumberFormatOptions} [options={}] - Additional formatting options.\n * @returns {string} - The formatted number as a string.\n */\n doIt(\n number: number,\n decimalPlaces: number = 2,\n locale: string = \"de-DE\",\n options: Intl.NumberFormatOptions = {},\n ): string {\n const roundedNumber = this.roundNumber(number, decimalPlaces);\n return this.formatNumber(roundedNumber, locale, options);\n }\n\n /**\n * Format a currency amount consistently across the application\n *\n * @param amount The amount to format\n * @param currency The currency symbol to display (default: '€')\n * @returns Formatted amount with currency symbol\n */\n formatCurrency(amount: number, currency: string = \"€\"): string {\n return `${currency}${this.doIt(amount)}`;\n }\n\n /**\n * Format a delta value with appropriate directional indicator\n *\n * @param delta The delta amount to format\n * @param currency The currency symbol to display (default: '€')\n * @returns Formatted delta with direction indicator and currency symbol\n */\n formatDelta(delta: number, currency: string = \"€\"): string {\n const symbol = delta > 0 ? \"↑\" : delta < 0 ? \"↓\" : \"→\";\n return `${symbol} ${currency}${this.doIt(Math.abs(delta))}`;\n }\n\n /**\n * Get CSS class for delta value\n *\n * @param delta The delta amount\n * @returns CSS class based on delta direction\n */\n getDeltaClass(delta: number): string {\n return delta > 0\n ? \"text-error-default\"\n : delta < 0\n ? \"text-primary-default\"\n : \"text-neutral\";\n }\n\n /**\n * Converts a decimal number to a mixed fraction string\n * For example: 1.5 becomes \"1 1/2\", 2.25 becomes \"2 1/4\"\n *\n * @param number The decimal number to convert\n * @param precision The precision level for fraction approximation (default: 16)\n * @param maxDenominator The maximum allowed denominator (default: 4)\n * @returns A string representing the mixed fraction\n */\n toMixedFraction(\n number: number,\n precision: number = 16,\n maxDenominator: number = 4,\n ): string {\n // Handle negative numbers\n const isNegative = number < 0;\n number = Math.abs(number);\n\n // Extract whole number part\n const wholePart = Math.floor(number);\n\n // Extract decimal part and convert to fraction\n let decimalPart = number - wholePart;\n\n // If the decimal part is very small or zero, just return the whole number\n if (decimalPart < 1 / Math.pow(10, precision)) {\n return isNegative ? `-${wholePart}` : `${wholePart}`;\n }\n\n // Find the best fraction approximation using precision and max denominator\n const { numerator, denominator } = this.decimalToFraction(\n decimalPart,\n precision,\n maxDenominator,\n );\n\n // Format based on whether there's a whole part\n if (wholePart === 0) {\n return isNegative\n ? `-${numerator}/${denominator}`\n : `${numerator}/${denominator}`;\n } else {\n return isNegative\n ? `-${wholePart} ${numerator}/${denominator}`\n : `${wholePart} ${numerator}/${denominator}`;\n }\n }\n\n /**\n * Converts a decimal to a simplified fraction with a maximum denominator\n *\n * @param decimal The decimal part to convert (0 <= decimal < 1)\n * @param precision The precision level for approximation\n * @param maxDenominator The maximum allowed denominator (default: 4)\n * @returns Object containing numerator and denominator\n */\n private decimalToFraction(\n decimal: number,\n precision: number,\n maxDenominator: number = 4,\n ): { numerator: number; denominator: number } {\n if (decimal === 0) {\n return { numerator: 0, denominator: 1 };\n }\n\n // Initialize best approximation\n let bestError = Infinity;\n let bestNumerator = 0;\n let bestDenominator = 1;\n\n // Check common fractions first for better user experience\n // Filter to only include fractions with denominators <= maxDenominator\n const commonFractions = [\n { n: 1, d: 2 }, // 1/2\n { n: 1, d: 3 }, // 1/3\n { n: 2, d: 3 }, // 2/3\n { n: 1, d: 4 }, // 1/4\n { n: 3, d: 4 }, // 3/4\n ];\n\n // Add additional fractions only if maxDenominator allows\n const additionalFractions = [];\n if (maxDenominator >= 5) {\n additionalFractions.push(\n { n: 1, d: 5 }, // 1/5\n { n: 2, d: 5 }, // 2/5\n { n: 3, d: 5 }, // 3/5\n { n: 4, d: 5 }, // 4/5\n );\n }\n if (maxDenominator >= 6) {\n additionalFractions.push(\n { n: 1, d: 6 }, // 1/6\n { n: 5, d: 6 }, // 5/6\n );\n }\n if (maxDenominator >= 8) {\n additionalFractions.push(\n { n: 1, d: 8 }, // 1/8\n { n: 3, d: 8 }, // 3/8\n { n: 5, d: 8 }, // 5/8\n { n: 7, d: 8 }, // 7/8\n );\n }\n if (maxDenominator >= 10) {\n additionalFractions.push(\n { n: 1, d: 10 }, // 1/10\n { n: 3, d: 10 }, // 3/10\n { n: 7, d: 10 }, // 7/10\n { n: 9, d: 10 }, // 9/10\n );\n }\n if (maxDenominator >= 12) {\n additionalFractions.push(\n { n: 1, d: 12 }, // 1/12\n { n: 5, d: 12 }, // 5/12\n { n: 7, d: 12 }, // 7/12\n { n: 11, d: 12 }, // 11/12\n );\n }\n if (maxDenominator >= 16) {\n additionalFractions.push(\n { n: 1, d: 16 }, // 1/16\n { n: 3, d: 16 }, // 3/16\n { n: 5, d: 16 }, // 5/16\n { n: 7, d: 16 }, // 7/16\n { n: 9, d: 16 }, // 9/16\n { n: 11, d: 16 }, // 11/16\n { n: 13, d: 16 }, // 13/16\n { n: 15, d: 16 }, // 15/16\n );\n }\n\n // Combine all applicable fractions\n const allFractions = [...commonFractions, ...additionalFractions];\n\n // Check common fractions first\n for (const frac of allFractions) {\n if (frac.d <= maxDenominator) {\n const error = Math.abs(decimal - frac.n / frac.d);\n if (error < bestError) {\n bestError = error;\n bestNumerator = frac.n;\n bestDenominator = frac.d;\n\n // If we're very close to a common fraction, just use it\n if (error < 1 / Math.pow(10, precision)) {\n return { numerator: frac.n, denominator: frac.d };\n }\n }\n }\n }\n\n // If no suitable common fraction found, use a more sophisticated approach\n // for denominators up to maxDenominator\n\n // Find the best approximation with denominator <= maxDenominator\n for (let d = 1; d <= maxDenominator; d++) {\n // Find best numerator for this denominator\n const n = Math.round(decimal * d);\n const error = Math.abs(decimal - n / d);\n\n if (error < bestError) {\n bestError = error;\n bestNumerator = n;\n bestDenominator = d;\n }\n }\n\n // Only use continued fraction expansion if we're significantly off\n // and maxDenominator allows for larger denominators\n if (bestError > 1 / Math.pow(10, precision / 2) && maxDenominator > 4) {\n // Implementation of continued fraction expansion\n let n1 = 1,\n n2 = 0;\n let d1 = 0,\n d2 = 1;\n let b = decimal;\n\n do {\n let a = Math.floor(b);\n let aux = n1;\n n1 = a * n1 + n2;\n n2 = aux;\n\n aux = d1;\n d1 = a * d1 + d2;\n d2 = aux;\n\n b = 1 / (b - a);\n\n // Calculate the current approximation\n const currentError = Math.abs(decimal - n1 / d1);\n\n // If we hit the precision limit or if the denominator gets too large, use this approximation\n if (currentError < 1 / Math.pow(10, precision) || d1 > maxDenominator) {\n // If d1 exceeds maxDenominator, return the previous best result\n if (d1 > maxDenominator) {\n return { numerator: bestNumerator, denominator: bestDenominator };\n }\n\n // Otherwise return this result\n return { numerator: n1, denominator: d1 };\n }\n } while (b !== Infinity);\n\n bestNumerator = n1;\n bestDenominator = d1;\n }\n\n // Simplify the fraction\n const gcd = this.findGCD(bestNumerator, bestDenominator);\n return {\n numerator: bestNumerator / gcd,\n denominator: bestDenominator / gcd,\n };\n }\n\n /**\n * Calculates the greatest common divisor of two numbers\n */\n private findGCD(a: number, b: number): number {\n return b === 0 ? a : this.findGCD(b, a % b);\n }\n\n /**\n * Alternative method to get a formatted mixed fraction with a specified format\n *\n * @param number The decimal number to convert\n * @param format The format specification ('unicode', 'ascii', 'superscript')\n * @param precision The precision level for fraction approximation\n * @param maxDenominator The maximum allowed denominator (default: 4)\n * @returns A formatted string representing the mixed fraction\n */\n formatMixedFraction(\n number: number,\n format: \"unicode\" | \"ascii\" | \"superscript\" = \"ascii\",\n precision: number = 16,\n maxDenominator: number = 4,\n ): string {\n // Get the basic mixed fraction\n const basicFraction = this.toMixedFraction(\n number,\n precision,\n maxDenominator,\n );\n\n // If the format is ascii, just return the basic fraction\n if (format === \"ascii\") {\n return basicFraction;\n }\n\n // For unicode and superscript formats, we need to parse the basic fraction\n const isNegative = basicFraction.startsWith(\"-\");\n const withoutSign = isNegative ? basicFraction.substring(1) : basicFraction;\n\n // Check if it's a pure fraction or mixed fraction\n const hasMixedPart = withoutSign.includes(\" \");\n\n if (!withoutSign.includes(\"/\")) {\n // If there's no fraction part, just return the number\n return basicFraction;\n }\n\n let wholePart = \"\";\n let fractionPart = withoutSign;\n\n if (hasMixedPart) {\n // Split the whole and fraction parts\n const parts = withoutSign.split(\" \");\n wholePart = parts[0];\n fractionPart = parts[1];\n }\n\n // Split the fraction part into numerator and denominator\n const [numerator, denominator] = fractionPart.split(\"/\");\n\n if (format === \"unicode\") {\n // Try to find a unicode fraction character\n const unicodeFraction = this.getUnicodeFraction(\n parseInt(numerator),\n parseInt(denominator),\n );\n\n if (unicodeFraction) {\n return isNegative\n ? `-${wholePart}${hasMixedPart ? \" \" : \"\"}${unicodeFraction}`\n : `${wholePart}${hasMixedPart ? \" \" : \"\"}${unicodeFraction}`;\n }\n\n // Fallback to basic format if no unicode fraction is available\n return basicFraction;\n }\n\n // Handle superscript format\n if (format === \"superscript\") {\n const superNumerator = this.toSuperscript(numerator);\n const subDenominator = this.toSubscript(denominator);\n\n if (hasMixedPart) {\n return isNegative\n ? `-${wholePart} ${superNumerator}⁄${subDenominator}`\n : `${wholePart} ${superNumerator}⁄${subDenominator}`;\n } else {\n return isNegative\n ? `-${superNumerator}⁄${subDenominator}`\n : `${superNumerator}⁄${subDenominator}`;\n }\n }\n\n // Fallback to basic format\n return basicFraction;\n }\n\n /**\n * Gets the Unicode fraction character if available\n *\n * @param numerator The numerator\n * @param denominator The denominator\n * @returns Unicode fraction character or null if not available\n */\n private getUnicodeFraction(\n numerator: number,\n denominator: number,\n ): string | null {\n // Map common fractions to their Unicode characters\n const fractionMap: Record<string, string> = {\n \"1/4\": \"¼\",\n \"1/2\": \"½\",\n \"3/4\": \"¾\",\n \"1/3\": \"⅓\",\n \"2/3\": \"⅔\",\n \"1/5\": \"⅕\",\n \"2/5\": \"⅖\",\n \"3/5\": \"⅗\",\n \"4/5\": \"⅘\",\n \"1/6\": \"⅙\",\n \"5/6\": \"⅚\",\n \"1/7\": \"⅐\",\n \"1/8\": \"⅛\",\n \"3/8\": \"⅜\",\n \"5/8\": \"⅝\",\n \"7/8\": \"⅞\",\n \"1/9\": \"⅑\",\n \"1/10\": \"⅒\",\n };\n\n const key = `${numerator}/${denominator}`;\n return fractionMap[key] || null;\n }\n\n /**\n * Converts digits to superscript\n */\n private toSuperscript(str: string): string {\n const superscriptMap: Record<string, string> = {\n \"0\": \"⁰\",\n \"1\": \"¹\",\n \"2\": \"²\",\n \"3\": \"³\",\n \"4\": \"⁴\",\n \"5\": \"⁵\",\n \"6\": \"⁶\",\n \"7\": \"⁷\",\n \"8\": \"⁸\",\n \"9\": \"⁹\",\n \"-\": \"⁻\",\n };\n\n return str\n .split(\"\")\n .map((char) => superscriptMap[char] || char)\n .join(\"\");\n }\n\n /**\n * Converts digits to subscript\n */\n private toSubscript(str: string): string {\n const subscriptMap: Record<string, string> = {\n \"0\": \"₀\",\n \"1\": \"₁\",\n \"2\": \"₂\",\n \"3\": \"₃\",\n \"4\": \"₄\",\n \"5\": \"₅\",\n \"6\": \"₆\",\n \"7\": \"₇\",\n \"8\": \"₈\",\n \"9\": \"₉\",\n \"-\": \"₋\",\n };\n\n return str\n .split(\"\")\n .map((char) => subscriptMap[char] || char)\n .join(\"\");\n }\n}\n\n"],"names":["number","decimalPlaces","factor","Math","pow","round","locale","options","Intl","NumberFormat","format","numberString","decimalSeparator","normalizedString","replace","parseFloat","roundedNumber","this","roundNumber","formatNumber","amount","currency","doIt","delta","abs","precision","maxDenominator","isNegative","wholePart","floor","decimalPart","numerator","denominator","decimalToFraction","decimal","bestError","Infinity","bestNumerator","bestDenominator","additionalFractions","push","n","d","allFractions","frac","error","n1","n2","d1","d2","b","a","aux","gcd","findGCD","basicFraction","toMixedFraction","startsWith","withoutSign","substring","hasMixedPart","includes","fractionPart","parts","split","unicodeFraction","getUnicodeFraction","parseInt","superNumerator","toSuperscript","subDenominator","toSubscript","str","superscriptMap","map","char","join","subscriptMap"],"mappings":"6BAAO,KAAA,CAOL,YAAYA,EAAgBC,EAAwB,EAAA,CAClD,MAAMC,EAASC,KAAKC,IAAI,GAAIH,CAAAA,EAC5B,OAAOE,KAAKE,MAAML,EAASE,CAAAA,EAAUA,CACvC,CASA,aACEF,EACAM,EAAiB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A,EACpCC,KAAK,EAAA,CACV,CAAA"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
class M {
|
|
2
|
+
roundNumber(t, n = 2) {
|
|
3
|
+
const r = Math.pow(10, n);
|
|
4
|
+
return Math.round(t * r) / r;
|
|
5
|
+
}
|
|
6
|
+
formatNumber(t, n = "de-DE", r = {}) {
|
|
7
|
+
return new Intl.NumberFormat(n, r).format(t);
|
|
8
|
+
}
|
|
9
|
+
parseToPureNumber(t, n = ",") {
|
|
10
|
+
const r = t.replace(n, ".");
|
|
11
|
+
return parseFloat(r);
|
|
12
|
+
}
|
|
13
|
+
doIt(t, n = 2, r = "de-DE", u = {}) {
|
|
14
|
+
const o = this.roundNumber(t, n);
|
|
15
|
+
return this.formatNumber(o, r, u);
|
|
16
|
+
}
|
|
17
|
+
formatCurrency(t, n = "€") {
|
|
18
|
+
return `${n}${this.doIt(t)}`;
|
|
19
|
+
}
|
|
20
|
+
formatDelta(t, n = "€") {
|
|
21
|
+
return `${t > 0 ? "↑" : t < 0 ? "↓" : "→"} ${n}${this.doIt(Math.abs(t))}`;
|
|
22
|
+
}
|
|
23
|
+
getDeltaClass(t) {
|
|
24
|
+
return t > 0 ? "text-error-default" : t < 0 ? "text-primary-default" : "text-neutral";
|
|
25
|
+
}
|
|
26
|
+
toMixedFraction(t, n = 16, r = 4) {
|
|
27
|
+
const u = t < 0;
|
|
28
|
+
t = Math.abs(t);
|
|
29
|
+
const o = Math.floor(t);
|
|
30
|
+
let s = t - o;
|
|
31
|
+
if (s < 1 / Math.pow(10, n)) return u ? `-${o}` : `${o}`;
|
|
32
|
+
const { numerator: d, denominator: $ } = this.decimalToFraction(s, n, r);
|
|
33
|
+
return o === 0 ? u ? `-${d}/${$}` : `${d}/${$}` : u ? `-${o} ${d}/${$}` : `${o} ${d}/${$}`;
|
|
34
|
+
}
|
|
35
|
+
decimalToFraction(t, n, r = 4) {
|
|
36
|
+
if (t === 0) return { numerator: 0, denominator: 1 };
|
|
37
|
+
let u = 1 / 0, o = 0, s = 1;
|
|
38
|
+
const d = [];
|
|
39
|
+
r >= 5 && d.push({ n: 1, d: 5 }, { n: 2, d: 5 }, { n: 3, d: 5 }, { n: 4, d: 5 }), r >= 6 && d.push({ n: 1, d: 6 }, { n: 5, d: 6 }), r >= 8 && d.push({ n: 1, d: 8 }, { n: 3, d: 8 }, { n: 5, d: 8 }, { n: 7, d: 8 }), r >= 10 && d.push({ n: 1, d: 10 }, { n: 3, d: 10 }, { n: 7, d: 10 }, { n: 9, d: 10 }), r >= 12 && d.push({ n: 1, d: 12 }, { n: 5, d: 12 }, { n: 7, d: 12 }, { n: 11, d: 12 }), r >= 16 && d.push({ n: 1, d: 16 }, { n: 3, d: 16 }, { n: 5, d: 16 }, { n: 7, d: 16 }, { n: 9, d: 16 }, { n: 11, d: 16 }, { n: 13, d: 16 }, { n: 15, d: 16 });
|
|
40
|
+
const $ = [{ n: 1, d: 2 }, { n: 1, d: 3 }, { n: 2, d: 3 }, { n: 1, d: 4 }, { n: 3, d: 4 }, ...d];
|
|
41
|
+
for (const e of $) if (e.d <= r) {
|
|
42
|
+
const c = Math.abs(t - e.n / e.d);
|
|
43
|
+
if (c < u && (u = c, o = e.n, s = e.d, c < 1 / Math.pow(10, n))) return { numerator: e.n, denominator: e.d };
|
|
44
|
+
}
|
|
45
|
+
for (let e = 1; e <= r; e++) {
|
|
46
|
+
const c = Math.round(t * e), i = Math.abs(t - c / e);
|
|
47
|
+
i < u && (u = i, o = c, s = e);
|
|
48
|
+
}
|
|
49
|
+
if (u > 1 / Math.pow(10, n / 2) && r > 4) {
|
|
50
|
+
let e = 1, c = 0, i = 0, a = 1, h = t;
|
|
51
|
+
do {
|
|
52
|
+
let m = Math.floor(h), l = e;
|
|
53
|
+
if (e = m * e + c, c = l, l = i, i = m * i + a, a = l, h = 1 / (h - m), Math.abs(t - e / i) < 1 / Math.pow(10, n) || i > r) return i > r ? { numerator: o, denominator: s } : { numerator: e, denominator: i };
|
|
54
|
+
} while (h !== 1 / 0);
|
|
55
|
+
o = e, s = i;
|
|
56
|
+
}
|
|
57
|
+
const p = this.findGCD(o, s);
|
|
58
|
+
return { numerator: o / p, denominator: s / p };
|
|
59
|
+
}
|
|
60
|
+
findGCD(t, n) {
|
|
61
|
+
return n === 0 ? t : this.findGCD(n, t % n);
|
|
62
|
+
}
|
|
63
|
+
formatMixedFraction(t, n = "ascii", r = 16, u = 4) {
|
|
64
|
+
const o = this.toMixedFraction(t, r, u);
|
|
65
|
+
if (n === "ascii") return o;
|
|
66
|
+
const s = o.startsWith("-"), d = s ? o.substring(1) : o, $ = d.includes(" ");
|
|
67
|
+
if (!d.includes("/")) return o;
|
|
68
|
+
let p = "", e = d;
|
|
69
|
+
if ($) {
|
|
70
|
+
const a = d.split(" ");
|
|
71
|
+
p = a[0], e = a[1];
|
|
72
|
+
}
|
|
73
|
+
const [c, i] = e.split("/");
|
|
74
|
+
if (n === "unicode") {
|
|
75
|
+
const a = this.getUnicodeFraction(parseInt(c), parseInt(i));
|
|
76
|
+
return a ? s ? `-${p}${$ ? " " : ""}${a}` : `${p}${$ ? " " : ""}${a}` : o;
|
|
77
|
+
}
|
|
78
|
+
if (n === "superscript") {
|
|
79
|
+
const a = this.toSuperscript(c), h = this.toSubscript(i);
|
|
80
|
+
return $ ? s ? `-${p} ${a}⁄${h}` : `${p} ${a}⁄${h}` : s ? `-${a}⁄${h}` : `${a}⁄${h}`;
|
|
81
|
+
}
|
|
82
|
+
return o;
|
|
83
|
+
}
|
|
84
|
+
getUnicodeFraction(t, n) {
|
|
85
|
+
return { "1/4": "¼", "1/2": "½", "3/4": "¾", "1/3": "⅓", "2/3": "⅔", "1/5": "⅕", "2/5": "⅖", "3/5": "⅗", "4/5": "⅘", "1/6": "⅙", "5/6": "⅚", "1/7": "⅐", "1/8": "⅛", "3/8": "⅜", "5/8": "⅝", "7/8": "⅞", "1/9": "⅑", "1/10": "⅒" }[`${t}/${n}`] || null;
|
|
86
|
+
}
|
|
87
|
+
toSuperscript(t) {
|
|
88
|
+
const n = { 0: "⁰", 1: "¹", 2: "²", 3: "³", 4: "⁴", 5: "⁵", 6: "⁶", 7: "⁷", 8: "⁸", 9: "⁹", "-": "⁻" };
|
|
89
|
+
return t.split("").map((r) => n[r] || r).join("");
|
|
90
|
+
}
|
|
91
|
+
toSubscript(t) {
|
|
92
|
+
const n = { 0: "₀", 1: "₁", 2: "₂", 3: "₃", 4: "₄", 5: "₅", 6: "₆", 7: "₇", 8: "₈", 9: "₉", "-": "₋" };
|
|
93
|
+
return t.split("").map((r) => n[r] || r).join("");
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
export {
|
|
97
|
+
M as N
|
|
98
|
+
};
|
|
99
|
+
//# sourceMappingURL=number-BhTiptLA.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number-BhTiptLA.js","sources":["../src/utils/number.ts"],"sourcesContent":["export class Numbers {\n /**\n * Rounds a number to the specified number of decimal places.\n * @param {number} number - The number to round.\n * @param {number} [decimalPlaces=2] - The number of decimal places to round to.\n * @returns {number} - The rounded number.\n */\n roundNumber(number: number, decimalPlaces: number = 2): number {\n const factor = Math.pow(10, decimalPlaces);\n return Math.round(number * factor) / factor;\n }\n\n /**\n * Formats a number according to the specified locale and options.\n * @param {number} number - The number to format.\n * @param {string} [locale='de-DE'] - The locale string (e.g., 'de-DE' for German).\n * @param {Intl.NumberFormatOptions} [options={}] - Additional formatting options.\n * @returns {string} - The formatted number as a string.\n */\n formatNumber(\n number: number,\n locale: string = \"de-DE\",\n options: Intl.NumberFormatOptions = {},\n ): string {\n return new Intl.NumberFormat(locale, options).format(number);\n }\n\n /**\n * Parses a string with a specified decimal separator into a number.\n * @param {string} numberString - The string to parse.\n * @param {string} [decimalSeparator=','] - The decimal separator used in the string.\n * @returns {number} - The parsed number.\n */\n parseToPureNumber(\n numberString: string,\n decimalSeparator: string = \",\",\n ): number {\n const normalizedString = numberString.replace(decimalSeparator, \".\");\n return parseFloat(normalizedString);\n }\n\n /**\n * Rounds a number to the specified decimal places and formats it according to the specified locale and options.\n * @param {number} number - The number to process.\n * @param {number} [decimalPlaces=2] - The number of decimal places to round to.\n * @param {string} [locale='de-DE'] - The locale string.\n * @param {Intl.NumberFormatOptions} [options={}] - Additional formatting options.\n * @returns {string} - The formatted number as a string.\n */\n doIt(\n number: number,\n decimalPlaces: number = 2,\n locale: string = \"de-DE\",\n options: Intl.NumberFormatOptions = {},\n ): string {\n const roundedNumber = this.roundNumber(number, decimalPlaces);\n return this.formatNumber(roundedNumber, locale, options);\n }\n\n /**\n * Format a currency amount consistently across the application\n *\n * @param amount The amount to format\n * @param currency The currency symbol to display (default: '€')\n * @returns Formatted amount with currency symbol\n */\n formatCurrency(amount: number, currency: string = \"€\"): string {\n return `${currency}${this.doIt(amount)}`;\n }\n\n /**\n * Format a delta value with appropriate directional indicator\n *\n * @param delta The delta amount to format\n * @param currency The currency symbol to display (default: '€')\n * @returns Formatted delta with direction indicator and currency symbol\n */\n formatDelta(delta: number, currency: string = \"€\"): string {\n const symbol = delta > 0 ? \"↑\" : delta < 0 ? \"↓\" : \"→\";\n return `${symbol} ${currency}${this.doIt(Math.abs(delta))}`;\n }\n\n /**\n * Get CSS class for delta value\n *\n * @param delta The delta amount\n * @returns CSS class based on delta direction\n */\n getDeltaClass(delta: number): string {\n return delta > 0\n ? \"text-error-default\"\n : delta < 0\n ? \"text-primary-default\"\n : \"text-neutral\";\n }\n\n /**\n * Converts a decimal number to a mixed fraction string\n * For example: 1.5 becomes \"1 1/2\", 2.25 becomes \"2 1/4\"\n *\n * @param number The decimal number to convert\n * @param precision The precision level for fraction approximation (default: 16)\n * @param maxDenominator The maximum allowed denominator (default: 4)\n * @returns A string representing the mixed fraction\n */\n toMixedFraction(\n number: number,\n precision: number = 16,\n maxDenominator: number = 4,\n ): string {\n // Handle negative numbers\n const isNegative = number < 0;\n number = Math.abs(number);\n\n // Extract whole number part\n const wholePart = Math.floor(number);\n\n // Extract decimal part and convert to fraction\n let decimalPart = number - wholePart;\n\n // If the decimal part is very small or zero, just return the whole number\n if (decimalPart < 1 / Math.pow(10, precision)) {\n return isNegative ? `-${wholePart}` : `${wholePart}`;\n }\n\n // Find the best fraction approximation using precision and max denominator\n const { numerator, denominator } = this.decimalToFraction(\n decimalPart,\n precision,\n maxDenominator,\n );\n\n // Format based on whether there's a whole part\n if (wholePart === 0) {\n return isNegative\n ? `-${numerator}/${denominator}`\n : `${numerator}/${denominator}`;\n } else {\n return isNegative\n ? `-${wholePart} ${numerator}/${denominator}`\n : `${wholePart} ${numerator}/${denominator}`;\n }\n }\n\n /**\n * Converts a decimal to a simplified fraction with a maximum denominator\n *\n * @param decimal The decimal part to convert (0 <= decimal < 1)\n * @param precision The precision level for approximation\n * @param maxDenominator The maximum allowed denominator (default: 4)\n * @returns Object containing numerator and denominator\n */\n private decimalToFraction(\n decimal: number,\n precision: number,\n maxDenominator: number = 4,\n ): { numerator: number; denominator: number } {\n if (decimal === 0) {\n return { numerator: 0, denominator: 1 };\n }\n\n // Initialize best approximation\n let bestError = Infinity;\n let bestNumerator = 0;\n let bestDenominator = 1;\n\n // Check common fractions first for better user experience\n // Filter to only include fractions with denominators <= maxDenominator\n const commonFractions = [\n { n: 1, d: 2 }, // 1/2\n { n: 1, d: 3 }, // 1/3\n { n: 2, d: 3 }, // 2/3\n { n: 1, d: 4 }, // 1/4\n { n: 3, d: 4 }, // 3/4\n ];\n\n // Add additional fractions only if maxDenominator allows\n const additionalFractions = [];\n if (maxDenominator >= 5) {\n additionalFractions.push(\n { n: 1, d: 5 }, // 1/5\n { n: 2, d: 5 }, // 2/5\n { n: 3, d: 5 }, // 3/5\n { n: 4, d: 5 }, // 4/5\n );\n }\n if (maxDenominator >= 6) {\n additionalFractions.push(\n { n: 1, d: 6 }, // 1/6\n { n: 5, d: 6 }, // 5/6\n );\n }\n if (maxDenominator >= 8) {\n additionalFractions.push(\n { n: 1, d: 8 }, // 1/8\n { n: 3, d: 8 }, // 3/8\n { n: 5, d: 8 }, // 5/8\n { n: 7, d: 8 }, // 7/8\n );\n }\n if (maxDenominator >= 10) {\n additionalFractions.push(\n { n: 1, d: 10 }, // 1/10\n { n: 3, d: 10 }, // 3/10\n { n: 7, d: 10 }, // 7/10\n { n: 9, d: 10 }, // 9/10\n );\n }\n if (maxDenominator >= 12) {\n additionalFractions.push(\n { n: 1, d: 12 }, // 1/12\n { n: 5, d: 12 }, // 5/12\n { n: 7, d: 12 }, // 7/12\n { n: 11, d: 12 }, // 11/12\n );\n }\n if (maxDenominator >= 16) {\n additionalFractions.push(\n { n: 1, d: 16 }, // 1/16\n { n: 3, d: 16 }, // 3/16\n { n: 5, d: 16 }, // 5/16\n { n: 7, d: 16 }, // 7/16\n { n: 9, d: 16 }, // 9/16\n { n: 11, d: 16 }, // 11/16\n { n: 13, d: 16 }, // 13/16\n { n: 15, d: 16 }, // 15/16\n );\n }\n\n // Combine all applicable fractions\n const allFractions = [...commonFractions, ...additionalFractions];\n\n // Check common fractions first\n for (const frac of allFractions) {\n if (frac.d <= maxDenominator) {\n const error = Math.abs(decimal - frac.n / frac.d);\n if (error < bestError) {\n bestError = error;\n bestNumerator = frac.n;\n bestDenominator = frac.d;\n\n // If we're very close to a common fraction, just use it\n if (error < 1 / Math.pow(10, precision)) {\n return { numerator: frac.n, denominator: frac.d };\n }\n }\n }\n }\n\n // If no suitable common fraction found, use a more sophisticated approach\n // for denominators up to maxDenominator\n\n // Find the best approximation with denominator <= maxDenominator\n for (let d = 1; d <= maxDenominator; d++) {\n // Find best numerator for this denominator\n const n = Math.round(decimal * d);\n const error = Math.abs(decimal - n / d);\n\n if (error < bestError) {\n bestError = error;\n bestNumerator = n;\n bestDenominator = d;\n }\n }\n\n // Only use continued fraction expansion if we're significantly off\n // and maxDenominator allows for larger denominators\n if (bestError > 1 / Math.pow(10, precision / 2) && maxDenominator > 4) {\n // Implementation of continued fraction expansion\n let n1 = 1,\n n2 = 0;\n let d1 = 0,\n d2 = 1;\n let b = decimal;\n\n do {\n let a = Math.floor(b);\n let aux = n1;\n n1 = a * n1 + n2;\n n2 = aux;\n\n aux = d1;\n d1 = a * d1 + d2;\n d2 = aux;\n\n b = 1 / (b - a);\n\n // Calculate the current approximation\n const currentError = Math.abs(decimal - n1 / d1);\n\n // If we hit the precision limit or if the denominator gets too large, use this approximation\n if (currentError < 1 / Math.pow(10, precision) || d1 > maxDenominator) {\n // If d1 exceeds maxDenominator, return the previous best result\n if (d1 > maxDenominator) {\n return { numerator: bestNumerator, denominator: bestDenominator };\n }\n\n // Otherwise return this result\n return { numerator: n1, denominator: d1 };\n }\n } while (b !== Infinity);\n\n bestNumerator = n1;\n bestDenominator = d1;\n }\n\n // Simplify the fraction\n const gcd = this.findGCD(bestNumerator, bestDenominator);\n return {\n numerator: bestNumerator / gcd,\n denominator: bestDenominator / gcd,\n };\n }\n\n /**\n * Calculates the greatest common divisor of two numbers\n */\n private findGCD(a: number, b: number): number {\n return b === 0 ? a : this.findGCD(b, a % b);\n }\n\n /**\n * Alternative method to get a formatted mixed fraction with a specified format\n *\n * @param number The decimal number to convert\n * @param format The format specification ('unicode', 'ascii', 'superscript')\n * @param precision The precision level for fraction approximation\n * @param maxDenominator The maximum allowed denominator (default: 4)\n * @returns A formatted string representing the mixed fraction\n */\n formatMixedFraction(\n number: number,\n format: \"unicode\" | \"ascii\" | \"superscript\" = \"ascii\",\n precision: number = 16,\n maxDenominator: number = 4,\n ): string {\n // Get the basic mixed fraction\n const basicFraction = this.toMixedFraction(\n number,\n precision,\n maxDenominator,\n );\n\n // If the format is ascii, just return the basic fraction\n if (format === \"ascii\") {\n return basicFraction;\n }\n\n // For unicode and superscript formats, we need to parse the basic fraction\n const isNegative = basicFraction.startsWith(\"-\");\n const withoutSign = isNegative ? basicFraction.substring(1) : basicFraction;\n\n // Check if it's a pure fraction or mixed fraction\n const hasMixedPart = withoutSign.includes(\" \");\n\n if (!withoutSign.includes(\"/\")) {\n // If there's no fraction part, just return the number\n return basicFraction;\n }\n\n let wholePart = \"\";\n let fractionPart = withoutSign;\n\n if (hasMixedPart) {\n // Split the whole and fraction parts\n const parts = withoutSign.split(\" \");\n wholePart = parts[0];\n fractionPart = parts[1];\n }\n\n // Split the fraction part into numerator and denominator\n const [numerator, denominator] = fractionPart.split(\"/\");\n\n if (format === \"unicode\") {\n // Try to find a unicode fraction character\n const unicodeFraction = this.getUnicodeFraction(\n parseInt(numerator),\n parseInt(denominator),\n );\n\n if (unicodeFraction) {\n return isNegative\n ? `-${wholePart}${hasMixedPart ? \" \" : \"\"}${unicodeFraction}`\n : `${wholePart}${hasMixedPart ? \" \" : \"\"}${unicodeFraction}`;\n }\n\n // Fallback to basic format if no unicode fraction is available\n return basicFraction;\n }\n\n // Handle superscript format\n if (format === \"superscript\") {\n const superNumerator = this.toSuperscript(numerator);\n const subDenominator = this.toSubscript(denominator);\n\n if (hasMixedPart) {\n return isNegative\n ? `-${wholePart} ${superNumerator}⁄${subDenominator}`\n : `${wholePart} ${superNumerator}⁄${subDenominator}`;\n } else {\n return isNegative\n ? `-${superNumerator}⁄${subDenominator}`\n : `${superNumerator}⁄${subDenominator}`;\n }\n }\n\n // Fallback to basic format\n return basicFraction;\n }\n\n /**\n * Gets the Unicode fraction character if available\n *\n * @param numerator The numerator\n * @param denominator The denominator\n * @returns Unicode fraction character or null if not available\n */\n private getUnicodeFraction(\n numerator: number,\n denominator: number,\n ): string | null {\n // Map common fractions to their Unicode characters\n const fractionMap: Record<string, string> = {\n \"1/4\": \"¼\",\n \"1/2\": \"½\",\n \"3/4\": \"¾\",\n \"1/3\": \"⅓\",\n \"2/3\": \"⅔\",\n \"1/5\": \"⅕\",\n \"2/5\": \"⅖\",\n \"3/5\": \"⅗\",\n \"4/5\": \"⅘\",\n \"1/6\": \"⅙\",\n \"5/6\": \"⅚\",\n \"1/7\": \"⅐\",\n \"1/8\": \"⅛\",\n \"3/8\": \"⅜\",\n \"5/8\": \"⅝\",\n \"7/8\": \"⅞\",\n \"1/9\": \"⅑\",\n \"1/10\": \"⅒\",\n };\n\n const key = `${numerator}/${denominator}`;\n return fractionMap[key] || null;\n }\n\n /**\n * Converts digits to superscript\n */\n private toSuperscript(str: string): string {\n const superscriptMap: Record<string, string> = {\n \"0\": \"⁰\",\n \"1\": \"¹\",\n \"2\": \"²\",\n \"3\": \"³\",\n \"4\": \"⁴\",\n \"5\": \"⁵\",\n \"6\": \"⁶\",\n \"7\": \"⁷\",\n \"8\": \"⁸\",\n \"9\": \"⁹\",\n \"-\": \"⁻\",\n };\n\n return str\n .split(\"\")\n .map((char) => superscriptMap[char] || char)\n .join(\"\");\n }\n\n /**\n * Converts digits to subscript\n */\n private toSubscript(str: string): string {\n const subscriptMap: Record<string, string> = {\n \"0\": \"₀\",\n \"1\": \"₁\",\n \"2\": \"₂\",\n \"3\": \"₃\",\n \"4\": \"₄\",\n \"5\": \"₅\",\n \"6\": \"₆\",\n \"7\": \"₇\",\n \"8\": \"₈\",\n \"9\": \"₉\",\n \"-\": \"₋\",\n };\n\n return str\n .split(\"\")\n .map((char) => subscriptMap[char] || char)\n .join(\"\");\n }\n}\n\n"],"names":["Numbers","number","decimalPlaces","factor","Math","pow","round","locale","options","Intl","NumberFormat","format","numberString","decimalSeparator","normalizedString","replace","parseFloat","roundedNumber","this","roundNumber","formatNumber","amount","currency","doIt","delta","abs","precision","maxDenominator","isNegative","wholePart","floor","decimalPart","numerator","denominator","decimalToFraction","decimal","bestError","Infinity","bestNumerator","bestDenominator","additionalFractions","push","n","d","allFractions","frac","error","n1","n2","d1","d2","b","a","aux","gcd","findGCD","basicFraction","toMixedFraction","startsWith","withoutSign","substring","hasMixedPart","includes","fractionPart","parts","split","unicodeFraction","getUnicodeFraction","parseInt","superNumerator","toSuperscript","subDenominator","toSubscript","str","superscriptMap","map","char","join","subscriptMap"],"mappings":"AAAO,MAAMA,EAAAA;AAAAA,EAOX,YAAYC,GAAgBC,IAAwB,GAAA;AAClD,UAAMC,IAASC,KAAKC,IAAI,IAAIH;AAC5B,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