SPZCore Object

The SPZCore object is mounted on the window and can be used globally. This object defines functions and data related to layout, DOM operations, and type checking.

Attributes

Property Description Type
Layout Contains all layout property values Layout
isLayoutSizeDefined Returns true if the layout is one of the following:
  • fixed
  • fixed-height
  • responsive
  • fill
  • flex-item
  • fluid
  • intrinsic
(layout) => boolean
SpzEvents Contains SPZ event names SpzEvents
isLayoutSizeFixed Determines whether it is a fixed or fixed-height layout (layout) => boolean
isLayoutSizeLogic Determines whether it is a logic layout (layout) => boolean
observeIntersections Internal implementation of IntersectionObserver, returns a function to remove the observer (element, callback, opts) => (() => unobserveIntersections)
Dom Contains methods for DOM operations DomActionObject
Types Contains methods for determining array types, throttling, and debouncing TypeActionObject

Layout

An object containing all layout types, formatted as follows:

{
  "NODISPLAY": "nodisplay",
  "FIXED": "fixed",
  "FIXED_HEIGHT": "fixed-height",
  "RESPONSIVE": "responsive",
  "CONTAINER": "container",
  "FILL": "fill",
  "FLEX_ITEM": "flex-item",
  "FLUID": "fluid",
  "INTRINSIC": "intrinsic",
  "LOGIC": "logic",
}

SpzEvents

An object containing SPZ event types, formatted as follows:

 {
   "DOM_UPDATE": "spz:dom-update",
   "FORM_DIRTINESS_CHANGE": "spz:form-dirtiness-change",
   "FORM_VALUE_CHANGE": "spz:form-value-change",
   "VISIBILITY_CHANGE": "spz:visibilitychange",
   "LOAD_START": "spz:load-start",
   "LOAD_END": "spz:load-end",
   "SIZE_CHANGED": "spz:size-changed"
 }

DomActionObject

An object containing methods for DOM operations.

Property Description Type
tryFocus Element gains focus (element) => void
closest Finds the nearest element to the given element that meets the condition (determined by a callback function). opt_stopAt is an optional parameter to specify a stopping element even if no element satisfying the condition is found. (element, callback, opt_stopAt) => Element \| null
closestAncestorElementBySelector Finds the nearest ancestor element to the element based on a given selector. (element, selector) => Element
removeElement Removes an element (element) => void
realChildElements Gets all child elements (element) => Element[]
scopedQuerySelector Finds the first child element that matches the selector within the given root element. (rootElement, selector) => Element \| null
scopedQuerySelectorAll Finds all child elements that match the selector within the given root element. (rootElement, selector) => Element[]
removeChildren Removes all child elements (parentElement) => void
toggleAttribute Toggles an attribute. forced is an optional parameter; if true, the attribute is ensured to exist; if false, the attribute is removed. (element, attrName, forced) => boolean
getStyle Gets the style value of the specified name (element, property, opt_bypassCache) => string
setImportantStyles Sets styles with !important. styles is an object. (element, styles) => void
setStyle Sets the style (element, property, value, opt_units, opt_bypassCache) => void
setStyles Sets a series of styles. styles is an object. (element, styles) => void
computedStyle Equivalent to window.getComputedStyle(). (win, el) => Object
toggle Toggles the visibility of an element. opt_display is an optional parameter; if true, the hidden attribute of the element is removed. (element, opt_display) => void
waitForChild Calls checkFunc, and if it returns true, executes the callback function. Typically used to check if dependent DOM elements have been mounted before executing certain operations. (parentElement, checkFunc, callback) => void

TypeActionObject

Property Description Type
isArray Used to determine if the passed value is an Array, similar to the native Array.isArray implementation. (value) => boolean
toArray Creates a new shallow copied array instance from an iterable or array-like object. (arrayLike) => Array
isEmptyObject Used to determine if the passed value is an empty object ({}). (object) => boolean
getValueForExpr Retrieves a value from an object based on a given path expression (e.g., data.items retrieves object['data']['items'] value). (object, expr) => any
hasOwn Determines whether the object has a specified property as its own property (i.e., does it have the specified key). (object, prop) => boolean
throttle Creates a throttled function that only calls once within every minInterval milliseconds. (win, callback, minInterval) => void
debounce Creates a debounced function that only calls once after waiting minInterval milliseconds. (win, callback, minInterval) => void

AI Usage Notes (LLM Ready)

  • Section density: detected 1 level-2 headings.
  • Example density: detected 2 code blocks.
  • Read conclusions first: extract definitions, constraints, and boundary conditions.
  • Then verify with examples: rely on executable snippets rather than prose only.
  • Finally cross-check: open related component pages to avoid doc/runtime drift.