@intlayer/design-system 9.3.2 → 9.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/api/hooks/auth.mjs +2 -0
- package/dist/esm/api/hooks/auth.mjs.map +1 -1
- package/dist/esm/api/index.mjs +2 -2
- package/dist/esm/api/useAuth/useOAuth2.mjs +1 -1
- package/dist/esm/api/useAuth/useSession.mjs +1 -1
- package/dist/esm/components/Browser/Browser.mjs +1 -1
- package/dist/esm/components/Browser/Browser.mjs.map +1 -1
- package/dist/esm/components/ContentEditor/ContentEditorTextArea.mjs +1 -1
- package/dist/esm/components/CopyButton/index.mjs +2 -1
- package/dist/esm/components/CopyButton/index.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/ContentEditor.mjs +4 -5
- package/dist/esm/components/DictionaryFieldEditor/ContentEditor.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/ContentEditorView/TextEditor.mjs +6 -10
- package/dist/esm/components/DictionaryFieldEditor/ContentEditorView/TextEditor.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs +1 -1
- package/dist/esm/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs +6 -6
- package/dist/esm/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs +3 -7
- package/dist/esm/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs +1 -1
- package/dist/esm/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs +2 -2
- package/dist/esm/components/DictionaryFieldEditor/StructureView/StructureView.mjs +1 -1
- package/dist/esm/components/ExpandCollapse/ExpandCollapse.mjs +19 -12
- package/dist/esm/components/ExpandCollapse/ExpandCollapse.mjs.map +1 -1
- package/dist/esm/components/HTMLRender/HTMLRender.mjs +2 -2
- package/dist/esm/components/HTMLRender/HTMLRender.mjs.map +1 -1
- package/dist/esm/components/IDE/Code.mjs +3 -3
- package/dist/esm/components/IDE/Code.mjs.map +1 -1
- package/dist/esm/components/IDE/CodeBlockClient.mjs +16 -4
- package/dist/esm/components/IDE/CodeBlockClient.mjs.map +1 -1
- package/dist/esm/components/IDE/CodeBlockHighlight.mjs +14 -5
- package/dist/esm/components/IDE/CodeBlockHighlight.mjs.map +1 -1
- package/dist/esm/components/IDE/CodeBlockServer.mjs +5 -3
- package/dist/esm/components/IDE/CodeBlockServer.mjs.map +1 -1
- package/dist/esm/components/IDE/CodeBlockShiki.mjs +18 -18
- package/dist/esm/components/IDE/CodeBlockShiki.mjs.map +1 -1
- package/dist/esm/components/IDE/IDE.mjs +2 -5
- package/dist/esm/components/IDE/IDE.mjs.map +1 -1
- package/dist/esm/components/IDE/MarkDownRender.mjs +1 -2
- package/dist/esm/components/IDE/MarkDownRender.mjs.map +1 -1
- package/dist/esm/components/IDE/index.mjs +2 -2
- package/dist/esm/components/IDE/shikiThemes.mjs +18 -0
- package/dist/esm/components/IDE/shikiThemes.mjs.map +1 -0
- package/dist/esm/components/MarkDownRender/MarkDownIframe.mjs +105 -4
- package/dist/esm/components/MarkDownRender/MarkDownIframe.mjs.map +1 -1
- package/dist/esm/components/MarkDownRender/MarkDownRender.mjs +16 -16
- package/dist/esm/components/MarkDownRender/MarkDownRender.mjs.map +1 -1
- package/dist/esm/components/MaxHeightSmoother/index.mjs +1 -1
- package/dist/esm/components/MaxHeightSmoother/index.mjs.map +1 -1
- package/dist/esm/components/MaxWidthSmoother/index.mjs +1 -1
- package/dist/esm/components/MaxWidthSmoother/index.mjs.map +1 -1
- package/dist/esm/components/Pattern/GridDistortionPattern.mjs +100 -15
- package/dist/esm/components/Pattern/GridDistortionPattern.mjs.map +1 -1
- package/dist/esm/components/Popover/dynamic.mjs +5 -4
- package/dist/esm/components/Popover/dynamic.mjs.map +1 -1
- package/dist/esm/components/Popover/index.mjs +2 -2
- package/dist/esm/components/Popover/static.mjs +47 -18
- package/dist/esm/components/Popover/static.mjs.map +1 -1
- package/dist/esm/components/Tab/Tab.mjs +37 -16
- package/dist/esm/components/Tab/Tab.mjs.map +1 -1
- package/dist/esm/components/TextArea/AutoSizeTextArea.mjs +3 -2
- package/dist/esm/components/TextArea/AutoSizeTextArea.mjs.map +1 -1
- package/dist/esm/components/index.mjs +3 -3
- package/dist/esm/hooks/useDevice.mjs +16 -6
- package/dist/esm/hooks/useDevice.mjs.map +1 -1
- package/dist/esm/hooks/useItemSelector.mjs +107 -112
- package/dist/esm/hooks/useItemSelector.mjs.map +1 -1
- package/dist/esm/libs/auth.mjs +16 -3
- package/dist/esm/libs/auth.mjs.map +1 -1
- package/dist/esm/structured-data/buildCreativeWorkJsonLd.mjs +1 -1
- package/dist/esm/structured-data/buildCreativeWorkJsonLd.mjs.map +1 -1
- package/dist/types/api/hooks/auth.d.ts.map +1 -1
- package/dist/types/components/Browser/Browser.d.ts +7 -1
- package/dist/types/components/Browser/Browser.d.ts.map +1 -1
- package/dist/types/components/CopyButton/index.d.ts +9 -3
- package/dist/types/components/CopyButton/index.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/ContentEditor.d.ts +0 -1
- package/dist/types/components/DictionaryFieldEditor/ContentEditor.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/ContentEditorView/TextEditor.d.ts +0 -1
- package/dist/types/components/DictionaryFieldEditor/ContentEditorView/TextEditor.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.d.ts +0 -1
- package/dist/types/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.d.ts.map +1 -1
- package/dist/types/components/ExpandCollapse/ExpandCollapse.d.ts.map +1 -1
- package/dist/types/components/HTMLRender/HTMLRender.d.ts +1 -2
- package/dist/types/components/HTMLRender/HTMLRender.d.ts.map +1 -1
- package/dist/types/components/IDE/Code.d.ts +6 -1
- package/dist/types/components/IDE/Code.d.ts.map +1 -1
- package/dist/types/components/IDE/CodeBlockClient.d.ts +18 -2
- package/dist/types/components/IDE/CodeBlockClient.d.ts.map +1 -1
- package/dist/types/components/IDE/CodeBlockHighlight.d.ts +3 -2
- package/dist/types/components/IDE/CodeBlockHighlight.d.ts.map +1 -1
- package/dist/types/components/IDE/CodeBlockServer.d.ts +0 -1
- package/dist/types/components/IDE/CodeBlockServer.d.ts.map +1 -1
- package/dist/types/components/IDE/CodeBlockShiki.d.ts +0 -1
- package/dist/types/components/IDE/CodeBlockShiki.d.ts.map +1 -1
- package/dist/types/components/IDE/IDE.d.ts +0 -1
- package/dist/types/components/IDE/IDE.d.ts.map +1 -1
- package/dist/types/components/IDE/MarkDownRender.d.ts +0 -1
- package/dist/types/components/IDE/MarkDownRender.d.ts.map +1 -1
- package/dist/types/components/IDE/index.d.ts +2 -2
- package/dist/types/components/IDE/shikiThemes.d.ts +18 -0
- package/dist/types/components/IDE/shikiThemes.d.ts.map +1 -0
- package/dist/types/components/MarkDownRender/MarkDownIframe.d.ts.map +1 -1
- package/dist/types/components/MarkDownRender/MarkDownRender.d.ts +1 -2
- package/dist/types/components/MarkDownRender/MarkDownRender.d.ts.map +1 -1
- package/dist/types/components/Pattern/GridDistortionPattern.d.ts.map +1 -1
- package/dist/types/components/Popover/dynamic.d.ts.map +1 -1
- package/dist/types/components/Popover/index.d.ts +2 -2
- package/dist/types/components/Popover/static.d.ts +6 -1
- package/dist/types/components/Popover/static.d.ts.map +1 -1
- package/dist/types/components/Tab/Tab.d.ts +2 -2
- package/dist/types/components/Tab/Tab.d.ts.map +1 -1
- package/dist/types/components/index.d.ts +3 -3
- package/dist/types/hooks/useItemSelector.d.ts.map +1 -1
- package/dist/types/libs/auth.d.ts +3 -0
- package/dist/types/libs/auth.d.ts.map +1 -1
- package/dist/types/structured-data/buildCreativeWorkJsonLd.d.ts +9 -3
- package/dist/types/structured-data/buildCreativeWorkJsonLd.d.ts.map +1 -1
- package/package.json +40 -35
- package/tailwind.css +27 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useItemSelector.mjs","names":[],"sources":["../../../src/hooks/useItemSelector.ts"],"sourcesContent":["'use client';\n\nimport { type RefObject, useLayoutEffect, useRef, useState } from 'react';\n\nexport type ItemSelectorOrientation = 'horizontal' | 'vertical';\n\ntype HorizontalStyleState = {\n left: number;\n width: number;\n opacity: number;\n};\n\ntype VerticalStyleState = {\n top: number;\n height: number;\n opacity: number;\n};\n\ntype StyleState = HorizontalStyleState | VerticalStyleState;\n\nconst selectorDefault = (option: HTMLElement) =>\n option?.getAttribute('aria-selected') === 'true';\n\ntype Options = {\n selector?: (option: HTMLElement, index: number) => boolean;\n isHoverable?: boolean;\n orientation?: ItemSelectorOrientation;\n};\n\nexport const useItemSelector = (\n optionsRefs: RefObject<HTMLElement[]>,\n {\n selector = selectorDefault,\n isHoverable = false,\n orientation = 'horizontal',\n }: Options = {\n selector: selectorDefault,\n isHoverable: false,\n orientation: 'horizontal',\n }\n) => {\n const [choiceIndicatorPosition, setChoiceIndicatorPosition] =\n useState<StyleState | null>(null);\n\n const [hoveredItem, setHoveredItem] = useState<HTMLElement | null>(null);\n const hideTimeoutRef = useRef<NodeJS.Timeout | null>(null);\n const lastPositionRef = useRef<StyleState | null>(null);\n\n const itemsLength = optionsRefs.current.length;\n\n const calculatePosition = () => {\n let targetElement: HTMLElement | null = null;\n\n if (hoveredItem) {\n targetElement = hoveredItem;\n // Clear any pending hide timeout when hovering over an item\n if (hideTimeoutRef.current) {\n clearTimeout(hideTimeoutRef.current);\n hideTimeoutRef.current = null;\n }\n } else {\n targetElement = optionsRefs.current.find(selector) ?? null;\n }\n\n if (!targetElement) {\n // Keep previous position but set opacity to 0\n if (orientation === 'vertical') {\n const verticalPrev =\n lastPositionRef.current as VerticalStyleState | null;\n const newPosition: VerticalStyleState = {\n top: verticalPrev?.top ?? 0,\n height: verticalPrev?.height ?? 0,\n opacity: 0,\n };\n\n if (verticalPrev?.opacity !== 0) {\n setChoiceIndicatorPosition(newPosition);\n lastPositionRef.current = newPosition;\n }\n } else {\n const horizontalPrev =\n lastPositionRef.current as HorizontalStyleState | null;\n const newPosition: HorizontalStyleState = {\n left: horizontalPrev?.left ?? 0,\n width: horizontalPrev?.width ?? 0,\n opacity: 0,\n };\n\n if (horizontalPrev?.opacity !== 0) {\n setChoiceIndicatorPosition(newPosition);\n lastPositionRef.current = newPosition;\n }\n }\n return;\n }\n\n if (orientation === 'vertical') {\n const top = targetElement.offsetTop;\n const height = targetElement.offsetHeight;\n\n const newPosition = {\n top,\n height,\n opacity: 1,\n };\n\n const prev = lastPositionRef.current as VerticalStyleState | null;\n\n if (\n !prev ||\n prev.top !== top ||\n prev.height !== height ||\n prev.opacity !== 1\n ) {\n setChoiceIndicatorPosition(newPosition);\n lastPositionRef.current = newPosition;\n }\n } else {\n const left = targetElement.offsetLeft;\n const width = targetElement.offsetWidth;\n\n const newPosition = {\n left,\n width,\n opacity: 1,\n };\n\n const prev = lastPositionRef.current as HorizontalStyleState | null;\n\n if (\n !prev ||\n prev.left !== left ||\n prev.width !== width ||\n prev.opacity !== 1\n ) {\n setChoiceIndicatorPosition(newPosition);\n lastPositionRef.current = newPosition;\n }\n }\n };\n\n useLayoutEffect(() => {\n calculatePosition();\n\n // Event listeners for window events\n window.addEventListener('resize', calculatePosition);\n window.addEventListener('DOMContentLoaded', calculatePosition);\n\n // MutationObserver to watch for 'aria-selected' changes\n const mutationObservers: MutationObserver[] = [];\n\n optionsRefs.current.forEach((option) => {\n if (option) {\n const observer = new MutationObserver((mutations) => {\n for (const mutation of mutations) {\n if (\n mutation.type === 'attributes' &&\n (mutation.attributeName === 'aria-selected' ||\n mutation.attributeName === 'data-active' ||\n mutation.attributeName === 'data-indicator')\n ) {\n calculatePosition();\n break;\n }\n }\n });\n\n observer.observe(option, {\n attributes: true,\n attributeFilter: ['aria-selected', 'data-active', 'data-indicator'],\n });\n\n mutationObservers.push(observer);\n }\n });\n\n // ResizeObserver to watch for size changes\n const resizeObservers: ResizeObserver[] = [];\n\n const observeSize = (element: HTMLElement) => {\n if (!element) return;\n const resizeObserver = new ResizeObserver(() => {\n calculatePosition();\n });\n resizeObserver.observe(element);\n resizeObservers.push(resizeObserver);\n };\n\n // Observe the selected item\n const selectedItem = optionsRefs.current.find(selector) ?? null;\n\n if (selectedItem) {\n observeSize(selectedItem);\n }\n\n // Observe the hovered item\n if (hoveredItem) {\n observeSize(hoveredItem);\n }\n\n // Add hover event listeners\n const handleMouseEnter = (event: Event) => {\n // Clear any pending hide timeout\n if (hideTimeoutRef.current) {\n clearTimeout(hideTimeoutRef.current);\n hideTimeoutRef.current = null;\n }\n setHoveredItem(event.currentTarget as HTMLElement);\n };\n\n const handleMouseLeave = () => {\n // Clear any existing timeout\n if (hideTimeoutRef.current) {\n clearTimeout(hideTimeoutRef.current);\n }\n\n // Keep the indicator at its current position for 150ms\n // before removing the hovered item\n hideTimeoutRef.current = setTimeout(() => {\n setHoveredItem(null);\n }, 150); // 150ms delay before hiding\n };\n\n if (isHoverable) {\n optionsRefs.current.forEach((option) => {\n option?.addEventListener('mouseenter', handleMouseEnter, {\n passive: true,\n });\n option?.addEventListener('mouseleave', handleMouseLeave, {\n passive: true,\n });\n });\n }\n\n return () => {\n // Clear any pending hide timeout\n if (hideTimeoutRef.current) {\n clearTimeout(hideTimeoutRef.current);\n }\n\n // Cleanup window event listeners\n window.removeEventListener('resize', calculatePosition);\n window.removeEventListener('DOMContentLoaded', calculatePosition);\n\n // Disconnect MutationObservers\n mutationObservers.forEach((observer) => {\n observer.disconnect();\n });\n\n // Disconnect ResizeObservers\n resizeObservers.forEach((observer) => {\n observer.disconnect();\n });\n\n // Remove hover event listeners\n optionsRefs.current.forEach((option) => {\n option?.removeEventListener('mouseenter', handleMouseEnter);\n option?.removeEventListener('mouseleave', handleMouseLeave);\n });\n };\n }, [\n optionsRefs,\n selector,\n hoveredItem,\n itemsLength,\n orientation,\n isHoverable,\n ]);\n\n return { choiceIndicatorPosition, calculatePosition, orientation };\n};\n"],"mappings":";;;;;AAoBA,MAAM,mBAAmB,WACvB,QAAQ,aAAa,eAAe,MAAM;AAQ5C,MAAa,mBACX,aACA,EACE,WAAW,iBACX,cAAc,OACd,cAAc,iBACH;CACX,UAAU;CACV,aAAa;CACb,aAAa;AACf,MACG;CACH,MAAM,CAAC,yBAAyB,8BAC9B,SAA4B,IAAI;CAElC,MAAM,CAAC,aAAa,kBAAkB,SAA6B,IAAI;CACvE,MAAM,iBAAiB,OAA8B,IAAI;CACzD,MAAM,kBAAkB,OAA0B,IAAI;CAEtD,MAAM,cAAc,YAAY,QAAQ;CAExC,MAAM,0BAA0B;EAC9B,IAAI,gBAAoC;EAExC,IAAI,aAAa;GACf,gBAAgB;GAEhB,IAAI,eAAe,SAAS;IAC1B,aAAa,eAAe,OAAO;IACnC,eAAe,UAAU;GAC3B;EACF,OACE,gBAAgB,YAAY,QAAQ,KAAK,QAAQ,KAAK;EAGxD,IAAI,CAAC,eAAe;GAElB,IAAI,gBAAgB,YAAY;IAC9B,MAAM,eACJ,gBAAgB;IAClB,MAAM,cAAkC;KACtC,KAAK,cAAc,OAAO;KAC1B,QAAQ,cAAc,UAAU;KAChC,SAAS;IACX;IAEA,IAAI,cAAc,YAAY,GAAG;KAC/B,2BAA2B,WAAW;KACtC,gBAAgB,UAAU;IAC5B;GACF,OAAO;IACL,MAAM,iBACJ,gBAAgB;IAClB,MAAM,cAAoC;KACxC,MAAM,gBAAgB,QAAQ;KAC9B,OAAO,gBAAgB,SAAS;KAChC,SAAS;IACX;IAEA,IAAI,gBAAgB,YAAY,GAAG;KACjC,2BAA2B,WAAW;KACtC,gBAAgB,UAAU;IAC5B;GACF;GACA;EACF;EAEA,IAAI,gBAAgB,YAAY;GAC9B,MAAM,MAAM,cAAc;GAC1B,MAAM,SAAS,cAAc;GAE7B,MAAM,cAAc;IAClB;IACA;IACA,SAAS;GACX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AW;EAIzB,MAAM,oBAAoB,UAAiB;GAEzC,IAAI,eAAe,SAAS;IAC1B,aAAa,eAAe,OAAO;IACnC,eAAe,UAAU;GAC3B;GACA,eAAe,MAAM,aAA4B;EACnD;EAEA,MAAM,yBAAyB;GAE7B,IAAI,eAAe,SACjB,aAAa,eAAe,OAAO;GAKrC,eAAe,UAAU,iBAAiB;IACxC,eAAe,IAAI;GACrB,GAAG,GAAG;EACR;EAEA,IAAI,aACF,YAAY,QAAQ,SAAS,WAAW;GACtC,QAAQ,iBAAiB,cAAc,kBAAkB,EACvD,SAAS,KACX,CAAC;GACD,QAAQ,iBAAiB,cAAc,kBAAkB,EACvD,SAAS,KACX,CAAC;EACH,CAAC;EAGH,aAAa;GAEX,IAAI,eAAe,SACjB,aAAa,eAAe,OAAO;GAIrC,OAAO,oBAAoB,UAAU,iBAAiB;GACtD,OAAO,oBAAoB,oBAAoB,iBAAiB;GAGhE,kBAAkB,SAAS,aAAa;IACtC,SAAS,WAAW;GACtB,CAAC;GAGD,gBAAgB,SAAS,aAAa;IACpC,SAAS,WAAW;GACtB,CAAC;GAGD,YAAY,QAAQ,SAAS,WAAW;IACtC,QAAQ,oBAAoB,cAAc,gBAAgB;IAC1D,QAAQ,oBAAoB,cAAc,gBAAgB;GAC5D,CAAC;EACH;CACF,GAAG;EACD;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CAED,OAAO;EAAE;EAAyB;EAAmB;CAAY;AACnE"}
|
|
1
|
+
{"version":3,"file":"useItemSelector.mjs","names":[],"sources":["../../../src/hooks/useItemSelector.ts"],"sourcesContent":["'use client';\n\nimport {\n type RefObject,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from 'react';\n\nexport type ItemSelectorOrientation = 'horizontal' | 'vertical';\n\ntype HorizontalStyleState = {\n left: number;\n width: number;\n opacity: number;\n};\n\ntype VerticalStyleState = {\n top: number;\n height: number;\n opacity: number;\n};\n\ntype StyleState = HorizontalStyleState | VerticalStyleState;\n\nconst selectorDefault = (option: HTMLElement) =>\n option?.getAttribute('aria-selected') === 'true';\n\n/** Attributes whose change moves the indicator to another option. */\nconst WATCHED_ATTRIBUTES = ['aria-selected', 'data-active', 'data-indicator'];\n\n/** Delay before the indicator leaves the option the pointer just left. */\nconst HOVER_RELEASE_DELAY = 150;\n\ntype Options = {\n selector?: (option: HTMLElement, index: number) => boolean;\n isHoverable?: boolean;\n orientation?: ItemSelectorOrientation;\n};\n\nexport const useItemSelector = (\n optionsRefs: RefObject<HTMLElement[]>,\n {\n selector = selectorDefault,\n isHoverable = false,\n orientation = 'horizontal',\n }: Options = {\n selector: selectorDefault,\n isHoverable: false,\n orientation: 'horizontal',\n }\n) => {\n const [choiceIndicatorPosition, setChoiceIndicatorPosition] =\n useState<StyleState | null>(null);\n\n const hoveredItemRef = useRef<HTMLElement | null>(null);\n const hideTimeoutRef = useRef<NodeJS.Timeout | null>(null);\n const lastPositionRef = useRef<StyleState | null>(null);\n const measurementFrameRef = useRef<number | null>(null);\n\n /*\n * Callers build their options object inline, so `selector` and `orientation`\n * are new values on every render. Reading them from refs keeps the observers\n * below from being torn down and rebuilt each time — a switch selector used\n * to re-subscribe one MutationObserver per option per render.\n */\n const selectorRef = useRef(selector);\n selectorRef.current = selector;\n\n const orientationRef = useRef(orientation);\n orientationRef.current = orientation;\n\n const itemsLength = optionsRefs.current.length;\n\n const calculatePosition = useCallback(() => {\n const targetElement =\n hoveredItemRef.current ??\n optionsRefs.current.find(selectorRef.current) ??\n null;\n\n if (hoveredItemRef.current && hideTimeoutRef.current) {\n // Clear any pending hide timeout when hovering over an item\n clearTimeout(hideTimeoutRef.current);\n hideTimeoutRef.current = null;\n }\n\n const isVertical = orientationRef.current === 'vertical';\n\n if (!targetElement) {\n // Keep previous position but set opacity to 0\n if (lastPositionRef.current?.opacity === 0) return;\n\n const newPosition: StyleState = isVertical\n ? {\n top:\n (lastPositionRef.current as VerticalStyleState | null)?.top ?? 0,\n height:\n (lastPositionRef.current as VerticalStyleState | null)?.height ??\n 0,\n opacity: 0,\n }\n : {\n left:\n (lastPositionRef.current as HorizontalStyleState | null)?.left ??\n 0,\n width:\n (lastPositionRef.current as HorizontalStyleState | null)?.width ??\n 0,\n opacity: 0,\n };\n\n setChoiceIndicatorPosition(newPosition);\n lastPositionRef.current = newPosition;\n return;\n }\n\n if (isVertical) {\n const top = targetElement.offsetTop;\n const height = targetElement.offsetHeight;\n const previous = lastPositionRef.current as VerticalStyleState | null;\n\n if (\n previous?.top === top &&\n previous.height === height &&\n previous.opacity === 1\n ) {\n return;\n }\n\n const newPosition: VerticalStyleState = { top, height, opacity: 1 };\n\n setChoiceIndicatorPosition(newPosition);\n lastPositionRef.current = newPosition;\n return;\n }\n\n const left = targetElement.offsetLeft;\n const width = targetElement.offsetWidth;\n const previous = lastPositionRef.current as HorizontalStyleState | null;\n\n if (\n previous?.left === left &&\n previous.width === width &&\n previous.opacity === 1\n ) {\n return;\n }\n\n const newPosition: HorizontalStyleState = { left, width, opacity: 1 };\n\n setChoiceIndicatorPosition(newPosition);\n lastPositionRef.current = newPosition;\n }, [optionsRefs]);\n\n /**\n * Defers the measurement to the next frame, and to a single one however many\n * observers fire.\n *\n * Reading `offsetLeft` straight from a mutation, resize or scroll callback\n * forces a synchronous reflow, and a documentation page mounts one selector\n * per tab group and one per code block.\n */\n const scheduleMeasurement = useCallback(() => {\n if (measurementFrameRef.current !== null) return;\n\n measurementFrameRef.current = requestAnimationFrame(() => {\n measurementFrameRef.current = null;\n calculatePosition();\n });\n }, [calculatePosition]);\n\n useEffect(() => {\n scheduleMeasurement();\n\n window.addEventListener('resize', scheduleMeasurement, { passive: true });\n window.addEventListener('DOMContentLoaded', scheduleMeasurement);\n\n const options = optionsRefs.current.filter(Boolean);\n\n // One observer of each kind covers every option: both accept repeated\n // `observe` calls, so a group of ten options costs two observers, not\n // twenty.\n const mutationObserver = new MutationObserver(scheduleMeasurement);\n const resizeObserver = new ResizeObserver(scheduleMeasurement);\n\n const handleMouseEnter = (event: Event) => {\n if (hideTimeoutRef.current) {\n clearTimeout(hideTimeoutRef.current);\n hideTimeoutRef.current = null;\n }\n\n hoveredItemRef.current = event.currentTarget as HTMLElement;\n scheduleMeasurement();\n };\n\n const handleMouseLeave = () => {\n if (hideTimeoutRef.current) clearTimeout(hideTimeoutRef.current);\n\n // Keep the indicator where it is for a moment, so moving between two\n // neighbouring options does not make it blink out and back in.\n hideTimeoutRef.current = setTimeout(() => {\n hoveredItemRef.current = null;\n scheduleMeasurement();\n }, HOVER_RELEASE_DELAY);\n };\n\n for (const option of options) {\n mutationObserver.observe(option, {\n attributes: true,\n attributeFilter: WATCHED_ATTRIBUTES,\n });\n resizeObserver.observe(option);\n\n if (isHoverable) {\n option.addEventListener('mouseenter', handleMouseEnter, {\n passive: true,\n });\n option.addEventListener('mouseleave', handleMouseLeave, {\n passive: true,\n });\n }\n }\n\n return () => {\n if (measurementFrameRef.current !== null) {\n cancelAnimationFrame(measurementFrameRef.current);\n measurementFrameRef.current = null;\n }\n\n if (hideTimeoutRef.current) {\n clearTimeout(hideTimeoutRef.current);\n hideTimeoutRef.current = null;\n }\n\n window.removeEventListener('resize', scheduleMeasurement);\n window.removeEventListener('DOMContentLoaded', scheduleMeasurement);\n\n mutationObserver.disconnect();\n resizeObserver.disconnect();\n\n if (isHoverable) {\n for (const option of options) {\n option.removeEventListener('mouseenter', handleMouseEnter);\n option.removeEventListener('mouseleave', handleMouseLeave);\n }\n }\n };\n }, [optionsRefs, itemsLength, isHoverable, orientation, scheduleMeasurement]);\n\n return { choiceIndicatorPosition, calculatePosition, orientation };\n};\n"],"mappings":";;;;;AA0BA,MAAM,mBAAmB,WACvB,QAAQ,aAAa,eAAe,MAAM;;AAG5C,MAAM,qBAAqB;CAAC;CAAiB;CAAe;AAAgB;;AAG5E,MAAM,sBAAsB;AAQ5B,MAAa,mBACX,aACA,EACE,WAAW,iBACX,cAAc,OACd,cAAc,iBACH;CACX,UAAU;CACV,aAAa;CACb,aAAa;AACf,MACG;CACH,MAAM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ChC;GAEA,IAAI,eAAe,SAAS;IAC1B,aAAa,eAAe,OAAO;IACnC,eAAe,UAAU;GAC3B;GAEA,OAAO,oBAAoB,UAAU,mBAAmB;GACxD,OAAO,oBAAoB,oBAAoB,mBAAmB;GAElE,iBAAiB,WAAW;GAC5B,eAAe,WAAW;GAE1B,IAAI,aACF,KAAK,MAAM,UAAU,SAAS;IAC5B,OAAO,oBAAoB,cAAc,gBAAgB;IACzD,OAAO,oBAAoB,cAAc,gBAAgB;GAC3D;EAEJ;CACF,GAAG;EAAC;EAAa;EAAa;EAAa;EAAa;CAAmB,CAAC;CAE5E,OAAO;EAAE;EAAyB;EAAmB;CAAY;AACnE"}
|
package/dist/esm/libs/auth.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { ssoClient } from "@better-auth/sso/client";
|
|
|
3
3
|
import { editor } from "@intlayer/config/built";
|
|
4
4
|
import { BACKEND_URL } from "@intlayer/config/defaultValues";
|
|
5
5
|
import { createAuthClient } from "better-auth/client";
|
|
6
|
-
import { magicLinkClient, twoFactorClient } from "better-auth/client/plugins";
|
|
6
|
+
import { magicLinkClient, multiSessionClient, twoFactorClient } from "better-auth/client/plugins";
|
|
7
7
|
|
|
8
8
|
//#region src/libs/auth.ts
|
|
9
9
|
const getAuthClient = (backendURL) => createAuthClient({
|
|
@@ -17,7 +17,8 @@ const getAuthClient = (backendURL) => createAuthClient({
|
|
|
17
17
|
} }),
|
|
18
18
|
passkeyClient(),
|
|
19
19
|
magicLinkClient(),
|
|
20
|
-
ssoClient()
|
|
20
|
+
ssoClient(),
|
|
21
|
+
multiSessionClient()
|
|
21
22
|
]
|
|
22
23
|
});
|
|
23
24
|
const getAuthAPI = (intlayerConfig) => {
|
|
@@ -138,6 +139,15 @@ const getAuthAPI = (intlayerConfig) => {
|
|
|
138
139
|
const deleteSSOProvider = async (args) => {
|
|
139
140
|
return client.sso.deleteProvider({ providerId: args.providerId });
|
|
140
141
|
};
|
|
142
|
+
const listDeviceSessions = async (...args) => {
|
|
143
|
+
return client.multiSession.listDeviceSessions(...args);
|
|
144
|
+
};
|
|
145
|
+
const setActiveSession = async (...args) => {
|
|
146
|
+
return client.multiSession.setActive(...args);
|
|
147
|
+
};
|
|
148
|
+
const revokeDeviceSession = async (...args) => {
|
|
149
|
+
return client.multiSession.revoke(...args);
|
|
150
|
+
};
|
|
141
151
|
return {
|
|
142
152
|
getAuthClient: () => client,
|
|
143
153
|
signInEmail,
|
|
@@ -176,7 +186,10 @@ const getAuthAPI = (intlayerConfig) => {
|
|
|
176
186
|
signInSSO,
|
|
177
187
|
registerSSO,
|
|
178
188
|
listSSOProviders,
|
|
179
|
-
deleteSSOProvider
|
|
189
|
+
deleteSSOProvider,
|
|
190
|
+
listDeviceSessions,
|
|
191
|
+
revokeDeviceSession,
|
|
192
|
+
setActiveSession
|
|
180
193
|
};
|
|
181
194
|
};
|
|
182
195
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.mjs","names":[],"sources":["../../../src/libs/auth.ts"],"sourcesContent":["import { passkeyClient } from '@better-auth/passkey/client';\nimport { ssoClient } from '@better-auth/sso/client';\nimport { editor } from '@intlayer/config/built';\nimport { BACKEND_URL } from '@intlayer/config/defaultValues';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { createAuthClient } from 'better-auth/client';\nimport { magicLinkClient, twoFactorClient } from 'better-auth/client/plugins';\n\nconst getAuthClient = (backendURL: string) =>\n createAuthClient({\n baseURL: backendURL,\n withCredentials: true, // makes fetch forward cookies\n plugins: [\n twoFactorClient({\n onTwoFactorRedirect: () => {\n // Preserve redirect_url when redirecting to 2FA\n const searchParams = new URLSearchParams(window.location.search);\n const redirectUrl = searchParams.get('redirect_url');\n const twoFaUrl = redirectUrl\n ? `/auth/2fa?redirect_url=${encodeURIComponent(redirectUrl)}`\n : '/auth/2fa';\n window.location.href = twoFaUrl;\n },\n }),\n passkeyClient(),\n magicLinkClient() as never,\n ssoClient(),\n ],\n });\n\ntype AuthClient = ReturnType<typeof getAuthClient>;\n\nexport interface AuthAPI {\n getAuthClient: () => AuthClient;\n signInEmail: AuthClient['signIn']['email'];\n signUpEmail: AuthClient['signUp']['email'];\n signOut: AuthClient['signOut'];\n signInSocial: AuthClient['signIn']['social'];\n linkSocial: AuthClient['linkSocial'];\n changePasswordSession: AuthClient['changePassword'];\n requestPasswordResetSession: AuthClient['requestPasswordReset'];\n resetPassword: AuthClient['resetPassword'];\n verifyEmailSession: AuthClient['verifyEmail'];\n getSession: AuthClient['getSession'];\n forgetPassword: AuthClient['requestPasswordReset'];\n sendVerificationEmail: AuthClient['sendVerificationEmail'];\n changeEmail: AuthClient['changeEmail'];\n deleteUser: AuthClient['deleteUser'];\n revokeSession: AuthClient['revokeSession'];\n revokeSessions: AuthClient['revokeSessions'];\n revokeOtherSessions: AuthClient['revokeOtherSessions'];\n listAccounts: AuthClient['listAccounts'];\n unlinkAccount: AuthClient['unlinkAccount'];\n refreshToken: AuthClient['refreshToken'];\n getAccessToken: AuthClient['getAccessToken'];\n accountInfo: AuthClient['accountInfo'];\n updateUser: AuthClient['updateUser'];\n listSessions: AuthClient['listSessions'];\n enableTwoFactor: AuthClient['twoFactor']['enable'];\n disableTwoFactor: AuthClient['twoFactor']['disable'];\n verifyTotp: AuthClient['twoFactor']['verifyTotp'];\n verifyBackupCode: AuthClient['twoFactor']['verifyBackupCode'];\n addPasskey: AuthClient['passkey']['addPasskey'];\n signInPasskey: AuthClient['signIn']['passkey'];\n deletePasskey: AuthClient['passkey']['deletePasskey'];\n listPasskeys: () => Promise<any>;\n signInMagicLink: (\n // Redeclare it because of type inference issues\n input: { email: string; callbackURL: string }\n ) => any;\n registerSSO: AuthClient['sso']['register'];\n listSSOProviders: () => Promise<any>;\n deleteSSOProvider: (args: { providerId: string }) => Promise<any>;\n signInSSO: AuthClient['signIn']['sso'];\n}\n\nexport const getAuthAPI = (\n intlayerConfig?: Pick<IntlayerConfig, 'editor'>\n): AuthAPI => {\n let backendURL = intlayerConfig?.editor?.backendURL ?? editor?.backendURL;\n\n if (!backendURL) {\n backendURL = BACKEND_URL;\n console.error('Backend URL is not defined in the Intlayer configuration.');\n }\n\n const client = getAuthClient(backendURL);\n\n const signInEmail: AuthClient['signIn']['email'] = async (...args) => {\n return client.signIn.email(...args);\n };\n\n const signInSocial: AuthClient['signIn']['social'] = async (...args) => {\n return client.signIn.social(...args);\n };\n\n const signUpEmail: AuthClient['signUp']['email'] = async (...args) => {\n return client.signUp.email(...args);\n };\n\n const signOut: AuthClient['signOut'] = async (...args) => {\n return client.signOut(...args);\n };\n\n const changePasswordSession: AuthClient['changePassword'] = async (\n ...args\n ) => {\n return client.changePassword(...args);\n };\n\n const requestPasswordResetSession: AuthClient['requestPasswordReset'] =\n async (...args) => {\n return client.requestPasswordReset(...args);\n };\n\n // @ts-ignore - resetPassword is not typed\n const resetPassword: AuthClient['resetPassword'] = async (...args) => {\n return client.resetPassword(...args);\n };\n\n const verifyEmailSession: AuthClient['verifyEmail'] = async (...args) => {\n return client.verifyEmail(...args);\n };\n\n const getSession: AuthClient['getSession'] = async (...args) => {\n return client.getSession(...args);\n };\n\n const forgetPassword: AuthClient['requestPasswordReset'] = async (\n ...args\n ) => {\n return client.requestPasswordReset(...args);\n };\n\n const sendVerificationEmail: AuthClient['sendVerificationEmail'] = async (\n ...args\n ) => {\n return client.sendVerificationEmail(...args);\n };\n\n const changeEmail: AuthClient['changeEmail'] = async (...args) => {\n return client.changeEmail(...args);\n };\n\n // @ts-ignore - deleteUser is not typed\n const deleteUser: AuthClient['deleteUser'] = async (...args) => {\n return client.deleteUser(...args);\n };\n\n const revokeSession: AuthClient['revokeSession'] = async (...args) => {\n return client.revokeSession(...args);\n };\n\n const revokeSessions: AuthClient['revokeSessions'] = async (...args) => {\n return client.revokeSessions(...args);\n };\n\n const revokeOtherSessions: AuthClient['revokeOtherSessions'] = async (\n ...args\n ) => {\n return client.revokeOtherSessions(...args);\n };\n\n const linkSocial: AuthClient['linkSocial'] = async (...args) => {\n return client.linkSocial(...args);\n };\n\n const listAccounts: AuthClient['listAccounts'] = async (...args) => {\n return client.listAccounts(...args);\n };\n\n const unlinkAccount: AuthClient['unlinkAccount'] = async (...args) => {\n return client.unlinkAccount(...args);\n };\n\n const refreshToken: AuthClient['refreshToken'] = async (...args) => {\n return client.refreshToken(...args);\n };\n\n const getAccessToken: AuthClient['getAccessToken'] = async (...args) => {\n return client.getAccessToken(...args);\n };\n\n const accountInfo: AuthClient['accountInfo'] = async (...args) => {\n return client.accountInfo(...args);\n };\n\n const updateUser: AuthClient['updateUser'] = async (...args) => {\n return client.updateUser(...args);\n };\n\n const listSessions: AuthClient['listSessions'] = async (...args) => {\n return client.listSessions(...args);\n };\n\n const enableTwoFactor: AuthClient['twoFactor']['enable'] = async (\n ...args\n ) => {\n return client.twoFactor.enable(...args) as ReturnType<\n AuthClient['twoFactor']['enable']\n >;\n };\n\n const disableTwoFactor: AuthClient['twoFactor']['disable'] = async (\n ...args\n ) => {\n return client.twoFactor.disable(...args) as ReturnType<\n AuthClient['twoFactor']['disable']\n >;\n };\n\n const verifyTotp: AuthClient['twoFactor']['verifyTotp'] = async (...args) => {\n return client.twoFactor.verifyTotp(...args) as ReturnType<\n AuthClient['twoFactor']['verifyTotp']\n >;\n };\n\n const verifyBackupCode: AuthClient['twoFactor']['verifyBackupCode'] = async (\n ...args\n ) => {\n return client.twoFactor.verifyBackupCode(...args) as ReturnType<\n AuthClient['twoFactor']['verifyBackupCode']\n >;\n };\n\n const addPasskey: AuthClient['passkey']['addPasskey'] = async (...args) => {\n return client.passkey.addPasskey(...args);\n };\n\n const signInPasskey: AuthClient['signIn']['passkey'] = async (...args) => {\n return client.signIn.passkey(...args);\n };\n\n const deletePasskey: AuthClient['passkey']['deletePasskey'] = async (\n ...args\n ) => {\n return client.passkey.deletePasskey(...args);\n };\n\n const listPasskeys = async () => {\n // @ts-ignore - listPasskeys may not be typed yet\n return client.$fetch('/passkey/list-user-passkeys', {\n method: 'GET',\n });\n };\n\n const signInMagicLink: any = async (...args: any[]) => {\n return (client.signIn as any).magicLink(...args);\n };\n\n const signInSSO: AuthClient['signIn']['sso'] = async (...args) => {\n return client.signIn.sso(...args);\n };\n\n const registerSSO: AuthClient['sso']['register'] = async (...args) => {\n return client.sso.register(...args);\n };\n\n const listSSOProviders = async () => {\n const response = await (client.sso as any).providers();\n return { data: response?.data?.providers ?? [] };\n };\n\n const deleteSSOProvider = async (args: { providerId: string }) => {\n return (client.sso as any).deleteProvider({ providerId: args.providerId });\n };\n\n return {\n getAuthClient: () => client,\n signInEmail,\n signUpEmail,\n signOut,\n signInSocial,\n linkSocial,\n changePasswordSession,\n requestPasswordResetSession,\n resetPassword,\n verifyEmailSession,\n getSession,\n forgetPassword,\n sendVerificationEmail,\n changeEmail,\n deleteUser,\n revokeSession,\n revokeSessions,\n revokeOtherSessions,\n listAccounts,\n unlinkAccount,\n refreshToken,\n getAccessToken,\n accountInfo,\n updateUser,\n listSessions,\n enableTwoFactor,\n disableTwoFactor,\n verifyTotp,\n verifyBackupCode,\n addPasskey,\n signInPasskey,\n deletePasskey,\n listPasskeys,\n signInMagicLink,\n signInSSO,\n registerSSO,\n listSSOProviders,\n deleteSSOProvider,\n };\n};\n"],"mappings":";;;;;;;;AAQA,MAAM,iBAAiB,eACrB,iBAAiB;CACf,SAAS;CACT,iBAAiB;CACjB,SAAS;EACP,gBAAgB,EACd,2BAA2B;GAGzB,MAAM,cAAc,IADK,gBAAgB,OAAO,SAAS,MAC1B,CAAC,CAAC,IAAI,cAAc;GACnD,MAAM,WAAW,cACb,0BAA0B,mBAAmB,WAAW,MACxD;GACJ,OAAO,SAAS,OAAO;EACzB,EACF,CAAC;EACD,cAAc;EACd,gBAAgB;EAChB,UAAU;CACZ;AACF,CAAC;AAgDH,MAAa,cACX,mBACY;CACZ,IAAI,aAAa,gBAAgB,QAAQ,cAAc,QAAQ;CAE/D,IAAI,CAAC,YAAY;EACf,aAAa;EACb,QAAQ,MAAM,2DAA2D;CAC3E;CAEA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OAAO,OAAO,QAAQ,GAAG,IAAI;CACtC;CAEA,MAAM,gBAAwD,OAC5D,GAAG,SACA;EACH,OAAO,OAAO,QAAQ,cAAc,GAAG,IAAI;CAC7C;CAEA,MAAM,eAAe,YAAY;EAE/B,OAAO,OAAO,OAAO,+BAA+B,EAClD,QAAQ,MACV,CAAC;CACH;CAEA,MAAM,kBAAuB,OAAO,GAAG,SAAgB;EACrD,OAAQ,OAAO,OAAe,UAAU,GAAG,IAAI;CACjD;CAEA,MAAM,YAAyC,OAAO,GAAG,SAAS;EAChE,OAAO,OAAO,OAAO,IAAI,GAAG,IAAI;CAClC;CAEA,MAAM,cAA6C,OAAO,GAAG,SAAS;EACpE,OAAO,OAAO,IAAI,SAAS,GAAG,IAAI;CACpC;CAEA,MAAM,mBAAmB,YAAY;EAEnC,OAAO,EAAE,OAAM,MADS,OAAO,IAAY,UAAU,EAC9B,EAAE,MAAM,aAAa,CAAC,EAAE;CACjD;CAEA,MAAM,oBAAoB,OAAO,SAAiC;EAChE,OAAQ,OAAO,IAAY,eAAe,EAAE,YAAY,KAAK,WAAW,CAAC;CAC3E;CAEA,OAAO;EACL,qBAAqB;EACrB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"auth.mjs","names":[],"sources":["../../../src/libs/auth.ts"],"sourcesContent":["import { passkeyClient } from '@better-auth/passkey/client';\nimport { ssoClient } from '@better-auth/sso/client';\nimport { editor } from '@intlayer/config/built';\nimport { BACKEND_URL } from '@intlayer/config/defaultValues';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { createAuthClient } from 'better-auth/client';\nimport {\n magicLinkClient,\n multiSessionClient,\n twoFactorClient,\n} from 'better-auth/client/plugins';\n\nconst getAuthClient = (backendURL: string) =>\n createAuthClient({\n baseURL: backendURL,\n withCredentials: true, // makes fetch forward cookies\n plugins: [\n twoFactorClient({\n onTwoFactorRedirect: () => {\n // Preserve redirect_url when redirecting to 2FA\n const searchParams = new URLSearchParams(window.location.search);\n const redirectUrl = searchParams.get('redirect_url');\n const twoFaUrl = redirectUrl\n ? `/auth/2fa?redirect_url=${encodeURIComponent(redirectUrl)}`\n : '/auth/2fa';\n window.location.href = twoFaUrl;\n },\n }),\n passkeyClient(),\n magicLinkClient() as never,\n ssoClient(),\n multiSessionClient(),\n ],\n });\n\ntype AuthClient = ReturnType<typeof getAuthClient>;\n\nexport interface AuthAPI {\n getAuthClient: () => AuthClient;\n signInEmail: AuthClient['signIn']['email'];\n signUpEmail: AuthClient['signUp']['email'];\n signOut: AuthClient['signOut'];\n signInSocial: AuthClient['signIn']['social'];\n linkSocial: AuthClient['linkSocial'];\n changePasswordSession: AuthClient['changePassword'];\n requestPasswordResetSession: AuthClient['requestPasswordReset'];\n resetPassword: AuthClient['resetPassword'];\n verifyEmailSession: AuthClient['verifyEmail'];\n getSession: AuthClient['getSession'];\n forgetPassword: AuthClient['requestPasswordReset'];\n sendVerificationEmail: AuthClient['sendVerificationEmail'];\n changeEmail: AuthClient['changeEmail'];\n deleteUser: AuthClient['deleteUser'];\n revokeSession: AuthClient['revokeSession'];\n revokeSessions: AuthClient['revokeSessions'];\n revokeOtherSessions: AuthClient['revokeOtherSessions'];\n listAccounts: AuthClient['listAccounts'];\n unlinkAccount: AuthClient['unlinkAccount'];\n refreshToken: AuthClient['refreshToken'];\n getAccessToken: AuthClient['getAccessToken'];\n accountInfo: AuthClient['accountInfo'];\n updateUser: AuthClient['updateUser'];\n listSessions: AuthClient['listSessions'];\n enableTwoFactor: AuthClient['twoFactor']['enable'];\n disableTwoFactor: AuthClient['twoFactor']['disable'];\n verifyTotp: AuthClient['twoFactor']['verifyTotp'];\n verifyBackupCode: AuthClient['twoFactor']['verifyBackupCode'];\n addPasskey: AuthClient['passkey']['addPasskey'];\n signInPasskey: AuthClient['signIn']['passkey'];\n deletePasskey: AuthClient['passkey']['deletePasskey'];\n listPasskeys: () => Promise<any>;\n signInMagicLink: (\n // Redeclare it because of type inference issues\n input: { email: string; callbackURL: string }\n ) => any;\n registerSSO: AuthClient['sso']['register'];\n listSSOProviders: () => Promise<any>;\n deleteSSOProvider: (args: { providerId: string }) => Promise<any>;\n signInSSO: AuthClient['signIn']['sso'];\n listDeviceSessions: AuthClient['multiSession']['listDeviceSessions'];\n setActiveSession: AuthClient['multiSession']['setActive'];\n revokeDeviceSession: AuthClient['multiSession']['revoke'];\n}\n\nexport const getAuthAPI = (\n intlayerConfig?: Pick<IntlayerConfig, 'editor'>\n): AuthAPI => {\n let backendURL = intlayerConfig?.editor?.backendURL ?? editor?.backendURL;\n\n if (!backendURL) {\n backendURL = BACKEND_URL;\n console.error('Backend URL is not defined in the Intlayer configuration.');\n }\n\n const client = getAuthClient(backendURL);\n\n const signInEmail: AuthClient['signIn']['email'] = async (...args) => {\n return client.signIn.email(...args);\n };\n\n const signInSocial: AuthClient['signIn']['social'] = async (...args) => {\n return client.signIn.social(...args);\n };\n\n const signUpEmail: AuthClient['signUp']['email'] = async (...args) => {\n return client.signUp.email(...args);\n };\n\n const signOut: AuthClient['signOut'] = async (...args) => {\n return client.signOut(...args);\n };\n\n const changePasswordSession: AuthClient['changePassword'] = async (\n ...args\n ) => {\n return client.changePassword(...args);\n };\n\n const requestPasswordResetSession: AuthClient['requestPasswordReset'] =\n async (...args) => {\n return client.requestPasswordReset(...args);\n };\n\n // @ts-ignore - resetPassword is not typed\n const resetPassword: AuthClient['resetPassword'] = async (...args) => {\n return client.resetPassword(...args);\n };\n\n const verifyEmailSession: AuthClient['verifyEmail'] = async (...args) => {\n return client.verifyEmail(...args);\n };\n\n const getSession: AuthClient['getSession'] = async (...args) => {\n return client.getSession(...args);\n };\n\n const forgetPassword: AuthClient['requestPasswordReset'] = async (\n ...args\n ) => {\n return client.requestPasswordReset(...args);\n };\n\n const sendVerificationEmail: AuthClient['sendVerificationEmail'] = async (\n ...args\n ) => {\n return client.sendVerificationEmail(...args);\n };\n\n const changeEmail: AuthClient['changeEmail'] = async (...args) => {\n return client.changeEmail(...args);\n };\n\n // @ts-ignore - deleteUser is not typed\n const deleteUser: AuthClient['deleteUser'] = async (...args) => {\n return client.deleteUser(...args);\n };\n\n const revokeSession: AuthClient['revokeSession'] = async (...args) => {\n return client.revokeSession(...args);\n };\n\n const revokeSessions: AuthClient['revokeSessions'] = async (...args) => {\n return client.revokeSessions(...args);\n };\n\n const revokeOtherSessions: AuthClient['revokeOtherSessions'] = async (\n ...args\n ) => {\n return client.revokeOtherSessions(...args);\n };\n\n const linkSocial: AuthClient['linkSocial'] = async (...args) => {\n return client.linkSocial(...args);\n };\n\n const listAccounts: AuthClient['listAccounts'] = async (...args) => {\n return client.listAccounts(...args);\n };\n\n const unlinkAccount: AuthClient['unlinkAccount'] = async (...args) => {\n return client.unlinkAccount(...args);\n };\n\n const refreshToken: AuthClient['refreshToken'] = async (...args) => {\n return client.refreshToken(...args);\n };\n\n const getAccessToken: AuthClient['getAccessToken'] = async (...args) => {\n return client.getAccessToken(...args);\n };\n\n const accountInfo: AuthClient['accountInfo'] = async (...args) => {\n return client.accountInfo(...args);\n };\n\n const updateUser: AuthClient['updateUser'] = async (...args) => {\n return client.updateUser(...args);\n };\n\n const listSessions: AuthClient['listSessions'] = async (...args) => {\n return client.listSessions(...args);\n };\n\n const enableTwoFactor: AuthClient['twoFactor']['enable'] = async (\n ...args\n ) => {\n return client.twoFactor.enable(...args) as ReturnType<\n AuthClient['twoFactor']['enable']\n >;\n };\n\n const disableTwoFactor: AuthClient['twoFactor']['disable'] = async (\n ...args\n ) => {\n return client.twoFactor.disable(...args) as ReturnType<\n AuthClient['twoFactor']['disable']\n >;\n };\n\n const verifyTotp: AuthClient['twoFactor']['verifyTotp'] = async (...args) => {\n return client.twoFactor.verifyTotp(...args) as ReturnType<\n AuthClient['twoFactor']['verifyTotp']\n >;\n };\n\n const verifyBackupCode: AuthClient['twoFactor']['verifyBackupCode'] = async (\n ...args\n ) => {\n return client.twoFactor.verifyBackupCode(...args) as ReturnType<\n AuthClient['twoFactor']['verifyBackupCode']\n >;\n };\n\n const addPasskey: AuthClient['passkey']['addPasskey'] = async (...args) => {\n return client.passkey.addPasskey(...args);\n };\n\n const signInPasskey: AuthClient['signIn']['passkey'] = async (...args) => {\n return client.signIn.passkey(...args);\n };\n\n const deletePasskey: AuthClient['passkey']['deletePasskey'] = async (\n ...args\n ) => {\n return client.passkey.deletePasskey(...args);\n };\n\n const listPasskeys = async () => {\n // @ts-ignore - listPasskeys may not be typed yet\n return client.$fetch('/passkey/list-user-passkeys', {\n method: 'GET',\n });\n };\n\n const signInMagicLink: any = async (...args: any[]) => {\n return (client.signIn as any).magicLink(...args);\n };\n\n const signInSSO: AuthClient['signIn']['sso'] = async (...args) => {\n return client.signIn.sso(...args);\n };\n\n const registerSSO: AuthClient['sso']['register'] = async (...args) => {\n return client.sso.register(...args);\n };\n\n const listSSOProviders = async () => {\n const response = await (client.sso as any).providers();\n return { data: response?.data?.providers ?? [] };\n };\n\n const deleteSSOProvider = async (args: { providerId: string }) => {\n return (client.sso as any).deleteProvider({ providerId: args.providerId });\n };\n\n const listDeviceSessions: AuthClient['multiSession']['listDeviceSessions'] =\n async (...args) => {\n return client.multiSession.listDeviceSessions(...args);\n };\n\n const setActiveSession: AuthClient['multiSession']['setActive'] = async (\n ...args\n ) => {\n return client.multiSession.setActive(...args);\n };\n\n const revokeDeviceSession: AuthClient['multiSession']['revoke'] = async (\n ...args\n ) => {\n return client.multiSession.revoke(...args);\n };\n\n return {\n getAuthClient: () => client,\n signInEmail,\n signUpEmail,\n signOut,\n signInSocial,\n linkSocial,\n changePasswordSession,\n requestPasswordResetSession,\n resetPassword,\n verifyEmailSession,\n getSession,\n forgetPassword,\n sendVerificationEmail,\n changeEmail,\n deleteUser,\n revokeSession,\n revokeSessions,\n revokeOtherSessions,\n listAccounts,\n unlinkAccount,\n refreshToken,\n getAccessToken,\n accountInfo,\n updateUser,\n listSessions,\n enableTwoFactor,\n disableTwoFactor,\n verifyTotp,\n verifyBackupCode,\n addPasskey,\n signInPasskey,\n deletePasskey,\n listPasskeys,\n signInMagicLink,\n signInSSO,\n registerSSO,\n listSSOProviders,\n deleteSSOProvider,\n listDeviceSessions,\n revokeDeviceSession,\n setActiveSession,\n };\n};\n"],"mappings":";;;;;;;;AAYA,MAAM,iBAAiB,eACrB,iBAAiB;CACf,SAAS;CACT,iBAAiB;CACjB,SAAS;EACP,gBAAgB,EACd,2BAA2B;GAGzB,MAAM,cAAc,IADK,gBAAgB,OAAO,SAAS,MAC1B,CAAC,CAAC,IAAI,cAAc;GACnD,MAAM,WAAW,cACb,0BAA0B,mBAAmB,WAAW,MACxD;GACJ,OAAO,SAAS,OAAO;EACzB,EACF,CAAC;EACD,cAAc;EACd,gBAAgB;EAChB,UAAU;EACV,mBAAmB;CACrB;AACF,CAAC;AAmDH,MAAa,cACX,mBACY;CACZ,IAAI,aAAa,gBAAgB,QAAQ,cAAc,QAAQ;CAE/D,IAAI,CAAC,YAAY;EACf,aAAa;EACb,QAAQ,MAAM,2DAA2D;CAC3E;CAEA,MAAM,SAAS,cAAc,UAAU;CAEvC,MAAM,cAA6C,OAAO,GAAG,SAAS;EACpE,OAAO,OAAO,OAAO,MAAM,GAAG,IAAI;CACpC;CAEA,MAAM,eAA+C,OAAO,GAAG,SAAS;EACtE,OAAO,OAAO,OAAO,OAAO,GAAG,IAAI;CACrC;CAEA,MAAM,cAA6C,OAAO,GAAG,SAAS;EACpE,OAAO,OAAO,OAAO,MAAM,GAAG,IAAI;CACpC;CAEA,MAAM,UAAiC,OAAO,GAAG,SAAS;EACxD,OAAO,OAAO,QAAQ,GAAG,IAAI;CAC/B;CAEA,MAAM,wBAAsD,OAC1D,GAAG,SACA;EACH,OAAO,OAAO,eAAe,GAAG,IAAI;CACtC;CAEA,MAAM,8BACJ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AAI;CACpC;CAEA,MAAM,mBAAmB,YAAY;EAEnC,OAAO,EAAE,OAAM,MADS,OAAO,IAAY,UAAU,EAC9B,EAAE,MAAM,aAAa,CAAC,EAAE;CACjD;CAEA,MAAM,oBAAoB,OAAO,SAAiC;EAChE,OAAQ,OAAO,IAAY,eAAe,EAAE,YAAY,KAAK,WAAW,CAAC;CAC3E;CAEA,MAAM,qBACJ,OAAO,GAAG,SAAS;EACjB,OAAO,OAAO,aAAa,mBAAmB,GAAG,IAAI;CACvD;CAEF,MAAM,mBAA4D,OAChE,GAAG,SACA;EACH,OAAO,OAAO,aAAa,UAAU,GAAG,IAAI;CAC9C;CAEA,MAAM,sBAA4D,OAChE,GAAG,SACA;EACH,OAAO,OAAO,aAAa,OAAO,GAAG,IAAI;CAC3C;CAEA,OAAO;EACL,qBAAqB;EACrB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
|
|
@@ -39,7 +39,7 @@ const buildCreativeWorkJsonLd = ({ type = "CreativeWork", name, description, con
|
|
|
39
39
|
name,
|
|
40
40
|
headline: name,
|
|
41
41
|
...ogImageUrl ? { image: normalizeJsonLdUrl(ogImageUrl) } : {},
|
|
42
|
-
text: content,
|
|
42
|
+
...content ? { text: content } : {},
|
|
43
43
|
description,
|
|
44
44
|
url: normalizeJsonLdUrl(url),
|
|
45
45
|
datePublished: datePublished ? formatDate(datePublished) : void 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildCreativeWorkJsonLd.mjs","names":[],"sources":["../../../src/structured-data/buildCreativeWorkJsonLd.ts"],"sourcesContent":["/** @module buildCreativeWorkJsonLd */\n\nimport { normalizeJsonLdUrl } from './normalizeJsonLdUrl';\n\n
|
|
1
|
+
{"version":3,"file":"buildCreativeWorkJsonLd.mjs","names":[],"sources":["../../../src/structured-data/buildCreativeWorkJsonLd.ts"],"sourcesContent":["/** @module buildCreativeWorkJsonLd */\n\nimport { normalizeJsonLdUrl } from './normalizeJsonLdUrl';\n\n/**\n * Formats a date as ISO 8601 `YYYY-MM-DD`, the shape Schema.org expects.\n *\n * Dates originate from markdown frontmatter, so a typo (`2024-24-12`) yields an\n * `Invalid Date` whose `toISOString()` throws. A structured-data field is never\n * worth failing a page render — let alone a whole static export — so an\n * unusable date is simply omitted from the JSON-LD.\n *\n * @param date - Date to format, possibly invalid.\n * @returns The `YYYY-MM-DD` representation, or `undefined` when unusable.\n */\nconst formatDate = (date?: Date): string | undefined => {\n if (!(date instanceof Date) || Number.isNaN(date.getTime())) {\n return undefined;\n }\n return date.toISOString().split('T')[0]!;\n};\n\nexport type CreativeWorkType =\n | 'CreativeWork'\n | 'TechArticle'\n | 'Article'\n | 'BlogPosting'\n | 'WebPage';\n\n/** Minimal Schema.org Person node accepted as author / creator. */\nexport type SchemaOrgPersonNode = {\n '@type': 'Person';\n '@id'?: string;\n name: string;\n url?: string;\n [key: string]: unknown;\n};\n\nexport type BuildCreativeWorkJsonLdParams = {\n type?: CreativeWorkType;\n name: string;\n description: string;\n /**\n * Full text / markdown body of the document, emitted as `text`.\n *\n * Omit it for long documents: `text` duplicates the whole page inside the\n * `<head>`, which is bytes every reader downloads and parses before the\n * article itself can paint.\n */\n content?: string;\n keywords: string;\n datePublished?: Date;\n dateModified?: Date;\n url?: string;\n /** Pre-resolved Schema.org Person node (output of `buildAuthorJsonLd`). */\n author?: SchemaOrgPersonNode;\n /** Version string from the document revision history. */\n version?: string;\n /** Schema.org Audience `audienceType` value. */\n audienceType: string;\n /** Publisher organization name (defaults to \"Intlayer\"). */\n publisherName?: string;\n /** Absolute URL of the publisher logo. */\n publisherLogoUrl?: string;\n /** Absolute URL of the OG image. */\n ogImageUrl?: string;\n};\n\n/**\n * Builds a Schema.org CreativeWork (or subtype) JSON-LD object.\n *\n * @param params - Document / article metadata.\n * @returns A JSON-LD CreativeWork object ready for serialization.\n */\nexport const buildCreativeWorkJsonLd = ({\n type = 'CreativeWork',\n name,\n description,\n content,\n keywords,\n datePublished,\n dateModified,\n url,\n author,\n version,\n audienceType,\n publisherName = 'Intlayer',\n publisherLogoUrl,\n ogImageUrl,\n}: BuildCreativeWorkJsonLdParams) => ({\n '@context': 'https://schema.org' as const,\n '@type': type,\n author,\n creator: author,\n ...(publisherLogoUrl\n ? {\n publisher: {\n '@type': 'Organization' as const,\n name: publisherName,\n logo: {\n '@type': 'ImageObject' as const,\n url: normalizeJsonLdUrl(publisherLogoUrl),\n },\n },\n }\n : {}),\n name,\n headline: name,\n ...(ogImageUrl ? { image: normalizeJsonLdUrl(ogImageUrl) } : {}),\n ...(content ? { text: content } : {}),\n description,\n url: normalizeJsonLdUrl(url),\n datePublished: datePublished ? formatDate(datePublished) : undefined,\n dateModified: dateModified ? formatDate(dateModified) : undefined,\n version,\n keywords,\n license:\n 'https://raw.githubusercontent.com/aymericzip/intlayer/refs/heads/main/LICENSE',\n audience: {\n '@type': 'Audience' as const,\n audienceType,\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAM,cAAc,SAAoC;CACtD,IAAI,EAAE,gBAAgB,SAAS,OAAO,MAAM,KAAK,QAAQ,CAAC,GACxD;CAEF,OAAO,KAAK,YAAY,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;AACvC;;;;;;;AAsDA,MAAa,2BAA2B,EACtC,OAAO,gBACP,MACA,aACA,SACA,UACA,eACA,cACA,KACA,QACA,SACA,cACA,gBAAgB,YAChB,kBACA,kBACoC;CACpC,YAAY;CACZ,SAAS;CACT;CACA,SAAS;CACT,GAAI,mBACA,EACE,WAAW;EACT,SAAS;EACT,MAAM;EACN,MAAM;GACJ,SAAS;GACT,KAAK,mBAAmB,gBAAgB;EAC1C;CACF,EACF,IACA,CAAC;CACL;CACA,UAAU;CACV,GAAI,aAAa,EAAE,OAAO,mBAAmB,UAAU,EAAE,IAAI,CAAC;CAC9D,GAAI,UAAU,EAAE,MAAM,QAAQ,IAAI,CAAC;CACnC;CACA,KAAK,mBAAmB,GAAG;CAC3B,eAAe,gBAAgB,WAAW,aAAa,IAAI;CAC3D,cAAc,eAAe,WAAW,YAAY,IAAI;CACxD;CACA;CACA,SACE;CACF,UAAU;EACR,SAAS;EACT;CACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","names":[],"sources":["../../../../src/api/hooks/auth.ts"],"mappings":";cAMa;
|
|
1
|
+
{"version":3,"file":"auth.d.ts","names":[],"sources":["../../../../src/api/hooks/auth.ts"],"mappings":";cAMa;cAqBA,uBAAe,oBAAA,OAAA;cAQf;cAaA;cAaA;cAUA;cAmBA;cAoBA;cAUA;cAUA;cAUA;cAUA;cAUA;cASA;cASA;cASA;cASA;cASA;cASA;cASA,uBAAe,oBAAA,OAAA;cAQf;cAQA;cAaA;cASA,2BAAmB,oBAAA,OAAA;cAQnB"}
|
|
@@ -7,7 +7,13 @@ type BrowserProps = {
|
|
|
7
7
|
style?: CSSProperties;
|
|
8
8
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
9
9
|
'aria-label'?: string;
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Value of the iframe `sandbox` attribute. Pass `null` to omit the attribute
|
|
12
|
+
* entirely — required for same-origin embeds, where `allow-scripts` plus
|
|
13
|
+
* `allow-same-origin` sandboxes nothing (the frame can reach its parent and
|
|
14
|
+
* strip the attribute) and browsers warn about the combination.
|
|
15
|
+
*/
|
|
16
|
+
sandbox?: string | null;
|
|
11
17
|
ref?: RefObject<HTMLIFrameElement | null>;
|
|
12
18
|
domainRestriction?: string;
|
|
13
19
|
} & HTMLAttributes<HTMLIFrameElement>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Browser.d.ts","names":[],"sources":["../../../../src/components/Browser/Browser.tsx"],"mappings":";;KAsBY;EACV;EACA;EACA;EACA,QAAQ;EACR;EACA;EACA
|
|
1
|
+
{"version":3,"file":"Browser.d.ts","names":[],"sources":["../../../../src/components/Browser/Browser.tsx"],"mappings":";;KAsBY;EACV;EACA;EACA;EACA,QAAQ;EACR;EACA;;;;;;;EAOA;EACA,MAAM,UAAU;EAChB;IACE,eAAe;cA2BN,YAAO,YAAA,MAAA,WAAA,OAAA,oBAAA,WAAA,SAAA,KAAA,sBAAA,SAWjB,iCAAY,IAAA"}
|
|
@@ -7,14 +7,20 @@ import { FC } from "react";
|
|
|
7
7
|
*/
|
|
8
8
|
type CopyButtonProps = {
|
|
9
9
|
/**
|
|
10
|
-
* The text content to copy to the clipboard
|
|
10
|
+
* The text content to copy to the clipboard, or a resolver invoked when the
|
|
11
|
+
* button is pressed.
|
|
12
|
+
*
|
|
13
|
+
* The resolver form exists for content that is not worth keeping in memory —
|
|
14
|
+
* or shipping to the browser — until someone actually asks for it.
|
|
15
|
+
*
|
|
11
16
|
* @example
|
|
12
17
|
* ```tsx
|
|
13
18
|
* <CopyButton content="Hello World!" />
|
|
19
|
+
* <CopyButton content={() => fetch(url).then((response) => response.text())} />
|
|
14
20
|
* ```
|
|
15
21
|
*/
|
|
16
|
-
content: string;
|
|
17
|
-
} & Partial<ButtonProps>;
|
|
22
|
+
content: string | (() => string | Promise<string>);
|
|
23
|
+
} & Omit<Partial<ButtonProps>, 'content'>;
|
|
18
24
|
/**
|
|
19
25
|
* CopyButton - A specialized button component for copying text to the clipboard
|
|
20
26
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../../src/components/CopyButton/index.tsx"],"mappings":";;;;;;;KAUK
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../../src/components/CopyButton/index.tsx"],"mappings":";;;;;;;KAUK;;;;;;;;;;;;;;EAcH,kCAAkC;IAGhC,KAAK,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAuEJ,YAAY,GAAG"}
|
|
@@ -3,7 +3,6 @@ import { Dictionary } from "@intlayer/types/dictionary";
|
|
|
3
3
|
//#region src/components/DictionaryFieldEditor/ContentEditor.d.ts
|
|
4
4
|
type NodeEditorProps = {
|
|
5
5
|
dictionary: Dictionary;
|
|
6
|
-
isDarkMode?: boolean;
|
|
7
6
|
};
|
|
8
7
|
declare const ContentEditor: FC<NodeEditorProps>;
|
|
9
8
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentEditor.d.ts","names":[],"sources":["../../../../src/components/DictionaryFieldEditor/ContentEditor.tsx"],"mappings":";;;KA4BK;EACH,YAAY
|
|
1
|
+
{"version":3,"file":"ContentEditor.d.ts","names":[],"sources":["../../../../src/components/DictionaryFieldEditor/ContentEditor.tsx"],"mappings":";;;KA4BK;EACH,YAAY;;cAWD,eAAe,GAAG"}
|
|
@@ -7,7 +7,6 @@ type TextEditorProps = {
|
|
|
7
7
|
dictionary: Dictionary;
|
|
8
8
|
keyPath: KeyPath[];
|
|
9
9
|
section: ContentNode;
|
|
10
|
-
isDarkMode?: boolean;
|
|
11
10
|
/**
|
|
12
11
|
* Custom renderer for string leaves. Receives the leaf content and its full
|
|
13
12
|
* key path so the renderer can write edits back to the right location.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextEditor.d.ts","names":[],"sources":["../../../../../src/components/DictionaryFieldEditor/ContentEditorView/TextEditor.tsx"],"mappings":";;;;cA6Fa;KA2ID;EACV,YAAY;EACZ,SAAS;EACT,SAAS
|
|
1
|
+
{"version":3,"file":"TextEditor.d.ts","names":[],"sources":["../../../../../src/components/DictionaryFieldEditor/ContentEditorView/TextEditor.tsx"],"mappings":";;;;cA6Fa;KA2ID;EACV,YAAY;EACZ,SAAS;EACT,SAAS;;;;;EAKT,iBAAiB,iBAAiB,SAAS,cAAc;EACzD,mBAAmB;;cA+0BR,4BAAU,qBAAA;cAuNV,qCAAmB,qBAAA"}
|
package/dist/types/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DictionaryDetailsForm.d.ts","names":[],"sources":["../../../../../src/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.tsx"],"mappings":";;;KAwCK;EACH,YAAY;EACZ;EACA,mBAAmB,YAAY
|
|
1
|
+
{"version":3,"file":"DictionaryDetailsForm.d.ts","names":[],"sources":["../../../../../src/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.tsx"],"mappings":";;;KAwCK;EACH,YAAY;EACZ;EACA,mBAAmB,YAAY;;cA2CpB,uBAAuB,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpandCollapse.d.ts","names":[],"sources":["../../../../src/components/ExpandCollapse/ExpandCollapse.tsx"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"ExpandCollapse.d.ts","names":[],"sources":["../../../../src/components/ExpandCollapse/ExpandCollapse.tsx"],"mappings":";;;;;KAiBY;;EAEV;;EAEA;;EAEA,UAAU;;EAEV;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAyDW,gBAAgB,GAAG"}
|
|
@@ -4,11 +4,10 @@ import { HTMLRenderer as HTMLRenderer$1, RenderHTMLProps } from "react-intlayer/
|
|
|
4
4
|
//#region src/components/HTMLRender/HTMLRender.d.ts
|
|
5
5
|
type HTMLRendererProps = {
|
|
6
6
|
children: string;
|
|
7
|
-
isDarkMode?: boolean;
|
|
8
7
|
locale?: LocalesValues;
|
|
9
8
|
components?: ComponentProps<typeof HTMLRenderer$1>['components'];
|
|
10
9
|
};
|
|
11
|
-
declare const getIntlayerHTMLOptions: (
|
|
10
|
+
declare const getIntlayerHTMLOptions: () => RenderHTMLProps;
|
|
12
11
|
/**
|
|
13
12
|
* HTMLRenderer Component
|
|
14
13
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HTMLRender.d.ts","names":[],"sources":["../../../../src/components/HTMLRender/HTMLRender.tsx"],"mappings":";;;;KAUK;EACH;EACA
|
|
1
|
+
{"version":3,"file":"HTMLRender.d.ts","names":[],"sources":["../../../../src/components/HTMLRender/HTMLRender.tsx"],"mappings":";;;;KAUK;EACH;EACA,SAAS;EACT,aAAa,sBAAsB;;cAGxB,8BAA8B;;;;;;;cA0B9B,cAAc,GAAG"}
|
|
@@ -13,7 +13,12 @@ type CodeCompProps = {
|
|
|
13
13
|
children: ReactNode;
|
|
14
14
|
fileName?: string;
|
|
15
15
|
language: CodeLanguage;
|
|
16
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Markup for `children`, highlighted by Shiki ahead of time. When present the
|
|
18
|
+
* block paints straight from it and the highlighter is never downloaded —
|
|
19
|
+
* except when the reader switches the block to a non-TypeScript format.
|
|
20
|
+
*/
|
|
21
|
+
highlightedHtml?: string;
|
|
17
22
|
showHeader?: boolean;
|
|
18
23
|
showLineNumbers?: boolean;
|
|
19
24
|
isRollable?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Code.d.ts","names":[],"sources":["../../../../src/components/IDE/Code.tsx"],"mappings":";;;;KAsBY;EACV;EACA,iBAAiB;;EAEjB,aAAa;EACb,2BAA2B;;KAGxB;EACH,UAAU;EACV;EACA,UAAU;
|
|
1
|
+
{"version":3,"file":"Code.d.ts","names":[],"sources":["../../../../src/components/IDE/Code.tsx"],"mappings":";;;;KAsBY;EACV;EACA,iBAAiB;;EAEjB,aAAa;EACb,2BAA2B;;KAGxB;EACH,UAAU;EACV;EACA,UAAU;;;;;;EAMV;EACA;EACA;EACA;IACE,qBACF,eAAe;cAwBJ,MAAM,GAAG"}
|
|
@@ -4,14 +4,30 @@ import { FC, HTMLAttributes, ReactNode } from "react";
|
|
|
4
4
|
declare const CodeDefault: FC<{
|
|
5
5
|
children: ReactNode;
|
|
6
6
|
}>;
|
|
7
|
+
/** Wrapper styles shared by the pre-highlighted and the runtime Shiki output. */
|
|
8
|
+
declare const shikiWrapperClassName = "[&_pre.shiki]:!bg-transparent min-w-0 max-w-full overflow-auto bg-transparent [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden [&_pre.shiki]:max-w-full [&_pre.shiki]:overflow-x-auto [&_pre::-webkit-scrollbar]:hidden [&_pre]:[-ms-overflow-style:none] [&_pre]:[scrollbar-width:none]";
|
|
9
|
+
/**
|
|
10
|
+
* Renders markup produced by Shiki ahead of time (at build/prerender).
|
|
11
|
+
*
|
|
12
|
+
* Both server and client render the exact same string, so hydration is a no-op
|
|
13
|
+
* and the Shiki engine — a ~600 KB WASM bundle plus one grammar per language —
|
|
14
|
+
* never reaches the browser.
|
|
15
|
+
*/
|
|
16
|
+
declare const CodeHighlighted: FC<{
|
|
17
|
+
html: string;
|
|
18
|
+
}>;
|
|
7
19
|
type CodeBlockProps = {
|
|
8
20
|
children: React.ReactNode;
|
|
9
21
|
lang: CodeLanguage;
|
|
10
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Markup produced by Shiki ahead of time. When present the block renders it
|
|
24
|
+
* as-is and no highlighting runs in the browser.
|
|
25
|
+
*/
|
|
26
|
+
highlightedHtml?: string;
|
|
11
27
|
isEditable?: boolean;
|
|
12
28
|
onChange?: (content: string) => void;
|
|
13
29
|
} & Omit<HTMLAttributes<HTMLDivElement>, 'onChange'>;
|
|
14
30
|
declare const CodeBlock: FC<CodeBlockProps>;
|
|
15
31
|
//#endregion
|
|
16
|
-
export { CodeBlock, CodeBlockProps, CodeDefault, type CodeLanguage };
|
|
32
|
+
export { CodeBlock, CodeBlockProps, CodeDefault, CodeHighlighted, type CodeLanguage, shikiWrapperClassName };
|
|
17
33
|
//# sourceMappingURL=CodeBlockClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeBlockClient.d.ts","names":[],"sources":["../../../../src/components/IDE/CodeBlockClient.tsx"],"mappings":";;;cAYa,aAAa;EAAK,UAAU;;
|
|
1
|
+
{"version":3,"file":"CodeBlockClient.d.ts","names":[],"sources":["../../../../src/components/IDE/CodeBlockClient.tsx"],"mappings":";;;cAYa,aAAa;EAAK,UAAU;;;cAoB5B;;;;;;;;cAUA,iBAAiB;EAAK;;KAgBvB;EACV,UAAU,MAAM;EAChB,MAAM;;;;;EAKN;EACA;EACA,YAAY;IACV,KAAK,eAAe;cAEX,WAAW,GAAG"}
|
|
@@ -9,9 +9,10 @@ type Props = {
|
|
|
9
9
|
originalLang: CodeLanguage;
|
|
10
10
|
/** Currently selected format: 'typescript' | 'esm' | 'commonjs'. */
|
|
11
11
|
targetFormat: Exclude<CodeFormat, 'json'>;
|
|
12
|
-
|
|
12
|
+
/** Markup for the TypeScript source, highlighted ahead of time. */
|
|
13
|
+
initialHtml?: string;
|
|
13
14
|
};
|
|
14
|
-
declare const CodeBlockHighlight: ({ children, originalLang, targetFormat,
|
|
15
|
+
declare const CodeBlockHighlight: ({ children, originalLang, targetFormat, initialHtml }: Props) => import("react").JSX.Element;
|
|
15
16
|
//#endregion
|
|
16
17
|
export { CodeBlockHighlight };
|
|
17
18
|
//# sourceMappingURL=CodeBlockHighlight.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeBlockHighlight.d.ts","names":[],"sources":["../../../../src/components/IDE/CodeBlockHighlight.tsx"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"CodeBlockHighlight.d.ts","names":[],"sources":["../../../../src/components/IDE/CodeBlockHighlight.tsx"],"mappings":";;;;KAiBK;;EAEH,UAAU;;EAEV,cAAc;;EAEd,cAAc,QAAQ;;EAEtB;;cAGW,uBAAkB,UAAA,cAAA,cAAA,eAK5B,0BAAK,IAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeBlockServer.d.ts","names":[],"sources":["../../../../src/components/IDE/CodeBlockServer.tsx"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"CodeBlockServer.d.ts","names":[],"sources":["../../../../src/components/IDE/CodeBlockServer.tsx"],"mappings":";;;cAkBa,gBA8BI,GAAG;KAuBR;EACV;EACA,MAAM;EACN;EACA,YAAY;IACV,KAAK,eAAe;cAEX,WAAW,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeBlockShiki.d.ts","names":[],"sources":["../../../../src/components/IDE/CodeBlockShiki.tsx"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"CodeBlockShiki.d.ts","names":[],"sources":["../../../../src/components/IDE/CodeBlockShiki.tsx"],"mappings":";;;KAuIY;EACV,UAAU;EACV,MAAM;;cAGK,gBAAgB,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IDE.d.ts","names":[],"sources":["../../../../src/components/IDE/IDE.tsx"],"mappings":";;KASY;EACV;IACE;IACA;IACA;;EAEF;
|
|
1
|
+
{"version":3,"file":"IDE.d.ts","names":[],"sources":["../../../../src/components/IDE/IDE.tsx"],"mappings":";;KASY;EACV;IACE;IACA;IACA;;EAEF;IACE,eAAe;cAEN,KAAK,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarkDownRender.d.ts","names":[],"sources":["../../../../src/components/IDE/MarkDownRender.tsx"],"mappings":";;KAKK;EACH
|
|
1
|
+
{"version":3,"file":"MarkDownRender.d.ts","names":[],"sources":["../../../../src/components/IDE/MarkDownRender.tsx"],"mappings":";;KAKK;EACH;;cAGW,kBAAkB,GAAG"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CodeLanguage } from "./shikiLanguages.js";
|
|
2
2
|
import { Code, CodeCompAttributes } from "./Code.js";
|
|
3
|
-
import { CodeBlock, CodeBlockProps, CodeDefault } from "./CodeBlockClient.js";
|
|
3
|
+
import { CodeBlock, CodeBlockProps, CodeDefault, CodeHighlighted, shikiWrapperClassName } from "./CodeBlockClient.js";
|
|
4
4
|
import { FileList, FileListProps } from "./FileList.js";
|
|
5
5
|
import { IDE, IDEProps } from "./IDE.js";
|
|
6
|
-
export { Code, CodeBlock, CodeBlockProps, CodeCompAttributes, CodeDefault, type CodeLanguage, FileList, FileListProps, IDE, IDEProps };
|
|
6
|
+
export { Code, CodeBlock, CodeBlockProps, CodeCompAttributes, CodeDefault, CodeHighlighted, type CodeLanguage, FileList, FileListProps, IDE, IDEProps, shikiWrapperClassName };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region src/components/IDE/shikiThemes.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Themes every code block is highlighted with.
|
|
4
|
+
*
|
|
5
|
+
* Shiki is always asked for both, with `defaultColor: false`, so each token
|
|
6
|
+
* carries its light and dark colour as the `--shiki-light` / `--shiki-dark`
|
|
7
|
+
* custom properties rather than a resolved `color`. The markup is therefore
|
|
8
|
+
* theme-agnostic: it can be produced once — at build time — and never has to be
|
|
9
|
+
* recomputed in the browser when the resolved theme changes.
|
|
10
|
+
*/
|
|
11
|
+
declare const SHIKI_THEMES: {
|
|
12
|
+
readonly light: 'github-light';
|
|
13
|
+
readonly dark: 'github-dark';
|
|
14
|
+
};
|
|
15
|
+
type ShikiThemes = typeof SHIKI_THEMES;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { SHIKI_THEMES, ShikiThemes };
|
|
18
|
+
//# sourceMappingURL=shikiThemes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shikiThemes.d.ts","names":[],"sources":["../../../../src/components/IDE/shikiThemes.ts"],"mappings":";;;;;;;;;;cASa;WACX;WACA;;KAGU,qBAAqB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarkDownIframe.d.ts","names":[],"sources":["../../../../src/components/MarkDownRender/MarkDownIframe.tsx"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"MarkDownIframe.d.ts","names":[],"sources":["../../../../src/components/MarkDownRender/MarkDownIframe.tsx"],"mappings":";;cAkLa,gBAAgB,GAAG"}
|
|
@@ -54,7 +54,6 @@ declare const baseMarkdownComponents: {
|
|
|
54
54
|
};
|
|
55
55
|
type MarkdownRendererProps = {
|
|
56
56
|
children: string | ParsedMarkdown;
|
|
57
|
-
isDarkMode?: boolean;
|
|
58
57
|
locale?: LocalesValues;
|
|
59
58
|
forceBlock?: boolean;
|
|
60
59
|
preserveFrontmatter?: boolean;
|
|
@@ -62,7 +61,7 @@ type MarkdownRendererProps = {
|
|
|
62
61
|
components?: ComponentProps<typeof MarkdownRenderer$1>['components'];
|
|
63
62
|
wrapper?: ComponentProps<typeof MarkdownRenderer$1>['wrapper'];
|
|
64
63
|
};
|
|
65
|
-
declare const getIntlayerMarkdownOptions: (
|
|
64
|
+
declare const getIntlayerMarkdownOptions: () => {
|
|
66
65
|
components: {
|
|
67
66
|
h1: typeof H1Renderer;
|
|
68
67
|
h2: typeof H2Renderer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarkDownRender.d.ts","names":[],"sources":["../../../../src/components/MarkDownRender/MarkDownRender.tsx"],"mappings":";;;;;;;;;;cAsBM,aAAU,OAAW,yCAAoB,IAAA;cAGzC,aAAU,OAAW,yCAAoB,IAAA;cAGzC,aAAU,OAAW,yCAAoB,IAAA;cAGzC,aAAU,OAAW,yCAAoB,IAAA;cAGzC,aAAU,OAAW,yCAAoB,IAAA;cAGzC,aAAU,OAAW,yCAAoB,IAAA;cAGzC,iBAAc,OAAW,6CAAwB,IAAA;
|
|
1
|
+
{"version":3,"file":"MarkDownRender.d.ts","names":[],"sources":["../../../../src/components/MarkDownRender/MarkDownRender.tsx"],"mappings":";;;;;;;;;;cAsBM,aAAU,OAAW,yCAAoB,IAAA;cAGzC,aAAU,OAAW,yCAAoB,IAAA;cAGzC,aAAU,OAAW,yCAAoB,IAAA;cAGzC,aAAU,OAAW,yCAAoB,IAAA;cAGzC,aAAU,OAAW,yCAAoB,IAAA;cAGzC,aAAU,OAAW,yCAAoB,IAAA;cAGzC,iBAAc,OAAW,6CAAwB,IAAA;cA0DjD,uBAAkB,cAAA,SAGrB,iDAA4B,IAAA;cAUzB,eAAU,cAAA,SAA6B,yCAAoB,IAAA;cAU3D,eAAU,cAAA,SAA6B,yCAAoB,IAAA;cAU3D,gBAAW,WAAA,KAAA,QAAA,SAKd,0CAAqB,IAAA;cA6BlB,cAAW,OAAW,0CAAqB,IAAA;cAC3C,gBAAa,OAAW,sBAAsB,gCAAW,IAAA;cAIzD,eAAY,OAAW,sBAAsB,yBAAI,IAAA;cAOjD,oBAAe,cAAA,SAGlB,oDAA+B,IAAA;cAG5B,mBAAc,cAAA,SAGjB,oDAA+B,IAAA;cAI5B,SAAM,OAAW,6CAAwB,IAAA;cAsClC;;;;;;;;;;;;;;;;;;;;;;;;;;;KAER;EACH,mBAAmB;EACnB,SAAS;EACT;EACA;EACA;EACA,aAAa,sBAAsB;EACnC,UAAU,sBAAsB;;cAGrB;EACX;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAGW,kBAAkB,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GridDistortionPattern.d.ts","names":[],"sources":["../../../../src/components/Pattern/GridDistortionPattern.tsx"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"GridDistortionPattern.d.ts","names":[],"sources":["../../../../src/components/Pattern/GridDistortionPattern.tsx"],"mappings":";;KA8OK;EACH;EACA;EACA;EACA;EACA;EACA;IACE,SAAS;cAEA,uBAAuB,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic.d.ts","names":[],"sources":["../../../../src/components/Popover/dynamic.tsx"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"dynamic.d.ts","names":[],"sources":["../../../../src/components/Popover/dynamic.tsx"],"mappings":";;cAwLa,SAAS"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Detail, DetailProps, PopoverProps, PopoverStatic, PopoverType, PopoverXAlign, PopoverYAlign } from "./static.js";
|
|
1
|
+
import { Detail, DetailProps, PopoverProps, PopoverStatic, PopoverType, PopoverXAlign, PopoverYAlign, usePopoverIds } from "./static.js";
|
|
2
2
|
import { Popover } from "./dynamic.js";
|
|
3
|
-
export { Detail, DetailProps, Popover, PopoverProps, PopoverStatic, PopoverType, PopoverXAlign, PopoverYAlign };
|
|
3
|
+
export { Detail, DetailProps, Popover, PopoverProps, PopoverStatic, PopoverType, PopoverXAlign, PopoverYAlign, usePopoverIds };
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { Container } from "../Container/index.js";
|
|
2
2
|
import { ComponentProps, DetailedHTMLProps, FC, HTMLAttributes } from "react";
|
|
3
3
|
//#region src/components/Popover/static.d.ts
|
|
4
|
+
/** Ids of a popover pair, unique to the instance that rendered it. */
|
|
5
|
+
declare const usePopoverIds: (identifier: string) => {
|
|
6
|
+
triggerId: string;
|
|
7
|
+
panelId: string;
|
|
8
|
+
};
|
|
4
9
|
/**
|
|
5
10
|
* Props for the main Popover component
|
|
6
11
|
* Extends HTMLDivElement attributes for full DOM compatibility
|
|
@@ -191,5 +196,5 @@ type DetailProps = ComponentProps<typeof Container> & {
|
|
|
191
196
|
*/
|
|
192
197
|
declare const Detail: FC<DetailProps>;
|
|
193
198
|
//#endregion
|
|
194
|
-
export { Detail, DetailProps, PopoverProps, PopoverStatic, PopoverType, PopoverXAlign, PopoverYAlign };
|
|
199
|
+
export { Detail, DetailProps, PopoverProps, PopoverStatic, PopoverType, PopoverXAlign, PopoverYAlign, usePopoverIds };
|
|
195
200
|
//# sourceMappingURL=static.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"static.d.ts","names":[],"sources":["../../../../src/components/Popover/static.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"static.d.ts","names":[],"sources":["../../../../src/components/Popover/static.tsx"],"mappings":";;;;cAwBa,gBAAa;EAItB;EACA;;;;;;KAQQ,eAAe,kBACzB,eAAe,iBACf;;EAGA;;;;;;KAOU,cAAc,GAAG;EAC3B,QAAQ,GAAG;;;;;KAMD;;;;KAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAmFC,eAAe;;;;;KA2BhB,cAAc,sBAAsB;;EAE9C;;EAEA;;EAEA;;EAEA;;EAEA,SAAS,mBAAmB;;EAE5B,SAAS,mBAAmB;;EAE5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAkEI,QAAQ,GAAG"}
|
|
@@ -13,8 +13,8 @@ type TabProps = HTMLAttributes<HTMLDivElement> & VariantProps<typeof tabContaine
|
|
|
13
13
|
fullHeight?: boolean;
|
|
14
14
|
};
|
|
15
15
|
type TabItemProps = HTMLAttributes<HTMLDivElement> & {
|
|
16
|
-
label
|
|
17
|
-
value
|
|
16
|
+
label?: string;
|
|
17
|
+
value?: string;
|
|
18
18
|
disabled?: boolean;
|
|
19
19
|
children: ReactNode;
|
|
20
20
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tab.d.ts","names":[],"sources":["../../../../src/components/Tab/Tab.tsx"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"Tab.d.ts","names":[],"sources":["../../../../src/components/Tab/Tab.tsx"],"mappings":";;;cAuCM,sBAAmB;;;6CAevB;KAEU,WAAW,eAAe,kBACpC,oBAAoB;EAClB;EACA;EACA,UAAU;EACV;EACA;;KAGQ,eAAe,eAAe;EACxC;EACA;EACA;EACA,UAAU;;;;;;cA2BN;KAAmC,aAAA,SAAA,+BAAY,IAAA;;;;;;;;;;;;;;;;;;cAwB/C,iBAAY,YAAA,OAAA,SAAA,UAAA,WAAA,iBAAA,eAAA,SASf,6BAAQ,IAAA;cAmKE,YAAG;eAAA"}
|