@orderlyshop/web-components 0.1.0-build.7045
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/AGENTS.md +110 -0
- package/README.md +685 -0
- package/bin/orderly-build-category-pages.mjs +160 -0
- package/bin/orderly-generate-category-pages.mjs +308 -0
- package/bin/orderly-hydrate-static-pages.mjs +595 -0
- package/bin/orderly-init-navigation.mjs +327 -0
- package/bin/orderly-init-shop.mjs +876 -0
- package/bin/orderly-init-taxonomy.mjs +2 -0
- package/bin/orderly-publish-site.mjs +342 -0
- package/custom-elements.json +505 -0
- package/dist/browser/orderly-web-components.define.global.js +3551 -0
- package/dist/browser/orderly-web-components.define.global.js.map +1 -0
- package/dist/browser/orderly-web-components.global.js +3551 -0
- package/dist/browser/orderly-web-components.global.js.map +1 -0
- package/dist/default-shop-DgX6uy10.d.ts +221 -0
- package/dist/default-shop.d.ts +6 -0
- package/dist/default-shop.js +762 -0
- package/dist/default-shop.js.map +1 -0
- package/dist/define-BNMhl19n.d.ts +9 -0
- package/dist/define.d.ts +2 -0
- package/dist/define.js +11094 -0
- package/dist/define.js.map +1 -0
- package/dist/index.d.ts +683 -0
- package/dist/index.js +11417 -0
- package/dist/index.js.map +1 -0
- package/dist/navigation.d.ts +61 -0
- package/dist/navigation.js +1125 -0
- package/dist/navigation.js.map +1 -0
- package/dist/query.d.ts +31 -0
- package/dist/query.js +115 -0
- package/dist/query.js.map +1 -0
- package/dist/registry-CPDecU3g.d.ts +6 -0
- package/dist/shop-BgQhGRzS.d.ts +173 -0
- package/dist/shop-query.d.ts +8 -0
- package/dist/shop-query.js +100 -0
- package/dist/shop-query.js.map +1 -0
- package/dist/shop.d.ts +8 -0
- package/dist/shop.js +11187 -0
- package/dist/shop.js.map +1 -0
- package/dist/stores.d.ts +46 -0
- package/dist/stores.js +145 -0
- package/dist/stores.js.map +1 -0
- package/dist/taxonomy.d.ts +35 -0
- package/dist/taxonomy.js +247 -0
- package/dist/taxonomy.js.map +1 -0
- package/dist/types-Bjez59Hr.d.ts +96 -0
- package/docs/components/README.md +708 -0
- package/docs/components/product-grid.md +182 -0
- package/docs/components/product-rail.md +174 -0
- package/examples/shop/README.md +72 -0
- package/examples/shop/package.json +28 -0
- package/examples/shop/src/category.html +20 -0
- package/examples/shop/src/checkout.html +21 -0
- package/examples/shop/src/forretningsbetingelser.html +81 -0
- package/examples/shop/src/includes/body-end.html +1 -0
- package/examples/shop/src/includes/body-start.html +3 -0
- package/examples/shop/src/includes/head.html +32 -0
- package/examples/shop/src/index.html +25 -0
- package/examples/shop/src/navigation.ts +154 -0
- package/examples/shop/src/product.html +24 -0
- package/examples/shop/src/templates/page-layouts.html +162 -0
- package/examples/shop/src/templates/shop-footer.html +76 -0
- package/examples/shop/tsconfig.json +32 -0
- package/examples/shop/vite.config.mjs +190 -0
- package/html-custom-data.json +279 -0
- package/package.json +118 -0
- package/server/README.md +111 -0
- package/server/apache/.htaccess +18 -0
- package/server/nginx/orderly-products.conf +24 -0
- package/server/node/product-snapshot-server.mjs +133 -0
- package/server/php/orderly-product.php +204 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/dom.ts","../src/i18n.ts","../src/navigation.ts"],"sourcesContent":["import type { Credit, StoredImage } from \"@orderlyshop/core-client\";\nimport { formatCredit } from \"./format.js\";\n\nexport type TemplateViewport = \"desktop\" | \"mobile\";\n\nexport interface ResponsiveTemplateConfig {\n mobileMediaQuery?: string;\n}\n\nexport interface GlobalTemplateRegistration {\n name: string;\n template: HTMLTemplateElement | string;\n for?: string | string[];\n viewport?: TemplateViewport;\n media?: string;\n}\n\nconst defaultMobileMediaQuery = \"(max-width: 767px)\";\n\nlet responsiveTemplateConfig: Required<ResponsiveTemplateConfig> = {\n mobileMediaQuery: defaultMobileMediaQuery\n};\nlet responsiveMediaQuery: MediaQueryList | undefined;\nlet responsiveListenersConnected = false;\nlet responsiveNotificationQueued = false;\nconst responsiveTemplateListeners = new Set<() => void>();\nconst globalTemplates: HTMLTemplateElement[] = [];\nconst projectedSlotCache = new WeakMap<HTMLElement, Map<string, Node[]>>();\nconst templateIdentityMap = new WeakMap<HTMLTemplateElement, number>();\nlet nextTemplateIdentity = 0;\n\nexport function configureResponsiveTemplates(config: ResponsiveTemplateConfig = {}): void {\n responsiveTemplateConfig = {\n mobileMediaQuery: config.mobileMediaQuery ?? defaultMobileMediaQuery\n };\n resetResponsiveListeners();\n notifyResponsiveTemplateListeners();\n}\n\nexport function currentTemplateViewport(): TemplateViewport {\n if (matchesMedia(responsiveTemplateConfig.mobileMediaQuery)) {\n return \"mobile\";\n }\n return \"desktop\";\n}\n\nexport function observeResponsiveTemplateChanges(callback: () => void): () => void {\n if (typeof window === \"undefined\") {\n return () => undefined;\n }\n responsiveTemplateListeners.add(callback);\n connectResponsiveListeners();\n return () => {\n responsiveTemplateListeners.delete(callback);\n if (responsiveTemplateListeners.size === 0) {\n disconnectResponsiveListeners();\n }\n };\n}\n\nexport function registerGlobalTemplate(registration: GlobalTemplateRegistration): () => void {\n const templateElement = normalizeTemplateRegistration(registration);\n globalTemplates.push(templateElement);\n notifyResponsiveTemplateListeners();\n return () => {\n const index = globalTemplates.indexOf(templateElement);\n if (index >= 0) {\n globalTemplates.splice(index, 1);\n notifyResponsiveTemplateListeners();\n }\n };\n}\n\nexport function clearGlobalTemplates(): void {\n if (globalTemplates.length === 0) {\n return;\n }\n globalTemplates.splice(0, globalTemplates.length);\n notifyResponsiveTemplateListeners();\n}\n\nexport function ensureRenderRoot(host: HTMLElement): HTMLElement {\n const existing = host.querySelector(\":scope > [data-orderly-render-root]\");\n if (existing instanceof HTMLElement) {\n return existing;\n }\n const root = document.createElement(\"div\");\n root.dataset.orderlyRenderRoot = \"\";\n host.append(root);\n return root;\n}\n\nexport function render(host: HTMLElement, content: Node | string): HTMLElement {\n host.dataset.orderlyViewport = currentTemplateViewport();\n const root = ensureRenderRoot(host);\n root.dataset.orderlyViewport = currentTemplateViewport();\n root.replaceChildren();\n if (typeof content === \"string\") {\n root.innerHTML = content;\n } else {\n root.append(content);\n }\n host.dataset.orderlyReady = \"true\";\n host.setAttribute(\"data-orderly-ready\", \"true\");\n return root;\n}\n\nexport function template(host: HTMLElement, name: string): HTMLTemplateElement | undefined {\n const localCandidates = [...host.children]\n .filter((element): element is HTMLTemplateElement => element instanceof HTMLTemplateElement && element.dataset.orderlyTemplate === name);\n return selectResponsiveTemplate(localCandidates) ?? selectResponsiveTemplate(globalTemplateCandidates(host, name));\n}\n\nexport function cloneTemplate(host: HTMLElement, name: string): DocumentFragment | undefined {\n const found = template(host, name);\n return found?.content.cloneNode(true) as DocumentFragment | undefined;\n}\n\nexport function responsiveTemplateSignature(host: HTMLElement): string {\n const groups = new Map<string, HTMLTemplateElement[]>();\n const candidates = [\n ...localTemplateCandidates(host),\n ...globalTemplatesForHost(host)\n ];\n\n for (const candidate of candidates) {\n const name = candidate.dataset.orderlyTemplate;\n if (!name) {\n continue;\n }\n const current = groups.get(name) ?? [];\n current.push(candidate);\n groups.set(name, current);\n }\n\n return [...groups.entries()]\n .filter(([, group]) => group.some(isResponsiveTemplateCandidate))\n .map(([name, group]) => `${name}:${templateIdentity(selectResponsiveTemplate(group))}`)\n .sort()\n .join(\"|\");\n}\n\nexport function upgradeFragment(fragment: DocumentFragment): DocumentFragment {\n const container = document.createElement(\"div\");\n container.append(fragment);\n customElements.upgrade(container);\n const upgraded = document.createDocumentFragment();\n upgraded.append(...container.childNodes);\n return upgraded;\n}\n\nexport function cloneTemplateSource(source: HTMLTemplateElement | string | undefined): DocumentFragment | undefined {\n if (!source) {\n return undefined;\n }\n if (typeof source === \"string\") {\n const template = document.createElement(\"template\");\n template.innerHTML = source;\n return template.content.cloneNode(true) as DocumentFragment;\n }\n return source.content.cloneNode(true) as DocumentFragment;\n}\n\nexport function slotTarget(root: ParentNode, name: string): Element | undefined {\n const target = root.querySelector(`[data-orderly-slot=\"${name}\"], slot[name=\"${name}\"]`);\n return target ?? undefined;\n}\n\nexport function replaceSlot(root: ParentNode, name: string, content: Node | string | undefined): void {\n const target = slotTarget(root, name);\n if (!target) {\n return;\n }\n target.replaceChildren();\n if (typeof content === \"string\") {\n target.textContent = content;\n } else if (content) {\n target.append(content);\n }\n}\n\nexport function assignedSlotNodes(host: HTMLElement, slotName: string): Node[] {\n return [...host.querySelectorAll(`[slot=\"${slotName}\"]`)];\n}\n\nexport function projectSlots(host: HTMLElement, root: ParentNode, slotNames: string[]): void {\n const cache = projectedSlotCache.get(host) ?? new Map<string, Node[]>();\n if (!projectedSlotCache.has(host)) {\n projectedSlotCache.set(host, cache);\n }\n for (const name of slotNames) {\n const target = slotTarget(root, name);\n if (!target) {\n continue;\n }\n const directNodes = directAssignedSlotNodes(host, name);\n if (directNodes.length > 0) {\n cache.set(name, directNodes);\n }\n const nodes = (cache.get(name) ?? []).filter((node) => node.isConnected && host.contains(node));\n if (nodes.length > 0) {\n cache.set(name, nodes);\n } else {\n cache.delete(name);\n }\n target.replaceChildren(...nodes);\n }\n}\n\nfunction directAssignedSlotNodes(host: HTMLElement, slotName: string): Node[] {\n return [...host.children].filter((element) => element.getAttribute(\"slot\") === slotName);\n}\n\nexport function bindText(root: ParentNode, name: string, value: string | undefined): void {\n root.querySelectorAll(`[data-orderly-bind=\"${name}\"]`).forEach((element) => {\n element.textContent = value ?? \"\";\n });\n}\n\nexport function bindImage(root: ParentNode, name: string, value: string | undefined): void {\n root.querySelectorAll(`[data-orderly-bind=\"${name}\"]`).forEach((element) => {\n if (element instanceof HTMLImageElement) {\n if (value) {\n element.src = value;\n delete element.dataset.orderlyEmptyImage;\n } else {\n element.removeAttribute(\"src\");\n element.dataset.orderlyEmptyImage = \"\";\n }\n }\n });\n}\n\nexport function bindStoredImage(root: ParentNode, name: string, value: StoredImage | undefined): void {\n root.querySelectorAll(`[data-orderly-bind=\"${name}\"]`).forEach((element) => {\n if (\"image\" in element) {\n (element as HTMLElement & { image?: StoredImage }).image = value;\n }\n });\n}\n\nexport function bindCredit(root: ParentNode, name: string, value: Credit | undefined): void {\n root.querySelectorAll(`[data-orderly-bind=\"${name}\"]`).forEach((element) => {\n if (\"credit\" in element) {\n (element as HTMLElement & { credit?: Credit }).credit = value;\n } else {\n element.textContent = formatCredit(value);\n }\n });\n}\n\nexport function dispatch<T>(target: EventTarget, type: string, detail: T, options: EventInit = {}): boolean {\n return target.dispatchEvent(new CustomEvent(type, {\n bubbles: true,\n composed: true,\n ...options,\n detail\n }));\n}\n\nexport function readInput(root: ParentNode, name: string): string {\n const element = root.querySelector(`[name=\"${name}\"]`);\n if (element instanceof HTMLInputElement || element instanceof HTMLTextAreaElement || element instanceof HTMLSelectElement) {\n return element.value;\n }\n return \"\";\n}\n\nexport function setInput(root: ParentNode, name: string, value: string | undefined): void {\n const element = root.querySelector(`[name=\"${name}\"]`);\n if (element instanceof HTMLInputElement || element instanceof HTMLTextAreaElement || element instanceof HTMLSelectElement) {\n element.value = value ?? \"\";\n }\n}\n\nexport function siblingTagName(host: HTMLElement, ownName: string, siblingName: string): string {\n if (host.localName.endsWith(ownName)) {\n return `${host.localName.slice(0, -ownName.length)}${siblingName}`;\n }\n return `orderly-${siblingName}`;\n}\n\nfunction selectResponsiveTemplate(candidates: HTMLTemplateElement[]): HTMLTemplateElement | undefined {\n const viewport = currentTemplateViewport();\n const mediaMatch = candidates.find((candidate) => {\n const media = candidate.dataset.orderlyMedia ?? candidate.getAttribute(\"media\") ?? \"\";\n return Boolean(media && matchesMedia(media));\n });\n if (mediaMatch) {\n return mediaMatch;\n }\n\n const viewportMatch = candidates.find((candidate) => normalizeViewport(candidate.dataset.orderlyViewport) === viewport);\n if (viewportMatch) {\n return viewportMatch;\n }\n\n return candidates.find((candidate) => {\n const media = candidate.dataset.orderlyMedia ?? candidate.getAttribute(\"media\");\n return !media && !candidate.dataset.orderlyViewport;\n });\n}\n\nfunction localTemplateCandidates(host: HTMLElement): HTMLTemplateElement[] {\n return [...host.children]\n .filter((element): element is HTMLTemplateElement => element instanceof HTMLTemplateElement && Boolean(element.dataset.orderlyTemplate));\n}\n\nfunction globalTemplatesForHost(host: HTMLElement): HTMLTemplateElement[] {\n return [\n ...globalTemplates,\n ...documentGlobalTemplates()\n ].filter((candidate) => templateAppliesToHost(candidate, host));\n}\n\nfunction globalTemplateCandidates(host: HTMLElement, name: string): HTMLTemplateElement[] {\n return [\n ...globalTemplates,\n ...documentGlobalTemplates()\n ].filter((candidate) => candidate.dataset.orderlyTemplate === name && templateAppliesToHost(candidate, host));\n}\n\nfunction documentGlobalTemplates(): HTMLTemplateElement[] {\n if (typeof document === \"undefined\") {\n return [];\n }\n return [...document.querySelectorAll(\"template[data-orderly-template]\")]\n .filter((element): element is HTMLTemplateElement => element instanceof HTMLTemplateElement)\n .filter((element) => element.hasAttribute(\"data-orderly-for\")\n || element.hasAttribute(\"data-orderly-component\")\n || element.hasAttribute(\"data-orderly-template-scope\")\n || element.hasAttribute(\"data-orderly-global\"));\n}\n\nfunction isResponsiveTemplateCandidate(templateElement: HTMLTemplateElement): boolean {\n return Boolean(\n templateElement.dataset.orderlyViewport\n || templateElement.dataset.orderlyMedia\n || templateElement.getAttribute(\"media\")\n );\n}\n\nfunction templateIdentity(templateElement: HTMLTemplateElement | undefined): string {\n if (!templateElement) {\n return \"none\";\n }\n const existing = templateIdentityMap.get(templateElement);\n if (existing) {\n return String(existing);\n }\n nextTemplateIdentity += 1;\n templateIdentityMap.set(templateElement, nextTemplateIdentity);\n return String(nextTemplateIdentity);\n}\n\nfunction templateAppliesToHost(templateElement: HTMLTemplateElement, host: HTMLElement): boolean {\n if (templateElement.hasAttribute(\"data-orderly-global\")) {\n return true;\n }\n const targets = splitTemplateTargets(\n templateElement.dataset.orderlyFor\n ?? templateElement.dataset.orderlyComponent\n ?? templateElement.dataset.orderlyTemplateScope\n );\n if (targets.length === 0) {\n return false;\n }\n const componentName = shortComponentName(host.localName);\n return targets.some((target) => target === \"*\"\n || target === host.localName\n || target === componentName);\n}\n\nfunction normalizeTemplateRegistration(registration: GlobalTemplateRegistration): HTMLTemplateElement {\n const templateElement = typeof registration.template === \"string\"\n ? document.createElement(\"template\")\n : registration.template.cloneNode(true) as HTMLTemplateElement;\n if (typeof registration.template === \"string\") {\n templateElement.innerHTML = registration.template;\n }\n templateElement.dataset.orderlyTemplate = registration.name;\n if (registration.for) {\n templateElement.dataset.orderlyFor = Array.isArray(registration.for)\n ? registration.for.join(\" \")\n : registration.for;\n } else {\n templateElement.dataset.orderlyGlobal = \"\";\n }\n if (registration.viewport) {\n templateElement.dataset.orderlyViewport = registration.viewport;\n }\n if (registration.media) {\n templateElement.dataset.orderlyMedia = registration.media;\n }\n return templateElement;\n}\n\nfunction splitTemplateTargets(value: string | undefined): string[] {\n return (value ?? \"\")\n .split(/[\\s,]+/g)\n .map((target) => target.trim())\n .filter(Boolean);\n}\n\nfunction shortComponentName(localName: string): string {\n return localName.includes(\"-\") ? localName.split(\"-\").slice(1).join(\"-\") : localName;\n}\n\nfunction normalizeViewport(value: string | undefined): TemplateViewport | undefined {\n if (value === \"mobile\" || value === \"desktop\") {\n return value;\n }\n return undefined;\n}\n\nfunction matchesMedia(media: string): boolean {\n return typeof window !== \"undefined\" && typeof window.matchMedia === \"function\" && window.matchMedia(media).matches;\n}\n\nfunction connectResponsiveListeners(): void {\n if (responsiveListenersConnected || typeof window === \"undefined\") {\n return;\n }\n responsiveListenersConnected = true;\n if (typeof window.matchMedia === \"function\") {\n responsiveMediaQuery = window.matchMedia(responsiveTemplateConfig.mobileMediaQuery);\n addMediaQueryListener(responsiveMediaQuery, notifyResponsiveTemplateListeners);\n }\n window.addEventListener(\"resize\", notifyResponsiveTemplateListeners);\n}\n\nfunction disconnectResponsiveListeners(): void {\n if (!responsiveListenersConnected || typeof window === \"undefined\") {\n return;\n }\n if (responsiveMediaQuery) {\n removeMediaQueryListener(responsiveMediaQuery, notifyResponsiveTemplateListeners);\n }\n responsiveMediaQuery = undefined;\n responsiveListenersConnected = false;\n window.removeEventListener(\"resize\", notifyResponsiveTemplateListeners);\n}\n\nfunction resetResponsiveListeners(): void {\n if (!responsiveListenersConnected) {\n return;\n }\n disconnectResponsiveListeners();\n if (responsiveTemplateListeners.size > 0) {\n connectResponsiveListeners();\n }\n}\n\nfunction notifyResponsiveTemplateListeners(): void {\n if (responsiveNotificationQueued) {\n return;\n }\n responsiveNotificationQueued = true;\n queueMicrotask(() => {\n responsiveNotificationQueued = false;\n responsiveTemplateListeners.forEach((listener) => listener());\n });\n}\n\nfunction addMediaQueryListener(query: MediaQueryList, listener: () => void): void {\n query.addEventListener(\"change\", listener);\n}\n\nfunction removeMediaQueryListener(query: MediaQueryList, listener: () => void): void {\n query.removeEventListener(\"change\", listener);\n}\n","export type UiLanguage = \"DA\" | \"EN\";\n\nexport type UiTextKey =\n | \"addressTitle\"\n | \"basketCheckoutDisabledLabel\"\n | \"basketCheckoutLabel\"\n | \"basketEmptyLabel\"\n | \"basketLabel\"\n | \"basketPanelTitle\"\n | \"categoriesLabel\"\n | \"categoryConfigurationErrorTitle\"\n | \"categoryNoConfigured\"\n | \"categoryNoDefinitions\"\n | \"categoryNoSlugMatch\"\n | \"categoryNoUrlMatch\"\n | \"checkoutAddressTitle\"\n | \"checkoutCityLabel\"\n | \"checkoutCompanyLabel\"\n | \"checkoutCountryLabel\"\n | \"checkoutCustomerTitle\"\n | \"checkoutChooseServicePointLabel\"\n | \"checkoutDeliveryMethodLabel\"\n | \"checkoutDeliveryAddressPrompt\"\n | \"checkoutDeliveryTitle\"\n | \"checkoutEmailLabel\"\n | \"checkoutErrorLabel\"\n | \"checkoutFirstNameLabel\"\n | \"checkoutFormTitle\"\n | \"checkoutLastNameLabel\"\n | \"checkoutOrderTitle\"\n | \"checkoutNoDeliveryMethodsLabel\"\n | \"checkoutNoServicePointsLabel\"\n | \"checkoutPageDescription\"\n | \"checkoutPageTitle\"\n | \"checkoutPhoneCountryLabel\"\n | \"checkoutPhoneLabel\"\n | \"checkoutServicePointLabel\"\n | \"checkoutServicePointHelpLabel\"\n | \"checkoutStreet2Label\"\n | \"checkoutStreetLabel\"\n | \"checkoutSubmitLabel\"\n | \"checkoutSubmittingLabel\"\n | \"checkoutTermsLabel\"\n | \"checkoutTermsLinkLabel\"\n | \"checkoutZipLabel\"\n | \"clearBasketLabel\"\n | \"clearSearchLabel\"\n | \"closeLabel\"\n | \"closeMenuLabel\"\n | \"collapseLabel\"\n | \"contactTitle\"\n | \"continueShoppingLabel\"\n | \"deliveryFallbackLabel\"\n | \"deliveryNote\"\n | \"emailLabel\"\n | \"emptyLabel\"\n | \"expandLabel\"\n | \"homeRailCtaLabel\"\n | \"homeTitle\"\n | \"informationLinksTitle\"\n | \"itemFallbackTitle\"\n | \"loadMoreLabel\"\n | \"loadingLabel\"\n | \"mainCategoriesLabel\"\n | \"mainNavigationLabel\"\n | \"menuLabel\"\n | \"navigationItemFallbackLabel\"\n | \"openingHoursTitle\"\n | \"phoneLabel\"\n | \"productAddLabel\"\n | \"productDetailColorLabel\"\n | \"productDetailConditionLabel\"\n | \"productDetailSizeLabel\"\n | \"productErrorLabel\"\n | \"productFallbackTitle\"\n | \"productImageLabel\"\n | \"productImageOverlayLabel\"\n | \"productLoadingLabel\"\n | \"productNotFoundLabel\"\n | \"productOpenImageLabel\"\n | \"productOpenPageLabel\"\n | \"productRemoveLabel\"\n | \"productViewLabel\"\n | \"productViewWithTitle\"\n | \"productsLabel\"\n | \"productsLoadError\"\n | \"quantityLabel\"\n | \"quantityShortLabel\"\n | \"removeLabel\"\n | \"searchLabel\"\n | \"searchPlaceholder\"\n | \"searchPromptLabel\"\n | \"searchingLabel\"\n | \"servicePointFallbackLabel\"\n | \"shippingLabel\"\n | \"shopBrandLabel\"\n | \"shopNowLabel\"\n | \"sortLabel\"\n | \"subtotalLabel\"\n | \"totalLabel\"\n | \"totalNote\"\n | \"websiteLabel\";\n\nconst UI_TEXTS: Record<UiLanguage, Record<UiTextKey, string>> = {\n DA: {\n addressTitle: \"Adresse\",\n basketCheckoutDisabledLabel: \"Læg varer i kurven før betaling\",\n basketCheckoutLabel: \"Gå til betaling\",\n basketEmptyLabel: \"Din kurv er tom\",\n basketLabel: \"Kurv\",\n basketPanelTitle: \"Kurv\",\n categoriesLabel: \"Kategorier\",\n categoryConfigurationErrorTitle: \"Fejl i kategorikonfiguration\",\n categoryNoConfigured: \"Der er ikke konfigureret nogen kategori.\",\n categoryNoDefinitions: \"Der er ikke konfigureret nogen navigation.\",\n categoryNoSlugMatch: \"Ingen kategori matcher slug \\\"{slug}\\\". Tjek navigation.ts og slug-attributten på orderly-category-page.\",\n categoryNoUrlMatch: \"Ingen kategori matcher URL-id \\\"{id}\\\". Tjek navigation.ts og #id-værdien.\",\n checkoutAddressTitle: \"Leveringsadresse\",\n checkoutCityLabel: \"By\",\n checkoutCompanyLabel: \"Firma\",\n checkoutCountryLabel: \"Land\",\n checkoutCustomerTitle: \"Kundeoplysninger\",\n checkoutChooseServicePointLabel: \"Vælg {method}\",\n checkoutDeliveryAddressPrompt: \"Udfyld adresse, postnummer og by for at se leveringsmetoder.\",\n checkoutDeliveryMethodLabel: \"Leveringsmetode\",\n checkoutDeliveryTitle: \"Leveringsmetode\",\n checkoutEmailLabel: \"Email\",\n checkoutErrorLabel: \"Checkout kunne ikke gennemføres.\",\n checkoutFirstNameLabel: \"Fornavn\",\n checkoutFormTitle: \"Levering og kontakt\",\n checkoutLastNameLabel: \"Efternavn\",\n checkoutOrderTitle: \"Din ordre\",\n checkoutNoDeliveryMethodsLabel: \"Der blev ikke fundet leveringsmetoder til adressen.\",\n checkoutNoServicePointsLabel: \"Der blev ikke fundet udleveringssteder til adressen.\",\n checkoutPageDescription: \"Udfyld leveringsoplysninger, vælg levering og gennemfør din ordre sikkert.\",\n checkoutPageTitle: \"Levering & betaling\",\n checkoutPhoneCountryLabel: \"Landekode\",\n checkoutPhoneLabel: \"Telefon\",\n checkoutServicePointLabel: \"Udleveringssted\",\n checkoutServicePointHelpLabel: \"Vælg dit ønskede udleveringssted\",\n checkoutStreet2Label: \"Adresse 2\",\n checkoutStreetLabel: \"Adresse\",\n checkoutSubmitLabel: \"Betal og bestil\",\n checkoutSubmittingLabel: \"Sender ordre...\",\n checkoutTermsLabel: \"Jeg accepterer\",\n checkoutTermsLinkLabel: \"forretningsbetingelserne\",\n checkoutZipLabel: \"Postnummer\",\n clearBasketLabel: \"Tøm kurv\",\n clearSearchLabel: \"Ryd søgning\",\n closeLabel: \"Luk\",\n closeMenuLabel: \"Luk menu\",\n collapseLabel: \"Luk {label}\",\n contactTitle: \"Kontakt\",\n continueShoppingLabel: \"Fortsæt med at handle\",\n deliveryFallbackLabel: \"Levering {index}\",\n deliveryNote: \"Levering beregnes fra valgt leveringsmetode.\",\n emailLabel: \"Email\",\n emptyLabel: \"Der blev ikke fundet varer.\",\n expandLabel: \"Åbn {label}\",\n homeRailCtaLabel: \"Se alle\",\n homeTitle: \"Butik\",\n informationLinksTitle: \"Information\",\n itemFallbackTitle: \"Vare\",\n loadMoreLabel: \"Indlæs flere\",\n loadingLabel: \"Indlæser...\",\n mainCategoriesLabel: \"Hovedkategorier\",\n mainNavigationLabel: \"Navigation\",\n menuLabel: \"Menu\",\n navigationItemFallbackLabel: \"Punkt {index}\",\n openingHoursTitle: \"Åbningstider\",\n phoneLabel: \"Telefon\",\n productAddLabel: \"Læg i kurven\",\n productDetailColorLabel: \"Farve\",\n productDetailConditionLabel: \"Stand\",\n productDetailSizeLabel: \"Størrelse\",\n productErrorLabel: \"Produktet kunne ikke indlæses.\",\n productFallbackTitle: \"Produkt\",\n productImageLabel: \"billede {index}\",\n productImageOverlayLabel: \"Produktbillede\",\n productLoadingLabel: \"Indlæser produkt...\",\n productNotFoundLabel: \"Produktet blev ikke fundet.\",\n productOpenImageLabel: \"Åbn produktbillede i fuld skærm\",\n productOpenPageLabel: \"Åbn produktside\",\n productRemoveLabel: \"Fjern fra kurven\",\n productViewLabel: \"Vis produkt\",\n productViewWithTitle: \"Vis {title}\",\n productsLabel: \"varer\",\n productsLoadError: \"Varerne kunne ikke indlæses.\",\n quantityLabel: \"Antal\",\n quantityShortLabel: \"Antal\",\n removeLabel: \"Fjern\",\n searchLabel: \"Søg\",\n searchPlaceholder: \"Søg produkter\",\n searchPromptLabel: \"Skriv i søgefeltet for at finde varer.\",\n searchingLabel: \"Søger efter\",\n servicePointFallbackLabel: \"Udleveringssted {index}\",\n shippingLabel: \"Levering\",\n shopBrandLabel: \"Butik\",\n shopNowLabel: \"Se varer\",\n sortLabel: \"Sorter\",\n subtotalLabel: \"Varer\",\n totalLabel: \"Total\",\n totalNote: \"Inkl. moms\",\n websiteLabel: \"Website\"\n },\n EN: {\n addressTitle: \"Address\",\n basketCheckoutDisabledLabel: \"Add items before checkout\",\n basketCheckoutLabel: \"Go to checkout\",\n basketEmptyLabel: \"Your basket is empty\",\n basketLabel: \"Basket\",\n basketPanelTitle: \"Basket\",\n categoriesLabel: \"Categories\",\n categoryConfigurationErrorTitle: \"Category configuration error\",\n categoryNoConfigured: \"No category has been configured.\",\n categoryNoDefinitions: \"No navigation definitions have been configured.\",\n categoryNoSlugMatch: \"No category matches slug \\\"{slug}\\\". Check navigation.ts and the orderly-category-page slug attribute.\",\n categoryNoUrlMatch: \"No category matches URL id \\\"{id}\\\". Check navigation.ts and the #id value.\",\n checkoutAddressTitle: \"Delivery address\",\n checkoutCityLabel: \"City\",\n checkoutCompanyLabel: \"Company\",\n checkoutCountryLabel: \"Country\",\n checkoutCustomerTitle: \"Customer information\",\n checkoutChooseServicePointLabel: \"Choose {method}\",\n checkoutDeliveryAddressPrompt: \"Enter street, zip, and city to see delivery methods.\",\n checkoutDeliveryMethodLabel: \"Delivery method\",\n checkoutDeliveryTitle: \"Delivery method\",\n checkoutEmailLabel: \"Email\",\n checkoutErrorLabel: \"Checkout failed.\",\n checkoutFirstNameLabel: \"First name\",\n checkoutFormTitle: \"Delivery and contact\",\n checkoutLastNameLabel: \"Last name\",\n checkoutOrderTitle: \"Your order\",\n checkoutNoDeliveryMethodsLabel: \"No delivery methods were found for the address.\",\n checkoutNoServicePointsLabel: \"No service points were found for the address.\",\n checkoutPageDescription: \"Enter your delivery details, choose delivery, and complete your order securely.\",\n checkoutPageTitle: \"Delivery & Payment\",\n checkoutPhoneCountryLabel: \"Phone country\",\n checkoutPhoneLabel: \"Phone\",\n checkoutServicePointLabel: \"Service point\",\n checkoutServicePointHelpLabel: \"Choose your preferred pickup point\",\n checkoutStreet2Label: \"Street 2\",\n checkoutStreetLabel: \"Street\",\n checkoutSubmitLabel: \"Create order\",\n checkoutSubmittingLabel: \"Creating order...\",\n checkoutTermsLabel: \"I accept the terms and conditions\",\n checkoutTermsLinkLabel: \"terms\",\n checkoutZipLabel: \"Zip\",\n clearBasketLabel: \"Clear basket\",\n clearSearchLabel: \"Clear search\",\n closeLabel: \"Close\",\n closeMenuLabel: \"Close menu\",\n collapseLabel: \"Collapse {label}\",\n contactTitle: \"Contact\",\n continueShoppingLabel: \"Continue shopping\",\n deliveryFallbackLabel: \"Delivery {index}\",\n deliveryNote: \"Delivery is calculated from the selected delivery method.\",\n emailLabel: \"Email\",\n emptyLabel: \"No products found.\",\n expandLabel: \"Expand {label}\",\n homeRailCtaLabel: \"See all\",\n homeTitle: \"Shop\",\n informationLinksTitle: \"Information\",\n itemFallbackTitle: \"Item\",\n loadMoreLabel: \"Load more\",\n loadingLabel: \"Loading...\",\n mainCategoriesLabel: \"Main categories\",\n mainNavigationLabel: \"Main navigation\",\n menuLabel: \"Menu\",\n navigationItemFallbackLabel: \"Item {index}\",\n openingHoursTitle: \"Opening hours\",\n phoneLabel: \"Phone\",\n productAddLabel: \"Add to basket\",\n productDetailColorLabel: \"Color\",\n productDetailConditionLabel: \"Condition\",\n productDetailSizeLabel: \"Size\",\n productErrorLabel: \"Product could not be loaded.\",\n productFallbackTitle: \"Product\",\n productImageLabel: \"image {index}\",\n productImageOverlayLabel: \"Product image\",\n productLoadingLabel: \"Loading product...\",\n productNotFoundLabel: \"Product could not be found.\",\n productOpenImageLabel: \"Open product image fullscreen\",\n productOpenPageLabel: \"Open product page\",\n productRemoveLabel: \"Remove from basket\",\n productViewLabel: \"View product\",\n productViewWithTitle: \"View {title}\",\n productsLabel: \"products\",\n productsLoadError: \"Products could not be loaded.\",\n quantityLabel: \"Quantity\",\n quantityShortLabel: \"Qty\",\n removeLabel: \"Remove\",\n searchLabel: \"Search\",\n searchPlaceholder: \"Search products\",\n searchPromptLabel: \"Start typing to find products.\",\n searchingLabel: \"Searching for\",\n servicePointFallbackLabel: \"Service point {index}\",\n shippingLabel: \"Shipping\",\n shopBrandLabel: \"Shop\",\n shopNowLabel: \"Shop now\",\n sortLabel: \"Sort\",\n subtotalLabel: \"Items\",\n totalLabel: \"Total\",\n totalNote: \"Incl. VAT\",\n websiteLabel: \"Website\"\n }\n};\n\nlet currentUiLanguage: UiLanguage = \"DA\";\n\nexport function defaultUiLanguage(): UiLanguage {\n return currentUiLanguage;\n}\n\nexport function configureUiLanguage(language: UiLanguage | string | undefined): UiLanguage {\n currentUiLanguage = normalizeUiLanguage(language);\n return currentUiLanguage;\n}\n\nexport function normalizeUiLanguage(language: UiLanguage | string | undefined): UiLanguage {\n const value = language?.trim().toUpperCase();\n return value === \"EN\" ? \"EN\" : \"DA\";\n}\n\nexport function uiText(key: UiTextKey, language: UiLanguage = currentUiLanguage): string {\n return UI_TEXTS[language][key] ?? UI_TEXTS.DA[key];\n}\n\nexport function formatUiText(key: UiTextKey, values: Record<string, string | number | undefined>, language: UiLanguage = currentUiLanguage): string {\n return uiText(key, language).replace(/\\{(\\w+)\\}/g, (_match, name: string) => {\n const value = values[name];\n return value === undefined ? \"\" : String(value);\n });\n}\n","import type { UIMenu, WebsitePage } from \"@orderlyshop/core-client\";\nimport type { NavigationItem, NavigationLayout, NavigationSelectionDetail } from \"./types.js\";\nimport { bindText, cloneTemplate, currentTemplateViewport, dispatch, observeResponsiveTemplateChanges, projectSlots, render, replaceSlot } from \"./utils/dom.js\";\nimport { formatUiText, uiText } from \"./i18n.js\";\n\nexport class NavigationController extends EventTarget {\n items: NavigationItem[] = [];\n activePath = locationPath();\n expandedIds = new Set<string>();\n menuOpen = false;\n\n setItems(items: NavigationItem[]): void {\n this.items = items;\n this.emitChange();\n }\n\n setActivePath(path: string): void {\n this.activePath = path;\n this.emitChange();\n }\n\n setExpandedIds(ids: Iterable<string>): void {\n const next = new Set(ids);\n if (sameSet(this.expandedIds, next)) {\n return;\n }\n this.expandedIds = next;\n this.emitChange();\n }\n\n toggle(id: string): void {\n if (this.expandedIds.has(id)) {\n this.expandedIds.delete(id);\n } else {\n this.expandedIds.add(id);\n }\n this.emitChange();\n }\n\n closeAll(): void {\n this.expandedIds.clear();\n this.emitChange();\n }\n\n openMenu(): void {\n if (!this.menuOpen) {\n this.menuOpen = true;\n this.emitChange();\n }\n }\n\n closeMenu(): void {\n if (this.menuOpen) {\n this.menuOpen = false;\n this.emitChange();\n }\n }\n\n toggleMenu(): void {\n this.menuOpen = !this.menuOpen;\n this.emitChange();\n }\n\n select(item: NavigationItem): void {\n this.dispatchEvent(new CustomEvent<NavigationSelectionDetail>(\"select\", {\n detail: { item }\n }));\n }\n\n isActive(item: NavigationItem): boolean {\n return Boolean(item.href && normalizePath(item.href) === normalizePath(this.activePath));\n }\n\n private emitChange(): void {\n this.dispatchEvent(new Event(\"change\"));\n }\n}\n\nexport abstract class OrderlyNavigationElement extends HTMLElement {\n static observedAttributes = [\"sticky\", \"layout\"];\n\n readonly controller = new NavigationController();\n private readonly menuPanelId = `orderly-navigation-panel-${nextNavigationId()}`;\n private disconnectResponsiveTemplates?: () => void;\n\n get sticky(): boolean {\n return booleanAttribute(this.getAttribute(\"sticky\"), true);\n }\n\n set sticky(value: boolean) {\n if (value) {\n this.removeAttribute(\"sticky\");\n } else {\n this.setAttribute(\"sticky\", \"false\");\n }\n }\n\n get layout(): NavigationLayout {\n return navigationLayoutAttribute(this.getAttribute(\"layout\"));\n }\n\n set layout(value: NavigationLayout) {\n if (value === \"vertical\") {\n this.removeAttribute(\"layout\");\n } else {\n this.setAttribute(\"layout\", value);\n }\n }\n\n connectedCallback(): void {\n this.disconnectResponsiveTemplates?.();\n this.disconnectResponsiveTemplates = observeResponsiveTemplateChanges(() => this.render());\n this.controller.addEventListener(\"change\", this.onControllerChange);\n this.controller.addEventListener(\"select\", this.onControllerSelect as EventListener);\n this.controller.setItems(this.getNavigationItems());\n this.addEventListener(\"click\", this.onClick);\n this.addEventListener(\"keydown\", this.onKeyDown);\n this.addEventListener(\"mouseleave\", this.onMouseLeave);\n this.addEventListener(\"focusin\", this.onFocusIn);\n this.addEventListener(\"focusout\", this.onFocusOut);\n this.render();\n }\n\n attributeChangedCallback(name: string): void {\n if (name === \"layout\") {\n this.controller.closeAll();\n }\n this.updateNavigationState();\n if (this.isConnected) {\n this.render();\n }\n }\n\n disconnectedCallback(): void {\n this.controller.removeEventListener(\"change\", this.onControllerChange);\n this.controller.removeEventListener(\"select\", this.onControllerSelect as EventListener);\n this.removeEventListener(\"click\", this.onClick);\n this.removeEventListener(\"keydown\", this.onKeyDown);\n this.removeEventListener(\"mouseleave\", this.onMouseLeave);\n this.removeEventListener(\"focusin\", this.onFocusIn);\n this.removeEventListener(\"focusout\", this.onFocusOut);\n updateBodyNavigationLock(this, false);\n this.disconnectResponsiveTemplates?.();\n this.disconnectResponsiveTemplates = undefined;\n }\n\n refresh(): void {\n this.controller.setItems(this.getNavigationItems());\n }\n\n closeAll(): void {\n this.controller.closeAll();\n }\n\n openMenu(): void {\n this.controller.openMenu();\n }\n\n closeMenu(): void {\n this.controller.closeMenu();\n }\n\n toggleMenu(): void {\n this.controller.toggleMenu();\n }\n\n protected abstract getNavigationItems(): NavigationItem[];\n\n protected render(): void {\n const layout = this.layout;\n const renderState = navigationRenderState(layout, this.controller);\n const root = cloneTemplate(this, \"navigation\") ?? defaultNavigation(this.getAttribute(\"aria-label\") ?? uiText(\"mainNavigationLabel\"));\n this.updateNavigationState();\n bindNavigationMenu(root, this.controller, this.menuPanelId, this.sticky, layout);\n replaceSlot(root, \"items\", renderNavigationItems(this.controller, this.controller.items, this, renderState));\n projectSlots(this, root, [\"before-items\", \"after-items\"]);\n layoutHorizontalDesktopSubnav(root, renderState);\n render(this, root);\n }\n\n private updateNavigationState(): void {\n this.dataset.orderlyNavigationHost = \"\";\n this.dataset.orderlySticky = String(this.sticky);\n this.dataset.orderlyLayout = this.layout;\n }\n\n private isDesktopHorizontalLayout(): boolean {\n return this.layout === \"horizontal\" && currentTemplateViewport() === \"desktop\";\n }\n\n private setDesktopBranch(id: string | undefined): void {\n if (!id) {\n this.controller.closeAll();\n return;\n }\n this.controller.setExpandedIds([id]);\n }\n\n private setDesktopSubBranch(rootId: string | undefined, id: string | undefined): void {\n if (!rootId) {\n this.controller.closeAll();\n return;\n }\n this.controller.setExpandedIds(id ? [rootId, id] : [rootId]);\n }\n\n private collapseDesktopChildBranch(): void {\n const expandedRoot = this.controller.items.find((item) => this.controller.expandedIds.has(item.id));\n if (expandedRoot) {\n this.controller.setExpandedIds([expandedRoot.id]);\n return;\n }\n this.controller.closeAll();\n }\n\n private readonly onControllerChange = (): void => {\n updateBodyNavigationLock(this, this.controller.menuOpen);\n this.render();\n };\n\n private readonly onControllerSelect = (event: CustomEvent<NavigationSelectionDetail>): void => {\n dispatch(this, \"orderly-navigation-select\", event.detail);\n };\n\n private readonly onClick = (event: MouseEvent): void => {\n const target = event.target as HTMLElement | null;\n const parentItem = target?.closest(\"[data-orderly-item]\");\n const level = Number.parseInt(parentItem?.getAttribute(\"data-orderly-level\") ?? \"-1\", 10);\n const rootId = parentItem?.getAttribute(\"data-orderly-nav-root\") ?? undefined;\n const desktopHorizontal = this.isDesktopHorizontalLayout();\n const desktopExpandedIds = desktopHorizontal ? resolveHorizontalDesktopExpandedIds(this.controller) : this.controller.expandedIds;\n const menuToggle = target?.closest(\"[data-orderly-nav-menu-toggle], [data-orderly-action=\\\"menu-toggle\\\"]\");\n const menuClose = target?.closest(\"[data-orderly-action=\\\"menu-close\\\"]\");\n const toggle = target?.closest(\"[data-orderly-nav-toggle]\");\n const link = target?.closest(\"[data-orderly-nav-id]\");\n const parent = target?.closest(\"[data-orderly-nav-parent]\");\n if (menuToggle instanceof HTMLElement) {\n event.preventDefault();\n this.controller.toggleMenu();\n return;\n }\n if (menuClose instanceof HTMLElement) {\n event.preventDefault();\n this.controller.closeMenu();\n return;\n }\n if (toggle instanceof HTMLElement) {\n event.preventDefault();\n const id = toggle.dataset.orderlyNavToggle ?? \"\";\n if (!id) {\n return;\n }\n if (desktopHorizontal && level === 0) {\n this.setDesktopBranch(desktopExpandedIds.has(id) ? undefined : id);\n return;\n }\n if (desktopHorizontal && level === 1) {\n this.setDesktopSubBranch(rootId, desktopExpandedIds.has(id) ? undefined : id);\n return;\n }\n this.controller.toggle(id);\n return;\n }\n if (link instanceof HTMLElement) {\n const item = findItem(this.controller.items, link.dataset.orderlyNavId ?? \"\");\n if (item) {\n const navigateOnClick = desktopHorizontal && level >= 0 && level <= 1 && Boolean(item.href);\n if (item.children?.length && (!navigateOnClick && (!desktopHorizontal || level <= 1)) && !desktopExpandedIds.has(item.id)) {\n event.preventDefault();\n if (desktopHorizontal && level === 0) {\n this.setDesktopBranch(item.id);\n } else if (desktopHorizontal && level === 1) {\n this.setDesktopSubBranch(rootId, item.id);\n } else {\n this.controller.toggle(item.id);\n }\n return;\n }\n this.controller.select(item);\n if (navigateOnClick) {\n return;\n }\n if (desktopHorizontal) {\n this.controller.closeAll();\n }\n this.controller.closeMenu();\n }\n return;\n }\n if (parent instanceof HTMLElement && target === parent) {\n const id = parent.dataset.orderlyNavParent ?? \"\";\n if (!id) {\n return;\n }\n if (desktopHorizontal && level === 0) {\n this.setDesktopBranch(desktopExpandedIds.has(id) ? undefined : id);\n return;\n }\n if (desktopHorizontal && level === 1) {\n this.setDesktopSubBranch(rootId, desktopExpandedIds.has(id) ? undefined : id);\n return;\n }\n this.controller.toggle(id);\n }\n };\n\n private readonly onMouseLeave = (): void => {\n if (this.isDesktopHorizontalLayout()) {\n this.collapseDesktopChildBranch();\n }\n };\n\n private readonly onFocusIn = (event: FocusEvent): void => {\n if (!this.isDesktopHorizontalLayout()) {\n return;\n }\n const target = event.target as HTMLElement | null;\n if (target?.closest(\"[data-orderly-nav-id]\")) {\n return;\n }\n const branch = target?.closest(\"[data-orderly-nav-parent]\");\n if (branch instanceof HTMLElement && this.contains(branch)) {\n const level = Number.parseInt(branch.dataset.orderlyLevel ?? \"-1\", 10);\n if (level === 0) {\n this.setDesktopBranch(branch.dataset.orderlyNavParent);\n return;\n }\n if (level === 1) {\n this.setDesktopSubBranch(\n branch.dataset.orderlyNavRoot,\n branch.dataset.orderlyHasChildren === \"true\" ? branch.dataset.orderlyNavParent : undefined\n );\n }\n }\n };\n\n private readonly onFocusOut = (): void => {\n if (!this.isDesktopHorizontalLayout()) {\n return;\n }\n queueMicrotask(() => {\n if (!this.isConnected || !this.isDesktopHorizontalLayout()) {\n return;\n }\n const active = document.activeElement;\n if (!(active instanceof Node) || !this.contains(active)) {\n this.collapseDesktopChildBranch();\n }\n });\n };\n\n private readonly onKeyDown = (event: KeyboardEvent): void => {\n if (event.key === \"Escape\") {\n this.controller.closeAll();\n this.controller.closeMenu();\n }\n };\n}\n\nexport class OrderlyNavigationMenuElement extends OrderlyNavigationElement {\n items: NavigationItem[] = [];\n\n protected getNavigationItems(): NavigationItem[] {\n return this.items;\n }\n}\n\nexport function navigationItemsFromUIMenu(menus: UIMenu[]): NavigationItem[] {\n return menus.map((menu, index) => {\n const label = menu.Link?.DisplayName ?? menu.Link?.URL ?? formatUiText(\"navigationItemFallbackLabel\", { index: index + 1 });\n return {\n id: menu.Link?.URL ?? `${index}`,\n label,\n href: menu.Link?.URL,\n menu,\n children: navigationItemsFromUIMenu(menu.Children)\n };\n });\n}\n\nexport function navigationItemsFromWebsitePages(pages: WebsitePage[]): NavigationItem[] {\n return pages.map((page) => ({\n id: page.Id?.Id?.Value ?? page.Path,\n label: page.DisplayName,\n href: page.Path,\n page\n }));\n}\n\ninterface NavigationRenderState {\n depth: number;\n horizontalDesktop: boolean;\n layout: NavigationLayout;\n expandedIds: ReadonlySet<string>;\n rootId?: string;\n}\n\nfunction renderItems(\n controller: NavigationController,\n items: NavigationItem[],\n host: HTMLElement,\n state: NavigationRenderState,\n listId?: string,\n options: { suppressChildren?: boolean } = {}\n): HTMLUListElement {\n const list = document.createElement(\"ul\");\n list.className = \"orderly-navigation__list\";\n list.dataset.orderlyLevel = String(state.depth);\n list.dataset.orderlyLayout = state.layout;\n if (state.rootId) {\n list.dataset.orderlyNavRoot = state.rootId;\n }\n if (listId) {\n list.id = listId;\n }\n for (const item of items) {\n const custom = cloneTemplate(host, \"item\");\n if (custom) {\n bindNavigationItem(custom, controller, item, host, state);\n list.append(custom);\n continue;\n }\n const element = document.createElement(\"li\");\n element.className = \"orderly-navigation__item\";\n element.dataset.orderlyItem = item.id;\n element.dataset.orderlyLevel = String(state.depth);\n element.dataset.orderlyLayout = state.layout;\n const link = document.createElement(\"a\");\n link.className = \"orderly-navigation__link\";\n link.dataset.orderlyNavId = item.id;\n link.textContent = item.label;\n link.href = item.href ?? \"#\";\n if (item.target) {\n link.target = item.target;\n }\n if (controller.isActive(item)) {\n link.setAttribute(\"aria-current\", \"page\");\n }\n if (item.disabled) {\n link.setAttribute(\"aria-disabled\", \"true\");\n }\n element.append(link);\n if (item.children?.length) {\n const expanded = state.expandedIds.has(item.id);\n const childListId = `orderly-navigation-children-${safeDomId(item.id)}`;\n element.dataset.orderlyHasChildren = \"true\";\n element.dataset.orderlyNavParent = item.id;\n element.dataset.orderlyExpanded = String(expanded);\n if (state.rootId) {\n element.dataset.orderlyNavRoot = state.rootId;\n }\n if (shouldRenderToggle(item, state)) {\n const button = document.createElement(\"button\");\n button.className = \"orderly-navigation__toggle\";\n button.type = \"button\";\n button.dataset.orderlyNavToggle = item.id;\n button.setAttribute(\"aria-expanded\", String(expanded));\n button.setAttribute(\"aria-controls\", childListId);\n button.setAttribute(\"aria-label\", expanded ? formatUiText(\"collapseLabel\", { label: item.label }) : formatUiText(\"expandLabel\", { label: item.label }));\n button.innerHTML = `\n <svg class=\"orderly-navigation__chevron\" viewBox=\"0 0 20 20\" focusable=\"false\" aria-hidden=\"true\">\n <path d=\"m7 5 5 5-5 5\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path>\n </svg>\n `;\n element.append(button);\n }\n if (!options.suppressChildren && shouldRenderChildren(item, state)) {\n element.append(renderItems(controller, item.children, host, childNavigationRenderState(state), childListId));\n }\n }\n list.append(element);\n }\n return list;\n}\n\nfunction defaultNavigation(label: string): DocumentFragment {\n const fragment = document.createDocumentFragment();\n const nav = document.createElement(\"nav\");\n nav.className = \"orderly-navigation\";\n nav.setAttribute(\"aria-label\", label);\n nav.innerHTML = `\n <button class=\"orderly-navigation__menu-button\" type=\"button\" data-orderly-action=\"menu-toggle\">\n <span class=\"orderly-navigation__menu-icon\" aria-hidden=\"true\"></span>\n <span class=\"orderly-navigation__menu-label\">${uiText(\"menuLabel\")}</span>\n </button>\n <button class=\"orderly-navigation__backdrop\" type=\"button\" data-orderly-action=\"menu-close\" aria-label=\"${uiText(\"closeMenuLabel\")}\"></button>\n <div class=\"orderly-navigation__panel\" data-orderly-menu-panel>\n <button class=\"orderly-navigation__close\" type=\"button\" data-orderly-action=\"menu-close\" aria-label=\"${uiText(\"closeMenuLabel\")}\">\n <span aria-hidden=\"true\">×</span>\n </button>\n <div class=\"orderly-navigation__content\">\n <div class=\"orderly-navigation__slot orderly-navigation__slot--before\" data-orderly-slot=\"before-items\"></div>\n <div class=\"orderly-navigation__items\" data-orderly-slot=\"items\"></div>\n <div class=\"orderly-navigation__slot orderly-navigation__slot--after\" data-orderly-slot=\"after-items\"></div>\n </div>\n </div>\n `;\n fragment.append(nav);\n return fragment;\n}\n\nfunction bindNavigationMenu(root: ParentNode, controller: NavigationController, panelId: string, sticky: boolean, layout: NavigationLayout): void {\n let resolvedPanelId = panelId;\n root.querySelectorAll(\".orderly-navigation, [data-orderly-navigation]\").forEach((element) => {\n if (element instanceof HTMLElement) {\n element.dataset.orderlyMenuOpen = String(controller.menuOpen);\n element.dataset.orderlySticky = String(sticky);\n element.dataset.orderlyLayout = layout;\n }\n });\n\n root.querySelectorAll(\"[data-orderly-menu-panel]\").forEach((element) => {\n if (element instanceof HTMLElement) {\n element.id ||= panelId;\n resolvedPanelId = element.id;\n element.dataset.orderlyMenuOpen = String(controller.menuOpen);\n element.dataset.orderlyLayout = layout;\n }\n });\n\n root.querySelectorAll(\"[data-orderly-nav-menu-toggle], [data-orderly-action=\\\"menu-toggle\\\"]\").forEach((element) => {\n if (element instanceof HTMLElement) {\n element.dataset.orderlyNavMenuToggle = \"\";\n element.setAttribute(\"aria-expanded\", String(controller.menuOpen));\n element.setAttribute(\"aria-controls\", resolvedPanelId);\n }\n });\n}\n\nfunction bindNavigationItem(\n root: ParentNode,\n controller: NavigationController,\n item: NavigationItem,\n host: HTMLElement,\n state: NavigationRenderState\n): void {\n const active = controller.isActive(item);\n const expanded = state.expandedIds.has(item.id);\n bindText(root, \"label\", item.label);\n root.querySelectorAll(\"[data-orderly-item]\").forEach((element) => {\n if (element instanceof HTMLElement) {\n element.dataset.orderlyItem = item.id;\n element.dataset.orderlyLevel = String(state.depth);\n element.dataset.orderlyLayout = state.layout;\n if (state.rootId) {\n element.dataset.orderlyNavRoot = state.rootId;\n } else {\n element.removeAttribute(\"data-orderly-nav-root\");\n }\n element.toggleAttribute(\"data-orderly-active\", active);\n element.toggleAttribute(\"data-orderly-disabled\", Boolean(item.disabled));\n element.toggleAttribute(\"data-orderly-has-children\", Boolean(item.children?.length));\n element.toggleAttribute(\"data-orderly-expanded\", expanded);\n if (item.children?.length) {\n element.dataset.orderlyNavParent = item.id;\n } else {\n element.removeAttribute(\"data-orderly-nav-parent\");\n }\n }\n });\n\n const link = root.querySelector(\"[data-orderly-action=\\\"select\\\"], a\");\n if (link instanceof HTMLElement) {\n link.dataset.orderlyNavId = item.id;\n if (link instanceof HTMLAnchorElement) {\n link.href = item.href ?? \"#\";\n if (item.target) {\n link.target = item.target;\n }\n }\n if (active) {\n link.setAttribute(\"aria-current\", \"page\");\n } else {\n link.removeAttribute(\"aria-current\");\n }\n if (item.disabled) {\n link.setAttribute(\"aria-disabled\", \"true\");\n } else {\n link.removeAttribute(\"aria-disabled\");\n }\n }\n\n const toggle = root.querySelector(\"[data-orderly-action=\\\"toggle\\\"], button\");\n if (toggle instanceof HTMLElement) {\n if (item.children?.length && shouldRenderToggle(item, state)) {\n toggle.hidden = false;\n toggle.dataset.orderlyNavToggle = item.id;\n toggle.setAttribute(\"aria-expanded\", String(expanded));\n toggle.setAttribute(\"aria-controls\", `orderly-navigation-children-${safeDomId(item.id)}`);\n toggle.setAttribute(\"aria-label\", expanded ? formatUiText(\"collapseLabel\", { label: item.label }) : formatUiText(\"expandLabel\", { label: item.label }));\n } else {\n toggle.hidden = true;\n toggle.removeAttribute(\"data-orderly-nav-toggle\");\n toggle.removeAttribute(\"aria-controls\");\n }\n }\n\n const children = shouldRenderChildren(item, state)\n ? renderItems(controller, item.children ?? [], host, childNavigationRenderState(state), `orderly-navigation-children-${safeDomId(item.id)}`)\n : undefined;\n replaceSlot(root, \"children\", children);\n}\n\nfunction findItem(items: NavigationItem[], id: string): NavigationItem | undefined {\n for (const item of items) {\n if (item.id === id) {\n return item;\n }\n const child = item.children ? findItem(item.children, id) : undefined;\n if (child) {\n return child;\n }\n }\n return undefined;\n}\n\nfunction normalizePath(path: string): string {\n try {\n const url = new URL(path, \"https://orderly.local\");\n return `${url.pathname}${url.search}${url.hash}`;\n } catch {\n return path;\n }\n}\n\nfunction locationPath(): string {\n try {\n const current = globalThis.location;\n return current ? `${current.pathname}${current.search}${current.hash}` : \"/\";\n } catch {\n return \"/\";\n }\n}\n\nfunction booleanAttribute(value: string | null, fallback: boolean): boolean {\n if (value === null) {\n return fallback;\n }\n const normalized = value.trim().toLowerCase();\n return normalized !== \"false\" && normalized !== \"0\" && normalized !== \"off\";\n}\n\nlet navigationId = 0;\nconst openNavigationMenus = new Set<HTMLElement>();\n\nfunction navigationLayoutAttribute(value: string | null): NavigationLayout {\n return value?.trim().toLowerCase() === \"horizontal\" ? \"horizontal\" : \"vertical\";\n}\n\nfunction navigationRenderState(layout: NavigationLayout, controller: NavigationController): NavigationRenderState {\n const horizontalDesktop = layout === \"horizontal\" && currentTemplateViewport() === \"desktop\";\n return {\n depth: 0,\n horizontalDesktop,\n layout,\n expandedIds: horizontalDesktop ? resolveHorizontalDesktopExpandedIds(controller) : controller.expandedIds\n };\n}\n\nfunction childNavigationRenderState(state: NavigationRenderState, rootId = state.rootId): NavigationRenderState {\n return {\n ...state,\n depth: state.depth + 1,\n rootId\n };\n}\n\nfunction renderNavigationItems(\n controller: NavigationController,\n items: NavigationItem[],\n host: HTMLElement,\n state: NavigationRenderState\n): HTMLElement {\n if (!state.horizontalDesktop || state.depth > 0) {\n return renderItems(controller, items, host, state);\n }\n\n const container = document.createElement(\"div\");\n container.className = \"orderly-navigation__desktop\";\n container.append(renderItems(controller, items, host, state, undefined, { suppressChildren: true }));\n\n const expandedRoot = items.find((item) => state.expandedIds.has(item.id) && item.children?.length);\n if (expandedRoot?.children?.length) {\n const subnav = document.createElement(\"div\");\n subnav.className = \"orderly-navigation__subnav\";\n subnav.dataset.orderlyNavRoot = expandedRoot.id;\n subnav.append(renderItems(controller, expandedRoot.children, host, childNavigationRenderState(state, expandedRoot.id)));\n container.append(subnav);\n }\n\n return container;\n}\n\nfunction layoutHorizontalDesktopSubnav(root: ParentNode, state: NavigationRenderState): void {\n if (!state.horizontalDesktop) {\n return;\n }\n\n const content = root.querySelector(\".orderly-navigation__content\");\n const items = root.querySelector(\".orderly-navigation__items\");\n const subnav = root.querySelector(\".orderly-navigation__desktop > .orderly-navigation__subnav\");\n if (!(content instanceof HTMLElement) || !(items instanceof HTMLElement) || !(subnav instanceof HTMLElement)) {\n return;\n }\n\n items.after(subnav);\n}\n\nfunction shouldRenderChildren(item: NavigationItem, state: NavigationRenderState): boolean {\n if (!item.children?.length) {\n return false;\n }\n if (state.horizontalDesktop) {\n if (state.depth === 0) {\n return false;\n }\n if (state.depth === 1) {\n return state.expandedIds.has(item.id);\n }\n return true;\n }\n return state.expandedIds.has(item.id);\n}\n\nfunction shouldRenderToggle(item: NavigationItem, state: NavigationRenderState): boolean {\n if (!item.children?.length) {\n return false;\n }\n if (state.horizontalDesktop) {\n return state.depth === 1;\n }\n return true;\n}\n\nfunction resolveHorizontalDesktopExpandedIds(controller: NavigationController): ReadonlySet<string> {\n const activePath = findItemPath(controller.items, (item) => controller.isActive(item)) ?? [];\n const explicitRoot = controller.items.find((item) => controller.expandedIds.has(item.id));\n const root = explicitRoot ?? activePath[0];\n if (!root) {\n return controller.expandedIds;\n }\n\n const ids = new Set<string>([root.id]);\n const explicitChild = root.children?.find((item) => controller.expandedIds.has(item.id));\n if (explicitChild) {\n ids.add(explicitChild.id);\n }\n return ids;\n}\n\nfunction findItemPath(\n items: NavigationItem[],\n predicate: (item: NavigationItem) => boolean,\n path: NavigationItem[] = []\n): NavigationItem[] | undefined {\n for (const item of items) {\n const nextPath = [...path, item];\n if (predicate(item)) {\n return nextPath;\n }\n const childPath = item.children ? findItemPath(item.children, predicate, nextPath) : undefined;\n if (childPath) {\n return childPath;\n }\n }\n return undefined;\n}\n\nfunction nextNavigationId(): number {\n navigationId += 1;\n return navigationId;\n}\n\nfunction safeDomId(value: string): string {\n return value.replace(/[^a-zA-Z0-9_-]+/g, \"-\");\n}\n\nfunction updateBodyNavigationLock(host: HTMLElement, open: boolean): void {\n if (typeof document === \"undefined\") {\n return;\n }\n if (open) {\n openNavigationMenus.add(host);\n } else {\n openNavigationMenus.delete(host);\n }\n document.body?.classList.toggle(\"orderly-navigation-menu-open\", openNavigationMenus.size > 0);\n}\n\nfunction sameSet(left: Set<string>, right: Set<string>): boolean {\n if (left.size !== right.size) {\n return false;\n }\n for (const value of left) {\n if (!right.has(value)) {\n return false;\n }\n }\n return true;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AY,IAAI,KAAK,EAAE,CAAC;AACvF,MAAI,eAAe;AACjB,QAAI,IAAI,cAAc,EAAE;AAAA,EAC1B;AACA,SAAO;AACT;AAEA,SAAS,aACP,OACA,WACA,OAAyB,CAAC,GACI;AAC9B,aAAW,QAAQ,OAAO;AACxB,UAAM,WAAW,CAAC,GAAG,MAAM,IAAI;AAC/B,QAAI,UAAU,IAAI,GAAG;AACnB,aAAO;AAAA,IACT;AACA,UAAM,YAAY,KAAK,WAAW,aAAa,KAAK,UAAU,WAAW,QAAQ,IAAI;AACrF,QAAI,WAAW;AACb,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AAEA,SAAS,mBAA2B;AAClC,kBAAgB;AAChB,SAAO;AACT;AAEA,SAAS,UAAU,OAAuB;AACxC,SAAO,MAAM,QAAQ,oBAAoB,GAAG;AAC9C;AAEA,SAAS,yBAAyB,MAAmB,MAAqB;AACxE,MAAI,OAAO,aAAa,aAAa;AACnC;AAAA,EACF;AACA,MAAI,MAAM;AACR,wBAAoB,IAAI,IAAI;AAAA,EAC9B,OAAO;AACL,wBAAoB,OAAO,IAAI;AAAA,EACjC;AACA,WAAS,MAAM,UAAU,OAAO,gCAAgC,oBAAoB,OAAO,CAAC;AAC9F;AAEA,SAAS,QAAQ,MAAmB,OAA6B;AAC/D,MAAI,KAAK,SAAS,MAAM,MAAM;AAC5B,WAAO;AAAA,EACT;AACA,aAAW,SAAS,MAAM;AACxB,QAAI,CAAC,MAAM,IAAI,KAAK,GAAG;AACrB,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
|
package/dist/query.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { SearchQuery } from '@orderlyshop/core-client';
|
|
2
|
+
|
|
3
|
+
declare const declarativeQueryAttributes: string[];
|
|
4
|
+
interface SearchQueryInput {
|
|
5
|
+
query?: string;
|
|
6
|
+
keywords?: string;
|
|
7
|
+
hiddenQuery?: string;
|
|
8
|
+
tags?: string[];
|
|
9
|
+
orderBy?: string[];
|
|
10
|
+
storeId?: string;
|
|
11
|
+
featured?: boolean;
|
|
12
|
+
}
|
|
13
|
+
type SearchQueryConfig = SearchQuery | SearchQueryInput;
|
|
14
|
+
/**
|
|
15
|
+
* Creates a Core SearchQuery from plain JavaScript values.
|
|
16
|
+
*
|
|
17
|
+
* This is mainly useful for vanilla browser setups that load the standalone
|
|
18
|
+
* bundle and do not want to import protobuf helpers directly.
|
|
19
|
+
*/
|
|
20
|
+
declare function createSearchQuery(input?: SearchQueryInput): SearchQuery;
|
|
21
|
+
declare function normalizeSearchQuery(input?: SearchQueryConfig): SearchQuery;
|
|
22
|
+
/**
|
|
23
|
+
* Builds a SearchQuery from simple HTML configuration.
|
|
24
|
+
*
|
|
25
|
+
* Supported on product grids, product rails, and collection pages. Typed
|
|
26
|
+
* JavaScript `query` properties take precedence in the components; this helper
|
|
27
|
+
* only covers the common declarative fields that are safe to express as text.
|
|
28
|
+
*/
|
|
29
|
+
declare function declarativeSearchQuery(host: Element): SearchQuery | undefined;
|
|
30
|
+
|
|
31
|
+
export { type SearchQueryConfig, type SearchQueryInput, createSearchQuery, declarativeQueryAttributes, declarativeSearchQuery, normalizeSearchQuery };
|
package/dist/query.js
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
// src/query.ts
|
|
2
|
+
import { create } from "@bufbuild/protobuf";
|
|
3
|
+
import {
|
|
4
|
+
SearchQuerySchema,
|
|
5
|
+
TagSchema
|
|
6
|
+
} from "@orderlyshop/core-client";
|
|
7
|
+
var declarativeQueryAttributes = [
|
|
8
|
+
"keywords",
|
|
9
|
+
"tags",
|
|
10
|
+
"hidden-query",
|
|
11
|
+
"order-by",
|
|
12
|
+
"store-id",
|
|
13
|
+
"featured"
|
|
14
|
+
];
|
|
15
|
+
function createSearchQuery(input = {}) {
|
|
16
|
+
return create(SearchQuerySchema, {
|
|
17
|
+
Query: input.query ?? input.keywords,
|
|
18
|
+
HiddenQuery: input.hiddenQuery,
|
|
19
|
+
Tags: (input.tags ?? []).map((tag) => create(TagSchema, { Value: tag })),
|
|
20
|
+
OrderBy: input.orderBy ?? [],
|
|
21
|
+
StoreId: input.storeId,
|
|
22
|
+
Featured: input.featured ?? false
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function normalizeSearchQuery(input = {}) {
|
|
26
|
+
if (isCoreSearchQuery(input)) {
|
|
27
|
+
return create(SearchQuerySchema, input);
|
|
28
|
+
}
|
|
29
|
+
return createSearchQuery(input);
|
|
30
|
+
}
|
|
31
|
+
function declarativeSearchQuery(host) {
|
|
32
|
+
const queryElement = directQueryElement(host);
|
|
33
|
+
const keywords = readQueryValue(host, queryElement, "keywords");
|
|
34
|
+
const hiddenQuery = readQueryValue(host, queryElement, "hidden-query");
|
|
35
|
+
const storeId = readQueryValue(host, queryElement, "store-id");
|
|
36
|
+
const featured = readQueryBoolean(host, queryElement, "featured");
|
|
37
|
+
const tags = readQueryList(host, queryElement, "tags");
|
|
38
|
+
const orderBy = readQueryList(host, queryElement, "order-by");
|
|
39
|
+
if (!keywords && !hiddenQuery && !storeId && featured === void 0 && tags.length === 0 && orderBy.length === 0) {
|
|
40
|
+
return void 0;
|
|
41
|
+
}
|
|
42
|
+
return create(SearchQuerySchema, {
|
|
43
|
+
Query: keywords || void 0,
|
|
44
|
+
HiddenQuery: hiddenQuery || void 0,
|
|
45
|
+
Tags: tags.map((tag) => create(TagSchema, { Value: tag })),
|
|
46
|
+
OrderBy: orderBy,
|
|
47
|
+
StoreId: storeId || void 0,
|
|
48
|
+
Featured: featured ?? false
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
function directQueryElement(host) {
|
|
52
|
+
const queryElement = [...host.children].find((child) => child.localName === "query");
|
|
53
|
+
if (queryElement instanceof HTMLElement) {
|
|
54
|
+
queryElement.hidden = true;
|
|
55
|
+
}
|
|
56
|
+
return queryElement;
|
|
57
|
+
}
|
|
58
|
+
function isCoreSearchQuery(input) {
|
|
59
|
+
return "Query" in input || "HiddenQuery" in input || "Tags" in input || "OrderBy" in input || "StoreId" in input || "Featured" in input;
|
|
60
|
+
}
|
|
61
|
+
function readQueryValue(host, queryElement, name) {
|
|
62
|
+
return firstValue(
|
|
63
|
+
host.getAttribute(name),
|
|
64
|
+
queryElement?.getAttribute(name),
|
|
65
|
+
childText(queryElement, name)
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
function readQueryList(host, queryElement, name) {
|
|
69
|
+
return uniqueValues([
|
|
70
|
+
...splitList(host.getAttribute(name)),
|
|
71
|
+
...splitList(queryElement?.getAttribute(name)),
|
|
72
|
+
...splitList(childText(queryElement, name))
|
|
73
|
+
]);
|
|
74
|
+
}
|
|
75
|
+
function readQueryBoolean(host, queryElement, name) {
|
|
76
|
+
if (host.hasAttribute(name) && !host.getAttribute(name)) {
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
if (queryElement?.hasAttribute(name) && !queryElement.getAttribute(name)) {
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
return parseBoolean(readQueryValue(host, queryElement, name));
|
|
83
|
+
}
|
|
84
|
+
function childText(queryElement, name) {
|
|
85
|
+
const child = [...queryElement?.children ?? []].find((element) => element.localName === name);
|
|
86
|
+
return child?.textContent?.trim();
|
|
87
|
+
}
|
|
88
|
+
function firstValue(...values) {
|
|
89
|
+
return values.map((value) => value?.trim()).find(Boolean) ?? "";
|
|
90
|
+
}
|
|
91
|
+
function splitList(value) {
|
|
92
|
+
return (value ?? "").split(/[\n,]/g).map((item) => item.trim()).filter(Boolean);
|
|
93
|
+
}
|
|
94
|
+
function uniqueValues(values) {
|
|
95
|
+
return [...new Set(values)];
|
|
96
|
+
}
|
|
97
|
+
function parseBoolean(value) {
|
|
98
|
+
if (!value) {
|
|
99
|
+
return void 0;
|
|
100
|
+
}
|
|
101
|
+
if (["true", "1", "yes", ""].includes(value.toLowerCase())) {
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
104
|
+
if (["false", "0", "no"].includes(value.toLowerCase())) {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
return void 0;
|
|
108
|
+
}
|
|
109
|
+
export {
|
|
110
|
+
createSearchQuery,
|
|
111
|
+
declarativeQueryAttributes,
|
|
112
|
+
declarativeSearchQuery,
|
|
113
|
+
normalizeSearchQuery
|
|
114
|
+
};
|
|
115
|
+
//# sourceMappingURL=query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/query.ts"],"sourcesContent":["import { create } from \"@bufbuild/protobuf\";\nimport {\n SearchQuerySchema,\n TagSchema,\n type SearchQuery\n} from \"@orderlyshop/core-client\";\n\nexport const declarativeQueryAttributes = [\n \"keywords\",\n \"tags\",\n \"hidden-query\",\n \"order-by\",\n \"store-id\",\n \"featured\"\n];\n\nexport interface SearchQueryInput {\n query?: string;\n keywords?: string;\n hiddenQuery?: string;\n tags?: string[];\n orderBy?: string[];\n storeId?: string;\n featured?: boolean;\n}\n\nexport type SearchQueryConfig = SearchQuery | SearchQueryInput;\n\n/**\n * Creates a Core SearchQuery from plain JavaScript values.\n *\n * This is mainly useful for vanilla browser setups that load the standalone\n * bundle and do not want to import protobuf helpers directly.\n */\nexport function createSearchQuery(input: SearchQueryInput = {}): SearchQuery {\n return create(SearchQuerySchema, {\n Query: input.query ?? input.keywords,\n HiddenQuery: input.hiddenQuery,\n Tags: (input.tags ?? []).map((tag) => create(TagSchema, { Value: tag })),\n OrderBy: input.orderBy ?? [],\n StoreId: input.storeId,\n Featured: input.featured ?? false\n });\n}\n\nexport function normalizeSearchQuery(input: SearchQueryConfig = {}): SearchQuery {\n if (isCoreSearchQuery(input)) {\n return create(SearchQuerySchema, input);\n }\n return createSearchQuery(input);\n}\n\n/**\n * Builds a SearchQuery from simple HTML configuration.\n *\n * Supported on product grids, product rails, and collection pages. Typed\n * JavaScript `query` properties take precedence in the components; this helper\n * only covers the common declarative fields that are safe to express as text.\n */\nexport function declarativeSearchQuery(host: Element): SearchQuery | undefined {\n const queryElement = directQueryElement(host);\n const keywords = readQueryValue(host, queryElement, \"keywords\");\n const hiddenQuery = readQueryValue(host, queryElement, \"hidden-query\");\n const storeId = readQueryValue(host, queryElement, \"store-id\");\n const featured = readQueryBoolean(host, queryElement, \"featured\");\n const tags = readQueryList(host, queryElement, \"tags\");\n const orderBy = readQueryList(host, queryElement, \"order-by\");\n\n if (!keywords && !hiddenQuery && !storeId && featured === undefined && tags.length === 0 && orderBy.length === 0) {\n return undefined;\n }\n\n return create(SearchQuerySchema, {\n Query: keywords || undefined,\n HiddenQuery: hiddenQuery || undefined,\n Tags: tags.map((tag) => create(TagSchema, { Value: tag })),\n OrderBy: orderBy,\n StoreId: storeId || undefined,\n Featured: featured ?? false\n });\n}\n\nfunction directQueryElement(host: Element): Element | undefined {\n const queryElement = [...host.children].find((child) => child.localName === \"query\");\n if (queryElement instanceof HTMLElement) {\n queryElement.hidden = true;\n }\n return queryElement;\n}\n\nfunction isCoreSearchQuery(input: SearchQueryConfig): input is SearchQuery {\n return \"Query\" in input\n || \"HiddenQuery\" in input\n || \"Tags\" in input\n || \"OrderBy\" in input\n || \"StoreId\" in input\n || \"Featured\" in input;\n}\n\nfunction readQueryValue(host: Element, queryElement: Element | undefined, name: string): string {\n return firstValue(\n host.getAttribute(name),\n queryElement?.getAttribute(name),\n childText(queryElement, name)\n );\n}\n\nfunction readQueryList(host: Element, queryElement: Element | undefined, name: string): string[] {\n return uniqueValues([\n ...splitList(host.getAttribute(name)),\n ...splitList(queryElement?.getAttribute(name)),\n ...splitList(childText(queryElement, name))\n ]);\n}\n\nfunction readQueryBoolean(host: Element, queryElement: Element | undefined, name: string): boolean | undefined {\n if (host.hasAttribute(name) && !host.getAttribute(name)) {\n return true;\n }\n if (queryElement?.hasAttribute(name) && !queryElement.getAttribute(name)) {\n return true;\n }\n return parseBoolean(readQueryValue(host, queryElement, name));\n}\n\nfunction childText(queryElement: Element | undefined, name: string): string | undefined {\n const child = [...queryElement?.children ?? []].find((element) => element.localName === name);\n return child?.textContent?.trim();\n}\n\nfunction firstValue(...values: Array<string | null | undefined>): string {\n return values.map((value) => value?.trim()).find(Boolean) ?? \"\";\n}\n\nfunction splitList(value: string | null | undefined): string[] {\n return (value ?? \"\")\n .split(/[\\n,]/g)\n .map((item) => item.trim())\n .filter(Boolean);\n}\n\nfunction uniqueValues(values: string[]): string[] {\n return [...new Set(values)];\n}\n\nfunction parseBoolean(value: string): boolean | undefined {\n if (!value) {\n return undefined;\n }\n if ([\"true\", \"1\", \"yes\", \"\"].includes(value.toLowerCase())) {\n return true;\n }\n if ([\"false\", \"0\", \"no\"].includes(value.toLowerCase())) {\n return false;\n }\n return undefined;\n}\n"],"mappings":";AAAA,SAAS,cAAc;AACvB;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AAEA,IAAM,6BAA6B;AAAA,EACxC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAoBO,SAAS,kBAAkB,QAA0B,CAAC,GAAgB;AAC3E,SAAO,OAAO,mBAAmB;AAAA,IAC/B,OAAO,MAAM,SAAS,MAAM;AAAA,IAC5B,aAAa,MAAM;AAAA,IACnB,OAAO,MAAM,QAAQ,CAAC,GAAG,IAAI,CAAC,QAAQ,OAAO,WAAW,EAAE,OAAO,IAAI,CAAC,CAAC;AAAA,IACvE,SAAS,MAAM,WAAW,CAAC;AAAA,IAC3B,SAAS,MAAM;AAAA,IACf,UAAU,MAAM,YAAY;AAAA,EAC9B,CAAC;AACH;AAEO,SAAS,qBAAqB,QAA2B,CAAC,GAAgB;AAC/E,MAAI,kBAAkB,KAAK,GAAG;AAC5B,WAAO,OAAO,mBAAmB,KAAK;AAAA,EACxC;AACA,SAAO,kBAAkB,KAAK;AAChC;AASO,SAAS,uBAAuB,MAAwC;AAC7E,QAAM,eAAe,mBAAmB,IAAI;AAC5C,QAAM,WAAW,eAAe,MAAM,cAAc,UAAU;AAC9D,QAAM,cAAc,eAAe,M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C,CAAC;AACH;AAEA,SAAS,iBAAiB,MAAe,cAAmC,MAAmC;AAC7G,MAAI,KAAK,aAAa,IAAI,KAAK,CAAC,KAAK,aAAa,IAAI,GAAG;AACvD,WAAO;AAAA,EACT;AACA,MAAI,cAAc,aAAa,IAAI,KAAK,CAAC,aAAa,aAAa,IAAI,GAAG;AACxE,WAAO;AAAA,EACT;AACA,SAAO,aAAa,eAAe,MAAM,cAAc,IAAI,CAAC;AAC9D;AAEA,SAAS,UAAU,cAAmC,MAAkC;AACtF,QAAM,QAAQ,CAAC,GAAG,cAAc,YAAY,CAAC,CAAC,EAAE,KAAK,CAAC,YAAY,QAAQ,cAAc,IAAI;AAC5F,SAAO,OAAO,aAAa,KAAK;AAClC;AAEA,SAAS,cAAc,QAAkD;AACvE,SAAO,OAAO,IAAI,CAAC,UAAU,OAAO,KAAK,CAAC,EAAE,KAAK,OAAO,KAAK;AAC/D;AAEA,SAAS,UAAU,OAA4C;AAC7D,UAAQ,SAAS,IACd,MAAM,QAAQ,EACd,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC,EACzB,OAAO,OAAO;AACnB;AAEA,SAAS,aAAa,QAA4B;AAChD,SAAO,CAAC,GAAG,IAAI,IAAI,MAAM,CAAC;AAC5B;AAEA,SAAS,aAAa,OAAoC;AACxD,MAAI,CAAC,OAAO;AACV,WAAO;AAAA,EACT;AACA,MAAI,CAAC,QAAQ,KAAK,OAAO,EAAE,EAAE,SAAS,MAAM,YAAY,CAAC,GAAG;AAC1D,WAAO;AAAA,EACT;AACA,MAAI,CAAC,SAAS,KAAK,IAAI,EAAE,SAAS,MAAM,YAAY,CAAC,GAAG;AACtD,WAAO;AAAA,EACT;AACA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { O as OrderlyElement, U as UiLanguage, D as DefaultShopConfig } from './default-shop-DgX6uy10.js';
|
|
2
|
+
import { D as DefineOrderlyWebComponentsOptions } from './registry-CPDecU3g.js';
|
|
3
|
+
import { StoredImage, Credit } from '@orderlyshop/core-client';
|
|
4
|
+
|
|
5
|
+
declare const DEFAULT_PAGE_LAYOUT_LOGO_SRC = "https://orderly.shop/home/App_Icon.svg";
|
|
6
|
+
declare const pageLayoutSlots: readonly ["utility", "header", "header-actions", "primary-nav", "left", "right", "content-before", "content", "content-after", "footer", "overlay"];
|
|
7
|
+
type PageLayoutSlot = typeof pageLayoutSlots[number];
|
|
8
|
+
interface PageLayoutConfig {
|
|
9
|
+
template?: HTMLTemplateElement | string;
|
|
10
|
+
logoSrc?: string;
|
|
11
|
+
logoAlt?: string;
|
|
12
|
+
logoHref?: string;
|
|
13
|
+
}
|
|
14
|
+
declare function configurePageLayout(config: PageLayoutConfig): void;
|
|
15
|
+
declare class OrderlyPageLayoutElement extends HTMLElement {
|
|
16
|
+
static observedAttributes: string[];
|
|
17
|
+
private disconnectResponsiveTemplates?;
|
|
18
|
+
get logoSrc(): string;
|
|
19
|
+
set logoSrc(value: string);
|
|
20
|
+
get logoAlt(): string;
|
|
21
|
+
set logoAlt(value: string);
|
|
22
|
+
get logoHref(): string;
|
|
23
|
+
set logoHref(value: string);
|
|
24
|
+
connectedCallback(): void;
|
|
25
|
+
disconnectedCallback(): void;
|
|
26
|
+
attributeChangedCallback(): void;
|
|
27
|
+
render(): void;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface ShopFooterAddress {
|
|
31
|
+
name?: string;
|
|
32
|
+
street?: string;
|
|
33
|
+
street2?: string;
|
|
34
|
+
postalCode?: string;
|
|
35
|
+
city?: string;
|
|
36
|
+
region?: string;
|
|
37
|
+
country?: string;
|
|
38
|
+
lines?: string[];
|
|
39
|
+
}
|
|
40
|
+
interface ShopFooterContactItem {
|
|
41
|
+
label: string;
|
|
42
|
+
value: string;
|
|
43
|
+
href?: string;
|
|
44
|
+
}
|
|
45
|
+
interface ShopFooterContact {
|
|
46
|
+
email?: string;
|
|
47
|
+
phone?: string;
|
|
48
|
+
website?: string;
|
|
49
|
+
items?: ShopFooterContactItem[];
|
|
50
|
+
}
|
|
51
|
+
interface ShopFooterOpeningHour {
|
|
52
|
+
label: string;
|
|
53
|
+
hours: string;
|
|
54
|
+
}
|
|
55
|
+
interface ShopFooterInformationLink {
|
|
56
|
+
label: string;
|
|
57
|
+
href: string;
|
|
58
|
+
target?: string;
|
|
59
|
+
rel?: string;
|
|
60
|
+
}
|
|
61
|
+
interface ShopFooterConfig {
|
|
62
|
+
template?: HTMLTemplateElement | string;
|
|
63
|
+
logoSrc?: string;
|
|
64
|
+
logoAlt?: string;
|
|
65
|
+
logoHref?: string;
|
|
66
|
+
aboutText?: string;
|
|
67
|
+
addressTitle?: string;
|
|
68
|
+
contactTitle?: string;
|
|
69
|
+
openingHoursTitle?: string;
|
|
70
|
+
informationLinksTitle?: string;
|
|
71
|
+
address?: ShopFooterAddress;
|
|
72
|
+
contact?: ShopFooterContact;
|
|
73
|
+
openingHours?: ShopFooterOpeningHour[];
|
|
74
|
+
informationLinks?: ShopFooterInformationLink[];
|
|
75
|
+
}
|
|
76
|
+
declare function configureShopFooter(config: ShopFooterConfig): void;
|
|
77
|
+
declare class OrderlyShopFooterElement extends OrderlyElement {
|
|
78
|
+
static observedAttributes: string[];
|
|
79
|
+
private addressValue?;
|
|
80
|
+
private contactValue?;
|
|
81
|
+
private openingHoursValue?;
|
|
82
|
+
private informationLinksValue?;
|
|
83
|
+
get logoSrc(): string;
|
|
84
|
+
set logoSrc(value: string);
|
|
85
|
+
get logoAlt(): string;
|
|
86
|
+
set logoAlt(value: string);
|
|
87
|
+
get logoHref(): string;
|
|
88
|
+
set logoHref(value: string);
|
|
89
|
+
get aboutText(): string;
|
|
90
|
+
set aboutText(value: string);
|
|
91
|
+
get addressTitle(): string;
|
|
92
|
+
set addressTitle(value: string);
|
|
93
|
+
get contactTitle(): string;
|
|
94
|
+
set contactTitle(value: string);
|
|
95
|
+
get openingHoursTitle(): string;
|
|
96
|
+
set openingHoursTitle(value: string);
|
|
97
|
+
get informationLinksTitle(): string;
|
|
98
|
+
set informationLinksTitle(value: string);
|
|
99
|
+
get address(): ShopFooterAddress | undefined;
|
|
100
|
+
set address(value: ShopFooterAddress | undefined);
|
|
101
|
+
get contact(): ShopFooterContact | undefined;
|
|
102
|
+
set contact(value: ShopFooterContact | undefined);
|
|
103
|
+
get openingHours(): ShopFooterOpeningHour[];
|
|
104
|
+
set openingHours(value: ShopFooterOpeningHour[]);
|
|
105
|
+
get informationLinks(): ShopFooterInformationLink[];
|
|
106
|
+
set informationLinks(value: ShopFooterInformationLink[]);
|
|
107
|
+
attributeChangedCallback(): void;
|
|
108
|
+
protected render(): void;
|
|
109
|
+
private renderAddress;
|
|
110
|
+
private renderContact;
|
|
111
|
+
private renderOpeningHours;
|
|
112
|
+
private renderInformationLinks;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
type StoredImageUrlVariant = "thumbnail" | "object";
|
|
116
|
+
type StoredImageUrlResolver = (image: StoredImage) => string | undefined;
|
|
117
|
+
declare const DEFAULT_IMAGE_BASE_URL = "https://orderlyproduction.azureedge.net/";
|
|
118
|
+
interface StoredImageUrlConfig {
|
|
119
|
+
baseUrl?: string;
|
|
120
|
+
thumbnailsPath?: string;
|
|
121
|
+
objectsPath?: string;
|
|
122
|
+
resolver?: StoredImageUrlResolver;
|
|
123
|
+
}
|
|
124
|
+
interface CreditFormatOptions {
|
|
125
|
+
locale?: string;
|
|
126
|
+
}
|
|
127
|
+
interface CreditFormatParts {
|
|
128
|
+
prefix: string;
|
|
129
|
+
amount: string;
|
|
130
|
+
currency: string;
|
|
131
|
+
text: string;
|
|
132
|
+
}
|
|
133
|
+
declare function configureStoredImageUrls(config: StoredImageUrlConfig): void;
|
|
134
|
+
declare function storedImageUrl(image: StoredImage | undefined, variant?: StoredImageUrlVariant): string | undefined;
|
|
135
|
+
declare function formatCredit(credit: Credit | undefined, options?: CreditFormatOptions): string;
|
|
136
|
+
declare function formatCreditParts(credit: Credit | undefined, options?: CreditFormatOptions): CreditFormatParts;
|
|
137
|
+
|
|
138
|
+
type TemplateViewport = "desktop" | "mobile";
|
|
139
|
+
interface ResponsiveTemplateConfig {
|
|
140
|
+
mobileMediaQuery?: string;
|
|
141
|
+
}
|
|
142
|
+
interface GlobalTemplateRegistration {
|
|
143
|
+
name: string;
|
|
144
|
+
template: HTMLTemplateElement | string;
|
|
145
|
+
for?: string | string[];
|
|
146
|
+
viewport?: TemplateViewport;
|
|
147
|
+
media?: string;
|
|
148
|
+
}
|
|
149
|
+
declare function configureResponsiveTemplates(config?: ResponsiveTemplateConfig): void;
|
|
150
|
+
declare function currentTemplateViewport(): TemplateViewport;
|
|
151
|
+
declare function registerGlobalTemplate(registration: GlobalTemplateRegistration): () => void;
|
|
152
|
+
declare function clearGlobalTemplates(): void;
|
|
153
|
+
|
|
154
|
+
interface ShopConfig {
|
|
155
|
+
/** UI language for built-in component copy. Defaults to Danish ("DA"). */
|
|
156
|
+
uiLanguage?: UiLanguage | string;
|
|
157
|
+
/** Shop-wide backend, navigation, query, basket, checkout, and copy defaults. */
|
|
158
|
+
defaultShop?: DefaultShopConfig;
|
|
159
|
+
/** Structural page layout defaults, including logo and optional layout template. */
|
|
160
|
+
pageLayout?: PageLayoutConfig;
|
|
161
|
+
/** Shared responsive template breakpoint configuration. */
|
|
162
|
+
responsiveTemplates?: ResponsiveTemplateConfig;
|
|
163
|
+
/** Default shop footer data when a shop does not provide a footer template. */
|
|
164
|
+
shopFooter?: ShopFooterConfig;
|
|
165
|
+
/** StoredImage URL resolver and CDN prefix configuration. */
|
|
166
|
+
storedImageUrls?: StoredImageUrlConfig;
|
|
167
|
+
/** Custom element registration options. Pass false when elements are registered elsewhere. */
|
|
168
|
+
components?: DefineOrderlyWebComponentsOptions | false;
|
|
169
|
+
}
|
|
170
|
+
/** Configure the storefront defaults and register web components. */
|
|
171
|
+
declare function configureShop(config?: ShopConfig): void;
|
|
172
|
+
|
|
173
|
+
export { type CreditFormatOptions as C, DEFAULT_IMAGE_BASE_URL as D, type GlobalTemplateRegistration as G, OrderlyPageLayoutElement as O, type PageLayoutConfig as P, type ResponsiveTemplateConfig as R, type StoredImageUrlVariant as S, type TemplateViewport as T, type CreditFormatParts as a, DEFAULT_PAGE_LAYOUT_LOGO_SRC as b, OrderlyShopFooterElement as c, type PageLayoutSlot as d, type ShopConfig as e, type ShopFooterAddress as f, type ShopFooterConfig as g, type ShopFooterContact as h, type ShopFooterContactItem as i, type ShopFooterInformationLink as j, type ShopFooterOpeningHour as k, type StoredImageUrlConfig as l, type StoredImageUrlResolver as m, clearGlobalTemplates as n, configurePageLayout as o, configureResponsiveTemplates as p, configureShop as q, configureShopFooter as r, configureStoredImageUrls as s, currentTemplateViewport as t, formatCredit as u, formatCreditParts as v, registerGlobalTemplate as w, storedImageUrl as x };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SearchQuery } from '@orderlyshop/core-client';
|
|
2
|
+
|
|
3
|
+
declare function configureShopSearchQuery(query: SearchQuery | undefined): void;
|
|
4
|
+
declare function shopSearchQuery(): SearchQuery | undefined;
|
|
5
|
+
declare function createAccountShopQuery(accountId: string): SearchQuery;
|
|
6
|
+
declare function mergeShopSearchQuery(query: SearchQuery | undefined, localShopQuery?: SearchQuery): SearchQuery;
|
|
7
|
+
|
|
8
|
+
export { configureShopSearchQuery, createAccountShopQuery, mergeShopSearchQuery, shopSearchQuery };
|