adp-web-components 0.3.18 → 0.3.20
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/{branch-slot-dropdown_15.cjs.entry.js → branch-date-dropdown_17.cjs.entry.js} +958 -68
- package/dist/cjs/dead-stock-lookup_3.cjs.entry.js +9 -9
- package/dist/cjs/flexible-container.cjs.entry.js +3 -3
- package/dist/cjs/form-checkbox.cjs.entry.js +2 -2
- package/dist/cjs/form-date-picker.cjs.entry.js +5 -5
- package/dist/cjs/form-input_7.cjs.entry.js +21 -19
- package/dist/cjs/form-switch.cjs.entry.js +2 -2
- package/dist/cjs/form-time-picker.cjs.entry.js +6 -6
- package/dist/cjs/{functions-C9XsBzrL.js → functions-BAUJUMt-.js} +44 -19
- package/dist/cjs/general-form.cjs.entry.js +6 -6
- package/dist/cjs/general-inquiry-form.cjs.entry.js +6 -6
- package/dist/cjs/{get-local-language-BnUadlVY.js → get-local-language-DI_UK6D5.js} +1 -1
- package/dist/cjs/{get-mock-files-Dr5dpq1N.js → get-mock-files-B1tNGb9m.js} +1 -1
- package/dist/cjs/information-table.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/loading-spinner.cjs.entry.js +2 -2
- package/dist/cjs/manufacturer-part-lookup.cjs.entry.js +3 -3
- package/dist/cjs/{mappers-BlH-TAo7.js → mappers-DnWgECCv.js} +54 -18
- package/dist/cjs/part-lookup.cjs.entry.js +2 -2
- package/dist/cjs/service-booking-form.cjs.entry.js +6 -6
- package/dist/cjs/shift-accordion.cjs.entry.js +2 -2
- package/dist/cjs/shift-checkbox.cjs.entry.js +2 -2
- package/dist/cjs/shift-components.cjs.js +1 -1
- package/dist/cjs/shift-slider.cjs.entry.js +1 -1
- package/dist/cjs/shift-switch.cjs.entry.js +2 -2
- package/dist/cjs/shift-tab-content.cjs.entry.js +2 -2
- package/dist/cjs/shift-tabs_2.cjs.entry.js +92 -34
- package/dist/cjs/ssc-lookup-form.cjs.entry.js +6 -6
- package/dist/cjs/test-drive-form.cjs.entry.js +6 -6
- package/dist/cjs/triangle-alert-CTvU1eGY.js +248 -0
- package/dist/cjs/vehicle-accessories_8.cjs.entry.js +177 -117
- package/dist/cjs/vehicle-lookup.cjs.entry.js +3 -3
- package/dist/cjs/vehicle-quotation-form.cjs.entry.js +17 -18
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/components/empty.css +1 -1
- package/dist/collection/components/components/flexible-container.css +1 -1
- package/dist/collection/components/components/flexible-container.js +2 -2
- package/dist/collection/components/components/information-table.css +1 -1
- package/dist/collection/components/components/loading-spinner.css +1 -1
- package/dist/collection/components/components/loading-spinner.js +1 -1
- package/dist/collection/components/components/shift-accordion.css +1 -1
- package/dist/collection/components/components/shift-accordion.js +1 -1
- package/dist/collection/components/components/shift-checkbox.js +1 -1
- package/dist/collection/components/components/shift-portal.css +1 -1
- package/dist/collection/components/components/shift-select-dropdown.css +1 -1
- package/dist/collection/components/components/shift-select-dropdown.js +2 -2
- package/dist/collection/components/components/shift-select.css +1 -1
- package/dist/collection/components/components/shift-select.js +3 -3
- package/dist/collection/components/components/shift-slider.js +1 -1
- package/dist/collection/components/components/shift-switch.js +1 -1
- package/dist/collection/components/components/shift-tab-content.css +1 -1
- package/dist/collection/components/components/shift-tab-content.js +1 -1
- package/dist/collection/components/components/shift-tabs.css +1 -1
- package/dist/collection/components/components/shift-tabs.js +2 -2
- package/dist/collection/components/form-elements/branch-date-dropdown.css +1 -0
- package/dist/collection/components/form-elements/branch-date-dropdown.js +682 -0
- package/dist/collection/components/form-elements/branch-date-picker.css +1 -0
- package/dist/collection/components/form-elements/branch-date-picker.js +1197 -0
- package/dist/collection/components/form-elements/branch-slot-dropdown.css +1 -1
- package/dist/collection/components/form-elements/branch-slot-dropdown.js +11 -6
- package/dist/collection/components/form-elements/branch-slot-picker.css +1 -1
- package/dist/collection/components/form-elements/branch-slot-picker.js +166 -18
- package/dist/collection/components/form-elements/form-checkbox.js +1 -1
- package/dist/collection/components/form-elements/form-date-picker-legacy.js +4 -4
- package/dist/collection/components/form-elements/form-dialog.css +1 -1
- package/dist/collection/components/form-elements/form-dialog.js +1 -1
- package/dist/collection/components/form-elements/form-file.js +2 -2
- package/dist/collection/components/form-elements/form-input.js +6 -4
- package/dist/collection/components/form-elements/form-inputs.css +1 -1
- package/dist/collection/components/form-elements/form-phone-number.js +4 -2
- package/dist/collection/components/form-elements/form-picker-input.js +6 -4
- package/dist/collection/components/form-elements/form-shadow-input.js +1 -1
- package/dist/collection/components/form-elements/form-stepper-control.js +2 -2
- package/dist/collection/components/form-elements/form-stepper-submit.js +2 -2
- package/dist/collection/components/form-elements/form-stepper.js +1 -1
- package/dist/collection/components/form-elements/form-structure-error.js +1 -1
- package/dist/collection/components/form-elements/form-submit.js +2 -2
- package/dist/collection/components/form-elements/form-switch.js +1 -1
- package/dist/collection/components/form-elements/form-text-area.js +6 -4
- package/dist/collection/components/form-elements/form-time-picker-legacy.js +5 -5
- package/dist/collection/components/form-elements/form-vin-input.js +6 -4
- package/dist/collection/components/forms/defaults/mappers.js +54 -18
- package/dist/collection/components/forms/defaults/style.css +1 -1
- package/dist/collection/components/forms/general-form.js +2 -2
- package/dist/collection/components/forms/general-inquiry.js +2 -2
- package/dist/collection/components/forms/service-booking.js +2 -2
- package/dist/collection/components/forms/ssc-lookup.js +2 -2
- package/dist/collection/components/forms/test-drive.js +2 -2
- package/dist/collection/components/forms/vehicle-quotation/themes.css +1 -1
- package/dist/collection/components/forms/vehicle-quotation.js +15 -16
- package/dist/collection/components/part-lookup/dead-stock-lookup.css +1 -1
- package/dist/collection/components/part-lookup/dead-stock-lookup.js +2 -2
- package/dist/collection/components/part-lookup/distributor-lookup.css +1 -1
- package/dist/collection/components/part-lookup/distributor-lookup.js +2 -2
- package/dist/collection/components/part-lookup/manufacturer-lookup.css +1 -1
- package/dist/collection/components/part-lookup/manufacturer-part-lookup.css +1 -1
- package/dist/collection/components/part-lookup/manufacturer-part-lookup.js +1 -1
- package/dist/collection/components/part-lookup/part-lookup.css +1 -1
- package/dist/collection/components/vehicle-lookup/components/claimable-item-popover.js +37 -29
- package/dist/collection/components/vehicle-lookup/components/claimable-trace-modal.js +6 -2
- package/dist/collection/components/vehicle-lookup/components/service-history-sub-row.js +3 -3
- package/dist/collection/components/vehicle-lookup/vehicle-accessories.css +1 -1
- package/dist/collection/components/vehicle-lookup/vehicle-accessories.js +2 -2
- package/dist/collection/components/vehicle-lookup/vehicle-claimable-items.css +1 -1
- package/dist/collection/components/vehicle-lookup/vehicle-claimable-items.js +121 -70
- package/dist/collection/components/vehicle-lookup/vehicle-item-claim-form.css +1 -1
- package/dist/collection/components/vehicle-lookup/vehicle-item-claim-form.js +89 -29
- package/dist/collection/components/vehicle-lookup/vehicle-lookup.css +1 -1
- package/dist/collection/components/vehicle-lookup/vehicle-paint-thickness.css +1 -1
- package/dist/collection/components/vehicle-lookup/vehicle-sale-information.css +1 -1
- package/dist/collection/components/vehicle-lookup/vehicle-sale-information.js +2 -2
- package/dist/collection/components/vehicle-lookup/vehicle-service-history.css +1 -1
- package/dist/collection/components/vehicle-lookup/vehicle-service-history.js +1 -1
- package/dist/collection/components/vehicle-lookup/vehicle-specification.css +1 -1
- package/dist/collection/components/vehicle-lookup/vehicle-specification.js +1 -1
- package/dist/collection/components/vehicle-lookup/vehicle-warranty-details.css +1 -1
- package/dist/collection/components/vehicle-lookup/vehicle-warranty-timeline.css +1 -1
- package/dist/collection/components/vehicle-lookup/vehicle-warranty-timeline.js +1 -1
- package/dist/collection/components/vin-extractor/vin-extractor.css +1 -1
- package/dist/collection/components/vin-extractor/vin-extractor.js +1 -1
- package/dist/collection/features/form-hook/functions.js +42 -18
- package/dist/collection/global/lib/overlay.js +154 -0
- package/dist/collection/global/lib/slot-day-rules.js +65 -0
- package/dist/collection/templates/assets/adp-wordmark.svg +1 -0
- package/dist/collection/templates/assets/favicon.svg +17 -0
- package/dist/collection/templates/forms/docs-content/params.js +1199 -0
- package/dist/collection/templates/forms/docs-content/structure.js +1153 -0
- package/dist/collection/templates/forms/docs-content/theming.js +1240 -0
- package/dist/collection/templates/harness-theme.js +44 -0
- package/dist/collection/templates/harness.js +775 -0
- package/dist/collection/templates/highlight.js +194 -0
- package/dist/collection/templates/nav.js +320 -0
- package/dist/collection/templates/site-header.js +642 -0
- package/dist/collection/templates/site-locales.js +771 -0
- package/dist/components/branch-date-dropdown.d.ts +11 -0
- package/dist/components/branch-date-dropdown.js +5 -0
- package/dist/components/branch-date-picker.d.ts +11 -0
- package/dist/components/branch-date-picker.js +5 -0
- package/dist/components/branch-slot-dropdown.js +1 -1
- package/dist/components/branch-slot-picker.js +1 -1
- package/dist/components/dead-stock-lookup.js +1 -1
- package/dist/components/distributor-lookup.js +1 -1
- package/dist/components/flexible-container.js +1 -1
- package/dist/components/form-checkbox.js +1 -1
- package/dist/components/form-date-picker.js +1 -1
- package/dist/components/form-dialog.js +1 -1
- package/dist/components/form-file.js +1 -1
- package/dist/components/form-input-preview.js +1 -1
- package/dist/components/form-input.js +1 -1
- package/dist/components/form-phone-number.js +1 -1
- package/dist/components/form-picker-input.js +1 -1
- package/dist/components/form-select.js +1 -1
- package/dist/components/form-shadow-input.js +1 -1
- package/dist/components/form-stepper-control.js +1 -1
- package/dist/components/form-stepper-submit.js +1 -1
- package/dist/components/form-stepper.js +1 -1
- package/dist/components/form-structure-error.js +1 -1
- package/dist/components/form-structure.js +1 -1
- package/dist/components/form-submit.js +1 -1
- package/dist/components/form-switch.js +1 -1
- package/dist/components/form-text-area.js +1 -1
- package/dist/components/form-time-picker.js +1 -1
- package/dist/components/form-vin-input.js +1 -1
- package/dist/components/general-form.js +1 -1
- package/dist/components/general-inquiry-form.js +1 -1
- package/dist/components/information-table.js +1 -1
- package/dist/components/loading-spinner.js +1 -1
- package/dist/components/manufacturer-lookup.js +1 -1
- package/dist/components/manufacturer-part-lookup.js +1 -1
- package/dist/components/p--lk4OUJg.js +5 -0
- package/dist/components/p-38ox9qxm.js +5 -0
- package/dist/components/p-5OD_mwiD.js +5 -0
- package/dist/components/{p-D7wRHBb3.js → p-68bjv9gT.js} +1 -1
- package/dist/components/p-B0_5_VvS.js +5 -0
- package/dist/components/p-B1xVBTqj.js +5 -0
- package/dist/components/{p-B0lK-5c_.js → p-B2bD-55K.js} +1 -1
- package/dist/components/{p-Bs5AIefE.js → p-BI5NL1Rh.js} +1 -1
- package/dist/components/{p-Be01Kv65.js → p-BPXRokES.js} +1 -1
- package/dist/components/{p-oZMLGlUq.js → p-BULuujHY.js} +1 -1
- package/dist/components/{p-B6EgLMus.js → p-BWlX-Nz-.js} +1 -1
- package/dist/components/p-Bc5HIbcj.js +5 -0
- package/dist/components/p-BcWJAP8j.js +5 -0
- package/dist/components/p-BpB_86n0.js +5 -0
- package/dist/components/p-BpHkd1L9.js +5 -0
- package/dist/components/{p-B0tcNl8W.js → p-BsnGFZeT.js} +1 -1
- package/dist/components/{p-B_jDD5xI.js → p-BvLVCp-j.js} +1 -1
- package/dist/components/p-C3KLOUbk.js +5 -0
- package/dist/components/{p-DgJ9CCPI.js → p-CJtTHErI.js} +1 -1
- package/dist/components/{p-DcB3e3j1.js → p-CMAmzdM7.js} +1 -1
- package/dist/components/p-CVpbr1tR.js +5 -0
- package/dist/components/{p-BVdlf8rx.js → p-CXbi5iPZ.js} +1 -1
- package/dist/components/p-C_1_eN4N.js +5 -0
- package/dist/components/{p-TtDq4UV5.js → p-Ce2mazYo.js} +1 -1
- package/dist/components/p-Cg6Prz81.js +5 -0
- package/dist/components/{p-l738xIxs.js → p-Cpjvk1pk.js} +1 -1
- package/dist/components/p-CqJiXtPb.js +5 -0
- package/dist/components/p-CrPyvAdX.js +5 -0
- package/dist/components/{p-C31A3MHr.js → p-CsU_c7eX.js} +1 -1
- package/dist/components/{p-Ci6k5mSb.js → p-D42YuMNZ.js} +1 -1
- package/dist/components/{p-Dhi7g1w3.js → p-DCpRGVqe.js} +1 -1
- package/dist/components/{p-D9pKibY5.js → p-DCsMDWbS.js} +1 -1
- package/dist/components/{p-BMnQwtNn.js → p-DQ0uTCi2.js} +1 -1
- package/dist/components/p-DTmI_Yx0.js +5 -0
- package/dist/components/p-DnspXuVN.js +5 -0
- package/dist/components/p-DqSdjh2n.js +5 -0
- package/dist/components/p-Dv2j7fhS.js +5 -0
- package/dist/components/{p-BUczNscD.js → p-K-OF4DG-.js} +1 -1
- package/dist/components/p-KSvRVGk-.js +5 -0
- package/dist/components/p-KbiYvxzP.js +5 -0
- package/dist/components/{p-DG-IgRFW.js → p-OY4Ixaeq.js} +1 -1
- package/dist/components/{p-BiaT4YFg.js → p-SIS25ChD.js} +1 -1
- package/dist/components/p-Wgb4y0H3.js +5 -0
- package/dist/components/p-X3AzJ0KD.js +5 -0
- package/dist/components/{p-gzdpekMI.js → p-bCeQwUKM.js} +1 -1
- package/dist/components/p-d3ZIPeEC.js +5 -0
- package/dist/components/{p-DlqfD7uh.js → p-ikaUQvOO.js} +1 -1
- package/dist/components/p-mbVTvSJF.js +5 -0
- package/dist/components/{p-DTdm5I7a.js → p-rQ3Z9EnS.js} +1 -1
- package/dist/components/{p-BmQrqnnJ.js → p-uYkn8a0m.js} +1 -1
- package/dist/components/part-lookup.js +1 -1
- package/dist/components/service-booking-form.js +1 -1
- package/dist/components/shift-accordion.js +1 -1
- package/dist/components/shift-checkbox.js +1 -1
- package/dist/components/shift-portal.js +1 -1
- package/dist/components/shift-select-dropdown.js +1 -1
- package/dist/components/shift-select.js +1 -1
- package/dist/components/shift-slider.js +1 -1
- package/dist/components/shift-switch.js +1 -1
- package/dist/components/shift-tab-content.js +1 -1
- package/dist/components/shift-tabs.js +1 -1
- package/dist/components/ssc-lookup-form.js +1 -1
- package/dist/components/test-drive-form.js +1 -1
- package/dist/components/vehicle-accessories.js +1 -1
- package/dist/components/vehicle-claimable-items.js +1 -1
- package/dist/components/vehicle-item-claim-form.js +1 -1
- package/dist/components/vehicle-lookup.js +1 -1
- package/dist/components/vehicle-paint-thickness.js +1 -1
- package/dist/components/vehicle-quotation-form.js +1 -1
- package/dist/components/vehicle-sale-information.js +1 -1
- package/dist/components/vehicle-service-history.js +1 -1
- package/dist/components/vehicle-specification.js +1 -1
- package/dist/components/vehicle-warranty-details.js +1 -1
- package/dist/components/vehicle-warranty-timeline.js +1 -1
- package/dist/components/vin-extractor.js +1 -1
- package/dist/esm/{branch-slot-dropdown_15.entry.js → branch-date-dropdown_17.entry.js} +957 -69
- package/dist/esm/dead-stock-lookup_3.entry.js +9 -9
- package/dist/esm/flexible-container.entry.js +3 -3
- package/dist/esm/form-checkbox.entry.js +2 -2
- package/dist/esm/form-date-picker.entry.js +5 -5
- package/dist/esm/form-input_7.entry.js +21 -19
- package/dist/esm/form-switch.entry.js +2 -2
- package/dist/esm/form-time-picker.entry.js +6 -6
- package/dist/esm/{functions-COLiDjnd.js → functions-DSwc1YVL.js} +44 -20
- package/dist/esm/general-form.entry.js +6 -6
- package/dist/esm/general-inquiry-form.entry.js +6 -6
- package/dist/esm/{get-local-language-CACck9dv.js → get-local-language-DdSAPSCV.js} +1 -1
- package/dist/esm/{get-mock-files-BEIYZlS_.js → get-mock-files-D4naDetb.js} +1 -1
- package/dist/esm/information-table.entry.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/loading-spinner.entry.js +2 -2
- package/dist/esm/manufacturer-part-lookup.entry.js +3 -3
- package/dist/esm/{mappers-9IKbvPiR.js → mappers-CZs2R7k6.js} +54 -18
- package/dist/esm/part-lookup.entry.js +2 -2
- package/dist/esm/service-booking-form.entry.js +6 -6
- package/dist/esm/shift-accordion.entry.js +2 -2
- package/dist/esm/shift-checkbox.entry.js +2 -2
- package/dist/esm/shift-components.js +1 -1
- package/dist/esm/shift-slider.entry.js +1 -1
- package/dist/esm/shift-switch.entry.js +2 -2
- package/dist/esm/shift-tab-content.entry.js +2 -2
- package/dist/esm/shift-tabs_2.entry.js +92 -34
- package/dist/esm/ssc-lookup-form.entry.js +6 -6
- package/dist/esm/test-drive-form.entry.js +6 -6
- package/dist/esm/triangle-alert-BlnfPzWh.js +237 -0
- package/dist/esm/vehicle-accessories_8.entry.js +177 -117
- package/dist/esm/vehicle-lookup.entry.js +3 -3
- package/dist/esm/vehicle-quotation-form.entry.js +17 -18
- package/dist/integration-manifest.json +1 -1
- package/dist/locales/vehicleLookup/serviceHistory/en.json +2 -2
- package/dist/shift-components/{p-a91ed0fc.entry.js → p-0b576888.entry.js} +1 -1
- package/dist/shift-components/p-11ffa908.entry.js +5 -0
- package/dist/shift-components/{p-b2048d87.entry.js → p-152057de.entry.js} +1 -1
- package/dist/shift-components/p-198333fa.entry.js +5 -0
- package/dist/shift-components/{p-537507ee.entry.js → p-247ac2db.entry.js} +1 -1
- package/dist/shift-components/{p-1923fdb9.entry.js → p-295e445f.entry.js} +1 -1
- package/dist/shift-components/p-431522f2.entry.js +5 -0
- package/dist/shift-components/{p-b1270d98.entry.js → p-49dc6d73.entry.js} +1 -1
- package/dist/shift-components/{p-ac91d4ce.entry.js → p-4b6f801a.entry.js} +1 -1
- package/dist/shift-components/{p-6263bc0c.entry.js → p-4cdeab63.entry.js} +1 -1
- package/dist/shift-components/{p-829f24b9.entry.js → p-52530fba.entry.js} +1 -1
- package/dist/shift-components/p-5ad4d072.entry.js +5 -0
- package/dist/shift-components/{p-a0d13479.entry.js → p-5e8e5ed7.entry.js} +1 -1
- package/dist/shift-components/{p-65aad39b.entry.js → p-68e41217.entry.js} +1 -1
- package/dist/shift-components/{p-f2b86186.entry.js → p-76b0ea8c.entry.js} +1 -1
- package/dist/shift-components/{p-fdf94f65.entry.js → p-85d43a41.entry.js} +1 -1
- package/dist/shift-components/p-B9INqdFT.js +5 -0
- package/dist/shift-components/p-BkVfhjgg.js +5 -0
- package/dist/shift-components/{p--JyU3LyU.js → p-D2Ofzg_i.js} +1 -1
- package/dist/shift-components/p-DDtDRGFL.js +5 -0
- package/dist/shift-components/{p-jmNTa9tM.js → p-OfPuHUYc.js} +1 -1
- package/dist/shift-components/p-b44b2c00.entry.js +5 -0
- package/dist/shift-components/{p-48a9feb9.entry.js → p-b4544d10.entry.js} +1 -1
- package/dist/shift-components/{p-853f1b8b.entry.js → p-bfe0661c.entry.js} +1 -1
- package/dist/shift-components/{p-e7a99998.entry.js → p-c7fc8d5f.entry.js} +1 -1
- package/dist/shift-components/{p-bb172fc4.entry.js → p-ca0683e9.entry.js} +1 -1
- package/dist/shift-components/{p-cfcfdb20.entry.js → p-cbdc1c2e.entry.js} +1 -1
- package/dist/shift-components/p-d3bbba07.entry.js +5 -0
- package/dist/shift-components/{p-ec2a7d65.entry.js → p-df0c7ac1.entry.js} +1 -1
- package/dist/shift-components/p-f4679148.entry.js +5 -0
- package/dist/shift-components/{p-c4cf0a18.entry.js → p-feb443ec.entry.js} +1 -1
- package/dist/shift-components/shift-components.esm.js +1 -1
- package/dist/stencil-docs.json +1677 -12
- package/dist/templates/production-host/vehicle-service-history.html +14 -0
- package/dist/types/components/form-elements/branch-date-dropdown.d.ts +74 -0
- package/dist/types/components/form-elements/branch-date-picker.d.ts +174 -0
- package/dist/types/components/form-elements/branch-slot-dropdown.d.ts +6 -0
- package/dist/types/components/form-elements/branch-slot-picker.d.ts +27 -0
- package/dist/types/components/forms/defaults/mappers.d.ts +15 -9
- package/dist/types/components/vehicle-lookup/components/claimable-item-popover.d.ts +10 -1
- package/dist/types/components/vehicle-lookup/components/claimable-trace-modal.d.ts +3 -0
- package/dist/types/components/vehicle-lookup/vehicle-claimable-items.d.ts +14 -4
- package/dist/types/components/vehicle-lookup/vehicle-item-claim-form.d.ts +23 -3
- package/dist/types/components.d.ts +533 -6
- package/dist/types/features/form-hook/functions.d.ts +14 -0
- package/dist/types/global/lib/overlay.d.ts +61 -0
- package/dist/types/global/lib/slot-day-rules.d.ts +25 -0
- package/dist/types/locales/vehicleLookup/serviceHistory/type.d.ts +2 -2
- package/dist/types/locales/vehicleLookup/warrantyTimeline/type.d.ts +4 -4
- package/dist/types/locales/vehicleLookup/wrapper-type.d.ts +2 -2
- package/package.json +15 -3
- package/dist/cjs/triangle-alert-BjQBwsRv.js +0 -92
- package/dist/components/p-BQHywBX6.js +0 -5
- package/dist/components/p-Bb4mauUH.js +0 -5
- package/dist/components/p-Bl_BMBad.js +0 -5
- package/dist/components/p-BogCz_yJ.js +0 -5
- package/dist/components/p-BvFDjUZZ.js +0 -5
- package/dist/components/p-C2trAVtF.js +0 -5
- package/dist/components/p-CCuYl9VQ.js +0 -5
- package/dist/components/p-CNqcMKLv.js +0 -5
- package/dist/components/p-CZWmJ1vV.js +0 -5
- package/dist/components/p-Cg4l7ICV.js +0 -5
- package/dist/components/p-Ci6LbIzY.js +0 -5
- package/dist/components/p-CuTemmgW.js +0 -5
- package/dist/components/p-D0oXezbg.js +0 -5
- package/dist/components/p-DBKG_o1-.js +0 -5
- package/dist/components/p-Dlm9wHfQ.js +0 -5
- package/dist/components/p-DsMy6H9e.js +0 -5
- package/dist/components/p-Dseg250d.js +0 -5
- package/dist/components/p-EVz84xxv.js +0 -5
- package/dist/components/p-SnXklPq9.js +0 -5
- package/dist/components/p-k8G1hnHC.js +0 -5
- package/dist/components/p-uPiGNvhQ.js +0 -5
- package/dist/esm/triangle-alert-Brtqhx2d.js +0 -86
- package/dist/shift-components/p-34dffc00.entry.js +0 -5
- package/dist/shift-components/p-6fa1121c.entry.js +0 -5
- package/dist/shift-components/p-782fe0e1.entry.js +0 -5
- package/dist/shift-components/p-9a6450f6.entry.js +0 -5
- package/dist/shift-components/p-B9kqtQjS.js +0 -5
- package/dist/shift-components/p-D0Md1Xf7.js +0 -5
- package/dist/shift-components/p-c66b18c9.entry.js +0 -5
- package/dist/shift-components/p-c9a7e5ab.entry.js +0 -5
- package/dist/shift-components/p-fa7a961c.entry.js +0 -5
- package/dist/shift-components/p-hABirfUj.js +0 -5
- /package/dist/collection/templates/{vehicle-lookup → prototypes}/prototype-assets/extended-warranty/adp-logo.svg +0 -0
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* adp-web-components — the showcase syntax highlighter.
|
|
3
|
+
*
|
|
4
|
+
* A highlighter in about fifty lines of rules, because the alternative is a CDN
|
|
5
|
+
* script tag and §3 of the design language exists to keep those off these pages.
|
|
6
|
+
*
|
|
7
|
+
* One pass per snippet: a single alternation walks the string, so a token
|
|
8
|
+
* already emitted is never re-scanned. Sequential .replace() calls would match
|
|
9
|
+
* `class="tok-key"` inside their own output. Every pattern uses NON-CAPTURING
|
|
10
|
+
* groups only — the group index IS the rule index, which is how a match is
|
|
11
|
+
* traced back to the rule that produced it.
|
|
12
|
+
*
|
|
13
|
+
* Five token classes exist and no more. They are styled in
|
|
14
|
+
* `templates/harness.src.css`, which is COMPILED into the gitignored
|
|
15
|
+
* harness.css, so a sixth class here would render as plain body text and a
|
|
16
|
+
* renamed one would silently lose its colour:
|
|
17
|
+
*
|
|
18
|
+
* tok-key magenta keywords, selectors, at-rules, literals
|
|
19
|
+
* tok-str green strings and literal values
|
|
20
|
+
* tok-attr blue names you address — attributes, JSON keys, CSS
|
|
21
|
+
* properties, shadow parts
|
|
22
|
+
* tok-comment grey comments
|
|
23
|
+
* tok-punct grey structural punctuation
|
|
24
|
+
*
|
|
25
|
+
* Kept deliberately dumb. None of these grammars is a parser: they carry no
|
|
26
|
+
* state, so they cannot know whether they are inside a rule block or a selector
|
|
27
|
+
* list, and each is tuned for the shape the showcase actually prints —
|
|
28
|
+
* hand-written, one declaration per line. Minified input degrades; it does not
|
|
29
|
+
* break.
|
|
30
|
+
*
|
|
31
|
+
* Usage:
|
|
32
|
+
*
|
|
33
|
+
* import { highlight } from '../highlight.js';
|
|
34
|
+
*
|
|
35
|
+
* element.innerHTML = highlight(source, 'css');
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
export const GRAMMARS = {
|
|
39
|
+
HTML: [
|
|
40
|
+
{ token: 'comment', pattern: '<!--[\\s\\S]*?-->' },
|
|
41
|
+
{ token: 'str', pattern: '"[^"]*"' },
|
|
42
|
+
{ token: 'key', pattern: '</?[a-zA-Z][\\w-]*' },
|
|
43
|
+
{ token: 'attr', pattern: '[a-zA-Z-]+(?==)' },
|
|
44
|
+
{ token: 'punct', pattern: '/?>' },
|
|
45
|
+
],
|
|
46
|
+
JavaScript: [
|
|
47
|
+
{ token: 'comment', pattern: '//[^\\n]*' },
|
|
48
|
+
{ token: 'str', pattern: "'[^']*'" },
|
|
49
|
+
{ token: 'key', pattern: '\\b(?:import|from|await|const|let|new|return|try|catch|document)\\b' },
|
|
50
|
+
{ token: 'attr', pattern: '\\b[a-zA-Z_$][\\w$]*(?=\\s*:)' },
|
|
51
|
+
{ token: 'punct', pattern: '[{}();,]' },
|
|
52
|
+
],
|
|
53
|
+
Shell: [
|
|
54
|
+
{ token: 'comment', pattern: '#[^\\n]*' },
|
|
55
|
+
{ token: 'key', pattern: '^\\S+' },
|
|
56
|
+
],
|
|
57
|
+
|
|
58
|
+
/*
|
|
59
|
+
* JSON. A key is a string sitting in front of a colon, and that is the one
|
|
60
|
+
* distinction worth drawing: a structure file is read by its keys, and
|
|
61
|
+
* painting them the same green as every value turns it into a wall.
|
|
62
|
+
*/
|
|
63
|
+
JSON: [
|
|
64
|
+
{ token: 'attr', pattern: '"(?:\\\\.|[^"\\\\])*"(?=\\s*:)' },
|
|
65
|
+
{ token: 'str', pattern: '"(?:\\\\.|[^"\\\\])*"' },
|
|
66
|
+
{ token: 'key', pattern: '\\b(?:true|false|null)\\b' },
|
|
67
|
+
{ token: 'key', pattern: '-?\\b\\d+(?:\\.\\d+)?(?:[eE][+-]?\\d+)?\\b' },
|
|
68
|
+
{ token: 'punct', pattern: '[{}\\[\\],:]' },
|
|
69
|
+
],
|
|
70
|
+
|
|
71
|
+
/*
|
|
72
|
+
* CSS, where the ordering IS the grammar.
|
|
73
|
+
*
|
|
74
|
+
* `::part(name)` is first among the selector rules because it is the thing a
|
|
75
|
+
* theme file is FOR. It takes the blue "name you address" colour so it reads
|
|
76
|
+
* apart from the magenta selector it hangs off.
|
|
77
|
+
*
|
|
78
|
+
* A property is told from a pseudo-class with no state at all, by what
|
|
79
|
+
* follows the colon: `color: red;` reaches a `;` or a `}` with no brace in
|
|
80
|
+
* between, while `a:hover {` hits the `{` first. That rule is anchored to
|
|
81
|
+
* the start of a line (the scanner runs with `m`) and swallows the colon, so
|
|
82
|
+
* `color:red` cannot leave a bare `:red` behind for the pseudo-class rule to
|
|
83
|
+
* claim. The leading indentation rides along inside the span, which is
|
|
84
|
+
* invisible — colour only reaches glyphs.
|
|
85
|
+
*
|
|
86
|
+
* The hex rule outranks the id-selector rule because `#fff` is a colour far
|
|
87
|
+
* more often than it is an id. `#abc` is genuinely ambiguous and goes to the
|
|
88
|
+
* colour; both are coloured, just not the same.
|
|
89
|
+
*/
|
|
90
|
+
CSS: [
|
|
91
|
+
{ token: 'comment', pattern: '/\\*[\\s\\S]*?\\*/' },
|
|
92
|
+
{ token: 'str', pattern: '"[^"]*"|\'[^\']*\'' },
|
|
93
|
+
{ token: 'key', pattern: '@[a-zA-Z-]+' },
|
|
94
|
+
{ token: 'attr', pattern: '::part\\([^()]*\\)' },
|
|
95
|
+
{ token: 'key', pattern: '::?[a-zA-Z][a-zA-Z-]*(?:\\((?:[^()]|\\([^()]*\\))*\\))?' },
|
|
96
|
+
{ token: 'key', pattern: '!\\s*important\\b' },
|
|
97
|
+
{ token: 'attr', pattern: '^[ \\t]*[a-zA-Z-][a-zA-Z0-9-]*\\s*:(?=[^;{}]*[;}])' },
|
|
98
|
+
{ token: 'key', pattern: '^[ \\t]*[a-zA-Z][a-zA-Z0-9-]*(?=[^;{}]*\\{)' },
|
|
99
|
+
{ token: 'str', pattern: '#[0-9a-fA-F]{3,8}\\b' },
|
|
100
|
+
{ token: 'key', pattern: '[.#][a-zA-Z_-][a-zA-Z0-9_-]*' },
|
|
101
|
+
{ token: 'key', pattern: '\\[[^\\]]*\\]' },
|
|
102
|
+
{ token: 'str', pattern: '\\b\\d+(?:\\.\\d+)?[a-zA-Z%]*' },
|
|
103
|
+
{ token: 'punct', pattern: '[{}();,:]' },
|
|
104
|
+
],
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* The spellings a caller is likely to have to hand — a file extension, a `lang`
|
|
109
|
+
* attribute, a lower-cased label. The canonical keys above stay display-cased
|
|
110
|
+
* because they are also what the landing page prints above a snippet.
|
|
111
|
+
*/
|
|
112
|
+
const ALIASES = Object.assign(Object.create(null), {
|
|
113
|
+
html: 'HTML',
|
|
114
|
+
javascript: 'JavaScript',
|
|
115
|
+
js: 'JavaScript',
|
|
116
|
+
shell: 'Shell',
|
|
117
|
+
sh: 'Shell',
|
|
118
|
+
bash: 'Shell',
|
|
119
|
+
json: 'JSON',
|
|
120
|
+
css: 'CSS',
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
/*
|
|
124
|
+
* One compiled scanner per grammar. Keyed by the rules array rather than by name
|
|
125
|
+
* so an alias cannot compile a second copy, and weak so a caller passing its own
|
|
126
|
+
* grammar array does not pin it here forever.
|
|
127
|
+
*/
|
|
128
|
+
const scanners = new WeakMap();
|
|
129
|
+
|
|
130
|
+
export function escapeHtml(text) {
|
|
131
|
+
return String(text).replace(/[&<>]/g, character => ({ '&': '&', '<': '<', '>': '>' })[character]);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Marks a snippet up for the `.code` block styling.
|
|
136
|
+
*
|
|
137
|
+
* @param {string} code the snippet, as written
|
|
138
|
+
* @param {string} lang a grammar name or alias. Anything unrecognised comes back
|
|
139
|
+
* escaped and unmarked, which is the right answer for a
|
|
140
|
+
* language nothing here understands.
|
|
141
|
+
* @returns {string} HTML — escaped text with `<span class="tok-…">` around every
|
|
142
|
+
* recognised token.
|
|
143
|
+
*/
|
|
144
|
+
export function highlight(code, lang) {
|
|
145
|
+
const rules = grammarFor(lang);
|
|
146
|
+
|
|
147
|
+
if (!rules) return escapeHtml(code);
|
|
148
|
+
|
|
149
|
+
const scanner = scannerFor(rules);
|
|
150
|
+
|
|
151
|
+
let output = '';
|
|
152
|
+
let index = 0;
|
|
153
|
+
let match;
|
|
154
|
+
|
|
155
|
+
// The scanner is shared and carries lastIndex between calls; nothing here is
|
|
156
|
+
// re-entrant, so rewinding once at the top is enough.
|
|
157
|
+
scanner.lastIndex = 0;
|
|
158
|
+
|
|
159
|
+
while ((match = scanner.exec(code)) !== null) {
|
|
160
|
+
// A zero-length match would loop forever; nothing here can produce one, but
|
|
161
|
+
// the guard costs a line and the failure is a hung tab.
|
|
162
|
+
if (match[0] === '') break;
|
|
163
|
+
|
|
164
|
+
const rule = rules[match.slice(1).findIndex(group => group !== undefined)];
|
|
165
|
+
|
|
166
|
+
output += escapeHtml(code.slice(index, match.index));
|
|
167
|
+
output += '<span class="tok-' + rule.token + '">' + escapeHtml(match[0]) + '</span>';
|
|
168
|
+
index = match.index + match[0].length;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return output + escapeHtml(code.slice(index));
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/** Own properties only — `GRAMMARS['constructor']` is not a grammar. */
|
|
175
|
+
function grammarFor(lang) {
|
|
176
|
+
const name = String(lang ?? '');
|
|
177
|
+
|
|
178
|
+
if (Object.prototype.hasOwnProperty.call(GRAMMARS, name)) return GRAMMARS[name];
|
|
179
|
+
|
|
180
|
+
const canonical = ALIASES[name.toLowerCase()];
|
|
181
|
+
|
|
182
|
+
return canonical ? GRAMMARS[canonical] : null;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function scannerFor(rules) {
|
|
186
|
+
let scanner = scanners.get(rules);
|
|
187
|
+
|
|
188
|
+
if (!scanner) {
|
|
189
|
+
scanner = new RegExp(rules.map(rule => '(' + rule.pattern + ')').join('|'), 'gm');
|
|
190
|
+
scanners.set(rules, scanner);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
return scanner;
|
|
194
|
+
}
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Navigation for the frozen prototypes.
|
|
3
|
+
*
|
|
4
|
+
* They predate the harness, and §8 says they are records rather than pages
|
|
5
|
+
* waiting to be restyled — so they cannot link `harness.css`. Tailwind's
|
|
6
|
+
* preflight alone would rewrite every one of them, which is precisely the record
|
|
7
|
+
* being destroyed.
|
|
8
|
+
*
|
|
9
|
+
* So this is a shadow-DOM custom element with its own styles: nothing leaks in,
|
|
10
|
+
* nothing leaks out, and it is `position: fixed`, so it contributes no layout and
|
|
11
|
+
* the page underneath renders exactly as it did before. A prototype adopts it
|
|
12
|
+
* with one line and no other change:
|
|
13
|
+
*
|
|
14
|
+
* <script type="module" src="/templates/nav.js"></script>
|
|
15
|
+
*
|
|
16
|
+
* Harness pages do not use this — they get the integrated sticky bar from
|
|
17
|
+
* harness.js. Both read the same `catalog.json`, so neither can go stale.
|
|
18
|
+
*
|
|
19
|
+
* See .shift/repos/adp/web-components/templates-design-language.md §8.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/*
|
|
23
|
+
* Paths come out of the catalog root-absolute (`/templates/…`), which only
|
|
24
|
+
* resolves when the site is the server root. This element ships on the frozen
|
|
25
|
+
* prototypes, which sit one directory down, and the built site can be mounted
|
|
26
|
+
* anywhere — so every path is re-resolved against the directory this module was
|
|
27
|
+
* loaded from instead. `harness.js` carries the same two lines for the same
|
|
28
|
+
* reason; they cannot be shared without giving the prototypes a second module.
|
|
29
|
+
*/
|
|
30
|
+
const SITE_ROOT = new URL('../', import.meta.url);
|
|
31
|
+
|
|
32
|
+
/** A catalog path as a URL path valid from wherever this page sits. */
|
|
33
|
+
const site = value => new URL(String(value).replace(/^\//, ''), SITE_ROOT).pathname;
|
|
34
|
+
|
|
35
|
+
const STYLES = /* css */ `
|
|
36
|
+
:host {
|
|
37
|
+
/* The harness tokens, hardcoded: this file cannot import the stylesheet that
|
|
38
|
+
defines them without dragging Tailwind in with it. */
|
|
39
|
+
--surface: #ffffff;
|
|
40
|
+
--ground: #eef1f5;
|
|
41
|
+
--line: #dde4ec;
|
|
42
|
+
--ink: #121922;
|
|
43
|
+
--muted: #7b8794;
|
|
44
|
+
--accent: #7a5d08;
|
|
45
|
+
--gold: #f9cb4b;
|
|
46
|
+
--on-gold: #2a2000;
|
|
47
|
+
|
|
48
|
+
position: fixed;
|
|
49
|
+
z-index: 2147483000;
|
|
50
|
+
bottom: 1rem;
|
|
51
|
+
left: 1rem;
|
|
52
|
+
font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
|
|
53
|
+
font-size: 13px;
|
|
54
|
+
line-height: 1.4;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@media (prefers-color-scheme: dark) {
|
|
58
|
+
:host {
|
|
59
|
+
--surface: #151b23;
|
|
60
|
+
--ground: #0c1016;
|
|
61
|
+
--line: #262f3a;
|
|
62
|
+
--ink: #e8eef4;
|
|
63
|
+
--muted: #76838f;
|
|
64
|
+
--accent: #f9cb4b;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
* {
|
|
69
|
+
box-sizing: border-box;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/* Dashed, mono, uppercase: a cropped screenshot must not read as prototype UI (R2). */
|
|
73
|
+
.launcher {
|
|
74
|
+
display: flex;
|
|
75
|
+
gap: 0.5rem;
|
|
76
|
+
align-items: center;
|
|
77
|
+
padding: 0.4rem 0.7rem;
|
|
78
|
+
color: var(--ink);
|
|
79
|
+
background: var(--surface);
|
|
80
|
+
border: 1px dashed var(--line);
|
|
81
|
+
border-radius: 999px;
|
|
82
|
+
box-shadow: 0 6px 20px rgb(18 25 34 / 18%);
|
|
83
|
+
cursor: pointer;
|
|
84
|
+
font: inherit;
|
|
85
|
+
font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
|
|
86
|
+
font-size: 11px;
|
|
87
|
+
letter-spacing: 0.08em;
|
|
88
|
+
text-transform: uppercase;
|
|
89
|
+
transition: border-color 150ms ease, color 150ms ease;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.launcher:hover {
|
|
93
|
+
color: var(--accent);
|
|
94
|
+
border-color: var(--accent);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.launcher svg {
|
|
98
|
+
display: block;
|
|
99
|
+
width: 13px;
|
|
100
|
+
height: 13px;
|
|
101
|
+
color: var(--accent);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.panel {
|
|
105
|
+
position: absolute;
|
|
106
|
+
bottom: calc(100% + 0.5rem);
|
|
107
|
+
left: 0;
|
|
108
|
+
width: min(22rem, calc(100vw - 2rem));
|
|
109
|
+
max-height: min(70vh, 34rem);
|
|
110
|
+
overflow-y: auto;
|
|
111
|
+
padding: 0.4rem;
|
|
112
|
+
color: var(--ink);
|
|
113
|
+
background: var(--surface);
|
|
114
|
+
border: 1px solid var(--line);
|
|
115
|
+
border-radius: 14px;
|
|
116
|
+
box-shadow: 0 18px 45px rgb(18 25 34 / 22%);
|
|
117
|
+
overscroll-behavior: contain;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
[hidden] {
|
|
121
|
+
display: none !important;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.home {
|
|
125
|
+
display: flex;
|
|
126
|
+
gap: 0.5rem;
|
|
127
|
+
align-items: center;
|
|
128
|
+
margin-bottom: 0.25rem;
|
|
129
|
+
padding: 0.45rem 0.6rem;
|
|
130
|
+
color: var(--ink);
|
|
131
|
+
background: var(--ground);
|
|
132
|
+
border-radius: 9px;
|
|
133
|
+
font-weight: 600;
|
|
134
|
+
text-decoration: none;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.home:hover {
|
|
138
|
+
color: var(--accent);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
details {
|
|
142
|
+
border-top: 1px solid var(--line);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
details:first-of-type {
|
|
146
|
+
border-top: 0;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
summary {
|
|
150
|
+
display: flex;
|
|
151
|
+
gap: 0.5rem;
|
|
152
|
+
align-items: center;
|
|
153
|
+
padding: 0.45rem 0.6rem;
|
|
154
|
+
color: var(--muted);
|
|
155
|
+
cursor: pointer;
|
|
156
|
+
font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
|
|
157
|
+
font-size: 11px;
|
|
158
|
+
letter-spacing: 0.08em;
|
|
159
|
+
text-transform: uppercase;
|
|
160
|
+
list-style: none;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
summary::-webkit-details-marker {
|
|
164
|
+
display: none;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
summary::before {
|
|
168
|
+
color: var(--muted);
|
|
169
|
+
content: '▸';
|
|
170
|
+
font-size: 9px;
|
|
171
|
+
transition: transform 150ms ease;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
details[open] summary::before {
|
|
175
|
+
transform: rotate(90deg);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.count {
|
|
179
|
+
margin-inline-start: auto;
|
|
180
|
+
font-variant-numeric: tabular-nums;
|
|
181
|
+
opacity: 0.7;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
a.page {
|
|
185
|
+
display: block;
|
|
186
|
+
padding: 0.4rem 0.6rem 0.4rem 1.5rem;
|
|
187
|
+
overflow: hidden;
|
|
188
|
+
color: var(--ink);
|
|
189
|
+
border-radius: 8px;
|
|
190
|
+
text-decoration: none;
|
|
191
|
+
text-overflow: ellipsis;
|
|
192
|
+
white-space: nowrap;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
a.page:hover {
|
|
196
|
+
background: var(--ground);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
a.page[aria-current='page'] {
|
|
200
|
+
color: var(--on-gold);
|
|
201
|
+
background: var(--gold);
|
|
202
|
+
font-weight: 600;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.empty {
|
|
206
|
+
padding: 0.6rem;
|
|
207
|
+
color: var(--muted);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
:focus-visible {
|
|
211
|
+
outline: 2px solid var(--accent);
|
|
212
|
+
outline-offset: 2px;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
@media (prefers-reduced-motion: reduce) {
|
|
216
|
+
* {
|
|
217
|
+
transition-duration: 0.01ms !important;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
`;
|
|
221
|
+
|
|
222
|
+
const ICON = /* html */ `
|
|
223
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" aria-hidden="true">
|
|
224
|
+
<path d="M4 6h16M4 12h16M4 18h16" />
|
|
225
|
+
</svg>
|
|
226
|
+
`;
|
|
227
|
+
|
|
228
|
+
class HarnessNav extends HTMLElement {
|
|
229
|
+
#open = false;
|
|
230
|
+
|
|
231
|
+
connectedCallback() {
|
|
232
|
+
if (this.shadowRoot) return;
|
|
233
|
+
|
|
234
|
+
const root = this.attachShadow({ mode: 'open' });
|
|
235
|
+
|
|
236
|
+
root.innerHTML = /* html */ `
|
|
237
|
+
<style>${STYLES}</style>
|
|
238
|
+
<button class="launcher" type="button" aria-expanded="false" aria-controls="panel">${ICON} Pages</button>
|
|
239
|
+
<div class="panel" id="panel" hidden><p class="empty">Loading…</p></div>
|
|
240
|
+
`;
|
|
241
|
+
|
|
242
|
+
this.launcher = root.querySelector('.launcher');
|
|
243
|
+
this.panel = root.querySelector('.panel');
|
|
244
|
+
|
|
245
|
+
this.launcher.addEventListener('click', () => this.toggle(!this.#open));
|
|
246
|
+
|
|
247
|
+
// `composedPath` because a click inside the shadow root reports this host as
|
|
248
|
+
// its target from the outside.
|
|
249
|
+
this.onDocumentClick = event => {
|
|
250
|
+
if (this.#open && !event.composedPath().includes(this)) this.toggle(false);
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
this.onKeydown = event => {
|
|
254
|
+
if (event.key === 'Escape') this.toggle(false);
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
document.addEventListener('click', this.onDocumentClick);
|
|
258
|
+
document.addEventListener('keydown', this.onKeydown);
|
|
259
|
+
|
|
260
|
+
this.load();
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
disconnectedCallback() {
|
|
264
|
+
document.removeEventListener('click', this.onDocumentClick);
|
|
265
|
+
document.removeEventListener('keydown', this.onKeydown);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
toggle(open) {
|
|
269
|
+
this.#open = open;
|
|
270
|
+
this.panel.hidden = !open;
|
|
271
|
+
this.launcher.setAttribute('aria-expanded', String(open));
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
async load() {
|
|
275
|
+
let catalog;
|
|
276
|
+
|
|
277
|
+
try {
|
|
278
|
+
const response = await fetch(new URL('catalog.json', import.meta.url));
|
|
279
|
+
|
|
280
|
+
if (!response.ok) throw new Error(String(response.status));
|
|
281
|
+
|
|
282
|
+
catalog = await response.json();
|
|
283
|
+
} catch {
|
|
284
|
+
this.panel.innerHTML = '<p class="empty">No catalog. Run <code>npm start</code>.</p>';
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
const here = window.location.pathname;
|
|
289
|
+
const escape = value => String(value).replace(/[&<>"]/g, character => ({ '&': '&', '<': '<', '>': '>', '"': '"' })[character]);
|
|
290
|
+
|
|
291
|
+
const groups = catalog.areas.map(area => {
|
|
292
|
+
const pages = catalog.pages.filter(page => page.area === area.id);
|
|
293
|
+
const current = pages.some(page => site(page.path) === here);
|
|
294
|
+
|
|
295
|
+
const items = pages
|
|
296
|
+
.map(page => `<a class="page" href="${escape(site(page.path))}"${site(page.path) === here ? ' aria-current="page"' : ''}>${escape(page.title)}</a>`)
|
|
297
|
+
.join('');
|
|
298
|
+
|
|
299
|
+
return `
|
|
300
|
+
<details${current ? ' open' : ''}>
|
|
301
|
+
<summary>${escape(area.label)}<span class="count">${pages.length}</span></summary>
|
|
302
|
+
${items}
|
|
303
|
+
</details>
|
|
304
|
+
`;
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
this.panel.innerHTML = `<a class="home" href="${escape(site('/'))}">← Showcase home</a>${groups.join('')}`;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
customElements.define('harness-nav', HarnessNav);
|
|
312
|
+
|
|
313
|
+
// Self-injecting, so a page adopts it with a script tag and nothing else. Guarded
|
|
314
|
+
// because a page is free to place the element itself.
|
|
315
|
+
if (!document.querySelector('harness-nav')) {
|
|
316
|
+
const mount = () => document.body.append(document.createElement('harness-nav'));
|
|
317
|
+
|
|
318
|
+
if (document.body) mount();
|
|
319
|
+
else document.addEventListener('DOMContentLoaded', mount);
|
|
320
|
+
}
|