@duskmoon-dev/el-pagination 1.5.6 → 1.6.0
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/cjs/index.js +60 -1
- package/dist/cjs/index.js.map +3 -3
- package/dist/cjs/register.js +60 -1
- package/dist/cjs/register.js.map +3 -3
- package/dist/esm/index.js +60 -1
- package/dist/esm/index.js.map +3 -3
- package/dist/esm/register.js +60 -1
- package/dist/esm/register.js.map +3 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/el-dm-pagination.d.ts +8 -0
- package/dist/types/el-dm-pagination.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/cjs/index.js
CHANGED
|
@@ -126,6 +126,36 @@ var styles = import_el_base.css`
|
|
|
126
126
|
user-select: none;
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
+
::slotted([slot='prev']),
|
|
130
|
+
::slotted([slot='previous']),
|
|
131
|
+
::slotted([slot='page']),
|
|
132
|
+
::slotted([slot='next']) {
|
|
133
|
+
display: inline-flex;
|
|
134
|
+
align-items: center;
|
|
135
|
+
justify-content: center;
|
|
136
|
+
min-width: 2rem;
|
|
137
|
+
height: 2rem;
|
|
138
|
+
padding: 0 0.5rem;
|
|
139
|
+
border: 1px solid var(--color-border, #d1d5db);
|
|
140
|
+
border-radius: var(--radius-md, 0.375rem);
|
|
141
|
+
color: var(--color-text, #374151);
|
|
142
|
+
font: inherit;
|
|
143
|
+
text-decoration: none;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
::slotted([slot='page'][aria-current='page']),
|
|
147
|
+
::slotted([slot='page'][data-active='true']) {
|
|
148
|
+
border-color: var(--color-primary, #3b82f6);
|
|
149
|
+
background: var(--color-primary, #3b82f6);
|
|
150
|
+
color: var(--color-primary-contrast, #ffffff);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
::slotted([disabled]),
|
|
154
|
+
::slotted([aria-disabled='true']) {
|
|
155
|
+
opacity: 0.5;
|
|
156
|
+
cursor: not-allowed;
|
|
157
|
+
}
|
|
158
|
+
|
|
129
159
|
/* Size variants */
|
|
130
160
|
:host([size='xs']) .pagination-btn {
|
|
131
161
|
min-width: 1.5rem;
|
|
@@ -204,6 +234,7 @@ class ElDmPagination extends import_el_base.BaseElement {
|
|
|
204
234
|
size: { type: String, reflect: true },
|
|
205
235
|
color: { type: String, reflect: true }
|
|
206
236
|
};
|
|
237
|
+
_controlsObserver;
|
|
207
238
|
constructor() {
|
|
208
239
|
super();
|
|
209
240
|
this.attachStyles(styles);
|
|
@@ -212,6 +243,17 @@ class ElDmPagination extends import_el_base.BaseElement {
|
|
|
212
243
|
super.connectedCallback();
|
|
213
244
|
this.addEventListener("click", this._handleClick.bind(this));
|
|
214
245
|
this.addEventListener("keydown", this._handleKeydown.bind(this));
|
|
246
|
+
this._controlsObserver = new MutationObserver(() => this.update());
|
|
247
|
+
this._controlsObserver.observe(this, {
|
|
248
|
+
childList: true,
|
|
249
|
+
subtree: true,
|
|
250
|
+
attributes: true,
|
|
251
|
+
attributeFilter: ["slot"]
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
disconnectedCallback() {
|
|
255
|
+
this._controlsObserver?.disconnect();
|
|
256
|
+
super.disconnectedCallback();
|
|
215
257
|
}
|
|
216
258
|
_getPageRange() {
|
|
217
259
|
const total = Math.max(1, this.total);
|
|
@@ -252,6 +294,9 @@ class ElDmPagination extends import_el_base.BaseElement {
|
|
|
252
294
|
}
|
|
253
295
|
return pages;
|
|
254
296
|
}
|
|
297
|
+
_hasDeclarativeControls() {
|
|
298
|
+
return this.querySelector('[slot="prev"], [slot="previous"], [slot="page"], [slot="next"]') !== null;
|
|
299
|
+
}
|
|
255
300
|
_goToPage(page) {
|
|
256
301
|
const newPage = Math.min(Math.max(1, page), this.total);
|
|
257
302
|
if (newPage !== this.current) {
|
|
@@ -260,6 +305,8 @@ class ElDmPagination extends import_el_base.BaseElement {
|
|
|
260
305
|
}
|
|
261
306
|
}
|
|
262
307
|
_handleClick(event) {
|
|
308
|
+
if (this._hasDeclarativeControls())
|
|
309
|
+
return;
|
|
263
310
|
const target = event.target;
|
|
264
311
|
const button = target.closest("button");
|
|
265
312
|
if (!button || button.disabled)
|
|
@@ -279,6 +326,8 @@ class ElDmPagination extends import_el_base.BaseElement {
|
|
|
279
326
|
}
|
|
280
327
|
}
|
|
281
328
|
_handleKeydown(event) {
|
|
329
|
+
if (this._hasDeclarativeControls())
|
|
330
|
+
return;
|
|
282
331
|
switch (event.key) {
|
|
283
332
|
case "ArrowLeft":
|
|
284
333
|
event.preventDefault();
|
|
@@ -299,6 +348,16 @@ class ElDmPagination extends import_el_base.BaseElement {
|
|
|
299
348
|
}
|
|
300
349
|
}
|
|
301
350
|
render() {
|
|
351
|
+
if (this._hasDeclarativeControls()) {
|
|
352
|
+
return `
|
|
353
|
+
<nav class="pagination" part="container" role="navigation" aria-label="Pagination">
|
|
354
|
+
<slot name="previous"></slot>
|
|
355
|
+
<slot name="prev"></slot>
|
|
356
|
+
<slot name="page"></slot>
|
|
357
|
+
<slot name="next"></slot>
|
|
358
|
+
</nav>
|
|
359
|
+
`;
|
|
360
|
+
}
|
|
302
361
|
const total = Math.max(1, this.total);
|
|
303
362
|
const current = Math.min(Math.max(1, this.current), total);
|
|
304
363
|
const pages = this._getPageRange();
|
|
@@ -366,5 +425,5 @@ function register() {
|
|
|
366
425
|
}
|
|
367
426
|
}
|
|
368
427
|
|
|
369
|
-
//# debugId=
|
|
428
|
+
//# debugId=668628C3CABA582D64756E2164756E21
|
|
370
429
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/el-dm-pagination.ts", "../../src/index.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"/**\n * DuskMoon Pagination Element\n *\n * A customizable pagination component for page navigation.\n * Supports first/last, previous/next buttons, and page number display with ellipsis.\n *\n * @element el-dm-pagination\n *\n * @attr {number} total - Total number of pages\n * @attr {number} current - Current active page (1-indexed)\n * @attr {number} siblings - Number of pages to show around current page\n * @attr {number} boundaries - Number of pages to show at start/end\n * @attr {string} size - Button size: xs, sm, md, lg\n * @attr {string} color - Color variant: primary, secondary, neutral\n *\n * @csspart container - The pagination container\n * @csspart button - Navigation buttons (first, prev, next, last)\n * @csspart page - Page number buttons\n * @csspart ellipsis - Ellipsis indicators\n *\n * @fires change - Fired when the current page changes, detail: { page: number }\n */\n\nimport { BaseElement, css } from '@duskmoon-dev/el-base';\n\nexport type PaginationSize = 'xs' | 'sm' | 'md' | 'lg';\nexport type PaginationColor = 'primary' | 'secondary' | 'neutral';\n\nconst styles = css`\n :host {\n display: inline-flex;\n vertical-align: middle;\n }\n\n :host([hidden]) {\n display: none !important;\n }\n\n .pagination {\n display: flex;\n align-items: center;\n gap: 0.25rem;\n font-family: inherit;\n }\n\n .pagination-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n border: 1px solid var(--color-border, #d1d5db);\n background: var(--color-surface, #ffffff);\n color: var(--color-text, #374151);\n cursor: pointer;\n font-family: inherit;\n font-weight: 500;\n transition:\n background-color 0.15s ease,\n border-color 0.15s ease,\n color 0.15s ease;\n border-radius: var(--radius-md, 0.375rem);\n min-width: 2rem;\n height: 2rem;\n padding: 0 0.5rem;\n font-size: 0.875rem;\n line-height: 1;\n }\n\n .pagination-btn:hover:not(:disabled) {\n background: var(--color-surface-hover, #f3f4f6);\n border-color: var(--color-border-hover, #9ca3af);\n }\n\n .pagination-btn:focus-visible {\n outline: 2px solid var(--color-primary, #3b82f6);\n outline-offset: 2px;\n }\n\n .pagination-btn:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n .pagination-btn.active {\n background: var(--color-primary, #3b82f6);\n border-color: var(--color-primary, #3b82f6);\n color: var(--color-primary-contrast, #ffffff);\n }\n\n .pagination-btn.nav-btn {\n padding: 0 0.375rem;\n }\n\n .pagination-btn.nav-btn svg {\n width: 1em;\n height: 1em;\n }\n\n .ellipsis {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 2rem;\n height: 2rem;\n color: var(--color-text-muted, #6b7280);\n font-size: 0.875rem;\n user-select: none;\n }\n\n /* Size variants */\n :host([size='xs']) .pagination-btn {\n min-width: 1.5rem;\n height: 1.5rem;\n padding: 0 0.25rem;\n font-size: 0.75rem;\n border-radius: var(--radius-sm, 0.25rem);\n }\n\n :host([size='xs']) .ellipsis {\n min-width: 1.5rem;\n height: 1.5rem;\n font-size: 0.75rem;\n }\n\n :host([size='sm']) .pagination-btn {\n min-width: 1.75rem;\n height: 1.75rem;\n padding: 0 0.375rem;\n font-size: 0.8125rem;\n }\n\n :host([size='sm']) .ellipsis {\n min-width: 1.75rem;\n height: 1.75rem;\n font-size: 0.8125rem;\n }\n\n :host([size='lg']) .pagination-btn {\n min-width: 2.5rem;\n height: 2.5rem;\n padding: 0 0.75rem;\n font-size: 1rem;\n }\n\n :host([size='lg']) .ellipsis {\n min-width: 2.5rem;\n height: 2.5rem;\n font-size: 1rem;\n }\n\n /* Color variants */\n :host([color='secondary']) .pagination-btn.active {\n background: var(--color-secondary, #8b5cf6);\n border-color: var(--color-secondary, #8b5cf6);\n color: var(--color-secondary-contrast, #ffffff);\n }\n\n :host([color='secondary']) .pagination-btn:focus-visible {\n outline-color: var(--color-secondary, #8b5cf6);\n }\n\n :host([color='neutral']) .pagination-btn.active {\n background: var(--color-neutral, #6b7280);\n border-color: var(--color-neutral, #6b7280);\n color: var(--color-neutral-contrast, #ffffff);\n }\n\n :host([color='neutral']) .pagination-btn:focus-visible {\n outline-color: var(--color-neutral, #6b7280);\n }\n`;\n\n// SVG icons for navigation buttons\nconst ICONS = {\n first: `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M15.79 14.77a.75.75 0 01-1.06.02l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 111.04 1.08L11.832 10l3.938 3.71a.75.75 0 01.02 1.06zm-6 0a.75.75 0 01-1.06.02l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 111.04 1.08L5.832 10l3.938 3.71a.75.75 0 01.02 1.06z\" clip-rule=\"evenodd\"/></svg>`,\n prev: `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M12.79 5.23a.75.75 0 01-.02 1.06L8.832 10l3.938 3.71a.75.75 0 11-1.04 1.08l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 011.06.02z\" clip-rule=\"evenodd\"/></svg>`,\n next: `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z\" clip-rule=\"evenodd\"/></svg>`,\n last: `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M4.21 5.23a.75.75 0 011.06-.02l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 11-1.04-1.08L8.168 10 4.23 6.29a.75.75 0 01-.02-1.06zm6 0a.75.75 0 011.06-.02l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 11-1.04-1.08L14.168 10l-3.938-3.71a.75.75 0 01-.02-1.06z\" clip-rule=\"evenodd\"/></svg>`,\n};\n\nexport class ElDmPagination extends BaseElement {\n static properties = {\n total: { type: Number, reflect: true, default: 1 },\n current: { type: Number, reflect: true, default: 1 },\n siblings: { type: Number, reflect: true, default: 1 },\n boundaries: { type: Number, reflect: true, default: 1 },\n size: { type: String, reflect: true },\n color: { type: String, reflect: true },\n };\n\n /** Total number of pages */\n declare total: number;\n\n /** Current active page (1-indexed) */\n declare current: number;\n\n /** Number of pages shown around the current page */\n declare siblings: number;\n\n /** Number of pages shown at the start and end */\n declare boundaries: number;\n\n /** Button size: xs, sm, md, lg */\n declare size: PaginationSize;\n\n /** Color variant: primary, secondary, neutral */\n declare color: PaginationColor;\n\n constructor() {\n super();\n this.attachStyles(styles);\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener('click', this._handleClick.bind(this));\n this.addEventListener('keydown', this._handleKeydown.bind(this));\n }\n\n /**\n * Calculate the range of page numbers to display\n */\n private _getPageRange(): (number | 'ellipsis')[] {\n const total = Math.max(1, this.total);\n const current = Math.min(Math.max(1, this.current), total);\n const siblings = Math.max(0, this.siblings);\n const boundaries = Math.max(0, this.boundaries);\n\n // If total pages fit without ellipsis\n const totalPageNumbers = boundaries * 2 + siblings * 2 + 3; // boundaries + siblings + current + 2 ellipsis spots\n if (total <= totalPageNumbers) {\n return Array.from({ length: total }, (_, i) => i + 1);\n }\n\n const leftSiblingIndex = Math.max(current - siblings, boundaries + 1);\n const rightSiblingIndex = Math.min(current + siblings, total - boundaries);\n\n const showLeftEllipsis = leftSiblingIndex > boundaries + 2;\n const showRightEllipsis = rightSiblingIndex < total - boundaries - 1;\n\n const pages: (number | 'ellipsis')[] = [];\n\n // Add left boundary pages\n for (let i = 1; i <= boundaries; i++) {\n pages.push(i);\n }\n\n // Add left ellipsis or connecting page\n if (showLeftEllipsis) {\n pages.push('ellipsis');\n } else if (boundaries + 1 < leftSiblingIndex) {\n pages.push(boundaries + 1);\n }\n\n // Add sibling pages and current page\n for (let i = leftSiblingIndex; i <= rightSiblingIndex; i++) {\n if (i > boundaries && i <= total - boundaries) {\n pages.push(i);\n }\n }\n\n // Add right ellipsis or connecting page\n if (showRightEllipsis) {\n pages.push('ellipsis');\n } else if (rightSiblingIndex < total - boundaries) {\n pages.push(total - boundaries);\n }\n\n // Add right boundary pages\n for (let i = total - boundaries + 1; i <= total; i++) {\n if (i > 0 && !pages.includes(i)) {\n pages.push(i);\n }\n }\n\n return pages;\n }\n\n /**\n * Navigate to a specific page\n */\n private _goToPage(page: number): void {\n const newPage = Math.min(Math.max(1, page), this.total);\n if (newPage !== this.current) {\n this.current = newPage;\n this.emit('change', { page: newPage });\n }\n }\n\n /**\n * Handle click events on pagination buttons\n */\n private _handleClick(event: Event): void {\n const target = event.target as HTMLElement;\n const button = target.closest('button');\n\n if (!button || button.disabled) return;\n\n const action = button.dataset.action;\n const page = button.dataset.page;\n\n if (action === 'first') {\n this._goToPage(1);\n } else if (action === 'prev') {\n this._goToPage(this.current - 1);\n } else if (action === 'next') {\n this._goToPage(this.current + 1);\n } else if (action === 'last') {\n this._goToPage(this.total);\n } else if (page) {\n this._goToPage(parseInt(page, 10));\n }\n }\n\n /**\n * Handle keyboard navigation\n */\n private _handleKeydown(event: KeyboardEvent): void {\n switch (event.key) {\n case 'ArrowLeft':\n event.preventDefault();\n this._goToPage(this.current - 1);\n break;\n case 'ArrowRight':\n event.preventDefault();\n this._goToPage(this.current + 1);\n break;\n case 'Home':\n event.preventDefault();\n this._goToPage(1);\n break;\n case 'End':\n event.preventDefault();\n this._goToPage(this.total);\n break;\n }\n }\n\n render(): string {\n const total = Math.max(1, this.total);\n const current = Math.min(Math.max(1, this.current), total);\n const pages = this._getPageRange();\n\n const isFirstPage = current === 1;\n const isLastPage = current === total;\n\n let pagesHtml = '';\n\n for (const page of pages) {\n if (page === 'ellipsis') {\n pagesHtml += `\n <span class=\"ellipsis\" part=\"ellipsis\" aria-hidden=\"true\">...</span>\n `;\n } else {\n const isActive = page === current;\n pagesHtml += `\n <button\n class=\"pagination-btn${isActive ? ' active' : ''}\"\n part=\"page\"\n data-page=\"${page}\"\n aria-label=\"Page ${page}\"\n aria-current=\"${isActive ? 'page' : 'false'}\"\n >${page}</button>\n `;\n }\n }\n\n return `\n <nav class=\"pagination\" part=\"container\" role=\"navigation\" aria-label=\"Pagination\">\n <button\n class=\"pagination-btn nav-btn\"\n part=\"button\"\n data-action=\"first\"\n aria-label=\"Go to first page\"\n ${isFirstPage ? 'disabled' : ''}\n >${ICONS.first}</button>\n <button\n class=\"pagination-btn nav-btn\"\n part=\"button\"\n data-action=\"prev\"\n aria-label=\"Go to previous page\"\n ${isFirstPage ? 'disabled' : ''}\n >${ICONS.prev}</button>\n ${pagesHtml}\n <button\n class=\"pagination-btn nav-btn\"\n part=\"button\"\n data-action=\"next\"\n aria-label=\"Go to next page\"\n ${isLastPage ? 'disabled' : ''}\n >${ICONS.next}</button>\n <button\n class=\"pagination-btn nav-btn\"\n part=\"button\"\n data-action=\"last\"\n aria-label=\"Go to last page\"\n ${isLastPage ? 'disabled' : ''}\n >${ICONS.last}</button>\n </nav>\n `;\n }\n}\n",
|
|
5
|
+
"/**\n * DuskMoon Pagination Element\n *\n * A customizable pagination component for page navigation.\n * Supports first/last, previous/next buttons, and page number display with ellipsis.\n *\n * @element el-dm-pagination\n *\n * @attr {number} total - Total number of pages\n * @attr {number} current - Current active page (1-indexed)\n * @attr {number} siblings - Number of pages to show around current page\n * @attr {number} boundaries - Number of pages to show at start/end\n * @attr {string} size - Button size: xs, sm, md, lg\n * @attr {string} color - Color variant: primary, secondary, neutral\n *\n * @slot prev - Declarative server-rendered previous-page control\n * @slot previous - Alias for the declarative previous-page control\n * @slot page - Declarative server-rendered page or ellipsis control\n * @slot next - Declarative server-rendered next-page control\n *\n * @csspart container - The pagination container\n * @csspart button - Navigation buttons (first, prev, next, last)\n * @csspart page - Page number buttons\n * @csspart ellipsis - Ellipsis indicators\n *\n * @fires change - Fired when the current page changes, detail: { page: number }\n */\n\nimport { BaseElement, css } from '@duskmoon-dev/el-base';\n\nexport type PaginationSize = 'xs' | 'sm' | 'md' | 'lg';\nexport type PaginationColor = 'primary' | 'secondary' | 'neutral';\n\nconst styles = css`\n :host {\n display: inline-flex;\n vertical-align: middle;\n }\n\n :host([hidden]) {\n display: none !important;\n }\n\n .pagination {\n display: flex;\n align-items: center;\n gap: 0.25rem;\n font-family: inherit;\n }\n\n .pagination-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n border: 1px solid var(--color-border, #d1d5db);\n background: var(--color-surface, #ffffff);\n color: var(--color-text, #374151);\n cursor: pointer;\n font-family: inherit;\n font-weight: 500;\n transition:\n background-color 0.15s ease,\n border-color 0.15s ease,\n color 0.15s ease;\n border-radius: var(--radius-md, 0.375rem);\n min-width: 2rem;\n height: 2rem;\n padding: 0 0.5rem;\n font-size: 0.875rem;\n line-height: 1;\n }\n\n .pagination-btn:hover:not(:disabled) {\n background: var(--color-surface-hover, #f3f4f6);\n border-color: var(--color-border-hover, #9ca3af);\n }\n\n .pagination-btn:focus-visible {\n outline: 2px solid var(--color-primary, #3b82f6);\n outline-offset: 2px;\n }\n\n .pagination-btn:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n .pagination-btn.active {\n background: var(--color-primary, #3b82f6);\n border-color: var(--color-primary, #3b82f6);\n color: var(--color-primary-contrast, #ffffff);\n }\n\n .pagination-btn.nav-btn {\n padding: 0 0.375rem;\n }\n\n .pagination-btn.nav-btn svg {\n width: 1em;\n height: 1em;\n }\n\n .ellipsis {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 2rem;\n height: 2rem;\n color: var(--color-text-muted, #6b7280);\n font-size: 0.875rem;\n user-select: none;\n }\n\n ::slotted([slot='prev']),\n ::slotted([slot='previous']),\n ::slotted([slot='page']),\n ::slotted([slot='next']) {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 2rem;\n height: 2rem;\n padding: 0 0.5rem;\n border: 1px solid var(--color-border, #d1d5db);\n border-radius: var(--radius-md, 0.375rem);\n color: var(--color-text, #374151);\n font: inherit;\n text-decoration: none;\n }\n\n ::slotted([slot='page'][aria-current='page']),\n ::slotted([slot='page'][data-active='true']) {\n border-color: var(--color-primary, #3b82f6);\n background: var(--color-primary, #3b82f6);\n color: var(--color-primary-contrast, #ffffff);\n }\n\n ::slotted([disabled]),\n ::slotted([aria-disabled='true']) {\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n /* Size variants */\n :host([size='xs']) .pagination-btn {\n min-width: 1.5rem;\n height: 1.5rem;\n padding: 0 0.25rem;\n font-size: 0.75rem;\n border-radius: var(--radius-sm, 0.25rem);\n }\n\n :host([size='xs']) .ellipsis {\n min-width: 1.5rem;\n height: 1.5rem;\n font-size: 0.75rem;\n }\n\n :host([size='sm']) .pagination-btn {\n min-width: 1.75rem;\n height: 1.75rem;\n padding: 0 0.375rem;\n font-size: 0.8125rem;\n }\n\n :host([size='sm']) .ellipsis {\n min-width: 1.75rem;\n height: 1.75rem;\n font-size: 0.8125rem;\n }\n\n :host([size='lg']) .pagination-btn {\n min-width: 2.5rem;\n height: 2.5rem;\n padding: 0 0.75rem;\n font-size: 1rem;\n }\n\n :host([size='lg']) .ellipsis {\n min-width: 2.5rem;\n height: 2.5rem;\n font-size: 1rem;\n }\n\n /* Color variants */\n :host([color='secondary']) .pagination-btn.active {\n background: var(--color-secondary, #8b5cf6);\n border-color: var(--color-secondary, #8b5cf6);\n color: var(--color-secondary-contrast, #ffffff);\n }\n\n :host([color='secondary']) .pagination-btn:focus-visible {\n outline-color: var(--color-secondary, #8b5cf6);\n }\n\n :host([color='neutral']) .pagination-btn.active {\n background: var(--color-neutral, #6b7280);\n border-color: var(--color-neutral, #6b7280);\n color: var(--color-neutral-contrast, #ffffff);\n }\n\n :host([color='neutral']) .pagination-btn:focus-visible {\n outline-color: var(--color-neutral, #6b7280);\n }\n`;\n\n// SVG icons for navigation buttons\nconst ICONS = {\n first: `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M15.79 14.77a.75.75 0 01-1.06.02l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 111.04 1.08L11.832 10l3.938 3.71a.75.75 0 01.02 1.06zm-6 0a.75.75 0 01-1.06.02l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 111.04 1.08L5.832 10l3.938 3.71a.75.75 0 01.02 1.06z\" clip-rule=\"evenodd\"/></svg>`,\n prev: `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M12.79 5.23a.75.75 0 01-.02 1.06L8.832 10l3.938 3.71a.75.75 0 11-1.04 1.08l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 011.06.02z\" clip-rule=\"evenodd\"/></svg>`,\n next: `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z\" clip-rule=\"evenodd\"/></svg>`,\n last: `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M4.21 5.23a.75.75 0 011.06-.02l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 11-1.04-1.08L8.168 10 4.23 6.29a.75.75 0 01-.02-1.06zm6 0a.75.75 0 011.06-.02l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 11-1.04-1.08L14.168 10l-3.938-3.71a.75.75 0 01-.02-1.06z\" clip-rule=\"evenodd\"/></svg>`,\n};\n\nexport class ElDmPagination extends BaseElement {\n static properties = {\n total: { type: Number, reflect: true, default: 1 },\n current: { type: Number, reflect: true, default: 1 },\n siblings: { type: Number, reflect: true, default: 1 },\n boundaries: { type: Number, reflect: true, default: 1 },\n size: { type: String, reflect: true },\n color: { type: String, reflect: true },\n };\n\n /** Total number of pages */\n declare total: number;\n\n /** Current active page (1-indexed) */\n declare current: number;\n\n /** Number of pages shown around the current page */\n declare siblings: number;\n\n /** Number of pages shown at the start and end */\n declare boundaries: number;\n\n /** Button size: xs, sm, md, lg */\n declare size: PaginationSize;\n\n /** Color variant: primary, secondary, neutral */\n declare color: PaginationColor;\n\n private _controlsObserver?: MutationObserver;\n\n constructor() {\n super();\n this.attachStyles(styles);\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener('click', this._handleClick.bind(this));\n this.addEventListener('keydown', this._handleKeydown.bind(this));\n this._controlsObserver = new MutationObserver(() => this.update());\n this._controlsObserver.observe(this, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: ['slot'],\n });\n }\n\n disconnectedCallback(): void {\n this._controlsObserver?.disconnect();\n super.disconnectedCallback();\n }\n\n /**\n * Calculate the range of page numbers to display\n */\n private _getPageRange(): (number | 'ellipsis')[] {\n const total = Math.max(1, this.total);\n const current = Math.min(Math.max(1, this.current), total);\n const siblings = Math.max(0, this.siblings);\n const boundaries = Math.max(0, this.boundaries);\n\n // If total pages fit without ellipsis\n const totalPageNumbers = boundaries * 2 + siblings * 2 + 3; // boundaries + siblings + current + 2 ellipsis spots\n if (total <= totalPageNumbers) {\n return Array.from({ length: total }, (_, i) => i + 1);\n }\n\n const leftSiblingIndex = Math.max(current - siblings, boundaries + 1);\n const rightSiblingIndex = Math.min(current + siblings, total - boundaries);\n\n const showLeftEllipsis = leftSiblingIndex > boundaries + 2;\n const showRightEllipsis = rightSiblingIndex < total - boundaries - 1;\n\n const pages: (number | 'ellipsis')[] = [];\n\n // Add left boundary pages\n for (let i = 1; i <= boundaries; i++) {\n pages.push(i);\n }\n\n // Add left ellipsis or connecting page\n if (showLeftEllipsis) {\n pages.push('ellipsis');\n } else if (boundaries + 1 < leftSiblingIndex) {\n pages.push(boundaries + 1);\n }\n\n // Add sibling pages and current page\n for (let i = leftSiblingIndex; i <= rightSiblingIndex; i++) {\n if (i > boundaries && i <= total - boundaries) {\n pages.push(i);\n }\n }\n\n // Add right ellipsis or connecting page\n if (showRightEllipsis) {\n pages.push('ellipsis');\n } else if (rightSiblingIndex < total - boundaries) {\n pages.push(total - boundaries);\n }\n\n // Add right boundary pages\n for (let i = total - boundaries + 1; i <= total; i++) {\n if (i > 0 && !pages.includes(i)) {\n pages.push(i);\n }\n }\n\n return pages;\n }\n\n private _hasDeclarativeControls(): boolean {\n return (\n this.querySelector('[slot=\"prev\"], [slot=\"previous\"], [slot=\"page\"], [slot=\"next\"]') !== null\n );\n }\n\n /**\n * Navigate to a specific page\n */\n private _goToPage(page: number): void {\n const newPage = Math.min(Math.max(1, page), this.total);\n if (newPage !== this.current) {\n this.current = newPage;\n this.emit('change', { page: newPage });\n }\n }\n\n /**\n * Handle click events on pagination buttons\n */\n private _handleClick(event: Event): void {\n if (this._hasDeclarativeControls()) return;\n\n const target = event.target as HTMLElement;\n const button = target.closest('button');\n\n if (!button || button.disabled) return;\n\n const action = button.dataset.action;\n const page = button.dataset.page;\n\n if (action === 'first') {\n this._goToPage(1);\n } else if (action === 'prev') {\n this._goToPage(this.current - 1);\n } else if (action === 'next') {\n this._goToPage(this.current + 1);\n } else if (action === 'last') {\n this._goToPage(this.total);\n } else if (page) {\n this._goToPage(parseInt(page, 10));\n }\n }\n\n /**\n * Handle keyboard navigation\n */\n private _handleKeydown(event: KeyboardEvent): void {\n if (this._hasDeclarativeControls()) return;\n\n switch (event.key) {\n case 'ArrowLeft':\n event.preventDefault();\n this._goToPage(this.current - 1);\n break;\n case 'ArrowRight':\n event.preventDefault();\n this._goToPage(this.current + 1);\n break;\n case 'Home':\n event.preventDefault();\n this._goToPage(1);\n break;\n case 'End':\n event.preventDefault();\n this._goToPage(this.total);\n break;\n }\n }\n\n render(): string {\n if (this._hasDeclarativeControls()) {\n return `\n <nav class=\"pagination\" part=\"container\" role=\"navigation\" aria-label=\"Pagination\">\n <slot name=\"previous\"></slot>\n <slot name=\"prev\"></slot>\n <slot name=\"page\"></slot>\n <slot name=\"next\"></slot>\n </nav>\n `;\n }\n\n const total = Math.max(1, this.total);\n const current = Math.min(Math.max(1, this.current), total);\n const pages = this._getPageRange();\n\n const isFirstPage = current === 1;\n const isLastPage = current === total;\n\n let pagesHtml = '';\n\n for (const page of pages) {\n if (page === 'ellipsis') {\n pagesHtml += `\n <span class=\"ellipsis\" part=\"ellipsis\" aria-hidden=\"true\">...</span>\n `;\n } else {\n const isActive = page === current;\n pagesHtml += `\n <button\n class=\"pagination-btn${isActive ? ' active' : ''}\"\n part=\"page\"\n data-page=\"${page}\"\n aria-label=\"Page ${page}\"\n aria-current=\"${isActive ? 'page' : 'false'}\"\n >${page}</button>\n `;\n }\n }\n\n return `\n <nav class=\"pagination\" part=\"container\" role=\"navigation\" aria-label=\"Pagination\">\n <button\n class=\"pagination-btn nav-btn\"\n part=\"button\"\n data-action=\"first\"\n aria-label=\"Go to first page\"\n ${isFirstPage ? 'disabled' : ''}\n >${ICONS.first}</button>\n <button\n class=\"pagination-btn nav-btn\"\n part=\"button\"\n data-action=\"prev\"\n aria-label=\"Go to previous page\"\n ${isFirstPage ? 'disabled' : ''}\n >${ICONS.prev}</button>\n ${pagesHtml}\n <button\n class=\"pagination-btn nav-btn\"\n part=\"button\"\n data-action=\"next\"\n aria-label=\"Go to next page\"\n ${isLastPage ? 'disabled' : ''}\n >${ICONS.next}</button>\n <button\n class=\"pagination-btn nav-btn\"\n part=\"button\"\n data-action=\"last\"\n aria-label=\"Go to last page\"\n ${isLastPage ? 'disabled' : ''}\n >${ICONS.last}</button>\n </nav>\n `;\n }\n}\n",
|
|
6
6
|
"/**\n * @duskmoon-dev/el-pagination\n *\n * DuskMoon Pagination custom element\n */\n\nimport { ElDmPagination } from './el-dm-pagination.js';\n\nexport { ElDmPagination };\n\n/**\n * Register the el-dm-pagination custom element\n *\n * @example\n * ```ts\n * import { register } from '@duskmoon-dev/el-pagination';\n * register();\n * ```\n */\nexport function register(): void {\n if (!customElements.get('el-dm-pagination')) {\n customElements.define('el-dm-pagination', ElDmPagination);\n }\n}\n"
|
|
7
7
|
],
|
|
8
|
-
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A,YAML,aAAa,aAAa;AAAA,WAC3B,MAAM;AAAA;AAAA;AAAA;AAIjB;;;ACncO,SAAS,QAAQ,GAAS;AAAA,EAC/B,IAAI,CAAC,eAAe,IAAI,kBAAkB,GAAG;AAAA,IAC3C,eAAe,OAAO,oBAAoB,cAAc;AAAA,EAC1D;AAAA;",
|
|
9
|
+
"debugId": "668628C3CABA582D64756E2164756E21",
|
|
10
10
|
"names": []
|
|
11
11
|
}
|
package/dist/cjs/register.js
CHANGED
|
@@ -126,6 +126,36 @@ var styles = import_el_base.css`
|
|
|
126
126
|
user-select: none;
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
+
::slotted([slot='prev']),
|
|
130
|
+
::slotted([slot='previous']),
|
|
131
|
+
::slotted([slot='page']),
|
|
132
|
+
::slotted([slot='next']) {
|
|
133
|
+
display: inline-flex;
|
|
134
|
+
align-items: center;
|
|
135
|
+
justify-content: center;
|
|
136
|
+
min-width: 2rem;
|
|
137
|
+
height: 2rem;
|
|
138
|
+
padding: 0 0.5rem;
|
|
139
|
+
border: 1px solid var(--color-border, #d1d5db);
|
|
140
|
+
border-radius: var(--radius-md, 0.375rem);
|
|
141
|
+
color: var(--color-text, #374151);
|
|
142
|
+
font: inherit;
|
|
143
|
+
text-decoration: none;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
::slotted([slot='page'][aria-current='page']),
|
|
147
|
+
::slotted([slot='page'][data-active='true']) {
|
|
148
|
+
border-color: var(--color-primary, #3b82f6);
|
|
149
|
+
background: var(--color-primary, #3b82f6);
|
|
150
|
+
color: var(--color-primary-contrast, #ffffff);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
::slotted([disabled]),
|
|
154
|
+
::slotted([aria-disabled='true']) {
|
|
155
|
+
opacity: 0.5;
|
|
156
|
+
cursor: not-allowed;
|
|
157
|
+
}
|
|
158
|
+
|
|
129
159
|
/* Size variants */
|
|
130
160
|
:host([size='xs']) .pagination-btn {
|
|
131
161
|
min-width: 1.5rem;
|
|
@@ -204,6 +234,7 @@ class ElDmPagination extends import_el_base.BaseElement {
|
|
|
204
234
|
size: { type: String, reflect: true },
|
|
205
235
|
color: { type: String, reflect: true }
|
|
206
236
|
};
|
|
237
|
+
_controlsObserver;
|
|
207
238
|
constructor() {
|
|
208
239
|
super();
|
|
209
240
|
this.attachStyles(styles);
|
|
@@ -212,6 +243,17 @@ class ElDmPagination extends import_el_base.BaseElement {
|
|
|
212
243
|
super.connectedCallback();
|
|
213
244
|
this.addEventListener("click", this._handleClick.bind(this));
|
|
214
245
|
this.addEventListener("keydown", this._handleKeydown.bind(this));
|
|
246
|
+
this._controlsObserver = new MutationObserver(() => this.update());
|
|
247
|
+
this._controlsObserver.observe(this, {
|
|
248
|
+
childList: true,
|
|
249
|
+
subtree: true,
|
|
250
|
+
attributes: true,
|
|
251
|
+
attributeFilter: ["slot"]
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
disconnectedCallback() {
|
|
255
|
+
this._controlsObserver?.disconnect();
|
|
256
|
+
super.disconnectedCallback();
|
|
215
257
|
}
|
|
216
258
|
_getPageRange() {
|
|
217
259
|
const total = Math.max(1, this.total);
|
|
@@ -252,6 +294,9 @@ class ElDmPagination extends import_el_base.BaseElement {
|
|
|
252
294
|
}
|
|
253
295
|
return pages;
|
|
254
296
|
}
|
|
297
|
+
_hasDeclarativeControls() {
|
|
298
|
+
return this.querySelector('[slot="prev"], [slot="previous"], [slot="page"], [slot="next"]') !== null;
|
|
299
|
+
}
|
|
255
300
|
_goToPage(page) {
|
|
256
301
|
const newPage = Math.min(Math.max(1, page), this.total);
|
|
257
302
|
if (newPage !== this.current) {
|
|
@@ -260,6 +305,8 @@ class ElDmPagination extends import_el_base.BaseElement {
|
|
|
260
305
|
}
|
|
261
306
|
}
|
|
262
307
|
_handleClick(event) {
|
|
308
|
+
if (this._hasDeclarativeControls())
|
|
309
|
+
return;
|
|
263
310
|
const target = event.target;
|
|
264
311
|
const button = target.closest("button");
|
|
265
312
|
if (!button || button.disabled)
|
|
@@ -279,6 +326,8 @@ class ElDmPagination extends import_el_base.BaseElement {
|
|
|
279
326
|
}
|
|
280
327
|
}
|
|
281
328
|
_handleKeydown(event) {
|
|
329
|
+
if (this._hasDeclarativeControls())
|
|
330
|
+
return;
|
|
282
331
|
switch (event.key) {
|
|
283
332
|
case "ArrowLeft":
|
|
284
333
|
event.preventDefault();
|
|
@@ -299,6 +348,16 @@ class ElDmPagination extends import_el_base.BaseElement {
|
|
|
299
348
|
}
|
|
300
349
|
}
|
|
301
350
|
render() {
|
|
351
|
+
if (this._hasDeclarativeControls()) {
|
|
352
|
+
return `
|
|
353
|
+
<nav class="pagination" part="container" role="navigation" aria-label="Pagination">
|
|
354
|
+
<slot name="previous"></slot>
|
|
355
|
+
<slot name="prev"></slot>
|
|
356
|
+
<slot name="page"></slot>
|
|
357
|
+
<slot name="next"></slot>
|
|
358
|
+
</nav>
|
|
359
|
+
`;
|
|
360
|
+
}
|
|
302
361
|
const total = Math.max(1, this.total);
|
|
303
362
|
const current = Math.min(Math.max(1, this.current), total);
|
|
304
363
|
const pages = this._getPageRange();
|
|
@@ -369,5 +428,5 @@ function register() {
|
|
|
369
428
|
// src/register.ts
|
|
370
429
|
register();
|
|
371
430
|
|
|
372
|
-
//# debugId=
|
|
431
|
+
//# debugId=E17292B1D73A8C8F64756E2164756E21
|
|
373
432
|
//# sourceMappingURL=register.js.map
|
package/dist/cjs/register.js.map
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/el-dm-pagination.ts", "../../src/index.ts", "../../src/register.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"/**\n * DuskMoon Pagination Element\n *\n * A customizable pagination component for page navigation.\n * Supports first/last, previous/next buttons, and page number display with ellipsis.\n *\n * @element el-dm-pagination\n *\n * @attr {number} total - Total number of pages\n * @attr {number} current - Current active page (1-indexed)\n * @attr {number} siblings - Number of pages to show around current page\n * @attr {number} boundaries - Number of pages to show at start/end\n * @attr {string} size - Button size: xs, sm, md, lg\n * @attr {string} color - Color variant: primary, secondary, neutral\n *\n * @csspart container - The pagination container\n * @csspart button - Navigation buttons (first, prev, next, last)\n * @csspart page - Page number buttons\n * @csspart ellipsis - Ellipsis indicators\n *\n * @fires change - Fired when the current page changes, detail: { page: number }\n */\n\nimport { BaseElement, css } from '@duskmoon-dev/el-base';\n\nexport type PaginationSize = 'xs' | 'sm' | 'md' | 'lg';\nexport type PaginationColor = 'primary' | 'secondary' | 'neutral';\n\nconst styles = css`\n :host {\n display: inline-flex;\n vertical-align: middle;\n }\n\n :host([hidden]) {\n display: none !important;\n }\n\n .pagination {\n display: flex;\n align-items: center;\n gap: 0.25rem;\n font-family: inherit;\n }\n\n .pagination-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n border: 1px solid var(--color-border, #d1d5db);\n background: var(--color-surface, #ffffff);\n color: var(--color-text, #374151);\n cursor: pointer;\n font-family: inherit;\n font-weight: 500;\n transition:\n background-color 0.15s ease,\n border-color 0.15s ease,\n color 0.15s ease;\n border-radius: var(--radius-md, 0.375rem);\n min-width: 2rem;\n height: 2rem;\n padding: 0 0.5rem;\n font-size: 0.875rem;\n line-height: 1;\n }\n\n .pagination-btn:hover:not(:disabled) {\n background: var(--color-surface-hover, #f3f4f6);\n border-color: var(--color-border-hover, #9ca3af);\n }\n\n .pagination-btn:focus-visible {\n outline: 2px solid var(--color-primary, #3b82f6);\n outline-offset: 2px;\n }\n\n .pagination-btn:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n .pagination-btn.active {\n background: var(--color-primary, #3b82f6);\n border-color: var(--color-primary, #3b82f6);\n color: var(--color-primary-contrast, #ffffff);\n }\n\n .pagination-btn.nav-btn {\n padding: 0 0.375rem;\n }\n\n .pagination-btn.nav-btn svg {\n width: 1em;\n height: 1em;\n }\n\n .ellipsis {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 2rem;\n height: 2rem;\n color: var(--color-text-muted, #6b7280);\n font-size: 0.875rem;\n user-select: none;\n }\n\n /* Size variants */\n :host([size='xs']) .pagination-btn {\n min-width: 1.5rem;\n height: 1.5rem;\n padding: 0 0.25rem;\n font-size: 0.75rem;\n border-radius: var(--radius-sm, 0.25rem);\n }\n\n :host([size='xs']) .ellipsis {\n min-width: 1.5rem;\n height: 1.5rem;\n font-size: 0.75rem;\n }\n\n :host([size='sm']) .pagination-btn {\n min-width: 1.75rem;\n height: 1.75rem;\n padding: 0 0.375rem;\n font-size: 0.8125rem;\n }\n\n :host([size='sm']) .ellipsis {\n min-width: 1.75rem;\n height: 1.75rem;\n font-size: 0.8125rem;\n }\n\n :host([size='lg']) .pagination-btn {\n min-width: 2.5rem;\n height: 2.5rem;\n padding: 0 0.75rem;\n font-size: 1rem;\n }\n\n :host([size='lg']) .ellipsis {\n min-width: 2.5rem;\n height: 2.5rem;\n font-size: 1rem;\n }\n\n /* Color variants */\n :host([color='secondary']) .pagination-btn.active {\n background: var(--color-secondary, #8b5cf6);\n border-color: var(--color-secondary, #8b5cf6);\n color: var(--color-secondary-contrast, #ffffff);\n }\n\n :host([color='secondary']) .pagination-btn:focus-visible {\n outline-color: var(--color-secondary, #8b5cf6);\n }\n\n :host([color='neutral']) .pagination-btn.active {\n background: var(--color-neutral, #6b7280);\n border-color: var(--color-neutral, #6b7280);\n color: var(--color-neutral-contrast, #ffffff);\n }\n\n :host([color='neutral']) .pagination-btn:focus-visible {\n outline-color: var(--color-neutral, #6b7280);\n }\n`;\n\n// SVG icons for navigation buttons\nconst ICONS = {\n first: `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M15.79 14.77a.75.75 0 01-1.06.02l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 111.04 1.08L11.832 10l3.938 3.71a.75.75 0 01.02 1.06zm-6 0a.75.75 0 01-1.06.02l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 111.04 1.08L5.832 10l3.938 3.71a.75.75 0 01.02 1.06z\" clip-rule=\"evenodd\"/></svg>`,\n prev: `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M12.79 5.23a.75.75 0 01-.02 1.06L8.832 10l3.938 3.71a.75.75 0 11-1.04 1.08l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 011.06.02z\" clip-rule=\"evenodd\"/></svg>`,\n next: `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z\" clip-rule=\"evenodd\"/></svg>`,\n last: `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M4.21 5.23a.75.75 0 011.06-.02l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 11-1.04-1.08L8.168 10 4.23 6.29a.75.75 0 01-.02-1.06zm6 0a.75.75 0 011.06-.02l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 11-1.04-1.08L14.168 10l-3.938-3.71a.75.75 0 01-.02-1.06z\" clip-rule=\"evenodd\"/></svg>`,\n};\n\nexport class ElDmPagination extends BaseElement {\n static properties = {\n total: { type: Number, reflect: true, default: 1 },\n current: { type: Number, reflect: true, default: 1 },\n siblings: { type: Number, reflect: true, default: 1 },\n boundaries: { type: Number, reflect: true, default: 1 },\n size: { type: String, reflect: true },\n color: { type: String, reflect: true },\n };\n\n /** Total number of pages */\n declare total: number;\n\n /** Current active page (1-indexed) */\n declare current: number;\n\n /** Number of pages shown around the current page */\n declare siblings: number;\n\n /** Number of pages shown at the start and end */\n declare boundaries: number;\n\n /** Button size: xs, sm, md, lg */\n declare size: PaginationSize;\n\n /** Color variant: primary, secondary, neutral */\n declare color: PaginationColor;\n\n constructor() {\n super();\n this.attachStyles(styles);\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener('click', this._handleClick.bind(this));\n this.addEventListener('keydown', this._handleKeydown.bind(this));\n }\n\n /**\n * Calculate the range of page numbers to display\n */\n private _getPageRange(): (number | 'ellipsis')[] {\n const total = Math.max(1, this.total);\n const current = Math.min(Math.max(1, this.current), total);\n const siblings = Math.max(0, this.siblings);\n const boundaries = Math.max(0, this.boundaries);\n\n // If total pages fit without ellipsis\n const totalPageNumbers = boundaries * 2 + siblings * 2 + 3; // boundaries + siblings + current + 2 ellipsis spots\n if (total <= totalPageNumbers) {\n return Array.from({ length: total }, (_, i) => i + 1);\n }\n\n const leftSiblingIndex = Math.max(current - siblings, boundaries + 1);\n const rightSiblingIndex = Math.min(current + siblings, total - boundaries);\n\n const showLeftEllipsis = leftSiblingIndex > boundaries + 2;\n const showRightEllipsis = rightSiblingIndex < total - boundaries - 1;\n\n const pages: (number | 'ellipsis')[] = [];\n\n // Add left boundary pages\n for (let i = 1; i <= boundaries; i++) {\n pages.push(i);\n }\n\n // Add left ellipsis or connecting page\n if (showLeftEllipsis) {\n pages.push('ellipsis');\n } else if (boundaries + 1 < leftSiblingIndex) {\n pages.push(boundaries + 1);\n }\n\n // Add sibling pages and current page\n for (let i = leftSiblingIndex; i <= rightSiblingIndex; i++) {\n if (i > boundaries && i <= total - boundaries) {\n pages.push(i);\n }\n }\n\n // Add right ellipsis or connecting page\n if (showRightEllipsis) {\n pages.push('ellipsis');\n } else if (rightSiblingIndex < total - boundaries) {\n pages.push(total - boundaries);\n }\n\n // Add right boundary pages\n for (let i = total - boundaries + 1; i <= total; i++) {\n if (i > 0 && !pages.includes(i)) {\n pages.push(i);\n }\n }\n\n return pages;\n }\n\n /**\n * Navigate to a specific page\n */\n private _goToPage(page: number): void {\n const newPage = Math.min(Math.max(1, page), this.total);\n if (newPage !== this.current) {\n this.current = newPage;\n this.emit('change', { page: newPage });\n }\n }\n\n /**\n * Handle click events on pagination buttons\n */\n private _handleClick(event: Event): void {\n const target = event.target as HTMLElement;\n const button = target.closest('button');\n\n if (!button || button.disabled) return;\n\n const action = button.dataset.action;\n const page = button.dataset.page;\n\n if (action === 'first') {\n this._goToPage(1);\n } else if (action === 'prev') {\n this._goToPage(this.current - 1);\n } else if (action === 'next') {\n this._goToPage(this.current + 1);\n } else if (action === 'last') {\n this._goToPage(this.total);\n } else if (page) {\n this._goToPage(parseInt(page, 10));\n }\n }\n\n /**\n * Handle keyboard navigation\n */\n private _handleKeydown(event: KeyboardEvent): void {\n switch (event.key) {\n case 'ArrowLeft':\n event.preventDefault();\n this._goToPage(this.current - 1);\n break;\n case 'ArrowRight':\n event.preventDefault();\n this._goToPage(this.current + 1);\n break;\n case 'Home':\n event.preventDefault();\n this._goToPage(1);\n break;\n case 'End':\n event.preventDefault();\n this._goToPage(this.total);\n break;\n }\n }\n\n render(): string {\n const total = Math.max(1, this.total);\n const current = Math.min(Math.max(1, this.current), total);\n const pages = this._getPageRange();\n\n const isFirstPage = current === 1;\n const isLastPage = current === total;\n\n let pagesHtml = '';\n\n for (const page of pages) {\n if (page === 'ellipsis') {\n pagesHtml += `\n <span class=\"ellipsis\" part=\"ellipsis\" aria-hidden=\"true\">...</span>\n `;\n } else {\n const isActive = page === current;\n pagesHtml += `\n <button\n class=\"pagination-btn${isActive ? ' active' : ''}\"\n part=\"page\"\n data-page=\"${page}\"\n aria-label=\"Page ${page}\"\n aria-current=\"${isActive ? 'page' : 'false'}\"\n >${page}</button>\n `;\n }\n }\n\n return `\n <nav class=\"pagination\" part=\"container\" role=\"navigation\" aria-label=\"Pagination\">\n <button\n class=\"pagination-btn nav-btn\"\n part=\"button\"\n data-action=\"first\"\n aria-label=\"Go to first page\"\n ${isFirstPage ? 'disabled' : ''}\n >${ICONS.first}</button>\n <button\n class=\"pagination-btn nav-btn\"\n part=\"button\"\n data-action=\"prev\"\n aria-label=\"Go to previous page\"\n ${isFirstPage ? 'disabled' : ''}\n >${ICONS.prev}</button>\n ${pagesHtml}\n <button\n class=\"pagination-btn nav-btn\"\n part=\"button\"\n data-action=\"next\"\n aria-label=\"Go to next page\"\n ${isLastPage ? 'disabled' : ''}\n >${ICONS.next}</button>\n <button\n class=\"pagination-btn nav-btn\"\n part=\"button\"\n data-action=\"last\"\n aria-label=\"Go to last page\"\n ${isLastPage ? 'disabled' : ''}\n >${ICONS.last}</button>\n </nav>\n `;\n }\n}\n",
|
|
5
|
+
"/**\n * DuskMoon Pagination Element\n *\n * A customizable pagination component for page navigation.\n * Supports first/last, previous/next buttons, and page number display with ellipsis.\n *\n * @element el-dm-pagination\n *\n * @attr {number} total - Total number of pages\n * @attr {number} current - Current active page (1-indexed)\n * @attr {number} siblings - Number of pages to show around current page\n * @attr {number} boundaries - Number of pages to show at start/end\n * @attr {string} size - Button size: xs, sm, md, lg\n * @attr {string} color - Color variant: primary, secondary, neutral\n *\n * @slot prev - Declarative server-rendered previous-page control\n * @slot previous - Alias for the declarative previous-page control\n * @slot page - Declarative server-rendered page or ellipsis control\n * @slot next - Declarative server-rendered next-page control\n *\n * @csspart container - The pagination container\n * @csspart button - Navigation buttons (first, prev, next, last)\n * @csspart page - Page number buttons\n * @csspart ellipsis - Ellipsis indicators\n *\n * @fires change - Fired when the current page changes, detail: { page: number }\n */\n\nimport { BaseElement, css } from '@duskmoon-dev/el-base';\n\nexport type PaginationSize = 'xs' | 'sm' | 'md' | 'lg';\nexport type PaginationColor = 'primary' | 'secondary' | 'neutral';\n\nconst styles = css`\n :host {\n display: inline-flex;\n vertical-align: middle;\n }\n\n :host([hidden]) {\n display: none !important;\n }\n\n .pagination {\n display: flex;\n align-items: center;\n gap: 0.25rem;\n font-family: inherit;\n }\n\n .pagination-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n border: 1px solid var(--color-border, #d1d5db);\n background: var(--color-surface, #ffffff);\n color: var(--color-text, #374151);\n cursor: pointer;\n font-family: inherit;\n font-weight: 500;\n transition:\n background-color 0.15s ease,\n border-color 0.15s ease,\n color 0.15s ease;\n border-radius: var(--radius-md, 0.375rem);\n min-width: 2rem;\n height: 2rem;\n padding: 0 0.5rem;\n font-size: 0.875rem;\n line-height: 1;\n }\n\n .pagination-btn:hover:not(:disabled) {\n background: var(--color-surface-hover, #f3f4f6);\n border-color: var(--color-border-hover, #9ca3af);\n }\n\n .pagination-btn:focus-visible {\n outline: 2px solid var(--color-primary, #3b82f6);\n outline-offset: 2px;\n }\n\n .pagination-btn:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n .pagination-btn.active {\n background: var(--color-primary, #3b82f6);\n border-color: var(--color-primary, #3b82f6);\n color: var(--color-primary-contrast, #ffffff);\n }\n\n .pagination-btn.nav-btn {\n padding: 0 0.375rem;\n }\n\n .pagination-btn.nav-btn svg {\n width: 1em;\n height: 1em;\n }\n\n .ellipsis {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 2rem;\n height: 2rem;\n color: var(--color-text-muted, #6b7280);\n font-size: 0.875rem;\n user-select: none;\n }\n\n ::slotted([slot='prev']),\n ::slotted([slot='previous']),\n ::slotted([slot='page']),\n ::slotted([slot='next']) {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 2rem;\n height: 2rem;\n padding: 0 0.5rem;\n border: 1px solid var(--color-border, #d1d5db);\n border-radius: var(--radius-md, 0.375rem);\n color: var(--color-text, #374151);\n font: inherit;\n text-decoration: none;\n }\n\n ::slotted([slot='page'][aria-current='page']),\n ::slotted([slot='page'][data-active='true']) {\n border-color: var(--color-primary, #3b82f6);\n background: var(--color-primary, #3b82f6);\n color: var(--color-primary-contrast, #ffffff);\n }\n\n ::slotted([disabled]),\n ::slotted([aria-disabled='true']) {\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n /* Size variants */\n :host([size='xs']) .pagination-btn {\n min-width: 1.5rem;\n height: 1.5rem;\n padding: 0 0.25rem;\n font-size: 0.75rem;\n border-radius: var(--radius-sm, 0.25rem);\n }\n\n :host([size='xs']) .ellipsis {\n min-width: 1.5rem;\n height: 1.5rem;\n font-size: 0.75rem;\n }\n\n :host([size='sm']) .pagination-btn {\n min-width: 1.75rem;\n height: 1.75rem;\n padding: 0 0.375rem;\n font-size: 0.8125rem;\n }\n\n :host([size='sm']) .ellipsis {\n min-width: 1.75rem;\n height: 1.75rem;\n font-size: 0.8125rem;\n }\n\n :host([size='lg']) .pagination-btn {\n min-width: 2.5rem;\n height: 2.5rem;\n padding: 0 0.75rem;\n font-size: 1rem;\n }\n\n :host([size='lg']) .ellipsis {\n min-width: 2.5rem;\n height: 2.5rem;\n font-size: 1rem;\n }\n\n /* Color variants */\n :host([color='secondary']) .pagination-btn.active {\n background: var(--color-secondary, #8b5cf6);\n border-color: var(--color-secondary, #8b5cf6);\n color: var(--color-secondary-contrast, #ffffff);\n }\n\n :host([color='secondary']) .pagination-btn:focus-visible {\n outline-color: var(--color-secondary, #8b5cf6);\n }\n\n :host([color='neutral']) .pagination-btn.active {\n background: var(--color-neutral, #6b7280);\n border-color: var(--color-neutral, #6b7280);\n color: var(--color-neutral-contrast, #ffffff);\n }\n\n :host([color='neutral']) .pagination-btn:focus-visible {\n outline-color: var(--color-neutral, #6b7280);\n }\n`;\n\n// SVG icons for navigation buttons\nconst ICONS = {\n first: `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M15.79 14.77a.75.75 0 01-1.06.02l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 111.04 1.08L11.832 10l3.938 3.71a.75.75 0 01.02 1.06zm-6 0a.75.75 0 01-1.06.02l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 111.04 1.08L5.832 10l3.938 3.71a.75.75 0 01.02 1.06z\" clip-rule=\"evenodd\"/></svg>`,\n prev: `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M12.79 5.23a.75.75 0 01-.02 1.06L8.832 10l3.938 3.71a.75.75 0 11-1.04 1.08l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 011.06.02z\" clip-rule=\"evenodd\"/></svg>`,\n next: `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z\" clip-rule=\"evenodd\"/></svg>`,\n last: `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M4.21 5.23a.75.75 0 011.06-.02l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 11-1.04-1.08L8.168 10 4.23 6.29a.75.75 0 01-.02-1.06zm6 0a.75.75 0 011.06-.02l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 11-1.04-1.08L14.168 10l-3.938-3.71a.75.75 0 01-.02-1.06z\" clip-rule=\"evenodd\"/></svg>`,\n};\n\nexport class ElDmPagination extends BaseElement {\n static properties = {\n total: { type: Number, reflect: true, default: 1 },\n current: { type: Number, reflect: true, default: 1 },\n siblings: { type: Number, reflect: true, default: 1 },\n boundaries: { type: Number, reflect: true, default: 1 },\n size: { type: String, reflect: true },\n color: { type: String, reflect: true },\n };\n\n /** Total number of pages */\n declare total: number;\n\n /** Current active page (1-indexed) */\n declare current: number;\n\n /** Number of pages shown around the current page */\n declare siblings: number;\n\n /** Number of pages shown at the start and end */\n declare boundaries: number;\n\n /** Button size: xs, sm, md, lg */\n declare size: PaginationSize;\n\n /** Color variant: primary, secondary, neutral */\n declare color: PaginationColor;\n\n private _controlsObserver?: MutationObserver;\n\n constructor() {\n super();\n this.attachStyles(styles);\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener('click', this._handleClick.bind(this));\n this.addEventListener('keydown', this._handleKeydown.bind(this));\n this._controlsObserver = new MutationObserver(() => this.update());\n this._controlsObserver.observe(this, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: ['slot'],\n });\n }\n\n disconnectedCallback(): void {\n this._controlsObserver?.disconnect();\n super.disconnectedCallback();\n }\n\n /**\n * Calculate the range of page numbers to display\n */\n private _getPageRange(): (number | 'ellipsis')[] {\n const total = Math.max(1, this.total);\n const current = Math.min(Math.max(1, this.current), total);\n const siblings = Math.max(0, this.siblings);\n const boundaries = Math.max(0, this.boundaries);\n\n // If total pages fit without ellipsis\n const totalPageNumbers = boundaries * 2 + siblings * 2 + 3; // boundaries + siblings + current + 2 ellipsis spots\n if (total <= totalPageNumbers) {\n return Array.from({ length: total }, (_, i) => i + 1);\n }\n\n const leftSiblingIndex = Math.max(current - siblings, boundaries + 1);\n const rightSiblingIndex = Math.min(current + siblings, total - boundaries);\n\n const showLeftEllipsis = leftSiblingIndex > boundaries + 2;\n const showRightEllipsis = rightSiblingIndex < total - boundaries - 1;\n\n const pages: (number | 'ellipsis')[] = [];\n\n // Add left boundary pages\n for (let i = 1; i <= boundaries; i++) {\n pages.push(i);\n }\n\n // Add left ellipsis or connecting page\n if (showLeftEllipsis) {\n pages.push('ellipsis');\n } else if (boundaries + 1 < leftSiblingIndex) {\n pages.push(boundaries + 1);\n }\n\n // Add sibling pages and current page\n for (let i = leftSiblingIndex; i <= rightSiblingIndex; i++) {\n if (i > boundaries && i <= total - boundaries) {\n pages.push(i);\n }\n }\n\n // Add right ellipsis or connecting page\n if (showRightEllipsis) {\n pages.push('ellipsis');\n } else if (rightSiblingIndex < total - boundaries) {\n pages.push(total - boundaries);\n }\n\n // Add right boundary pages\n for (let i = total - boundaries + 1; i <= total; i++) {\n if (i > 0 && !pages.includes(i)) {\n pages.push(i);\n }\n }\n\n return pages;\n }\n\n private _hasDeclarativeControls(): boolean {\n return (\n this.querySelector('[slot=\"prev\"], [slot=\"previous\"], [slot=\"page\"], [slot=\"next\"]') !== null\n );\n }\n\n /**\n * Navigate to a specific page\n */\n private _goToPage(page: number): void {\n const newPage = Math.min(Math.max(1, page), this.total);\n if (newPage !== this.current) {\n this.current = newPage;\n this.emit('change', { page: newPage });\n }\n }\n\n /**\n * Handle click events on pagination buttons\n */\n private _handleClick(event: Event): void {\n if (this._hasDeclarativeControls()) return;\n\n const target = event.target as HTMLElement;\n const button = target.closest('button');\n\n if (!button || button.disabled) return;\n\n const action = button.dataset.action;\n const page = button.dataset.page;\n\n if (action === 'first') {\n this._goToPage(1);\n } else if (action === 'prev') {\n this._goToPage(this.current - 1);\n } else if (action === 'next') {\n this._goToPage(this.current + 1);\n } else if (action === 'last') {\n this._goToPage(this.total);\n } else if (page) {\n this._goToPage(parseInt(page, 10));\n }\n }\n\n /**\n * Handle keyboard navigation\n */\n private _handleKeydown(event: KeyboardEvent): void {\n if (this._hasDeclarativeControls()) return;\n\n switch (event.key) {\n case 'ArrowLeft':\n event.preventDefault();\n this._goToPage(this.current - 1);\n break;\n case 'ArrowRight':\n event.preventDefault();\n this._goToPage(this.current + 1);\n break;\n case 'Home':\n event.preventDefault();\n this._goToPage(1);\n break;\n case 'End':\n event.preventDefault();\n this._goToPage(this.total);\n break;\n }\n }\n\n render(): string {\n if (this._hasDeclarativeControls()) {\n return `\n <nav class=\"pagination\" part=\"container\" role=\"navigation\" aria-label=\"Pagination\">\n <slot name=\"previous\"></slot>\n <slot name=\"prev\"></slot>\n <slot name=\"page\"></slot>\n <slot name=\"next\"></slot>\n </nav>\n `;\n }\n\n const total = Math.max(1, this.total);\n const current = Math.min(Math.max(1, this.current), total);\n const pages = this._getPageRange();\n\n const isFirstPage = current === 1;\n const isLastPage = current === total;\n\n let pagesHtml = '';\n\n for (const page of pages) {\n if (page === 'ellipsis') {\n pagesHtml += `\n <span class=\"ellipsis\" part=\"ellipsis\" aria-hidden=\"true\">...</span>\n `;\n } else {\n const isActive = page === current;\n pagesHtml += `\n <button\n class=\"pagination-btn${isActive ? ' active' : ''}\"\n part=\"page\"\n data-page=\"${page}\"\n aria-label=\"Page ${page}\"\n aria-current=\"${isActive ? 'page' : 'false'}\"\n >${page}</button>\n `;\n }\n }\n\n return `\n <nav class=\"pagination\" part=\"container\" role=\"navigation\" aria-label=\"Pagination\">\n <button\n class=\"pagination-btn nav-btn\"\n part=\"button\"\n data-action=\"first\"\n aria-label=\"Go to first page\"\n ${isFirstPage ? 'disabled' : ''}\n >${ICONS.first}</button>\n <button\n class=\"pagination-btn nav-btn\"\n part=\"button\"\n data-action=\"prev\"\n aria-label=\"Go to previous page\"\n ${isFirstPage ? 'disabled' : ''}\n >${ICONS.prev}</button>\n ${pagesHtml}\n <button\n class=\"pagination-btn nav-btn\"\n part=\"button\"\n data-action=\"next\"\n aria-label=\"Go to next page\"\n ${isLastPage ? 'disabled' : ''}\n >${ICONS.next}</button>\n <button\n class=\"pagination-btn nav-btn\"\n part=\"button\"\n data-action=\"last\"\n aria-label=\"Go to last page\"\n ${isLastPage ? 'disabled' : ''}\n >${ICONS.last}</button>\n </nav>\n `;\n }\n}\n",
|
|
6
6
|
"/**\n * @duskmoon-dev/el-pagination\n *\n * DuskMoon Pagination custom element\n */\n\nimport { ElDmPagination } from './el-dm-pagination.js';\n\nexport { ElDmPagination };\n\n/**\n * Register the el-dm-pagination custom element\n *\n * @example\n * ```ts\n * import { register } from '@duskmoon-dev/el-pagination';\n * register();\n * ```\n */\nexport function register(): void {\n if (!customElements.get('el-dm-pagination')) {\n customElements.define('el-dm-pagination', ElDmPagination);\n }\n}\n",
|
|
7
7
|
"/**\n * Auto-register el-dm-pagination custom element\n *\n * @example\n * ```ts\n * import '@duskmoon-dev/el-pagination/register';\n *\n * // Now you can use <el-dm-pagination> in HTML\n * ```\n */\nimport { register } from './index.js';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MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAML,aAAa,aAAa;AAAA,WAC3B,MAAM;AAAA;AAAA;AAAA;AAIjB;;;ACncO,SAAS,QAAQ,GAAS;AAAA,EAC/B,IAAI,CAAC,eAAe,IAAI,kBAAkB,GAAG;AAAA,IAC3C,eAAe,OAAO,oBAAoB,cAAc;AAAA,EAC1D;AAAA;;;ACVF,SAAS;",
|
|
10
|
+
"debugId": "E17292B1D73A8C8F64756E2164756E21",
|
|
11
11
|
"names": []
|
|
12
12
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -80,6 +80,36 @@ var styles = css`
|
|
|
80
80
|
user-select: none;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
::slotted([slot='prev']),
|
|
84
|
+
::slotted([slot='previous']),
|
|
85
|
+
::slotted([slot='page']),
|
|
86
|
+
::slotted([slot='next']) {
|
|
87
|
+
display: inline-flex;
|
|
88
|
+
align-items: center;
|
|
89
|
+
justify-content: center;
|
|
90
|
+
min-width: 2rem;
|
|
91
|
+
height: 2rem;
|
|
92
|
+
padding: 0 0.5rem;
|
|
93
|
+
border: 1px solid var(--color-border, #d1d5db);
|
|
94
|
+
border-radius: var(--radius-md, 0.375rem);
|
|
95
|
+
color: var(--color-text, #374151);
|
|
96
|
+
font: inherit;
|
|
97
|
+
text-decoration: none;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
::slotted([slot='page'][aria-current='page']),
|
|
101
|
+
::slotted([slot='page'][data-active='true']) {
|
|
102
|
+
border-color: var(--color-primary, #3b82f6);
|
|
103
|
+
background: var(--color-primary, #3b82f6);
|
|
104
|
+
color: var(--color-primary-contrast, #ffffff);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
::slotted([disabled]),
|
|
108
|
+
::slotted([aria-disabled='true']) {
|
|
109
|
+
opacity: 0.5;
|
|
110
|
+
cursor: not-allowed;
|
|
111
|
+
}
|
|
112
|
+
|
|
83
113
|
/* Size variants */
|
|
84
114
|
:host([size='xs']) .pagination-btn {
|
|
85
115
|
min-width: 1.5rem;
|
|
@@ -158,6 +188,7 @@ class ElDmPagination extends BaseElement {
|
|
|
158
188
|
size: { type: String, reflect: true },
|
|
159
189
|
color: { type: String, reflect: true }
|
|
160
190
|
};
|
|
191
|
+
_controlsObserver;
|
|
161
192
|
constructor() {
|
|
162
193
|
super();
|
|
163
194
|
this.attachStyles(styles);
|
|
@@ -166,6 +197,17 @@ class ElDmPagination extends BaseElement {
|
|
|
166
197
|
super.connectedCallback();
|
|
167
198
|
this.addEventListener("click", this._handleClick.bind(this));
|
|
168
199
|
this.addEventListener("keydown", this._handleKeydown.bind(this));
|
|
200
|
+
this._controlsObserver = new MutationObserver(() => this.update());
|
|
201
|
+
this._controlsObserver.observe(this, {
|
|
202
|
+
childList: true,
|
|
203
|
+
subtree: true,
|
|
204
|
+
attributes: true,
|
|
205
|
+
attributeFilter: ["slot"]
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
disconnectedCallback() {
|
|
209
|
+
this._controlsObserver?.disconnect();
|
|
210
|
+
super.disconnectedCallback();
|
|
169
211
|
}
|
|
170
212
|
_getPageRange() {
|
|
171
213
|
const total = Math.max(1, this.total);
|
|
@@ -206,6 +248,9 @@ class ElDmPagination extends BaseElement {
|
|
|
206
248
|
}
|
|
207
249
|
return pages;
|
|
208
250
|
}
|
|
251
|
+
_hasDeclarativeControls() {
|
|
252
|
+
return this.querySelector('[slot="prev"], [slot="previous"], [slot="page"], [slot="next"]') !== null;
|
|
253
|
+
}
|
|
209
254
|
_goToPage(page) {
|
|
210
255
|
const newPage = Math.min(Math.max(1, page), this.total);
|
|
211
256
|
if (newPage !== this.current) {
|
|
@@ -214,6 +259,8 @@ class ElDmPagination extends BaseElement {
|
|
|
214
259
|
}
|
|
215
260
|
}
|
|
216
261
|
_handleClick(event) {
|
|
262
|
+
if (this._hasDeclarativeControls())
|
|
263
|
+
return;
|
|
217
264
|
const target = event.target;
|
|
218
265
|
const button = target.closest("button");
|
|
219
266
|
if (!button || button.disabled)
|
|
@@ -233,6 +280,8 @@ class ElDmPagination extends BaseElement {
|
|
|
233
280
|
}
|
|
234
281
|
}
|
|
235
282
|
_handleKeydown(event) {
|
|
283
|
+
if (this._hasDeclarativeControls())
|
|
284
|
+
return;
|
|
236
285
|
switch (event.key) {
|
|
237
286
|
case "ArrowLeft":
|
|
238
287
|
event.preventDefault();
|
|
@@ -253,6 +302,16 @@ class ElDmPagination extends BaseElement {
|
|
|
253
302
|
}
|
|
254
303
|
}
|
|
255
304
|
render() {
|
|
305
|
+
if (this._hasDeclarativeControls()) {
|
|
306
|
+
return `
|
|
307
|
+
<nav class="pagination" part="container" role="navigation" aria-label="Pagination">
|
|
308
|
+
<slot name="previous"></slot>
|
|
309
|
+
<slot name="prev"></slot>
|
|
310
|
+
<slot name="page"></slot>
|
|
311
|
+
<slot name="next"></slot>
|
|
312
|
+
</nav>
|
|
313
|
+
`;
|
|
314
|
+
}
|
|
256
315
|
const total = Math.max(1, this.total);
|
|
257
316
|
const current = Math.min(Math.max(1, this.current), total);
|
|
258
317
|
const pages = this._getPageRange();
|
|
@@ -324,5 +383,5 @@ export {
|
|
|
324
383
|
ElDmPagination
|
|
325
384
|
};
|
|
326
385
|
|
|
327
|
-
//# debugId=
|
|
386
|
+
//# debugId=4D190251751150F064756E2164756E21
|
|
328
387
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/el-dm-pagination.ts", "../../src/index.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"/**\n * DuskMoon Pagination Element\n *\n * A customizable pagination component for page navigation.\n * Supports first/last, previous/next buttons, and page number display with ellipsis.\n *\n * @element el-dm-pagination\n *\n * @attr {number} total - Total number of pages\n * @attr {number} current - Current active page (1-indexed)\n * @attr {number} siblings - Number of pages to show around current page\n * @attr {number} boundaries - Number of pages to show at start/end\n * @attr {string} size - Button size: xs, sm, md, lg\n * @attr {string} color - Color variant: primary, secondary, neutral\n *\n * @csspart container - The pagination container\n * @csspart button - Navigation buttons (first, prev, next, last)\n * @csspart page - Page number buttons\n * @csspart ellipsis - Ellipsis indicators\n *\n * @fires change - Fired when the current page changes, detail: { page: number }\n */\n\nimport { BaseElement, css } from '@duskmoon-dev/el-base';\n\nexport type PaginationSize = 'xs' | 'sm' | 'md' | 'lg';\nexport type PaginationColor = 'primary' | 'secondary' | 'neutral';\n\nconst styles = css`\n :host {\n display: inline-flex;\n vertical-align: middle;\n }\n\n :host([hidden]) {\n display: none !important;\n }\n\n .pagination {\n display: flex;\n align-items: center;\n gap: 0.25rem;\n font-family: inherit;\n }\n\n .pagination-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n border: 1px solid var(--color-border, #d1d5db);\n background: var(--color-surface, #ffffff);\n color: var(--color-text, #374151);\n cursor: pointer;\n font-family: inherit;\n font-weight: 500;\n transition:\n background-color 0.15s ease,\n border-color 0.15s ease,\n color 0.15s ease;\n border-radius: var(--radius-md, 0.375rem);\n min-width: 2rem;\n height: 2rem;\n padding: 0 0.5rem;\n font-size: 0.875rem;\n line-height: 1;\n }\n\n .pagination-btn:hover:not(:disabled) {\n background: var(--color-surface-hover, #f3f4f6);\n border-color: var(--color-border-hover, #9ca3af);\n }\n\n .pagination-btn:focus-visible {\n outline: 2px solid var(--color-primary, #3b82f6);\n outline-offset: 2px;\n }\n\n .pagination-btn:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n .pagination-btn.active {\n background: var(--color-primary, #3b82f6);\n border-color: var(--color-primary, #3b82f6);\n color: var(--color-primary-contrast, #ffffff);\n }\n\n .pagination-btn.nav-btn {\n padding: 0 0.375rem;\n }\n\n .pagination-btn.nav-btn svg {\n width: 1em;\n height: 1em;\n }\n\n .ellipsis {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 2rem;\n height: 2rem;\n color: var(--color-text-muted, #6b7280);\n font-size: 0.875rem;\n user-select: none;\n }\n\n /* Size variants */\n :host([size='xs']) .pagination-btn {\n min-width: 1.5rem;\n height: 1.5rem;\n padding: 0 0.25rem;\n font-size: 0.75rem;\n border-radius: var(--radius-sm, 0.25rem);\n }\n\n :host([size='xs']) .ellipsis {\n min-width: 1.5rem;\n height: 1.5rem;\n font-size: 0.75rem;\n }\n\n :host([size='sm']) .pagination-btn {\n min-width: 1.75rem;\n height: 1.75rem;\n padding: 0 0.375rem;\n font-size: 0.8125rem;\n }\n\n :host([size='sm']) .ellipsis {\n min-width: 1.75rem;\n height: 1.75rem;\n font-size: 0.8125rem;\n }\n\n :host([size='lg']) .pagination-btn {\n min-width: 2.5rem;\n height: 2.5rem;\n padding: 0 0.75rem;\n font-size: 1rem;\n }\n\n :host([size='lg']) .ellipsis {\n min-width: 2.5rem;\n height: 2.5rem;\n font-size: 1rem;\n }\n\n /* Color variants */\n :host([color='secondary']) .pagination-btn.active {\n background: var(--color-secondary, #8b5cf6);\n border-color: var(--color-secondary, #8b5cf6);\n color: var(--color-secondary-contrast, #ffffff);\n }\n\n :host([color='secondary']) .pagination-btn:focus-visible {\n outline-color: var(--color-secondary, #8b5cf6);\n }\n\n :host([color='neutral']) .pagination-btn.active {\n background: var(--color-neutral, #6b7280);\n border-color: var(--color-neutral, #6b7280);\n color: var(--color-neutral-contrast, #ffffff);\n }\n\n :host([color='neutral']) .pagination-btn:focus-visible {\n outline-color: var(--color-neutral, #6b7280);\n }\n`;\n\n// SVG icons for navigation buttons\nconst ICONS = {\n first: `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M15.79 14.77a.75.75 0 01-1.06.02l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 111.04 1.08L11.832 10l3.938 3.71a.75.75 0 01.02 1.06zm-6 0a.75.75 0 01-1.06.02l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 111.04 1.08L5.832 10l3.938 3.71a.75.75 0 01.02 1.06z\" clip-rule=\"evenodd\"/></svg>`,\n prev: `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M12.79 5.23a.75.75 0 01-.02 1.06L8.832 10l3.938 3.71a.75.75 0 11-1.04 1.08l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 011.06.02z\" clip-rule=\"evenodd\"/></svg>`,\n next: `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z\" clip-rule=\"evenodd\"/></svg>`,\n last: `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M4.21 5.23a.75.75 0 011.06-.02l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 11-1.04-1.08L8.168 10 4.23 6.29a.75.75 0 01-.02-1.06zm6 0a.75.75 0 011.06-.02l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 11-1.04-1.08L14.168 10l-3.938-3.71a.75.75 0 01-.02-1.06z\" clip-rule=\"evenodd\"/></svg>`,\n};\n\nexport class ElDmPagination extends BaseElement {\n static properties = {\n total: { type: Number, reflect: true, default: 1 },\n current: { type: Number, reflect: true, default: 1 },\n siblings: { type: Number, reflect: true, default: 1 },\n boundaries: { type: Number, reflect: true, default: 1 },\n size: { type: String, reflect: true },\n color: { type: String, reflect: true },\n };\n\n /** Total number of pages */\n declare total: number;\n\n /** Current active page (1-indexed) */\n declare current: number;\n\n /** Number of pages shown around the current page */\n declare siblings: number;\n\n /** Number of pages shown at the start and end */\n declare boundaries: number;\n\n /** Button size: xs, sm, md, lg */\n declare size: PaginationSize;\n\n /** Color variant: primary, secondary, neutral */\n declare color: PaginationColor;\n\n constructor() {\n super();\n this.attachStyles(styles);\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener('click', this._handleClick.bind(this));\n this.addEventListener('keydown', this._handleKeydown.bind(this));\n }\n\n /**\n * Calculate the range of page numbers to display\n */\n private _getPageRange(): (number | 'ellipsis')[] {\n const total = Math.max(1, this.total);\n const current = Math.min(Math.max(1, this.current), total);\n const siblings = Math.max(0, this.siblings);\n const boundaries = Math.max(0, this.boundaries);\n\n // If total pages fit without ellipsis\n const totalPageNumbers = boundaries * 2 + siblings * 2 + 3; // boundaries + siblings + current + 2 ellipsis spots\n if (total <= totalPageNumbers) {\n return Array.from({ length: total }, (_, i) => i + 1);\n }\n\n const leftSiblingIndex = Math.max(current - siblings, boundaries + 1);\n const rightSiblingIndex = Math.min(current + siblings, total - boundaries);\n\n const showLeftEllipsis = leftSiblingIndex > boundaries + 2;\n const showRightEllipsis = rightSiblingIndex < total - boundaries - 1;\n\n const pages: (number | 'ellipsis')[] = [];\n\n // Add left boundary pages\n for (let i = 1; i <= boundaries; i++) {\n pages.push(i);\n }\n\n // Add left ellipsis or connecting page\n if (showLeftEllipsis) {\n pages.push('ellipsis');\n } else if (boundaries + 1 < leftSiblingIndex) {\n pages.push(boundaries + 1);\n }\n\n // Add sibling pages and current page\n for (let i = leftSiblingIndex; i <= rightSiblingIndex; i++) {\n if (i > boundaries && i <= total - boundaries) {\n pages.push(i);\n }\n }\n\n // Add right ellipsis or connecting page\n if (showRightEllipsis) {\n pages.push('ellipsis');\n } else if (rightSiblingIndex < total - boundaries) {\n pages.push(total - boundaries);\n }\n\n // Add right boundary pages\n for (let i = total - boundaries + 1; i <= total; i++) {\n if (i > 0 && !pages.includes(i)) {\n pages.push(i);\n }\n }\n\n return pages;\n }\n\n /**\n * Navigate to a specific page\n */\n private _goToPage(page: number): void {\n const newPage = Math.min(Math.max(1, page), this.total);\n if (newPage !== this.current) {\n this.current = newPage;\n this.emit('change', { page: newPage });\n }\n }\n\n /**\n * Handle click events on pagination buttons\n */\n private _handleClick(event: Event): void {\n const target = event.target as HTMLElement;\n const button = target.closest('button');\n\n if (!button || button.disabled) return;\n\n const action = button.dataset.action;\n const page = button.dataset.page;\n\n if (action === 'first') {\n this._goToPage(1);\n } else if (action === 'prev') {\n this._goToPage(this.current - 1);\n } else if (action === 'next') {\n this._goToPage(this.current + 1);\n } else if (action === 'last') {\n this._goToPage(this.total);\n } else if (page) {\n this._goToPage(parseInt(page, 10));\n }\n }\n\n /**\n * Handle keyboard navigation\n */\n private _handleKeydown(event: KeyboardEvent): void {\n switch (event.key) {\n case 'ArrowLeft':\n event.preventDefault();\n this._goToPage(this.current - 1);\n break;\n case 'ArrowRight':\n event.preventDefault();\n this._goToPage(this.current + 1);\n break;\n case 'Home':\n event.preventDefault();\n this._goToPage(1);\n break;\n case 'End':\n event.preventDefault();\n this._goToPage(this.total);\n break;\n }\n }\n\n render(): string {\n const total = Math.max(1, this.total);\n const current = Math.min(Math.max(1, this.current), total);\n const pages = this._getPageRange();\n\n const isFirstPage = current === 1;\n const isLastPage = current === total;\n\n let pagesHtml = '';\n\n for (const page of pages) {\n if (page === 'ellipsis') {\n pagesHtml += `\n <span class=\"ellipsis\" part=\"ellipsis\" aria-hidden=\"true\">...</span>\n `;\n } else {\n const isActive = page === current;\n pagesHtml += `\n <button\n class=\"pagination-btn${isActive ? ' active' : ''}\"\n part=\"page\"\n data-page=\"${page}\"\n aria-label=\"Page ${page}\"\n aria-current=\"${isActive ? 'page' : 'false'}\"\n >${page}</button>\n `;\n }\n }\n\n return `\n <nav class=\"pagination\" part=\"container\" role=\"navigation\" aria-label=\"Pagination\">\n <button\n class=\"pagination-btn nav-btn\"\n part=\"button\"\n data-action=\"first\"\n aria-label=\"Go to first page\"\n ${isFirstPage ? 'disabled' : ''}\n >${ICONS.first}</button>\n <button\n class=\"pagination-btn nav-btn\"\n part=\"button\"\n data-action=\"prev\"\n aria-label=\"Go to previous page\"\n ${isFirstPage ? 'disabled' : ''}\n >${ICONS.prev}</button>\n ${pagesHtml}\n <button\n class=\"pagination-btn nav-btn\"\n part=\"button\"\n data-action=\"next\"\n aria-label=\"Go to next page\"\n ${isLastPage ? 'disabled' : ''}\n >${ICONS.next}</button>\n <button\n class=\"pagination-btn nav-btn\"\n part=\"button\"\n data-action=\"last\"\n aria-label=\"Go to last page\"\n ${isLastPage ? 'disabled' : ''}\n >${ICONS.last}</button>\n </nav>\n `;\n }\n}\n",
|
|
5
|
+
"/**\n * DuskMoon Pagination Element\n *\n * A customizable pagination component for page navigation.\n * Supports first/last, previous/next buttons, and page number display with ellipsis.\n *\n * @element el-dm-pagination\n *\n * @attr {number} total - Total number of pages\n * @attr {number} current - Current active page (1-indexed)\n * @attr {number} siblings - Number of pages to show around current page\n * @attr {number} boundaries - Number of pages to show at start/end\n * @attr {string} size - Button size: xs, sm, md, lg\n * @attr {string} color - Color variant: primary, secondary, neutral\n *\n * @slot prev - Declarative server-rendered previous-page control\n * @slot previous - Alias for the declarative previous-page control\n * @slot page - Declarative server-rendered page or ellipsis control\n * @slot next - Declarative server-rendered next-page control\n *\n * @csspart container - The pagination container\n * @csspart button - Navigation buttons (first, prev, next, last)\n * @csspart page - Page number buttons\n * @csspart ellipsis - Ellipsis indicators\n *\n * @fires change - Fired when the current page changes, detail: { page: number }\n */\n\nimport { BaseElement, css } from '@duskmoon-dev/el-base';\n\nexport type PaginationSize = 'xs' | 'sm' | 'md' | 'lg';\nexport type PaginationColor = 'primary' | 'secondary' | 'neutral';\n\nconst styles = css`\n :host {\n display: inline-flex;\n vertical-align: middle;\n }\n\n :host([hidden]) {\n display: none !important;\n }\n\n .pagination {\n display: flex;\n align-items: center;\n gap: 0.25rem;\n font-family: inherit;\n }\n\n .pagination-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n border: 1px solid var(--color-border, #d1d5db);\n background: var(--color-surface, #ffffff);\n color: var(--color-text, #374151);\n cursor: pointer;\n font-family: inherit;\n font-weight: 500;\n transition:\n background-color 0.15s ease,\n border-color 0.15s ease,\n color 0.15s ease;\n border-radius: var(--radius-md, 0.375rem);\n min-width: 2rem;\n height: 2rem;\n padding: 0 0.5rem;\n font-size: 0.875rem;\n line-height: 1;\n }\n\n .pagination-btn:hover:not(:disabled) {\n background: var(--color-surface-hover, #f3f4f6);\n border-color: var(--color-border-hover, #9ca3af);\n }\n\n .pagination-btn:focus-visible {\n outline: 2px solid var(--color-primary, #3b82f6);\n outline-offset: 2px;\n }\n\n .pagination-btn:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n .pagination-btn.active {\n background: var(--color-primary, #3b82f6);\n border-color: var(--color-primary, #3b82f6);\n color: var(--color-primary-contrast, #ffffff);\n }\n\n .pagination-btn.nav-btn {\n padding: 0 0.375rem;\n }\n\n .pagination-btn.nav-btn svg {\n width: 1em;\n height: 1em;\n }\n\n .ellipsis {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 2rem;\n height: 2rem;\n color: var(--color-text-muted, #6b7280);\n font-size: 0.875rem;\n user-select: none;\n }\n\n ::slotted([slot='prev']),\n ::slotted([slot='previous']),\n ::slotted([slot='page']),\n ::slotted([slot='next']) {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 2rem;\n height: 2rem;\n padding: 0 0.5rem;\n border: 1px solid var(--color-border, #d1d5db);\n border-radius: var(--radius-md, 0.375rem);\n color: var(--color-text, #374151);\n font: inherit;\n text-decoration: none;\n }\n\n ::slotted([slot='page'][aria-current='page']),\n ::slotted([slot='page'][data-active='true']) {\n border-color: var(--color-primary, #3b82f6);\n background: var(--color-primary, #3b82f6);\n color: var(--color-primary-contrast, #ffffff);\n }\n\n ::slotted([disabled]),\n ::slotted([aria-disabled='true']) {\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n /* Size variants */\n :host([size='xs']) .pagination-btn {\n min-width: 1.5rem;\n height: 1.5rem;\n padding: 0 0.25rem;\n font-size: 0.75rem;\n border-radius: var(--radius-sm, 0.25rem);\n }\n\n :host([size='xs']) .ellipsis {\n min-width: 1.5rem;\n height: 1.5rem;\n font-size: 0.75rem;\n }\n\n :host([size='sm']) .pagination-btn {\n min-width: 1.75rem;\n height: 1.75rem;\n padding: 0 0.375rem;\n font-size: 0.8125rem;\n }\n\n :host([size='sm']) .ellipsis {\n min-width: 1.75rem;\n height: 1.75rem;\n font-size: 0.8125rem;\n }\n\n :host([size='lg']) .pagination-btn {\n min-width: 2.5rem;\n height: 2.5rem;\n padding: 0 0.75rem;\n font-size: 1rem;\n }\n\n :host([size='lg']) .ellipsis {\n min-width: 2.5rem;\n height: 2.5rem;\n font-size: 1rem;\n }\n\n /* Color variants */\n :host([color='secondary']) .pagination-btn.active {\n background: var(--color-secondary, #8b5cf6);\n border-color: var(--color-secondary, #8b5cf6);\n color: var(--color-secondary-contrast, #ffffff);\n }\n\n :host([color='secondary']) .pagination-btn:focus-visible {\n outline-color: var(--color-secondary, #8b5cf6);\n }\n\n :host([color='neutral']) .pagination-btn.active {\n background: var(--color-neutral, #6b7280);\n border-color: var(--color-neutral, #6b7280);\n color: var(--color-neutral-contrast, #ffffff);\n }\n\n :host([color='neutral']) .pagination-btn:focus-visible {\n outline-color: var(--color-neutral, #6b7280);\n }\n`;\n\n// SVG icons for navigation buttons\nconst ICONS = {\n first: `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M15.79 14.77a.75.75 0 01-1.06.02l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 111.04 1.08L11.832 10l3.938 3.71a.75.75 0 01.02 1.06zm-6 0a.75.75 0 01-1.06.02l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 111.04 1.08L5.832 10l3.938 3.71a.75.75 0 01.02 1.06z\" clip-rule=\"evenodd\"/></svg>`,\n prev: `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M12.79 5.23a.75.75 0 01-.02 1.06L8.832 10l3.938 3.71a.75.75 0 11-1.04 1.08l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 011.06.02z\" clip-rule=\"evenodd\"/></svg>`,\n next: `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z\" clip-rule=\"evenodd\"/></svg>`,\n last: `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M4.21 5.23a.75.75 0 011.06-.02l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 11-1.04-1.08L8.168 10 4.23 6.29a.75.75 0 01-.02-1.06zm6 0a.75.75 0 011.06-.02l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 11-1.04-1.08L14.168 10l-3.938-3.71a.75.75 0 01-.02-1.06z\" clip-rule=\"evenodd\"/></svg>`,\n};\n\nexport class ElDmPagination extends BaseElement {\n static properties = {\n total: { type: Number, reflect: true, default: 1 },\n current: { type: Number, reflect: true, default: 1 },\n siblings: { type: Number, reflect: true, default: 1 },\n boundaries: { type: Number, reflect: true, default: 1 },\n size: { type: String, reflect: true },\n color: { type: String, reflect: true },\n };\n\n /** Total number of pages */\n declare total: number;\n\n /** Current active page (1-indexed) */\n declare current: number;\n\n /** Number of pages shown around the current page */\n declare siblings: number;\n\n /** Number of pages shown at the start and end */\n declare boundaries: number;\n\n /** Button size: xs, sm, md, lg */\n declare size: PaginationSize;\n\n /** Color variant: primary, secondary, neutral */\n declare color: PaginationColor;\n\n private _controlsObserver?: MutationObserver;\n\n constructor() {\n super();\n this.attachStyles(styles);\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener('click', this._handleClick.bind(this));\n this.addEventListener('keydown', this._handleKeydown.bind(this));\n this._controlsObserver = new MutationObserver(() => this.update());\n this._controlsObserver.observe(this, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: ['slot'],\n });\n }\n\n disconnectedCallback(): void {\n this._controlsObserver?.disconnect();\n super.disconnectedCallback();\n }\n\n /**\n * Calculate the range of page numbers to display\n */\n private _getPageRange(): (number | 'ellipsis')[] {\n const total = Math.max(1, this.total);\n const current = Math.min(Math.max(1, this.current), total);\n const siblings = Math.max(0, this.siblings);\n const boundaries = Math.max(0, this.boundaries);\n\n // If total pages fit without ellipsis\n const totalPageNumbers = boundaries * 2 + siblings * 2 + 3; // boundaries + siblings + current + 2 ellipsis spots\n if (total <= totalPageNumbers) {\n return Array.from({ length: total }, (_, i) => i + 1);\n }\n\n const leftSiblingIndex = Math.max(current - siblings, boundaries + 1);\n const rightSiblingIndex = Math.min(current + siblings, total - boundaries);\n\n const showLeftEllipsis = leftSiblingIndex > boundaries + 2;\n const showRightEllipsis = rightSiblingIndex < total - boundaries - 1;\n\n const pages: (number | 'ellipsis')[] = [];\n\n // Add left boundary pages\n for (let i = 1; i <= boundaries; i++) {\n pages.push(i);\n }\n\n // Add left ellipsis or connecting page\n if (showLeftEllipsis) {\n pages.push('ellipsis');\n } else if (boundaries + 1 < leftSiblingIndex) {\n pages.push(boundaries + 1);\n }\n\n // Add sibling pages and current page\n for (let i = leftSiblingIndex; i <= rightSiblingIndex; i++) {\n if (i > boundaries && i <= total - boundaries) {\n pages.push(i);\n }\n }\n\n // Add right ellipsis or connecting page\n if (showRightEllipsis) {\n pages.push('ellipsis');\n } else if (rightSiblingIndex < total - boundaries) {\n pages.push(total - boundaries);\n }\n\n // Add right boundary pages\n for (let i = total - boundaries + 1; i <= total; i++) {\n if (i > 0 && !pages.includes(i)) {\n pages.push(i);\n }\n }\n\n return pages;\n }\n\n private _hasDeclarativeControls(): boolean {\n return (\n this.querySelector('[slot=\"prev\"], [slot=\"previous\"], [slot=\"page\"], [slot=\"next\"]') !== null\n );\n }\n\n /**\n * Navigate to a specific page\n */\n private _goToPage(page: number): void {\n const newPage = Math.min(Math.max(1, page), this.total);\n if (newPage !== this.current) {\n this.current = newPage;\n this.emit('change', { page: newPage });\n }\n }\n\n /**\n * Handle click events on pagination buttons\n */\n private _handleClick(event: Event): void {\n if (this._hasDeclarativeControls()) return;\n\n const target = event.target as HTMLElement;\n const button = target.closest('button');\n\n if (!button || button.disabled) return;\n\n const action = button.dataset.action;\n const page = button.dataset.page;\n\n if (action === 'first') {\n this._goToPage(1);\n } else if (action === 'prev') {\n this._goToPage(this.current - 1);\n } else if (action === 'next') {\n this._goToPage(this.current + 1);\n } else if (action === 'last') {\n this._goToPage(this.total);\n } else if (page) {\n this._goToPage(parseInt(page, 10));\n }\n }\n\n /**\n * Handle keyboard navigation\n */\n private _handleKeydown(event: KeyboardEvent): void {\n if (this._hasDeclarativeControls()) return;\n\n switch (event.key) {\n case 'ArrowLeft':\n event.preventDefault();\n this._goToPage(this.current - 1);\n break;\n case 'ArrowRight':\n event.preventDefault();\n this._goToPage(this.current + 1);\n break;\n case 'Home':\n event.preventDefault();\n this._goToPage(1);\n break;\n case 'End':\n event.preventDefault();\n this._goToPage(this.total);\n break;\n }\n }\n\n render(): string {\n if (this._hasDeclarativeControls()) {\n return `\n <nav class=\"pagination\" part=\"container\" role=\"navigation\" aria-label=\"Pagination\">\n <slot name=\"previous\"></slot>\n <slot name=\"prev\"></slot>\n <slot name=\"page\"></slot>\n <slot name=\"next\"></slot>\n </nav>\n `;\n }\n\n const total = Math.max(1, this.total);\n const current = Math.min(Math.max(1, this.current), total);\n const pages = this._getPageRange();\n\n const isFirstPage = current === 1;\n const isLastPage = current === total;\n\n let pagesHtml = '';\n\n for (const page of pages) {\n if (page === 'ellipsis') {\n pagesHtml += `\n <span class=\"ellipsis\" part=\"ellipsis\" aria-hidden=\"true\">...</span>\n `;\n } else {\n const isActive = page === current;\n pagesHtml += `\n <button\n class=\"pagination-btn${isActive ? ' active' : ''}\"\n part=\"page\"\n data-page=\"${page}\"\n aria-label=\"Page ${page}\"\n aria-current=\"${isActive ? 'page' : 'false'}\"\n >${page}</button>\n `;\n }\n }\n\n return `\n <nav class=\"pagination\" part=\"container\" role=\"navigation\" aria-label=\"Pagination\">\n <button\n class=\"pagination-btn nav-btn\"\n part=\"button\"\n data-action=\"first\"\n aria-label=\"Go to first page\"\n ${isFirstPage ? 'disabled' : ''}\n >${ICONS.first}</button>\n <button\n class=\"pagination-btn nav-btn\"\n part=\"button\"\n data-action=\"prev\"\n aria-label=\"Go to previous page\"\n ${isFirstPage ? 'disabled' : ''}\n >${ICONS.prev}</button>\n ${pagesHtml}\n <button\n class=\"pagination-btn nav-btn\"\n part=\"button\"\n data-action=\"next\"\n aria-label=\"Go to next page\"\n ${isLastPage ? 'disabled' : ''}\n >${ICONS.next}</button>\n <button\n class=\"pagination-btn nav-btn\"\n part=\"button\"\n data-action=\"last\"\n aria-label=\"Go to last page\"\n ${isLastPage ? 'disabled' : ''}\n >${ICONS.last}</button>\n </nav>\n `;\n }\n}\n",
|
|
6
6
|
"/**\n * @duskmoon-dev/el-pagination\n *\n * DuskMoon Pagination custom element\n */\n\nimport { ElDmPagination } from './el-dm-pagination.js';\n\nexport { ElDmPagination };\n\n/**\n * Register the el-dm-pagination custom element\n *\n * @example\n * ```ts\n * import { register } from '@duskmoon-dev/el-pagination';\n * register();\n * ```\n */\nexport function register(): void {\n if (!customElements.get('el-dm-pagination')) {\n customElements.define('el-dm-pagination', ElDmPagination);\n }\n}\n"
|
|
7
7
|
],
|
|
8
|
-
"mappings": ";
|
|
9
|
-
"debugId": "
|
|
8
|
+
"mappings": ";AA4BA;AAKA,IAAM,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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10
|
"names": []
|
|
11
11
|
}
|
package/dist/esm/register.js
CHANGED
|
@@ -80,6 +80,36 @@ var styles = css`
|
|
|
80
80
|
user-select: none;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
::slotted([slot='prev']),
|
|
84
|
+
::slotted([slot='previous']),
|
|
85
|
+
::slotted([slot='page']),
|
|
86
|
+
::slotted([slot='next']) {
|
|
87
|
+
display: inline-flex;
|
|
88
|
+
align-items: center;
|
|
89
|
+
justify-content: center;
|
|
90
|
+
min-width: 2rem;
|
|
91
|
+
height: 2rem;
|
|
92
|
+
padding: 0 0.5rem;
|
|
93
|
+
border: 1px solid var(--color-border, #d1d5db);
|
|
94
|
+
border-radius: var(--radius-md, 0.375rem);
|
|
95
|
+
color: var(--color-text, #374151);
|
|
96
|
+
font: inherit;
|
|
97
|
+
text-decoration: none;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
::slotted([slot='page'][aria-current='page']),
|
|
101
|
+
::slotted([slot='page'][data-active='true']) {
|
|
102
|
+
border-color: var(--color-primary, #3b82f6);
|
|
103
|
+
background: var(--color-primary, #3b82f6);
|
|
104
|
+
color: var(--color-primary-contrast, #ffffff);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
::slotted([disabled]),
|
|
108
|
+
::slotted([aria-disabled='true']) {
|
|
109
|
+
opacity: 0.5;
|
|
110
|
+
cursor: not-allowed;
|
|
111
|
+
}
|
|
112
|
+
|
|
83
113
|
/* Size variants */
|
|
84
114
|
:host([size='xs']) .pagination-btn {
|
|
85
115
|
min-width: 1.5rem;
|
|
@@ -158,6 +188,7 @@ class ElDmPagination extends BaseElement {
|
|
|
158
188
|
size: { type: String, reflect: true },
|
|
159
189
|
color: { type: String, reflect: true }
|
|
160
190
|
};
|
|
191
|
+
_controlsObserver;
|
|
161
192
|
constructor() {
|
|
162
193
|
super();
|
|
163
194
|
this.attachStyles(styles);
|
|
@@ -166,6 +197,17 @@ class ElDmPagination extends BaseElement {
|
|
|
166
197
|
super.connectedCallback();
|
|
167
198
|
this.addEventListener("click", this._handleClick.bind(this));
|
|
168
199
|
this.addEventListener("keydown", this._handleKeydown.bind(this));
|
|
200
|
+
this._controlsObserver = new MutationObserver(() => this.update());
|
|
201
|
+
this._controlsObserver.observe(this, {
|
|
202
|
+
childList: true,
|
|
203
|
+
subtree: true,
|
|
204
|
+
attributes: true,
|
|
205
|
+
attributeFilter: ["slot"]
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
disconnectedCallback() {
|
|
209
|
+
this._controlsObserver?.disconnect();
|
|
210
|
+
super.disconnectedCallback();
|
|
169
211
|
}
|
|
170
212
|
_getPageRange() {
|
|
171
213
|
const total = Math.max(1, this.total);
|
|
@@ -206,6 +248,9 @@ class ElDmPagination extends BaseElement {
|
|
|
206
248
|
}
|
|
207
249
|
return pages;
|
|
208
250
|
}
|
|
251
|
+
_hasDeclarativeControls() {
|
|
252
|
+
return this.querySelector('[slot="prev"], [slot="previous"], [slot="page"], [slot="next"]') !== null;
|
|
253
|
+
}
|
|
209
254
|
_goToPage(page) {
|
|
210
255
|
const newPage = Math.min(Math.max(1, page), this.total);
|
|
211
256
|
if (newPage !== this.current) {
|
|
@@ -214,6 +259,8 @@ class ElDmPagination extends BaseElement {
|
|
|
214
259
|
}
|
|
215
260
|
}
|
|
216
261
|
_handleClick(event) {
|
|
262
|
+
if (this._hasDeclarativeControls())
|
|
263
|
+
return;
|
|
217
264
|
const target = event.target;
|
|
218
265
|
const button = target.closest("button");
|
|
219
266
|
if (!button || button.disabled)
|
|
@@ -233,6 +280,8 @@ class ElDmPagination extends BaseElement {
|
|
|
233
280
|
}
|
|
234
281
|
}
|
|
235
282
|
_handleKeydown(event) {
|
|
283
|
+
if (this._hasDeclarativeControls())
|
|
284
|
+
return;
|
|
236
285
|
switch (event.key) {
|
|
237
286
|
case "ArrowLeft":
|
|
238
287
|
event.preventDefault();
|
|
@@ -253,6 +302,16 @@ class ElDmPagination extends BaseElement {
|
|
|
253
302
|
}
|
|
254
303
|
}
|
|
255
304
|
render() {
|
|
305
|
+
if (this._hasDeclarativeControls()) {
|
|
306
|
+
return `
|
|
307
|
+
<nav class="pagination" part="container" role="navigation" aria-label="Pagination">
|
|
308
|
+
<slot name="previous"></slot>
|
|
309
|
+
<slot name="prev"></slot>
|
|
310
|
+
<slot name="page"></slot>
|
|
311
|
+
<slot name="next"></slot>
|
|
312
|
+
</nav>
|
|
313
|
+
`;
|
|
314
|
+
}
|
|
256
315
|
const total = Math.max(1, this.total);
|
|
257
316
|
const current = Math.min(Math.max(1, this.current), total);
|
|
258
317
|
const pages = this._getPageRange();
|
|
@@ -323,5 +382,5 @@ function register() {
|
|
|
323
382
|
// src/register.ts
|
|
324
383
|
register();
|
|
325
384
|
|
|
326
|
-
//# debugId=
|
|
385
|
+
//# debugId=DF22CCA5805D909764756E2164756E21
|
|
327
386
|
//# sourceMappingURL=register.js.map
|
package/dist/esm/register.js.map
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/el-dm-pagination.ts", "../../src/index.ts", "../../src/register.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"/**\n * DuskMoon Pagination Element\n *\n * A customizable pagination component for page navigation.\n * Supports first/last, previous/next buttons, and page number display with ellipsis.\n *\n * @element el-dm-pagination\n *\n * @attr {number} total - Total number of pages\n * @attr {number} current - Current active page (1-indexed)\n * @attr {number} siblings - Number of pages to show around current page\n * @attr {number} boundaries - Number of pages to show at start/end\n * @attr {string} size - Button size: xs, sm, md, lg\n * @attr {string} color - Color variant: primary, secondary, neutral\n *\n * @csspart container - The pagination container\n * @csspart button - Navigation buttons (first, prev, next, last)\n * @csspart page - Page number buttons\n * @csspart ellipsis - Ellipsis indicators\n *\n * @fires change - Fired when the current page changes, detail: { page: number }\n */\n\nimport { BaseElement, css } from '@duskmoon-dev/el-base';\n\nexport type PaginationSize = 'xs' | 'sm' | 'md' | 'lg';\nexport type PaginationColor = 'primary' | 'secondary' | 'neutral';\n\nconst styles = css`\n :host {\n display: inline-flex;\n vertical-align: middle;\n }\n\n :host([hidden]) {\n display: none !important;\n }\n\n .pagination {\n display: flex;\n align-items: center;\n gap: 0.25rem;\n font-family: inherit;\n }\n\n .pagination-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n border: 1px solid var(--color-border, #d1d5db);\n background: var(--color-surface, #ffffff);\n color: var(--color-text, #374151);\n cursor: pointer;\n font-family: inherit;\n font-weight: 500;\n transition:\n background-color 0.15s ease,\n border-color 0.15s ease,\n color 0.15s ease;\n border-radius: var(--radius-md, 0.375rem);\n min-width: 2rem;\n height: 2rem;\n padding: 0 0.5rem;\n font-size: 0.875rem;\n line-height: 1;\n }\n\n .pagination-btn:hover:not(:disabled) {\n background: var(--color-surface-hover, #f3f4f6);\n border-color: var(--color-border-hover, #9ca3af);\n }\n\n .pagination-btn:focus-visible {\n outline: 2px solid var(--color-primary, #3b82f6);\n outline-offset: 2px;\n }\n\n .pagination-btn:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n .pagination-btn.active {\n background: var(--color-primary, #3b82f6);\n border-color: var(--color-primary, #3b82f6);\n color: var(--color-primary-contrast, #ffffff);\n }\n\n .pagination-btn.nav-btn {\n padding: 0 0.375rem;\n }\n\n .pagination-btn.nav-btn svg {\n width: 1em;\n height: 1em;\n }\n\n .ellipsis {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 2rem;\n height: 2rem;\n color: var(--color-text-muted, #6b7280);\n font-size: 0.875rem;\n user-select: none;\n }\n\n /* Size variants */\n :host([size='xs']) .pagination-btn {\n min-width: 1.5rem;\n height: 1.5rem;\n padding: 0 0.25rem;\n font-size: 0.75rem;\n border-radius: var(--radius-sm, 0.25rem);\n }\n\n :host([size='xs']) .ellipsis {\n min-width: 1.5rem;\n height: 1.5rem;\n font-size: 0.75rem;\n }\n\n :host([size='sm']) .pagination-btn {\n min-width: 1.75rem;\n height: 1.75rem;\n padding: 0 0.375rem;\n font-size: 0.8125rem;\n }\n\n :host([size='sm']) .ellipsis {\n min-width: 1.75rem;\n height: 1.75rem;\n font-size: 0.8125rem;\n }\n\n :host([size='lg']) .pagination-btn {\n min-width: 2.5rem;\n height: 2.5rem;\n padding: 0 0.75rem;\n font-size: 1rem;\n }\n\n :host([size='lg']) .ellipsis {\n min-width: 2.5rem;\n height: 2.5rem;\n font-size: 1rem;\n }\n\n /* Color variants */\n :host([color='secondary']) .pagination-btn.active {\n background: var(--color-secondary, #8b5cf6);\n border-color: var(--color-secondary, #8b5cf6);\n color: var(--color-secondary-contrast, #ffffff);\n }\n\n :host([color='secondary']) .pagination-btn:focus-visible {\n outline-color: var(--color-secondary, #8b5cf6);\n }\n\n :host([color='neutral']) .pagination-btn.active {\n background: var(--color-neutral, #6b7280);\n border-color: var(--color-neutral, #6b7280);\n color: var(--color-neutral-contrast, #ffffff);\n }\n\n :host([color='neutral']) .pagination-btn:focus-visible {\n outline-color: var(--color-neutral, #6b7280);\n }\n`;\n\n// SVG icons for navigation buttons\nconst ICONS = {\n first: `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M15.79 14.77a.75.75 0 01-1.06.02l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 111.04 1.08L11.832 10l3.938 3.71a.75.75 0 01.02 1.06zm-6 0a.75.75 0 01-1.06.02l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 111.04 1.08L5.832 10l3.938 3.71a.75.75 0 01.02 1.06z\" clip-rule=\"evenodd\"/></svg>`,\n prev: `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M12.79 5.23a.75.75 0 01-.02 1.06L8.832 10l3.938 3.71a.75.75 0 11-1.04 1.08l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 011.06.02z\" clip-rule=\"evenodd\"/></svg>`,\n next: `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z\" clip-rule=\"evenodd\"/></svg>`,\n last: `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M4.21 5.23a.75.75 0 011.06-.02l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 11-1.04-1.08L8.168 10 4.23 6.29a.75.75 0 01-.02-1.06zm6 0a.75.75 0 011.06-.02l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 11-1.04-1.08L14.168 10l-3.938-3.71a.75.75 0 01-.02-1.06z\" clip-rule=\"evenodd\"/></svg>`,\n};\n\nexport class ElDmPagination extends BaseElement {\n static properties = {\n total: { type: Number, reflect: true, default: 1 },\n current: { type: Number, reflect: true, default: 1 },\n siblings: { type: Number, reflect: true, default: 1 },\n boundaries: { type: Number, reflect: true, default: 1 },\n size: { type: String, reflect: true },\n color: { type: String, reflect: true },\n };\n\n /** Total number of pages */\n declare total: number;\n\n /** Current active page (1-indexed) */\n declare current: number;\n\n /** Number of pages shown around the current page */\n declare siblings: number;\n\n /** Number of pages shown at the start and end */\n declare boundaries: number;\n\n /** Button size: xs, sm, md, lg */\n declare size: PaginationSize;\n\n /** Color variant: primary, secondary, neutral */\n declare color: PaginationColor;\n\n constructor() {\n super();\n this.attachStyles(styles);\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener('click', this._handleClick.bind(this));\n this.addEventListener('keydown', this._handleKeydown.bind(this));\n }\n\n /**\n * Calculate the range of page numbers to display\n */\n private _getPageRange(): (number | 'ellipsis')[] {\n const total = Math.max(1, this.total);\n const current = Math.min(Math.max(1, this.current), total);\n const siblings = Math.max(0, this.siblings);\n const boundaries = Math.max(0, this.boundaries);\n\n // If total pages fit without ellipsis\n const totalPageNumbers = boundaries * 2 + siblings * 2 + 3; // boundaries + siblings + current + 2 ellipsis spots\n if (total <= totalPageNumbers) {\n return Array.from({ length: total }, (_, i) => i + 1);\n }\n\n const leftSiblingIndex = Math.max(current - siblings, boundaries + 1);\n const rightSiblingIndex = Math.min(current + siblings, total - boundaries);\n\n const showLeftEllipsis = leftSiblingIndex > boundaries + 2;\n const showRightEllipsis = rightSiblingIndex < total - boundaries - 1;\n\n const pages: (number | 'ellipsis')[] = [];\n\n // Add left boundary pages\n for (let i = 1; i <= boundaries; i++) {\n pages.push(i);\n }\n\n // Add left ellipsis or connecting page\n if (showLeftEllipsis) {\n pages.push('ellipsis');\n } else if (boundaries + 1 < leftSiblingIndex) {\n pages.push(boundaries + 1);\n }\n\n // Add sibling pages and current page\n for (let i = leftSiblingIndex; i <= rightSiblingIndex; i++) {\n if (i > boundaries && i <= total - boundaries) {\n pages.push(i);\n }\n }\n\n // Add right ellipsis or connecting page\n if (showRightEllipsis) {\n pages.push('ellipsis');\n } else if (rightSiblingIndex < total - boundaries) {\n pages.push(total - boundaries);\n }\n\n // Add right boundary pages\n for (let i = total - boundaries + 1; i <= total; i++) {\n if (i > 0 && !pages.includes(i)) {\n pages.push(i);\n }\n }\n\n return pages;\n }\n\n /**\n * Navigate to a specific page\n */\n private _goToPage(page: number): void {\n const newPage = Math.min(Math.max(1, page), this.total);\n if (newPage !== this.current) {\n this.current = newPage;\n this.emit('change', { page: newPage });\n }\n }\n\n /**\n * Handle click events on pagination buttons\n */\n private _handleClick(event: Event): void {\n const target = event.target as HTMLElement;\n const button = target.closest('button');\n\n if (!button || button.disabled) return;\n\n const action = button.dataset.action;\n const page = button.dataset.page;\n\n if (action === 'first') {\n this._goToPage(1);\n } else if (action === 'prev') {\n this._goToPage(this.current - 1);\n } else if (action === 'next') {\n this._goToPage(this.current + 1);\n } else if (action === 'last') {\n this._goToPage(this.total);\n } else if (page) {\n this._goToPage(parseInt(page, 10));\n }\n }\n\n /**\n * Handle keyboard navigation\n */\n private _handleKeydown(event: KeyboardEvent): void {\n switch (event.key) {\n case 'ArrowLeft':\n event.preventDefault();\n this._goToPage(this.current - 1);\n break;\n case 'ArrowRight':\n event.preventDefault();\n this._goToPage(this.current + 1);\n break;\n case 'Home':\n event.preventDefault();\n this._goToPage(1);\n break;\n case 'End':\n event.preventDefault();\n this._goToPage(this.total);\n break;\n }\n }\n\n render(): string {\n const total = Math.max(1, this.total);\n const current = Math.min(Math.max(1, this.current), total);\n const pages = this._getPageRange();\n\n const isFirstPage = current === 1;\n const isLastPage = current === total;\n\n let pagesHtml = '';\n\n for (const page of pages) {\n if (page === 'ellipsis') {\n pagesHtml += `\n <span class=\"ellipsis\" part=\"ellipsis\" aria-hidden=\"true\">...</span>\n `;\n } else {\n const isActive = page === current;\n pagesHtml += `\n <button\n class=\"pagination-btn${isActive ? ' active' : ''}\"\n part=\"page\"\n data-page=\"${page}\"\n aria-label=\"Page ${page}\"\n aria-current=\"${isActive ? 'page' : 'false'}\"\n >${page}</button>\n `;\n }\n }\n\n return `\n <nav class=\"pagination\" part=\"container\" role=\"navigation\" aria-label=\"Pagination\">\n <button\n class=\"pagination-btn nav-btn\"\n part=\"button\"\n data-action=\"first\"\n aria-label=\"Go to first page\"\n ${isFirstPage ? 'disabled' : ''}\n >${ICONS.first}</button>\n <button\n class=\"pagination-btn nav-btn\"\n part=\"button\"\n data-action=\"prev\"\n aria-label=\"Go to previous page\"\n ${isFirstPage ? 'disabled' : ''}\n >${ICONS.prev}</button>\n ${pagesHtml}\n <button\n class=\"pagination-btn nav-btn\"\n part=\"button\"\n data-action=\"next\"\n aria-label=\"Go to next page\"\n ${isLastPage ? 'disabled' : ''}\n >${ICONS.next}</button>\n <button\n class=\"pagination-btn nav-btn\"\n part=\"button\"\n data-action=\"last\"\n aria-label=\"Go to last page\"\n ${isLastPage ? 'disabled' : ''}\n >${ICONS.last}</button>\n </nav>\n `;\n }\n}\n",
|
|
5
|
+
"/**\n * DuskMoon Pagination Element\n *\n * A customizable pagination component for page navigation.\n * Supports first/last, previous/next buttons, and page number display with ellipsis.\n *\n * @element el-dm-pagination\n *\n * @attr {number} total - Total number of pages\n * @attr {number} current - Current active page (1-indexed)\n * @attr {number} siblings - Number of pages to show around current page\n * @attr {number} boundaries - Number of pages to show at start/end\n * @attr {string} size - Button size: xs, sm, md, lg\n * @attr {string} color - Color variant: primary, secondary, neutral\n *\n * @slot prev - Declarative server-rendered previous-page control\n * @slot previous - Alias for the declarative previous-page control\n * @slot page - Declarative server-rendered page or ellipsis control\n * @slot next - Declarative server-rendered next-page control\n *\n * @csspart container - The pagination container\n * @csspart button - Navigation buttons (first, prev, next, last)\n * @csspart page - Page number buttons\n * @csspart ellipsis - Ellipsis indicators\n *\n * @fires change - Fired when the current page changes, detail: { page: number }\n */\n\nimport { BaseElement, css } from '@duskmoon-dev/el-base';\n\nexport type PaginationSize = 'xs' | 'sm' | 'md' | 'lg';\nexport type PaginationColor = 'primary' | 'secondary' | 'neutral';\n\nconst styles = css`\n :host {\n display: inline-flex;\n vertical-align: middle;\n }\n\n :host([hidden]) {\n display: none !important;\n }\n\n .pagination {\n display: flex;\n align-items: center;\n gap: 0.25rem;\n font-family: inherit;\n }\n\n .pagination-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n border: 1px solid var(--color-border, #d1d5db);\n background: var(--color-surface, #ffffff);\n color: var(--color-text, #374151);\n cursor: pointer;\n font-family: inherit;\n font-weight: 500;\n transition:\n background-color 0.15s ease,\n border-color 0.15s ease,\n color 0.15s ease;\n border-radius: var(--radius-md, 0.375rem);\n min-width: 2rem;\n height: 2rem;\n padding: 0 0.5rem;\n font-size: 0.875rem;\n line-height: 1;\n }\n\n .pagination-btn:hover:not(:disabled) {\n background: var(--color-surface-hover, #f3f4f6);\n border-color: var(--color-border-hover, #9ca3af);\n }\n\n .pagination-btn:focus-visible {\n outline: 2px solid var(--color-primary, #3b82f6);\n outline-offset: 2px;\n }\n\n .pagination-btn:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n .pagination-btn.active {\n background: var(--color-primary, #3b82f6);\n border-color: var(--color-primary, #3b82f6);\n color: var(--color-primary-contrast, #ffffff);\n }\n\n .pagination-btn.nav-btn {\n padding: 0 0.375rem;\n }\n\n .pagination-btn.nav-btn svg {\n width: 1em;\n height: 1em;\n }\n\n .ellipsis {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 2rem;\n height: 2rem;\n color: var(--color-text-muted, #6b7280);\n font-size: 0.875rem;\n user-select: none;\n }\n\n ::slotted([slot='prev']),\n ::slotted([slot='previous']),\n ::slotted([slot='page']),\n ::slotted([slot='next']) {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 2rem;\n height: 2rem;\n padding: 0 0.5rem;\n border: 1px solid var(--color-border, #d1d5db);\n border-radius: var(--radius-md, 0.375rem);\n color: var(--color-text, #374151);\n font: inherit;\n text-decoration: none;\n }\n\n ::slotted([slot='page'][aria-current='page']),\n ::slotted([slot='page'][data-active='true']) {\n border-color: var(--color-primary, #3b82f6);\n background: var(--color-primary, #3b82f6);\n color: var(--color-primary-contrast, #ffffff);\n }\n\n ::slotted([disabled]),\n ::slotted([aria-disabled='true']) {\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n /* Size variants */\n :host([size='xs']) .pagination-btn {\n min-width: 1.5rem;\n height: 1.5rem;\n padding: 0 0.25rem;\n font-size: 0.75rem;\n border-radius: var(--radius-sm, 0.25rem);\n }\n\n :host([size='xs']) .ellipsis {\n min-width: 1.5rem;\n height: 1.5rem;\n font-size: 0.75rem;\n }\n\n :host([size='sm']) .pagination-btn {\n min-width: 1.75rem;\n height: 1.75rem;\n padding: 0 0.375rem;\n font-size: 0.8125rem;\n }\n\n :host([size='sm']) .ellipsis {\n min-width: 1.75rem;\n height: 1.75rem;\n font-size: 0.8125rem;\n }\n\n :host([size='lg']) .pagination-btn {\n min-width: 2.5rem;\n height: 2.5rem;\n padding: 0 0.75rem;\n font-size: 1rem;\n }\n\n :host([size='lg']) .ellipsis {\n min-width: 2.5rem;\n height: 2.5rem;\n font-size: 1rem;\n }\n\n /* Color variants */\n :host([color='secondary']) .pagination-btn.active {\n background: var(--color-secondary, #8b5cf6);\n border-color: var(--color-secondary, #8b5cf6);\n color: var(--color-secondary-contrast, #ffffff);\n }\n\n :host([color='secondary']) .pagination-btn:focus-visible {\n outline-color: var(--color-secondary, #8b5cf6);\n }\n\n :host([color='neutral']) .pagination-btn.active {\n background: var(--color-neutral, #6b7280);\n border-color: var(--color-neutral, #6b7280);\n color: var(--color-neutral-contrast, #ffffff);\n }\n\n :host([color='neutral']) .pagination-btn:focus-visible {\n outline-color: var(--color-neutral, #6b7280);\n }\n`;\n\n// SVG icons for navigation buttons\nconst ICONS = {\n first: `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M15.79 14.77a.75.75 0 01-1.06.02l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 111.04 1.08L11.832 10l3.938 3.71a.75.75 0 01.02 1.06zm-6 0a.75.75 0 01-1.06.02l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 111.04 1.08L5.832 10l3.938 3.71a.75.75 0 01.02 1.06z\" clip-rule=\"evenodd\"/></svg>`,\n prev: `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M12.79 5.23a.75.75 0 01-.02 1.06L8.832 10l3.938 3.71a.75.75 0 11-1.04 1.08l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 011.06.02z\" clip-rule=\"evenodd\"/></svg>`,\n next: `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z\" clip-rule=\"evenodd\"/></svg>`,\n last: `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M4.21 5.23a.75.75 0 011.06-.02l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 11-1.04-1.08L8.168 10 4.23 6.29a.75.75 0 01-.02-1.06zm6 0a.75.75 0 011.06-.02l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 11-1.04-1.08L14.168 10l-3.938-3.71a.75.75 0 01-.02-1.06z\" clip-rule=\"evenodd\"/></svg>`,\n};\n\nexport class ElDmPagination extends BaseElement {\n static properties = {\n total: { type: Number, reflect: true, default: 1 },\n current: { type: Number, reflect: true, default: 1 },\n siblings: { type: Number, reflect: true, default: 1 },\n boundaries: { type: Number, reflect: true, default: 1 },\n size: { type: String, reflect: true },\n color: { type: String, reflect: true },\n };\n\n /** Total number of pages */\n declare total: number;\n\n /** Current active page (1-indexed) */\n declare current: number;\n\n /** Number of pages shown around the current page */\n declare siblings: number;\n\n /** Number of pages shown at the start and end */\n declare boundaries: number;\n\n /** Button size: xs, sm, md, lg */\n declare size: PaginationSize;\n\n /** Color variant: primary, secondary, neutral */\n declare color: PaginationColor;\n\n private _controlsObserver?: MutationObserver;\n\n constructor() {\n super();\n this.attachStyles(styles);\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener('click', this._handleClick.bind(this));\n this.addEventListener('keydown', this._handleKeydown.bind(this));\n this._controlsObserver = new MutationObserver(() => this.update());\n this._controlsObserver.observe(this, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: ['slot'],\n });\n }\n\n disconnectedCallback(): void {\n this._controlsObserver?.disconnect();\n super.disconnectedCallback();\n }\n\n /**\n * Calculate the range of page numbers to display\n */\n private _getPageRange(): (number | 'ellipsis')[] {\n const total = Math.max(1, this.total);\n const current = Math.min(Math.max(1, this.current), total);\n const siblings = Math.max(0, this.siblings);\n const boundaries = Math.max(0, this.boundaries);\n\n // If total pages fit without ellipsis\n const totalPageNumbers = boundaries * 2 + siblings * 2 + 3; // boundaries + siblings + current + 2 ellipsis spots\n if (total <= totalPageNumbers) {\n return Array.from({ length: total }, (_, i) => i + 1);\n }\n\n const leftSiblingIndex = Math.max(current - siblings, boundaries + 1);\n const rightSiblingIndex = Math.min(current + siblings, total - boundaries);\n\n const showLeftEllipsis = leftSiblingIndex > boundaries + 2;\n const showRightEllipsis = rightSiblingIndex < total - boundaries - 1;\n\n const pages: (number | 'ellipsis')[] = [];\n\n // Add left boundary pages\n for (let i = 1; i <= boundaries; i++) {\n pages.push(i);\n }\n\n // Add left ellipsis or connecting page\n if (showLeftEllipsis) {\n pages.push('ellipsis');\n } else if (boundaries + 1 < leftSiblingIndex) {\n pages.push(boundaries + 1);\n }\n\n // Add sibling pages and current page\n for (let i = leftSiblingIndex; i <= rightSiblingIndex; i++) {\n if (i > boundaries && i <= total - boundaries) {\n pages.push(i);\n }\n }\n\n // Add right ellipsis or connecting page\n if (showRightEllipsis) {\n pages.push('ellipsis');\n } else if (rightSiblingIndex < total - boundaries) {\n pages.push(total - boundaries);\n }\n\n // Add right boundary pages\n for (let i = total - boundaries + 1; i <= total; i++) {\n if (i > 0 && !pages.includes(i)) {\n pages.push(i);\n }\n }\n\n return pages;\n }\n\n private _hasDeclarativeControls(): boolean {\n return (\n this.querySelector('[slot=\"prev\"], [slot=\"previous\"], [slot=\"page\"], [slot=\"next\"]') !== null\n );\n }\n\n /**\n * Navigate to a specific page\n */\n private _goToPage(page: number): void {\n const newPage = Math.min(Math.max(1, page), this.total);\n if (newPage !== this.current) {\n this.current = newPage;\n this.emit('change', { page: newPage });\n }\n }\n\n /**\n * Handle click events on pagination buttons\n */\n private _handleClick(event: Event): void {\n if (this._hasDeclarativeControls()) return;\n\n const target = event.target as HTMLElement;\n const button = target.closest('button');\n\n if (!button || button.disabled) return;\n\n const action = button.dataset.action;\n const page = button.dataset.page;\n\n if (action === 'first') {\n this._goToPage(1);\n } else if (action === 'prev') {\n this._goToPage(this.current - 1);\n } else if (action === 'next') {\n this._goToPage(this.current + 1);\n } else if (action === 'last') {\n this._goToPage(this.total);\n } else if (page) {\n this._goToPage(parseInt(page, 10));\n }\n }\n\n /**\n * Handle keyboard navigation\n */\n private _handleKeydown(event: KeyboardEvent): void {\n if (this._hasDeclarativeControls()) return;\n\n switch (event.key) {\n case 'ArrowLeft':\n event.preventDefault();\n this._goToPage(this.current - 1);\n break;\n case 'ArrowRight':\n event.preventDefault();\n this._goToPage(this.current + 1);\n break;\n case 'Home':\n event.preventDefault();\n this._goToPage(1);\n break;\n case 'End':\n event.preventDefault();\n this._goToPage(this.total);\n break;\n }\n }\n\n render(): string {\n if (this._hasDeclarativeControls()) {\n return `\n <nav class=\"pagination\" part=\"container\" role=\"navigation\" aria-label=\"Pagination\">\n <slot name=\"previous\"></slot>\n <slot name=\"prev\"></slot>\n <slot name=\"page\"></slot>\n <slot name=\"next\"></slot>\n </nav>\n `;\n }\n\n const total = Math.max(1, this.total);\n const current = Math.min(Math.max(1, this.current), total);\n const pages = this._getPageRange();\n\n const isFirstPage = current === 1;\n const isLastPage = current === total;\n\n let pagesHtml = '';\n\n for (const page of pages) {\n if (page === 'ellipsis') {\n pagesHtml += `\n <span class=\"ellipsis\" part=\"ellipsis\" aria-hidden=\"true\">...</span>\n `;\n } else {\n const isActive = page === current;\n pagesHtml += `\n <button\n class=\"pagination-btn${isActive ? ' active' : ''}\"\n part=\"page\"\n data-page=\"${page}\"\n aria-label=\"Page ${page}\"\n aria-current=\"${isActive ? 'page' : 'false'}\"\n >${page}</button>\n `;\n }\n }\n\n return `\n <nav class=\"pagination\" part=\"container\" role=\"navigation\" aria-label=\"Pagination\">\n <button\n class=\"pagination-btn nav-btn\"\n part=\"button\"\n data-action=\"first\"\n aria-label=\"Go to first page\"\n ${isFirstPage ? 'disabled' : ''}\n >${ICONS.first}</button>\n <button\n class=\"pagination-btn nav-btn\"\n part=\"button\"\n data-action=\"prev\"\n aria-label=\"Go to previous page\"\n ${isFirstPage ? 'disabled' : ''}\n >${ICONS.prev}</button>\n ${pagesHtml}\n <button\n class=\"pagination-btn nav-btn\"\n part=\"button\"\n data-action=\"next\"\n aria-label=\"Go to next page\"\n ${isLastPage ? 'disabled' : ''}\n >${ICONS.next}</button>\n <button\n class=\"pagination-btn nav-btn\"\n part=\"button\"\n data-action=\"last\"\n aria-label=\"Go to last page\"\n ${isLastPage ? 'disabled' : ''}\n >${ICONS.last}</button>\n </nav>\n `;\n }\n}\n",
|
|
6
6
|
"/**\n * @duskmoon-dev/el-pagination\n *\n * DuskMoon Pagination custom element\n */\n\nimport { ElDmPagination } from './el-dm-pagination.js';\n\nexport { ElDmPagination };\n\n/**\n * Register the el-dm-pagination custom element\n *\n * @example\n * ```ts\n * import { register } from '@duskmoon-dev/el-pagination';\n * register();\n * ```\n */\nexport function register(): void {\n if (!customElements.get('el-dm-pagination')) {\n customElements.define('el-dm-pagination', ElDmPagination);\n }\n}\n",
|
|
7
7
|
"/**\n * Auto-register el-dm-pagination custom element\n *\n * @example\n * ```ts\n * import '@duskmoon-dev/el-pagination/register';\n *\n * // Now you can use <el-dm-pagination> in HTML\n * ```\n */\nimport { register } from './index.js';\n\nregister();\n"
|
|
8
8
|
],
|
|
9
|
-
"mappings": ";
|
|
10
|
-
"debugId": "
|
|
9
|
+
"mappings": ";AA4BA;AAKA,IAAM,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2021.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.date.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2021.promise.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2021.string.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2021.intl.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.array.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.intl.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.object.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.string.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.decorators.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../src/duskmoon-core.d.ts","../../../packages/base/dist/types/base-element.d.ts","../../../packages/base/dist/types/styles.d.ts","../../../packages/base/dist/types/animations.d.ts","../../../packages/base/dist/types/themes.d.ts","../../../packages/base/dist/types/mixins.d.ts","../../../packages/base/dist/types/types.d.ts","../../../packages/base/dist/types/validation.d.ts","../../../packages/base/dist/types/performance.d.ts","../../../packages/base/dist/types/index.d.ts","../src/el-dm-pagination.ts","../src/index.ts","../src/register.ts"],"fileIdsList":[[69],[70],[71],[61,62,63,64,65,66,67,68],[61],[66]],"fileInfos":[{"version":"bcd24271a113971ba9eb71ff8cb01bc6b0f872a85c23fdbe5d93065b375933cd","affectsGlobalScope":true,"impliedFormat":1},{"version":"3f88bedbeb09c6f5a6645cb24c7c55f1aa22d19ae96c8e6959cbd8b85a707bc6","impliedFormat":1},{"version":"7fe93b39b810eadd916be8db880dd7f0f7012a5cc6ffb62de8f62a2117fa6f1f","impliedFormat":1},{"version":"bb0074cc08b84a2374af33d8bf044b80851ccc9e719a5e202eacf40db2c31600","impliedFormat":1},{"version":"1a7daebe4f45fb03d9ec53d60008fbf9ac45a697fdc89e4ce218bc94b94f94d6","impliedFormat":1},{"version":"f94b133a3cb14a288803be545ac2683e0d0ff6661bcd37e31aaaec54fc382aed","impliedFormat":1},{"version":"f59d0650799f8782fd74cf73c19223730c6d1b9198671b1c5b3a38e1188b5953","impliedFormat":1},{"version":"8a15b4607d9a499e2dbeed9ec0d3c0d7372c850b2d5f1fb259e8f6d41d468a84","impliedFormat":1},{"version":"26e0fe14baee4e127f4365d1ae0b276f400562e45e19e35fd2d4c296684715e6","impliedFormat":1},{"version":"d6b1eba8496bdd0eed6fc8a685768fe01b2da4a0388b5fe7df558290bffcf32f","affectsGlobalScope":true,"impliedFormat":1},{"version":"7f57fc4404ff020bc45b9c620aff2b40f700b95fe31164024c453a5e3c163c54","impliedFormat":1},{"version":"eadcffda2aa84802c73938e589b9e58248d74c59cb7fcbca6474e3435ac15504","affectsGlobalScope":true,"impliedFormat":1},{"version":"105ba8ff7ba746404fe1a2e189d1d3d2e0eb29a08c18dded791af02f29fb4711","affectsGlobalScope":true,"impliedFormat":1},{"version":"00343ca5b2e3d48fa5df1db6e32ea2a59afab09590274a6cccb1dbae82e60c7c","affectsGlobalScope":true,"impliedFormat":1},{"version":"ebd9f816d4002697cb2864bea1f0b70a103124e18a8cd9645eeccc09bdf80ab4","affectsGlobalScope":true,"impliedFormat":1},{"version":"2c1afac30a01772cd2a9a298a7ce7706b5892e447bb46bdbeef720f7b5da77ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"7b0225f483e4fa685625ebe43dd584bb7973bbd84e66a6ba7bbe175ee1048b4f","affectsGlobalScope":true,"impliedFormat":1},{"version":"c0a4b8ac6ce74679c1da2b3795296f5896e31c38e888469a8e0f99dc3305de60","affectsGlobalScope":true,"impliedFormat":1},{"version":"3084a7b5f569088e0146533a00830e206565de65cae2239509168b11434cd84f","affectsGlobalScope":true,"impliedFormat":1},{"version":"c5079c53f0f141a0698faa903e76cb41cd664e3efb01cc17a5c46ec2eb0bef42","affectsGlobalScope":true,"impliedFormat":1},{"version":"32cafbc484dea6b0ab62cf8473182bbcb23020d70845b406f80b7526f38ae862","affectsGlobalScope":true,"impliedFormat":1},{"version":"fca4cdcb6d6c5ef18a869003d02c9f0fd95df8cfaf6eb431cd3376bc034cad36","affectsGlobalScope":true,"impliedFormat":1},{"version":"b93ec88115de9a9dc1b602291b85baf825c85666bf25985cc5f698073892b467","affectsGlobalScope":true,"impliedFormat":1},{"version":"f5c06dcc3fe849fcb297c247865a161f995cc29de7aa823afdd75aaaddc1419b","affectsGlobalScope":true,"impliedFormat":1},{"version":"b77e16112127a4b169ef0b8c3a4d730edf459c5f25fe52d5e436a6919206c4d7","affectsGlobalScope":true,"impliedFormat":1},{"version":"fbffd9337146eff822c7c00acbb78b01ea7ea23987f6c961eba689349e744f8c","affectsGlobalScope":true,"impliedFormat":1},{"version":"a995c0e49b721312f74fdfb89e4ba29bd9824c770bbb4021d74d2bf560e4c6bd","affectsGlobalScope":true,"impliedFormat":1},{"version":"c7b3542146734342e440a84b213384bfa188835537ddbda50d30766f0593aff9","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce6180fa19b1cccd07ee7f7dbb9a367ac19c0ed160573e4686425060b6df7f57","affectsGlobalScope":true,"impliedFormat":1},{"version":"3f02e2476bccb9dbe21280d6090f0df17d2f66b74711489415a8aa4df73c9675","affectsGlobalScope":true,"impliedFormat":1},{"version":"45e3ab34c1c013c8ab2dc1ba4c80c780744b13b5676800ae2e3be27ae862c40c","affectsGlobalScope":true,"impliedFormat":1},{"version":"805c86f6cca8d7702a62a844856dbaa2a3fd2abef0536e65d48732441dde5b5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"e42e397f1a5a77994f0185fd1466520691456c772d06bf843e5084ceb879a0ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"f4c2b41f90c95b1c532ecc874bd3c111865793b23aebcc1c3cbbabcd5d76ffb0","affectsGlobalScope":true,"impliedFormat":1},{"version":"ab26191cfad5b66afa11b8bf935ef1cd88fabfcb28d30b2dfa6fad877d050332","affectsGlobalScope":true,"impliedFormat":1},{"version":"2088bc26531e38fb05eedac2951480db5309f6be3fa4a08d2221abb0f5b4200d","affectsGlobalScope":true,"impliedFormat":1},{"version":"cb9d366c425fea79716a8fb3af0d78e6b22ebbab3bd64d25063b42dc9f531c1e","affectsGlobalScope":true,"impliedFormat":1},{"version":"500934a8089c26d57ebdb688fc9757389bb6207a3c8f0674d68efa900d2abb34","affectsGlobalScope":true,"impliedFormat":1},{"version":"689da16f46e647cef0d64b0def88910e818a5877ca5379ede156ca3afb780ac3","affectsGlobalScope":true,"impliedFormat":1},{"version":"bc21cc8b6fee4f4c2440d08035b7ea3c06b3511314c8bab6bef7a92de58a2593","affectsGlobalScope":true,"impliedFormat":1},{"version":"7ca53d13d2957003abb47922a71866ba7cb2068f8d154877c596d63c359fed25","affectsGlobalScope":true,"impliedFormat":1},{"version":"54725f8c4df3d900cb4dac84b64689ce29548da0b4e9b7c2de61d41c79293611","affectsGlobalScope":true,"impliedFormat":1},{"version":"e5594bc3076ac29e6c1ebda77939bc4c8833de72f654b6e376862c0473199323","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f3eb332c2d73e729f3364fcc0c2b375e72a121e8157d25a82d67a138c83a95c","affectsGlobalScope":true,"impliedFormat":1},{"version":"6f4427f9642ce8d500970e4e69d1397f64072ab73b97e476b4002a646ac743b1","affectsGlobalScope":true,"impliedFormat":1},{"version":"48915f327cd1dea4d7bd358d9dc7732f58f9e1626a29cc0c05c8c692419d9bb7","affectsGlobalScope":true,"impliedFormat":1},{"version":"b7bf9377723203b5a6a4b920164df22d56a43f593269ba6ae1fdc97774b68855","affectsGlobalScope":true,"impliedFormat":1},{"version":"db9709688f82c9e5f65a119c64d835f906efe5f559d08b11642d56eb85b79357","affectsGlobalScope":true,"impliedFormat":1},{"version":"4b25b8c874acd1a4cf8444c3617e037d444d19080ac9f634b405583fd10ce1f7","affectsGlobalScope":true,"impliedFormat":1},{"version":"37be57d7c90cf1f8112ee2636a068d8fd181289f82b744160ec56a7dc158a9f5","affectsGlobalScope":true,"impliedFormat":1},{"version":"a917a49ac94cd26b754ab84e113369a75d1a47a710661d7cd25e961cc797065f","affectsGlobalScope":true,"impliedFormat":1},{"version":"6d3261badeb7843d157ef3e6f5d1427d0eeb0af0cf9df84a62cfd29fd47ac86e","affectsGlobalScope":true,"impliedFormat":1},{"version":"195daca651dde22f2167ac0d0a05e215308119a3100f5e6268e8317d05a92526","affectsGlobalScope":true,"impliedFormat":1},{"version":"8b11e4285cd2bb164a4dc09248bdec69e9842517db4ca47c1ba913011e44ff2f","affectsGlobalScope":true,"impliedFormat":1},{"version":"0508571a52475e245b02bc50fa1394065a0a3d05277fbf5120c3784b85651799","affectsGlobalScope":true,"impliedFormat":1},{"version":"8f9af488f510c3015af3cc8c267a9e9d96c4dd38a1fdff0e11dc5a544711415b","affectsGlobalScope":true,"impliedFormat":1},{"version":"fc611fea8d30ea72c6bbfb599c9b4d393ce22e2f5bfef2172534781e7d138104","affectsGlobalScope":true,"impliedFormat":1},{"version":"1ce14b81c5cc821994aa8ec1d42b220dd41b27fcc06373bce3958af7421b77d4","affectsGlobalScope":true,"impliedFormat":1},{"version":"b3a048b3e9302ef9a34ef4ebb9aecfb28b66abb3bce577206a79fee559c230da","affectsGlobalScope":true,"impliedFormat":1},"089e5f6343a272f3dc70f597665b75c8574b02ac052fdf962ccea821459d7aa8","42526b6de804c10fd86f1cf55a6c660a74ee448e381f0f78356f223b75982280","28914adcfb92fa94199e1c887da7d67a7d9d736d9571627d6b02e55ff82f577b","b0a69607a92876948c2a42e3aa6703b0d724699468ed7e3c6e2a237d119a9db9","cdacb8e4ac607a46494d1187e073382c43e7269e8bf698502a285a8ccb470925","f5091ebbd718ea236a7f503df569deb07aff0621aa8f73ed90e419de88f006aa","d3a328c0eccf652bc8b6c14515a8b848a558b9d684e15a7c0c2e15de5016df57","1b5193795ee478857bf1115fed004151284dd4da883a5a4f22e62631c3b414ad","3be01044afc63501423c361deb531d3e95f5c2677f1f7a628802bd346988d62c","78d8d1ca7d54a437702c8a8c08764b6a49f2cf2ca357d0e459bfe89a06abf50a",{"version":"22125c9146a4307b82309d55f0d6294de934cd858727a9ea9e7231e6239ef53a","signature":"99a875326ccd0ee7adc8e118028527d11aa3672f86a60c75f980db3ad3bba2b8"},{"version":"f8b05d02e0438b110775e1efeffbce5d1bb341d8506bea863f06907fcc5fe88d","signature":"19823e5af4854c07c4d4dcb40fc1e54092d2dc4d0370002994339d5e0e72316a"},{"version":"8c9990964f963b4b47e02951d2fbd8546c65d56362337ff8548a05f3e3d02f85","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"}],"root":[60,[70,72]],"options":{"composite":true,"declaration":true,"declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":true,"module":99,"outDir":"./types","rootDir":"../src","skipLibCheck":true,"sourceMap":true,"strict":true,"target":9},"referencedMap":[[70,1],[71,2],[72,3],[69,4],[65,5],[67,6]],"latestChangedDtsFile":"./types/register.d.ts","version":"6.0.3"}
|
|
1
|
+
{"fileNames":["../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2021.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.date.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2021.promise.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2021.string.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2021.intl.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.array.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.intl.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.object.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.string.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.decorators.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../src/duskmoon-core.d.ts","../../../packages/base/dist/types/base-element.d.ts","../../../packages/base/dist/types/styles.d.ts","../../../packages/base/dist/types/animations.d.ts","../../../packages/base/dist/types/themes.d.ts","../../../packages/base/dist/types/mixins.d.ts","../../../packages/base/dist/types/types.d.ts","../../../packages/base/dist/types/validation.d.ts","../../../packages/base/dist/types/performance.d.ts","../../../packages/base/dist/types/index.d.ts","../src/el-dm-pagination.ts","../src/index.ts","../src/register.ts"],"fileIdsList":[[69],[70],[71],[61,62,63,64,65,66,67,68],[61],[66]],"fileInfos":[{"version":"bcd24271a113971ba9eb71ff8cb01bc6b0f872a85c23fdbe5d93065b375933cd","affectsGlobalScope":true,"impliedFormat":1},{"version":"3f88bedbeb09c6f5a6645cb24c7c55f1aa22d19ae96c8e6959cbd8b85a707bc6","impliedFormat":1},{"version":"7fe93b39b810eadd916be8db880dd7f0f7012a5cc6ffb62de8f62a2117fa6f1f","impliedFormat":1},{"version":"bb0074cc08b84a2374af33d8bf044b80851ccc9e719a5e202eacf40db2c31600","impliedFormat":1},{"version":"1a7daebe4f45fb03d9ec53d60008fbf9ac45a697fdc89e4ce218bc94b94f94d6","impliedFormat":1},{"version":"f94b133a3cb14a288803be545ac2683e0d0ff6661bcd37e31aaaec54fc382aed","impliedFormat":1},{"version":"f59d0650799f8782fd74cf73c19223730c6d1b9198671b1c5b3a38e1188b5953","impliedFormat":1},{"version":"8a15b4607d9a499e2dbeed9ec0d3c0d7372c850b2d5f1fb259e8f6d41d468a84","impliedFormat":1},{"version":"26e0fe14baee4e127f4365d1ae0b276f400562e45e19e35fd2d4c296684715e6","impliedFormat":1},{"version":"d6b1eba8496bdd0eed6fc8a685768fe01b2da4a0388b5fe7df558290bffcf32f","affectsGlobalScope":true,"impliedFormat":1},{"version":"7f57fc4404ff020bc45b9c620aff2b40f700b95fe31164024c453a5e3c163c54","impliedFormat":1},{"version":"eadcffda2aa84802c73938e589b9e58248d74c59cb7fcbca6474e3435ac15504","affectsGlobalScope":true,"impliedFormat":1},{"version":"105ba8ff7ba746404fe1a2e189d1d3d2e0eb29a08c18dded791af02f29fb4711","affectsGlobalScope":true,"impliedFormat":1},{"version":"00343ca5b2e3d48fa5df1db6e32ea2a59afab09590274a6cccb1dbae82e60c7c","affectsGlobalScope":true,"impliedFormat":1},{"version":"ebd9f816d4002697cb2864bea1f0b70a103124e18a8cd9645eeccc09bdf80ab4","affectsGlobalScope":true,"impliedFormat":1},{"version":"2c1afac30a01772cd2a9a298a7ce7706b5892e447bb46bdbeef720f7b5da77ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"7b0225f483e4fa685625ebe43dd584bb7973bbd84e66a6ba7bbe175ee1048b4f","affectsGlobalScope":true,"impliedFormat":1},{"version":"c0a4b8ac6ce74679c1da2b3795296f5896e31c38e888469a8e0f99dc3305de60","affectsGlobalScope":true,"impliedFormat":1},{"version":"3084a7b5f569088e0146533a00830e206565de65cae2239509168b11434cd84f","affectsGlobalScope":true,"impliedFormat":1},{"version":"c5079c53f0f141a0698faa903e76cb41cd664e3efb01cc17a5c46ec2eb0bef42","affectsGlobalScope":true,"impliedFormat":1},{"version":"32cafbc484dea6b0ab62cf8473182bbcb23020d70845b406f80b7526f38ae862","affectsGlobalScope":true,"impliedFormat":1},{"version":"fca4cdcb6d6c5ef18a869003d02c9f0fd95df8cfaf6eb431cd3376bc034cad36","affectsGlobalScope":true,"impliedFormat":1},{"version":"b93ec88115de9a9dc1b602291b85baf825c85666bf25985cc5f698073892b467","affectsGlobalScope":true,"impliedFormat":1},{"version":"f5c06dcc3fe849fcb297c247865a161f995cc29de7aa823afdd75aaaddc1419b","affectsGlobalScope":true,"impliedFormat":1},{"version":"b77e16112127a4b169ef0b8c3a4d730edf459c5f25fe52d5e436a6919206c4d7","affectsGlobalScope":true,"impliedFormat":1},{"version":"fbffd9337146eff822c7c00acbb78b01ea7ea23987f6c961eba689349e744f8c","affectsGlobalScope":true,"impliedFormat":1},{"version":"a995c0e49b721312f74fdfb89e4ba29bd9824c770bbb4021d74d2bf560e4c6bd","affectsGlobalScope":true,"impliedFormat":1},{"version":"c7b3542146734342e440a84b213384bfa188835537ddbda50d30766f0593aff9","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce6180fa19b1cccd07ee7f7dbb9a367ac19c0ed160573e4686425060b6df7f57","affectsGlobalScope":true,"impliedFormat":1},{"version":"3f02e2476bccb9dbe21280d6090f0df17d2f66b74711489415a8aa4df73c9675","affectsGlobalScope":true,"impliedFormat":1},{"version":"45e3ab34c1c013c8ab2dc1ba4c80c780744b13b5676800ae2e3be27ae862c40c","affectsGlobalScope":true,"impliedFormat":1},{"version":"805c86f6cca8d7702a62a844856dbaa2a3fd2abef0536e65d48732441dde5b5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"e42e397f1a5a77994f0185fd1466520691456c772d06bf843e5084ceb879a0ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"f4c2b41f90c95b1c532ecc874bd3c111865793b23aebcc1c3cbbabcd5d76ffb0","affectsGlobalScope":true,"impliedFormat":1},{"version":"ab26191cfad5b66afa11b8bf935ef1cd88fabfcb28d30b2dfa6fad877d050332","affectsGlobalScope":true,"impliedFormat":1},{"version":"2088bc26531e38fb05eedac2951480db5309f6be3fa4a08d2221abb0f5b4200d","affectsGlobalScope":true,"impliedFormat":1},{"version":"cb9d366c425fea79716a8fb3af0d78e6b22ebbab3bd64d25063b42dc9f531c1e","affectsGlobalScope":true,"impliedFormat":1},{"version":"500934a8089c26d57ebdb688fc9757389bb6207a3c8f0674d68efa900d2abb34","affectsGlobalScope":true,"impliedFormat":1},{"version":"689da16f46e647cef0d64b0def88910e818a5877ca5379ede156ca3afb780ac3","affectsGlobalScope":true,"impliedFormat":1},{"version":"bc21cc8b6fee4f4c2440d08035b7ea3c06b3511314c8bab6bef7a92de58a2593","affectsGlobalScope":true,"impliedFormat":1},{"version":"7ca53d13d2957003abb47922a71866ba7cb2068f8d154877c596d63c359fed25","affectsGlobalScope":true,"impliedFormat":1},{"version":"54725f8c4df3d900cb4dac84b64689ce29548da0b4e9b7c2de61d41c79293611","affectsGlobalScope":true,"impliedFormat":1},{"version":"e5594bc3076ac29e6c1ebda77939bc4c8833de72f654b6e376862c0473199323","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f3eb332c2d73e729f3364fcc0c2b375e72a121e8157d25a82d67a138c83a95c","affectsGlobalScope":true,"impliedFormat":1},{"version":"6f4427f9642ce8d500970e4e69d1397f64072ab73b97e476b4002a646ac743b1","affectsGlobalScope":true,"impliedFormat":1},{"version":"48915f327cd1dea4d7bd358d9dc7732f58f9e1626a29cc0c05c8c692419d9bb7","affectsGlobalScope":true,"impliedFormat":1},{"version":"b7bf9377723203b5a6a4b920164df22d56a43f593269ba6ae1fdc97774b68855","affectsGlobalScope":true,"impliedFormat":1},{"version":"db9709688f82c9e5f65a119c64d835f906efe5f559d08b11642d56eb85b79357","affectsGlobalScope":true,"impliedFormat":1},{"version":"4b25b8c874acd1a4cf8444c3617e037d444d19080ac9f634b405583fd10ce1f7","affectsGlobalScope":true,"impliedFormat":1},{"version":"37be57d7c90cf1f8112ee2636a068d8fd181289f82b744160ec56a7dc158a9f5","affectsGlobalScope":true,"impliedFormat":1},{"version":"a917a49ac94cd26b754ab84e113369a75d1a47a710661d7cd25e961cc797065f","affectsGlobalScope":true,"impliedFormat":1},{"version":"6d3261badeb7843d157ef3e6f5d1427d0eeb0af0cf9df84a62cfd29fd47ac86e","affectsGlobalScope":true,"impliedFormat":1},{"version":"195daca651dde22f2167ac0d0a05e215308119a3100f5e6268e8317d05a92526","affectsGlobalScope":true,"impliedFormat":1},{"version":"8b11e4285cd2bb164a4dc09248bdec69e9842517db4ca47c1ba913011e44ff2f","affectsGlobalScope":true,"impliedFormat":1},{"version":"0508571a52475e245b02bc50fa1394065a0a3d05277fbf5120c3784b85651799","affectsGlobalScope":true,"impliedFormat":1},{"version":"8f9af488f510c3015af3cc8c267a9e9d96c4dd38a1fdff0e11dc5a544711415b","affectsGlobalScope":true,"impliedFormat":1},{"version":"fc611fea8d30ea72c6bbfb599c9b4d393ce22e2f5bfef2172534781e7d138104","affectsGlobalScope":true,"impliedFormat":1},{"version":"1ce14b81c5cc821994aa8ec1d42b220dd41b27fcc06373bce3958af7421b77d4","affectsGlobalScope":true,"impliedFormat":1},{"version":"b3a048b3e9302ef9a34ef4ebb9aecfb28b66abb3bce577206a79fee559c230da","affectsGlobalScope":true,"impliedFormat":1},"089e5f6343a272f3dc70f597665b75c8574b02ac052fdf962ccea821459d7aa8","42526b6de804c10fd86f1cf55a6c660a74ee448e381f0f78356f223b75982280","28914adcfb92fa94199e1c887da7d67a7d9d736d9571627d6b02e55ff82f577b","b0a69607a92876948c2a42e3aa6703b0d724699468ed7e3c6e2a237d119a9db9","cdacb8e4ac607a46494d1187e073382c43e7269e8bf698502a285a8ccb470925","f5091ebbd718ea236a7f503df569deb07aff0621aa8f73ed90e419de88f006aa","d3a328c0eccf652bc8b6c14515a8b848a558b9d684e15a7c0c2e15de5016df57","1b5193795ee478857bf1115fed004151284dd4da883a5a4f22e62631c3b414ad","3be01044afc63501423c361deb531d3e95f5c2677f1f7a628802bd346988d62c","78d8d1ca7d54a437702c8a8c08764b6a49f2cf2ca357d0e459bfe89a06abf50a",{"version":"d537933a91a8c3179bbbe425e58d6ce9ae529d29b024e7f088a3ecc83c8138ab","signature":"9fd03993f8f72149efe3586eb79f1d209c23b96764a95d990373fd27461c7c08"},{"version":"f8b05d02e0438b110775e1efeffbce5d1bb341d8506bea863f06907fcc5fe88d","signature":"19823e5af4854c07c4d4dcb40fc1e54092d2dc4d0370002994339d5e0e72316a"},{"version":"8c9990964f963b4b47e02951d2fbd8546c65d56362337ff8548a05f3e3d02f85","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"}],"root":[60,[70,72]],"options":{"composite":true,"declaration":true,"declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":true,"module":99,"outDir":"./types","rootDir":"../src","skipLibCheck":true,"sourceMap":true,"strict":true,"target":9},"referencedMap":[[70,1],[71,2],[72,3],[69,4],[65,5],[67,6]],"latestChangedDtsFile":"./types/register.d.ts","version":"6.0.3"}
|
|
@@ -13,6 +13,11 @@
|
|
|
13
13
|
* @attr {string} size - Button size: xs, sm, md, lg
|
|
14
14
|
* @attr {string} color - Color variant: primary, secondary, neutral
|
|
15
15
|
*
|
|
16
|
+
* @slot prev - Declarative server-rendered previous-page control
|
|
17
|
+
* @slot previous - Alias for the declarative previous-page control
|
|
18
|
+
* @slot page - Declarative server-rendered page or ellipsis control
|
|
19
|
+
* @slot next - Declarative server-rendered next-page control
|
|
20
|
+
*
|
|
16
21
|
* @csspart container - The pagination container
|
|
17
22
|
* @csspart button - Navigation buttons (first, prev, next, last)
|
|
18
23
|
* @csspart page - Page number buttons
|
|
@@ -66,12 +71,15 @@ export declare class ElDmPagination extends BaseElement {
|
|
|
66
71
|
size: PaginationSize;
|
|
67
72
|
/** Color variant: primary, secondary, neutral */
|
|
68
73
|
color: PaginationColor;
|
|
74
|
+
private _controlsObserver?;
|
|
69
75
|
constructor();
|
|
70
76
|
connectedCallback(): void;
|
|
77
|
+
disconnectedCallback(): void;
|
|
71
78
|
/**
|
|
72
79
|
* Calculate the range of page numbers to display
|
|
73
80
|
*/
|
|
74
81
|
private _getPageRange;
|
|
82
|
+
private _hasDeclarativeControls;
|
|
75
83
|
/**
|
|
76
84
|
* Navigate to a specific page
|
|
77
85
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"el-dm-pagination.d.ts","sourceRoot":"","sources":["../../src/el-dm-pagination.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"el-dm-pagination.d.ts","sourceRoot":"","sources":["../../src/el-dm-pagination.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,WAAW,EAAO,MAAM,uBAAuB,CAAC;AAEzD,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AACvD,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,CAAC;AAuLlE,qBAAa,cAAe,SAAQ,WAAW;IAC7C,MAAM,CAAC,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAOf;IAEF,4BAA4B;IACpB,KAAK,EAAE,MAAM,CAAC;IAEtB,sCAAsC;IAC9B,OAAO,EAAE,MAAM,CAAC;IAExB,oDAAoD;IAC5C,QAAQ,EAAE,MAAM,CAAC;IAEzB,iDAAiD;IACzC,UAAU,EAAE,MAAM,CAAC;IAE3B,kCAAkC;IAC1B,IAAI,EAAE,cAAc,CAAC;IAE7B,iDAAiD;IACzC,KAAK,EAAE,eAAe,CAAC;IAE/B,OAAO,CAAC,iBAAiB,CAAC,CAAmB;;IAO7C,iBAAiB,IAAI,IAAI;IAazB,oBAAoB,IAAI,IAAI;IAK5B;;OAEG;IACH,OAAO,CAAC,aAAa;IAwDrB,OAAO,CAAC,uBAAuB;IAM/B;;OAEG;IACH,OAAO,CAAC,SAAS;IAQjB;;OAEG;IACH,OAAO,CAAC,YAAY;IAwBpB;;OAEG;IACH,OAAO,CAAC,cAAc;IAuBtB,MAAM,IAAI,MAAM;CA0EjB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@duskmoon-dev/el-pagination",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -39,11 +39,11 @@
|
|
|
39
39
|
"release:dry-run": "bun publish --dry-run"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@duskmoon-dev/el-base": "1.
|
|
43
|
-
"@duskmoon-dev/core": "1.17.
|
|
42
|
+
"@duskmoon-dev/el-base": "1.6.0",
|
|
43
|
+
"@duskmoon-dev/core": "1.17.2"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"typescript": "
|
|
46
|
+
"typescript": "6.0.3"
|
|
47
47
|
},
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public"
|