@phatvu/web-component-poc 1.0.5 → 1.0.7
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/fast-button.cjs.entry.js +46 -0
- package/dist/cjs/{fast-button_4.cjs.entry.js → fast-carousel.cjs.entry.js} +1 -231
- package/dist/cjs/fast-input_4.cjs.entry.js +499 -0
- package/dist/cjs/{index-B2BTpdbN.js → index-BEvZs91D.js} +2 -2
- package/dist/cjs/job-card.cjs.entry.js +138 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/web-component-poc.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +4 -1
- package/dist/collection/components/button/button.js +2 -2
- package/dist/collection/components/fast-input/fast-input.css +55 -0
- package/dist/collection/components/fast-input/fast-input.js +335 -0
- package/dist/collection/components/job-card/job-card.css +247 -0
- package/dist/collection/components/job-card/job-card.js +435 -0
- package/dist/collection/components/jobs-item/jobs-item.js +5 -5
- package/dist/collection/components/jobs-list-only/jobs-list-only.js +185 -8
- package/dist/collection/components/jobs-list-reactive/jobs-list-reactive.css +8 -0
- package/dist/collection/components/jobs-list-reactive/jobs-list-reactive.js +203 -0
- package/dist/components/fast-button.js +1 -1
- package/dist/components/fast-carousel.js +1 -1
- package/dist/components/fast-input.d.ts +11 -0
- package/dist/components/fast-input.js +1 -0
- package/dist/components/index.js +1 -1
- package/dist/components/job-card.d.ts +11 -0
- package/dist/components/job-card.js +1 -0
- package/dist/components/jobs-item.js +1 -1
- package/dist/components/jobs-list-only.js +1 -1
- package/dist/components/jobs-list-reactive.d.ts +11 -0
- package/dist/components/jobs-list-reactive.js +1 -0
- package/dist/components/{p-ClQDwJJB.js → p-DQiaLjLf.js} +1 -1
- package/dist/esm/fast-button.entry.js +44 -0
- package/dist/esm/{fast-button_4.entry.js → fast-carousel.entry.js} +2 -229
- package/dist/esm/fast-input_4.entry.js +494 -0
- package/dist/esm/{index-Dk5CvWmb.js → index-C_ZLQIpp.js} +2 -2
- package/dist/esm/job-card.entry.js +136 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/web-component-poc.js +3 -3
- package/dist/types/components/fast-input/fast-input.d.ts +37 -0
- package/dist/types/components/job-card/job-card.d.ts +93 -0
- package/dist/types/components/jobs-item/jobs-item.d.ts +2 -2
- package/dist/types/components/jobs-list-only/jobs-list-only.d.ts +24 -2
- package/dist/types/components/jobs-list-reactive/jobs-list-reactive.d.ts +26 -0
- package/dist/types/components.d.ts +469 -7
- package/dist/types/mock/jobs-list-only.mock.d.ts +2 -2
- package/dist/types/types/jobs-list.d.ts +6 -2
- package/dist/web-component-poc/p-618fba28.entry.js +1 -0
- package/dist/web-component-poc/p-7d45772f.entry.js +1 -0
- package/dist/web-component-poc/p-bef7c8e2.entry.js +1 -0
- package/dist/web-component-poc/p-cfb9aed9.entry.js +1 -0
- package/dist/web-component-poc/web-component-poc.esm.js +1 -1
- package/hydrate/index.js +534 -6
- package/hydrate/index.mjs +534 -6
- package/package.json +9 -1
- package/dist/web-component-poc/p-df843533.entry.js +0 -1
- /package/dist/components/{p-UM9TUfe3.js → p-BiaJAQXY.js} +0 -0
- /package/dist/web-component-poc/{p-Dk5CvWmb.js → p-C_ZLQIpp.js} +0 -0
|
@@ -25,16 +25,84 @@ export class JobsListOnly {
|
|
|
25
25
|
enableKilometers = false;
|
|
26
26
|
/** Extra CSS class on the root element (avoid prop name "class" / "classname" reserved). */
|
|
27
27
|
rootClass = '';
|
|
28
|
+
/** Template string for count display. Tokens: {count} = jobs on page, {total} = total from API. */
|
|
29
|
+
showCountText = '';
|
|
28
30
|
showSuggestions = false;
|
|
29
31
|
clearResultSuggestionsTitleText = 'Suggestions';
|
|
30
32
|
clearResultSuggestionsLine1 = 'Try different keywords';
|
|
31
33
|
clearResultSuggestionsLine2 = 'Make sure everything is spelled correctly';
|
|
32
34
|
clearResultSuggestionsLine3 = 'Try other locations';
|
|
33
35
|
clearResultSuggestionsLine4 = '';
|
|
36
|
+
/** When true, component manages its own data fetching */
|
|
37
|
+
autoFetch = false;
|
|
38
|
+
/** Jobs search endpoint */
|
|
39
|
+
apiUrl = '/api/get-jobs';
|
|
40
|
+
/** Comma-separated URL param names to watch and forward to the API */
|
|
41
|
+
watchParams = 'keyword';
|
|
42
|
+
fetchedJobs = [];
|
|
43
|
+
fetchedTotal = 0;
|
|
44
|
+
fetchLoading = false;
|
|
45
|
+
fetchComplete;
|
|
46
|
+
searchExecutedHandler;
|
|
47
|
+
popstateHandler;
|
|
48
|
+
connectedCallback() {
|
|
49
|
+
if (this.autoFetch) {
|
|
50
|
+
this.fetchJobs();
|
|
51
|
+
this.searchExecutedHandler = () => this.fetchJobs();
|
|
52
|
+
this.popstateHandler = () => this.fetchJobs();
|
|
53
|
+
document.addEventListener('search-executed', this.searchExecutedHandler);
|
|
54
|
+
window.addEventListener('popstate', this.popstateHandler);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
disconnectedCallback() {
|
|
58
|
+
if (this.autoFetch) {
|
|
59
|
+
document.removeEventListener('search-executed', this.searchExecutedHandler);
|
|
60
|
+
window.removeEventListener('popstate', this.popstateHandler);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
async fetchJobs() {
|
|
64
|
+
this.fetchLoading = true;
|
|
65
|
+
const params = new URLSearchParams(window.location.search);
|
|
66
|
+
const watchList = this.watchParams.split(',').map(p => p.trim()).filter(Boolean);
|
|
67
|
+
const query = new URLSearchParams();
|
|
68
|
+
for (const key of watchList) {
|
|
69
|
+
const val = params.get(key);
|
|
70
|
+
if (val !== null)
|
|
71
|
+
query.set(key, val);
|
|
72
|
+
}
|
|
73
|
+
const url = `${this.apiUrl}?${query.toString()}`;
|
|
74
|
+
try {
|
|
75
|
+
const res = await fetch(url, {
|
|
76
|
+
method: 'POST',
|
|
77
|
+
headers: { 'Content-Type': 'application/json' },
|
|
78
|
+
body: JSON.stringify({ disable_switch_search_mode: false }),
|
|
79
|
+
});
|
|
80
|
+
if (!res.ok)
|
|
81
|
+
throw new Error('fetch failed');
|
|
82
|
+
const data = await res.json();
|
|
83
|
+
this.fetchedJobs = data.jobs;
|
|
84
|
+
this.fetchedTotal = data.totalJob;
|
|
85
|
+
this.fetchComplete.emit({ jobs: data.jobs, totalJob: data.totalJob });
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
// preserve stale data, just stop loading
|
|
89
|
+
}
|
|
90
|
+
finally {
|
|
91
|
+
this.fetchLoading = false;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
renderCountText(count, total) {
|
|
95
|
+
return this.showCountText
|
|
96
|
+
.replace('{count}', String(count))
|
|
97
|
+
.replace('{total}', String(total));
|
|
98
|
+
}
|
|
34
99
|
getJobsArray() {
|
|
35
100
|
if (this.mockData) {
|
|
36
101
|
return mockJobsListOnly;
|
|
37
102
|
}
|
|
103
|
+
if (this.autoFetch) {
|
|
104
|
+
return this.fetchedJobs;
|
|
105
|
+
}
|
|
38
106
|
const j = this.jobs;
|
|
39
107
|
if (Array.isArray(j))
|
|
40
108
|
return j;
|
|
@@ -54,11 +122,15 @@ export class JobsListOnly {
|
|
|
54
122
|
}
|
|
55
123
|
render() {
|
|
56
124
|
const jobsArray = this.getJobsArray();
|
|
57
|
-
const loading = this.mockData ? false : this.loading;
|
|
58
|
-
const totalJob = this.mockData
|
|
125
|
+
const loading = this.mockData ? false : (this.autoFetch ? this.fetchLoading : this.loading);
|
|
126
|
+
const totalJob = this.mockData
|
|
127
|
+
? jobsArray.length
|
|
128
|
+
: this.autoFetch
|
|
129
|
+
? this.fetchedTotal
|
|
130
|
+
: (this.totalJob || jobsArray.length);
|
|
59
131
|
const showNoResults = !loading && totalJob === 0 && !this.showSuggestions;
|
|
60
132
|
const showSuggestionsBlock = !loading && totalJob === 0 && this.showSuggestions;
|
|
61
|
-
return (h("div", { key: '
|
|
133
|
+
return (h("div", { key: '1116855473d28d650641b9d962243bfcdcb434ec', class: `jobs-list-root ${this.rootClass}`.trim() }, h("div", { key: 'fcef04f1da9ad4e150af9f59921688f5781d9d43', class: "results-container" }, this.autoFetch && this.fetchLoading && (h("div", { key: '75b157c82c89691c7ce73d12ea0144b3b45485c3', class: "jobs-list-only__loading" }, "Loading...")), h("div", { key: 'b09f9879e10ee4a93e32177611912da5f19f3526', class: loading ? 'loader' : 'loader hide', "aria-hidden": !loading }), totalJob > 0 && this.showCountText && (h("p", { key: 'd10f800fb0a33d82531d5f1728bac4ceba2ed577', class: "jobs-list-only__count" }, this.renderCountText(jobsArray.length, totalJob))), totalJob > 0 && (h("div", { key: '18153ed1338bd48f7be4f043b11ce15e3271f27b', class: "card" }, h("ul", { key: '766e128b1fd5adb456530ae39e92ba8eb0b5d6cf', class: "results-list front" }, jobsArray.map((job, index) => this.renderJobItem(job, index))))), showNoResults && (h("div", { key: 'ed6f3d2bd2bbedabd6e69d508ea1425580e6941f', class: "share-jobs__no-results" }, h("h2", { key: '2302656e33340c69e84cb949afb7256b8f35f440' }, this.noResultsLine1), h("h3", { key: '1c7e6642441a96c04ee26883fdec4f81b0fe6cec' }, this.noResultsLine2))), showSuggestionsBlock && (h("div", { key: 'be7af85f64455918545e88952ca6ff00f0a970c5', class: "card primary-color" }, h("h4", { key: '2f63deb8131190eff882308544b15f767b6f3edc', class: "result-suggestions-title" }, this.clearResultSuggestionsTitleText, ":"), h("ul", { key: 'cb18daaa9e2c2c442c5b906ed370dcd653b5262d', class: "results-list front" }, h("li", { key: 'ff1d5c6518b75c0daa35b43df7162b0dfecde25e', class: "result-suggestions-line" }, this.clearResultSuggestionsLine1), h("li", { key: '4099fd7bf8dcf114eca28702a498ab0938f5de46', class: "result-suggestions-line" }, this.clearResultSuggestionsLine2), h("li", { key: 'fb65b54c3c0b14bc58112977eb4c7c56c1246a45', class: "result-suggestions-line" }, this.clearResultSuggestionsLine3), this.clearResultSuggestionsLine4 && (h("li", { key: '10f745e74cf68a2b1c42e6f49f810a8b59eb27b6', class: "result-suggestions-line" }, this.clearResultSuggestionsLine4))))))));
|
|
62
134
|
}
|
|
63
135
|
static get is() { return "jobs-list-only"; }
|
|
64
136
|
static get originalStyleUrls() {
|
|
@@ -97,14 +169,14 @@ export class JobsListOnly {
|
|
|
97
169
|
"type": "string",
|
|
98
170
|
"mutable": false,
|
|
99
171
|
"complexType": {
|
|
100
|
-
"original": "
|
|
101
|
-
"resolved": "
|
|
172
|
+
"original": "Job[] | string",
|
|
173
|
+
"resolved": "Job[] | string",
|
|
102
174
|
"references": {
|
|
103
|
-
"
|
|
175
|
+
"Job": {
|
|
104
176
|
"location": "import",
|
|
105
177
|
"path": "../../types/jobs-list",
|
|
106
|
-
"id": "src/types/jobs-list.ts::
|
|
107
|
-
"referenceLocation": "
|
|
178
|
+
"id": "src/types/jobs-list.ts::Job",
|
|
179
|
+
"referenceLocation": "Job"
|
|
108
180
|
}
|
|
109
181
|
}
|
|
110
182
|
},
|
|
@@ -380,6 +452,26 @@ export class JobsListOnly {
|
|
|
380
452
|
"attribute": "root-class",
|
|
381
453
|
"defaultValue": "''"
|
|
382
454
|
},
|
|
455
|
+
"showCountText": {
|
|
456
|
+
"type": "string",
|
|
457
|
+
"mutable": false,
|
|
458
|
+
"complexType": {
|
|
459
|
+
"original": "string",
|
|
460
|
+
"resolved": "string",
|
|
461
|
+
"references": {}
|
|
462
|
+
},
|
|
463
|
+
"required": false,
|
|
464
|
+
"optional": false,
|
|
465
|
+
"docs": {
|
|
466
|
+
"tags": [],
|
|
467
|
+
"text": "Template string for count display. Tokens: {count} = jobs on page, {total} = total from API."
|
|
468
|
+
},
|
|
469
|
+
"getter": false,
|
|
470
|
+
"setter": false,
|
|
471
|
+
"reflect": false,
|
|
472
|
+
"attribute": "show-count-text",
|
|
473
|
+
"defaultValue": "''"
|
|
474
|
+
},
|
|
383
475
|
"showSuggestions": {
|
|
384
476
|
"type": "boolean",
|
|
385
477
|
"mutable": false,
|
|
@@ -499,7 +591,92 @@ export class JobsListOnly {
|
|
|
499
591
|
"reflect": false,
|
|
500
592
|
"attribute": "clear-result-suggestions-line-4",
|
|
501
593
|
"defaultValue": "''"
|
|
594
|
+
},
|
|
595
|
+
"autoFetch": {
|
|
596
|
+
"type": "boolean",
|
|
597
|
+
"mutable": false,
|
|
598
|
+
"complexType": {
|
|
599
|
+
"original": "boolean",
|
|
600
|
+
"resolved": "boolean",
|
|
601
|
+
"references": {}
|
|
602
|
+
},
|
|
603
|
+
"required": false,
|
|
604
|
+
"optional": false,
|
|
605
|
+
"docs": {
|
|
606
|
+
"tags": [],
|
|
607
|
+
"text": "When true, component manages its own data fetching"
|
|
608
|
+
},
|
|
609
|
+
"getter": false,
|
|
610
|
+
"setter": false,
|
|
611
|
+
"reflect": false,
|
|
612
|
+
"attribute": "auto-fetch",
|
|
613
|
+
"defaultValue": "false"
|
|
614
|
+
},
|
|
615
|
+
"apiUrl": {
|
|
616
|
+
"type": "string",
|
|
617
|
+
"mutable": false,
|
|
618
|
+
"complexType": {
|
|
619
|
+
"original": "string",
|
|
620
|
+
"resolved": "string",
|
|
621
|
+
"references": {}
|
|
622
|
+
},
|
|
623
|
+
"required": false,
|
|
624
|
+
"optional": false,
|
|
625
|
+
"docs": {
|
|
626
|
+
"tags": [],
|
|
627
|
+
"text": "Jobs search endpoint"
|
|
628
|
+
},
|
|
629
|
+
"getter": false,
|
|
630
|
+
"setter": false,
|
|
631
|
+
"reflect": false,
|
|
632
|
+
"attribute": "api-url",
|
|
633
|
+
"defaultValue": "'/api/get-jobs'"
|
|
634
|
+
},
|
|
635
|
+
"watchParams": {
|
|
636
|
+
"type": "string",
|
|
637
|
+
"mutable": false,
|
|
638
|
+
"complexType": {
|
|
639
|
+
"original": "string",
|
|
640
|
+
"resolved": "string",
|
|
641
|
+
"references": {}
|
|
642
|
+
},
|
|
643
|
+
"required": false,
|
|
644
|
+
"optional": false,
|
|
645
|
+
"docs": {
|
|
646
|
+
"tags": [],
|
|
647
|
+
"text": "Comma-separated URL param names to watch and forward to the API"
|
|
648
|
+
},
|
|
649
|
+
"getter": false,
|
|
650
|
+
"setter": false,
|
|
651
|
+
"reflect": false,
|
|
652
|
+
"attribute": "watch-params",
|
|
653
|
+
"defaultValue": "'keyword'"
|
|
502
654
|
}
|
|
503
655
|
};
|
|
504
656
|
}
|
|
657
|
+
static get states() {
|
|
658
|
+
return {
|
|
659
|
+
"fetchedJobs": {},
|
|
660
|
+
"fetchedTotal": {},
|
|
661
|
+
"fetchLoading": {}
|
|
662
|
+
};
|
|
663
|
+
}
|
|
664
|
+
static get events() {
|
|
665
|
+
return [{
|
|
666
|
+
"method": "fetchComplete",
|
|
667
|
+
"name": "fetchComplete",
|
|
668
|
+
"bubbles": true,
|
|
669
|
+
"cancelable": true,
|
|
670
|
+
"composed": true,
|
|
671
|
+
"docs": {
|
|
672
|
+
"tags": [],
|
|
673
|
+
"text": ""
|
|
674
|
+
},
|
|
675
|
+
"complexType": {
|
|
676
|
+
"original": "{ jobs: any[]; totalJob: number }",
|
|
677
|
+
"resolved": "{ jobs: any[]; totalJob: number; }",
|
|
678
|
+
"references": {}
|
|
679
|
+
}
|
|
680
|
+
}];
|
|
681
|
+
}
|
|
505
682
|
}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
export class JobsListReactive {
|
|
3
|
+
el;
|
|
4
|
+
/** Jobs search endpoint */
|
|
5
|
+
apiUrl = '/api/get-jobs';
|
|
6
|
+
/** Comma-separated URL param names to watch and forward to the API */
|
|
7
|
+
watchParams = 'keyword,location_name';
|
|
8
|
+
/** CSS class added to container while fetching */
|
|
9
|
+
loadingClass = 'loading';
|
|
10
|
+
isLoading = false;
|
|
11
|
+
fetchComplete;
|
|
12
|
+
templateEl = null;
|
|
13
|
+
searchExecutedHandler;
|
|
14
|
+
popstateHandler;
|
|
15
|
+
connectedCallback() {
|
|
16
|
+
this.templateEl = this.el.querySelector('template');
|
|
17
|
+
this.searchExecutedHandler = () => this.fetchJobs();
|
|
18
|
+
this.popstateHandler = () => this.fetchJobs();
|
|
19
|
+
document.addEventListener('search-executed', this.searchExecutedHandler);
|
|
20
|
+
window.addEventListener('popstate', this.popstateHandler);
|
|
21
|
+
}
|
|
22
|
+
disconnectedCallback() {
|
|
23
|
+
document.removeEventListener('search-executed', this.searchExecutedHandler);
|
|
24
|
+
window.removeEventListener('popstate', this.popstateHandler);
|
|
25
|
+
}
|
|
26
|
+
buildQueryString() {
|
|
27
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
28
|
+
const watchList = this.watchParams.split(',').map(p => p.trim()).filter(Boolean);
|
|
29
|
+
const query = new URLSearchParams();
|
|
30
|
+
for (const key of watchList) {
|
|
31
|
+
const val = urlParams.get(key);
|
|
32
|
+
if (val !== null && val !== '') {
|
|
33
|
+
query.set(key, val);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return query.toString();
|
|
37
|
+
}
|
|
38
|
+
async fetchJobs() {
|
|
39
|
+
this.isLoading = true;
|
|
40
|
+
this.el.classList.add(this.loadingClass);
|
|
41
|
+
const queryString = this.buildQueryString();
|
|
42
|
+
const url = queryString ? `${this.apiUrl}?${queryString}` : this.apiUrl;
|
|
43
|
+
try {
|
|
44
|
+
const res = await fetch(url, {
|
|
45
|
+
method: 'POST',
|
|
46
|
+
headers: { 'Content-Type': 'application/json' },
|
|
47
|
+
body: JSON.stringify({ disable_switch_search_mode: false }),
|
|
48
|
+
});
|
|
49
|
+
if (!res.ok)
|
|
50
|
+
throw new Error('fetch failed');
|
|
51
|
+
const data = await res.json();
|
|
52
|
+
this.renderJobs(data.jobs);
|
|
53
|
+
this.updateCountElements(data.jobs.length, data.totalJob);
|
|
54
|
+
this.fetchComplete.emit({ jobs: data.jobs, totalJob: data.totalJob });
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
// Preserve stale data on error
|
|
58
|
+
}
|
|
59
|
+
finally {
|
|
60
|
+
this.isLoading = false;
|
|
61
|
+
this.el.classList.remove(this.loadingClass);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
renderJobs(jobs) {
|
|
65
|
+
if (!this.templateEl)
|
|
66
|
+
return;
|
|
67
|
+
// Remove all children except the template
|
|
68
|
+
const children = Array.from(this.el.children);
|
|
69
|
+
for (const child of children) {
|
|
70
|
+
if (child !== this.templateEl) {
|
|
71
|
+
child.remove();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
// Clone template and render each job
|
|
75
|
+
for (const job of jobs) {
|
|
76
|
+
const clone = this.templateEl.content.cloneNode(true);
|
|
77
|
+
const jobCard = clone.querySelector('job-card');
|
|
78
|
+
if (jobCard) {
|
|
79
|
+
jobCard.setAttribute('job', JSON.stringify(job));
|
|
80
|
+
}
|
|
81
|
+
this.el.appendChild(clone);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
updateCountElements(count, total) {
|
|
85
|
+
const countEls = document.querySelectorAll('[data-job-count]');
|
|
86
|
+
const totalEls = document.querySelectorAll('[data-job-total]');
|
|
87
|
+
countEls.forEach(el => {
|
|
88
|
+
el.textContent = String(count);
|
|
89
|
+
});
|
|
90
|
+
totalEls.forEach(el => {
|
|
91
|
+
el.textContent = String(total);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
render() {
|
|
95
|
+
return h("slot", { key: '30a6fe9727eb877b6aafb99072c40811df121ba6' });
|
|
96
|
+
}
|
|
97
|
+
static get is() { return "jobs-list-reactive"; }
|
|
98
|
+
static get originalStyleUrls() {
|
|
99
|
+
return {
|
|
100
|
+
"$": ["jobs-list-reactive.css"]
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
static get styleUrls() {
|
|
104
|
+
return {
|
|
105
|
+
"$": ["jobs-list-reactive.css"]
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
static get properties() {
|
|
109
|
+
return {
|
|
110
|
+
"apiUrl": {
|
|
111
|
+
"type": "string",
|
|
112
|
+
"mutable": false,
|
|
113
|
+
"complexType": {
|
|
114
|
+
"original": "string",
|
|
115
|
+
"resolved": "string",
|
|
116
|
+
"references": {}
|
|
117
|
+
},
|
|
118
|
+
"required": false,
|
|
119
|
+
"optional": false,
|
|
120
|
+
"docs": {
|
|
121
|
+
"tags": [],
|
|
122
|
+
"text": "Jobs search endpoint"
|
|
123
|
+
},
|
|
124
|
+
"getter": false,
|
|
125
|
+
"setter": false,
|
|
126
|
+
"reflect": false,
|
|
127
|
+
"attribute": "api-url",
|
|
128
|
+
"defaultValue": "'/api/get-jobs'"
|
|
129
|
+
},
|
|
130
|
+
"watchParams": {
|
|
131
|
+
"type": "string",
|
|
132
|
+
"mutable": false,
|
|
133
|
+
"complexType": {
|
|
134
|
+
"original": "string",
|
|
135
|
+
"resolved": "string",
|
|
136
|
+
"references": {}
|
|
137
|
+
},
|
|
138
|
+
"required": false,
|
|
139
|
+
"optional": false,
|
|
140
|
+
"docs": {
|
|
141
|
+
"tags": [],
|
|
142
|
+
"text": "Comma-separated URL param names to watch and forward to the API"
|
|
143
|
+
},
|
|
144
|
+
"getter": false,
|
|
145
|
+
"setter": false,
|
|
146
|
+
"reflect": false,
|
|
147
|
+
"attribute": "watch-params",
|
|
148
|
+
"defaultValue": "'keyword,location_name'"
|
|
149
|
+
},
|
|
150
|
+
"loadingClass": {
|
|
151
|
+
"type": "string",
|
|
152
|
+
"mutable": false,
|
|
153
|
+
"complexType": {
|
|
154
|
+
"original": "string",
|
|
155
|
+
"resolved": "string",
|
|
156
|
+
"references": {}
|
|
157
|
+
},
|
|
158
|
+
"required": false,
|
|
159
|
+
"optional": false,
|
|
160
|
+
"docs": {
|
|
161
|
+
"tags": [],
|
|
162
|
+
"text": "CSS class added to container while fetching"
|
|
163
|
+
},
|
|
164
|
+
"getter": false,
|
|
165
|
+
"setter": false,
|
|
166
|
+
"reflect": false,
|
|
167
|
+
"attribute": "loading-class",
|
|
168
|
+
"defaultValue": "'loading'"
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
static get states() {
|
|
173
|
+
return {
|
|
174
|
+
"isLoading": {}
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
static get events() {
|
|
178
|
+
return [{
|
|
179
|
+
"method": "fetchComplete",
|
|
180
|
+
"name": "fetchComplete",
|
|
181
|
+
"bubbles": true,
|
|
182
|
+
"cancelable": true,
|
|
183
|
+
"composed": true,
|
|
184
|
+
"docs": {
|
|
185
|
+
"tags": [],
|
|
186
|
+
"text": ""
|
|
187
|
+
},
|
|
188
|
+
"complexType": {
|
|
189
|
+
"original": "{ jobs: Job[]; totalJob: number }",
|
|
190
|
+
"resolved": "{ jobs: Job[]; totalJob: number; }",
|
|
191
|
+
"references": {
|
|
192
|
+
"Job": {
|
|
193
|
+
"location": "import",
|
|
194
|
+
"path": "../../types/jobs-list",
|
|
195
|
+
"id": "src/types/jobs-list.ts::Job",
|
|
196
|
+
"referenceLocation": "Job"
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}];
|
|
201
|
+
}
|
|
202
|
+
static get elementRef() { return "el"; }
|
|
203
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t,p as o,H as e,c as n,h as s}from"./p-
|
|
1
|
+
import{t,p as o,H as e,c as n,h as s}from"./p-BiaJAQXY.js";const u=o(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.buttonClick=n(this,"buttonClick")}variant="primary";type="button";disabled=!1;buttonClick;handleClick=t=>{if(this.disabled)return t.preventDefault(),void t.stopPropagation();this.buttonClick.emit(t)};render(){return s("button",{key:"3b74909afe4e305dfd38f0b07657202e3d5bfccd",type:this.type,class:{"custom-button":!0,["custom-button--"+this.variant]:!0,"custom-button--disabled":this.disabled},disabled:this.disabled,onClick:this.handleClick},s("slot",{key:"49845d350e4665c5c66e30bd9262f788eaaa1e20"}))}static get style(){return":host{display:inline-block}.custom-button{display:inline-flex;align-items:center;justify-content:center;padding:0.5rem 1rem;font-family:inherit;font-size:0.875rem;font-weight:500;line-height:1.25;border:none;border-radius:0.375rem;cursor:pointer;transition:background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease}.custom-button:focus{outline:2px solid var(--custom-button-focus-ring, #2563eb);outline-offset:2px}.custom-button:focus:not(:focus-visible){outline:none}.custom-button--primary{background-color:var(--custom-button-primary-bg, #2563eb);color:var(--custom-button-primary-color, #fff)}.custom-button--primary:hover:not(.custom-button--disabled){background-color:var(--custom-button-primary-hover-bg, #1d4ed8)}.custom-button--primary:active:not(.custom-button--disabled){background-color:var(--custom-button-primary-active-bg, #1e40af)}.custom-button--secondary{background-color:var(--custom-button-secondary-bg, #e5e7eb);color:var(--custom-button-secondary-color, #1f2937)}.custom-button--secondary:hover:not(.custom-button--disabled){background-color:var(--custom-button-secondary-hover-bg, #d1d5db)}.custom-button--secondary:active:not(.custom-button--disabled){background-color:var(--custom-button-secondary-active-bg, #9ca3af)}.custom-button--text{background-color:transparent;color:var(--custom-button-text-color, #2563eb)}.custom-button--text:hover:not(.custom-button--disabled){background-color:var(--custom-button-text-hover-bg, rgba(37, 99, 235, 0.08))}.custom-button--text:active:not(.custom-button--disabled){background-color:var(--custom-button-text-active-bg, rgba(37, 99, 235, 0.12))}.custom-button--disabled,.custom-button:disabled{opacity:0.6;cursor:not-allowed}"}},[772,"fast-button",{variant:[1],type:[1],disabled:[4]}]);function c(){"undefined"!=typeof customElements&&["fast-button"].forEach((o=>{"fast-button"===o&&(customElements.get(t(o))||customElements.define(t(o),u))}))}c();const r=u,a=c;export{r as FastButton,a as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as n,p as t,H as e,h as o}from"./p-UM9TUfe3.js";function r(n){return"number"==typeof n}function i(n){return"string"==typeof n}function s(n){return"boolean"==typeof n}function c(n){return"[object Object]"===Object.prototype.toString.call(n)}function u(n){return Math.abs(n)}function l(n){return Math.sign(n)}function a(n,t){return u(n-t)}function d(n){return m(n).map(Number)}function f(n){return n[h(n)]}function h(n){return Math.max(0,n.length-1)}function p(n,t){return t===h(n)}function g(n,t=0){return Array.from(Array(n),((n,e)=>t+e))}function m(n){return Object.keys(n)}function b(n,t){return[n,t].reduce(((n,t)=>(m(t).forEach((e=>{const o=n[e],r=t[e],i=c(o)&&c(r);n[e]=i?b(o,r):r})),n)),{})}function y(n,t){return void 0!==t.MouseEvent&&n instanceof t.MouseEvent}function v(){let n=[];const t={add:function(e,o,r,i={passive:!0}){let s;if("addEventListener"in e)e.addEventListener(o,r,i),s=()=>e.removeEventListener(o,r,i);else{const n=e;n.addListener(r),s=()=>n.removeListener(r)}return n.push(s),t},clear:function(){n=n.filter((n=>n()))}};return t}function x(n=0,t=0){const e=u(n-t);function o(t){return t<n}function r(n){return n>t}function i(n){return o(n)||r(n)}return{length:e,max:t,min:n,constrain:function(e){return i(e)?o(e)?n:t:e},reachedAny:i,reachedMax:r,reachedMin:o,removeOffset:function(n){return e?n-e*Math.ceil((n-t)/e):n}}}function _(n,t,e){const{constrain:o}=x(0,n),r=n+1;let i=s(t);function s(n){return e?u((r+n)%r):o(n)}function c(){return i}function l(){return _(n,c(),e)}const a={get:c,set:function(n){return i=s(n),a},add:function(n){return l().set(c()+n)},clone:l};return a}function k(n,t,e,o,r,i,c,d,f,h,p,g,m,b,_,k,w,S,C){const{cross:E,direction:L}=n,M=["INPUT","SELECT","TEXTAREA"],T={passive:!1},I=v(),A=v(),N=x(50,225).constrain(b.measure(20)),R={mouse:300,touch:400},z={mouse:500,touch:600},O=_?43:25;let j=!1,B=0,F=0,D=!1,P=!1,H=!1,G=!1;function V(n){if(!y(n,o)&&n.touches.length>=2)return U(n);const t=i.readPoint(n),e=i.readPoint(n,E),s=a(t,B),c=a(e,F);if(!P&&!G){if(!n.cancelable)return U(n);if(P=s>c,!P)return U(n)}const u=i.pointerMove(n);s>k&&(H=!0),h.useFriction(.3).useDuration(.75),d.start(),r.add(L(u)),n.preventDefault()}function U(n){const t=p.byDistance(0,!1).index!==g.get(),e=i.pointerUp(n)*(_?z:R)[G?"mouse":"touch"],o=function(n,t){const e=g.add(-1*l(n)),o=p.byDistance(n,!_).distance;return _||u(n)<N?o:w&&t?.5*o:p.byIndex(e.get(),0).distance}(L(e),t),r=function(n,t){if(0===n||0===t)return 0;if(u(n)<=u(t))return 0;const e=a(u(n),u(t));return u(e/n)}(e,o),s=O-10*r,c=S+r/50;P=!1,D=!1,A.clear(),h.useDuration(s).useFriction(c),f.distance(o,!_),G=!1,m.emit("pointerUp")}function W(n){H&&(n.stopPropagation(),n.preventDefault(),H=!1)}return{init:function(n){if(!C)return;function u(u){(s(C)||C(n,u))&&function(n){const s=y(n,o);G=s,H=_&&s&&!n.buttons&&j,j=a(r.get(),c.get())>=2,s&&0!==n.button||function(n){return M.includes(n.nodeName||"")}(n.target)||(D=!0,i.pointerDown(n),h.useFriction(0).useDuration(0),r.set(c),function(){const n=G?e:t;A.add(n,"touchmove",V,T).add(n,"touchend",U).add(n,"mousemove",V,T).add(n,"mouseup",U)}(),B=i.readPoint(n),F=i.readPoint(n,E),m.emit("pointerDown"))}(u)}const l=t;I.add(l,"dragstart",(n=>n.preventDefault()),T).add(l,"touchmove",(()=>{}),T).add(l,"touchend",(()=>{})).add(l,"touchstart",u).add(l,"mousedown",u).add(l,"touchcancel",U).add(l,"contextmenu",U).add(l,"click",W,!0)},destroy:function(){I.clear(),A.clear()},pointerDown:function(){return D}}}function w(n,t){let e,o;function r(n){return n.timeStamp}function i(e,o){const r="client"+("x"===(o||n.scroll)?"X":"Y");return(y(e,t)?e:e.touches[0])[r]}return{pointerDown:function(n){return e=n,o=n,i(n)},pointerMove:function(n){const t=i(n)-i(o),s=r(n)-r(e)>170;return o=n,s&&(e=n),t},pointerUp:function(n){if(!e||!o)return 0;const t=i(o)-i(e),s=r(n)-r(e),c=r(n)-r(o)>170,l=t/s;return s&&!c&&u(l)>.1?l:0},readPoint:i}}function S(n,t,e,o,r,i,c){const l=[n].concat(o);let a,d,f=[],h=!1;function p(n){return r.measureSize(c.measure(n))}return{init:function(r){i&&(d=p(n),f=o.map(p),a=new ResizeObserver((e=>{(s(i)||i(r,e))&&function(e){for(const i of e){if(h)return;const e=i.target===n,s=o.indexOf(i.target),c=e?d:f[s];if(u(p(e?n:o[s])-c)>=.5){r.reInit(),t.emit("resize");break}}}(e)})),e.requestAnimationFrame((()=>{l.forEach((n=>a.observe(n)))})))},destroy:function(){h=!0,a&&a.disconnect()}}}function C(n,t,e,o,r){const i=r.measure(10),s=r.measure(50),c=x(.1,.99);let l=!1;function a(){return!l&&!!n.reachedAny(e.get())&&!!n.reachedAny(t.get())}return{shouldConstrain:a,constrain:function(r){if(!a())return;const l=n.reachedMin(t.get())?"min":"max",d=u(n[l]-t.get()),f=e.get()-t.get(),h=c.constrain(d/s);e.subtract(f*h),!r&&u(f)<i&&(e.set(n.constrain(e.get())),o.useDuration(25).useBaseFriction())},toggleActive:function(n){l=!n}}}function E(n,t,e,o){const r=t.min+.1,i=t.max+.1,{reachedMin:s,reachedMax:c}=x(r,i);return{loop:function(t){if(!function(n){return 1===n?c(e.get()):-1===n&&s(e.get())}(t))return;const r=n*(-1*t);o.forEach((n=>n.add(r)))}}}function L(n){let t=n;function e(n){return r(n)?n:n.get()}return{get:function(){return t},set:function(n){t=e(n)},add:function(n){t+=e(n)},subtract:function(n){t-=e(n)}}}function M(n,t){const e="x"===n.scroll?function(n){return`translate3d(${n}px,0px,0px)`}:function(n){return`translate3d(0px,${n}px,0px)`},o=t.style;let r=null,i=!1;return{clear:function(){i||(o.transform="",t.getAttribute("style")||t.removeAttribute("style"))},to:function(t){if(i)return;const s=function(n){return Math.round(100*n)/100}(n.direction(t));s!==r&&(o.transform=e(s),r=s)},toggleActive:function(n){i=!n}}}function T(n,t,e,o,r,i,s,c,u){const l=d(r),a=p(h(d(r).reverse(),s[0]),e,!1).concat(p(h(l,t-s[0]-1),-e,!0));function f(n,t){return n.reduce(((n,t)=>n-r[t]),t)}function h(n,t){return n.reduce(((n,e)=>f(n,t)>0?n.concat([e]):n),[])}function p(r,s,l){const a=function(n){return i.map(((e,r)=>({start:e-o[r]+.5+n,end:e+t-.5+n})))}(s);return r.map((t=>{const o=l?0:-e,r=l?e:0,i=a[t][l?"end":"start"];return{index:t,loopPoint:i,slideLocation:L(-1),translate:M(n,u[t]),target:()=>c.get()>i?o:r}}))}return{canLoop:function(){return a.every((({index:n})=>f(l.filter((t=>t!==n)),t)<=.1))},clear:function(){a.forEach((n=>n.translate.clear()))},loop:function(){a.forEach((n=>{const{target:t,translate:e,slideLocation:o}=n,r=t();r!==o.get()&&(e.to(r),o.set(r))}))},loopPoints:a}}function I(n,t,e){let o,r=!1;return{init:function(i){e&&(o=new MutationObserver((n=>{r||(s(e)||e(i,n))&&function(n){for(const e of n)if("childList"===e.type){i.reInit(),t.emit("slidesChanged");break}}(n)})),o.observe(n,{childList:!0}))},destroy:function(){o&&o.disconnect(),r=!0}}}function A(n,t,e,o,c,b,y){const{align:A,axis:N,direction:R,startIndex:z,loop:O,duration:j,dragFree:B,dragThreshold:F,inViewThreshold:D,slidesToScroll:P,skipSnaps:H,containScroll:G,watchResize:V,watchSlides:U,watchDrag:W,watchFocus:q}=b,Q={measure:function(n){const{offsetTop:t,offsetLeft:e,offsetWidth:o,offsetHeight:r}=n;return{top:t,right:e+o,bottom:t+r,left:e,width:o,height:r}}},X=Q.measure(t),$=e.map(Q.measure),J=function(n,t){const e="rtl"===t,o="y"===n,r=!o&&e?-1:1;return{scroll:o?"y":"x",cross:o?"x":"y",startEdge:o?"top":e?"right":"left",endEdge:o?"bottom":e?"left":"right",measureSize:function(n){const{height:t,width:e}=n;return o?t:e},direction:function(n){return n*r}}}(N,R),Y=J.measureSize(X),K=function(n){return{measure:function(t){return n*(t/100)}}}(Y),Z=function(n,t){const e={start:function(){return 0},center:function(n){return o(n)/2},end:o};function o(n){return t-n}return{measure:function(o,r){return i(n)?e[n](o):n(t,o,r)}}}(A,Y),nn=!O&&!!G,tn=O||!!G,{slideSizes:en,slideSizesWithGaps:on,startGap:rn,endGap:sn}=function(n,t,e,o,r,i){const{measureSize:s,startEdge:c,endEdge:l}=n,a=e[0]&&r,d=a?u(t[c]-e[0][c]):0,h=function(){if(!a)return 0;const n=i.getComputedStyle(f(o));return parseFloat(n.getPropertyValue("margin-"+l))}(),g=e.map(s),m=e.map(((n,t,e)=>{const o=!t,r=p(e,t);return o?g[t]+d:r?g[t]+h:e[t+1][c]-n[c]})).map(u);return{slideSizes:g,slideSizesWithGaps:m,startGap:d,endGap:h}}(J,X,$,e,tn,c),cn=function(n,t,e,o,i,s,c,l,a){const{startEdge:p,endEdge:g,direction:m}=n,b=r(e);return{groupSlides:function(n){return b?function(n,t){return d(n).filter((n=>n%t==0)).map((e=>n.slice(e,e+t)))}(n,e):function(n){return n.length?d(n).reduce(((e,r,d)=>{const b=f(e)||0,y=0===b,v=r===h(n),x=i[p]-s[b][p],_=i[p]-s[r][g],k=!o&&y?m(c):0,w=u(_-(!o&&v?m(l):0)-(x+k));return d&&w>t+a&&e.push(r),v&&e.push(n.length),e}),[]).map(((t,e,o)=>n.slice(Math.max(o[e-1]||0),t))):[]}(n)}}}(J,Y,P,O,X,$,rn,sn,2),{snaps:un,snapsAligned:ln}=function(n,t,e,o,r){const{startEdge:i,endEdge:s}=n,{groupSlides:c}=r,l=c(o).map((n=>f(n)[s]-n[0][i])).map(u).map(t.measure),a=o.map((n=>e[i]-n[i])).map((n=>-u(n))),d=c(a).map((n=>n[0])).map(((n,t)=>n+l[t]));return{snaps:a,snapsAligned:d}}(J,Z,X,$,cn),an=-f(un)+f(on),{snapsContained:dn,scrollContainLimit:fn}=function(n,t,e,o){const r=x(-t+n,0),i=e.map(((n,t)=>{const{min:o,max:i}=r,s=r.constrain(n),u=!t,l=p(e,t);return u?i:l||c(o,s)?o:c(i,s)?i:s})).map((n=>parseFloat(n.toFixed(3)))),s=function(){const n=i[0],t=f(i);return x(i.lastIndexOf(n),i.indexOf(t)+1)}();function c(n,t){return a(n,t)<=1}return{snapsContained:function(){if(t<=n+2)return[r.max];if("keepSnaps"===o)return i;const{min:e,max:c}=s;return i.slice(e,c)}(),scrollContainLimit:s}}(Y,an,ln,G),hn=nn?dn:ln,{limit:pn}=function(n,t,e){const o=t[0];return{limit:x(e?o-n:f(t),o)}}(an,hn,O),gn=_(h(hn),z,O),mn=gn.clone(),bn=d(e),yn=function(n,t,e,o){const r=v(),i=1e3/60;let s=null,c=0,u=0;function l(n){if(!u)return;s||(s=n,e(),e());const r=n-s;for(s=n,c+=r;c>=i;)e(),c-=i;o(c/i),u&&(u=t.requestAnimationFrame(l))}function a(){t.cancelAnimationFrame(u),s=null,c=0,u=0}return{init:function(){r.add(n,"visibilitychange",(()=>{n.hidden&&(s=null,c=0)}))},destroy:function(){a(),r.clear()},start:function(){u||(u=t.requestAnimationFrame(l))},stop:a,update:e,render:o}}(o,c,(()=>(({dragHandler:n,scrollBody:t,scrollBounds:e,options:{loop:o}})=>{o||e.constrain(n.pointerDown()),t.seek()})(Nn)),(n=>(({scrollBody:n,translate:t,location:e,offsetLocation:o,previousLocation:r,scrollLooper:i,slideLooper:s,dragHandler:c,animation:u,eventHandler:l,scrollBounds:a,options:{loop:d}},f)=>{const h=n.settled(),p=!a.shouldConstrain(),g=d?h:h&&p,m=g&&!c.pointerDown();m&&u.stop();const b=e.get()*f+r.get()*(1-f);o.set(b),d&&(i.loop(n.direction()),s.loop()),t.to(o.get()),m&&l.emit("settle"),g||l.emit("scroll")})(Nn,n))),vn=hn[gn.get()],xn=L(vn),_n=L(vn),kn=L(vn),wn=L(vn),Sn=function(n,t,e,o,r){let i=0,s=0,c=r,a=.68,d=n.get(),f=0;function h(n){return c=n,g}function p(n){return a=n,g}const g={direction:function(){return s},duration:function(){return c},velocity:function(){return i},seek:function(){const t=o.get()-n.get();let r=0;return c?(e.set(n),i+=t/c,i*=a,d+=i,n.add(i),r=d-f):(i=0,e.set(o),n.set(o),r=t),s=l(r),f=d,g},settled:function(){return u(o.get()-t.get())<.001},useBaseFriction:function(){return p(.68)},useBaseDuration:function(){return h(r)},useFriction:p,useDuration:h};return g}(xn,kn,_n,wn,j),Cn=function(n,t,e,o,r){const{reachedAny:i,removeOffset:s,constrain:c}=o;function a(n){return n.concat().sort(((n,t)=>u(n)-u(t)))[0]}function d(t,o){const r=[t,t+e,t-e];if(!n)return t;if(!o)return a(r);const i=r.filter((n=>l(n)===o));return i.length?a(i):f(r)-e}return{byDistance:function(e,o){const l=r.get()+e,{index:a,distance:f}=function(e){const o=n?s(e):c(e),r=t.map(((n,t)=>({diff:d(n-o,0),index:t}))).sort(((n,t)=>u(n.diff)-u(t.diff))),{index:i}=r[0];return{index:i,distance:o}}(l),h=!n&&i(l);return!o||h?{index:a,distance:e}:{index:a,distance:e+d(t[a]-f,0)}},byIndex:function(n,e){return{index:n,distance:d(t[n]-r.get(),e)}},shortcut:d}}(O,hn,an,pn,wn),En=function(n,t,e,o,r,i,s){function c(r){const c=r.distance,u=r.index!==t.get();i.add(c),c&&(o.duration()?n.start():(n.update(),n.render(1),n.update())),u&&(e.set(t.get()),t.set(r.index),s.emit("select"))}return{distance:function(n,t){c(r.byDistance(n,t))},index:function(n,e){const o=t.clone().set(n);c(r.byIndex(o.get(),e))}}}(yn,gn,mn,Sn,Cn,wn,y),Ln=function(n){const{max:t,length:e}=n;return{get:function(n){return e?(n-t)/-e:0}}}(pn),Mn=v(),Tn=function(n,t,e,o){const r={};let i,s=null,c=null,u=!1;return{init:function(){i=new IntersectionObserver((n=>{u||(n.forEach((n=>{const e=t.indexOf(n.target);r[e]=n})),s=null,c=null,e.emit("slidesInView"))}),{root:n.parentElement,threshold:o}),t.forEach((n=>i.observe(n)))},destroy:function(){i&&i.disconnect(),u=!0},get:function(n=!0){if(n&&s)return s;if(!n&&c)return c;const t=function(n){return m(r).reduce(((t,e)=>{const o=parseInt(e),{isIntersecting:i}=r[o];return(n&&i||!n&&!i)&&t.push(o),t}),[])}(n);return n&&(s=t),n||(c=t),t}}}(t,e,y,D),{slideRegistry:In}=function(n,t,e,o,r,i){const{groupSlides:s}=r,{min:c,max:u}=o;return{slideRegistry:function(){const o=s(i);return 1===e.length?[i]:n&&"keepSnaps"!==t?o.slice(c,u).map(((n,t,e)=>{const o=!t,r=p(e,t);return o?g(f(e[0])+1):r?g(h(i)-f(e)[0]+1,f(e)[0]):n})):o}()}}(nn,G,hn,fn,cn,bn),An=function(n,t,e,o,i,c,u,l){const a={passive:!0,capture:!0};let d=0;function f(n){"Tab"===n.code&&(d=(new Date).getTime())}return{init:function(h){l&&(c.add(document,"keydown",f,!1),t.forEach(((t,f)=>{c.add(t,"focus",(t=>{(s(l)||l(h,t))&&function(t){if((new Date).getTime()-d>10)return;u.emit("slideFocusStart"),n.scrollLeft=0;const s=e.findIndex((n=>n.includes(t)));r(s)&&(i.useDuration(0),o.index(s,0),u.emit("slideFocus"))}(f)}),a)})))}}}(n,e,In,En,Sn,Mn,y,q),Nn={ownerDocument:o,ownerWindow:c,eventHandler:y,containerRect:X,slideRects:$,animation:yn,axis:J,dragHandler:k(J,n,o,c,wn,w(J,c),xn,yn,En,Sn,Cn,gn,y,K,B,F,H,.68,W),eventStore:Mn,percentOfView:K,index:gn,indexPrevious:mn,limit:pn,location:xn,offsetLocation:kn,previousLocation:_n,options:b,resizeHandler:S(t,y,c,e,J,V,Q),scrollBody:Sn,scrollBounds:C(pn,kn,wn,Sn,K),scrollLooper:E(an,pn,kn,[xn,kn,_n,wn]),scrollProgress:Ln,scrollSnapList:hn.map(Ln.get),scrollSnaps:hn,scrollTarget:Cn,scrollTo:En,slideLooper:T(J,Y,an,en,on,un,hn,kn,e),slideFocus:An,slidesHandler:I(t,y,U),slidesInView:Tn,slideIndexes:bn,slideRegistry:In,slidesToScroll:cn,target:wn,translate:M(J,t)};return Nn}const N={align:"center",axis:"x",container:null,slides:null,containScroll:"trimSnaps",direction:"ltr",slidesToScroll:1,inViewThreshold:0,breakpoints:{},dragFree:!1,dragThreshold:10,loop:!1,skipSnaps:!1,duration:25,startIndex:0,active:!0,watchDrag:!0,watchResize:!0,watchSlides:!0,watchFocus:!0};function R(n){function t(n,t){return b(n,t||{})}return{mergeOptions:t,optionsAtMedia:function(e){const o=e.breakpoints||{},r=m(o).filter((t=>n.matchMedia(t).matches)).map((n=>o[n])).reduce(((n,e)=>t(n,e)),{});return t(e,r)},optionsMediaQueries:function(t){return t.map((n=>m(n.breakpoints||{}))).reduce(((n,t)=>n.concat(t)),[]).map(n.matchMedia)}}}function z(n,t,e){const o=n.ownerDocument,r=o.defaultView,s=R(r),c=function(n){let t=[];return{init:function(e,o){return t=o.filter((({options:t})=>!1!==n.optionsAtMedia(t).active)),t.forEach((t=>t.init(e,n))),o.reduce(((n,t)=>Object.assign(n,{[t.name]:t})),{})},destroy:function(){t=t.filter((n=>n.destroy()))}}}(s),u=v(),l=function(){let n,t={};function e(n){return t[n]||[]}const o={init:function(t){n=t},emit:function(t){return e(t).forEach((e=>e(n,t))),o},off:function(n,r){return t[n]=e(n).filter((n=>n!==r)),o},on:function(n,r){return t[n]=e(n).concat([r]),o},clear:function(){t={}}};return o}(),{mergeOptions:a,optionsAtMedia:d,optionsMediaQueries:f}=s,{on:h,off:p,emit:g}=l,m=M;let b,y,x,_,k=!1,w=a(N,z.globalOptions),S=a(w),C=[];function E(t){const e=A(n,x,_,o,r,t,l);return t.loop&&!e.slideLooper.canLoop()?E(Object.assign({},t,{loop:!1})):e}function L(t,e){k||(w=a(w,t),S=d(w),C=e||C,function(){const{container:t,slides:e}=S,o=i(t)?n.querySelector(t):t;x=o||n.children[0];const r=i(e)?x.querySelectorAll(e):e;_=[].slice.call(r||x.children)}(),b=E(S),f([w,...C.map((({options:n})=>n))]).forEach((n=>u.add(n,"change",M))),S.active&&(b.translate.to(b.location.get()),b.animation.init(),b.slidesInView.init(),b.slideFocus.init(j),b.eventHandler.init(j),b.resizeHandler.init(j),b.slidesHandler.init(j),b.options.loop&&b.slideLooper.loop(),x.offsetParent&&_.length&&b.dragHandler.init(j),y=c.init(j,C)))}function M(n,t){const e=O();T(),L(a({startIndex:e},n),t),l.emit("reInit")}function T(){b.dragHandler.destroy(),b.eventStore.clear(),b.translate.clear(),b.slideLooper.clear(),b.resizeHandler.destroy(),b.slidesHandler.destroy(),b.slidesInView.destroy(),b.animation.destroy(),c.destroy(),u.clear()}function I(n,t,e){S.active&&!k&&(b.scrollBody.useBaseFriction().useDuration(!0===t?0:S.duration),b.scrollTo.index(n,e||0))}function O(){return b.index.get()}const j={canScrollNext:function(){return b.index.add(1).get()!==O()},canScrollPrev:function(){return b.index.add(-1).get()!==O()},containerNode:function(){return x},internalEngine:function(){return b},destroy:function(){k||(k=!0,u.clear(),T(),l.emit("destroy"),l.clear())},off:p,on:h,emit:g,plugins:function(){return y},previousScrollSnap:function(){return b.indexPrevious.get()},reInit:m,rootNode:function(){return n},scrollNext:function(n){I(b.index.add(1).get(),n,-1)},scrollPrev:function(n){I(b.index.add(-1).get(),n,1)},scrollProgress:function(){return b.scrollProgress.get(b.offsetLocation.get())},scrollSnapList:function(){return b.scrollSnapList},scrollTo:I,selectedScrollSnap:O,slideNodes:function(){return _},slidesInView:function(){return b.slidesInView.get()},slidesNotInView:function(){return b.slidesInView.get(!1)}};return L(t,e),setTimeout((()=>l.emit("init")),0),j}z.globalOptions=void 0;const O=t(class extends e{constructor(n){super(),!1!==n&&this.__registerHost()}get el(){return this}items;loop=!0;class;controlClass;slideClass;itemClass;viewportRef;containerRef;slotRef;prevBtnRef;nextBtnRef;dotsRef;embla=null;movedNodes=[];prevClickHandler=null;nextClickHandler=null;dotClickHandlers=[];slotNodesMoved=!1;async scrollPrev(){this.embla?.scrollPrev()}async scrollNext(){this.embla?.scrollNext()}async goToSlide(n){this.embla?.scrollTo(n)}async getEmbla(){return this.embla}moveSlotNodesIntoContainer(){if(!this.slotRef||!this.containerRef||this.slotNodesMoved)return;const n=this.slotRef.assignedNodes().filter((n=>n.nodeType===Node.ELEMENT_NODE));0!==n.length&&(this.movedNodes=[],n.forEach((n=>{this.containerRef.appendChild(n),this.movedNodes.push(n)})),this.slotNodesMoved=!0,this.scheduleEmblaInit())}initScheduled=!1;scheduleEmblaInit(){this.initScheduled||(this.initScheduled=!0,requestAnimationFrame((()=>{this.initScheduled=!1,this.destroyEmbla(),this.initEmbla()})))}moveSlotNodesBack(){const n=this.el;this.movedNodes.forEach((t=>n.appendChild(t))),this.movedNodes=[]}initEmbla(){if(!this.viewportRef||!this.containerRef)return;const n=this.getItemsArray();if(!(void 0!==n?n.length>0:this.containerRef.children.length>0))return;this.embla=z(this.viewportRef,{loop:this.loop,align:"center",containScroll:"trimSnaps"});const t=this.prevBtnRef,e=this.nextBtnRef,o=this.dotsRef,r=()=>{t&&(this.embla?.canScrollPrev()?t.removeAttribute("disabled"):t.setAttribute("disabled","")),e&&(this.embla?.canScrollNext()?e.removeAttribute("disabled"):e.setAttribute("disabled",""))};if(this.embla.on("init",r),this.embla.on("reInit",r),this.embla.on("select",r),t&&e&&(this.prevClickHandler=()=>this.embla?.scrollPrev(),this.nextClickHandler=()=>this.embla?.scrollNext(),t.addEventListener("click",this.prevClickHandler),e.addEventListener("click",this.nextClickHandler)),o){const n=this.embla.scrollSnapList().length;o.innerHTML="";for(let t=0;t<n;t++){const n=document.createElement("button");n.type="button",n.setAttribute("aria-label","Go to slide "+(t+1)),n.className="carousel__dot",0===t&&n.classList.add("current");const e=document.createElement("div");e.className="carousel__dot-inner",n.appendChild(e);const r=t,i=()=>this.embla?.scrollTo(r);this.dotClickHandlers.push(i),n.addEventListener("click",i),o.appendChild(n)}this.embla.on("select",(()=>{const n=this.embla?.selectedScrollSnap()??0;o.querySelectorAll("button").forEach(((t,e)=>{t.classList.toggle("current",e===n)}))}))}r()}destroyEmbla(){this.prevBtnRef&&this.prevClickHandler&&(this.prevBtnRef.removeEventListener("click",this.prevClickHandler),this.prevClickHandler=null),this.nextBtnRef&&this.nextClickHandler&&(this.nextBtnRef.removeEventListener("click",this.nextClickHandler),this.nextClickHandler=null),this.dotClickHandlers=[],this.dotsRef&&(this.dotsRef.innerHTML=""),this.embla?.destroy(),this.embla=null}onSlotChange=()=>{void 0===this.getItemsArray()&&this.moveSlotNodesIntoContainer()};componentDidRender(){void 0===this.getItemsArray()?(this.slotRef&&(this.slotRef.removeEventListener("slotchange",this.onSlotChange),this.slotRef.addEventListener("slotchange",this.onSlotChange)),requestAnimationFrame((()=>{this.moveSlotNodesIntoContainer(),this.slotNodesMoved||(this.destroyEmbla(),this.initEmbla())}))):(this.destroyEmbla(),this.initEmbla())}disconnectedCallback(){this.slotRef&&this.slotRef.removeEventListener("slotchange",this.onSlotChange),this.destroyEmbla(),void 0===this.getItemsArray()&&(this.moveSlotNodesBack(),this.slotNodesMoved=!1)}getItemsArray(){if(void 0!==this.items){if(Array.isArray(this.items))return this.items;if("string"==typeof this.items)try{const n=JSON.parse(this.items);return Array.isArray(n)?n:void 0}catch{return}}}render(){const n=this.getItemsArray(),t=void 0!==n&&n.length>0;return o("div",{key:"3a2ea6c339bf0fe656e5a333789df7a37156b5dc",class:("carousel "+(this.class||"")).trim()},o("div",{key:"0a73b925095ae3188e5e40b024bc250e4c183894",class:("carousel__viewport "+(this.slideClass||"")).trim(),ref:n=>this.viewportRef=n},o("div",{key:"7fc3b5a72e386f7fa21702aeb363e08da1b728cf",class:"carousel__container",ref:n=>this.containerRef=n},t&&n?n.map(((n,t)=>o("div",{key:t,class:("carousel__slide "+(this.itemClass||"")).trim()},"object"==typeof n&&null!==n&&"content"in n?n.content:n+""))):null)),!t&&o("div",{key:"dee2fc91470728c136c9853cd74ae350ad3c5676",style:{display:"none"},"aria-hidden":"true"},o("slot",{key:"35dd47c03a1b9b6b73d845252c3d0482590f7da2",ref:n=>this.slotRef=n})),o("div",{key:"df639ad86ae8533f1dc15eed30afb70d99e36e1a",class:("carousel__controls "+(this.controlClass||"")).trim()},o("button",{key:"c17c0ea9bf023b5d2621e558c957d92b13425584",type:"button","aria-label":"Previous",class:"carousel__prev",ref:n=>this.prevBtnRef=n},o("svg",{key:"5125abcae0b08ee72106d511b4c24c2d0f24187b",class:"carousel__icon","stroke-width":"1.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true"},o("path",{key:"9b7f28be56f451ad14de226d7163a5587a1cd9e6","stroke-linecap":"round","stroke-linejoin":"round",d:"M15.75 19.5L8.25 12l7.5-7.5"}))),o("div",{key:"9939d3496092a3f319efac9132cec8097c83b497",class:"carousel__dots",ref:n=>this.dotsRef=n}),o("button",{key:"a0b1228f6df0065885f1d272386283926e78464b",type:"button","aria-label":"Next",class:"carousel__next",ref:n=>this.nextBtnRef=n},o("svg",{key:"e00c92cc0485f41a30e97d5d0466aaee48a64998",class:"carousel__icon","stroke-width":"1.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true"},o("path",{key:"a35c46fdbd1cd333d3e6f76590f45dd837546165","stroke-linecap":"round","stroke-linejoin":"round",d:"M8.25 4.5l7.5 7.5-7.5 7.5"})))))}static get style(){return":host{display:block}.carousel{display:flex;flex-direction:column;overflow:hidden}.carousel__viewport{overflow:hidden;touch-action:pan-y pinch-zoom}.carousel__container{display:flex;flex-direction:row;height:100%;margin-left:calc(-0.4rem)}.carousel__container ::slotted(*){flex:0 0 50%;width:50%;height:100%;padding-left:0.4rem;box-sizing:border-box}.carousel__slide{flex:0 0 50%;width:50%;height:100%;padding-left:0.4rem;box-sizing:border-box}.carousel__controls{display:flex;gap:0.25rem;margin-top:0.25rem;justify-content:center;align-items:center}.carousel__prev,.carousel__next{display:inline-flex;align-items:center;justify-content:center;padding:0;border:none;background:transparent;cursor:pointer;color:currentColor}.carousel__prev:disabled,.carousel__next:disabled{opacity:0.4;cursor:not-allowed}.carousel__icon{width:2.4rem;height:2.4rem}.carousel__dots{display:flex;gap:0.25rem;align-items:center}.carousel__dot{padding:0;border:none;background:none;cursor:pointer;width:0.5rem;height:0.5rem;display:flex;align-items:center;justify-content:center}.carousel__dot-inner{width:100%;height:100%;border-radius:50%;background-color:var(--carousel-dot-bg, #cbd5e1);transition:background-color 0.2s ease}.carousel__dot.current .carousel__dot-inner{background-color:var(--carousel-dot-active-bg, #94a3b8)}"}},[772,"fast-carousel",{items:[1],loop:[4],class:[1],controlClass:[1,"control-class"],slideClass:[1,"slide-class"],itemClass:[1,"item-class"],scrollPrev:[64],scrollNext:[64],goToSlide:[64],getEmbla:[64]}]);function j(){"undefined"!=typeof customElements&&["fast-carousel"].forEach((t=>{"fast-carousel"===t&&(customElements.get(n(t))||customElements.define(n(t),O))}))}j();const B=O,F=j;export{B as FastCarousel,F as defineCustomElement}
|
|
1
|
+
import{t as n,p as t,H as e,h as o}from"./p-BiaJAQXY.js";function r(n){return"number"==typeof n}function i(n){return"string"==typeof n}function s(n){return"boolean"==typeof n}function c(n){return"[object Object]"===Object.prototype.toString.call(n)}function u(n){return Math.abs(n)}function l(n){return Math.sign(n)}function a(n,t){return u(n-t)}function d(n){return m(n).map(Number)}function f(n){return n[h(n)]}function h(n){return Math.max(0,n.length-1)}function p(n,t){return t===h(n)}function g(n,t=0){return Array.from(Array(n),((n,e)=>t+e))}function m(n){return Object.keys(n)}function b(n,t){return[n,t].reduce(((n,t)=>(m(t).forEach((e=>{const o=n[e],r=t[e],i=c(o)&&c(r);n[e]=i?b(o,r):r})),n)),{})}function y(n,t){return void 0!==t.MouseEvent&&n instanceof t.MouseEvent}function v(){let n=[];const t={add:function(e,o,r,i={passive:!0}){let s;if("addEventListener"in e)e.addEventListener(o,r,i),s=()=>e.removeEventListener(o,r,i);else{const n=e;n.addListener(r),s=()=>n.removeListener(r)}return n.push(s),t},clear:function(){n=n.filter((n=>n()))}};return t}function x(n=0,t=0){const e=u(n-t);function o(t){return t<n}function r(n){return n>t}function i(n){return o(n)||r(n)}return{length:e,max:t,min:n,constrain:function(e){return i(e)?o(e)?n:t:e},reachedAny:i,reachedMax:r,reachedMin:o,removeOffset:function(n){return e?n-e*Math.ceil((n-t)/e):n}}}function _(n,t,e){const{constrain:o}=x(0,n),r=n+1;let i=s(t);function s(n){return e?u((r+n)%r):o(n)}function c(){return i}function l(){return _(n,c(),e)}const a={get:c,set:function(n){return i=s(n),a},add:function(n){return l().set(c()+n)},clone:l};return a}function k(n,t,e,o,r,i,c,d,f,h,p,g,m,b,_,k,w,S,C){const{cross:E,direction:L}=n,I=["INPUT","SELECT","TEXTAREA"],M={passive:!1},T=v(),A=v(),N=x(50,225).constrain(b.measure(20)),R={mouse:300,touch:400},z={mouse:500,touch:600},B=_?43:25;let O=!1,j=0,F=0,D=!1,P=!1,H=!1,G=!1;function V(n){if(!y(n,o)&&n.touches.length>=2)return W(n);const t=i.readPoint(n),e=i.readPoint(n,E),s=a(t,j),c=a(e,F);if(!P&&!G){if(!n.cancelable)return W(n);if(P=s>c,!P)return W(n)}const u=i.pointerMove(n);s>k&&(H=!0),h.useFriction(.3).useDuration(.75),d.start(),r.add(L(u)),n.preventDefault()}function W(n){const t=p.byDistance(0,!1).index!==g.get(),e=i.pointerUp(n)*(_?z:R)[G?"mouse":"touch"],o=function(n,t){const e=g.add(-1*l(n)),o=p.byDistance(n,!_).distance;return _||u(n)<N?o:w&&t?.5*o:p.byIndex(e.get(),0).distance}(L(e),t),r=function(n,t){if(0===n||0===t)return 0;if(u(n)<=u(t))return 0;const e=a(u(n),u(t));return u(e/n)}(e,o),s=B-10*r,c=S+r/50;P=!1,D=!1,A.clear(),h.useDuration(s).useFriction(c),f.distance(o,!_),G=!1,m.emit("pointerUp")}function Q(n){H&&(n.stopPropagation(),n.preventDefault(),H=!1)}return{init:function(n){if(!C)return;function u(u){(s(C)||C(n,u))&&function(n){const s=y(n,o);G=s,H=_&&s&&!n.buttons&&O,O=a(r.get(),c.get())>=2,s&&0!==n.button||function(n){return I.includes(n.nodeName||"")}(n.target)||(D=!0,i.pointerDown(n),h.useFriction(0).useDuration(0),r.set(c),function(){const n=G?e:t;A.add(n,"touchmove",V,M).add(n,"touchend",W).add(n,"mousemove",V,M).add(n,"mouseup",W)}(),j=i.readPoint(n),F=i.readPoint(n,E),m.emit("pointerDown"))}(u)}const l=t;T.add(l,"dragstart",(n=>n.preventDefault()),M).add(l,"touchmove",(()=>{}),M).add(l,"touchend",(()=>{})).add(l,"touchstart",u).add(l,"mousedown",u).add(l,"touchcancel",W).add(l,"contextmenu",W).add(l,"click",Q,!0)},destroy:function(){T.clear(),A.clear()},pointerDown:function(){return D}}}function w(n,t){let e,o;function r(n){return n.timeStamp}function i(e,o){const r="client"+("x"===(o||n.scroll)?"X":"Y");return(y(e,t)?e:e.touches[0])[r]}return{pointerDown:function(n){return e=n,o=n,i(n)},pointerMove:function(n){const t=i(n)-i(o),s=r(n)-r(e)>170;return o=n,s&&(e=n),t},pointerUp:function(n){if(!e||!o)return 0;const t=i(o)-i(e),s=r(n)-r(e),c=r(n)-r(o)>170,l=t/s;return s&&!c&&u(l)>.1?l:0},readPoint:i}}function S(n,t,e,o,r,i,c){const l=[n].concat(o);let a,d,f=[],h=!1;function p(n){return r.measureSize(c.measure(n))}return{init:function(r){i&&(d=p(n),f=o.map(p),a=new ResizeObserver((e=>{(s(i)||i(r,e))&&function(e){for(const i of e){if(h)return;const e=i.target===n,s=o.indexOf(i.target),c=e?d:f[s];if(u(p(e?n:o[s])-c)>=.5){r.reInit(),t.emit("resize");break}}}(e)})),e.requestAnimationFrame((()=>{l.forEach((n=>a.observe(n)))})))},destroy:function(){h=!0,a&&a.disconnect()}}}function C(n,t,e,o,r){const i=r.measure(10),s=r.measure(50),c=x(.1,.99);let l=!1;function a(){return!l&&!!n.reachedAny(e.get())&&!!n.reachedAny(t.get())}return{shouldConstrain:a,constrain:function(r){if(!a())return;const l=n.reachedMin(t.get())?"min":"max",d=u(n[l]-t.get()),f=e.get()-t.get(),h=c.constrain(d/s);e.subtract(f*h),!r&&u(f)<i&&(e.set(n.constrain(e.get())),o.useDuration(25).useBaseFriction())},toggleActive:function(n){l=!n}}}function E(n,t,e,o){const r=t.min+.1,i=t.max+.1,{reachedMin:s,reachedMax:c}=x(r,i);return{loop:function(t){if(!function(n){return 1===n?c(e.get()):-1===n&&s(e.get())}(t))return;const r=n*(-1*t);o.forEach((n=>n.add(r)))}}}function L(n){let t=n;function e(n){return r(n)?n:n.get()}return{get:function(){return t},set:function(n){t=e(n)},add:function(n){t+=e(n)},subtract:function(n){t-=e(n)}}}function I(n,t){const e="x"===n.scroll?function(n){return`translate3d(${n}px,0px,0px)`}:function(n){return`translate3d(0px,${n}px,0px)`},o=t.style;let r=null,i=!1;return{clear:function(){i||(o.transform="",t.getAttribute("style")||t.removeAttribute("style"))},to:function(t){if(i)return;const s=function(n){return Math.round(100*n)/100}(n.direction(t));s!==r&&(o.transform=e(s),r=s)},toggleActive:function(n){i=!n}}}function M(n,t,e,o,r,i,s,c,u){const l=d(r),a=p(h(d(r).reverse(),s[0]),e,!1).concat(p(h(l,t-s[0]-1),-e,!0));function f(n,t){return n.reduce(((n,t)=>n-r[t]),t)}function h(n,t){return n.reduce(((n,e)=>f(n,t)>0?n.concat([e]):n),[])}function p(r,s,l){const a=function(n){return i.map(((e,r)=>({start:e-o[r]+.5+n,end:e+t-.5+n})))}(s);return r.map((t=>{const o=l?0:-e,r=l?e:0,i=a[t][l?"end":"start"];return{index:t,loopPoint:i,slideLocation:L(-1),translate:I(n,u[t]),target:()=>c.get()>i?o:r}}))}return{canLoop:function(){return a.every((({index:n})=>f(l.filter((t=>t!==n)),t)<=.1))},clear:function(){a.forEach((n=>n.translate.clear()))},loop:function(){a.forEach((n=>{const{target:t,translate:e,slideLocation:o}=n,r=t();r!==o.get()&&(e.to(r),o.set(r))}))},loopPoints:a}}function T(n,t,e){let o,r=!1;return{init:function(i){e&&(o=new MutationObserver((n=>{r||(s(e)||e(i,n))&&function(n){for(const e of n)if("childList"===e.type){i.reInit(),t.emit("slidesChanged");break}}(n)})),o.observe(n,{childList:!0}))},destroy:function(){o&&o.disconnect(),r=!0}}}function A(n,t,e,o,c,b,y){const{align:A,axis:N,direction:R,startIndex:z,loop:B,duration:O,dragFree:j,dragThreshold:F,inViewThreshold:D,slidesToScroll:P,skipSnaps:H,containScroll:G,watchResize:V,watchSlides:W,watchDrag:Q,watchFocus:U}=b,X={measure:function(n){const{offsetTop:t,offsetLeft:e,offsetWidth:o,offsetHeight:r}=n;return{top:t,right:e+o,bottom:t+r,left:e,width:o,height:r}}},q=X.measure(t),J=e.map(X.measure),Y=function(n,t){const e="rtl"===t,o="y"===n,r=!o&&e?-1:1;return{scroll:o?"y":"x",cross:o?"x":"y",startEdge:o?"top":e?"right":"left",endEdge:o?"bottom":e?"left":"right",measureSize:function(n){const{height:t,width:e}=n;return o?t:e},direction:function(n){return n*r}}}(N,R),$=Y.measureSize(q),K=function(n){return{measure:function(t){return n*(t/100)}}}($),Z=function(n,t){const e={start:function(){return 0},center:function(n){return o(n)/2},end:o};function o(n){return t-n}return{measure:function(o,r){return i(n)?e[n](o):n(t,o,r)}}}(A,$),nn=!B&&!!G,tn=B||!!G,{slideSizes:en,slideSizesWithGaps:on,startGap:rn,endGap:sn}=function(n,t,e,o,r,i){const{measureSize:s,startEdge:c,endEdge:l}=n,a=e[0]&&r,d=a?u(t[c]-e[0][c]):0,h=function(){if(!a)return 0;const n=i.getComputedStyle(f(o));return parseFloat(n.getPropertyValue("margin-"+l))}(),g=e.map(s),m=e.map(((n,t,e)=>{const o=!t,r=p(e,t);return o?g[t]+d:r?g[t]+h:e[t+1][c]-n[c]})).map(u);return{slideSizes:g,slideSizesWithGaps:m,startGap:d,endGap:h}}(Y,q,J,e,tn,c),cn=function(n,t,e,o,i,s,c,l,a){const{startEdge:p,endEdge:g,direction:m}=n,b=r(e);return{groupSlides:function(n){return b?function(n,t){return d(n).filter((n=>n%t==0)).map((e=>n.slice(e,e+t)))}(n,e):function(n){return n.length?d(n).reduce(((e,r,d)=>{const b=f(e)||0,y=0===b,v=r===h(n),x=i[p]-s[b][p],_=i[p]-s[r][g],k=!o&&y?m(c):0,w=u(_-(!o&&v?m(l):0)-(x+k));return d&&w>t+a&&e.push(r),v&&e.push(n.length),e}),[]).map(((t,e,o)=>n.slice(Math.max(o[e-1]||0),t))):[]}(n)}}}(Y,$,P,B,q,J,rn,sn,2),{snaps:un,snapsAligned:ln}=function(n,t,e,o,r){const{startEdge:i,endEdge:s}=n,{groupSlides:c}=r,l=c(o).map((n=>f(n)[s]-n[0][i])).map(u).map(t.measure),a=o.map((n=>e[i]-n[i])).map((n=>-u(n))),d=c(a).map((n=>n[0])).map(((n,t)=>n+l[t]));return{snaps:a,snapsAligned:d}}(Y,Z,q,J,cn),an=-f(un)+f(on),{snapsContained:dn,scrollContainLimit:fn}=function(n,t,e,o){const r=x(-t+n,0),i=e.map(((n,t)=>{const{min:o,max:i}=r,s=r.constrain(n),u=!t,l=p(e,t);return u?i:l||c(o,s)?o:c(i,s)?i:s})).map((n=>parseFloat(n.toFixed(3)))),s=function(){const n=i[0],t=f(i);return x(i.lastIndexOf(n),i.indexOf(t)+1)}();function c(n,t){return a(n,t)<=1}return{snapsContained:function(){if(t<=n+2)return[r.max];if("keepSnaps"===o)return i;const{min:e,max:c}=s;return i.slice(e,c)}(),scrollContainLimit:s}}($,an,ln,G),hn=nn?dn:ln,{limit:pn}=function(n,t,e){const o=t[0];return{limit:x(e?o-n:f(t),o)}}(an,hn,B),gn=_(h(hn),z,B),mn=gn.clone(),bn=d(e),yn=function(n,t,e,o){const r=v(),i=1e3/60;let s=null,c=0,u=0;function l(n){if(!u)return;s||(s=n,e(),e());const r=n-s;for(s=n,c+=r;c>=i;)e(),c-=i;o(c/i),u&&(u=t.requestAnimationFrame(l))}function a(){t.cancelAnimationFrame(u),s=null,c=0,u=0}return{init:function(){r.add(n,"visibilitychange",(()=>{n.hidden&&(s=null,c=0)}))},destroy:function(){a(),r.clear()},start:function(){u||(u=t.requestAnimationFrame(l))},stop:a,update:e,render:o}}(o,c,(()=>(({dragHandler:n,scrollBody:t,scrollBounds:e,options:{loop:o}})=>{o||e.constrain(n.pointerDown()),t.seek()})(Nn)),(n=>(({scrollBody:n,translate:t,location:e,offsetLocation:o,previousLocation:r,scrollLooper:i,slideLooper:s,dragHandler:c,animation:u,eventHandler:l,scrollBounds:a,options:{loop:d}},f)=>{const h=n.settled(),p=!a.shouldConstrain(),g=d?h:h&&p,m=g&&!c.pointerDown();m&&u.stop();const b=e.get()*f+r.get()*(1-f);o.set(b),d&&(i.loop(n.direction()),s.loop()),t.to(o.get()),m&&l.emit("settle"),g||l.emit("scroll")})(Nn,n))),vn=hn[gn.get()],xn=L(vn),_n=L(vn),kn=L(vn),wn=L(vn),Sn=function(n,t,e,o,r){let i=0,s=0,c=r,a=.68,d=n.get(),f=0;function h(n){return c=n,g}function p(n){return a=n,g}const g={direction:function(){return s},duration:function(){return c},velocity:function(){return i},seek:function(){const t=o.get()-n.get();let r=0;return c?(e.set(n),i+=t/c,i*=a,d+=i,n.add(i),r=d-f):(i=0,e.set(o),n.set(o),r=t),s=l(r),f=d,g},settled:function(){return u(o.get()-t.get())<.001},useBaseFriction:function(){return p(.68)},useBaseDuration:function(){return h(r)},useFriction:p,useDuration:h};return g}(xn,kn,_n,wn,O),Cn=function(n,t,e,o,r){const{reachedAny:i,removeOffset:s,constrain:c}=o;function a(n){return n.concat().sort(((n,t)=>u(n)-u(t)))[0]}function d(t,o){const r=[t,t+e,t-e];if(!n)return t;if(!o)return a(r);const i=r.filter((n=>l(n)===o));return i.length?a(i):f(r)-e}return{byDistance:function(e,o){const l=r.get()+e,{index:a,distance:f}=function(e){const o=n?s(e):c(e),r=t.map(((n,t)=>({diff:d(n-o,0),index:t}))).sort(((n,t)=>u(n.diff)-u(t.diff))),{index:i}=r[0];return{index:i,distance:o}}(l),h=!n&&i(l);return!o||h?{index:a,distance:e}:{index:a,distance:e+d(t[a]-f,0)}},byIndex:function(n,e){return{index:n,distance:d(t[n]-r.get(),e)}},shortcut:d}}(B,hn,an,pn,wn),En=function(n,t,e,o,r,i,s){function c(r){const c=r.distance,u=r.index!==t.get();i.add(c),c&&(o.duration()?n.start():(n.update(),n.render(1),n.update())),u&&(e.set(t.get()),t.set(r.index),s.emit("select"))}return{distance:function(n,t){c(r.byDistance(n,t))},index:function(n,e){const o=t.clone().set(n);c(r.byIndex(o.get(),e))}}}(yn,gn,mn,Sn,Cn,wn,y),Ln=function(n){const{max:t,length:e}=n;return{get:function(n){return e?(n-t)/-e:0}}}(pn),In=v(),Mn=function(n,t,e,o){const r={};let i,s=null,c=null,u=!1;return{init:function(){i=new IntersectionObserver((n=>{u||(n.forEach((n=>{const e=t.indexOf(n.target);r[e]=n})),s=null,c=null,e.emit("slidesInView"))}),{root:n.parentElement,threshold:o}),t.forEach((n=>i.observe(n)))},destroy:function(){i&&i.disconnect(),u=!0},get:function(n=!0){if(n&&s)return s;if(!n&&c)return c;const t=function(n){return m(r).reduce(((t,e)=>{const o=parseInt(e),{isIntersecting:i}=r[o];return(n&&i||!n&&!i)&&t.push(o),t}),[])}(n);return n&&(s=t),n||(c=t),t}}}(t,e,y,D),{slideRegistry:Tn}=function(n,t,e,o,r,i){const{groupSlides:s}=r,{min:c,max:u}=o;return{slideRegistry:function(){const o=s(i);return 1===e.length?[i]:n&&"keepSnaps"!==t?o.slice(c,u).map(((n,t,e)=>{const o=!t,r=p(e,t);return o?g(f(e[0])+1):r?g(h(i)-f(e)[0]+1,f(e)[0]):n})):o}()}}(nn,G,hn,fn,cn,bn),An=function(n,t,e,o,i,c,u,l){const a={passive:!0,capture:!0};let d=0;function f(n){"Tab"===n.code&&(d=(new Date).getTime())}return{init:function(h){l&&(c.add(document,"keydown",f,!1),t.forEach(((t,f)=>{c.add(t,"focus",(t=>{(s(l)||l(h,t))&&function(t){if((new Date).getTime()-d>10)return;u.emit("slideFocusStart"),n.scrollLeft=0;const s=e.findIndex((n=>n.includes(t)));r(s)&&(i.useDuration(0),o.index(s,0),u.emit("slideFocus"))}(f)}),a)})))}}}(n,e,Tn,En,Sn,In,y,U),Nn={ownerDocument:o,ownerWindow:c,eventHandler:y,containerRect:q,slideRects:J,animation:yn,axis:Y,dragHandler:k(Y,n,o,c,wn,w(Y,c),xn,yn,En,Sn,Cn,gn,y,K,j,F,H,.68,Q),eventStore:In,percentOfView:K,index:gn,indexPrevious:mn,limit:pn,location:xn,offsetLocation:kn,previousLocation:_n,options:b,resizeHandler:S(t,y,c,e,Y,V,X),scrollBody:Sn,scrollBounds:C(pn,kn,wn,Sn,K),scrollLooper:E(an,pn,kn,[xn,kn,_n,wn]),scrollProgress:Ln,scrollSnapList:hn.map(Ln.get),scrollSnaps:hn,scrollTarget:Cn,scrollTo:En,slideLooper:M(Y,$,an,en,on,un,hn,kn,e),slideFocus:An,slidesHandler:T(t,y,W),slidesInView:Mn,slideIndexes:bn,slideRegistry:Tn,slidesToScroll:cn,target:wn,translate:I(Y,t)};return Nn}const N={align:"center",axis:"x",container:null,slides:null,containScroll:"trimSnaps",direction:"ltr",slidesToScroll:1,inViewThreshold:0,breakpoints:{},dragFree:!1,dragThreshold:10,loop:!1,skipSnaps:!1,duration:25,startIndex:0,active:!0,watchDrag:!0,watchResize:!0,watchSlides:!0,watchFocus:!0};function R(n){function t(n,t){return b(n,t||{})}return{mergeOptions:t,optionsAtMedia:function(e){const o=e.breakpoints||{},r=m(o).filter((t=>n.matchMedia(t).matches)).map((n=>o[n])).reduce(((n,e)=>t(n,e)),{});return t(e,r)},optionsMediaQueries:function(t){return t.map((n=>m(n.breakpoints||{}))).reduce(((n,t)=>n.concat(t)),[]).map(n.matchMedia)}}}function z(n,t,e){const o=n.ownerDocument,r=o.defaultView,s=R(r),c=function(n){let t=[];return{init:function(e,o){return t=o.filter((({options:t})=>!1!==n.optionsAtMedia(t).active)),t.forEach((t=>t.init(e,n))),o.reduce(((n,t)=>Object.assign(n,{[t.name]:t})),{})},destroy:function(){t=t.filter((n=>n.destroy()))}}}(s),u=v(),l=function(){let n,t={};function e(n){return t[n]||[]}const o={init:function(t){n=t},emit:function(t){return e(t).forEach((e=>e(n,t))),o},off:function(n,r){return t[n]=e(n).filter((n=>n!==r)),o},on:function(n,r){return t[n]=e(n).concat([r]),o},clear:function(){t={}}};return o}(),{mergeOptions:a,optionsAtMedia:d,optionsMediaQueries:f}=s,{on:h,off:p,emit:g}=l,m=I;let b,y,x,_,k=!1,w=a(N,z.globalOptions),S=a(w),C=[];function E(t){const e=A(n,x,_,o,r,t,l);return t.loop&&!e.slideLooper.canLoop()?E(Object.assign({},t,{loop:!1})):e}function L(t,e){k||(w=a(w,t),S=d(w),C=e||C,function(){const{container:t,slides:e}=S,o=i(t)?n.querySelector(t):t;x=o||n.children[0];const r=i(e)?x.querySelectorAll(e):e;_=[].slice.call(r||x.children)}(),b=E(S),f([w,...C.map((({options:n})=>n))]).forEach((n=>u.add(n,"change",I))),S.active&&(b.translate.to(b.location.get()),b.animation.init(),b.slidesInView.init(),b.slideFocus.init(O),b.eventHandler.init(O),b.resizeHandler.init(O),b.slidesHandler.init(O),b.options.loop&&b.slideLooper.loop(),x.offsetParent&&_.length&&b.dragHandler.init(O),y=c.init(O,C)))}function I(n,t){const e=B();M(),L(a({startIndex:e},n),t),l.emit("reInit")}function M(){b.dragHandler.destroy(),b.eventStore.clear(),b.translate.clear(),b.slideLooper.clear(),b.resizeHandler.destroy(),b.slidesHandler.destroy(),b.slidesInView.destroy(),b.animation.destroy(),c.destroy(),u.clear()}function T(n,t,e){S.active&&!k&&(b.scrollBody.useBaseFriction().useDuration(!0===t?0:S.duration),b.scrollTo.index(n,e||0))}function B(){return b.index.get()}const O={canScrollNext:function(){return b.index.add(1).get()!==B()},canScrollPrev:function(){return b.index.add(-1).get()!==B()},containerNode:function(){return x},internalEngine:function(){return b},destroy:function(){k||(k=!0,u.clear(),M(),l.emit("destroy"),l.clear())},off:p,on:h,emit:g,plugins:function(){return y},previousScrollSnap:function(){return b.indexPrevious.get()},reInit:m,rootNode:function(){return n},scrollNext:function(n){T(b.index.add(1).get(),n,-1)},scrollPrev:function(n){T(b.index.add(-1).get(),n,1)},scrollProgress:function(){return b.scrollProgress.get(b.offsetLocation.get())},scrollSnapList:function(){return b.scrollSnapList},scrollTo:T,selectedScrollSnap:B,slideNodes:function(){return _},slidesInView:function(){return b.slidesInView.get()},slidesNotInView:function(){return b.slidesInView.get(!1)}};return L(t,e),setTimeout((()=>l.emit("init")),0),O}z.globalOptions=void 0;const B=t(class extends e{constructor(n){super(),!1!==n&&this.__registerHost()}get el(){return this}items;loop=!0;class;controlClass;slideClass;itemClass;viewportRef;containerRef;slotRef;prevBtnRef;nextBtnRef;dotsRef;embla=null;movedNodes=[];prevClickHandler=null;nextClickHandler=null;dotClickHandlers=[];slotNodesMoved=!1;async scrollPrev(){this.embla?.scrollPrev()}async scrollNext(){this.embla?.scrollNext()}async goToSlide(n){this.embla?.scrollTo(n)}async getEmbla(){return this.embla}moveSlotNodesIntoContainer(){if(!this.slotRef||!this.containerRef||this.slotNodesMoved)return;const n=this.slotRef.assignedNodes().filter((n=>n.nodeType===Node.ELEMENT_NODE));0!==n.length&&(this.movedNodes=[],n.forEach((n=>{this.containerRef.appendChild(n),this.movedNodes.push(n)})),this.slotNodesMoved=!0,this.scheduleEmblaInit())}initScheduled=!1;scheduleEmblaInit(){this.initScheduled||(this.initScheduled=!0,requestAnimationFrame((()=>{this.initScheduled=!1,this.destroyEmbla(),this.initEmbla()})))}moveSlotNodesBack(){const n=this.el;this.movedNodes.forEach((t=>n.appendChild(t))),this.movedNodes=[]}initEmbla(){if(!this.viewportRef||!this.containerRef)return;const n=this.getItemsArray();if(!(void 0!==n?n.length>0:this.containerRef.children.length>0))return;this.embla=z(this.viewportRef,{loop:this.loop,align:"center",containScroll:"trimSnaps"});const t=this.prevBtnRef,e=this.nextBtnRef,o=this.dotsRef,r=()=>{t&&(this.embla?.canScrollPrev()?t.removeAttribute("disabled"):t.setAttribute("disabled","")),e&&(this.embla?.canScrollNext()?e.removeAttribute("disabled"):e.setAttribute("disabled",""))};if(this.embla.on("init",r),this.embla.on("reInit",r),this.embla.on("select",r),t&&e&&(this.prevClickHandler=()=>this.embla?.scrollPrev(),this.nextClickHandler=()=>this.embla?.scrollNext(),t.addEventListener("click",this.prevClickHandler),e.addEventListener("click",this.nextClickHandler)),o){const n=this.embla.scrollSnapList().length;o.innerHTML="";for(let t=0;t<n;t++){const n=document.createElement("button");n.type="button",n.setAttribute("aria-label","Go to slide "+(t+1)),n.className="carousel__dot",0===t&&n.classList.add("current");const e=document.createElement("div");e.className="carousel__dot-inner",n.appendChild(e);const r=t,i=()=>this.embla?.scrollTo(r);this.dotClickHandlers.push(i),n.addEventListener("click",i),o.appendChild(n)}this.embla.on("select",(()=>{const n=this.embla?.selectedScrollSnap()??0;o.querySelectorAll("button").forEach(((t,e)=>{t.classList.toggle("current",e===n)}))}))}r()}destroyEmbla(){this.prevBtnRef&&this.prevClickHandler&&(this.prevBtnRef.removeEventListener("click",this.prevClickHandler),this.prevClickHandler=null),this.nextBtnRef&&this.nextClickHandler&&(this.nextBtnRef.removeEventListener("click",this.nextClickHandler),this.nextClickHandler=null),this.dotClickHandlers=[],this.dotsRef&&(this.dotsRef.innerHTML=""),this.embla?.destroy(),this.embla=null}onSlotChange=()=>{void 0===this.getItemsArray()&&this.moveSlotNodesIntoContainer()};componentDidRender(){void 0===this.getItemsArray()?(this.slotRef&&(this.slotRef.removeEventListener("slotchange",this.onSlotChange),this.slotRef.addEventListener("slotchange",this.onSlotChange)),requestAnimationFrame((()=>{this.moveSlotNodesIntoContainer(),this.slotNodesMoved||(this.destroyEmbla(),this.initEmbla())}))):(this.destroyEmbla(),this.initEmbla())}disconnectedCallback(){this.slotRef&&this.slotRef.removeEventListener("slotchange",this.onSlotChange),this.destroyEmbla(),void 0===this.getItemsArray()&&(this.moveSlotNodesBack(),this.slotNodesMoved=!1)}getItemsArray(){if(void 0!==this.items){if(Array.isArray(this.items))return this.items;if("string"==typeof this.items)try{const n=JSON.parse(this.items);return Array.isArray(n)?n:void 0}catch{return}}}render(){const n=this.getItemsArray(),t=void 0!==n&&n.length>0;return o("div",{key:"3a2ea6c339bf0fe656e5a333789df7a37156b5dc",class:("carousel "+(this.class||"")).trim()},o("div",{key:"0a73b925095ae3188e5e40b024bc250e4c183894",class:("carousel__viewport "+(this.slideClass||"")).trim(),ref:n=>this.viewportRef=n},o("div",{key:"7fc3b5a72e386f7fa21702aeb363e08da1b728cf",class:"carousel__container",ref:n=>this.containerRef=n},t&&n?n.map(((n,t)=>o("div",{key:t,class:("carousel__slide "+(this.itemClass||"")).trim()},"object"==typeof n&&null!==n&&"content"in n?n.content:n+""))):null)),!t&&o("div",{key:"dee2fc91470728c136c9853cd74ae350ad3c5676",style:{display:"none"},"aria-hidden":"true"},o("slot",{key:"35dd47c03a1b9b6b73d845252c3d0482590f7da2",ref:n=>this.slotRef=n})),o("div",{key:"df639ad86ae8533f1dc15eed30afb70d99e36e1a",class:("carousel__controls "+(this.controlClass||"")).trim()},o("button",{key:"c17c0ea9bf023b5d2621e558c957d92b13425584",type:"button","aria-label":"Previous",class:"carousel__prev",ref:n=>this.prevBtnRef=n},o("svg",{key:"5125abcae0b08ee72106d511b4c24c2d0f24187b",class:"carousel__icon","stroke-width":"1.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true"},o("path",{key:"9b7f28be56f451ad14de226d7163a5587a1cd9e6","stroke-linecap":"round","stroke-linejoin":"round",d:"M15.75 19.5L8.25 12l7.5-7.5"}))),o("div",{key:"9939d3496092a3f319efac9132cec8097c83b497",class:"carousel__dots",ref:n=>this.dotsRef=n}),o("button",{key:"a0b1228f6df0065885f1d272386283926e78464b",type:"button","aria-label":"Next",class:"carousel__next",ref:n=>this.nextBtnRef=n},o("svg",{key:"e00c92cc0485f41a30e97d5d0466aaee48a64998",class:"carousel__icon","stroke-width":"1.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true"},o("path",{key:"a35c46fdbd1cd333d3e6f76590f45dd837546165","stroke-linecap":"round","stroke-linejoin":"round",d:"M8.25 4.5l7.5 7.5-7.5 7.5"})))))}static get style(){return":host{display:block}.carousel{display:flex;flex-direction:column;overflow:hidden}.carousel__viewport{overflow:hidden;touch-action:pan-y pinch-zoom}.carousel__container{display:flex;flex-direction:row;height:100%;margin-left:calc(-0.4rem)}.carousel__container ::slotted(*){flex:0 0 50%;width:50%;height:100%;padding-left:0.4rem;box-sizing:border-box}.carousel__slide{flex:0 0 50%;width:50%;height:100%;padding-left:0.4rem;box-sizing:border-box}.carousel__controls{display:flex;gap:0.25rem;margin-top:0.25rem;justify-content:center;align-items:center}.carousel__prev,.carousel__next{display:inline-flex;align-items:center;justify-content:center;padding:0;border:none;background:transparent;cursor:pointer;color:currentColor}.carousel__prev:disabled,.carousel__next:disabled{opacity:0.4;cursor:not-allowed}.carousel__icon{width:2.4rem;height:2.4rem}.carousel__dots{display:flex;gap:0.25rem;align-items:center}.carousel__dot{padding:0;border:none;background:none;cursor:pointer;width:0.5rem;height:0.5rem;display:flex;align-items:center;justify-content:center}.carousel__dot-inner{width:100%;height:100%;border-radius:50%;background-color:var(--carousel-dot-bg, #cbd5e1);transition:background-color 0.2s ease}.carousel__dot.current .carousel__dot-inner{background-color:var(--carousel-dot-active-bg, #94a3b8)}"}},[772,"fast-carousel",{items:[1],loop:[4],class:[1],controlClass:[1,"control-class"],slideClass:[1,"slide-class"],itemClass:[1,"item-class"],scrollPrev:[64],scrollNext:[64],goToSlide:[64],getEmbla:[64]}]);function O(){"undefined"!=typeof customElements&&["fast-carousel"].forEach((t=>{"fast-carousel"===t&&(customElements.get(n(t))||customElements.define(n(t),B))}))}O();const j=B,F=O;export{j as FastCarousel,F as defineCustomElement}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface FastInput extends Components.FastInput, HTMLElement {}
|
|
4
|
+
export const FastInput: {
|
|
5
|
+
prototype: FastInput;
|
|
6
|
+
new (): FastInput;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t,p as e,H as s,c as o,h as i}from"./p-BiaJAQXY.js";const a=e(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.searchExecuted=o(this,"searchExecuted"),this.inputChanged=o(this,"inputChanged")}placeholder="Search...";value="";paramName="keyword";enableAutocomplete=!1;autocompleteUrl="/api/jobs/autocomplete";targetPath;debounceMs=300;minChars=3;searchExecuted;inputChanged;inputValue="";suggestions=[];showDropdown=!1;autocompleteLoading=!1;debounceTimer;popstateHandler;connectedCallback(){const t=this.getUrlParam();this.inputValue=null!==t?t:this.value,this.popstateHandler=()=>{this.inputValue=this.getUrlParam()??""},window.addEventListener("popstate",this.popstateHandler)}disconnectedCallback(){window.removeEventListener("popstate",this.popstateHandler),clearTimeout(this.debounceTimer)}getUrlParam(){return new URLSearchParams(window.location.search).get(this.paramName)}updateUrlParam(t){const e=new URLSearchParams(window.location.search);t?e.set(this.paramName,t):e.delete(this.paramName);const s=""+e,o=s?`${window.location.pathname}?${s}`:window.location.pathname;history.pushState({},"",o)}submit(){this.updateUrlParam(this.inputValue),document.dispatchEvent(new CustomEvent("search-executed",{detail:{keyword:this.inputValue},bubbles:!0,composed:!0})),this.searchExecuted.emit({keyword:this.inputValue}),this.showDropdown=!1}handleInput=t=>{const e=t.target.value;this.inputValue=e,this.inputChanged.emit({value:e}),this.enableAutocomplete&&this.scheduleAutocomplete(e)};handleKeydown=t=>{"Enter"===t.key?this.submit():"Escape"===t.key&&(this.showDropdown=!1)};handleBlur=()=>{this.showDropdown=!1};scheduleAutocomplete(t){clearTimeout(this.debounceTimer),t.length<this.minChars?this.showDropdown=!1:this.debounceTimer=setTimeout((()=>this.fetchSuggestions(t)),this.debounceMs)}async fetchSuggestions(t){if(this.targetPath){this.autocompleteLoading=!0,this.showDropdown=!0;try{const e=await fetch(this.autocompleteUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({keyword:t,target_path:this.targetPath})});if(!e.ok)throw Error("autocomplete request failed");const s=await e.json();this.suggestions=s}catch{this.showDropdown=!1,this.suggestions=[]}finally{this.autocompleteLoading=!1}}else console.warn("[fast-input] target-path is required for autocomplete")}selectSuggestion(t){this.inputValue=t,this.showDropdown=!1,this.submit()}render(){return i("div",{key:"3a9d31c7b109205600addc326d63979585f10bcd",class:"fast-input"},i("input",{key:"8f238fe9e002f367d4939616be8c06d938d76045",type:"text",class:"fast-input__field",placeholder:this.placeholder,value:this.inputValue,onInput:this.handleInput,onKeyDown:this.handleKeydown,onBlur:this.handleBlur}),i("button",{key:"7b7404f13432750ece669da8ce68be15179921de",class:"fast-input__button",type:"button",onClick:()=>this.submit()},"Search"),this.enableAutocomplete&&this.showDropdown&&i("ul",{key:"1438bacadc21c183842a8bdaa3f336bffb152e14",class:"fast-input__dropdown"},this.autocompleteLoading?i("li",{class:"fast-input__dropdown-loading"},"Loading..."):this.suggestions.map((t=>i("li",{class:"fast-input__dropdown-item",onMouseDown:t=>{t.preventDefault()},onClick:()=>this.selectSuggestion(t.title)},t.title)))))}static get style(){return".fast-input{position:relative;display:inline-flex;gap:0.5rem}.fast-input__field{flex:1;padding:0.5rem 0.75rem;font-size:1rem;border:1px solid #ccc;border-radius:4px}.fast-input__button{padding:0.5rem 1rem;font-size:1rem;cursor:pointer;background:#0070f3;color:#fff;border:none;border-radius:4px}.fast-input__dropdown{position:absolute;top:100%;left:0;right:0;margin:0;padding:0;list-style:none;background:#fff;border:1px solid #ccc;border-top:none;border-radius:0 0 4px 4px;z-index:100;max-height:200px;overflow-y:auto}.fast-input__dropdown-item{padding:0.5rem 0.75rem;cursor:pointer}.fast-input__dropdown-item:hover{background:#f0f0f0}.fast-input__dropdown-loading{padding:0.5rem 0.75rem;color:#999;font-style:italic}"}},[512,"fast-input",{placeholder:[1],value:[1],paramName:[1,"param-name"],enableAutocomplete:[4,"enable-autocomplete"],autocompleteUrl:[1,"autocomplete-url"],targetPath:[1,"target-path"],debounceMs:[2,"debounce-ms"],minChars:[2,"min-chars"],inputValue:[32],suggestions:[32],showDropdown:[32],autocompleteLoading:[32]}]);function n(){"undefined"!=typeof customElements&&["fast-input"].forEach((e=>{"fast-input"===e&&(customElements.get(t(e))||customElements.define(t(e),a))}))}n();const r=a,d=n;export{r as FastInput,d as defineCustomElement}
|
package/dist/components/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{g as getAssetPath,r as render,s as setAssetPath,a as setNonce,b as setPlatformOptions}from"./p-
|
|
1
|
+
export{g as getAssetPath,r as render,s as setAssetPath,a as setNonce,b as setPlatformOptions}from"./p-BiaJAQXY.js";function t(s,t,e){return(s||"")+(t?" "+t:"")+(e?" "+e:"")}export{t as format}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface JobCard extends Components.JobCard, HTMLElement {}
|
|
4
|
+
export const JobCard: {
|
|
5
|
+
prototype: JobCard;
|
|
6
|
+
new (): JobCard;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|