acinguiux-preact-components 0.0.1
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/package.json +56 -0
- package/src/content/themes/theme-acinguiux-amg/theme-acinguiux-amg.css +23 -0
- package/src/content/themes/theme-acinguiux-cafe/theme-acinguiux-cafe.css +47 -0
- package/src/content/themes/theme-acinguiux-energy/theme-acinguiux-energy.css +45 -0
- package/src/content/themes/theme-acinguiux-livewire/theme-acinguiux-livewire.css +22 -0
- package/src/content/themes/theme-acinguiux-livewire-italy/theme-acinguiux-livewire-italy.css +22 -0
- package/src/content/themes/theme-acinguiux-recharge/theme-acinguiux-recharge.css +49 -0
- package/src/content/themes/theme-allon/theme-allon.css +25 -0
- package/src/content/themes/theme-atlas/theme-atlas.css +31 -0
- package/src/content/themes/theme-aurvana/resources/favicon/apple-touch-icon.png +0 -0
- package/src/content/themes/theme-aurvana/resources/favicon/favico.ico +0 -0
- package/src/content/themes/theme-aurvana/resources/favicon/favicon-96x96.png +0 -0
- package/src/content/themes/theme-aurvana/resources/favicon/favicon.ico +0 -0
- package/src/content/themes/theme-aurvana/resources/favicon/favicon.png +0 -0
- package/src/content/themes/theme-aurvana/resources/favicon/favicon.svg +13 -0
- package/src/content/themes/theme-aurvana/resources/favicon/google-touch-icon.png +0 -0
- package/src/content/themes/theme-aurvana/resources/favicon/manifest.json +14 -0
- package/src/content/themes/theme-aurvana/resources/favicon/site.webmanifest +21 -0
- package/src/content/themes/theme-aurvana/resources/favicon/web-app-manifest-192x192.png +0 -0
- package/src/content/themes/theme-aurvana/resources/favicon/web-app-manifest-512x512.png +0 -0
- package/src/content/themes/theme-aurvana/theme-aurvana.css +49 -0
- package/src/content/themes/theme-base/theme-base.css +49 -0
- package/src/content/themes/theme-base2/resources/favicon/android-chrome-192x192.png +0 -0
- package/src/content/themes/theme-base2/resources/favicon/android-chrome-512x512.png +0 -0
- package/src/content/themes/theme-base2/resources/favicon/apple-touch-icon.png +0 -0
- package/src/content/themes/theme-base2/resources/favicon/favico.ico +0 -0
- package/src/content/themes/theme-base2/resources/favicon/favicon-16x16.png +0 -0
- package/src/content/themes/theme-base2/resources/favicon/favicon-32x32.png +0 -0
- package/src/content/themes/theme-base2/resources/favicon/favicon-96x96.png +0 -0
- package/src/content/themes/theme-base2/resources/favicon/favicon.ico +0 -0
- package/src/content/themes/theme-base2/resources/favicon/favicon.png +0 -0
- package/src/content/themes/theme-base2/resources/favicon/favicon.svg +9 -0
- package/src/content/themes/theme-base2/resources/favicon/google-touch-icon.png +0 -0
- package/src/content/themes/theme-base2/resources/favicon/manifest.json +14 -0
- package/src/content/themes/theme-base2/resources/favicon/site.webmanifest +1 -0
- package/src/content/themes/theme-base2/resources/favicon/web-app-manifest-192x192.png +0 -0
- package/src/content/themes/theme-base2/resources/favicon/web-app-manifest-512x512.png +0 -0
- package/src/content/themes/theme-base2/resources/fonts/acinguiux-typeface-la-heavy-221208.woff2 +0 -0
- package/src/content/themes/theme-base2/theme-base2.css +47 -0
- package/src/content/themes/theme-eco-marathon/theme-eco-marathon.css +22 -0
- package/src/content/themes/theme-energy-transition-campus-amsterdam/theme-energy-transition-campus-amsterdam.css +26 -0
- package/src/content/themes/theme-evpass/theme-evpass.css +46 -0
- package/src/content/themes/theme-nam-2025/resources/favicon/apple-touch-icon.png +0 -0
- package/src/content/themes/theme-nam-2025/resources/favicon/favico.ico +0 -0
- package/src/content/themes/theme-nam-2025/resources/favicon/favicon-96x96.png +0 -0
- package/src/content/themes/theme-nam-2025/resources/favicon/favicon.ico +0 -0
- package/src/content/themes/theme-nam-2025/resources/favicon/favicon.png +0 -0
- package/src/content/themes/theme-nam-2025/resources/favicon/favicon.svg +9 -0
- package/src/content/themes/theme-nam-2025/resources/favicon/google-touch-icon.png +0 -0
- package/src/content/themes/theme-nam-2025/resources/favicon/manifest.json +14 -0
- package/src/content/themes/theme-nam-2025/resources/favicon/site.webmanifest +21 -0
- package/src/content/themes/theme-nam-2025/resources/favicon/web-app-manifest-192x192.png +0 -0
- package/src/content/themes/theme-nam-2025/resources/favicon/web-app-manifest-512x512.png +0 -0
- package/src/content/themes/theme-nam-2025/theme-nam-2025.css +47 -0
- package/src/content/themes/theme-pennzoil/theme-pennzoil.css +36 -0
- package/src/content/themes/theme-quaker-state/theme-quaker-state.css +63 -0
- package/src/content/themes/theme-tafawoq/theme-tafawoq.css +26 -0
- package/src/content/themes/theme-vegetable/resources/favicon/apple-touch-icon.png +0 -0
- package/src/content/themes/theme-vegetable/resources/favicon/favico.ico +0 -0
- package/src/content/themes/theme-vegetable/resources/favicon/favicon-96x96.png +0 -0
- package/src/content/themes/theme-vegetable/resources/favicon/favicon.ico +0 -0
- package/src/content/themes/theme-vegetable/resources/favicon/favicon.png +0 -0
- package/src/content/themes/theme-vegetable/resources/favicon/favicon.svg +13 -0
- package/src/content/themes/theme-vegetable/resources/favicon/google-touch-icon.png +0 -0
- package/src/content/themes/theme-vegetable/resources/favicon/manifest.json +14 -0
- package/src/content/themes/theme-vegetable/resources/favicon/site.webmanifest +21 -0
- package/src/content/themes/theme-vegetable/resources/favicon/web-app-manifest-192x192.png +0 -0
- package/src/content/themes/theme-vegetable/resources/favicon/web-app-manifest-512x512.png +0 -0
- package/src/content/themes/theme-vegetable/theme-vegetable.css +49 -0
- package/src/content/themes/theme-zeolyst/resources/fonts/type-ar-medium.woff2 +0 -0
- package/src/content/themes/theme-zeolyst/theme-zeolyst.css +29 -0
- package/src/main/atoms/audio.js +16 -0
- package/src/main/atoms/box.js +5 -0
- package/src/main/atoms/button.js +40 -0
- package/src/main/atoms/card.js +22 -0
- package/src/main/atoms/form.js +30 -0
- package/src/main/atoms/heading.js +17 -0
- package/src/main/atoms/icon.js +24 -0
- package/src/main/atoms/img.js +131 -0
- package/src/main/atoms/input.js +55 -0
- package/src/main/atoms/link-text.js +21 -0
- package/src/main/atoms/link.js +60 -0
- package/src/main/atoms/list.js +12 -0
- package/src/main/atoms/logo.js +9 -0
- package/src/main/atoms/menu.js +10 -0
- package/src/main/atoms/message.js +5 -0
- package/src/main/atoms/nav-link.js +49 -0
- package/src/main/atoms/popup.js +47 -0
- package/src/main/atoms/rich-text.js +128 -0
- package/src/main/atoms/scroller.js +224 -0
- package/src/main/atoms/svg.js +65 -0
- package/src/main/atoms/table.js +32 -0
- package/src/main/atoms/textarea.js +10 -0
- package/src/main/atoms/time.js +12 -0
- package/src/main/atoms/video.js +100 -0
- package/src/main/export-main.js +12 -0
- package/src/main/export-matter.js +86 -0
- package/src/main/export-preact-hooks.js +1 -0
- package/src/main/export-preact.js +1 -0
- package/src/main/index.js +13 -0
- package/src/main/molecules/asset.js +23 -0
- package/src/main/molecules/glossary.js +44 -0
- package/src/main/molecules/links.js +23 -0
- package/src/main/molecules/promo-text.js +27 -0
- package/src/main/molecules/tags.js +15 -0
- package/src/main/molecules/tree.js +51 -0
- package/src/main/organisms/accordion-item.js +106 -0
- package/src/main/organisms/author.js +29 -0
- package/src/main/organisms/breadcrumb.js +69 -0
- package/src/main/organisms/call-to-action.js +24 -0
- package/src/main/organisms/carousel.js +178 -0
- package/src/main/organisms/cart-item.js +156 -0
- package/src/main/organisms/cart.js +162 -0
- package/src/main/organisms/contact-form.js +141 -0
- package/src/main/organisms/container/ab-test.js +47 -0
- package/src/main/organisms/container/default.js +6 -0
- package/src/main/organisms/container/filtered-section.js +293 -0
- package/src/main/organisms/container/footer.js +12 -0
- package/src/main/organisms/container/grid.js +44 -0
- package/src/main/organisms/container/header.js +13 -0
- package/src/main/organisms/container/list.js +7 -0
- package/src/main/organisms/container/main.js +6 -0
- package/src/main/organisms/container/raw.js +7 -0
- package/src/main/organisms/container/section.js +28 -0
- package/src/main/organisms/container.js +29 -0
- package/src/main/organisms/content-owner.js +15 -0
- package/src/main/organisms/date-entry.js +56 -0
- package/src/main/organisms/external-search.js +73 -0
- package/src/main/organisms/filtered-item.js +163 -0
- package/src/main/organisms/footer-item.js +17 -0
- package/src/main/organisms/image-gallery.js +164 -0
- package/src/main/organisms/last-modified.js +20 -0
- package/src/main/organisms/legal-footer.js +16 -0
- package/src/main/organisms/list-item.js +48 -0
- package/src/main/organisms/metadata.js +11 -0
- package/src/main/organisms/navigation.js +232 -0
- package/src/main/organisms/notification.js +87 -0
- package/src/main/organisms/order-tracker.js +203 -0
- package/src/main/organisms/page-header-banner.js +26 -0
- package/src/main/organisms/page-header.js +33 -0
- package/src/main/organisms/page-tags.js +14 -0
- package/src/main/organisms/page.js +260 -0
- package/src/main/organisms/press-release.js +24 -0
- package/src/main/organisms/product-admin.js +204 -0
- package/src/main/organisms/promo-banner.js +28 -0
- package/src/main/organisms/promo-bottom.js +23 -0
- package/src/main/organisms/promo-button.js +8 -0
- package/src/main/organisms/promo-card-cover.js +35 -0
- package/src/main/organisms/promo-card.js +33 -0
- package/src/main/organisms/promo-full.js +20 -0
- package/src/main/organisms/promo-image.js +22 -0
- package/src/main/organisms/promo-lure.js +22 -0
- package/src/main/organisms/promo-product-card.js +187 -0
- package/src/main/organisms/promo-product-full.js +293 -0
- package/src/main/organisms/promo-simple.js +23 -0
- package/src/main/organisms/quote.js +21 -0
- package/src/main/organisms/search-form.js +42 -0
- package/src/main/organisms/search-nav.js +66 -0
- package/src/main/organisms/search-result.js +53 -0
- package/src/main/organisms/slider.js +26 -0
- package/src/main/organisms/standalone-asset.js +22 -0
- package/src/main/organisms/tabs.js +277 -0
- package/src/main/organisms/topbar.js +83 -0
- package/src/main/organisms/web-component.js +53 -0
- package/src/main/routing/annotation.js +9 -0
- package/src/main/routing/component.js +138 -0
- package/src/main/routing/empty.js +5 -0
- package/src/main/routing/error-handler.js +64 -0
- package/src/main/routing/placeholder-image.svg +5 -0
- package/src/main/routing/router.js +219 -0
- package/src/main/shared/analytics.js +677 -0
- package/src/main/shared/bubble-event.js +11 -0
- package/src/main/shared/custom-element.js +21 -0
- package/src/main/shared/deep-selector.js +28 -0
- package/src/main/shared/disable-transparency.js +10 -0
- package/src/main/shared/format-time.js +8 -0
- package/src/main/shared/get-id.js +5 -0
- package/src/main/shared/get-meta.js +3 -0
- package/src/main/shared/get-size-class.js +3 -0
- package/src/main/shared/get-size.js +11 -0
- package/src/main/shared/h.js +88 -0
- package/src/main/shared/hash-jump.js +33 -0
- package/src/main/shared/icons/arrow-back.svg +1 -0
- package/src/main/shared/icons/arrow-down.svg +1 -0
- package/src/main/shared/icons/arrow-next.svg +1 -0
- package/src/main/shared/icons/arrow-tail-right.svg +1 -0
- package/src/main/shared/icons/arrow-tail-up.svg +1 -0
- package/src/main/shared/icons/arrow-up.svg +1 -0
- package/src/main/shared/icons/asset-download.svg +1 -0
- package/src/main/shared/icons/logo.svg +5 -0
- package/src/main/shared/icons/low-carbon-placeholder.svg +9 -0
- package/src/main/shared/icons/media-pause.svg +1 -0
- package/src/main/shared/icons/media-play.svg +1 -0
- package/src/main/shared/icons/navigation-burger.svg +1 -0
- package/src/main/shared/icons/navigation-close.svg +1 -0
- package/src/main/shared/icons/navigation-link.svg +1 -0
- package/src/main/shared/icons/navigation-refresh.svg +1 -0
- package/src/main/shared/icons/navigation-search.svg +1 -0
- package/src/main/shared/icons/navigation-share.svg +1 -0
- package/src/main/shared/icons/toggle-newwindow.svg +1 -0
- package/src/main/shared/icons.js +18 -0
- package/src/main/shared/id-from-string.js +5 -0
- package/src/main/shared/mark-selection.js +19 -0
- package/src/main/shared/register.js +26 -0
- package/src/main/shared/renderer.js +43 -0
- package/src/main/shared/simple-consent-api.js +70 -0
- package/src/main/shared/split-links.js +11 -0
- package/src/main/shared/t.js +60 -0
- package/src/main/shared/twind.js +837 -0
- package/src/main/shared/update-head.js +34 -0
- package/src/main/shared/update-scrollbar-width.js +30 -0
- package/src/main/shared/use-link.js +151 -0
- package/src/main/shared/use-persistent-state.js +42 -0
- package/src/main/shared/wait-for-dom-ready.js +6 -0
- package/src/main/shared/wcm-mode.js +4 -0
- package/src/wcs/components/acinguiux-preact-doc/acinguiux-preact-doc.js +207 -0
- package/src/wcs/components/admin-dashboard/admin-dashboard.js +487 -0
- package/src/wcs/components/admin-login/admin-login.js +91 -0
- package/src/wcs/components/bazaar-voice/bazaar-voice.js +56 -0
- package/src/wcs/components/chatbot-koreai/chatbot-koreai.js +176 -0
- package/src/wcs/components/chatbot-koreai/koreai-transport.js +217 -0
- package/src/wcs/components/chatbot-ms/chatbot-ms.js +210 -0
- package/src/wcs/components/chatbot-test/chatbot-test.js +44 -0
- package/src/wcs/components/comparison-chart/comparison-chart.js +111 -0
- package/src/wcs/components/consent-banner/consent-banner.js +248 -0
- package/src/wcs/components/consent-banner/icons/ccpa.svg +6 -0
- package/src/wcs/components/consent-banner/icons/info.svg +1 -0
- package/src/wcs/components/consent-banner/provider-onetrust.js +131 -0
- package/src/wcs/components/decision-tree/arrow-back.svg +3 -0
- package/src/wcs/components/decision-tree/badges.js +37 -0
- package/src/wcs/components/decision-tree/decision-tree.js +162 -0
- package/src/wcs/components/dynamic-contact-details/dynamic-contact-details.js +111 -0
- package/src/wcs/components/example-accordion/example-accordion.js +10 -0
- package/src/wcs/components/example-asset/example-asset.js +12 -0
- package/src/wcs/components/example-form/example-form.js +59 -0
- package/src/wcs/components/example-nested/example-nested.js +10 -0
- package/src/wcs/components/example-routing/example-routing.js +51 -0
- package/src/wcs/components/example-rtl/example-rtl.js +28 -0
- package/src/wcs/components/example-tabs/example-tabs.js +12 -0
- package/src/wcs/components/example-web-component/example-web-component.js +34 -0
- package/src/wcs/components/floating-button/floating-button.js +17 -0
- package/src/wcs/components/formstack-form/fields/address.js +38 -0
- package/src/wcs/components/formstack-form/fields/checkbox.js +42 -0
- package/src/wcs/components/formstack-form/fields/date.js +22 -0
- package/src/wcs/components/formstack-form/fields/description.js +8 -0
- package/src/wcs/components/formstack-form/fields/input.js +8 -0
- package/src/wcs/components/formstack-form/fields/name.js +39 -0
- package/src/wcs/components/formstack-form/fields/radio.js +24 -0
- package/src/wcs/components/formstack-form/fields/rating.js +53 -0
- package/src/wcs/components/formstack-form/fields/section.js +8 -0
- package/src/wcs/components/formstack-form/fields/select.js +10 -0
- package/src/wcs/components/formstack-form/fields/textarea.js +8 -0
- package/src/wcs/components/formstack-form/fields/wrapper.js +11 -0
- package/src/wcs/components/formstack-form/formstack-form.js +280 -0
- package/src/wcs/components/fuel-prices/fuel-prices.js +45 -0
- package/src/wcs/components/furniture-overview/furniture-overview.js +115 -0
- package/src/wcs/components/gauge-value/gauge-value.js +65 -0
- package/src/wcs/components/help-centre/api.js +150 -0
- package/src/wcs/components/help-centre/help-centre.js +400 -0
- package/src/wcs/components/help-centre/icon-search.svg +1 -0
- package/src/wcs/components/image-gen/admin-panel.js +248 -0
- package/src/wcs/components/image-gen/image-gen.js +385 -0
- package/src/wcs/components/image-gen/labels.js +37 -0
- package/src/wcs/components/image-gen/use-api.js +392 -0
- package/src/wcs/components/inspired-gallery/inspired-gallery.js +118 -0
- package/src/wcs/components/launch-container/launch-container.js +95 -0
- package/src/wcs/components/launch-container/ledger.js +140 -0
- package/src/wcs/components/lng-map/lng-map.js +44 -0
- package/src/wcs/components/mouseflow-analytics/mouseflow-analytics.js +39 -0
- package/src/wcs/components/msds-search/msds-search.js +127 -0
- package/src/wcs/components/msds-search/navigation-search.svg +3 -0
- package/src/wcs/components/product-catalogue/icon-back.svg +3 -0
- package/src/wcs/components/product-catalogue/icon-cart.svg +3 -0
- package/src/wcs/components/product-catalogue/icon-close.svg +3 -0
- package/src/wcs/components/product-catalogue/product-catalogue.js +215 -0
- package/src/wcs/components/product-links/icon-cart.svg +3 -0
- package/src/wcs/components/product-links/product-links.js +43 -0
- package/src/wcs/components/rio-iframe/rio-iframe.js +137 -0
- package/src/wcs/components/salsify-products/filter-tools.js +60 -0
- package/src/wcs/components/salsify-products/icon-cart.svg +3 -0
- package/src/wcs/components/salsify-products/process-products.js +53 -0
- package/src/wcs/components/salsify-products/route-tools.js +54 -0
- package/src/wcs/components/salsify-products/salsify-products.js +281 -0
- package/src/wcs/components/shout-out/shout-out.js +51 -0
- package/src/wcs/components/simple-chart/simple-chart.js +53 -0
- package/src/wcs/components/single-stat/single-stat.js +85 -0
- package/src/wcs/components/site-feedback/site-feedback.js +56 -0
- package/src/wcs/components/skds-search/navigation-search.svg +3 -0
- package/src/wcs/components/skds-search/skds-search.js +103 -0
- package/src/wcs/components/smart-banner/smart-banner.js +104 -0
- package/src/wcs/components/standalone-table/arrow-up-down.svg +3 -0
- package/src/wcs/components/standalone-table/arrow-up.svg +3 -0
- package/src/wcs/components/standalone-table/standalone-table.js +440 -0
- package/src/wcs/components/station-locator/station-locator.js +49 -0
- package/src/wcs/components/store-badges/badges.js +60 -0
- package/src/wcs/components/store-badges/store-badges.js +93 -0
- package/src/wcs/components/topbar-button/person.svg +1 -0
- package/src/wcs/components/topbar-button/topbar-button.js +22 -0
- package/src/wcs/components/universal-gallery/universal-gallery.js +308 -0
- package/src/wcs/components/zendesk-chat/zendesk-chat.js +133 -0
- package/src/wcs/shared/chat-bot/README.md +61 -0
- package/src/wcs/shared/chat-bot/chat-bot.js +216 -0
- package/src/wcs/shared/chat-bot/resources/arrow-next.svg +1 -0
- package/src/wcs/shared/chat-bot/resources/navigation-close.svg +1 -0
- package/src/wcs/shared/chat-bot/resources/person.svg +1 -0
- package/src/wcs/shared/chat-bot/resources/upload.svg +1 -0
- package/src/wcs/shared/filtered-data/README.md +52 -0
- package/src/wcs/shared/filtered-data/fetch-data.js +33 -0
- package/src/wcs/shared/filtered-data/filtered-data.js +337 -0
- package/src/wcs/shared/promo-with-popup/icon-close.svg +3 -0
- package/src/wcs/shared/promo-with-popup/icon-next.svg +3 -0
- package/src/wcs/shared/promo-with-popup/icon-prev.svg +3 -0
- package/src/wcs/shared/promo-with-popup/promo-with-popup.js +93 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export default async function deepSelector (selector) {
|
|
2
|
+
if (!selector) {
|
|
3
|
+
return []
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
const roots = [document]
|
|
7
|
+
|
|
8
|
+
// Add all shadow roots including nested.
|
|
9
|
+
for (const el of roots) {
|
|
10
|
+
const wcs = [...el.querySelectorAll('[data-name="WebComponent"] *')].filter(wcEl => wcEl.tagName?.includes('-'))
|
|
11
|
+
for (const wc of wcs) {
|
|
12
|
+
await customElements.whenDefined(wc.tagName.toLowerCase())
|
|
13
|
+
wc?.shadowRoot?.querySelectorAll && roots.push(wc.shadowRoot)
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Get all the results across all shadow roots.
|
|
18
|
+
const result = []
|
|
19
|
+
for (const root of roots) {
|
|
20
|
+
try {
|
|
21
|
+
result.push(...root.querySelectorAll(selector))
|
|
22
|
+
} catch {
|
|
23
|
+
// Ignore incorrect selector.
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return result
|
|
28
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { tw } from './twind.js'
|
|
2
|
+
|
|
3
|
+
export default function disableTransparency (color, breakpoints = ['md', 'sm']) {
|
|
4
|
+
const className = (color === 'transparent' || color === 'semitransparent')
|
|
5
|
+
? breakpoints.map(device => tw(`${device}:pal-brand1`)).join(' ')
|
|
6
|
+
: ''
|
|
7
|
+
|
|
8
|
+
const palette = color ? `pal-${color}` : ''
|
|
9
|
+
return `${palette} ${className}`
|
|
10
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export default function formatTime (date, displayTime = false) {
|
|
2
|
+
const locale = document.documentElement.lang || navigator.language
|
|
3
|
+
let options = { year: 'numeric', month: 'short', day: 'numeric' }
|
|
4
|
+
if (displayTime) {
|
|
5
|
+
options = { ...options, hour: 'numeric', minute: '2-digit' }
|
|
6
|
+
}
|
|
7
|
+
return date.toLocaleDateString(locale, options)
|
|
8
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const RANGE = 1000 // 1000 for MB, 1024 for MiB.
|
|
2
|
+
const PRECISION = 0 // Decimal places.
|
|
3
|
+
|
|
4
|
+
export default function getSize (string) {
|
|
5
|
+
if (typeof string !== 'string') {
|
|
6
|
+
throw new TypeError('Invalid type')
|
|
7
|
+
}
|
|
8
|
+
const number = Number.parseInt(string, 10)
|
|
9
|
+
const i = Math.max(Math.floor(Math.log(number) / Math.log(RANGE)), 0)
|
|
10
|
+
return `${Number((number / Math.pow(RANGE, i)).toFixed(PRECISION)) * 1} ${['B', 'kB', 'MB', 'GB', 'TB'][i]}`
|
|
11
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// A lightweight Preact wrapper with a mithril-style hyperscript helper.
|
|
2
|
+
import { h as ph } from 'preact'
|
|
3
|
+
import getId from './get-id.js'
|
|
4
|
+
import { tw } from './twind.js'
|
|
5
|
+
|
|
6
|
+
const INNER_MODEL_PROPS = new Set([
|
|
7
|
+
'name',
|
|
8
|
+
'value',
|
|
9
|
+
'icon',
|
|
10
|
+
'type',
|
|
11
|
+
'src',
|
|
12
|
+
'alt',
|
|
13
|
+
'caption',
|
|
14
|
+
'autoplay'
|
|
15
|
+
])
|
|
16
|
+
|
|
17
|
+
function h (...args) {
|
|
18
|
+
let [tag, props] = args
|
|
19
|
+
|
|
20
|
+
// Ensure props are present.
|
|
21
|
+
if (
|
|
22
|
+
!props ||
|
|
23
|
+
typeof props !== 'object' ||
|
|
24
|
+
Object.hasOwn(props, '__k') || // Preact element
|
|
25
|
+
Array.isArray(props)
|
|
26
|
+
) {
|
|
27
|
+
props = {}
|
|
28
|
+
args.splice(1, 0, props)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
let customStyle
|
|
32
|
+
if (typeof tag === 'string') {
|
|
33
|
+
// When rendering HTML tag.
|
|
34
|
+
handleColor(props)
|
|
35
|
+
customStyle = handleCustomStyle(props)
|
|
36
|
+
removePrivateProps(props)
|
|
37
|
+
tw(props.className)
|
|
38
|
+
} else {
|
|
39
|
+
// When rendering Preact component.
|
|
40
|
+
ensureModel(props)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return customStyle
|
|
44
|
+
? [customStyle, ph.apply(this, args)]
|
|
45
|
+
: ph.apply(this, args)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Remove private props (starting with underscore).
|
|
49
|
+
function removePrivateProps (props, ignoreList) {
|
|
50
|
+
for (const key in props) {
|
|
51
|
+
if (key.startsWith('_') && !ignoreList?.includes(key)) {
|
|
52
|
+
delete props[key]
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function handleCustomStyle (props) {
|
|
58
|
+
if (props._style) {
|
|
59
|
+
props.id ||= getId()
|
|
60
|
+
return h('style', props._style(`#${props.id}`))
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return null
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function handleColor (props) {
|
|
67
|
+
const { _color } = props
|
|
68
|
+
if (_color) {
|
|
69
|
+
props.className = `pal-${_color} ${props.className ?? ''}`
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function ensureModel (props) {
|
|
74
|
+
const _model = props._model || {}
|
|
75
|
+
if (Object.keys(_model).some(key => INNER_MODEL_PROPS.has(key))) {
|
|
76
|
+
return
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
_model.image ||= {}
|
|
80
|
+
_model.video ||= {}
|
|
81
|
+
_model.links ||= []
|
|
82
|
+
_model.tags ||= []
|
|
83
|
+
_model.date = _model.date ? new Date(_model.date) : null
|
|
84
|
+
_model.asset = _model.video.src ? _model.video : _model.image
|
|
85
|
+
props._model = _model
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export default h
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/* global location */
|
|
2
|
+
import deepSelector from './deep-selector.js'
|
|
3
|
+
|
|
4
|
+
const STEP = 100
|
|
5
|
+
const MAX_STEPS = 10
|
|
6
|
+
const STOP_EVENTS = ['mousedown', 'wheel', 'touchmove', 'keydown']
|
|
7
|
+
|
|
8
|
+
let listening = false
|
|
9
|
+
|
|
10
|
+
export default async function hashJump () {
|
|
11
|
+
if (!listening) {
|
|
12
|
+
listening = true
|
|
13
|
+
globalThis.addEventListener('hashchange', () => scrollToElement(location.hash))
|
|
14
|
+
globalThis.addEventListener('route', () => scrollToElement(location.hash))
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
await scrollToElement(location.hash)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async function scrollToElement (selector) {
|
|
21
|
+
let cancel = false
|
|
22
|
+
const listener = () => { cancel = true }
|
|
23
|
+
|
|
24
|
+
for (const event of STOP_EVENTS) { document.addEventListener(event, listener) }
|
|
25
|
+
|
|
26
|
+
for (let ii = 0; ii < MAX_STEPS; ++ii) {
|
|
27
|
+
const [el] = await deepSelector(selector)
|
|
28
|
+
el && !cancel && el.scrollIntoView()
|
|
29
|
+
await new Promise(resolve => setTimeout(resolve, STEP))
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
for (const event of STOP_EVENTS) { document.removeEventListener(event, listener) }
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><polygon fill="#595959" points="15.543 4.294 7.699 12.922 15.51 20.743 14.095 22.156 4.937 12.987 14.063 2.949"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><polygon fill="#595959" points="3.579 8.35 12.207 16.194 20.028 8.382 21.441 9.797 12.271 18.956 2.233 9.83"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><polygon fill="#595959" points="7.374 4.324 15.219 12.952 7.407 20.773 8.822 22.187 17.981 13.017 8.854 2.979"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><polygon fill="#595959" points="13.858 5.372 19.884 12 13.826 18.065 12.411 16.652 16.057 12.999 4 13 4 11 16.271 10.999 12.378 6.718"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><polygon fill="#595959" points="12 4.103 18.065 10.161 16.652 11.576 12.999 7.928 13 20.021 11 20.021 10.999 7.714 6.718 11.609 5.372 10.129"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><polygon fill="#595959" points="3.579 17.209 12.207 9.365 20.028 17.177 21.441 15.762 12.271 6.603 2.233 15.729"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg version="1.1" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="m2 2v11h4l2-3h3l2.5625-4 4.4375 7h4v-11zm3.9512 2c0.016275-1.987e-4 0.032553-1.987e-4 0.048828 0 1.1046 0 2 0.89543 2 2s-0.89543 2-2 2-2-0.89543-2-2c-3.236e-4 -1.0858 0.86572-1.9735 1.9512-2z"/><path d="m12 13v5.1719l-2.5352-2.5352-1.4141 1.4141s3.2995 3.2995 4.9492 4.9492l4.9492-4.9492-1.4141-1.4141-2.5352 2.5352v-5.1719z"/></svg>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 160 64" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Shiv Shakti Hardware logo">
|
|
2
|
+
<image id="image5" width="41" x="11.5" y="4" height="56" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACkAAAA4CAMAAABXNCH6AAAA2FBMVEVMaXFBQUFTU1OcnJxCQkFXV1lPTk5SUFI8PDtFRUX///9FRERoZ2dgYF/ExMTg4OA+Pj4+Pj5vb29AQEBCQEFAQECsrKx6enqEhINCQUF5eHk+PT1BQUH4+Ph+fn2Li4yenZ6MjIxsbGw9PT0+PT08PDw/Pj45OTlBQEA1NjkxMzd4bleXiGhMSURFREKkkmxUUEeDeGBvZlMrLTNnXkxcVku1o3uNeFK4nmrmy5Hfu3OihVSyk13PrW+LfmNVVFKFakT+8LDFsoLhxIh2ZEapoH/l2qlFOzHHGH9yAAAAI3RSTlMAMehcvRL9AvwFB0jg+TAd5J/Eao/QPpYssHjxfRKlm3eEjU12s+gAAAAJcEhZcwAACxMAAAsTAQCanBgAAAL+SURBVHja7ZVpc9pADIYdzoUAOcndpql3tYdvcx+BQI7+/39UyWsSEpxmpp+jYdZgHr9aaSXZcb7tf6ye21dU45Vo/APOhOrVPbJqPbvxGeg09k8rh4wL173uHu1Xi1HiTrqgFLhCuIKDgsMbZIvA/a5SLmPMzQy/gDo82ZFFwVMAS4mN4U91+UG27lQv1UYtY+0DqNu92EZRsaIYdwuMidLZFlp3jhRzOdkHkHMmSwevaN05QcUCLnuYucfNV3Dv2t7d/L1ZMhJYcJeLWt90G9BcWoBD5gPoArJt/aNkHrQwxmiQuEguBTJCa5Jl4V1OnlpJAV4UpSb2o6eAp0pwoUYjwHyBbP2wqTyEjJQP936Uei/Pi6dx4vsGZDAdC3Ima2Xk0DnQL9DJLOz11NqPjQ4if62VHExnkiJj4TnlnFJEkno4MqC9ST9SIEy0Nkr3pyONMaH7YypYGzkHHc0XYLzVcAAg44lvQu1NPSTRnyg1aZ8Vqynj2f3DHz7HRRt/EvR0bzTtZ6RL5/RKCq6D2ePjMB3hshzNn5KFN74fSPKOIXXeSPIRJpPV6jl5eXleD1Iv7Y/vQ8Ft8NukEFoa2R+jx3g2j+kUZvP8fDPveUTk3hMgB+lk2Isn0UIrN5w/CPLNbUQN58aSoP2k1xtEw0UvHg4HmhIQaco1t1nC/rEkF8L3vdSPktQbJ2NP6/4KD4r+sZnPTtNWmND9xB8EXuLFQRoIEXix5G+niZ/LLPW0IW2MxFoyEqPDOEwGovPWgS3PfWB5IVNBUoHiQgwuWdWHt3nVORVbTAUNlz0t2x1b9JuYdtuNbqFkcLtpubyWdxsul7S7zOcC+S9oYeoi3d5q+LpzURKssIcR/PV+iFyUoGCIAJPvwQythJLl4wsv9MEtqnbZ2Rl2zd81kDjFBM1PkmNSLI87uxMU5+TZcS2UEmk0vIbLVrlZPL0dp3PeqtUC5aqgtmz9RO7TSe84zU756urn+VX5zA6Dz18f7/fz1Yur0Wh8+eb6tmL7C0LYn9pjSj+nAAAAAElFTkSuQmCC"/>
|
|
3
|
+
<text x="72" y="30" fill="#111111" font-size="16" font-weight="700" font-family="Arial, Helvetica, sans-serif" textLength="84" lengthAdjust="spacingAndGlyphs">SHIV SHAKTI</text>
|
|
4
|
+
<text x="72" y="48" fill="#111111" font-size="12" font-weight="600" font-family="Arial, Helvetica, sans-serif" textLength="78" lengthAdjust="spacingAndGlyphs" letter-spacing="0.8">HARDWARE</text>
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" style="width: 100%; height: 100%">
|
|
2
|
+
<rect width="100%" height="100%" style="fill: #767676;" />
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="100" height="100" x="50%" y="50%" overflow="visible">
|
|
4
|
+
<path
|
|
5
|
+
transform="translate(-92.5 -92.5)"
|
|
6
|
+
style="fill: #606060; stroke: #606060; stroke-miterlimit:10; stroke-width: 4px;"
|
|
7
|
+
d="M94.22,2.5a91.72,91.72,0,1,0,91.71,91.72A91.82,91.82,0,0,0,94.22,2.5ZM92.79,183a27.68,27.68,0,1,1,2.85,0l-1.42,0C93.74,183,93.27,183,92.79,183Zm32-27.64a30.57,30.57,0,1,0-48.25,24.9,57.92,57.92,0,1,1,35.38,0A30.54,30.54,0,0,0,124.78,155.37Zm.21,22.17a60.82,60.82,0,1,0-61.55,0,88.83,88.83,0,1,1,61.55,0Z"></path>
|
|
8
|
+
</svg>
|
|
9
|
+
</svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M6.5 5C6.22386 5 6 5.19588 6 5.4375V18.5625C6 18.8041 6.22386 19 6.5 19H10.5C10.7761 19 11 18.8041 11 18.5625V5.4375C11 5.19588 10.7761 5 10.5 5H6.5Z" fill="#292929"/><path d="M13.5 5C13.2239 5 13 5.19588 13 5.4375V18.5625C13 18.8041 13.2239 19 13.5 19H17.5C17.7761 19 18 18.8041 18 18.5625V5.4375C18 5.19588 17.7761 5 17.5 5H13.5Z" fill="#292929"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M7 17.9999V5.99985C7 5.20116 7.89015 4.72476 8.5547 5.1678L17.5 11.1679C18.0937 11.5637 18.0937 12.4362 17.5 12.832L8.5547 18.8319C7.89015 19.275 7 18.7986 7 17.9999Z" fill="#292929"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="#595959" d="M22,16 L22,18 L2,18 L2,16 L22,16 Z M22,7 L22,9 L2,9 L2,7 L22,7 Z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><polygon fill="#595959" points="19.293 3.293 20.707 4.707 13.414 12 20.707 19.293 19.293 20.707 12 13.414 4.707 20.707 3.293 19.293 10.586 12 3.293 4.707 4.707 3.293 12 10.586"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="#595959" d="M11.9101291,7.30977962 L12.0355339,7.42893219 L14.1862019,9.57960023 L12.7719884,10.9938138 L10.6213203,8.84314575 C10.238924,8.46074937 9.74884933,8.39294597 9.48557745,8.57491586 L9.4246781,8.62557443 L4.039788,14.0104645 C3.81663935,14.2336132 3.83786237,14.711438 4.16827673,15.109458 L4.25735931,15.2071068 L7.79289322,18.7426407 C8.1752896,19.1250371 8.66536423,19.1928405 8.92863612,19.0108706 L8.98953546,18.960212 L10.9808489,16.9688985 L12.3950625,18.3831121 L10.403749,20.3744256 C9.36229137,21.4158832 7.65397108,21.3138177 6.5040845,20.2760068 L6.37867966,20.1568542 L2.84314575,16.6213203 C1.73630542,15.51448 1.55751496,13.8038246 2.51455222,12.7146505 L2.62557443,12.596251 L8.01046454,7.21136087 C9.05192219,6.16990321 10.7602425,6.27196874 11.9101291,7.30977962 Z M17.2030223,3.0168864 L17.3284271,3.13603897 L20.863961,6.67157288 C21.9708014,7.77841321 22.1495918,9.48906859 21.1925546,10.5782427 L21.0815323,10.6966422 L15.6966422,16.0815323 C14.6551846,17.12299 12.9468643,17.0209245 11.7969777,15.9831136 L11.6715729,15.863961 L9.52090484,13.713293 L10.9351184,12.2990794 L13.0857864,14.4497475 C13.4681828,14.8321439 13.9582575,14.8999473 14.2215293,14.7179774 L14.2824287,14.6673188 L19.6673188,9.28242868 C19.8904674,9.05928004 19.8692444,8.58145524 19.5388301,8.18343527 L19.4497475,8.08578644 L15.9142136,4.55025253 C15.5318172,4.16785615 15.0417425,4.10005275 14.7784707,4.28202264 L14.7175713,4.33268121 L12.7262579,6.32399468 L11.3120443,4.90978112 L13.3033578,2.91846765 C14.3448154,1.87700999 16.0531357,1.97907552 17.2030223,3.0168864 Z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="#595959" d="M13,3 C17.9705627,3 22,7.02943725 22,12 C22,16.8818027 18.1131863,20.8557914 13.2653623,20.9961629 L13,21 L13,19 C16.8659932,19 20,15.8659932 20,12 C20,8.13400675 16.8659932,5 13,5 C9.7631697,5 7.03946154,7.19693701 6.23866147,10.1810251 L7.34386686,9.07901694 L8.7572339,10.4940765 L5.38736465,13.8599151 L1.72098016,10.5264476 L3.06641209,9.04664591 L4.20504138,10.0809533 C5.08432351,6.03237819 8.68803682,3 13,3 Z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="#595959" d="M10.5,2 C15.1944204,2 19,5.80557963 19,10.5 C19,12.4865245 18.3185332,14.3138839 17.1766205,15.7610573 L21.7071068,20.2928932 L20.2928932,21.7071068 L15.7610573,17.1766205 C14.3138839,18.3185332 12.4865245,19 10.5,19 C5.80557963,19 2,15.1944204 2,10.5 C2,5.80557963 5.80557963,2 10.5,2 Z M10.5,4 C6.91014913,4 4,6.91014913 4,10.5 C4,14.0898509 6.91014913,17 10.5,17 C14.0898509,17 17,14.0898509 17,10.5 C17,6.91014913 14.0898509,4 10.5,4 Z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="#595959" d="M18,2 C20.209139,2 22,3.790861 22,6 C22,8.209139 20.209139,10 18,10 C16.7931555,10 15.7111418,9.46553608 14.9777399,8.62038933 L8.94342799,11.8698669 C8.9805908,12.0742743 9,12.2848705 9,12.5 C9,12.8565793 8.94667633,13.2007042 8.84756814,13.5248355 L14.4174794,16.2188197 C15.0726625,14.9035805 16.43081,14 18,14 C20.209139,14 22,15.790861 22,18 C22,20.209139 20.209139,22 18,22 C15.8727565,22 14.1333536,20.3394567 14.0073135,18.243892 L7.72316911,15.2033716 C7.11862246,15.7011074 6.34421629,16 5.5,16 C3.56700338,16 2,14.4329966 2,12.5 C2,10.5670034 3.56700338,9 5.5,9 C6.4979657,9 7.39837807,9.41767547 8.03596474,10.0877541 L14.0859674,6.82878072 C14.0296295,6.56138815 14,6.28415424 14,6 C14,3.790861 15.790861,2 18,2 Z M18,16 C16.8954305,16 16,16.8954305 16,18 C16,19.1045695 16.8954305,20 18,20 C19.1045695,20 20,19.1045695 20,18 C20,16.8954305 19.1045695,16 18,16 Z M5.5,11 C4.67157288,11 4,11.6715729 4,12.5 C4,13.3284271 4.67157288,14 5.5,14 C6.32842712,14 7,13.3284271 7,12.5 C7,11.6715729 6.32842712,11 5.5,11 Z M18,4 C16.8954305,4 16,4.8954305 16,6 C16,7.1045695 16.8954305,8 18,8 C19.1045695,8 20,7.1045695 20,6 C20,4.8954305 19.1045695,4 18,4 Z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z"/></svg>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export { default as LOGO } from './icons/logo.svg'
|
|
2
|
+
export { default as LOW_CARBON_PLACEHOLDER } from './icons/low-carbon-placeholder.svg'
|
|
3
|
+
export { default as ARROW_BACK } from './icons/arrow-back.svg'
|
|
4
|
+
export { default as ARROW_DOWN } from './icons/arrow-down.svg'
|
|
5
|
+
export { default as ARROW_NEXT } from './icons/arrow-next.svg'
|
|
6
|
+
export { default as ARROW_UP } from './icons/arrow-up.svg'
|
|
7
|
+
export { default as ARROW_TAIL_UP } from './icons/arrow-tail-up.svg'
|
|
8
|
+
export { default as ARROW_TAIL_RIGHT } from './icons/arrow-tail-right.svg'
|
|
9
|
+
export { default as ASSET_DOWNLOAD } from './icons/asset-download.svg'
|
|
10
|
+
export { default as MEDIA_PAUSE } from './icons/media-pause.svg'
|
|
11
|
+
export { default as MEDIA_PLAY } from './icons/media-play.svg'
|
|
12
|
+
export { default as NAVIGATION_BURGER } from './icons/navigation-burger.svg'
|
|
13
|
+
export { default as NAVIGATION_CLOSE } from './icons/navigation-close.svg'
|
|
14
|
+
export { default as NAVIGATION_LINK } from './icons/navigation-link.svg'
|
|
15
|
+
export { default as NAVIGATION_REFRESH } from './icons/navigation-refresh.svg'
|
|
16
|
+
export { default as NAVIGATION_SEARCH } from './icons/navigation-search.svg'
|
|
17
|
+
export { default as NAVIGATION_SHARE } from './icons/navigation-share.svg'
|
|
18
|
+
export { default as TOGGLE_NEWWINDOW } from './icons/toggle-newwindow.svg'
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/* global location */
|
|
2
|
+
function deselectAndAddLength (l) {
|
|
3
|
+
return Object.assign(l, { selected: false, length: l.value?.replace?.(/\.html.*/, '')?.length ?? 0 })
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export default function markSelection (links) {
|
|
7
|
+
const payload = [...links]
|
|
8
|
+
for (const link of payload) {
|
|
9
|
+
link.selected = false // Reset selection.
|
|
10
|
+
payload.push(...(link.children ?? [])) // Go deeper.
|
|
11
|
+
const url = new URL(link.value, location)
|
|
12
|
+
// Select all links on the current path except for hash links.
|
|
13
|
+
link.selected = !url.href.includes('#') && location.href.startsWith(url.href.replace(/\.html.*/, ''))
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Make sure only one first level link is selected (the longest = most specific).
|
|
17
|
+
const longestSelectedLink = links.filter(l => l.selected).map(deselectAndAddLength).sort((a, b) => a.length - b.length).pop() ?? {}
|
|
18
|
+
longestSelectedLink.selected = true
|
|
19
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { h, render } from 'preact'
|
|
2
|
+
import { injectStyles } from './twind.js'
|
|
3
|
+
|
|
4
|
+
// Web component registration function with hook cleanup.
|
|
5
|
+
export default function register (Component, elementName) {
|
|
6
|
+
class CustomElement extends HTMLElement {
|
|
7
|
+
connectedCallback () {
|
|
8
|
+
this.shadow = this.attachShadow({ mode: 'open' })
|
|
9
|
+
this.attrs = Object.fromEntries(Array.from(this.attributes, ({ name, value }) => [name, value]))
|
|
10
|
+
this.vnode = h(Component, this.attrs)
|
|
11
|
+
|
|
12
|
+
injectStyles(this.shadow)
|
|
13
|
+
render(this.vnode, this.shadow)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
disconnectedCallback () {
|
|
17
|
+
// Call cleanup functions for all hooks.
|
|
18
|
+
// Based on https://github.com/preactjs/preact/blob/main/hooks/src/index.js
|
|
19
|
+
for (const hook of this.vnode?.__c?.__H?.__ || []) {
|
|
20
|
+
hook?.__c?.call?.()
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
customElements.get(elementName) || customElements.define(elementName, CustomElement)
|
|
26
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/* global */
|
|
2
|
+
import { render } from 'preact'
|
|
3
|
+
import { Component } from '../routing/component.js'
|
|
4
|
+
import { Router } from '../routing/router.js'
|
|
5
|
+
import h from './h.js'
|
|
6
|
+
// import setStyle from './styles.js'
|
|
7
|
+
import waitForDomReady from './wait-for-dom-ready.js'
|
|
8
|
+
import { isEdit } from './wcm-mode.js'
|
|
9
|
+
import hashJump from './hash-jump.js'
|
|
10
|
+
import { injectStyles } from './twind.js'
|
|
11
|
+
let isReady = false
|
|
12
|
+
|
|
13
|
+
export async function renderPage () {
|
|
14
|
+
if (isReady) {
|
|
15
|
+
return
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
isReady = true
|
|
19
|
+
|
|
20
|
+
// Apply CSS.
|
|
21
|
+
injectStyles(document)
|
|
22
|
+
await waitForDomReady()
|
|
23
|
+
|
|
24
|
+
// Skip rendering in edit mode.
|
|
25
|
+
if (isEdit) {
|
|
26
|
+
console.log('Skipping page rendering in edit mode.')
|
|
27
|
+
return
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Prepare the container.
|
|
31
|
+
const container = document.body.children[0] ?? document.body
|
|
32
|
+
container.innerHTML = ''
|
|
33
|
+
|
|
34
|
+
// Scroll to hash.
|
|
35
|
+
hashJump()
|
|
36
|
+
|
|
37
|
+
render(h(Router), container)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function renderComponent (componentModel, container) {
|
|
41
|
+
render(h(Component, { _componentModel: componentModel, _model: componentModel.model }), container)
|
|
42
|
+
console.log(`Rendered ${componentModel.id}: ${componentModel.organism}`)
|
|
43
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/* global localStorage */
|
|
2
|
+
const STORAGE_KEY = '_evidon_proxy'
|
|
3
|
+
const DEFAULT_CONSENT = {
|
|
4
|
+
functional: true,
|
|
5
|
+
statistics: false,
|
|
6
|
+
preferences: false,
|
|
7
|
+
marketing: false,
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function setConsent (consent) {
|
|
11
|
+
if (consent) {
|
|
12
|
+
consent = { ...DEFAULT_CONSENT, date: new Date().toISOString(), ...consent }
|
|
13
|
+
localStorage.setItem(STORAGE_KEY, JSON.stringify(consent))
|
|
14
|
+
} else {
|
|
15
|
+
localStorage.removeItem(STORAGE_KEY)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
globalThis.dispatchEvent(new CustomEvent('consent', { detail: consent }))
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function getConsent () {
|
|
22
|
+
// No consent granted.
|
|
23
|
+
const consent = JSON.parse(localStorage.getItem(STORAGE_KEY))
|
|
24
|
+
if (!consent) {
|
|
25
|
+
return gcpHandler()
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Consent expired.
|
|
29
|
+
const now = new Date()
|
|
30
|
+
const referenceDate = new Date(now.getFullYear() - 1, now.getMonth(), now.getDate(), now.getHours(), now.getMinutes(),
|
|
31
|
+
now.getSeconds(), now.getMilliseconds())
|
|
32
|
+
if (new Date(consent.date) < referenceDate) {
|
|
33
|
+
setConsent()
|
|
34
|
+
return gcpHandler()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Consent already granted or denied.
|
|
38
|
+
return gcpHandler(consent)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// This works for the first consent collection.
|
|
42
|
+
// Changing consent requires a page reload anyway.
|
|
43
|
+
export async function waitForConsent (expectedConsent, inclusive = true) {
|
|
44
|
+
return new Promise(resolve => {
|
|
45
|
+
if (hasConsent(expectedConsent, inclusive)) {
|
|
46
|
+
resolve(getConsent())
|
|
47
|
+
return
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
globalThis.addEventListener('consent', () => {
|
|
51
|
+
if (hasConsent(expectedConsent, inclusive)) {
|
|
52
|
+
resolve(getConsent())
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
})
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function hasConsent (expectedConsent, inclusive) {
|
|
59
|
+
const consent = getConsent() ?? {}
|
|
60
|
+
const func = inclusive ? 'every' : 'some'
|
|
61
|
+
return Object.keys(expectedConsent)[func](key => consent[key] === expectedConsent[key])
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function gcpHandler (consent) {
|
|
65
|
+
if (!consent) {
|
|
66
|
+
return navigator.globalPrivacyControl ? DEFAULT_CONSENT : null
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return consent
|
|
70
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
const PREFIX = 'acinguiux-preact: '
|
|
2
|
+
|
|
3
|
+
export const TRANSLATIONS = new Set([
|
|
4
|
+
'All',
|
|
5
|
+
'Back to top',
|
|
6
|
+
'Buy now',
|
|
7
|
+
'Click to sort',
|
|
8
|
+
'Category',
|
|
9
|
+
'Close',
|
|
10
|
+
'Description',
|
|
11
|
+
'Dismiss',
|
|
12
|
+
'Enter your search term',
|
|
13
|
+
'Features',
|
|
14
|
+
'Go to: {0}',
|
|
15
|
+
'Load more',
|
|
16
|
+
'Next',
|
|
17
|
+
'Next slide',
|
|
18
|
+
'No results found.',
|
|
19
|
+
'Pause playback',
|
|
20
|
+
'Previous',
|
|
21
|
+
'Previous slide',
|
|
22
|
+
'Read more',
|
|
23
|
+
'Reset filters',
|
|
24
|
+
'Resume playback',
|
|
25
|
+
'Search',
|
|
26
|
+
'Skip to main content',
|
|
27
|
+
'Sorted ascending - {0}',
|
|
28
|
+
'Sorted descending - {0}',
|
|
29
|
+
'Submit',
|
|
30
|
+
'View product list',
|
|
31
|
+
'Viscosity',
|
|
32
|
+
'{0} results found',
|
|
33
|
+
'Download on the {0}',
|
|
34
|
+
'Get it on {0}',
|
|
35
|
+
'Scan the QR code to download the app or click the link below'
|
|
36
|
+
].map(key => `${PREFIX}${key}`))
|
|
37
|
+
|
|
38
|
+
export const i18n = {}
|
|
39
|
+
|
|
40
|
+
export class TranslationError extends Error {
|
|
41
|
+
constructor (key) {
|
|
42
|
+
super(`Unknown dictionary key: ${key}`)
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export default function t (text, ...args) {
|
|
47
|
+
const key = PREFIX + text
|
|
48
|
+
|
|
49
|
+
if (!TRANSLATIONS.has(key)) {
|
|
50
|
+
throw new TranslationError(key)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
let result = i18n[key] ?? text
|
|
54
|
+
|
|
55
|
+
for (const [ii, arg] of args.entries()) {
|
|
56
|
+
result = result.replaceAll(`{${ii}}`, arg)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return result
|
|
60
|
+
}
|