@ship-ui/core 0.22.15 → 0.22.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/mcp/components.json +213 -47
- package/bin/src/subset.ts +6 -6
- package/bin/src/utilities.ts +14 -14
- package/fesm2022/ship-ui-core-ship-a11y-keybindings.mjs +12 -86
- package/fesm2022/ship-ui-core-ship-a11y-keybindings.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-accordion.mjs +4 -3
- package/fesm2022/ship-ui-core-ship-accordion.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-alert.mjs +1 -4
- package/fesm2022/ship-ui-core-ship-alert.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-blueprint.mjs +17 -11
- package/fesm2022/ship-ui-core-ship-blueprint.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-checkbox.mjs +3 -2
- package/fesm2022/ship-ui-core-ship-checkbox.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-color-picker.mjs +66 -62
- package/fesm2022/ship-ui-core-ship-color-picker.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-datepicker.mjs +24 -16
- package/fesm2022/ship-ui-core-ship-datepicker.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-dialog.mjs +4 -0
- package/fesm2022/ship-ui-core-ship-dialog.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-editor.mjs +0 -42
- package/fesm2022/ship-ui-core-ship-editor.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-form-field.mjs +0 -1
- package/fesm2022/ship-ui-core-ship-form-field.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-kbd.mjs +0 -6
- package/fesm2022/ship-ui-core-ship-kbd.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-list-item-swipe.mjs +241 -0
- package/fesm2022/ship-ui-core-ship-list-item-swipe.mjs.map +1 -0
- package/fesm2022/ship-ui-core-ship-menu.mjs +7 -10
- package/fesm2022/ship-ui-core-ship-menu.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-popover.mjs +5 -20
- package/fesm2022/ship-ui-core-ship-popover.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-radio.mjs +3 -2
- package/fesm2022/ship-ui-core-ship-radio.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-range-slider.mjs +7 -9
- package/fesm2022/ship-ui-core-ship-range-slider.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-select.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-sidenav.mjs +2 -2
- package/fesm2022/ship-ui-core-ship-sidenav.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-sortable.mjs +262 -68
- package/fesm2022/ship-ui-core-ship-sortable.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-spotlight.mjs +0 -11
- package/fesm2022/ship-ui-core-ship-spotlight.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-stepper.mjs +1 -1
- package/fesm2022/ship-ui-core-ship-stepper.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-table.mjs +426 -23
- package/fesm2022/ship-ui-core-ship-table.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-toggle.mjs +3 -2
- package/fesm2022/ship-ui-core-ship-toggle.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-tree.mjs +1 -9
- package/fesm2022/ship-ui-core-ship-tree.mjs.map +1 -1
- package/fesm2022/ship-ui-core.mjs +37 -53
- package/fesm2022/ship-ui-core.mjs.map +1 -1
- package/package.json +5 -1
- package/types/ship-ui-core-ship-a11y-keybindings.d.ts +0 -55
- package/types/ship-ui-core-ship-accordion.d.ts +7 -7
- package/types/ship-ui-core-ship-blueprint.d.ts +2 -1
- package/types/ship-ui-core-ship-checkbox.d.ts +2 -3
- package/types/ship-ui-core-ship-color-picker.d.ts +1 -25
- package/types/ship-ui-core-ship-datepicker.d.ts +2 -3
- package/types/ship-ui-core-ship-editor.d.ts +10 -10
- package/types/ship-ui-core-ship-list-item-swipe.d.ts +25 -0
- package/types/ship-ui-core-ship-menu.d.ts +1 -2
- package/types/ship-ui-core-ship-radio.d.ts +2 -3
- package/types/ship-ui-core-ship-range-slider.d.ts +6 -6
- package/types/ship-ui-core-ship-sortable.d.ts +31 -9
- package/types/ship-ui-core-ship-table.d.ts +12 -1
- package/types/ship-ui-core-ship-toggle.d.ts +2 -3
- package/types/ship-ui-core-ship-tree.d.ts +20 -25
- package/types/ship-ui-core.d.ts +17 -24
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ship-ui-core-ship-form-field.mjs","sources":["../../../projects/ship-ui/ship-form-field/ship-form-field.ts","../../../projects/ship-ui/ship-form-field/ship-form-field-popover.ts","../../../projects/ship-ui/ship-form-field/ship-ui-core-ship-form-field.ts"],"sourcesContent":["import { afterNextRender, ChangeDetectionStrategy, Component, ElementRef, HostListener, inject, input, ViewEncapsulation } from '@angular/core';\nimport { shipComponentClasses } from '@ship-ui/core';\nimport { ShipColor, ShipFormFieldVariant, ShipSize } from '@ship-ui/core';\n\n@Component({\n selector: 'sh-form-field',\n styleUrl: './ship-form-field.scss',\n encapsulation: ViewEncapsulation.None,\n imports: [],\n template: `\n <ng-content select=\"label\"></ng-content>\n\n <div class=\"input-wrap\">\n <div class=\"prefix\">\n <ng-content select=\"[boxPrefix]\"></ng-content>\n <ng-content select=\"[prefix]\"></ng-content>\n <ng-content select=\"[textPrefix]\"></ng-content>\n </div>\n\n <ng-content select=\"input\"></ng-content>\n <ng-content select=\"textarea\"></ng-content>\n\n <div class=\"suffix\">\n <ng-content select=\"[textSuffix]\"></ng-content>\n <ng-content select=\"[suffix]\"></ng-content>\n <ng-content select=\"[boxSuffix]\"></ng-content>\n </div>\n </div>\n\n <div class=\"helpers\">\n <div class=\"error-wrap\">\n <ng-content select=\"[error]\"></ng-content>\n </div>\n\n <div class=\"hint\">\n <ng-content select=\"[hint]\"></ng-content>\n </div>\n </div>\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[class]': 'hostClasses()',\n },\n})\nexport class ShipFormField {\n #selfRef = inject(ElementRef);\n\n color = input<ShipColor | null>(null);\n variant = input<ShipFormFieldVariant | null>(null);\n size = input<ShipSize | null>(null);\n readonly = input<boolean>(false);\n\n hostClasses = shipComponentClasses('formField', {\n color: this.color,\n variant: this.variant,\n size: this.size,\n readonly: this.readonly,\n });\n\n @HostListener('click')\n onClick() {\n if (this.#selfRef.nativeElement.querySelector('input')) {\n this.#selfRef.nativeElement.querySelector('input').focus();\n }\n\n if (this.#selfRef.nativeElement.querySelector('textarea')) {\n this.#selfRef.nativeElement.querySelector('textarea').focus();\n }\n }\n\n constructor() {\n afterNextRender(() => {\n const el = this.#selfRef.nativeElement;\n const inputEl = el.querySelector('input') || el.querySelector('textarea');\n const labelEl = el.querySelector('label');\n const errorEl = el.querySelector('[error]');\n const hintEl = el.querySelector('[hint]');\n\n if (inputEl) {\n if (!inputEl.id) {\n inputEl.id = `sh-input-${Math.random().toString(36).substring(2, 9)}`;\n }\n\n if (labelEl && !labelEl.getAttribute('for')) {\n labelEl.setAttribute('for', inputEl.id);\n }\n\n const describedBy: string[] = [];\n if (errorEl) {\n if (!errorEl.id) errorEl.id = `sh-error-${Math.random().toString(36).substring(2, 9)}`;\n describedBy.push(errorEl.id);\n }\n if (hintEl) {\n if (!hintEl.id) hintEl.id = `sh-hint-${Math.random().toString(36).substring(2, 9)}`;\n describedBy.push(hintEl.id);\n }\n\n if (describedBy.length > 0 && !inputEl.hasAttribute('aria-describedby')) {\n inputEl.setAttribute('aria-describedby', describedBy.join(' '));\n }\n }\n\n const supportFieldSizing = typeof CSS !== 'undefined' && CSS.supports('field-sizing', 'content');\n const text = this.#selfRef.nativeElement.querySelector('textarea');\n\n if (!supportFieldSizing && text !== null) {\n function resize() {\n text.style.height = 'auto';\n text.style.height = text.scrollHeight + 'px';\n }\n\n /* 0-timeout to get the already changed text */\n function delayedResize() {\n setTimeout(resize, 0);\n }\n\n text.addEventListener('change', resize);\n text.addEventListener('cut', delayedResize);\n text.addEventListener('paste', delayedResize);\n text.addEventListener('drop', delayedResize);\n text.addEventListener('keydown', delayedResize);\n\n text.focus();\n text.select();\n resize();\n }\n });\n }\n}\n","import { ChangeDetectionStrategy, Component, ElementRef, HostListener, inject, input, model, output, ViewEncapsulation } from '@angular/core';\nimport { ShipPopover } from '@ship-ui/core/ship-popover';\nimport { shipComponentClasses } from '@ship-ui/core';\nimport { ShipColor, ShipFormFieldVariant, ShipSize } from '@ship-ui/core';\n\n@Component({\n selector: 'sh-form-field-popover',\n styleUrl: './ship-form-field.scss',\n encapsulation: ViewEncapsulation.None,\n imports: [ShipPopover],\n template: `\n <ng-content select=\"label\"></ng-content>\n\n <sh-popover\n [(isOpen)]=\"isOpen\"\n (closed)=\"close()\"\n [asSheetOnMobile]=\"true\"\n [options]=\"{\n closeOnButton: false,\n closeOnEsc: true,\n }\">\n <div trigger class=\"input-wrap\" [class.is-open]=\"isOpen()\">\n <div class=\"prefix\">\n <ng-content select=\"[prefix]\"></ng-content>\n <ng-content select=\"[textPrefix]\"></ng-content>\n </div>\n\n <div class=\"prefix-space\"></div>\n\n <ng-content select=\"input\"></ng-content>\n\n <ng-content select=\"textarea\"></ng-content>\n\n <ng-content select=\"[textSuffix]\"></ng-content>\n <div class=\"suffix-space\"></div>\n <ng-content select=\"[suffix]\"></ng-content>\n </div>\n <ng-content select=\"[popoverContent]\"></ng-content>\n </sh-popover>\n\n <div class=\"helpers\">\n <div class=\"error-wrap\">\n <ng-content select=\"[error]\"></ng-content>\n </div>\n\n <div class=\"hint\">\n <ng-content select=\"[hint]\"></ng-content>\n </div>\n </div>\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[class]': 'hostClasses()',\n },\n})\nexport class ShipFormFieldPopover {\n #selfRef = inject(ElementRef);\n\n isOpen = model<boolean>(false);\n closed = output<void>();\n\n color = input<ShipColor | null>(null);\n variant = input<ShipFormFieldVariant | null>(null);\n size = input<ShipSize | null>(null);\n readonly = input<boolean>(false);\n\n hostClasses = shipComponentClasses('formField', {\n color: this.color,\n variant: this.variant,\n size: this.size,\n readonly: this.readonly,\n });\n\n @HostListener('click', ['$event'])\n onClick(event: MouseEvent) {\n const target = event.target as HTMLElement;\n if (target.closest('.input-wrap')) {\n if (this.#selfRef.nativeElement.querySelector('input')) {\n this.#selfRef.nativeElement.querySelector('input').focus();\n }\n \n if (this.#selfRef.nativeElement.querySelector('textarea')) {\n this.#selfRef.nativeElement.querySelector('textarea').focus();\n }\n }\n }\n\n close() {\n this.closed.emit();\n }\n\n ngOnInit() {\n const supportFieldSizing = typeof CSS !== 'undefined' && CSS.supports('field-sizing', 'content');\n const text = this.#selfRef.nativeElement.querySelector('textarea');\n\n if (!supportFieldSizing && text !== null) {\n const text = this.#selfRef.nativeElement.querySelector('textarea');\n\n function resize() {\n text.style.height = 'auto';\n text.style.height = text.scrollHeight + 'px';\n }\n\n /* 0-timeout to get the already changed text */\n function delayedResize() {\n setTimeout(resize, 0);\n }\n\n if (text) {\n text.addEventListener('change', resize);\n text.addEventListener('cut', delayedResize);\n text.addEventListener('paste', delayedResize);\n text.addEventListener('drop', delayedResize);\n text.addEventListener('keydown', delayedResize);\n\n text.focus();\n text.select();\n resize();\n }\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;MA4Ca,aAAa,CAAA;AACxB,IAAA,QAAQ;IAeR,OAAO,GAAA;QACL,IAAI,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE;AACtD,YAAA,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE;QAC5D;QAEA,IAAI,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,aAAa,CAAC,UAAU,CAAC,EAAE;AACzD,YAAA,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC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AAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAxCS,WAAW,EAAA,QAAA,EAAA,YAAA,EAAA,MAAA,EAAA,CAAA,cAAA,EAAA,iBAAA,EAAA,oBAAA,EAAA,QAAA,EAAA,SAAA,CAAA,EAAA,OAAA,EAAA,CAAA,cAAA,EAAA,QAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,aAAA,EAAA,EAAA,CAAA,iBAAA,CAAA,IAAA,EAAA,CAAA,CAAA;;2FA8CV,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAlDhC,SAAS;+BACE,uBAAuB,EAAA,aAAA,EAElB,iBAAiB,CAAC,IAAI,WAC5B,CAAC,WAAW,CAAC,EAAA,QAAA,EACZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCT,EAAA,eAAA,EACgB,uBAAuB,CAAC,MAAM,EAAA,IAAA,EACzC;AACJ,wBAAA,SAAS,EAAE,eAAe;AAC3B,qBAAA,EAAA,MAAA,EAAA,CAAA,wsYAAA,CAAA,EAAA;;sBAoBA,YAAY;uBAAC,OAAO,EAAE,CAAC,QAAQ,CAAC;;;ACzEnC;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ship-ui-core-ship-form-field.mjs","sources":["../../../projects/ship-ui/ship-form-field/ship-form-field.ts","../../../projects/ship-ui/ship-form-field/ship-form-field-popover.ts","../../../projects/ship-ui/ship-form-field/ship-ui-core-ship-form-field.ts"],"sourcesContent":["import { afterNextRender, ChangeDetectionStrategy, Component, ElementRef, HostListener, inject, input, ViewEncapsulation } from '@angular/core';\nimport { shipComponentClasses } from '@ship-ui/core';\nimport { ShipColor, ShipFormFieldVariant, ShipSize } from '@ship-ui/core';\n\n@Component({\n selector: 'sh-form-field',\n styleUrl: './ship-form-field.scss',\n encapsulation: ViewEncapsulation.None,\n imports: [],\n template: `\n <ng-content select=\"label\"></ng-content>\n\n <div class=\"input-wrap\">\n <div class=\"prefix\">\n <ng-content select=\"[boxPrefix]\"></ng-content>\n <ng-content select=\"[prefix]\"></ng-content>\n <ng-content select=\"[textPrefix]\"></ng-content>\n </div>\n\n <ng-content select=\"input\"></ng-content>\n <ng-content select=\"textarea\"></ng-content>\n\n <div class=\"suffix\">\n <ng-content select=\"[textSuffix]\"></ng-content>\n <ng-content select=\"[suffix]\"></ng-content>\n <ng-content select=\"[boxSuffix]\"></ng-content>\n </div>\n </div>\n\n <div class=\"helpers\">\n <div class=\"error-wrap\">\n <ng-content select=\"[error]\"></ng-content>\n </div>\n\n <div class=\"hint\">\n <ng-content select=\"[hint]\"></ng-content>\n </div>\n </div>\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[class]': 'hostClasses()',\n },\n})\nexport class ShipFormField {\n #selfRef = inject(ElementRef);\n\n color = input<ShipColor | null>(null);\n variant = input<ShipFormFieldVariant | null>(null);\n size = input<ShipSize | null>(null);\n readonly = input<boolean>(false);\n\n hostClasses = shipComponentClasses('formField', {\n color: this.color,\n variant: this.variant,\n size: this.size,\n readonly: this.readonly,\n });\n\n @HostListener('click')\n onClick() {\n if (this.#selfRef.nativeElement.querySelector('input')) {\n this.#selfRef.nativeElement.querySelector('input').focus();\n }\n\n if (this.#selfRef.nativeElement.querySelector('textarea')) {\n this.#selfRef.nativeElement.querySelector('textarea').focus();\n }\n }\n\n constructor() {\n afterNextRender(() => {\n const el = this.#selfRef.nativeElement;\n const inputEl = el.querySelector('input') || el.querySelector('textarea');\n const labelEl = el.querySelector('label');\n const errorEl = el.querySelector('[error]');\n const hintEl = el.querySelector('[hint]');\n\n if (inputEl) {\n if (!inputEl.id) {\n inputEl.id = `sh-input-${Math.random().toString(36).substring(2, 9)}`;\n }\n\n if (labelEl && !labelEl.getAttribute('for')) {\n labelEl.setAttribute('for', inputEl.id);\n }\n\n const describedBy: string[] = [];\n if (errorEl) {\n if (!errorEl.id) errorEl.id = `sh-error-${Math.random().toString(36).substring(2, 9)}`;\n describedBy.push(errorEl.id);\n }\n if (hintEl) {\n if (!hintEl.id) hintEl.id = `sh-hint-${Math.random().toString(36).substring(2, 9)}`;\n describedBy.push(hintEl.id);\n }\n\n if (describedBy.length > 0 && !inputEl.hasAttribute('aria-describedby')) {\n inputEl.setAttribute('aria-describedby', describedBy.join(' '));\n }\n }\n\n const supportFieldSizing = typeof CSS !== 'undefined' && CSS.supports('field-sizing', 'content');\n const text = this.#selfRef.nativeElement.querySelector('textarea');\n\n if (!supportFieldSizing && text !== null) {\n function resize() {\n text.style.height = 'auto';\n text.style.height = text.scrollHeight + 'px';\n }\n\n /* 0-timeout to get the already changed text */\n function delayedResize() {\n setTimeout(resize, 0);\n }\n\n text.addEventListener('change', resize);\n text.addEventListener('cut', delayedResize);\n text.addEventListener('paste', delayedResize);\n text.addEventListener('drop', delayedResize);\n text.addEventListener('keydown', delayedResize);\n\n text.focus();\n text.select();\n resize();\n }\n });\n }\n}\n","import { ChangeDetectionStrategy, Component, ElementRef, HostListener, inject, input, model, output, ViewEncapsulation } from '@angular/core';\nimport { ShipPopover } from '@ship-ui/core/ship-popover';\nimport { shipComponentClasses } from '@ship-ui/core';\nimport { ShipColor, ShipFormFieldVariant, ShipSize } from '@ship-ui/core';\n\n@Component({\n selector: 'sh-form-field-popover',\n styleUrl: './ship-form-field.scss',\n encapsulation: ViewEncapsulation.None,\n imports: [ShipPopover],\n template: `\n <ng-content select=\"label\"></ng-content>\n\n <sh-popover\n [(isOpen)]=\"isOpen\"\n (closed)=\"close()\"\n [asSheetOnMobile]=\"true\"\n [options]=\"{\n closeOnButton: false,\n closeOnEsc: true,\n }\">\n <div trigger class=\"input-wrap\" [class.is-open]=\"isOpen()\">\n <div class=\"prefix\">\n <ng-content select=\"[prefix]\"></ng-content>\n <ng-content select=\"[textPrefix]\"></ng-content>\n </div>\n\n <div class=\"prefix-space\"></div>\n\n <ng-content select=\"input\"></ng-content>\n\n <ng-content select=\"textarea\"></ng-content>\n\n <ng-content select=\"[textSuffix]\"></ng-content>\n <div class=\"suffix-space\"></div>\n <ng-content select=\"[suffix]\"></ng-content>\n </div>\n <ng-content select=\"[popoverContent]\"></ng-content>\n </sh-popover>\n\n <div class=\"helpers\">\n <div class=\"error-wrap\">\n <ng-content select=\"[error]\"></ng-content>\n </div>\n\n <div class=\"hint\">\n <ng-content select=\"[hint]\"></ng-content>\n </div>\n </div>\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[class]': 'hostClasses()',\n },\n})\nexport class ShipFormFieldPopover {\n #selfRef = inject(ElementRef);\n\n isOpen = model<boolean>(false);\n closed = output<void>();\n\n color = input<ShipColor | null>(null);\n variant = input<ShipFormFieldVariant | null>(null);\n size = input<ShipSize | null>(null);\n readonly = input<boolean>(false);\n\n hostClasses = shipComponentClasses('formField', {\n color: this.color,\n variant: this.variant,\n size: this.size,\n readonly: this.readonly,\n });\n\n @HostListener('click', ['$event'])\n onClick(event: MouseEvent) {\n const target = event.target as HTMLElement;\n if (target.closest('.input-wrap')) {\n if (this.#selfRef.nativeElement.querySelector('input')) {\n this.#selfRef.nativeElement.querySelector('input').focus();\n }\n \n if (this.#selfRef.nativeElement.querySelector('textarea')) {\n this.#selfRef.nativeElement.querySelector('textarea').focus();\n }\n }\n }\n\n close() {\n this.closed.emit();\n }\n\n ngOnInit() {\n const supportFieldSizing = typeof CSS !== 'undefined' && CSS.supports('field-sizing', 'content');\n const text = this.#selfRef.nativeElement.querySelector('textarea');\n\n if (!supportFieldSizing && text !== null) {\n const text = this.#selfRef.nativeElement.querySelector('textarea');\n\n function resize() {\n text.style.height = 'auto';\n text.style.height = text.scrollHeight + 'px';\n }\n\n \n function delayedResize() {\n setTimeout(resize, 0);\n }\n\n if (text) {\n text.addEventListener('change', resize);\n text.addEventListener('cut', delayedResize);\n text.addEventListener('paste', delayedResize);\n text.addEventListener('drop', delayedResize);\n text.addEventListener('keydown', delayedResize);\n\n text.focus();\n text.select();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ACzEnC;;AAEG;;;;"}
|
|
@@ -19,11 +19,6 @@ class ShipKbd {
|
|
|
19
19
|
}, /* @ts-ignore */
|
|
20
20
|
...(ngDevMode ? [{ debugName: "isMac" }] : /* istanbul ignore next */ []));
|
|
21
21
|
this.hasContent = computed(() => {
|
|
22
|
-
// If there is any content, it will be projected. We just need to render the separator
|
|
23
|
-
// if there are modifiers before it. Angular ng-content always renders if projected,
|
|
24
|
-
// so we assume true if they use the component with innerHTML (which we can't easily check
|
|
25
|
-
// statically, but we can assume if it's used as a wrapper, there's content).
|
|
26
|
-
// Actually, we can check if any modifiers exist to prepend.
|
|
27
22
|
return true;
|
|
28
23
|
}, /* @ts-ignore */
|
|
29
24
|
...(ngDevMode ? [{ debugName: "hasContent" }] : /* istanbul ignore next */ []));
|
|
@@ -44,7 +39,6 @@ class ShipKbd {
|
|
|
44
39
|
keys.push(mac ? '⎋' : 'Esc');
|
|
45
40
|
if (this.backspace())
|
|
46
41
|
keys.push(mac ? '⌫' : 'Backspace');
|
|
47
|
-
// Remove duplicates if they specify both meta and ctrl on windows (which both map to Ctrl)
|
|
48
42
|
return Array.from(new Set(keys));
|
|
49
43
|
}, /* @ts-ignore */
|
|
50
44
|
...(ngDevMode ? [{ debugName: "displayKeys" }] : /* istanbul ignore next */ []));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ship-ui-core-ship-kbd.mjs","sources":["../../../projects/ship-ui/ship-kbd/ship-kbd.ts","../../../projects/ship-ui/ship-kbd/ship-ui-core-ship-kbd.ts"],"sourcesContent":["import { booleanAttribute, Component, computed, inject, input, PLATFORM_ID } from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\n\n@Component({\n selector: 'sh-kbd, [sh-kbd]',\n standalone: true,\n template: `\n @for (key of displayKeys(); track $index) {\n <span class=\"key-part\">{{ key }}</span>\n @if (!isMac() && !$last) {\n <span class=\"separator\">+</span>\n }\n }\n @if (hasContent()) {\n @if (!isMac() && displayKeys().length > 0) {\n <span class=\"separator\">+</span>\n }\n <span class=\"content\">\n <ng-content></ng-content>\n </span>\n }\n `,\n styleUrl: './ship-kbd.scss',\n})\nexport class ShipKbd {\n #platformId = inject(PLATFORM_ID);\n\n meta = input<boolean, string | boolean>(false, { transform: booleanAttribute });\n shift = input<boolean, string | boolean>(false, { transform: booleanAttribute });\n alt = input<boolean, string | boolean>(false, { transform: booleanAttribute });\n ctrl = input<boolean, string | boolean>(false, { transform: booleanAttribute });\n enter = input<boolean, string | boolean>(false, { transform: booleanAttribute });\n escape = input<boolean, string | boolean>(false, { transform: booleanAttribute });\n backspace = input<boolean, string | boolean>(false, { transform: booleanAttribute });\n\n isMac = computed(() => {\n if (!isPlatformBrowser(this.#platformId)) return false;\n return navigator.userAgent.toLowerCase().includes('mac');\n });\n\n hasContent = computed(() => {\n
|
|
1
|
+
{"version":3,"file":"ship-ui-core-ship-kbd.mjs","sources":["../../../projects/ship-ui/ship-kbd/ship-kbd.ts","../../../projects/ship-ui/ship-kbd/ship-ui-core-ship-kbd.ts"],"sourcesContent":["import { booleanAttribute, Component, computed, inject, input, PLATFORM_ID } from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\n\n@Component({\n selector: 'sh-kbd, [sh-kbd]',\n standalone: true,\n template: `\n @for (key of displayKeys(); track $index) {\n <span class=\"key-part\">{{ key }}</span>\n @if (!isMac() && !$last) {\n <span class=\"separator\">+</span>\n }\n }\n @if (hasContent()) {\n @if (!isMac() && displayKeys().length > 0) {\n <span class=\"separator\">+</span>\n }\n <span class=\"content\">\n <ng-content></ng-content>\n </span>\n }\n `,\n styleUrl: './ship-kbd.scss',\n})\nexport class ShipKbd {\n #platformId = inject(PLATFORM_ID);\n\n meta = input<boolean, string | boolean>(false, { transform: booleanAttribute });\n shift = input<boolean, string | boolean>(false, { transform: booleanAttribute });\n alt = input<boolean, string | boolean>(false, { transform: booleanAttribute });\n ctrl = input<boolean, string | boolean>(false, { transform: booleanAttribute });\n enter = input<boolean, string | boolean>(false, { transform: booleanAttribute });\n escape = input<boolean, string | boolean>(false, { transform: booleanAttribute });\n backspace = input<boolean, string | boolean>(false, { transform: booleanAttribute });\n\n isMac = computed(() => {\n if (!isPlatformBrowser(this.#platformId)) return false;\n return navigator.userAgent.toLowerCase().includes('mac');\n });\n\n hasContent = computed(() => {\n \n \n \n \n \n return true; \n });\n\n displayKeys = computed(() => {\n const keys: string[] = [];\n const mac = this.isMac();\n\n if (this.meta()) keys.push(mac ? '⌘' : 'Win');\n if (this.ctrl()) keys.push(mac ? '⌃' : 'Ctrl');\n if (this.alt()) keys.push(mac ? '⌥' : 'Alt');\n if (this.shift()) keys.push(mac ? '⇧' : 'Shift');\n if (this.enter()) keys.push(mac ? '↵' : 'Enter');\n if (this.escape()) keys.push(mac ? '⎋' : 'Esc');\n if (this.backspace()) keys.push(mac ? '⌫' : 'Backspace');\n\n \n return Array.from(new Set(keys));\n });\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;MAwBa,OAAO,CAAA;AArBpB,IAAA,WAAA,GAAA;AAsBE,QAAA,IAAA,CAAA,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;QAEjC,IAAA,CAAA,IAAI,GAAG,KAAK,CAA4B,KAAK,4EAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;QAC/E,IAAA,CAAA,KAAK,GAAG,KAAK,CAA4B,KAAK,6EAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;QAChF,IAAA,CAAA,GAAG,GAAG,KAAK,CAA4B,KAAK,2EAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;QAC9E,IAAA,CAAA,IAAI,GAAG,KAAK,CAA4B,KAAK,4EAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;QAC/E,IAAA,CAAA,KAAK,GAAG,KAAK,CAA4B,KAAK,6EAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;QAChF,IAAA,CAAA,MAAM,GAAG,KAAK,CAA4B,KAAK,8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AAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,MAAA,EAAA,EAAA,iBAAA,EAAA,QAAA,EAAA,UAAA,EAAA,QAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,SAAA,EAAA,EAAA,iBAAA,EAAA,WAAA,EAAA,UAAA,EAAA,WAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EAlBR;;;;;;;;;;;;;;;AAeT,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,wYAAA,CAAA,EAAA,CAAA,CAAA;;2FAGU,OAAO,EAAA,UAAA,EAAA,CAAA;kBArBnB,SAAS;+BACE,kBAAkB,EAAA,UAAA,EAChB,IAAI,EAAA,QAAA,EACN;;;;;;;;;;;;;;;AAeT,EAAA,CAAA,EAAA,MAAA,EAAA,CAAA,wYAAA,CAAA,EAAA;;;ACrBH;;AAEG;;;;"}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { DOCUMENT } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { Injectable, inject, ElementRef, Renderer2, viewChild, input, output, HostListener, ChangeDetectionStrategy, ViewEncapsulation, Component } from '@angular/core';
|
|
4
|
+
|
|
5
|
+
class ShipListItemSwipeService {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.activeSwipeItem = null;
|
|
8
|
+
}
|
|
9
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: ShipListItemSwipeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
10
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: ShipListItemSwipeService, providedIn: 'root' }); }
|
|
11
|
+
}
|
|
12
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: ShipListItemSwipeService, decorators: [{
|
|
13
|
+
type: Injectable,
|
|
14
|
+
args: [{
|
|
15
|
+
providedIn: 'root',
|
|
16
|
+
}]
|
|
17
|
+
}] });
|
|
18
|
+
class ShipListItemSwipe {
|
|
19
|
+
constructor() {
|
|
20
|
+
this.#swipeService = inject(ShipListItemSwipeService);
|
|
21
|
+
this.#elementRef = inject((ElementRef));
|
|
22
|
+
this.#document = inject(DOCUMENT);
|
|
23
|
+
this.#renderer = inject(Renderer2);
|
|
24
|
+
this.contentEl = viewChild.required('content');
|
|
25
|
+
this.actionsLeftEl = viewChild.required('actionsLeft');
|
|
26
|
+
this.actionsRightEl = viewChild.required('actionsRight');
|
|
27
|
+
this.swipeThreshold = input(0.3, /* @ts-ignore */
|
|
28
|
+
...(ngDevMode ? [{ debugName: "swipeThreshold" }] : /* istanbul ignore next */ []));
|
|
29
|
+
this.swipeOpen = output();
|
|
30
|
+
this.swipeClose = output();
|
|
31
|
+
this.#startX = 0;
|
|
32
|
+
this.#startY = 0;
|
|
33
|
+
this.#currentX = 0;
|
|
34
|
+
this.#isSwiping = false;
|
|
35
|
+
this.#isScrollLock = false;
|
|
36
|
+
this.#hasLeftActions = false;
|
|
37
|
+
this.#hasRightActions = false;
|
|
38
|
+
this.#leftActionsWidth = 0;
|
|
39
|
+
this.#rightActionsWidth = 0;
|
|
40
|
+
this.#swipeState = 'closed';
|
|
41
|
+
this.#boundTouchMove = this.#onTouchMove.bind(this);
|
|
42
|
+
this.#boundTouchEnd = this.#onTouchEnd.bind(this);
|
|
43
|
+
}
|
|
44
|
+
#swipeService;
|
|
45
|
+
#elementRef;
|
|
46
|
+
#document;
|
|
47
|
+
#renderer;
|
|
48
|
+
#startX;
|
|
49
|
+
#startY;
|
|
50
|
+
#currentX;
|
|
51
|
+
#isSwiping;
|
|
52
|
+
#isScrollLock;
|
|
53
|
+
#hasLeftActions;
|
|
54
|
+
#hasRightActions;
|
|
55
|
+
#leftActionsWidth;
|
|
56
|
+
#rightActionsWidth;
|
|
57
|
+
#swipeState;
|
|
58
|
+
#boundTouchMove;
|
|
59
|
+
#boundTouchEnd;
|
|
60
|
+
onTouchStart(e) {
|
|
61
|
+
const touch = e.touches[0];
|
|
62
|
+
this.#startX = touch.clientX;
|
|
63
|
+
this.#startY = touch.clientY;
|
|
64
|
+
this.#currentX = this.#getTranslateX();
|
|
65
|
+
if (this.#swipeService.activeSwipeItem && this.#swipeService.activeSwipeItem !== this) {
|
|
66
|
+
this.#swipeService.activeSwipeItem.close();
|
|
67
|
+
}
|
|
68
|
+
const host = this.#elementRef.nativeElement;
|
|
69
|
+
this.#hasLeftActions = host.querySelector('button[actionLeft]') !== null;
|
|
70
|
+
this.#hasRightActions = host.querySelector('button[actionRight]') !== null;
|
|
71
|
+
this.#leftActionsWidth = this.actionsLeftEl().nativeElement.offsetWidth || 0;
|
|
72
|
+
this.#rightActionsWidth = this.actionsRightEl().nativeElement.offsetWidth || 0;
|
|
73
|
+
this.#isSwiping = false;
|
|
74
|
+
this.#isScrollLock = false;
|
|
75
|
+
this.#renderer.setStyle(this.contentEl().nativeElement, 'transition', 'none');
|
|
76
|
+
this.#document.addEventListener('touchmove', this.#boundTouchMove, { passive: false });
|
|
77
|
+
this.#document.addEventListener('touchend', this.#boundTouchEnd, { passive: false });
|
|
78
|
+
this.#document.addEventListener('touchcancel', this.#boundTouchEnd, { passive: false });
|
|
79
|
+
}
|
|
80
|
+
#onTouchMove(e) {
|
|
81
|
+
const touch = e.touches[0];
|
|
82
|
+
const deltaX = touch.clientX - this.#startX;
|
|
83
|
+
const deltaY = touch.clientY - this.#startY;
|
|
84
|
+
if (!this.#isSwiping) {
|
|
85
|
+
if (Math.abs(deltaY) > Math.abs(deltaX)) {
|
|
86
|
+
this.#unbindListeners();
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (Math.abs(deltaX) > 8) {
|
|
90
|
+
this.#isSwiping = true;
|
|
91
|
+
this.#isScrollLock = true;
|
|
92
|
+
if (this.#swipeService.activeSwipeItem && this.#swipeService.activeSwipeItem !== this) {
|
|
93
|
+
this.#swipeService.activeSwipeItem.close();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
if (this.#isScrollLock) {
|
|
98
|
+
e.preventDefault();
|
|
99
|
+
}
|
|
100
|
+
if (this.#isSwiping) {
|
|
101
|
+
let targetTranslate = this.#currentX + deltaX;
|
|
102
|
+
if (targetTranslate > 0) {
|
|
103
|
+
if (!this.#hasLeftActions) {
|
|
104
|
+
targetTranslate = 0;
|
|
105
|
+
}
|
|
106
|
+
else if (targetTranslate > this.#leftActionsWidth) {
|
|
107
|
+
targetTranslate = this.#leftActionsWidth + (targetTranslate - this.#leftActionsWidth) * 0.25;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
else if (targetTranslate < 0) {
|
|
111
|
+
if (!this.#hasRightActions) {
|
|
112
|
+
targetTranslate = 0;
|
|
113
|
+
}
|
|
114
|
+
else if (targetTranslate < -this.#rightActionsWidth) {
|
|
115
|
+
targetTranslate = -this.#rightActionsWidth + (targetTranslate + this.#rightActionsWidth) * 0.25;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
this.#setTranslateX(targetTranslate);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
#onTouchEnd() {
|
|
122
|
+
this.#unbindListeners();
|
|
123
|
+
if (this.#isSwiping) {
|
|
124
|
+
const currentTranslate = this.#getTranslateX();
|
|
125
|
+
const threshold = this.swipeThreshold();
|
|
126
|
+
if (currentTranslate > 0 && this.#hasLeftActions) {
|
|
127
|
+
if (currentTranslate > this.#leftActionsWidth * threshold) {
|
|
128
|
+
this.open('left');
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
this.close();
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
else if (currentTranslate < 0 && this.#hasRightActions) {
|
|
135
|
+
if (Math.abs(currentTranslate) > this.#rightActionsWidth * threshold) {
|
|
136
|
+
this.open('right');
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
this.close();
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
this.close();
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
open(side) {
|
|
148
|
+
if (side === 'left') {
|
|
149
|
+
const leftWidth = this.actionsLeftEl().nativeElement.offsetWidth || 0;
|
|
150
|
+
this.#animateTo(leftWidth);
|
|
151
|
+
this.#swipeState = 'open-left';
|
|
152
|
+
this.swipeOpen.emit('left');
|
|
153
|
+
this.#swipeService.activeSwipeItem = this;
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
const rightWidth = this.actionsRightEl().nativeElement.offsetWidth || 0;
|
|
157
|
+
this.#animateTo(-rightWidth);
|
|
158
|
+
this.#swipeState = 'open-right';
|
|
159
|
+
this.swipeOpen.emit('right');
|
|
160
|
+
this.#swipeService.activeSwipeItem = this;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
close() {
|
|
164
|
+
this.#animateTo(0);
|
|
165
|
+
if (this.#swipeState !== 'closed') {
|
|
166
|
+
this.#swipeState = 'closed';
|
|
167
|
+
this.swipeClose.emit();
|
|
168
|
+
}
|
|
169
|
+
if (this.#swipeService.activeSwipeItem === this) {
|
|
170
|
+
this.#swipeService.activeSwipeItem = null;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
#animateTo(x) {
|
|
174
|
+
const el = this.contentEl().nativeElement;
|
|
175
|
+
this.#renderer.setStyle(el, 'transition', 'transform 200ms cubic-bezier(0.25, 0.8, 0.25, 1)');
|
|
176
|
+
this.#setTranslateX(x);
|
|
177
|
+
}
|
|
178
|
+
#setTranslateX(x) {
|
|
179
|
+
this.#renderer.setStyle(this.contentEl().nativeElement, 'transform', `translateX(${x}px)`);
|
|
180
|
+
}
|
|
181
|
+
#getTranslateX() {
|
|
182
|
+
const transform = this.contentEl().nativeElement.style.transform;
|
|
183
|
+
if (!transform)
|
|
184
|
+
return 0;
|
|
185
|
+
const match = /translateX\(([^)]+)px\)/.exec(transform);
|
|
186
|
+
return match ? parseFloat(match[1]) : 0;
|
|
187
|
+
}
|
|
188
|
+
#unbindListeners() {
|
|
189
|
+
this.#document.removeEventListener('touchmove', this.#boundTouchMove);
|
|
190
|
+
this.#document.removeEventListener('touchend', this.#boundTouchEnd);
|
|
191
|
+
this.#document.removeEventListener('touchcancel', this.#boundTouchEnd);
|
|
192
|
+
}
|
|
193
|
+
ngOnDestroy() {
|
|
194
|
+
this.#unbindListeners();
|
|
195
|
+
if (this.#swipeService.activeSwipeItem === this) {
|
|
196
|
+
this.#swipeService.activeSwipeItem = null;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: ShipListItemSwipe, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
200
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.0", type: ShipListItemSwipe, isStandalone: true, selector: "sh-list-item-swipe", inputs: { swipeThreshold: { classPropertyName: "swipeThreshold", publicName: "swipeThreshold", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { swipeOpen: "swipeOpen", swipeClose: "swipeClose" }, host: { listeners: { "touchstart": "onTouchStart($event)" }, classAttribute: "sh-list-item-swipe" }, viewQueries: [{ propertyName: "contentEl", first: true, predicate: ["content"], descendants: true, isSignal: true }, { propertyName: "actionsLeftEl", first: true, predicate: ["actionsLeft"], descendants: true, isSignal: true }, { propertyName: "actionsRightEl", first: true, predicate: ["actionsRight"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
201
|
+
<div class="sh-swipe-container">
|
|
202
|
+
<div class="sh-swipe-actions actions-left" #actionsLeft>
|
|
203
|
+
<ng-content select="button[actionLeft]" />
|
|
204
|
+
</div>
|
|
205
|
+
<div class="sh-swipe-actions actions-right" #actionsRight>
|
|
206
|
+
<ng-content select="button[actionRight]" />
|
|
207
|
+
</div>
|
|
208
|
+
<div class="sh-swipe-content" #content>
|
|
209
|
+
<ng-content />
|
|
210
|
+
</div>
|
|
211
|
+
</div>
|
|
212
|
+
`, isInline: true, styles: ["sh-list-item-swipe{display:block;width:100%;position:relative;overflow:hidden;border-radius:var(--list-s, var(--shape-2));margin:0;padding:0}sh-list-item-swipe .sh-swipe-container{position:relative;width:100%;overflow:hidden}sh-list-item-swipe .sh-swipe-content{position:relative;z-index:2;width:100%;box-sizing:border-box;background-color:var(--base-1);color:var(--list-color, var(--base-9));border-radius:inherit;transition:transform .2s cubic-bezier(.25,.8,.25,1),background-color .15s ease}sh-list-item-swipe .sh-swipe-content:hover{background-color:var(--base-2)}sh-list-item-swipe .sh-swipe-content>[item],sh-list-item-swipe .sh-swipe-content>[action]{background-color:transparent!important;box-shadow:none!important;border:0!important;width:100%;margin:0;box-sizing:border-box}sh-list-item-swipe:focus-visible .sh-swipe-content{outline:2px solid var(--primary-8);outline-offset:-2px}sh-list-item-swipe.active .sh-swipe-content,sh-list-item-swipe.selected .sh-swipe-content,sh-list-item-swipe:has(.active) .sh-swipe-content,sh-list-item-swipe:has(.selected) .sh-swipe-content,sh-list-item-swipe:has(input:checked) .sh-swipe-content{background-color:var(--list-active-bg, var(--base-2));color:var(--base-12)}sh-list-item-swipe .sh-swipe-actions{position:absolute;top:0;bottom:0;z-index:1;display:flex;align-items:stretch;box-sizing:border-box}sh-list-item-swipe .sh-swipe-actions.actions-left{left:0}sh-list-item-swipe .sh-swipe-actions.actions-right{right:0}sh-list-item-swipe .sh-swipe-actions button,sh-list-item-swipe .sh-swipe-actions button[actionLeft],sh-list-item-swipe .sh-swipe-actions button[actionRight],sh-list-item-swipe .sh-swipe-actions .sh-swipe-action-btn{border:0;margin:0;padding:0 1.25rem;display:flex;align-items:center;justify-content:center;font:var(--paragraph-30B);cursor:pointer;background-color:var(--base-3);color:var(--base-10);transition:background-color .15s ease;height:100%}sh-list-item-swipe .sh-swipe-actions button:hover,sh-list-item-swipe .sh-swipe-actions button[actionLeft]:hover,sh-list-item-swipe .sh-swipe-actions button[actionRight]:hover,sh-list-item-swipe .sh-swipe-actions .sh-swipe-action-btn:hover{background-color:var(--base-4)}sh-list-item-swipe .sh-swipe-actions button.action-danger,sh-list-item-swipe .sh-swipe-actions button.danger,sh-list-item-swipe .sh-swipe-actions button[actionLeft].action-danger,sh-list-item-swipe .sh-swipe-actions button[actionLeft].danger,sh-list-item-swipe .sh-swipe-actions button[actionRight].action-danger,sh-list-item-swipe .sh-swipe-actions button[actionRight].danger,sh-list-item-swipe .sh-swipe-actions .sh-swipe-action-btn.action-danger,sh-list-item-swipe .sh-swipe-actions .sh-swipe-action-btn.danger{background-color:var(--error-8);color:var(--base-1)}sh-list-item-swipe .sh-swipe-actions button.action-danger:hover,sh-list-item-swipe .sh-swipe-actions button.danger:hover,sh-list-item-swipe .sh-swipe-actions button[actionLeft].action-danger:hover,sh-list-item-swipe .sh-swipe-actions button[actionLeft].danger:hover,sh-list-item-swipe .sh-swipe-actions button[actionRight].action-danger:hover,sh-list-item-swipe .sh-swipe-actions button[actionRight].danger:hover,sh-list-item-swipe .sh-swipe-actions .sh-swipe-action-btn.action-danger:hover,sh-list-item-swipe .sh-swipe-actions .sh-swipe-action-btn.danger:hover{background-color:var(--error-9)}sh-list-item-swipe .sh-swipe-actions button.action-success,sh-list-item-swipe .sh-swipe-actions button.success,sh-list-item-swipe .sh-swipe-actions button[actionLeft].action-success,sh-list-item-swipe .sh-swipe-actions button[actionLeft].success,sh-list-item-swipe .sh-swipe-actions button[actionRight].action-success,sh-list-item-swipe .sh-swipe-actions button[actionRight].success,sh-list-item-swipe .sh-swipe-actions .sh-swipe-action-btn.action-success,sh-list-item-swipe .sh-swipe-actions .sh-swipe-action-btn.success{background-color:var(--success-8);color:var(--base-1)}sh-list-item-swipe .sh-swipe-actions button.action-success:hover,sh-list-item-swipe .sh-swipe-actions button.success:hover,sh-list-item-swipe .sh-swipe-actions button[actionLeft].action-success:hover,sh-list-item-swipe .sh-swipe-actions button[actionLeft].success:hover,sh-list-item-swipe .sh-swipe-actions button[actionRight].action-success:hover,sh-list-item-swipe .sh-swipe-actions button[actionRight].success:hover,sh-list-item-swipe .sh-swipe-actions .sh-swipe-action-btn.action-success:hover,sh-list-item-swipe .sh-swipe-actions .sh-swipe-action-btn.success:hover{background-color:var(--success-9)}sh-list-item-swipe .sh-swipe-actions button.action-warning,sh-list-item-swipe .sh-swipe-actions button.warning,sh-list-item-swipe .sh-swipe-actions button[actionLeft].action-warning,sh-list-item-swipe .sh-swipe-actions button[actionLeft].warning,sh-list-item-swipe .sh-swipe-actions button[actionRight].action-warning,sh-list-item-swipe .sh-swipe-actions button[actionRight].warning,sh-list-item-swipe .sh-swipe-actions .sh-swipe-action-btn.action-warning,sh-list-item-swipe .sh-swipe-actions .sh-swipe-action-btn.warning{background-color:var(--warn-8);color:var(--base-1)}sh-list-item-swipe .sh-swipe-actions button.action-warning:hover,sh-list-item-swipe .sh-swipe-actions button.warning:hover,sh-list-item-swipe .sh-swipe-actions button[actionLeft].action-warning:hover,sh-list-item-swipe .sh-swipe-actions button[actionLeft].warning:hover,sh-list-item-swipe .sh-swipe-actions button[actionRight].action-warning:hover,sh-list-item-swipe .sh-swipe-actions button[actionRight].warning:hover,sh-list-item-swipe .sh-swipe-actions .sh-swipe-action-btn.action-warning:hover,sh-list-item-swipe .sh-swipe-actions .sh-swipe-action-btn.warning:hover{background-color:var(--warn-9)}sh-list-item-swipe .sh-swipe-actions button.action-primary,sh-list-item-swipe .sh-swipe-actions button.primary,sh-list-item-swipe .sh-swipe-actions button[actionLeft].action-primary,sh-list-item-swipe .sh-swipe-actions button[actionLeft].primary,sh-list-item-swipe .sh-swipe-actions button[actionRight].action-primary,sh-list-item-swipe .sh-swipe-actions button[actionRight].primary,sh-list-item-swipe .sh-swipe-actions .sh-swipe-action-btn.action-primary,sh-list-item-swipe .sh-swipe-actions .sh-swipe-action-btn.primary{background-color:var(--primary-8);color:var(--base-1)}sh-list-item-swipe .sh-swipe-actions button.action-primary:hover,sh-list-item-swipe .sh-swipe-actions button.primary:hover,sh-list-item-swipe .sh-swipe-actions button[actionLeft].action-primary:hover,sh-list-item-swipe .sh-swipe-actions button[actionLeft].primary:hover,sh-list-item-swipe .sh-swipe-actions button[actionRight].action-primary:hover,sh-list-item-swipe .sh-swipe-actions button[actionRight].primary:hover,sh-list-item-swipe .sh-swipe-actions .sh-swipe-action-btn.action-primary:hover,sh-list-item-swipe .sh-swipe-actions .sh-swipe-action-btn.primary:hover{background-color:var(--primary-9)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
213
|
+
}
|
|
214
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: ShipListItemSwipe, decorators: [{
|
|
215
|
+
type: Component,
|
|
216
|
+
args: [{ selector: 'sh-list-item-swipe', standalone: true, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
217
|
+
<div class="sh-swipe-container">
|
|
218
|
+
<div class="sh-swipe-actions actions-left" #actionsLeft>
|
|
219
|
+
<ng-content select="button[actionLeft]" />
|
|
220
|
+
</div>
|
|
221
|
+
<div class="sh-swipe-actions actions-right" #actionsRight>
|
|
222
|
+
<ng-content select="button[actionRight]" />
|
|
223
|
+
</div>
|
|
224
|
+
<div class="sh-swipe-content" #content>
|
|
225
|
+
<ng-content />
|
|
226
|
+
</div>
|
|
227
|
+
</div>
|
|
228
|
+
`, host: {
|
|
229
|
+
class: 'sh-list-item-swipe',
|
|
230
|
+
}, styles: ["sh-list-item-swipe{display:block;width:100%;position:relative;overflow:hidden;border-radius:var(--list-s, var(--shape-2));margin:0;padding:0}sh-list-item-swipe .sh-swipe-container{position:relative;width:100%;overflow:hidden}sh-list-item-swipe .sh-swipe-content{position:relative;z-index:2;width:100%;box-sizing:border-box;background-color:var(--base-1);color:var(--list-color, var(--base-9));border-radius:inherit;transition:transform .2s cubic-bezier(.25,.8,.25,1),background-color .15s ease}sh-list-item-swipe .sh-swipe-content:hover{background-color:var(--base-2)}sh-list-item-swipe .sh-swipe-content>[item],sh-list-item-swipe .sh-swipe-content>[action]{background-color:transparent!important;box-shadow:none!important;border:0!important;width:100%;margin:0;box-sizing:border-box}sh-list-item-swipe:focus-visible .sh-swipe-content{outline:2px solid var(--primary-8);outline-offset:-2px}sh-list-item-swipe.active .sh-swipe-content,sh-list-item-swipe.selected .sh-swipe-content,sh-list-item-swipe:has(.active) .sh-swipe-content,sh-list-item-swipe:has(.selected) .sh-swipe-content,sh-list-item-swipe:has(input:checked) .sh-swipe-content{background-color:var(--list-active-bg, var(--base-2));color:var(--base-12)}sh-list-item-swipe .sh-swipe-actions{position:absolute;top:0;bottom:0;z-index:1;display:flex;align-items:stretch;box-sizing:border-box}sh-list-item-swipe .sh-swipe-actions.actions-left{left:0}sh-list-item-swipe .sh-swipe-actions.actions-right{right:0}sh-list-item-swipe .sh-swipe-actions button,sh-list-item-swipe .sh-swipe-actions button[actionLeft],sh-list-item-swipe .sh-swipe-actions button[actionRight],sh-list-item-swipe .sh-swipe-actions .sh-swipe-action-btn{border:0;margin:0;padding:0 1.25rem;display:flex;align-items:center;justify-content:center;font:var(--paragraph-30B);cursor:pointer;background-color:var(--base-3);color:var(--base-10);transition:background-color .15s ease;height:100%}sh-list-item-swipe .sh-swipe-actions button:hover,sh-list-item-swipe .sh-swipe-actions button[actionLeft]:hover,sh-list-item-swipe .sh-swipe-actions button[actionRight]:hover,sh-list-item-swipe .sh-swipe-actions .sh-swipe-action-btn:hover{background-color:var(--base-4)}sh-list-item-swipe .sh-swipe-actions button.action-danger,sh-list-item-swipe .sh-swipe-actions button.danger,sh-list-item-swipe .sh-swipe-actions button[actionLeft].action-danger,sh-list-item-swipe .sh-swipe-actions button[actionLeft].danger,sh-list-item-swipe .sh-swipe-actions button[actionRight].action-danger,sh-list-item-swipe .sh-swipe-actions button[actionRight].danger,sh-list-item-swipe .sh-swipe-actions .sh-swipe-action-btn.action-danger,sh-list-item-swipe .sh-swipe-actions .sh-swipe-action-btn.danger{background-color:var(--error-8);color:var(--base-1)}sh-list-item-swipe .sh-swipe-actions button.action-danger:hover,sh-list-item-swipe .sh-swipe-actions button.danger:hover,sh-list-item-swipe .sh-swipe-actions button[actionLeft].action-danger:hover,sh-list-item-swipe .sh-swipe-actions button[actionLeft].danger:hover,sh-list-item-swipe .sh-swipe-actions button[actionRight].action-danger:hover,sh-list-item-swipe .sh-swipe-actions button[actionRight].danger:hover,sh-list-item-swipe .sh-swipe-actions .sh-swipe-action-btn.action-danger:hover,sh-list-item-swipe .sh-swipe-actions .sh-swipe-action-btn.danger:hover{background-color:var(--error-9)}sh-list-item-swipe .sh-swipe-actions button.action-success,sh-list-item-swipe .sh-swipe-actions button.success,sh-list-item-swipe .sh-swipe-actions button[actionLeft].action-success,sh-list-item-swipe .sh-swipe-actions button[actionLeft].success,sh-list-item-swipe .sh-swipe-actions button[actionRight].action-success,sh-list-item-swipe .sh-swipe-actions button[actionRight].success,sh-list-item-swipe .sh-swipe-actions .sh-swipe-action-btn.action-success,sh-list-item-swipe .sh-swipe-actions .sh-swipe-action-btn.success{background-color:var(--success-8);color:var(--base-1)}sh-list-item-swipe .sh-swipe-actions button.action-success:hover,sh-list-item-swipe .sh-swipe-actions button.success:hover,sh-list-item-swipe .sh-swipe-actions button[actionLeft].action-success:hover,sh-list-item-swipe .sh-swipe-actions button[actionLeft].success:hover,sh-list-item-swipe .sh-swipe-actions button[actionRight].action-success:hover,sh-list-item-swipe .sh-swipe-actions button[actionRight].success:hover,sh-list-item-swipe .sh-swipe-actions .sh-swipe-action-btn.action-success:hover,sh-list-item-swipe .sh-swipe-actions .sh-swipe-action-btn.success:hover{background-color:var(--success-9)}sh-list-item-swipe .sh-swipe-actions button.action-warning,sh-list-item-swipe .sh-swipe-actions button.warning,sh-list-item-swipe .sh-swipe-actions button[actionLeft].action-warning,sh-list-item-swipe .sh-swipe-actions button[actionLeft].warning,sh-list-item-swipe .sh-swipe-actions button[actionRight].action-warning,sh-list-item-swipe .sh-swipe-actions button[actionRight].warning,sh-list-item-swipe .sh-swipe-actions .sh-swipe-action-btn.action-warning,sh-list-item-swipe .sh-swipe-actions .sh-swipe-action-btn.warning{background-color:var(--warn-8);color:var(--base-1)}sh-list-item-swipe .sh-swipe-actions button.action-warning:hover,sh-list-item-swipe .sh-swipe-actions button.warning:hover,sh-list-item-swipe .sh-swipe-actions button[actionLeft].action-warning:hover,sh-list-item-swipe .sh-swipe-actions button[actionLeft].warning:hover,sh-list-item-swipe .sh-swipe-actions button[actionRight].action-warning:hover,sh-list-item-swipe .sh-swipe-actions button[actionRight].warning:hover,sh-list-item-swipe .sh-swipe-actions .sh-swipe-action-btn.action-warning:hover,sh-list-item-swipe .sh-swipe-actions .sh-swipe-action-btn.warning:hover{background-color:var(--warn-9)}sh-list-item-swipe .sh-swipe-actions button.action-primary,sh-list-item-swipe .sh-swipe-actions button.primary,sh-list-item-swipe .sh-swipe-actions button[actionLeft].action-primary,sh-list-item-swipe .sh-swipe-actions button[actionLeft].primary,sh-list-item-swipe .sh-swipe-actions button[actionRight].action-primary,sh-list-item-swipe .sh-swipe-actions button[actionRight].primary,sh-list-item-swipe .sh-swipe-actions .sh-swipe-action-btn.action-primary,sh-list-item-swipe .sh-swipe-actions .sh-swipe-action-btn.primary{background-color:var(--primary-8);color:var(--base-1)}sh-list-item-swipe .sh-swipe-actions button.action-primary:hover,sh-list-item-swipe .sh-swipe-actions button.primary:hover,sh-list-item-swipe .sh-swipe-actions button[actionLeft].action-primary:hover,sh-list-item-swipe .sh-swipe-actions button[actionLeft].primary:hover,sh-list-item-swipe .sh-swipe-actions button[actionRight].action-primary:hover,sh-list-item-swipe .sh-swipe-actions button[actionRight].primary:hover,sh-list-item-swipe .sh-swipe-actions .sh-swipe-action-btn.action-primary:hover,sh-list-item-swipe .sh-swipe-actions .sh-swipe-action-btn.primary:hover{background-color:var(--primary-9)}\n"] }]
|
|
231
|
+
}], propDecorators: { contentEl: [{ type: i0.ViewChild, args: ['content', { isSignal: true }] }], actionsLeftEl: [{ type: i0.ViewChild, args: ['actionsLeft', { isSignal: true }] }], actionsRightEl: [{ type: i0.ViewChild, args: ['actionsRight', { isSignal: true }] }], swipeThreshold: [{ type: i0.Input, args: [{ isSignal: true, alias: "swipeThreshold", required: false }] }], swipeOpen: [{ type: i0.Output, args: ["swipeOpen"] }], swipeClose: [{ type: i0.Output, args: ["swipeClose"] }], onTouchStart: [{
|
|
232
|
+
type: HostListener,
|
|
233
|
+
args: ['touchstart', ['$event']]
|
|
234
|
+
}] } });
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Generated bundle index. Do not edit.
|
|
238
|
+
*/
|
|
239
|
+
|
|
240
|
+
export { ShipListItemSwipe, ShipListItemSwipeService };
|
|
241
|
+
//# sourceMappingURL=ship-ui-core-ship-list-item-swipe.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ship-ui-core-ship-list-item-swipe.mjs","sources":["../../../projects/ship-ui/ship-list-item-swipe/ship-list-item-swipe.ts","../../../projects/ship-ui/ship-list-item-swipe/ship-ui-core-ship-list-item-swipe.ts"],"sourcesContent":["import { DOCUMENT } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n HostListener,\n inject,\n Injectable,\n input,\n OnDestroy,\n output,\n Renderer2,\n viewChild,\n ViewEncapsulation,\n} from '@angular/core';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class ShipListItemSwipeService {\n activeSwipeItem: ShipListItemSwipe | null = null;\n}\n\n@Component({\n selector: 'sh-list-item-swipe',\n standalone: true,\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n styleUrl: './ship-list-item-swipe.scss',\n template: `\n <div class=\"sh-swipe-container\">\n <div class=\"sh-swipe-actions actions-left\" #actionsLeft>\n <ng-content select=\"button[actionLeft]\" />\n </div>\n <div class=\"sh-swipe-actions actions-right\" #actionsRight>\n <ng-content select=\"button[actionRight]\" />\n </div>\n <div class=\"sh-swipe-content\" #content>\n <ng-content />\n </div>\n </div>\n `,\n host: {\n class: 'sh-list-item-swipe',\n },\n})\nexport class ShipListItemSwipe implements OnDestroy {\n #swipeService = inject(ShipListItemSwipeService);\n #elementRef = inject(ElementRef<HTMLElement>);\n #document = inject(DOCUMENT);\n #renderer = inject(Renderer2);\n\n contentEl = viewChild.required<ElementRef<HTMLElement>>('content');\n actionsLeftEl = viewChild.required<ElementRef<HTMLElement>>('actionsLeft');\n actionsRightEl = viewChild.required<ElementRef<HTMLElement>>('actionsRight');\n\n swipeThreshold = input<number>(0.3);\n\n swipeOpen = output<'left' | 'right'>();\n swipeClose = output<void>();\n\n #startX = 0;\n #startY = 0;\n #currentX = 0;\n #isSwiping = false;\n #isScrollLock = false;\n #hasLeftActions = false;\n #hasRightActions = false;\n #leftActionsWidth = 0;\n #rightActionsWidth = 0;\n\n #swipeState: 'closed' | 'open-left' | 'open-right' = 'closed';\n\n #boundTouchMove = this.#onTouchMove.bind(this);\n #boundTouchEnd = this.#onTouchEnd.bind(this);\n\n @HostListener('touchstart', ['$event'])\n onTouchStart(e: TouchEvent) {\n const touch = e.touches[0];\n this.#startX = touch.clientX;\n this.#startY = touch.clientY;\n this.#currentX = this.#getTranslateX();\n\n if (this.#swipeService.activeSwipeItem && this.#swipeService.activeSwipeItem !== this) {\n this.#swipeService.activeSwipeItem.close();\n }\n\n const host = this.#elementRef.nativeElement;\n this.#hasLeftActions = host.querySelector('button[actionLeft]') !== null;\n this.#hasRightActions = host.querySelector('button[actionRight]') !== null;\n\n this.#leftActionsWidth = this.actionsLeftEl().nativeElement.offsetWidth || 0;\n this.#rightActionsWidth = this.actionsRightEl().nativeElement.offsetWidth || 0;\n\n this.#isSwiping = false;\n this.#isScrollLock = false;\n\n this.#renderer.setStyle(this.contentEl().nativeElement, 'transition', 'none');\n\n this.#document.addEventListener('touchmove', this.#boundTouchMove, { passive: false });\n this.#document.addEventListener('touchend', this.#boundTouchEnd, { passive: false });\n this.#document.addEventListener('touchcancel', this.#boundTouchEnd, { passive: false });\n }\n\n #onTouchMove(e: TouchEvent) {\n const touch = e.touches[0];\n const deltaX = touch.clientX - this.#startX;\n const deltaY = touch.clientY - this.#startY;\n\n if (!this.#isSwiping) {\n if (Math.abs(deltaY) > Math.abs(deltaX)) {\n this.#unbindListeners();\n return;\n }\n if (Math.abs(deltaX) > 8) {\n this.#isSwiping = true;\n this.#isScrollLock = true;\n\n if (this.#swipeService.activeSwipeItem && this.#swipeService.activeSwipeItem !== this) {\n this.#swipeService.activeSwipeItem.close();\n }\n }\n }\n\n if (this.#isScrollLock) {\n e.preventDefault();\n }\n\n if (this.#isSwiping) {\n let targetTranslate = this.#currentX + deltaX;\n\n if (targetTranslate > 0) {\n if (!this.#hasLeftActions) {\n targetTranslate = 0;\n } else if (targetTranslate > this.#leftActionsWidth) {\n targetTranslate = this.#leftActionsWidth + (targetTranslate - this.#leftActionsWidth) * 0.25;\n }\n } else if (targetTranslate < 0) {\n if (!this.#hasRightActions) {\n targetTranslate = 0;\n } else if (targetTranslate < -this.#rightActionsWidth) {\n targetTranslate = -this.#rightActionsWidth + (targetTranslate + this.#rightActionsWidth) * 0.25;\n }\n }\n\n this.#setTranslateX(targetTranslate);\n }\n }\n\n #onTouchEnd() {\n this.#unbindListeners();\n\n if (this.#isSwiping) {\n const currentTranslate = this.#getTranslateX();\n const threshold = this.swipeThreshold();\n\n if (currentTranslate > 0 && this.#hasLeftActions) {\n if (currentTranslate > this.#leftActionsWidth * threshold) {\n this.open('left');\n } else {\n this.close();\n }\n } else if (currentTranslate < 0 && this.#hasRightActions) {\n if (Math.abs(currentTranslate) > this.#rightActionsWidth * threshold) {\n this.open('right');\n } else {\n this.close();\n }\n } else {\n this.close();\n }\n }\n }\n\n open(side: 'left' | 'right') {\n if (side === 'left') {\n const leftWidth = this.actionsLeftEl().nativeElement.offsetWidth || 0;\n this.#animateTo(leftWidth);\n this.#swipeState = 'open-left';\n this.swipeOpen.emit('left');\n this.#swipeService.activeSwipeItem = this;\n } else {\n const rightWidth = this.actionsRightEl().nativeElement.offsetWidth || 0;\n this.#animateTo(-rightWidth);\n this.#swipeState = 'open-right';\n this.swipeOpen.emit('right');\n this.#swipeService.activeSwipeItem = this;\n }\n }\n\n close() {\n this.#animateTo(0);\n if (this.#swipeState !== 'closed') {\n this.#swipeState = 'closed';\n this.swipeClose.emit();\n }\n if (this.#swipeService.activeSwipeItem === this) {\n this.#swipeService.activeSwipeItem = null;\n }\n }\n\n #animateTo(x: number) {\n const el = this.contentEl().nativeElement;\n this.#renderer.setStyle(el, 'transition', 'transform 200ms cubic-bezier(0.25, 0.8, 0.25, 1)');\n this.#setTranslateX(x);\n }\n\n #setTranslateX(x: number) {\n this.#renderer.setStyle(this.contentEl().nativeElement, 'transform', `translateX(${x}px)`);\n }\n\n #getTranslateX(): number {\n const transform = this.contentEl().nativeElement.style.transform;\n if (!transform) return 0;\n const match = /translateX\\(([^)]+)px\\)/.exec(transform);\n return match ? parseFloat(match[1]) : 0;\n }\n\n #unbindListeners() {\n this.#document.removeEventListener('touchmove', this.#boundTouchMove);\n this.#document.removeEventListener('touchend', this.#boundTouchEnd);\n this.#document.removeEventListener('touchcancel', this.#boundTouchEnd);\n }\n\n ngOnDestroy() {\n this.#unbindListeners();\n if (this.#swipeService.activeSwipeItem === this) {\n this.#swipeService.activeSwipeItem = null;\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;MAmBa,wBAAwB,CAAA;AAHrC,IAAA,WAAA,GAAA;QA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,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,cAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,SAAA,EAAA,IAAA,EAAA,CACZ,cAAc,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,cAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,gBAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,SAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,MAAA,EAAA,IAAA,EAAA,CAAA,WAAA,CAAA,EAAA,CAAA,EAAA,UAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,MAAA,EAAA,IAAA,EAAA,CAAA,YAAA,CAAA,EAAA,CAAA,EAAA,YAAA,EAAA,CAAA;sBAsB1E,YAAY;uBAAC,YAAY,EAAE,CAAC,QAAQ,CAAC;;;AC5ExC;;AAEG;;;;"}
|
|
@@ -6,6 +6,7 @@ import { ShipIcon } from '@ship-ui/core/ship-icon';
|
|
|
6
6
|
import { ShipPopover } from '@ship-ui/core/ship-popover';
|
|
7
7
|
import { observeChildren, createFormInputSignal, generateUniqueId } from '@ship-ui/core';
|
|
8
8
|
|
|
9
|
+
const openMenus = [];
|
|
9
10
|
class ShipMenu {
|
|
10
11
|
constructor() {
|
|
11
12
|
this.#document = inject(DOCUMENT);
|
|
@@ -39,12 +40,12 @@ class ShipMenu {
|
|
|
39
40
|
...(ngDevMode ? [{ debugName: "optionsRef" }] : /* istanbul ignore next */ []));
|
|
40
41
|
this.openMenusEffect = effect((onCleanup) => {
|
|
41
42
|
if (this.isOpen()) {
|
|
42
|
-
|
|
43
|
+
openMenus.push(this);
|
|
43
44
|
}
|
|
44
45
|
onCleanup(() => {
|
|
45
|
-
const index =
|
|
46
|
+
const index = openMenus.indexOf(this);
|
|
46
47
|
if (index > -1) {
|
|
47
|
-
|
|
48
|
+
openMenus.splice(index, 1);
|
|
48
49
|
}
|
|
49
50
|
});
|
|
50
51
|
}, /* @ts-ignore */
|
|
@@ -112,8 +113,7 @@ class ShipMenu {
|
|
|
112
113
|
}, /* @ts-ignore */
|
|
113
114
|
...(ngDevMode ? [{ debugName: "optionsEffect" }] : /* istanbul ignore next */ []));
|
|
114
115
|
this.keyDownEventListener = (e) => {
|
|
115
|
-
|
|
116
|
-
if (ShipMenu.openMenus.at(-1) !== this)
|
|
116
|
+
if (openMenus.at(-1) !== this)
|
|
117
117
|
return;
|
|
118
118
|
const activeOptionIndex = this.activeOptionIndex();
|
|
119
119
|
if (this.#keybindings.matches(e, 'menu.next')) {
|
|
@@ -128,7 +128,6 @@ class ShipMenu {
|
|
|
128
128
|
if (activeOptionIndex > -1) {
|
|
129
129
|
const el = this.activeElements()[activeOptionIndex];
|
|
130
130
|
const parent = el.parentElement;
|
|
131
|
-
// For nested menu's
|
|
132
131
|
if (parent?.hasAttribute('trigger')) {
|
|
133
132
|
e.preventDefault();
|
|
134
133
|
const event = new CustomEvent('ship-menu-open', {
|
|
@@ -151,7 +150,6 @@ class ShipMenu {
|
|
|
151
150
|
if (activeOptionIndex > -1) {
|
|
152
151
|
const el = this.activeElements()[activeOptionIndex];
|
|
153
152
|
const parent = el.parentElement;
|
|
154
|
-
// For nested menu's
|
|
155
153
|
if (parent?.hasAttribute('trigger')) {
|
|
156
154
|
const event = new CustomEvent('ship-menu-open', {
|
|
157
155
|
bubbles: true,
|
|
@@ -274,7 +272,6 @@ class ShipMenu {
|
|
|
274
272
|
#document;
|
|
275
273
|
#renderer;
|
|
276
274
|
#keybindings;
|
|
277
|
-
static { this.openMenus = []; }
|
|
278
275
|
toggleIsOpen(event) {
|
|
279
276
|
event.preventDefault();
|
|
280
277
|
event.stopPropagation();
|
|
@@ -408,9 +405,9 @@ class ShipMenu {
|
|
|
408
405
|
this.abortController.abort();
|
|
409
406
|
this.abortController = null;
|
|
410
407
|
}
|
|
411
|
-
const index =
|
|
408
|
+
const index = openMenus.indexOf(this);
|
|
412
409
|
if (index > -1) {
|
|
413
|
-
|
|
410
|
+
openMenus.splice(index, 1);
|
|
414
411
|
}
|
|
415
412
|
}
|
|
416
413
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: ShipMenu, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|