Utilcatalogue.
Every origam utility helper is documented with its real TypeScript signature, parameters and return value — sourced directly from the DS source code.
395 utils across 24 categories
BROWSE BY CATEGORY
All utils.
Bracket
bracketDashArray
Resolve SVG stroke-dasharray and stroke-linecap attributes from a CSS border-style value. Used by OrigamBracket to render dashed or dotted connector lines.
bracketSurfaceVars
Assemble the --origam-bracket-match---* CSS custom property map for a match surface from a prop bag. Used by OrigamBracket and OrigamBracketMatch to apply bg-color, rounded, elevation, border and borderColor.
resolveBracketBorderColor
Resolve a bracket borderColor value (intent token or raw CSS colour) into a concrete CSS colour string. Returns null for falsy inputs.
resolveBracketBorderWidth
Resolve a bracket border value (keyword, boolean, or number) into a CSS border-width string. Returns null for falsy inputs.
resolveBracketForeground
Resolve a bracket color value to its text/foreground CSS colour. Intent strings yield the subtle foreground token; raw CSS colours are returned as-is; null/falsy inputs return null.
resolveBracketRadius
Resolve a bracket rounded value (named variant, rung keyword, boolean, number, or raw CSS string) to a border-radius CSS expression. Returns null for falsy inputs.
resolveBracketShadow
Resolve a bracket elevation value (number, named rung, boolean, or raw string) to a box-shadow CSS expression using the design token shadow ladder. Returns null for falsy inputs.
resolveBracketSurface
Resolve a bracket bgColor value (intent token, "transparent", or raw CSS colour) to a background-color CSS expression. Returns null for falsy inputs.
Calendar
buildDisabledPredicate
Factory that normalises the disabledDates prop (array of Date | string, or a custom predicate) into a single (date: Date) => boolean function consumed by calendar cell builders.
buildMonthMatrix
Build a fixed 6-row × 7-column date matrix for the month containing the given date. The grid always has exactly 6 rows so the calendar height stays stable when navigating month-to-month.
diffMinutes
Returns the difference between two dates expressed in minutes (positive when b is after a). Used by the calendar component for event-height calculations in week / day timelines.
eachDayOfInterval
Inclusive day-range iterator. Returns every date at midnight (00:00 local) between from and to. Returns an empty array when to is before from.
endOfWeekFixed
Returns the last day of the week starting on a given weekday index (0 = Sunday, 1 = Monday …). Symmetric counterpart to startOfWeekFixed. Used by the calendar's week/day views.
expandRecurrence
Expands a single calendar event with an optional RRULE string into all occurrences that fall within a given date range. Supports a minimal RFC 5545 subset (FREQ=DAILY|WEEKLY|MONTHLY, INTERVAL, COUNT, UNTIL, BYDAY). Non-recurring events are returned as-is when they overlap the range.
formatTime
Format a Date object as a locale-aware time string in 12-hour or 24-hour notation, using Intl.DateTimeFormat so the locale separator and AM/PM marker are honoured.
getWeekdayNames
Returns an ordered array of localised weekday name strings for a given locale and first-day-of-week offset. The output is already rotated so the first element corresponds to firstDayOfWeek.
isAfter
Returns true if date is strictly after comparing by comparing their Unix timestamps.
isAfterDay
Returns true if date falls on a calendar day strictly after comparing, ignoring the time component. Both dates are compared at the start of their respective day.
isBefore
Returns true if date is strictly before comparing by comparing their Unix timestamps.
isEqual
Returns true when two Date objects represent the exact same point in time, compared via their Unix timestamps.
isPast
Returns true when the given Date sits in the past relative to the current moment (Date.now()). Includes earlier hours of today. Used to fade or disable past events in calendar and agenda views.
isToday
Returns true when a Date object falls on the current calendar day in local timezone. Captures the "now" reference at call time (no memoization) to keep the function pure across calls.
isWeekend
Returns true when the given Date falls on a Saturday (day 6) or Sunday (day 0). Used to paint the weekend stripe in calendar month and week views.
isoWeekNumber
Returns the ISO 8601 week number for a given Date. Week 1 is the week containing the year's first Thursday (Thursday-of-week / first-Thursday-of-year algorithm).
parseISO
Parse an ISO 8601 date string (`"YYYY-MM-DD"`) into a JavaScript `Date` using local midnight, matching the behaviour of the Origam calendar internals.
parseLocalDate
Parse a `"YYYY-MM-DD"` string into a local-time `Date` by splitting on `-` and passing individual components to `new Date()`. This avoids the UTC offset that the single-argument `new Date(string)` constructor introduces.
parseRRule
Parse a raw RFC 5545 RRULE string into a normalised `IParsedRule` object, or return `null` when the directive is malformed or uses an unsupported `FREQ` value. Supports `DAILY`, `WEEKLY`, and `MONTHLY` frequencies.
startOfWeekFixed
Return a new Date at midnight of the first day of the week containing the given date, using an explicit firstDayOfWeek integer. Unlike startOfWeek, locale is never consulted.
toDate
Coerce a Date, ISO string, or epoch number to a Date instance. Returns null for null, undefined, and unparseable values so the caller can branch without catching exceptions.
Chart
arcPath
Build an SVG path string for a pie or donut slice. Angles are in radians using the standard math convention (0 at 3 o'clock, counter-clockwise); the helper converts internally to the SVG convention.
areaPath
Build an SVG closed area path from a series of [x, y] points and a baseline Y value. Supports four smoothing modes: straight lines, Catmull-Rom, Fritsch-Carlson monotone, and stepped.
computeQuartiles
Computes the five-number Tukey summary (min, Q1, median, Q3, max) plus IQR and outlier list for a sample array. Non-finite values are filtered out before computation.
decimateAxisTicks
isRawDatum
Type guard for the OrigamBoxPlot chart that returns true when a datum carries a raw samples array (unaggregated) rather than pre-computed box-plot statistics (min, q1, median, q3, max).
linePath
Converts an array of pre-scaled [x, y] pixel coordinates into an SVG path string using straight line segments (M…L…). Returns an empty string for an empty array.
measureWidestAxisLabel
mercatorProject
Projects WGS-84 geographic coordinates (longitude / latitude) into SVG pixel space using the Web Mercator (EPSG:3857) formula. Reference canvas: 1000 × 500 px.
monotonePath
Generates a smooth SVG cubic-Bezier path through pixel coordinates using the Fritsch-Carlson monotone spline algorithm. Produces no overshoot at sharp peaks. Falls back to linePath for fewer than 3 points.
multiPolygonCentroid
Computes the geographic centroid of a multi-polygon (arithmetic mean of all [lng, lat] vertices) and returns it projected to SVG pixel space via mercatorProject.
multiPolygonToSvgPath
Converts a multi-polygon (array of [lng, lat] polygon arrays) into a single SVG path string with multiple M…Z subpaths. Each polygon is projected via mercatorProject.
pathLength
Compute the total Cartesian length of a polyline defined by an ordered array of `[x, y]` points. Used to seed `stroke-dasharray` / `stroke-dashoffset` for the chart line-drawing entrance animation.
polarToCartesian
Convert a polar coordinate (centre, radius, angle in radians) into a Cartesian `[x, y]` point. Uses the mathematical convention — zero at 3 o'clock, counter-clockwise — shifted to noon/clockwise for visual consistency with radar and pie charts.
polygonPath
Convert an array of [x, y] chart coordinates into a closed SVG path string (M…L…Z). Returns an empty string when the array is empty.
polygonToSvgPath
Project an array of geographic [lng, lat] pairs to a Mercator-projected, closed SVG path string. Returns an empty string when fewer than 3 points are provided.
smoothPath
Generate a Catmull-Rom spline SVG path string through an array of [x, y] points. Falls back to a straight polyline when fewer than 3 points are provided.
steppedPath
Generate a staircase SVG path string through an array of [x, y] points. Each step moves horizontally to the next x then vertically to the next y, producing the discrete-state "event log" look.
steppedPathLength
Compute the total Manhattan-distance length of a stepped SVG path. Each pair of points contributes |Δx| + |Δy| (not the Euclidean diagonal), matching the true rendered stroke length of a stepped-line chart.
CodeGroup
Color
APCAcontrast
Compute the APCA (Accessible Perceptual Contrast Algorithm) contrast value between a text colour and a background colour. Returns a signed float in the range [-108, 106] — positive for dark text on light background, negative for light text on dark background.
HSLtoHSV
Convert an HSL colour (hue, saturation, lightness) to HSV (hue, saturation, value). Both representations span the same visible gamut; HSV is more convenient for colour-picker math.
HSLtoRGB
Convert an HSL colour (hue, saturation, lightness) to sRGB. Implemented as HSLtoHSV followed by HSVtoRGB.
HSVtoCSS
Convert an HSV colour to a CSS rgb() or rgba() string. Delegates to HSVtoRGB then RGBtoCSS.
HSVtoHSL
Convert an HSV colour (hue, saturation, value) to HSL (hue, saturation, lightness).
HSVtoHex
Convert an HSV colour to a hexadecimal CSS colour string (e.g. "#FF0000" or "#FF0000FF" when alpha is present). Delegates to HSVtoRGB then RGBtoHex.
HSVtoRGB
Convert an HSV colour (hue, saturation, value) to sRGB. Used internally by all HSV-to-CSS and HSV-to-Hex conversions.
HexToHSV
Convert a hexadecimal colour string to HSV. Delegates to HexToRGB then RGBtoHSV. Useful when feeding a user-picked hex value into the colour-picker engine.
HexToRGB
Convert a hexadecimal colour string to an sRGB object. Accepts 3-, 4-, 6- and 8-character hex values, with or without a leading "#".
LabtoXyz
Convert a CIE L*a*b* colour to the CIE XYZ (D65) colour space. Used in the lighten/darken pipeline alongside XyztoLab.
RGBtoCSS
Serialize an sRGB object to a CSS rgb() or rgba() string. Emits rgba() only when the alpha property is defined.
RGBtoHSV
Convert an sRGB colour to HSV (hue, saturation, value). Returns a safe default {h:0, s:1, v:1, a:1} when rgba is falsy.
RGBtoHex
Convert an sRGB object to a hex colour string. Each channel is rounded to the nearest integer before encoding. The alpha component is appended only when defined.
RgbtoXyz
Convert an sRGB colour to the CIE XYZ (D65) colour space by linearising the sRGB gamma curve then applying a 3x3 matrix transform. Used internally for APCA contrast and lighten/darken operations.
TOKEN_INTENT_STATES
A frozen Set of intent / state modifier strings recognised by the origam token-name grammar. A path segment matching one of these values is emitted with the "--" modifier separator in the CSS variable name rather than treated as a BEM child ("__") or a property ("---").
XyzToRgb
Convert a CIE XYZ (D65) tristimulus value to an sRGB object by applying the sRGB forward matrix and gamma curve, then clamping and rounding to [0, 255].
XyztoLab
Convert a CIE XYZ (D65) colour to CIE L*a*b* by applying the CIELAB forward transform. Used to perform perceptually uniform lightness adjustments (lighten/darken).
ColorPicker
extractColor
Converts an internal HSVA color value to the format expected by the consumer (string → hex, RGB object, HSL object, or HSV object), preserving alpha when appropriate.
hasAlpha
Detects whether a colour value carries an alpha channel. For strings it checks that the length exceeds 7 characters (8-digit hex or rgba/hsla). For objects it looks for an "a" or "alpha" own property. Returns false for falsy values.
stripAlpha
Remove the alpha channel from a colour object when the stripAlpha flag is true. Returns the original object unchanged when the flag is false.
Commons
addWeeks
Return a new Date that is the given number of weeks after the input date. The original date is never mutated.
addWindowListener
Register an event listener on window and push its cleanup function into an array collected on unmount. Returns a standalone remove callback for manual teardown.
anchorToPoint
Convert a parsed anchor descriptor (side + align) into an absolute viewport-space point relative to the given bounding box.
animate
Safe wrapper around the Web Animations API. Falls back to a resolved-promise stub when the browser does not support Element.animate() or when an exception is thrown.
attachedRoot
Return the root node (HTMLDocument or ShadowRoot) of a DOM node if it is attached to the live document, or null if it is detached. Shadow DOM aware.
binaryClosest
Binary search a sorted array of numbers to find the index of the element closest to (but not exceeding) a target value. Used internally by virtual scroll lists.
bindProps
Imperatively apply a props record to a DOM element: event handlers (onXxx keys) are attached via addEventListener with deduplication, attribute keys are set or removed via setAttribute / removeAttribute.
bindScroll
Attach a passive scroll listener to the document and all scroll parents of an element. Automatically removes all listeners on Vue scope disposal via onScopeDispose.
blockScrollStrategy
Prevent page scrolling while an overlay is open. Adds the origam-overlay--scroll-blocked class to all scroll parents, captures their current scroll positions as CSS custom properties, and restores everything on scope disposal.
calculate
Compute the position (centerX, centerY), radius, and initial scale of a ripple effect from a pointer or keyboard event on a target element.
calculateImpulseVelocity
Estimate the fling velocity from a reversed-time array of pointer samples using a weighted impulse algorithm. Returns 0 when fewer than 2 samples are available.
camelize
checkEvent
Determines whether a MouseEvent occurred outside the bound element and its included elements, honouring ShadowRoot boundaries. Used internally by the v-click-outside directive.
checkIsActive
Evaluates the closeConditional guard of a v-click-outside directive binding. Returns true when the directive is currently active, undefined when no guard is provided.
chunk
Splits a string into an array of fixed-size substrings. Used internally to segment colour codes and similar fixed-width token sequences.
clamp
Constrains a number to stay within [min, max]. Returns min when value is below range, max when above, otherwise the value itself.
clampTarget
Clamps a scroll target value to the valid scroll range of a container element, supporting both vertical and horizontal axes. Used internally by the goTo scroll utility.
classToHex
Resolves a named colour class string (e.g. "red lighten-2") to its hex value by looking it up in a colour map. Returns an empty string when the colour is not found.
classicSelectStrategy
Returns a TStrategySelect object that implements classic tree-selection behaviour: selecting a node propagates to all its descendants and recalculates the indeterminate state of its ancestors.
closeScrollStrategy
A scroll strategy that automatically closes an overlay (sets isActive to false) whenever a scroll event is detected on the target or content element. Used by OrigamMenu and similar floating components.
collectRuleErrors
connectedLocationStrategy
Positions a floating overlay relative to its activator by computing the preferred anchor and origin, then adjusting to avoid viewport overflow. Handles both fixed and scrolled activators.
consoleError
Emits a Vue warn-level message prefixed with "Origam error:" to the developer console. Prefer this over console.error for internal error reporting so the message is tied to the Vue component tree.
consoleWarn
Emits a Vue warn-level message prefixed with "Origam:" to the developer console. Prefer this over console.warn for internal warnings so the message is linked to the Vue component tree.
convertToUnit
Normalise a CSS length value: numbers become "Npx" (or any unit), CSS strings pass through untouched, and null/empty/non-finite inputs return undefined.
createBuiltinAdapter
createHandlers
Builds the internal touch-event handler map (touchstart, touchend, touchmove) from a set of directional callbacks. Used by the v-touch directive to bridge raw touch events with high-level swipe/drag gestures.
createInstance
Instantiates a reactive date adapter from the given IDateOptions and locale instance. The adapter locale is kept in sync with the active locale via a watcher.
createProvideFunction
Returns a factory function that bootstraps a scoped locale instance for a component sub-tree using vue-i18n. Each call creates an isolated locale with overridable current locale, fallback, and messages props.
createRange
Generates an array of sequential integers of a given length, starting from an optional offset. Equivalent to Python's range() but returns a plain array.
createSsrStyleCollector
createVueI18nAdapter
Wraps a vue-i18n instance into the ILocaleInstance interface expected by Origam. Bridges vue-i18n's translation, number formatting, and locale management with the DS locale system.
cyclicMovement
Computes a sinusoidal parallax offset (x, y) from a reference position relative to a shape or the viewport. Used by the parallax system to create cyclic, depth-driven motion.
darken
Darkens an RGBA colour by reducing its CIE L* lightness in CIELAB space by amount × 10. Returns the modified RGBA without mutating the input.
date
Converts a loose date value (string, Date, or undefined) to a Date object. Accepts ISO 8601 YYYY-MM-DD strings with local-timezone parsing to avoid UTC shift. Returns null for invalid or unrecognisable values.
debounce
Wraps a function so that it is only called after the specified delay has elapsed since the last invocation. Accepts a reactive delay (MaybeRef<number>) so the interval can be updated at runtime. The returned wrapper exposes .clear() and .immediate shortcuts.
deepEqual
Recursively compares two values for structural equality. Handles primitives, Date objects, and plain objects. Returns true when both values have identical structure and content.
defaultFilter
Case-insensitive substring search. Returns the index of the query inside the stringified value, or -1 when there is no match or either argument is null.
defer
Schedules a callback after a given timeout (ms) using window.setTimeout in the browser. When called during SSR or with timeout = 0, the callback runs synchronously. Returns a cancel function.
destructComputed
Converts a computed getter that returns an object into individual reactive refs, one per key. Lets you destructure a computed without losing reactivity.
directive
Click-outside handler invoked on each document click event. Calls the bound handler when the last mousedown was outside the element and the binding passes the active check. Internal helper for v-click-outside.
elementToViewport
Converts a point in element-local space to viewport space by adding the element's bounding-box offset. Inverse of viewportToElement.
endOfDay
Returns a new Date set to the last millisecond of the given day (23:59:59.999 local time). The input date is not mutated.
endOfMonth
Returns a new Date set to the last calendar day of the month containing the given date (midnight, day 0 of next month trick). The input date is not mutated.
endOfWeek
Returns the last day of the ISO week containing the given date, respecting the locale's first-day-of-week setting. The input date is not mutated.
endOfYear
Returns a new Date set to December 31 of the year containing the given date (midnight local time). The input date is not mutated.
escapeCssIdent
eventName
Converts a Vue prop name in the "onXxx" format to the corresponding event name "xxx". Used internally to derive emit names from prop names.
filterItems
Filters a list of items against a query string using a configurable filter function. Supports per-key custom filters, key allowlists, and three filter modes: any-key (default), union, every, and intersection.
findChildrenWithProvide
Walks a Vue VNode tree and returns all ComponentInternalInstance nodes that have a specific injection key in their provides object. Used by layout components to locate child components registered via provide/inject.
flattenFragments
Recursively unwrap Vue Fragment nodes from a VNode array, returning a flat list of concrete VNodes with no Fragment wrappers.
flipAlign
Return a new parsed anchor where the align axis is mirrored (top↔bottom, left↔right, center stays) while the side is preserved. Used by the overlay positioning engine to compute collision-avoidance fallbacks.
flipCorner
Return a new parsed anchor where side and align are swapped (the anchor "rotates" 90°). Used by the overlay engine to compute diagonal collision-avoidance fallbacks.
flipSide
Return a new parsed anchor where the side axis is mirrored (top↔bottom, left↔right, center stays) while the align is preserved. First fallback tried by the overlay positioning engine when the preferred placement overflows.
focusChild
Focus the first, last, next, or previous focusable descendant inside an element. When no location is given it focuses the first child unless focus already lives inside the element.
focusRippleHide
FocusEvent handler that hides the keyboard-triggered ripple when the element loses focus. Paired with the ripple directive — only acts when a keyboard ripple is currently active.
focusableChildren
Return all focusable descendant elements inside a container. By default filters out elements with tabIndex="-1" so only tab-reachable elements are included.
formatBorderPositionStylesVar
formatBorderStylesVar
Build an array of CSS border shorthand declarations (border-width, border-color, or border-style) from a 1-, 2-, or 4-value shorthand array, using logical block/inline properties.
formatBytes
Convert a raw byte count to a human-readable string (e.g. "1.5 MB"). Uses base-1024 with SI suffixes (B, KB, MB, GB, TB, PB). Non-finite or negative values return "0 B".
formatDate
Format a Date object using a named format string (e.g. "fullDate", "shortDate", "monthAndYear") with locale-aware output via Intl.DateTimeFormat. Supports custom format functions via a formats map.
formatElevationStyle
Compute a CSS box-shadow declaration from a numeric elevation level and an optional background color. Deprecated since v0.4 — prefer the --origam-shadow-{xs|sm|md|lg|xl} design tokens emitted by useElevation.
formatMarginStylesVar
Build an array of CSS margin declarations from a 1- or 4-value shorthand array, using logical block/inline properties (margin-block-start, etc.).
formatPaddingStylesVar
Build an array of CSS padding declarations from a 1-, 2-, or 4-value shorthand array, using logical block/inline properties (padding-block, padding-inline, etc.).
formatRoundedStylesVar
Build an array of CSS border-radius declarations from a 1- or 4-value shorthand array, using logical corner properties (border-start-start-radius, etc.).
forwardRefs
Merge one or more Vue template refs into a target exposure object so their public properties are transparently forwarded. Used by compound components (e.g. Field containing Input) to expose the inner element's methods on the outer `ref`.
genDefaults
Return the default IGoToOptions object used by the useGoTo scroll-animation composable. Provides the built-in easing functions (linear, easeInOutCubic, …) and sensible defaults for duration, offset, and container.
generateLayers
Compute the cumulative layout offset layers for the Origam layout system. Each registered layout item (AppBar, NavigationDrawer, Footer…) contributes its size to the running totals for its side (top/bottom/left/right), producing a cascade of offset objects used by the layout composable.
getAxis
Return the scroll/layout axis ('x' or 'y') for a parsed anchor object. Block-flow sides (top, bottom) map to the Y axis; inline sides (left, right) map to the X axis.
getCenter
Returns the geometric centre point {x, y} of a bounding box or DOMRect. Both coordinates are zero when the element is null.
getChildren
Returns the direct animatable children of a transition root element (card, sheet, or list). Used internally by overlay transition helpers.
getClientHeight
Returns the viewport height (window.innerHeight) in a browser context, or the SSR-provided clientHeight fallback when running server-side.
getClientSize
Returns clientWidth or clientHeight of an element depending on the orientation axis. Used by SlideGroup to measure scrollable container dimensions.
getClientWidth
Returns the viewport width (window.innerWidth) in a browser context, or the SSR-provided clientWidth fallback when running server-side.
getContainer
Resolves the scroll container element from a CSS selector string, a Vue component instance, or an HTMLElement. Falls back to document.scrollingElement or document.body when the argument is omitted or resolves to null.
getContrast
Computes the WCAG 2 contrast ratio between two colors. A ratio of 4.5 meets AA for normal text; 3.0 meets AA for large text.
getCurrentInstance
Asserts that the call is made inside a Vue component setup function and returns the current internal instance. Throws a descriptive [Origam] error when called outside a component context.
getCurrentInstanceName
Returns the kebab-case name of the currently active Vue component, resolved from aliasName, name, or __name. Useful for generating stable, component-scoped CSS class prefixes inside composables.
getDataTableHeadersDefaultItem
Returns the built-in header descriptor preset for a DataTable special column key (data-table-group, data-table-expand, data-table-select). Returns undefined for regular user-defined columns.
getDate
Returns the day of the month (1–31) for a given Date object. Thin wrapper around Date.prototype.getDate() used by the Calendar component.
getDecimals
Returns the number of decimal digits in a numeric value by inspecting its string representation. Used by Slider to infer step precision.
getDescriptor
Walks the prototype chain of an object and returns the first property descriptor found for the given key. Works across the full inheritance hierarchy, not just own properties.
getDiff
Computes the difference between two dates in the requested unit (years, quarters, months, weeks, days, hours, minutes, seconds). Falls back to milliseconds when no unit is supplied.
getDimensions
Calculates the scale and translation values needed to animate an overlay element from a target position. Returns offset coordinates, scale ratios (sx, sy), and a speed multiplier for large elements.
getEventCoordinates
Extracts {clientX, clientY} from a MouseEvent or TouchEvent in a unified way. For touch events, the coordinates of the first touch point are returned.
getForeground
Returns "#fff" or "#000" depending on which foreground color produces the best APCA contrast against the given background. Prefers white when both reach the 50 Lc threshold.
getHeaderDepth
Recursively computes the maximum nesting depth of a DataTable header column tree. Used to calculate the rowspan for parent columns in multi-level header rows.
getHours
Returns the hour (0–23) for a given Date object. Thin wrapper around Date.prototype.getHours() used by the TimePicker component.
getIds
Converts an array of model values to an array of internal group item IDs, supporting both value-based lookup and index-based fallback. Used by the group selection logic (Tabs, BtnToggle, etc.).
getIntrinsicSize
Returns the bounding-box of an element with its right constraint removed and CSS transforms nullified, giving the element's natural (intrinsic) content dimensions. Used by the location/overlay positioning engine.
getItemIndex
Finds the array index of the group item whose ID matches the resolved ID of the given value. Returns -1 when no match is found.
getLifeCycleTarget
Returns the provided Vue component instance if given, otherwise falls back to the current Vue lifecycle instance obtained via getCurrentInstance().
getLocationOffset
Computes the cumulative offset of an element from the document edge by walking its offsetParent chain, or returns a raw numeric offset (negated in RTL horizontal mode).
getLuma
Returns the perceptual luminance (Y channel in CIE XYZ space) of a color. Used internally by the contrast checker to decide foreground colour on coloured surfaces.
getMinutes
Returns the minutes component (0–59) of a Date object. Thin semantic wrapper around Date.prototype.getMinutes().
getMonth
Returns the zero-based month index (0 = January, 11 = December) of a Date object. Thin semantic wrapper around Date.prototype.getMonth().
getNestedValue
Safely drills into a nested object following an array path of string/number keys and returns the value found, or a fallback when any segment is null or the key is absent.
getNextElement
Finds the next or previous focusable HTML element in a flat list relative to the currently focused element, with an optional visibility/condition filter.
getNextMonth
Returns a new Date set to the first day of the month that follows the given date, without mutating the input.
getObjectValueByPath
Resolves a dot-notation (or bracket-notation) path string against an object and returns the found value, or a fallback when null or absent.
getOffset
Computes the vector difference between two 2-D points (a − b) and returns it as a TOffset {x, y}. Used internally for drag-and-drop and overlay positioning.
getOffsetPosition
Returns the offsetLeft or offsetTop pixel value of a SlideGroup element depending on the axis direction. Returns 0 when the element is undefined.
getOffsetSize
Returns the offsetWidth or offsetHeight of an element depending on the axis. Returns 0 when the element is undefined. Used by SlideGroup to compute slide dimensions.
getOverflow
Calculates how much box a overflows box b on each side (before/after on both axes). Returns zero for sides where a is fully contained inside b.
getPlatform
Detects the current runtime environment by reading the browser user-agent and returns a typed IDisplayPlatform object with boolean flags for each platform/browser.
getPosition
Extracts a named client coordinate (e.g. clientX, pageY) from a MouseEvent or TouchEvent in a unified way, handling both touch and pointer events transparently.
getPrefixedEventHandlers
Filters event-handler attrs by a trailing suffix, strips the suffix, and wraps each handler so it receives an extra getData argument. Used internally to forward scoped event listeners through component boundaries.
getPreviousMonth
Returns a new Date set to the first day of the month that precedes the given date, without mutating the input.
getPropertyFromItem
Extracts a value from a data item using a flexible TSelectItemKey accessor — a string path, an array path, a boolean identity flag, or a custom extractor function — with a fallback for missing values.
getScrollParent
Walks the DOM ancestor chain of an element and returns the first parent that has a visible scrollbar (or any potential scroll container when includeHidden is true).
getScrollParents
Collects all scrollable ancestor elements of a given element up to an optional boundary, returning them as an array. Used by overlay scroll strategies to block or track all scroll containers at once.
getScrollPosition
Returns the current scroll position (scrollLeft or scrollTop) of a SlideGroup element, with RTL correction applied for horizontal axes.
getScrollSize
Returns the scrollWidth or scrollHeight of an element depending on the axis. Returns 0 when the element is undefined. Used by SlideGroup to determine total scrollable content size.
getSsrStyles
getTarget
Resolves a CSS selector string or a Vue component instance / HTMLElement reference to the underlying HTMLElement. Returns null when no match is found in the document.
getTargetActivator
Resolves an activator selector to the concrete HTMLElement that should act as the trigger for an overlay (Menu, Tooltip, …). Accepts the special value "parent" to walk up the DOM and skip data-no-activator nodes.
getTargetBox
Returns a bounding-box descriptor for an activator. For an HTMLElement it delegates to getBoundingClientRect(); for an [x, y] coordinate pair it returns a zero-size IBox centred on that point.
getUid
Returns a stable numeric UID for the calling Vue component instance. The same instance always receives the same integer; different instances receive different integers. Useful for generating unique DOM id attributes (aria-controls, aria-labelledby, …).
getValues
Extracts the value (or index fallback) of each IGroupItem whose id appears in the provided ids array. Used internally by group-selection composables to translate selection identifiers back to model values.
getWeek
Returns the ISO-like week number (1–53) of a date, computed via the configured DateAdapter. The algorithm aligns with the ISO 8601 definition: weeks start on Monday and week 1 contains the first Thursday of the year.
getWeekArray
Builds a 2-D array of Date objects representing the calendar grid for the month containing the given date. Each inner array is one week (7 days). Padding days from adjacent months fill the first and last partial weeks.
getWeekdays
Returns an array of 7 narrow weekday labels (single character or narrow abbreviation) for the given locale, rotated so the first element corresponds to the locale-specific (or explicit) first day of the week. Used to render calendar column headers.
getYear
Returns the full four-digit year of a native Date object. A thin, named wrapper around Date.prototype.getFullYear() that keeps date utility code readable.
gradientFromObject
Converts a structured IGradient descriptor into a ready-to-use CSS gradient function string (linear-gradient, radial-gradient, or conic-gradient). Intent tokens (e.g. "primary") are resolved to the matching CSS custom property. Pure — no side effects.
handleGesture
Processes a completed touch gesture described by a TTouchWrapper and fires the appropriate directional callback (left, right, up, down) when the swipe distance and ratio meet the threshold. Mutates the wrapper offsetX/offsetY fields in place.
handleShadow
Invokes a callback on the document root and additionally on the element's Shadow Root when the element is inside a Shadow DOM. Used by click-outside and similar directives to register / unregister listeners across the shadow boundary.
has
Type-safe own-property check. Returns true (and narrows the type) when every key in the provided array is an own property of the object. Relies on Object.prototype.hasOwnProperty to avoid false positives from prototype properties.
hasEvent
Checks whether a Vue component props object contains a listener for a given event name, covering all Vue 3 listener modifier variants: plain, Once, Capture, OnceCapture, and CaptureOnce.
hasScrollbar
Returns true when an element has a visible or auto vertical scrollbar. Checks the computed overflowY style and compares scrollHeight to clientHeight. Returns false for non-element nodes and null/undefined inputs.
hoverHide
Event handler that hides the hover visual effect on the current target element. Delegates to the internal HOVER.hide() strategy and fires the optional mouseleave callback registered on the element's _hover descriptor.
hoverRemoveListeners
Removes all hover event listeners (mouseenter, mouseleave, touchstart, touchend, touchcancel) from an IHoverHtmlElement. Should be called in the directive's beforeUnmount hook to prevent memory leaks.
hoverShow
Event handler that activates the hover visual effect on the current target element. Guards against duplicate touch/mouse events on Android/iOS. Uses the ORIGAM_HOVER_STOP_KEY sentinel to prevent bubble propagation to parent hover elements.
hoverStop
Marks a hover event with the internal stop token so that ancestor hover handlers skip processing — the equivalent of stopPropagation for the Origam hover system.
humanReadableFileSize
Formats a raw byte count into a human-readable string using either SI (base-1000: k, M, G) or IEC (base-1024: Ki, Mi, Gi) prefixes.
inViewport
Returns true if a bounding box (IBox or DOMRect) is at least partially visible in the current viewport.
independentSelectStrategy
Returns a TStrategySelect object implementing independent multi-selection: each item is toggled independently without affecting siblings. An optional mandatory flag prevents deselecting the last selected item.
independentSingleSelectStrategy
Returns a TStrategySelect object implementing single-item selection: at most one item can be selected at a time. Built on top of independentSelectStrategy by slicing the input to one element.
int
Thin wrapper around parseInt with a default radix of 10. Accepts both string and number inputs.
intentBgExpr
Builds the CSS color-mix() expression for the background of an intent token at a given interaction role (default, hover, active, disabled). Falls back gracefully when the token is absent by mixing the base bg with black.
intentFgExpr
Builds the CSS var() expression for the foreground (text) color of an intent token at a given interaction role. The foreground color stays constant across hover/active — only disabled gets a distinct token.
intentTokenBase
Maps a TIntent value to the CSS token namespace segment used in all intent-related var() expressions (e.g. "primary" → "action--primary", "danger" → "feedback--danger").
isCompleteCssColor
isComposingIgnoreKey
Returns true when a keyboard event is fired during IME composition (isComposing) AND the key is one of the keys that should be swallowed during composition (Enter, etc.). Used by text inputs to avoid premature confirmation while the user is still typing CJK characters.
isCssColor
Type guard that returns true when the input string is a valid CSS color value: a hex code, a functional notation (rgb, hsl, hwb, lab, lch, oklab, oklch, color), a CSS variable (var(--…)), or one of the 148 named CSS colors.
isCustomBorderRadius
Returns true when a border-radius value is a custom CSS length (px, %, rem, em, vh, etc.) rather than a semantic Origam token name (sm, md, lg, …). Used by useRounded to decide whether to emit a utility class or an inline style.
isCustomBoxShadow
isEmpty
Returns true when a value is null, undefined, or a blank string (only whitespace). Typed as accepting any, so it works as a lightweight nil + blank guard across all value types.
isFixedPosition
Walks up the DOM ancestry of an element and returns true if any ancestor (including the element itself) has position: fixed in its computed style. Used by overlay and location strategies to decide whether teleport targets need special handling.
isGradient
Returns true when the value is a CSS gradient string (linear-gradient, radial-gradient, …), a preset gradient name, or a gradient object descriptor. Excludes intents, hex colors, and transparent.
isHoverEnabled
Type guard that returns true when hover interactions should be active: when the value is undefined (default-on) or any truthy value. Falsy values (false, 0, "") disable hover.
isIntent
Type guard that narrows a TColor | TIntent value to TIntent. Returns true when the value is a known semantic intent token (primary, success, danger, …), false for raw CSS colors or null/undefined.
isKeyboardEvent
Type guard that narrows a TRippleEvent to KeyboardEvent by checking constructor.name. Used internally by the ripple system to apply a square ripple on keyboard activation.
isModePinned
isObject
Type guard that returns true when the value is a plain (non-null, non-array) object. Excludes null and arrays which typeof incorrectly reports as "object".
isOn
Returns true when a prop key is a Vue event listener name — i.e. starts with "on" followed by an uppercase letter. Used to separate event handlers from regular props when forwarding attrs.
isParsableColor
Returns true when a string is a parsable CSS color value (hex, rgb, hsl, named…) but is NOT a CSS custom property reference (var(--…)). Combines the CSS color check with a var() exclusion.
isPotentiallyScrollable
Returns true when an element has overflow-y set to "scroll" or "auto" via computed styles, meaning it is a potential scroll container. Used by scroll strategy utilities to locate the relevant ancestor.
isRippleEnabled
Type guard that returns true when the ripple effect should be active: when the value is undefined (default-on) or any truthy value. Mirrors isHoverEnabled for the ripple directive.
isSameDay
Returns true when two Date objects fall on the same calendar day (same date, month, and year in local timezone). Used in date pickers and calendar views to highlight selected or today cells.
isSameMonth
Returns true when two Date objects fall in the same calendar month and year. Used in date pickers to determine which cells belong to the current month view.
isSameYear
Returns true when two Date objects fall in the same calendar year. Used in year pickers and date range validation.
isTouchEvent
Type guard that narrows a TRippleEvent to TouchEvent by checking constructor.name. Used internally by the ripple system to position the ripple at the touch contact point.
isUtilityIntent
Type guard that narrows to the subset of TIntent values for which the design system ships a global utility class (.origam--bg-<intent> / .origam--color-<intent>). The "ghost" intent is intentionally excluded.
isValid
Returns true when the given value can be coerced into a valid JavaScript Date (not NaN). Accepts any input type.
isWithinRange
Returns true when a date is strictly after range[0] and strictly before range[1]. Both bounds are exclusive.
keyboardRippleHide
Clears the internal keyboard-ripple flag and immediately hides the ripple effect in response to a keyboard event. Counterpart to keyboardRippleShow.
keyboardRippleShow
Triggers the ripple effect on Enter or Space keydown, setting the internal keyboard-ripple flag. No-ops for any other key.
keys
Type-safe wrapper around Object.keys(). Returns the keys of a plain object typed as (keyof O)[] instead of string[], preserving the original key union.
kineticEnergyToVelocity
Converts a kinetic-energy scalar (work) into a signed velocity using sqrt(2) scaling. Negative work produces negative velocity. Used internally by inertia-scroll and drag composables.
knownBrand
leafSelectStrategy
Factory that returns a TStrategySelect which only allows leaf nodes (nodes without children) to be selected. Branch nodes are ignored during selection.
leafSingleSelectStrategy
Factory that returns a TStrategySelect allowing only a single leaf node to be selected at a time. Selecting a new leaf deselects the previously selected one.
lighten
Lightens an RGBA color by the given amount using CIE-Lab L* adjustment (via XYZ intermediate). Each unit of amount raises L* by 10.
matchesSelector
Safely tests whether a DOM element matches a CSS selector. Returns null when the browser does not support the CSS.supports selector() query, and null on error.
mergeDeep
Recursively merge two plain objects into a new object. Nested objects are merged deeply; arrays are combined via an optional resolver, otherwise the target wins.
noop
A no-operation function that accepts no arguments and returns nothing. Used as a safe default callback placeholder where a function reference is required.
normalize
Re-maps a number from one numeric range to another. First normalises to [0, 1] relative to the current scale, then projects onto the new scale.
normalizeKey
Normalises a keyboard key string to its canonical lowercase form using the internal alias map. Aliases such as "esc", "escape", "up", "arrowup" are all resolved to a single canonical name.
nullifyTransforms
Returns the bounding rect of an element after undoing its CSS transform (matrix / matrix3d). Used to get the true layout position regardless of applied transforms.
nuxtIconsOptions
nuxtLocaleOptions
omit
Returns a shallow clone of an object with the specified keys removed. The original object is not mutated. TypeScript narrows the return type to Omit<T, U>.
omitUndefined
only
Extract a strict subset of an object's keys into a new object. Unlike pick, every listed key is copied unconditionally — the result contains all listed keys, even when they are undefined on the source.
oops
Unconditionally throws an Error. Typed as returning `never`, making it usable as an exhaustiveness guard in switch/if chains where TypeScript must know all branches throw.
padEnd
Right-pad a string to a target length by appending a repeat of the padding character. If the string is already at or beyond the target length it is returned unchanged.
padStart
Left-pad a string to a target length by prepending a repeat of the padding character. If the string is already at or beyond the target length it is returned unchanged.
parseAnchor
Decompose a `TAnchor` string (e.g. `"top left"`, `"bottom"`, `"center"`) into a `{side, align}` pair used internally by overlay positioning utilities.
parseBorderPositionValue
parseColor
Normalise any supported color representation — integer, CSS string (hex, rgb, rgba, hsl, hsla, hsv, hsva), or an RGBA/HSLA/HSVA object — into a unified `TRGBA` object.
parseDisplayOptions
Merge caller-supplied display options with `DEFAULT_DISPLAY_OPTIONS` via a deep merge, returning a fully resolved `IInternalDisplayOptions` object ready to be consumed by the display composable.
parseGradient
Resolve human-readable Vuetify/Origam color names embedded in a CSS gradient string (e.g. `"to right, primary, secondary"`) into real hex values, and expand short `rgba(#rrggbb, …)` syntax into valid CSS.
parseHex
Normalise any hex color string — with or without leading `#`, short-form (3/4 digits) or long-form (6/8 digits) — into a canonical 6-character `THex` string, replacing invalid characters with `F`.
pick
Extract a subset of an object's own enumerable keys into a new object. Only keys that actually exist on `obj` are included — missing keys are silently skipped (contrast with `only`, which copies all listed keys unconditionally).
pickWithRest
Split an object's keys into two buckets: `yes` (keys matching any of the paths, minus any explicitly excluded ones) and `no` (everything else). Paths may be plain strings or `RegExp` patterns.
pixelCeil
Ceil a sub-pixel value to the nearest physical pixel boundary using `devicePixelRatio`. Prevents layout rounding errors in high-DPI positioning calculations.
pixelRound
Round a sub-pixel value to the nearest physical pixel boundary using `devicePixelRatio`. Prevents blurry rendering on high-DPI screens when positioning overlays and tooltips.
prefersReducedMotion
rawBgExprWithState
Apply a hover or active darkening effect to a raw CSS colour value by wrapping it in a color-mix() expression. Passes through unchanged for the default and disabled roles.
rawSupports
refElement
Extract the underlying HTMLElement from a Vue component instance or a raw HTMLElement ref. Handles multi-root components by following the first element sibling of a text node.
registerSsrStyleCollector
renderSsrStyles
repositionScrollStrategy
Scroll strategy that repositions a floating overlay (menu, tooltip, popover) to track its anchor when the page scrolls. Automatically throttles updates via requestIdleCallback when repositioning is slow.
requestNewFrame
Schedule a callback to run in its own animation frame, isolated from other frame tasks. Heavy work is queued so each callback gets a fresh frame, preventing jank when multiple tasks pile up.
resetSupportsCache
resolveBorderSideColor
resolveGradient
Normalise a gradient value (preset key, CSS gradient string, or IGradient object) into a CSS gradient string for use in background-image or text-clip. Returns an empty string for non-gradient inputs.
resolveRoundedCornerValue
resolveSpacingValue
resolveUnref
Unwrap a Vue Ref or a getter function to its current value. Functions are called; Refs are unwrapped via Vue unref. Useful for composables that accept either form.
rippleCancelShow
Cancel a pending ripple show on a touch/mouse move event. Clears the show-timer commit and the pending timeout so a ripple that has not yet appeared is silently discarded.
rippleHide
Trigger the hide animation for an active ripple on a mouse/touch end or leave event. Handles the special case where a touchend arrives before the show-timer fires, committing and then queuing the hide.
rippleRemoveListeners
Remove all event listeners previously attached by the ripple directive from an element. Called on directive unmount or when the ripple is programmatically disabled.
rippleShow
Trigger the ripple animation on an element in response to a pointer or keyboard event. Handles touch vs. mouse distinctions and respects the stop-propagation flag.
rippleStop
Set the internal stop-propagation flag on a ripple event so that nested elements do not also spawn a ripple for the same interaction.
rippleTransform
Apply a CSS transform string to a ripple-enabled element, setting both the standard and WebKit-prefixed properties simultaneously.
roundTo
Round a number to a given number of decimal places using the standard half-up rule.
scrollTo
Scroll to.
setDate
Return a new Date with the day-of-month replaced by the given value. The original date is never mutated.
setHours
Return a new Date with the hours field replaced by the given count. The original date is never mutated.
setMinutes
Return a new Date with the minutes field replaced by the given count. The original date is never mutated.
setMonth
Return a new Date with the month replaced by the given zero-based index (0 = January). The original date is never mutated.
setYear
Return a new Date with the full year replaced by the given value. The original date is never mutated.
splitKeyCombination
Parse a single hotkey combination string (e.g. "ctrl+k") into an array of individual key names. Validates structure and warns on invalid input.
splitKeySequence
Parse a hotkey sequence string (e.g. "ctrl+k-p") into an array of combination strings that must be pressed in order. Validates structure and warns on invalid sequences.
startOfDay
Return a new Date set to midnight (00:00:00.000) of the same calendar day. The original date is not mutated.
startOfMonth
Return a new Date set to the first day of the same month (day 1, time 00:00:00). The original date is not mutated.
startOfWeek
Return a new Date rewound to the first day of the week containing the given date. The first day of week is derived from the locale (or from an explicit override).
startOfYear
Return a new Date set to January 1st of the same year at midnight. The original date is not mutated.
staticLocationStrategy
A no-op location strategy placeholder used when an overlay component should not reposition itself. The function currently does nothing and is reserved for future implementation.
templateRef
Create a dual-purpose template ref that can be passed as a Vue callback ref and also read like a normal ShallowRef. Exposes both `.value` (the raw ComponentPublicInstance or HTMLElement) and `.el` (the resolved HTMLElement).
themeToUnpinnedCss
toHex
Convert a single 0–255 integer channel value to a zero-padded, uppercase 2-digit hexadecimal string. Used internally by RGBtoHex and HSVtoHex.
toISO
Format a Date (adapter-aware) to a zero-padded `YYYY-MM-DD` ISO date string. Works with any IDateAdapter so it is locale-independent and consistent across calendar systems.
toKebabCase
Convert any string (camelCase, PascalCase, etc.) to kebab-case by replacing non-alpha characters with hyphens and inserting a hyphen before each uppercase letter. Results are cached for performance.
tokenForegroundForIntent
Resolve the foreground-only CSS token for an intent — the "coloured text on a light surface" rung (fgSubtle). Distinct from tokenStylesForIntent which returns the WCAG-contrasted text placed ON a coloured surface.
tokenStylesForIntent
Build a CSS-vars override map (background-color + color) for a given intent and interaction role. Returns the correct token expressions for default, hover, active, and disabled states.
touchend
Handle the `touchend` phase of a gesture: record the ending X/Y coordinates, call the optional `end` callback, then delegate to `handleGesture` to fire the directional callbacks (left, right, up, down).
touchmove
Handle the `touchmove` phase of a gesture: record the current pointer X/Y coordinates and call the optional `move` callback on the wrapper.
touchstart
Handle the `touchstart` phase of a gesture: record the starting X/Y coordinates from the first changed touch point and call the optional `start` callback on the wrapper.
tryOnMounted
Call a function when the component mounts, or immediately when called outside a Vue component lifecycle. Falls back to nextTick when sync is false and no lifecycle target is found.
tryOnScopeDispose
Safely register a cleanup callback with onScopeDispose(). When called outside an active effect scope the function is ignored and returns false, preventing the "getCurrentScope is undefined" error.
unbindProps
Remove event listeners and attributes previously applied to a DOM element via bindProps(). Mirrors the bind step for clean teardown in custom directives.
unmountIntersect
Tear down the IntersectionObserver attached by the v-intersect directive on an element for the current component instance. Called in the directive's unmounted hook.
unrefElement
Unwrap a Vue template ref or getter to the underlying DOM element. Handles both component refs (reads .$el) and plain element refs.
updateHover
Sync the v-hover directive's internal state on an element when its binding value or modifiers change. Adds or removes the hover class and mouse/touch listeners accordingly.
updateRipple
Sync the v-ripple directive's internal state when its binding changes. Hides an active ripple when disabled and attaches or replaces the event listeners that trigger ripple animations.
useProvided
Create a two-way-bound ref that falls back to an injected provided value when the component prop is null. The ref stays in sync with the provided value unless the consumer explicitly overrides it via the prop.
viewportToElement
Convert a point expressed in viewport (page) coordinates to the local coordinate space of an element by subtracting the element's bounding-box offset.
warnDeprecatedEmit
warnDeprecatedProp
warnIntersectTupleBinding
warnLegacyColor
Emit a console.warn (once per unique kind+value pair) when a raw CSS color is passed to a color prop that expects a TIntent. Deprecated raw-color support will be removed in v3.0.0.
warnMissingAccessibleName
warnMissingLandmarkName
warnMissingNativeControlName
warnUnsupportedProp
wrapInArray
Normalise a value into an array: null/undefined becomes [], an existing array passes through untouched, and any other value is wrapped in a single-element array.
DataTable
convertToInternalHeaders
Transforms an array of user-supplied IDataTableHeader definitions into normalised IInternalDataTableHeader objects, filling in default key/value fields, sortable flags, and recursively processing nested column groups.
extractKeys
Recursively collects all header key values from a nested DataTable header tree into a Set. Traverses children arrays automatically.
extractLeaves
Recursively collects all leaf (childless) headers from a nested DataTable header tree into a flat array. Used to derive the rendered column list from a grouped header definition.
flattenItems
Flatten a DataTable item tree (rows + groups) according to the current open-group set, returning only the rows that should be visible at the current expansion state.
getSkeletonCellShape
groupItems
Recursively groups an array of data table rows by one or more property keys. Each level produces an array of IDataTableGroup objects that carry depth, id, key, value, and the nested items. Used internally by OrigamDataTable grouping.
groupItemsByProperty
Groups an array of IDataTableGroupableItem rows by a single property path, returning a Map whose keys are the distinct property values and whose values are sub-arrays of matching rows. Building block used by groupItems for each groupBy level.
isDataTableHeaderColumnSlot
isDataTableItemColumnSlot
parseFixedColumns
Walk a flat-or-nested `IInternalDataTableHeader` tree and apply sticky-column metadata in-place: mark the last fixed leaf as `lastFixed`, propagate `fixed` from parents to children, and emit a console error when multiple fixed columns lack a static width.
parseHeaderItems
Flatten a tree of `IInternalDataTableHeader` nodes into a 2-D row matrix, computing `rowspan` and `colspan` values for each cell so they render correctly in a multi-level `<thead>`.
pickDataTableHeaderColumnSlotNames
pickDataTableItemColumnSlotNames
pickDataTableRowsSlotNames
priorityQueue
Create a min-heap priority queue for generic items. Elements are inserted in priority order (lower number = higher priority) and the queue exposes enqueue, size, count, and dequeue operations.
sortItems
Sort an array of internal data-table items by one or more sort keys and directions, with optional custom compare functions per key.
transformDataTableItem
Convert one raw data object to an IDataTableItem with a normalised `value`, `key`, `selectable` flag, pre-resolved per-column values, and the original `raw` reference. Used internally by transformDataTableItems.
transformDataTableItems
Map an array of raw data objects to normalised IDataTableItem rows by calling transformDataTableItem for each entry. Returns an empty array when items is undefined.
Date
addDays
Return a new Date shifted by the given number of days. The original date is never mutated.
addHours
Return a new Date shifted by the given number of hours. The original date is never mutated.
addMinutes
Return a new Date shifted by the given number of minutes. The original date is never mutated.
addMonths
Return a new Date shifted by the given number of months. To avoid day-overflow issues (e.g. Jan 31 + 1 month), the day-of-month is reset to 1 before advancing the month. The original date is never mutated.
List
transformListItem
Convert one raw item (string or object) to a normalised IInternalListItem with resolved title, value, optional children array, itemProps, and the original raw reference.
transformListItems
Map an array of raw items (strings or objects) to normalised IInternalListItemChildren by calling transformListItem for each entry. The main entry-point used by OrigamList and OrigamSelect.
Mask
applyMask
Apply a character-based mask pattern to a raw string value. Returns both the masked display string and the unmasked raw string, plus a flag indicating whether all consumer slots are filled.
isFrDateValid
Validates an 8-digit unmasked string representing a French calendar date (DDMMYYYY) against real Gregorian rules including leap years.
isIbanValid
Validates an IBAN string using the ISO 13616 mod-97 algorithm. Strips whitespace, rearranges the character groups, converts letters to numbers, and verifies the remainder equals 1.
isIsoDateValid
Validates an 8-digit unmasked string representing an ISO calendar date (YYYYMMDD) against real Gregorian rules including leap years.
isLuhnValid
Validates a numeric string using the Luhn checksum algorithm (ISO/IEC 7812). Commonly used to verify credit card numbers, IMEI codes, and SIRET-like sequences.
isUsDateValid
Validates an 8-digit unmasked string representing a US calendar date (MMDDYYYY) against real Gregorian rules including leap years.
parsePattern
Compile a mask pattern string into an array of `IMaskToken` objects. `#` matches a digit, `A` matches a letter, `*` matches any character, and all other characters become literal separators. Results are cached per pattern.
resolveMaskConfig
Normalise the polymorphic mask prop (built-in key string, raw pattern string, or IMaskOptions object) into a fully resolved IResolvedMaskConfig object. Returns null for empty/absent values.
unmaskValue
Strip mask characters from a formatted string and return only the raw user input. Delegates to applyMask() and extracts its unmasked output.
validatePattern
Run a named or custom validator against an unmasked string. Named validators (e.g. "numeric", "alpha") are looked up in the built-in VALIDATORS registry; unknown names throw to catch typos early.
QrCode
resolveQrColor
Resolve a QR code colour value (intent token or raw colour) to a concrete CSS colour string for a foreground or background role. Falls back to a provided default for empty/null inputs.
resolveQrCornerRadius
Convert a DS-shaped rounded value (named rung, number, boolean, or string) into a per-module corner radius in the [0, 0.5] range expected by the QR encoder. CSS dimension strings fall back to 0.
Slide
calculateCenteredTarget
Compute the scroll offset that places a selected slide item at the visual center of its container. Used by OrigamSlideGroup in centered-scroll mode.
calculateUpdatedTarget
Compute the minimum scroll offset needed to bring a selected slide item fully into view within its container, with a 40% item-size buffer on each side. Returns the current scroll position unchanged if the item is already visible.
Textarea
htmlToMarkdown
Converts a pre-sanitised HTML string (as produced by OrigamTextareaField in rich mode) to a Markdown string. Only the subset of tags emitted by the rich toolbar is translated; everything else is unwrapped and its text content kept.
sanitizeHtml
Walk a DOMParser-parsed tree and remove disallowed tags, attributes, and event handlers. Returns the cleaned HTML string. SSR-safe: returns the raw input when DOMParser is unavailable.
Theme
applyTheme
Inject (or replace) a single theme's CSS variable block into <head> at runtime. SSR-safe: returns null when document is unavailable or the theme is empty.
applyThemes
Install a list of themes at once by calling applyTheme for each entry. Returns the ids that were actually written; SSR-skipped or empty themes are omitted from the result.
installedThemesFromList
Derives the TInstalledThemes summary from the raw IOrigamTheme[] array passed to createOrigam(). Groups themes by name, collects available modes (light/dark), and extracts UI metadata (label, description, swatch). Pure — safe to call server-side.
isBemChildKey
Returns true when a token path segment is a BEM child key — a single word containing only letters, with no hyphens or digits. Used by the token-name resolver to emit __child vs ---property separators.
resolveThemeVars
Flatten an IOrigamTheme object into a flat TThemeVars map of --origam-* CSS custom properties. The cssVars escape hatch always wins over vars on key collision.
semanticTreeToVars
Walk a hand-authored semantic token tree depth-first and emit a flat map of CSS custom property names to their leaf values, prefixed with a given root path.
themeSelector
Compute the CSS selector that a theme block targets based on its name and mode. Returns `:root` for the default theme, `[data-theme="name"]` for named themes, and compound selectors when both name and mode are set.
themeToCss
Serialise an IOrigamTheme object to a complete CSS rule string (selector + declarations). Pure function with no DOM access — usable both at runtime and in the Theme Builder CSS export.
themeVarsToVars
Flatten the structured IThemeVars token bucket (color / rounded / border / typo / shadow / spacing / motion groups) into a flat record of `--origam-*` CSS variable names to values.
tokenPathToCssVar
Convenience wrapper around tokenPathToCssVarName that returns the full `--origam-…` CSS custom-property reference, ready to drop into a stylesheet declaration or `:style` binding.
tokenPathToCssVarName
Resolve a token path array to an origam CSS variable name (WITHOUT the leading `--`). Applies the Origam naming convention: triple-tiret for property, double-tiret for state/BEM-child, and `__` for BEM child elements.