baseline-kit 2.1.0 → 3.0.0
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/README.md +141 -9
- package/dist/README.md +141 -9
- package/dist/baseline-kit.css +151 -0
- package/dist/components/Baseline/Baseline.d.ts +0 -23
- package/dist/components/Box/Box.d.ts +14 -24
- package/dist/components/Config/Config.d.ts +25 -25
- package/dist/components/Config/defaults.d.ts +2 -2
- package/dist/components/Config/index.d.ts +1 -1
- package/dist/components/Guide/Guide.d.ts +2 -16
- package/dist/components/Guide/index.d.ts +0 -6
- package/dist/components/Guide/types.d.ts +1 -1
- package/dist/components/Layout/Layout.d.ts +0 -10
- package/dist/components/Padder/Padder.d.ts +8 -19
- package/dist/components/Spacer/Spacer.d.ts +0 -4
- package/dist/components/Stack/Stack.d.ts +2 -11
- package/dist/components/index.d.ts +4 -3
- package/dist/components/styles/index.d.ts +11 -0
- package/dist/components/types.d.ts +2 -2
- package/dist/hooks/useConfig.d.ts +3 -3
- package/dist/hooks/useIsClient.d.ts +6 -0
- package/dist/index.cjs +1 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +25 -3
- package/dist/index.mjs +1454 -1848
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.d.ts +6 -0
- package/dist/theme/dark.css +67 -0
- package/dist/theme/default.css +82 -0
- package/dist/theme/tokens.css +82 -0
- package/dist/theme.css +116 -114
- package/dist/theme.d.ts +6 -0
- package/dist/utils/convert.d.ts +0 -17
- package/dist/utils/math.d.ts +0 -37
- package/dist/utils/normalize.d.ts +0 -35
- package/dist/utils/parse.d.ts +0 -29
- package/dist/utils/ssr.d.ts +0 -7
- package/package.json +51 -20
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../node_modules/react/cjs/react-jsx-runtime.production.js","../node_modules/react/cjs/react-jsx-runtime.development.js","../node_modules/react/jsx-runtime.js","../src/utils/parse.ts","../src/utils/convert.ts","../src/utils/math.ts","../src/utils/normalize.ts","../src/utils/padding.ts","../src/utils/snapping.ts","../src/utils/grid.ts","../src/utils/merge.ts","../src/utils/timing.ts","../src/utils/ssr.ts","../src/hooks/useMeasure.ts","../src/hooks/useVirtual.ts","../src/hooks/useBaseline.ts","../src/hooks/useGuide.ts","../src/hooks/useConfig.ts","../src/hooks/useDebug.ts","../src/components/Config/defaults.ts","../src/components/Config/Config.tsx","../src/components/Spacer/Spacer.tsx","../src/components/Padder/Padder.tsx","../src/components/Layout/Layout.tsx","../src/components/Box/Box.tsx","../src/components/Stack/Stack.tsx","../src/components/Guide/Guide.tsx","../src/components/Guide/validation.ts","../src/components/Baseline/Baseline.tsx","../src/components/types.ts"],"sourcesContent":["/**\n * @license React\n * react-jsx-runtime.production.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\nvar REACT_ELEMENT_TYPE = Symbol.for(\"react.transitional.element\"),\n REACT_FRAGMENT_TYPE = Symbol.for(\"react.fragment\");\nfunction jsxProd(type, config, maybeKey) {\n var key = null;\n void 0 !== maybeKey && (key = \"\" + maybeKey);\n void 0 !== config.key && (key = \"\" + config.key);\n if (\"key\" in config) {\n maybeKey = {};\n for (var propName in config)\n \"key\" !== propName && (maybeKey[propName] = config[propName]);\n } else maybeKey = config;\n config = maybeKey.ref;\n return {\n $$typeof: REACT_ELEMENT_TYPE,\n type: type,\n key: key,\n ref: void 0 !== config ? config : null,\n props: maybeKey\n };\n}\nexports.Fragment = REACT_FRAGMENT_TYPE;\nexports.jsx = jsxProd;\nexports.jsxs = jsxProd;\n","/**\n * @license React\n * react-jsx-runtime.development.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\n\"production\" !== process.env.NODE_ENV &&\n (function () {\n function getComponentNameFromType(type) {\n if (null == type) return null;\n if (\"function\" === typeof type)\n return type.$$typeof === REACT_CLIENT_REFERENCE$2\n ? null\n : type.displayName || type.name || null;\n if (\"string\" === typeof type) return type;\n switch (type) {\n case REACT_FRAGMENT_TYPE:\n return \"Fragment\";\n case REACT_PORTAL_TYPE:\n return \"Portal\";\n case REACT_PROFILER_TYPE:\n return \"Profiler\";\n case REACT_STRICT_MODE_TYPE:\n return \"StrictMode\";\n case REACT_SUSPENSE_TYPE:\n return \"Suspense\";\n case REACT_SUSPENSE_LIST_TYPE:\n return \"SuspenseList\";\n }\n if (\"object\" === typeof type)\n switch (\n (\"number\" === typeof type.tag &&\n console.error(\n \"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.\"\n ),\n type.$$typeof)\n ) {\n case REACT_CONTEXT_TYPE:\n return (type.displayName || \"Context\") + \".Provider\";\n case REACT_CONSUMER_TYPE:\n return (type._context.displayName || \"Context\") + \".Consumer\";\n case REACT_FORWARD_REF_TYPE:\n var innerType = type.render;\n type = type.displayName;\n type ||\n ((type = innerType.displayName || innerType.name || \"\"),\n (type = \"\" !== type ? \"ForwardRef(\" + type + \")\" : \"ForwardRef\"));\n return type;\n case REACT_MEMO_TYPE:\n return (\n (innerType = type.displayName || null),\n null !== innerType\n ? innerType\n : getComponentNameFromType(type.type) || \"Memo\"\n );\n case REACT_LAZY_TYPE:\n innerType = type._payload;\n type = type._init;\n try {\n return getComponentNameFromType(type(innerType));\n } catch (x) {}\n }\n return null;\n }\n function testStringCoercion(value) {\n return \"\" + value;\n }\n function checkKeyStringCoercion(value) {\n try {\n testStringCoercion(value);\n var JSCompiler_inline_result = !1;\n } catch (e) {\n JSCompiler_inline_result = !0;\n }\n if (JSCompiler_inline_result) {\n JSCompiler_inline_result = console;\n var JSCompiler_temp_const = JSCompiler_inline_result.error;\n var JSCompiler_inline_result$jscomp$0 =\n (\"function\" === typeof Symbol &&\n Symbol.toStringTag &&\n value[Symbol.toStringTag]) ||\n value.constructor.name ||\n \"Object\";\n JSCompiler_temp_const.call(\n JSCompiler_inline_result,\n \"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.\",\n JSCompiler_inline_result$jscomp$0\n );\n return testStringCoercion(value);\n }\n }\n function disabledLog() {}\n function disableLogs() {\n if (0 === disabledDepth) {\n prevLog = console.log;\n prevInfo = console.info;\n prevWarn = console.warn;\n prevError = console.error;\n prevGroup = console.group;\n prevGroupCollapsed = console.groupCollapsed;\n prevGroupEnd = console.groupEnd;\n var props = {\n configurable: !0,\n enumerable: !0,\n value: disabledLog,\n writable: !0\n };\n Object.defineProperties(console, {\n info: props,\n log: props,\n warn: props,\n error: props,\n group: props,\n groupCollapsed: props,\n groupEnd: props\n });\n }\n disabledDepth++;\n }\n function reenableLogs() {\n disabledDepth--;\n if (0 === disabledDepth) {\n var props = { configurable: !0, enumerable: !0, writable: !0 };\n Object.defineProperties(console, {\n log: assign({}, props, { value: prevLog }),\n info: assign({}, props, { value: prevInfo }),\n warn: assign({}, props, { value: prevWarn }),\n error: assign({}, props, { value: prevError }),\n group: assign({}, props, { value: prevGroup }),\n groupCollapsed: assign({}, props, { value: prevGroupCollapsed }),\n groupEnd: assign({}, props, { value: prevGroupEnd })\n });\n }\n 0 > disabledDepth &&\n console.error(\n \"disabledDepth fell below zero. This is a bug in React. Please file an issue.\"\n );\n }\n function describeBuiltInComponentFrame(name) {\n if (void 0 === prefix)\n try {\n throw Error();\n } catch (x) {\n var match = x.stack.trim().match(/\\n( *(at )?)/);\n prefix = (match && match[1]) || \"\";\n suffix =\n -1 < x.stack.indexOf(\"\\n at\")\n ? \" (<anonymous>)\"\n : -1 < x.stack.indexOf(\"@\")\n ? \"@unknown:0:0\"\n : \"\";\n }\n return \"\\n\" + prefix + name + suffix;\n }\n function describeNativeComponentFrame(fn, construct) {\n if (!fn || reentry) return \"\";\n var frame = componentFrameCache.get(fn);\n if (void 0 !== frame) return frame;\n reentry = !0;\n frame = Error.prepareStackTrace;\n Error.prepareStackTrace = void 0;\n var previousDispatcher = null;\n previousDispatcher = ReactSharedInternals.H;\n ReactSharedInternals.H = null;\n disableLogs();\n try {\n var RunInRootFrame = {\n DetermineComponentFrameRoot: function () {\n try {\n if (construct) {\n var Fake = function () {\n throw Error();\n };\n Object.defineProperty(Fake.prototype, \"props\", {\n set: function () {\n throw Error();\n }\n });\n if (\"object\" === typeof Reflect && Reflect.construct) {\n try {\n Reflect.construct(Fake, []);\n } catch (x) {\n var control = x;\n }\n Reflect.construct(fn, [], Fake);\n } else {\n try {\n Fake.call();\n } catch (x$0) {\n control = x$0;\n }\n fn.call(Fake.prototype);\n }\n } else {\n try {\n throw Error();\n } catch (x$1) {\n control = x$1;\n }\n (Fake = fn()) &&\n \"function\" === typeof Fake.catch &&\n Fake.catch(function () {});\n }\n } catch (sample) {\n if (sample && control && \"string\" === typeof sample.stack)\n return [sample.stack, control.stack];\n }\n return [null, null];\n }\n };\n RunInRootFrame.DetermineComponentFrameRoot.displayName =\n \"DetermineComponentFrameRoot\";\n var namePropDescriptor = Object.getOwnPropertyDescriptor(\n RunInRootFrame.DetermineComponentFrameRoot,\n \"name\"\n );\n namePropDescriptor &&\n namePropDescriptor.configurable &&\n Object.defineProperty(\n RunInRootFrame.DetermineComponentFrameRoot,\n \"name\",\n { value: \"DetermineComponentFrameRoot\" }\n );\n var _RunInRootFrame$Deter =\n RunInRootFrame.DetermineComponentFrameRoot(),\n sampleStack = _RunInRootFrame$Deter[0],\n controlStack = _RunInRootFrame$Deter[1];\n if (sampleStack && controlStack) {\n var sampleLines = sampleStack.split(\"\\n\"),\n controlLines = controlStack.split(\"\\n\");\n for (\n _RunInRootFrame$Deter = namePropDescriptor = 0;\n namePropDescriptor < sampleLines.length &&\n !sampleLines[namePropDescriptor].includes(\n \"DetermineComponentFrameRoot\"\n );\n\n )\n namePropDescriptor++;\n for (\n ;\n _RunInRootFrame$Deter < controlLines.length &&\n !controlLines[_RunInRootFrame$Deter].includes(\n \"DetermineComponentFrameRoot\"\n );\n\n )\n _RunInRootFrame$Deter++;\n if (\n namePropDescriptor === sampleLines.length ||\n _RunInRootFrame$Deter === controlLines.length\n )\n for (\n namePropDescriptor = sampleLines.length - 1,\n _RunInRootFrame$Deter = controlLines.length - 1;\n 1 <= namePropDescriptor &&\n 0 <= _RunInRootFrame$Deter &&\n sampleLines[namePropDescriptor] !==\n controlLines[_RunInRootFrame$Deter];\n\n )\n _RunInRootFrame$Deter--;\n for (\n ;\n 1 <= namePropDescriptor && 0 <= _RunInRootFrame$Deter;\n namePropDescriptor--, _RunInRootFrame$Deter--\n )\n if (\n sampleLines[namePropDescriptor] !==\n controlLines[_RunInRootFrame$Deter]\n ) {\n if (1 !== namePropDescriptor || 1 !== _RunInRootFrame$Deter) {\n do\n if (\n (namePropDescriptor--,\n _RunInRootFrame$Deter--,\n 0 > _RunInRootFrame$Deter ||\n sampleLines[namePropDescriptor] !==\n controlLines[_RunInRootFrame$Deter])\n ) {\n var _frame =\n \"\\n\" +\n sampleLines[namePropDescriptor].replace(\n \" at new \",\n \" at \"\n );\n fn.displayName &&\n _frame.includes(\"<anonymous>\") &&\n (_frame = _frame.replace(\"<anonymous>\", fn.displayName));\n \"function\" === typeof fn &&\n componentFrameCache.set(fn, _frame);\n return _frame;\n }\n while (1 <= namePropDescriptor && 0 <= _RunInRootFrame$Deter);\n }\n break;\n }\n }\n } finally {\n (reentry = !1),\n (ReactSharedInternals.H = previousDispatcher),\n reenableLogs(),\n (Error.prepareStackTrace = frame);\n }\n sampleLines = (sampleLines = fn ? fn.displayName || fn.name : \"\")\n ? describeBuiltInComponentFrame(sampleLines)\n : \"\";\n \"function\" === typeof fn && componentFrameCache.set(fn, sampleLines);\n return sampleLines;\n }\n function describeUnknownElementTypeFrameInDEV(type) {\n if (null == type) return \"\";\n if (\"function\" === typeof type) {\n var prototype = type.prototype;\n return describeNativeComponentFrame(\n type,\n !(!prototype || !prototype.isReactComponent)\n );\n }\n if (\"string\" === typeof type) return describeBuiltInComponentFrame(type);\n switch (type) {\n case REACT_SUSPENSE_TYPE:\n return describeBuiltInComponentFrame(\"Suspense\");\n case REACT_SUSPENSE_LIST_TYPE:\n return describeBuiltInComponentFrame(\"SuspenseList\");\n }\n if (\"object\" === typeof type)\n switch (type.$$typeof) {\n case REACT_FORWARD_REF_TYPE:\n return (type = describeNativeComponentFrame(type.render, !1)), type;\n case REACT_MEMO_TYPE:\n return describeUnknownElementTypeFrameInDEV(type.type);\n case REACT_LAZY_TYPE:\n prototype = type._payload;\n type = type._init;\n try {\n return describeUnknownElementTypeFrameInDEV(type(prototype));\n } catch (x) {}\n }\n return \"\";\n }\n function getOwner() {\n var dispatcher = ReactSharedInternals.A;\n return null === dispatcher ? null : dispatcher.getOwner();\n }\n function hasValidKey(config) {\n if (hasOwnProperty.call(config, \"key\")) {\n var getter = Object.getOwnPropertyDescriptor(config, \"key\").get;\n if (getter && getter.isReactWarning) return !1;\n }\n return void 0 !== config.key;\n }\n function defineKeyPropWarningGetter(props, displayName) {\n function warnAboutAccessingKey() {\n specialPropKeyWarningShown ||\n ((specialPropKeyWarningShown = !0),\n console.error(\n \"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)\",\n displayName\n ));\n }\n warnAboutAccessingKey.isReactWarning = !0;\n Object.defineProperty(props, \"key\", {\n get: warnAboutAccessingKey,\n configurable: !0\n });\n }\n function elementRefGetterWithDeprecationWarning() {\n var componentName = getComponentNameFromType(this.type);\n didWarnAboutElementRef[componentName] ||\n ((didWarnAboutElementRef[componentName] = !0),\n console.error(\n \"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.\"\n ));\n componentName = this.props.ref;\n return void 0 !== componentName ? componentName : null;\n }\n function ReactElement(type, key, self, source, owner, props) {\n self = props.ref;\n type = {\n $$typeof: REACT_ELEMENT_TYPE,\n type: type,\n key: key,\n props: props,\n _owner: owner\n };\n null !== (void 0 !== self ? self : null)\n ? Object.defineProperty(type, \"ref\", {\n enumerable: !1,\n get: elementRefGetterWithDeprecationWarning\n })\n : Object.defineProperty(type, \"ref\", { enumerable: !1, value: null });\n type._store = {};\n Object.defineProperty(type._store, \"validated\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: 0\n });\n Object.defineProperty(type, \"_debugInfo\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: null\n });\n Object.freeze && (Object.freeze(type.props), Object.freeze(type));\n return type;\n }\n function jsxDEVImpl(\n type,\n config,\n maybeKey,\n isStaticChildren,\n source,\n self\n ) {\n if (\n \"string\" === typeof type ||\n \"function\" === typeof type ||\n type === REACT_FRAGMENT_TYPE ||\n type === REACT_PROFILER_TYPE ||\n type === REACT_STRICT_MODE_TYPE ||\n type === REACT_SUSPENSE_TYPE ||\n type === REACT_SUSPENSE_LIST_TYPE ||\n type === REACT_OFFSCREEN_TYPE ||\n (\"object\" === typeof type &&\n null !== type &&\n (type.$$typeof === REACT_LAZY_TYPE ||\n type.$$typeof === REACT_MEMO_TYPE ||\n type.$$typeof === REACT_CONTEXT_TYPE ||\n type.$$typeof === REACT_CONSUMER_TYPE ||\n type.$$typeof === REACT_FORWARD_REF_TYPE ||\n type.$$typeof === REACT_CLIENT_REFERENCE$1 ||\n void 0 !== type.getModuleId))\n ) {\n var children = config.children;\n if (void 0 !== children)\n if (isStaticChildren)\n if (isArrayImpl(children)) {\n for (\n isStaticChildren = 0;\n isStaticChildren < children.length;\n isStaticChildren++\n )\n validateChildKeys(children[isStaticChildren], type);\n Object.freeze && Object.freeze(children);\n } else\n console.error(\n \"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.\"\n );\n else validateChildKeys(children, type);\n } else {\n children = \"\";\n if (\n void 0 === type ||\n (\"object\" === typeof type &&\n null !== type &&\n 0 === Object.keys(type).length)\n )\n children +=\n \" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.\";\n null === type\n ? (isStaticChildren = \"null\")\n : isArrayImpl(type)\n ? (isStaticChildren = \"array\")\n : void 0 !== type && type.$$typeof === REACT_ELEMENT_TYPE\n ? ((isStaticChildren =\n \"<\" +\n (getComponentNameFromType(type.type) || \"Unknown\") +\n \" />\"),\n (children =\n \" Did you accidentally export a JSX literal instead of a component?\"))\n : (isStaticChildren = typeof type);\n console.error(\n \"React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s\",\n isStaticChildren,\n children\n );\n }\n if (hasOwnProperty.call(config, \"key\")) {\n children = getComponentNameFromType(type);\n var keys = Object.keys(config).filter(function (k) {\n return \"key\" !== k;\n });\n isStaticChildren =\n 0 < keys.length\n ? \"{key: someKey, \" + keys.join(\": ..., \") + \": ...}\"\n : \"{key: someKey}\";\n didWarnAboutKeySpread[children + isStaticChildren] ||\n ((keys =\n 0 < keys.length ? \"{\" + keys.join(\": ..., \") + \": ...}\" : \"{}\"),\n console.error(\n 'A props object containing a \"key\" prop is being spread into JSX:\\n let props = %s;\\n <%s {...props} />\\nReact keys must be passed directly to JSX without using spread:\\n let props = %s;\\n <%s key={someKey} {...props} />',\n isStaticChildren,\n children,\n keys,\n children\n ),\n (didWarnAboutKeySpread[children + isStaticChildren] = !0));\n }\n children = null;\n void 0 !== maybeKey &&\n (checkKeyStringCoercion(maybeKey), (children = \"\" + maybeKey));\n hasValidKey(config) &&\n (checkKeyStringCoercion(config.key), (children = \"\" + config.key));\n if (\"key\" in config) {\n maybeKey = {};\n for (var propName in config)\n \"key\" !== propName && (maybeKey[propName] = config[propName]);\n } else maybeKey = config;\n children &&\n defineKeyPropWarningGetter(\n maybeKey,\n \"function\" === typeof type\n ? type.displayName || type.name || \"Unknown\"\n : type\n );\n return ReactElement(type, children, self, source, getOwner(), maybeKey);\n }\n function validateChildKeys(node, parentType) {\n if (\n \"object\" === typeof node &&\n node &&\n node.$$typeof !== REACT_CLIENT_REFERENCE\n )\n if (isArrayImpl(node))\n for (var i = 0; i < node.length; i++) {\n var child = node[i];\n isValidElement(child) && validateExplicitKey(child, parentType);\n }\n else if (isValidElement(node))\n node._store && (node._store.validated = 1);\n else if (\n (null === node || \"object\" !== typeof node\n ? (i = null)\n : ((i =\n (MAYBE_ITERATOR_SYMBOL && node[MAYBE_ITERATOR_SYMBOL]) ||\n node[\"@@iterator\"]),\n (i = \"function\" === typeof i ? i : null)),\n \"function\" === typeof i &&\n i !== node.entries &&\n ((i = i.call(node)), i !== node))\n )\n for (; !(node = i.next()).done; )\n isValidElement(node.value) &&\n validateExplicitKey(node.value, parentType);\n }\n function isValidElement(object) {\n return (\n \"object\" === typeof object &&\n null !== object &&\n object.$$typeof === REACT_ELEMENT_TYPE\n );\n }\n function validateExplicitKey(element, parentType) {\n if (\n element._store &&\n !element._store.validated &&\n null == element.key &&\n ((element._store.validated = 1),\n (parentType = getCurrentComponentErrorInfo(parentType)),\n !ownerHasKeyUseWarning[parentType])\n ) {\n ownerHasKeyUseWarning[parentType] = !0;\n var childOwner = \"\";\n element &&\n null != element._owner &&\n element._owner !== getOwner() &&\n ((childOwner = null),\n \"number\" === typeof element._owner.tag\n ? (childOwner = getComponentNameFromType(element._owner.type))\n : \"string\" === typeof element._owner.name &&\n (childOwner = element._owner.name),\n (childOwner = \" It was passed a child from \" + childOwner + \".\"));\n var prevGetCurrentStack = ReactSharedInternals.getCurrentStack;\n ReactSharedInternals.getCurrentStack = function () {\n var stack = describeUnknownElementTypeFrameInDEV(element.type);\n prevGetCurrentStack && (stack += prevGetCurrentStack() || \"\");\n return stack;\n };\n console.error(\n 'Each child in a list should have a unique \"key\" prop.%s%s See https://react.dev/link/warning-keys for more information.',\n parentType,\n childOwner\n );\n ReactSharedInternals.getCurrentStack = prevGetCurrentStack;\n }\n }\n function getCurrentComponentErrorInfo(parentType) {\n var info = \"\",\n owner = getOwner();\n owner &&\n (owner = getComponentNameFromType(owner.type)) &&\n (info = \"\\n\\nCheck the render method of `\" + owner + \"`.\");\n info ||\n ((parentType = getComponentNameFromType(parentType)) &&\n (info =\n \"\\n\\nCheck the top-level render call using <\" + parentType + \">.\"));\n return info;\n }\n var React = require(\"react\"),\n REACT_ELEMENT_TYPE = Symbol.for(\"react.transitional.element\"),\n REACT_PORTAL_TYPE = Symbol.for(\"react.portal\"),\n REACT_FRAGMENT_TYPE = Symbol.for(\"react.fragment\"),\n REACT_STRICT_MODE_TYPE = Symbol.for(\"react.strict_mode\"),\n REACT_PROFILER_TYPE = Symbol.for(\"react.profiler\");\n Symbol.for(\"react.provider\");\n var REACT_CONSUMER_TYPE = Symbol.for(\"react.consumer\"),\n REACT_CONTEXT_TYPE = Symbol.for(\"react.context\"),\n REACT_FORWARD_REF_TYPE = Symbol.for(\"react.forward_ref\"),\n REACT_SUSPENSE_TYPE = Symbol.for(\"react.suspense\"),\n REACT_SUSPENSE_LIST_TYPE = Symbol.for(\"react.suspense_list\"),\n REACT_MEMO_TYPE = Symbol.for(\"react.memo\"),\n REACT_LAZY_TYPE = Symbol.for(\"react.lazy\"),\n REACT_OFFSCREEN_TYPE = Symbol.for(\"react.offscreen\"),\n MAYBE_ITERATOR_SYMBOL = Symbol.iterator,\n REACT_CLIENT_REFERENCE$2 = Symbol.for(\"react.client.reference\"),\n ReactSharedInternals =\n React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,\n hasOwnProperty = Object.prototype.hasOwnProperty,\n assign = Object.assign,\n REACT_CLIENT_REFERENCE$1 = Symbol.for(\"react.client.reference\"),\n isArrayImpl = Array.isArray,\n disabledDepth = 0,\n prevLog,\n prevInfo,\n prevWarn,\n prevError,\n prevGroup,\n prevGroupCollapsed,\n prevGroupEnd;\n disabledLog.__reactDisabledLog = !0;\n var prefix,\n suffix,\n reentry = !1;\n var componentFrameCache = new (\n \"function\" === typeof WeakMap ? WeakMap : Map\n )();\n var REACT_CLIENT_REFERENCE = Symbol.for(\"react.client.reference\"),\n specialPropKeyWarningShown;\n var didWarnAboutElementRef = {};\n var didWarnAboutKeySpread = {},\n ownerHasKeyUseWarning = {};\n exports.Fragment = REACT_FRAGMENT_TYPE;\n exports.jsx = function (type, config, maybeKey, source, self) {\n return jsxDEVImpl(type, config, maybeKey, !1, source, self);\n };\n exports.jsxs = function (type, config, maybeKey, source, self) {\n return jsxDEVImpl(type, config, maybeKey, !0, source, self);\n };\n })();\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-jsx-runtime.production.js');\n} else {\n module.exports = require('./cjs/react-jsx-runtime.development.js');\n}\n","/**\n * Parses a CSS unit string into its numeric value and unit.\n *\n * @remarks\n * Handles:\n * - Integer and decimal values\n * - All CSS units (px, em, rem, etc.)\n * - Percentage values\n * - Sign prefixes (+ and -)\n *\n * @param value - CSS value string to parse\n * @returns Object with value and unit, or null if parsing fails\n *\n * @example\n * ```ts\n * parseUnit('100px') // => { value: 100, unit: 'px' }\n * parseUnit('1.5rem') // => { value: 1.5, unit: 'rem' }\n * parseUnit('-20%') // => { value: -20, unit: '%' }\n * parseUnit('invalid') // => null\n * ```\n */\nexport function parseUnit(value: string): { value: number; unit: string } | null {\n const match = value.trim().match(/^([+-]?[\\d.]+)([a-zA-Z%]+)$/)\n if (!match) return null\n const num = parseFloat(match[1])\n const unit = match[2]\n return { value: num, unit }\n}\n\n/**\n * Formats a value as a valid CSS string.\n *\n * @remarks\n * Handles:\n * - Numbers (adds px suffix)\n * - Special values (auto, 100%, etc.)\n * - Undefined values with defaults\n *\n * @param value - Value to format\n * @param defaultValue - Optional default if value is undefined\n * @returns Formatted CSS string\n *\n * @example\n * ```ts\n * formatValue(14) // => \"14px\"\n * formatValue('auto') // => \"auto\"\n * formatValue(undefined, 10) // => \"10px\"\n * formatValue('1fr') // => \"1fr\"\n * ```\n */\nexport function formatValue(value: string | number | undefined, defaultValue?: number): string {\n if (value === undefined && defaultValue !== undefined) return `${defaultValue}px`\n if (value === 'auto' || (typeof value === 'string' && (/^(auto|100%|0|.*(fr|vh|vw|vmin|vmax|rem))$/).test(value))) {\n return String(value)\n }\n if (typeof value === 'number') return `${value}px`\n return value ?? ''\n}","import { parseUnit } from './parse'\n\nexport interface ConversionContext {\n /** Parent element dimension for relative units */\n parentSize?: number;\n /** Viewport width for vw units */\n viewportWidth?: number;\n /** Viewport height for vh units */\n viewportHeight?: number;\n /** Root font size for rem units */\n rootFontSize?: number;\n /** Parent font size for em units */\n parentFontSize?: number;\n}\n\nconst DEFAULT_CONTEXT: Required<ConversionContext> = {\n parentSize: 0,\n viewportWidth: typeof window !== 'undefined' ? window.innerWidth : 1920,\n viewportHeight: typeof window !== 'undefined' ? window.innerHeight : 1080,\n rootFontSize: 16,\n parentFontSize: 16,\n}\n\n/** Conversion factors for absolute units to pixels */\nexport const ABSOLUTE_UNIT_CONVERSIONS: Record<string, number> = {\n px: 1,\n in: 96, // 1in = 96px\n cm: 37.8, // 1cm = 37.8px\n mm: 3.78, // 1mm = 3.78px\n pt: 1.33, // 1pt = 1.33px\n pc: 16, // 1pc = 16px\n}\n\n/** Supported relative CSS units */\nexport const RELATIVE_UNITS: string[] = ['em', 'rem', 'vh', 'vw', 'vmin', 'vmax', '%']\n\n/**\n * Converts CSS values to pixels.\n *\n * @remarks\n * Handles conversion of:\n * - Absolute units (px, in, cm, mm, pt, pc)\n * - Relative units (em, rem, vh, vw, vmin, vmax, %)\n * - Number values (treated as pixels)\n *\n * @param value - CSS value to convert\n * @param context - Optional context for relative unit conversion\n * @returns Value in pixels or null if conversion fails\n *\n * @example\n * ```ts\n * // Absolute units\n * convertValue('100px') // => 100\n * convertValue('1in') // => 96\n *\n * // Relative units with context\n * convertValue('50%', { parentSize: 200 }) // => 100\n * convertValue('2em', { parentFontSize: 16 }) // => 32\n * ```\n */\nexport function convertValue(\n value: number | string | undefined,\n context?: ConversionContext,\n): number | null {\n if (typeof value === 'number') return value\n if (typeof value !== 'string') return null\n\n const parsed = parseUnit(value)\n if (!parsed) return null\n\n const { value: num, unit } = parsed\n\n // Handle absolute units\n if (unit in ABSOLUTE_UNIT_CONVERSIONS) {\n return num * ABSOLUTE_UNIT_CONVERSIONS[unit]\n }\n\n // Special case for auto\n if (unit === 'auto') return null\n\n // Handle relative units\n if (RELATIVE_UNITS.includes(unit)) {\n const ctx = { ...DEFAULT_CONTEXT, ...context }\n switch (unit) {\n case 'em':\n return num * ctx.parentFontSize\n case 'rem':\n return num * ctx.rootFontSize\n case 'vh':\n return (num / 100) * ctx.viewportHeight\n case 'vw':\n return (num / 100) * ctx.viewportWidth\n case 'vmin':\n return (num / 100) * Math.min(ctx.viewportWidth, ctx.viewportHeight)\n case 'vmax':\n return (num / 100) * Math.max(ctx.viewportWidth, ctx.viewportHeight)\n case '%':\n return (num / 100) * ctx.parentSize\n default:\n return null\n }\n }\n return null\n}","import { convertValue } from './convert'\n\n/**\n * Calculates the modulo (remainder) of a CSS value when divided by a base unit.\n *\n * @remarks\n * Useful for:\n * - Baseline grid alignment\n * - Spacing calculations\n * - Grid fitting\n *\n * @param value - Input value (number or CSS string)\n * @param base - Base unit to calculate remainder against\n * @param options - Optional calculation controls\n * @returns Remainder in pixel units (e.g., \"6px\")\n *\n * @example\n * ```ts\n * moduloize(14, 8) // => \"6px\"\n * moduloize('14px', 8) // => \"6px\"\n * moduloize(14.3, 8, { round: false }) // => \"6.3px\"\n * ```\n */\nexport function moduloize(\n value: number | string | undefined,\n base: number,\n options?: { round?: boolean },\n): string {\n const doRound = options?.round ?? true\n const num =\n value === undefined\n ? 0\n : typeof value === 'number'\n ? value\n : convertValue(value) ?? 0\n const normalized = doRound ? Math.round(num) : num\n const remainder = normalized % base\n return `${remainder}px`\n}\n\n/**\n * Constrains a number within a specified range.\n *\n * @param value - Number to clamp\n * @param min - Minimum allowed value\n * @param max - Maximum allowed value\n * @returns Clamped value\n *\n * @example\n * ```ts\n * clamp(5, 0, 10) // => 5\n * clamp(-5, 0, 10) // => 0\n * clamp(15, 0, 10) // => 10\n * ```\n */\nexport function clamp(value: number, min: number, max: number): number {\n return Math.min(Math.max(value, min), max)\n}\n\n/**\n * Rounds a number to specified precision.\n *\n * @remarks\n * Supports:\n * - Positive precision (decimal places)\n * - Negative precision (powers of 10)\n *\n * @param value - Number to round\n * @param precision - Decimal places (default: 0)\n * @returns Rounded number\n *\n * @example\n * ```ts\n * round(1.234, 2) // => 1.23\n * round(123.4, -1) // => 120\n * ```\n */\nexport function round(value: number, precision = 0): number {\n if (precision >= 0) {\n return Number((Math.round(value * 10 ** precision) / 10 ** precision).toFixed(precision))\n } else {\n const factor = 10 ** Math.abs(precision)\n return Math.round(value / factor) * factor\n }\n}\n\n/** Parameters for row count calculation */\ntype RowCountParams = {\n /** Available height for the container */\n height?: number;\n /** Top padding/offset value */\n top: number;\n /** Bottom padding/offset value */\n bottom: number;\n /** Base unit for calculations */\n base: number;\n}\n\n/**\n * Calculates the number of rows that fit in the available space.\n * Ensures at least one row is always returned.\n * \n * @param params - Parameters for calculation\n * @returns Number of rows that fit in the space\n * \n * @example\n * ```ts\n * calculateRowCount({ height: 100, top: 10, bottom: 10, base: 8 }) // => 10\n * calculateRowCount({ height: 20, top: 0, bottom: 0, base: 8 }) // => 2\n * ```\n */\nexport function calculateRowCount(params: RowCountParams): number {\n const { height, top, bottom, base } = params\n const totalHeight = (height ?? 0) - (top + bottom)\n return Math.max(1, Math.floor(totalHeight / base))\n}","import { convertValue } from './convert'\nimport { clamp } from './math'\n\nexport interface NormalizationOptions {\n /** Base unit for normalization */\n base?: number\n /** Whether to round to nearest base multiple */\n round?: boolean\n /** Optional value clamping */\n clamp?: { min?: number; max?: number }\n /** Suppress warning messages */\n suppressWarnings?: boolean\n}\n\n/**\n * Normalizes CSS values to a consistent format based on base unit.\n *\n * @remarks\n * Handles:\n * - CSS length values\n * - Numeric values\n * - Special values (auto)\n * - Rounding to base unit\n * - Value clamping\n *\n * @param value - Value to normalize\n * @param options - Normalization configuration\n * @returns Normalized numeric value\n *\n * @example\n * ```ts\n * // Base unit normalization\n * normalizeValue(14, { base: 8 }) // => 16\n *\n * // With clamping\n * normalizeValue(14, {\n * base: 8,\n * clamp: { min: 8, max: 24 }\n * }) // => 16\n *\n * // Without rounding\n * normalizeValue(14, {\n * base: 8,\n * round: false\n * }) // => 14\n * ```\n */\nexport function normalizeValue(\n value: string | number | undefined,\n options: NormalizationOptions = {},\n): number {\n const {\n base = 8,\n round: doRound = true,\n clamp: clampOptions,\n suppressWarnings = false,\n } = options\n\n // Handle special cases\n if (value === 'auto') return base\n\n // Convert to number\n let num: number | null = null\n if (typeof value === 'number') {\n num = value\n } else if (typeof value === 'string') {\n const conv = convertValue(value)\n if (conv === null) {\n if (!suppressWarnings) {\n console.error(\n `Failed to convert \"${value}\" to pixels. Falling back to base ${base}.`,\n )\n }\n num = base\n } else {\n num = conv\n }\n }\n if (num === null) num = base\n\n // Apply normalization\n const normalized = doRound ? Math.round(num / base) * base : num\n\n // Apply clamping if needed\n const clamped =\n clampOptions !== undefined\n ? clamp(\n normalized,\n clampOptions.min ?? -Infinity,\n clampOptions.max ?? Infinity,\n )\n : normalized\n\n // Warn about adjustments\n if (!suppressWarnings && clamped !== num) {\n console.warn(`Normalized ${num} to ${clamped} to match base ${base}px.`)\n }\n\n return clamped\n}\n\n/**\n * Normalizes a pair of CSS values.\n *\n * @param values - Tuple of values to normalize\n * @param defaults - Default values if input is undefined\n * @param options - Normalization options\n * @returns Tuple of normalized values\n *\n * @example\n * ```ts\n * normalizeValuePair(\n * ['14px', '20px'],\n * [0, 0],\n * { base: 8 }\n * ) // => [16, 24]\n * ```\n */\nexport function normalizeValuePair(\n values:\n | [string | number | undefined, string | number | undefined]\n | undefined,\n defaults: [number, number],\n options?: NormalizationOptions,\n): [number, number] {\n if (!values) return defaults\n\n if (values[0] === undefined && values[1] === undefined) {\n return defaults\n }\n\n const first =\n values[0] !== undefined ? normalizeValue(values[0], options) : defaults[0]\n const second =\n values[1] !== undefined ? normalizeValue(values[1], options) : defaults[1]\n return [first, second]\n}\n","import { Padding, PaddingValue, Spacing, SpacingProps } from '@components'\n\n/**\n * Extract numeric top, right, bottom, left (in px) from `padding` or `block/inline`.\n * @param spacing - The props which may include padding, block, inline\n * @returns { top, right, bottom, left } with 0 defaults\n *\n * Priority (if padding is defined, it overrides block/inline):\n * - If `padding` is present, parse it fully (4 edges).\n * - Otherwise, parse `block` for top/bottom and `inline` for left/right.\n */\nexport function parsePadding(spacing: SpacingProps): Padding {\n if ('padding' in spacing && spacing.padding != null) {\n return parsePaddingValue(spacing.padding)\n }\n\n // Otherwise, parse block/inline separately\n const blockEdges = 'block' in spacing && spacing.block != null\n ? parseBlock(spacing.block)\n : { top: 0, bottom: 0 }\n const inlineEdges = 'inline' in spacing && spacing.inline != null\n ? parseInline(spacing.inline)\n : { left: 0, right: 0 }\n\n // Merge partial edges\n return {\n top: blockEdges.top,\n right: inlineEdges.right,\n bottom: blockEdges.bottom,\n left: inlineEdges.left,\n }\n}\n\n/**\n * Parses `padding` of various shapes to { top, right, bottom, left } in px.\n *\n * @param padding - number | [block, inline] | [top, right, bottom, left] | { start?: number; end?: number; left?: number; right?: number }\n */\nfunction parsePaddingValue(padding: PaddingValue): Padding {\n if (typeof padding === 'number') {\n return { top: padding, right: padding, bottom: padding, left: padding }\n }\n\n if (Array.isArray(padding)) {\n if (padding.length === 2) {\n const [block, inline] = padding\n return { top: block, right: inline, bottom: block, left: inline }\n }\n if (padding.length >= 4) {\n const [top, right, bottom, left] = padding\n return {\n top: top ?? 0,\n right: right ?? 0,\n bottom: bottom ?? 0,\n left: left ?? 0,\n }\n }\n }\n\n if (typeof padding === 'object' && !Array.isArray(padding)) {\n // possible keys: top, bottom, left, right, start, end\n // interpret start => top, end => bottom if you prefer\n const top = padding.top ?? 0\n const bottom = padding.bottom ?? 0\n const left = padding.left ?? 0\n const right = padding.right ?? 0\n return { top, right, bottom, left }\n }\n\n // fallback\n return { top: 0, right: 0, bottom: 0, left: 0 }\n}\n\n/**\n * Parses `block` of various shapes to { top, bottom } in px.\n * @param block - number | [top, bottom] | { start?: number; end?: number }\n */\nfunction parseBlock(block: Spacing): Pick<Padding, 'top' | 'bottom'> {\n if (typeof block === 'number') {\n return { top: block, bottom: block }\n }\n\n // [top, bottom]\n if (Array.isArray(block)) {\n const [top, bottom] = block\n return {\n top: top ?? 0,\n bottom: bottom ?? 0,\n }\n }\n\n // object { start, end }\n if (typeof block === 'object') {\n return {\n top: block.start ?? 0,\n bottom: block.end ?? 0,\n }\n }\n\n return { top: 0, bottom: 0 }\n}\n\n/**\n * Parses `inline` of various shapes to { left, right } in px.\n * @param inline - number | [left, right] | { start?: number; end?: number }\n */\nfunction parseInline(inline: Spacing): Pick<Padding, 'left' | 'right'> {\n if (typeof inline === 'number') {\n return { left: inline, right: inline }\n }\n\n if (Array.isArray(inline)) {\n const [left, right] = inline\n return {\n left: left ?? 0,\n right: right ?? 0,\n }\n }\n\n if (typeof inline === 'object') {\n return {\n left: inline.start ?? 0,\n right: inline.end ?? 0,\n }\n }\n\n return { left: 0, right: 0 }\n}","import { SnappingMode, Padding, PaddingValue } from '@components'\nimport { parsePadding } from '@/utils/padding'\n\n/**\n * Calculates spacing adjustments to maintain baseline grid alignment.\n *\n * @remarks\n * Provides different snapping behaviors:\n * - none: No adjustments\n * - height: Adjusts bottom padding only\n * - clamp: Adjusts both top and bottom padding\n *\n * @param height - Measured element height\n * @param base - Grid base unit\n * @param initial - Initial spacing values\n * @param snapping - Snapping mode to apply\n * @returns Adjusted spacing values\n *\n * @example\n * ```ts\n * // Height snapping mode\n * calculateSnappedSpacing(46, 8, { top: 10, bottom: 10 }, 'height')\n * // => { top: 10, right: 0, bottom: 12, left: 0 }\n *\n * // Clamp mode\n * calculateSnappedSpacing(45, 8, { top: 10, bottom: 6 }, 'clamp')\n * // => { top: 2, right: 0, bottom: 1, left: 0 }\n * ```\n */\nexport function calculateSnappedSpacing(\n height: number,\n base: number,\n initial: PaddingValue,\n snapping: SnappingMode,\n): Padding {\n const pad: Padding = parsePadding({ padding: initial })\n\n if (snapping === 'none') {\n return pad\n }\n\n if (snapping === 'height') {\n const remainder = height % base\n if (remainder !== 0) {\n pad.bottom += base - remainder\n }\n }\n\n if (snapping === 'clamp') {\n pad.top = pad.top % base\n const remainder = height % base\n if (remainder !== 0) {\n pad.bottom += base - remainder\n }\n pad.bottom = pad.bottom % base\n }\n\n return pad\n}","/**\n * @file grid.ts\n * @description Grid layout utilities\n * @module utils\n */\n\nimport * as React from 'react'\n\n/**\n * Creates grid span styles based on span props.\n * Handles both combined span and individual col/row span values.\n *\n * @param span - Optional equal span for both rows and columns\n * @param colSpan - Optional column span value\n * @param rowSpan - Optional row span value \n * @returns CSS properties object with grid span values\n * \n * @example\n * ```ts\n * createGridSpanStyles(2) // => { gridColumn: \"span 2\", gridRow: \"span 2\" }\n * createGridSpanStyles(undefined, 3, 2) // => { gridColumn: \"span 3\", gridRow: \"span 2\" }\n * ```\n */\nexport const createGridSpanStyles = (\n span?: number,\n colSpan?: number,\n rowSpan?: number\n): React.CSSProperties => {\n const gridStyles: React.CSSProperties = {}\n \n if (span !== undefined) {\n gridStyles.gridColumn = `span ${span}`\n gridStyles.gridRow = `span ${span}`\n } else {\n if (colSpan !== undefined) {\n gridStyles.gridColumn = `span ${colSpan}`\n }\n if (rowSpan !== undefined) {\n gridStyles.gridRow = `span ${rowSpan}`\n }\n }\n \n return gridStyles\n} ","import * as React from 'react'\n\n/**\n * Combines class names, filtering out falsy values.\n *\n * @remarks\n * - Filters out false, null, undefined\n * - Trims whitespace\n * - Preserves order of classes\n *\n * @param classes - Array of potential class names\n * @returns Combined class string\n *\n * @example\n * ```ts\n * mergeClasses('btn', isActive && 'active', undefined)\n * // => \"btn active\"\n * ```\n */\nexport const mergeClasses = (\n ...classes: Array<string | boolean | undefined | null>\n): string => classes.filter(Boolean).join(' ').trim()\n\n/**\n * Combines multiple style objects with type safety.\n *\n * @remarks\n * - Preserves type information\n * - Handles undefined values\n * - Merges deeply nested styles\n *\n * @param styles - Array of style objects\n * @returns Combined style object\n *\n * @example\n * ```ts\n * mergeStyles(\n * { color: 'red' },\n * isLarge && { fontSize: '2em' },\n * customStyles\n * )\n * ```\n */\nexport const mergeStyles = <T extends React.CSSProperties>(\n ...styles: Array<T | undefined>\n): T => Object.assign({}, ...styles.filter((style): style is T => style !== undefined))\n\n/**\n * Assigns a value to a React ref.\n */\nfunction assignRef<T>(ref: React.Ref<T> | null | undefined, node: T | null): void {\n if (!ref) return\n if (typeof ref === 'function') {\n ref(node)\n } else {\n try {\n Object.assign(ref, { current: node })\n } catch (error) {\n console.error('Error assigning ref:', error)\n }\n }\n}\n\n/**\n * Merges multiple React refs into a single callback ref.\n *\n * @remarks\n * Handles:\n * - Function refs\n * - Object refs\n * - Undefined/null refs\n *\n * @param refs - Array of refs to merge\n * @returns Combined ref callback\n *\n * @example\n * ```tsx\n * const Component = React.forwardRef((props, ref) => {\n * const localRef = useRef(null);\n * const combinedRef = mergeRefs(ref, localRef);\n *\n * return <div ref={combinedRef} />;\n * });\n * ```\n */\nexport function mergeRefs<T>(\n ...refs: Array<React.Ref<T> | null | undefined>\n): React.RefCallback<T> {\n return (node: T | null) => {\n refs.forEach(ref => {\n assignRef(ref, node)\n })\n }\n}\n\n/**\n * Parameters for creating a style override\n */\nexport type StyleOverrideParams = {\n /** CSS variable key to potentially override */\n key: string;\n /** Value to use if override is needed */\n value: string;\n /** Default styles to compare against */\n defaultStyles: Record<string, string>;\n /** Special case dimensions that should be skipped for specific values */\n skipDimensions?: {\n /** Dimensions that should be skipped when they're set to \"fit-content\" */\n fitContent?: string[];\n /** Dimensions that should be skipped when they're set to \"auto\" */\n auto?: string[];\n /** Dimensions that should be skipped when they're set to % values (like \"100%\") */\n fullSize?: string[];\n };\n}\n\n/**\n * Creates style overrides for CSS variables, conditionally based on comparison to defaults.\n * Only applies overrides when the value differs from the default, optimizing style objects.\n *\n * @param params - Style override parameters or individual arguments\n * @param value\n * @param defaultStyles\n * @returns Style object with override (if needed)\n *\n * @example\n * ```ts\n * // Object parameter style:\n * createStyleOverride({\n * key: '--color',\n * value: 'red',\n * defaultStyles: { '--color': 'blue' }\n * })\n * // => { '--color': 'red' }\n *\n * // With dimension skipping:\n * createStyleOverride({\n * key: '--width',\n * value: 'fit-content',\n * defaultStyles: { '--width': 'auto' },\n * skipDimensions: { fitContent: ['--width', '--height'] }\n * })\n * // => {}\n *\n * // Legacy style with separate arguments:\n * createStyleOverride('--color', 'red', { '--color': 'blue' })\n * // => { '--color': 'red' }\n * ```\n */\nexport function createStyleOverride(\n params: StyleOverrideParams | string,\n value?: string,\n defaultStyles?: Record<string, string>,\n): Record<string, string | number> {\n // Handle both object parameter and individual arguments for backward compatibility\n const key = typeof params === 'string' ? params : params.key\n const val = typeof params === 'string' ? value! : params.value\n const defaults = typeof params === 'string' ? defaultStyles! : params.defaultStyles\n const skipDimensions = typeof params === 'object' ? params.skipDimensions : undefined\n\n // Skip dimensions based on specific values\n if (skipDimensions) {\n // Skip 'fit-content' dimensions (Box, Spacer patterns)\n if (skipDimensions.fitContent?.includes(key) && val === 'fit-content') {\n return {}\n }\n\n // Skip 'auto' dimensions (Stack, Layout patterns)\n if (skipDimensions.auto?.includes(key) && val === 'auto') {\n return {}\n }\n\n // Skip '100%' or '100vh/vw' dimensions (Guide, some Spacer patterns)\n if (skipDimensions.fullSize?.includes(key) &&\n (val === '100%' || val === '100vh' || val === '100vw')) {\n return {}\n }\n }\n\n // Only apply override if value differs from default\n return val !== defaults[key] ? { [key]: val } : {}\n}","/**\n * Creates a debounced version of a function.\n *\n * @remarks\n * Useful for:\n * - Handling rapid event sequences\n * - Limiting API calls\n * - Performance optimization\n *\n * @param fn - Function to debounce\n * @param delay - Delay in milliseconds\n * @returns Debounced function\n *\n * @example\n * ```ts\n * const handleResize = debounce(() => {\n * // Expensive calculation\n * }, 100);\n *\n * window.addEventListener('resize', handleResize);\n * ```\n */\nexport const debounce = <T extends (...args: unknown[]) => void>(\n fn: T,\n delay: number,\n): [T, () => void] => {\n let timer: ReturnType<typeof setTimeout> | null = null\n\n const cancel = () => {\n if (timer) {\n clearTimeout(timer)\n timer = null\n }\n }\n\n const debounced = ((...args) => {\n cancel()\n timer = setTimeout(() => fn(...args), delay)\n }) as T\n\n return [debounced, cancel]\n}\n\n/**\n * Creates a requestAnimationFrame-based throttled function.\n *\n * @remarks\n * Optimizes performance by:\n * - Limiting execution to animation frames\n * - Preventing rapid-fire calls\n * - Maintaining visual smoothness\n *\n * @param fn - Function to throttle\n * @returns RAF-throttled function\n *\n * @example\n * ```ts\n * const updateScroll = rafThrottle(() => {\n * // Update scroll position\n * });\n *\n * document.addEventListener('scroll', updateScroll);\n * ```\n */\nexport const rafThrottle = <T extends (...args: never[]) => void>(\n fn: T,\n): T => {\n let rafId: number | null = null\n let lastArgs: Parameters<T> | null = null\n\n const throttled = (...args: Parameters<T>) => {\n lastArgs = args\n\n if (rafId !== null) {\n cancelAnimationFrame(rafId)\n }\n\n rafId = requestAnimationFrame(() => {\n fn(...lastArgs!)\n rafId = null\n lastArgs = null\n })\n }\n\n return throttled as T\n}\n","/**\n * SSR (Server-Side Rendering) utility functions for baseline-kit.\n * These functions help ensure consistent rendering between server and client.\n */\n\n/**\n * Detects if code is running in a server-side environment\n */\nexport const isSSR = typeof window === 'undefined'\n\n/**\n * Default dimensions to use during server-side rendering \n * These values provide stable rendering between server and client\n * during the initial hydration phase.\n */\nexport const SSR_DIMENSIONS = {\n width: 1024,\n height: 768\n}\n\n/**\n * Safe window-using function that works in both server and client\n * @param clientFn Function that uses window/browser APIs\n * @param fallback Fallback value to use in SSR environment\n * @returns Result of clientFn in browser, fallback in SSR\n */\nexport function safeClientValue<T>(clientFn: () => T, fallback: T): T {\n if (isSSR) {\n return fallback\n }\n \n try {\n return clientFn()\n } catch {\n return fallback\n }\n}\n\n/**\n * Returns a stable value during SSR and initial render, then switches to\n * the dynamic value after hydration\n * @param isHydrated Boolean indicating if component is hydrated\n * @param ssrValue Value to use during SSR/initial render\n * @param dynamicValue Value to use after hydration\n * @returns Appropriate value based on hydration state\n */\nexport function hydratedValue<T>(isHydrated: boolean, ssrValue: T, dynamicValue: T): T {\n return (!isHydrated || isSSR) ? ssrValue : dynamicValue\n} ","import * as React from 'react'\nimport { rafThrottle } from '@utils'\n\nexport interface MeasureResult {\n /** Measured width in pixels */\n width: number;\n /** Measured height in pixels */\n height: number;\n /** Function to force a remeasurement */\n refresh: () => void;\n}\n\n/**\n * Hook for measuring and tracking DOM element dimensions.\n *\n * Provides responsive element measurements using ResizeObserver,\n * with performance optimization (via RAF throttling), error handling,\n * and a manual refresh method.\n *\n * @param ref - Reference to the DOM element to measure\n * @returns Current dimensions and refresh function\n *\n * @example\n * ```tsx\n * function ResponsiveBox() {\n * const ref = React.useRef<HTMLDivElement>(null);\n * const { width, height, refresh } = useMeasure(ref);\n *\n * return (\n * <div ref={ref} className=\"responsive-box\">\n * Width: {width}px, Height: {height}px\n * <button onClick={refresh}>Remeasure</button>\n * </div>\n * );\n * }\n * ```\n */\nexport function useMeasure(ref: React.RefObject<HTMLElement | null>): MeasureResult {\n const [dimensions, setDimensions] = React.useState({ width: 0, height: 0 })\n\n // measure() reads getBoundingClientRect() from ref.current\n const measure = React.useCallback(() => {\n if (!ref.current) return\n try {\n const rect = ref.current.getBoundingClientRect()\n const next = {\n width: rect ? Math.round(rect.width) : 0,\n height: rect ? Math.round(rect.height) : 0,\n }\n setDimensions(prev =>\n prev.width === next.width && prev.height === next.height ? prev : next,\n )\n } catch {\n setDimensions({ width: 0, height: 0 })\n }\n }, [ref])\n\n // Create a throttled version of measure using RAF.\n const refresh = React.useMemo(() => rafThrottle(measure), [measure])\n\n // On mount (or when ref changes) perform an immediate measurement.\n React.useLayoutEffect(() => { measure() }, [measure])\n\n // Set up a ResizeObserver on mount.\n React.useLayoutEffect(() => {\n if (!ref.current) return\n const observer = new ResizeObserver(() => {\n refresh()\n })\n observer.observe(ref.current)\n return () => {\n observer.disconnect()\n }\n }, [ref, refresh])\n\n return { ...dimensions, refresh }\n}\n","import { RefObject, useCallback, useLayoutEffect, useMemo, useState } from 'react'\nimport { rafThrottle } from '@utils'\n\ntype VirtualResult = {\n /** Total number of items/lines to virtualize */\n totalLines: number;\n /** Height of each item in pixels */\n lineHeight: number;\n /** Reference to the scrollable container */\n containerRef: RefObject<HTMLDivElement | null>;\n /** Additional items to render above/below viewport */\n buffer?: number | string;\n}\n\n/**\n * Hook for optimizing large lists through virtual scrolling.\n *\n * @remarks\n * This hook helps manage virtual scrolling by:\n * - Calculating visible item ranges\n * - Handling scroll events efficiently\n * - Managing buffer zones for smooth scrolling\n * - Supporting dynamic container sizes\n *\n * Performance optimizations:\n * - RAF-based scroll handling\n * - Intersection Observer for visibility\n * - Buffer zones to prevent flicker\n * - Efficient range calculations\n *\n * @param options - Virtual scrolling configuration\n * @returns Object containing start and end indices of visible items\n *\n * @example\n * ```tsx\n * function VirtualList() {\n * const containerRef = useRef<HTMLDivElement>(null);\n * const { start, end } = useVirtual({\n * totalLines: 1000,\n * lineHeight: 30,\n * containerRef,\n * buffer: 5\n * });\n *\n * return (\n * <div ref={containerRef} className=\"scroll-container\">\n * <div style={{ height: 1000 * 30 }}>\n * {items.slice(start, end).map(item => (\n * <div key={item.id} style={{ height: 30 }}>\n * {item.content}\n * </div>\n * ))}\n * </div>\n * </div>\n * );\n * }\n * ```\n */\nexport function useVirtual({\n totalLines,\n lineHeight,\n containerRef,\n buffer = 0,\n}: VirtualResult) {\n // Convert buffer to numeric value\n const numericBuffer = useMemo(() =>\n typeof buffer === 'number' ? buffer : parseInt(buffer, 10) || 0\n , [buffer])\n\n /**\n * Calculates the visible range of items based on scroll position\n * and viewport dimensions.\n */\n const calculateRange = useCallback(() => {\n const element = containerRef.current\n if (!element) return { start: 0, end: totalLines }\n\n // Show all lines if container is inside .content-block\n if (element.closest('.block')) {\n return { start: 0, end: totalLines }\n }\n\n // Calculate visible range\n const rect = element.getBoundingClientRect()\n const offsetTop = rect.top + window.scrollY\n const viewportTop = Math.max(0, window.scrollY - offsetTop - numericBuffer)\n const viewportBottom = viewportTop + window.innerHeight + numericBuffer * 2\n\n const start = Math.max(0, Math.floor(viewportTop / lineHeight))\n const end = Math.min(totalLines, Math.ceil(viewportBottom / lineHeight))\n\n return { start, end }\n }, [totalLines, lineHeight, containerRef, numericBuffer])\n\n const [visibleRange, setVisibleRange] = useState(calculateRange)\n\n // Subscribe to window events using our helper\n useWindowEvents(['scroll', 'resize'], () => {\n updateRangeThrottled()\n })\n\n\n // Throttle updates for performance\n const updateRange = useCallback(() => {\n setVisibleRange(prev => {\n const next = calculateRange()\n return prev.start !== next.start || prev.end !== next.end ? next : prev\n })\n }, [calculateRange])\n\n const updateRangeThrottled = useMemo(() => rafThrottle(updateRange), [updateRange])\n\n useLayoutEffect(() => {\n const element = containerRef.current\n if (!element) return\n\n // Use IntersectionObserver for visibility tracking\n const observer = new IntersectionObserver(updateRangeThrottled, { threshold: 0 })\n observer.observe(element)\n updateRangeThrottled()\n\n return () => {\n observer.disconnect()\n }\n }, [containerRef, calculateRange, updateRangeThrottled])\n\n return visibleRange\n}\n\n/** Helper hook to manage multiple window event listeners. */\nfunction useWindowEvents(events: string[], handler: () => void) {\n const stableHandler = useCallback(handler, [handler])\n\n useLayoutEffect(() => {\n const wrappedHandler = () => stableHandler()\n events.forEach(evt => window.addEventListener(evt, wrappedHandler))\n return () => events.forEach(evt => window.removeEventListener(evt, wrappedHandler))\n }, [events, stableHandler])\n}\n\n","import * as React from 'react'\nimport { useMeasure } from './useMeasure'\nimport { calculateSnappedSpacing } from '@utils'\nimport type { SnappingMode, Padding } from '@components'\nimport { parsePadding } from '@utils'\n\nexport interface BaselineOptions {\n /* Base unit for alignment (default 8). */\n base?: number\n /** Snapping strategy: 'none' | 'height' | 'clamp'. */\n snapping?: SnappingMode\n /** Initial padding config. e.g. { top: 10, bottom: 20 } or just 8, etc. */\n spacing?: Partial<Padding> | number\n /** Whether to warn in the console if the measured height is not a multiple of base. */\n warnOnMisalignment?: boolean\n}\n\nexport interface BaselineResult {\n padding: Padding\n isAligned: boolean\n height: number\n}\n\n/**\n * Hook for managing baseline grid alignment in components.\n *\n * @remarks\n * This hook handles the complex calculations needed to maintain baseline grid\n * alignment, including:\n * ▪\tMeasuring element dimensions\n * ▪\tCalculating padding adjustments\n * ▪\tPotentially snapping values to ensure multiples of the base\n * ▪\tWarning about misalignments in development\n *\n * Different snapping modes affect how spacing is adjusted:\n * ▪\t'none': Uses raw spacing values without adjustment\n * ▪\t'height': Adjusts only the final (bottom) padding to align\n * ▪\t'clamp': Adjusts top and bottom to align\n *\n * @param ref Reference to the DOM element\n * @param options Configuration options for alignment behavior\n * @returns Object with adjusted padding, alignment status, and height\n *\n * @example\n * ```tsx\n * export function MyComponent() {\n * const ref = useRef<HTMLDivElement>(null)\n * const { padding } = useBaseline(ref, {\n * base: 8,\n * snapping: 'height',\n * spacing: {\n * top: 16,\n * bottom: 16\n * }\n * }}\n * >\n * Content\n * </div>\n * )\n * }\n */\nexport function useBaseline(\n ref: React.RefObject<HTMLElement | null>,\n {\n base = 8,\n snapping = 'none',\n spacing = {},\n warnOnMisalignment = false,\n }: BaselineOptions = {},\n): BaselineResult {\n if (base < 1) {\n throw new Error('Base must be >= 1 for baseline alignment.')\n }\n\n const { height } = useMeasure(ref)\n // Track whether we've already snapped once for this component.\n const didSnapRef = React.useRef<boolean>(false)\n const hasWarnedRef = React.useRef<boolean>(false)\n\n return React.useMemo(() => {\n // Convert the spacing prop into { top, right, bottom, left } numeric values.\n const initialPadding = parsePadding({ padding: spacing })\n const isAligned = height % base === 0\n\n // Log the warning only once\n if (!isAligned && warnOnMisalignment && process.env.NODE_ENV === 'development') {\n if (!hasWarnedRef.current) {\n console.warn(\n `[useBaseline] Element height (${height}px) is not aligned with base (${base}px).`,\n )\n hasWarnedRef.current = true // Mark warning as logged\n }\n }\n\n // If snapping is disabled, just return the original padding.\n if (snapping === 'none') {\n return { padding: initialPadding, isAligned, height }\n }\n\n // If we've already snapped once, just reuse the original (or store the\n // snapped result in a ref if you prefer).\n if (didSnapRef.current) {\n return { padding: initialPadding, isAligned, height }\n }\n\n // Snap exactly once.\n const finalPadding = calculateSnappedSpacing(height, base, initialPadding, snapping)\n didSnapRef.current = true\n\n return { padding: finalPadding, isAligned, height }\n }, [base, snapping, spacing, warnOnMisalignment, height])\n}\n","import * as React from 'react'\nimport { GuideConfig, GuideColumnsPattern, isValidGuidePattern } from '@components'\nimport { formatValue, convertValue, normalizeValue } from '@utils'\nimport { useMeasure } from './useMeasure'\n\nexport interface GuideResult {\n /** CSS grid template string */\n template: string;\n /** Total number of columns */\n columnsCount: number;\n /** Final gap size in pixels */\n calculatedGap: number;\n /** Whether the configuration is valid */\n isValid: boolean;\n}\n\n/**\n * Hook for calculating grid layout parameters based on container dimensions.\n *\n * @remarks\n * This hook handles complex grid calculations for different layout variants:\n * - 'line': Evenly spaced vertical lines\n * - 'pattern': Custom repeating column patterns\n * - 'fixed': Set number of columns with optional width\n * - 'auto': Dynamic columns based on available space\n *\n * Key features:\n * - Responsive grid calculations\n * - Pattern validation\n * - Gap management\n * - Error handling\n *\n * @param ref - Reference to container element\n * @param config - Grid configuration object\n * @returns Grid calculation results\n *\n * @example\n * ```tsx\n * function GridOverlay() {\n * const ref = useRef<HTMLDivElement>(null);\n * const { template, columnsCount } = useGuide(ref, {\n * variant: 'fixed',\n * columns: 12,\n * gap: 16,\n * base: 8\n * });\n *\n * return (\n * <div\n * ref={ref}\n * style={{\n * display: 'grid',\n * gridTemplateColumns: template,\n * gap: calculatedGap\n * }}\n * >\n * {Array(columnsCount).fill(null).map((_, i) => (\n * <div key={i} className=\"grid-line\" />\n * ))}\n * </div>\n * );\n * }\n * ```\n */\nexport function useGuide(\n ref: React.RefObject<HTMLElement | null>,\n config: GuideConfig,\n): GuideResult {\n const { width } = useMeasure(ref)\n const hasWarnedRef = React.useRef<boolean>(false) // Track if warning has been logged\n\n return React.useMemo(() => {\n // Default values\n const variant = config.variant ?? 'line'\n const base = config.base ?? 8\n // Normalize the gap using the base value\n const gap = normalizeValue(config.gap ?? 0, { base })\n\n // Return invalid result if no width\n if (!width) {\n return {\n template: 'none',\n columnsCount: 0,\n calculatedGap: 0,\n isValid: false,\n }\n }\n\n try {\n switch (variant) {\n case 'line': {\n // Simple vertical lines\n const columns = Math.max(1, Math.floor(width / (gap + 1)) + 1)\n return {\n template: `repeat(${columns}, 1px)`,\n columnsCount: columns,\n calculatedGap: gap,\n isValid: true,\n }\n }\n\n case 'pattern': {\n // Custom column pattern\n if (!isValidGuidePattern(config.columns)) {\n throw new Error('Invalid \"pattern\" columns array')\n }\n const columnsArr = (config.columns as GuideColumnsPattern).map(col => {\n if (typeof col === 'number') return `${col}px`\n return col\n })\n\n // Validate no zero widths\n if (columnsArr.some(c => c === '0' || c === '0px')) {\n return {\n template: 'none',\n columnsCount: 0,\n calculatedGap: 0,\n isValid: false,\n }\n }\n\n return {\n template: columnsArr.join(' '),\n columnsCount: columnsArr.length,\n calculatedGap: gap,\n isValid: true,\n }\n }\n\n case 'fixed': {\n // Fixed number of columns\n const colCount = typeof config.columns === 'number' ? config.columns : 0\n if (colCount < 1) {\n throw new Error(`Invalid columns count: ${colCount}`)\n }\n const colWidth = config.columnWidth\n ? formatValue(config.columnWidth)\n : '1fr'\n\n return {\n template: `repeat(${colCount}, ${colWidth})`,\n columnsCount: colCount,\n calculatedGap: gap,\n isValid: true,\n }\n }\n\n case 'auto': {\n // Auto-fitting columns\n const colWidth = config.columnWidth ?? 'auto'\n if (colWidth === 'auto') {\n return {\n template: 'repeat(auto-fit, minmax(0, 1fr))',\n columnsCount: 1,\n calculatedGap: gap,\n isValid: true,\n }\n }\n const colWidthStr =\n typeof colWidth === 'number' ? `${colWidth}px` : colWidth.toString()\n\n const pxVal = convertValue(colWidthStr) ?? 0\n const columns = pxVal > 0\n ? Math.max(1, Math.floor((width + gap) / (pxVal + gap)))\n : 1\n\n return {\n template: `repeat(auto-fit, minmax(${colWidthStr}, 1fr))`,\n columnsCount: columns,\n calculatedGap: gap,\n isValid: true,\n }\n }\n\n default: {\n if (!hasWarnedRef.current) {\n console.warn(\n `[useGuide] Unknown variant \"${variant}\". Falling back to \"line\".`,\n )\n hasWarnedRef.current = true // Mark warning as logged\n }\n const columns = Math.max(1, Math.floor(width / (gap + 1)) + 1)\n return {\n template: `repeat(${columns}, 1px)`,\n columnsCount: columns,\n calculatedGap: gap,\n isValid: true,\n }\n }\n }\n } catch (error) {\n console.warn('Error in useGuide:', error)\n return {\n template: 'none',\n columnsCount: 0,\n calculatedGap: 0,\n isValid: false,\n }\n }\n }, [config, width])\n}\n","import { useMemo } from 'react'\nimport { Config, useDefaultConfig } from '@components'\n\n/** Type helper that merges base configuration with component-specific settings. */\nexport type ComponentConfig<K extends keyof Config> = Config[K] & {\n /** Base unit for spacing calculations */\n base: number\n}\n\n/**\n * Hook for accessing component-specific theme configuration.\n *\n * @remarks\n * This hook provides:\n * - Access to component-specific theme settings\n * - Automatic base unit inheritance\n * - Memoized configuration to prevent unnecessary updates\n * - Type-safe configuration access\n *\n * It merges:\n * - Global base unit settings\n * - Component-specific configurations\n * - Theme-based color schemes\n *\n * @param component - Name of the component requesting configuration\n * @returns Merged configuration for the specific component\n *\n * @example\n * ```tsx\n * function Box() {\n * const config = useConfig('box');\n *\n * return (\n * <div style={{\n * '--box-base': `${config.base}px`,\n * '--box-color': config.colors.line\n * }}>\n * {children}\n * </div>\n * );\n * }\n * ```\n */\nexport function useConfig<K extends keyof Config>(component: K): ComponentConfig<K> {\n const defaultConfig = useDefaultConfig()\n return useMemo(() => {\n return Object.assign(\n { base: defaultConfig.base },\n defaultConfig[component],\n ) as ComponentConfig<K>\n }, [defaultConfig, component])\n}","import { useMemo } from 'react'\nimport { DebuggingMode } from '../components/Config/Config'\n\ninterface DebugResult {\n /** Whether debug visuals should be shown */\n isShown: boolean;\n /** Whether debug features exist but are hidden */\n isHidden: boolean;\n /** Whether debug features are disabled */\n isNone: boolean;\n /** Current debugging mode */\n debugging: DebuggingMode | undefined;\n}\n\n/**\n * Hook for managing component debug state and visibility.\n *\n * @remarks\n * Determines the active debugging mode by:\n * - Using prop value if provided\n * - Falling back to config value if prop is undefined\n * - Computing visibility states based on active mode\n *\n * This hook helps components:\n * - Control debug visual rendering\n * - Manage debug feature states\n * - Handle prop/config inheritance\n *\n * @param debuggingProp - Optional debugging mode from props\n * @param debuggingConfig - Debugging mode from theme/config\n * @returns Debug state information\n *\n * @example\n * ```tsx\n * function DebugComponent({ debugging: debugProp }) {\n * const { isShown, isHidden, isNone } = useDebug(\n * debugProp,\n * 'hidden' // Default from config\n * );\n *\n * return (\n * <div>\n * {isShown && <DebugOverlay />}\n * {!isNone && <DebugFeatures />}\n * <Content />\n * </div>\n * );\n * }\n * ```\n */\nexport function useDebug(\n debuggingProp?: DebuggingMode,\n debuggingConfig?: DebuggingMode,\n): DebugResult {\n return useMemo(() => {\n const effective = debuggingProp ?? debuggingConfig\n return {\n isShown: effective === 'visible',\n isHidden: effective === 'hidden',\n isNone: effective === 'none',\n debugging: effective,\n }\n }, [debuggingProp, debuggingConfig])\n}","/**\n * @file defaults.ts\n * @description Default theme and configuration values for baseline-kit\n * @module baseline-kit/components/Config\n */\n\nimport type { Config } from './Config'\n\n/**\n * CSS variable-based color configuration for Guide component.\n * Maps each guide variant to its theme color.\n */\nconst GUIDE_COLORS = {\n /** Color for single-line guides */\n line: 'var(--bk-guide-color-line-theme)',\n /** Color for pattern-based guides */\n pattern: 'var(--bk-guide-color-pattern-theme)',\n /** Color for auto-calculated guides */\n auto: 'var(--bk-guide-color-auto-theme)',\n /** Color for fixed-column guides */\n fixed: 'var(--bk-guide-color-fixed-theme)',\n} as const\n\n/**\n * CSS variable-based color configuration for Baseline component.\n */\nconst BASELINE_COLORS = {\n /** Color for line variant */\n line: 'var(--bk-baseline-color-line-theme)',\n /** Color for flat/block variant */\n flat: 'var(--bk-baseline-color-flat-theme)',\n} as const\n\n/**\n * CSS variable-based color configuration for Spacer component.\n */\nconst SPACER_COLORS = {\n /** Color for line-style spacers */\n line: 'var(--bk-spacer-color-line-theme)',\n /** Color for flat/block spacers */\n flat: 'var(--bk-spacer-color-flat-theme)',\n /** Color for measurement indicators */\n text: 'var(--bk-spacer-color-text-theme)',\n} as const\n\n/**\n * CSS variable-based color configuration for Box component.\n */\nconst BOX_COLORS = {\n /** Border color for debug outline */\n line: 'var(--bk-box-color-line-theme)',\n /** Background color for debug mode */\n flat: 'var(--bk-box-color-flat-theme)',\n /** Color for measurement indicators */\n text: 'var(--bk-box-color-text-theme)',\n} as const\n\n/**\n * CSS variable-based color configuration for Stack/Flex component.\n */\nconst STACK_COLORS = {\n /** Border color for debug outline */\n line: 'var(--bk-stack-color-line-theme)',\n /** Background color for debug mode */\n flat: 'var(--bk-stack-color-flat-theme)',\n /** Color for measurement indicators */\n text: 'var(--bk-stack-color-text-theme)',\n} as const\n\n/**\n * CSS variable-based color configuration for Layout component.\n */\nconst LAYOUT_COLORS = {\n /** Border color for debug outline */\n line: 'var(--bk-layout-color-line-theme)',\n /** Background color for debug mode */\n flat: 'var(--bk-layout-color-flat-theme)',\n /** Color for measurement indicators */\n text: 'var(--bk-layout-color-text-theme)',\n} as const\n\n/** CSS variable for Padder component color */\nconst PADDER_COLOR = 'var(--bk-padder-color-theme)'\n\n/**\n * Default configuration for baseline-kit.\n *\n * @remarks\n * Provides the base configuration for all components including:\n * - Base unit for spacing calculations (8px default)\n * - Default component variants\n * - Initial debugging modes\n * - Theme color assignments\n *\n * Each component section includes:\n * - Visual variant selection (where applicable)\n * - Debugging mode setting\n * - Color theme assignments\n *\n * The configuration is marked as const to ensure type safety\n * and prevent accidental modifications.\n */\nexport const DEFAULT_CONFIG: Config = {\n /** Base unit for spacing calculations (in pixels) */\n base: 8,\n\n /** Baseline grid configuration */\n baseline: {\n variant: 'line',\n debugging: 'hidden',\n colors: BASELINE_COLORS,\n },\n\n /** Guide overlay configuration */\n guide: {\n variant: 'line',\n debugging: 'hidden',\n colors: GUIDE_COLORS,\n },\n\n /** Spacer component configuration */\n spacer: {\n variant: 'line',\n debugging: 'hidden',\n colors: SPACER_COLORS,\n },\n\n /** Box component configuration */\n box: {\n debugging: 'hidden',\n colors: BOX_COLORS,\n },\n\n /** Stack/Flex component configuration */\n stack: {\n debugging: 'hidden',\n colors: STACK_COLORS,\n },\n\n /** Layout component configuration */\n layout: {\n debugging: 'hidden',\n colors: LAYOUT_COLORS,\n },\n\n /** Padder component configuration */\n padder: {\n debugging: 'hidden',\n color: PADDER_COLOR,\n },\n} as const","import * as React from 'react'\nimport { BaselineVariant } from '@/components'\nimport { DEFAULT_CONFIG } from './defaults'\nimport type { GuideVariant, Variant } from '../types'\n\n/**\n * Controls component debugging visibility and behavior.\n *\n * @remarks\n * - `none`: Debug features are fully disabled\n * - `hidden`: Debug elements exist in DOM but are not visible\n * - `visible`: Debug elements are fully rendered and visible\n */\nexport type DebuggingMode = 'none' | 'hidden' | 'visible'\n\n/** Color configuration for component themes. */\ntype Colors = {\n /** Color for line-based visuals */\n line: string;\n /** Color for flat surface visuals */\n flat: string;\n /** Color for measurement indicators */\n text: string;\n}\n\n/** Complete configuration schema for baseline-kit. */\nexport type Config = {\n /** Base unit for spacing calculations */\n base: number;\n /** Guide component configuration */\n guide: {\n variant: GuideVariant;\n debugging: DebuggingMode;\n colors: Record<GuideVariant, string>;\n };\n /** Baseline component configuration */\n baseline: {\n variant: BaselineVariant;\n debugging: DebuggingMode;\n colors: Record<BaselineVariant, string>;\n };\n /** Stack component configuration */\n stack: {\n colors: Colors;\n debugging: DebuggingMode;\n };\n /** Layout component configuration */\n layout: {\n colors: Colors;\n debugging: DebuggingMode;\n };\n /** Spacer component configuration */\n spacer: {\n variant: Variant;\n debugging: DebuggingMode;\n colors: Colors;\n };\n /** Box component configuration */\n box: {\n colors: Colors;\n debugging: DebuggingMode;\n };\n /** Padder component configuration */\n padder: {\n color: string;\n debugging: DebuggingMode;\n };\n}\n\n// Create the context\nconst ConfigContext = React.createContext<Config>(DEFAULT_CONFIG)\nConfigContext.displayName = 'ConfigContext'\n\n// Update to use React 19's use hook instead of useContext\nexport const useDefaultConfig = () => React.use(ConfigContext)\n\ntype ConfigProps = {\n children: React.ReactNode;\n /** Base unit for spacing calculations */\n base?: number;\n /** Baseline component overrides */\n baseline?: Partial<Config['baseline']>;\n /** Flex component overrides */\n stack?: Partial<Config['stack']>;\n /** Layout component overrides */\n layout?: Partial<Config['layout']>;\n /** Guide component overrides */\n guide?: Partial<Config['guide']>;\n /** Spacer component overrides */\n spacer?: Partial<Config['spacer']>;\n /** Box component overrides */\n box?: Partial<Config['box']>;\n /** Padder component overrides */\n padder?: Partial<Config['padder']>;\n}\n\n// Utils -----------------------------------------------------------------------\n\n/** Parameters for creating CSS variables */\ntype CSSVariablesParams = {\n /** Base unit for spacing calculations */\n base: number;\n /** Baseline component configuration */\n baseline: Config['baseline'];\n /** Guide component configuration */\n guide: Config['guide'];\n /** Stack component configuration */\n stack: Config['stack'];\n /** Spacer component configuration */\n spacer: Config['spacer'];\n /** Layout component configuration */\n layout: Config['layout'];\n /** Box component configuration */\n box: Config['box'];\n /** Padder component configuration */\n padder: Config['padder'];\n}\n\n/** \n * Creates CSS variables from the configuration object.\n * These variables are used throughout the component library.\n */\nexport const createCSSVariables = (\n params: CSSVariablesParams\n): Record<string, string> => {\n const {\n base,\n baseline,\n guide,\n stack,\n spacer,\n layout,\n box,\n padder,\n } = params\n\n return {\n '--bkb': `${base}px`,\n\n // Baseline Colors\n '--bkbcl': baseline.colors.line,\n '--bkbcf': baseline.colors.flat,\n\n // Guide Colors\n '--bkgcl': guide.colors.line,\n '--bkgcp': guide.colors.pattern,\n '--bkgca': guide.colors.auto,\n '--bkgcf': guide.colors.fixed,\n\n // Spacer Colors\n '--bkscl': spacer.colors.line,\n '--bkscf': spacer.colors.flat,\n '--bksci': spacer.colors.text,\n\n // Box Colors\n '--bkxcl': box.colors.line,\n '--bkxcf': box.colors.flat,\n '--bkxci': box.colors.text,\n\n // Flex Colors\n '--bkkcl': stack.colors.line,\n '--bkkcf': stack.colors.flat,\n '--bkkci': stack.colors.text,\n\n // Layout Colors\n '--bklcl': layout.colors.line,\n '--bklcf': layout.colors.flat,\n '--bklci': layout.colors.text,\n\n // Padder Color\n '--bkpc': padder.color,\n }\n}\n\n/** Parameters for merging configuration */\ntype MergeConfigParams = {\n /** Parent configuration to extend */\n parentConfig: Config;\n /** Base unit override */\n base?: number;\n /** Baseline component overrides */\n baseline?: Partial<Config['baseline']>;\n /** Guide component overrides */\n guide?: Partial<Config['guide']>;\n /** Spacer component overrides */\n spacer?: Partial<Config['spacer']>;\n /** Box component overrides */\n box?: Partial<Config['box']>;\n /** Stack component overrides */\n stack?: Partial<Config['stack']>;\n /** Layout component overrides */\n layout?: Partial<Config['layout']>;\n /** Padder component overrides */\n padder?: Partial<Config['padder']>;\n}\n\n/** \n * Merges parent config with overrides.\n * Creates a new config object without mutating the parent.\n */\nexport const mergeConfig = (params: MergeConfigParams): Config => {\n const {\n parentConfig,\n base,\n baseline,\n guide,\n spacer,\n box,\n stack,\n layout,\n padder,\n } = params\n\n return {\n base: base ?? parentConfig.base,\n baseline: { ...parentConfig.baseline, ...baseline },\n guide: { ...parentConfig.guide, ...guide },\n spacer: { ...parentConfig.spacer, ...spacer },\n box: { ...parentConfig.box, ...box },\n stack: { ...parentConfig.stack, ...stack },\n layout: { ...parentConfig.layout, ...layout },\n padder: { ...parentConfig.padder, ...padder },\n }\n}\n\n/**\n * Configuration provider for baseline-kit components.\n *\n * @remarks\n * Config provides theme and debugging settings to all nested components.\n * It allows for:\n * - Global base unit configuration\n * - Component-specific color themes\n * - Debug mode control\n * - Visual style customization\n *\n * Configs can be nested to override settings for specific sections.\n *\n * @example\n * ```tsx\n * // Basic global configuration\n * <Config base={8}>\n * <App />\n * </Config>\n *\n * // Component-specific overrides\n * <Config\n * base={8}\n * guide={{\n * debugging: \"visible\",\n * colors: {\n * line: \"rgba(255,0,0,0.2)\",\n * pattern: \"rgba(0,0,255,0.2)\"\n * }\n * }}\n * >\n * <Layout>...</Layout>\n * </Config>\n *\n * // Nested configurations\n * <Config base={8}>\n * <div>Uses 8px base</div>\n * <Config base={4}>\n * <div>Uses 4px base</div>\n * </Config>\n * </Config>\n * ```\n */\nexport function Config({\n children,\n base,\n stack,\n baseline,\n guide,\n layout,\n spacer,\n box,\n padder,\n}: ConfigProps) {\n const parentConfig = useDefaultConfig()\n\n const value = React.useMemo(() => {\n return mergeConfig({\n parentConfig,\n base,\n baseline,\n guide,\n spacer,\n box,\n stack,\n layout,\n padder,\n })\n }, [\n parentConfig,\n base,\n baseline,\n guide,\n spacer,\n box,\n stack,\n layout,\n padder,\n ])\n\n return (\n <ConfigContext value={value}>\n {children}\n </ConfigContext>\n )\n}","import * as React from 'react'\nimport { useConfig, useDebug } from '@hooks'\nimport {\n mergeStyles,\n mergeClasses,\n formatValue,\n normalizeValuePair,\n createStyleOverride,\n hydratedValue\n} from '@utils'\nimport { ComponentsProps, Variant } from '../types'\nimport styles from './styles.module.css'\n\n// Type Definitions ------------------------------------------------------------\n\nexport type IndicatorNode = (value: number, type: 'width' | 'height') => React.ReactNode\n\nexport type SpacerProps = {\n /** Explicit width (takes precedence over block) */\n width?: React.CSSProperties['width']\n /** Explicit height (takes precedence over block) */\n height?: React.CSSProperties['height']\n /** Visual style in debug mode */\n variant?: Variant\n /** Color to use for debug visuals (overrides theme) */\n color?: string\n /** Base unit for measurements (defaults to theme value) */\n base?: number\n /** Custom content to render (for debugging info) */\n children?: React.ReactNode\n /** Custom indicator node rendering function */\n indicatorNode?: IndicatorNode\n /** Flag to enable SSR-compatible mode (simplified initial render) */\n ssrMode?: boolean\n} & ComponentsProps\n\n// Utils -----------------------------------------------------------------------\n\n/** Creates default spacer styles */\nexport const createDefaultSpacerStyles = (\n base: number,\n textColor: string,\n flatColor: string,\n lineColor: string,\n): Record<string, string> => ({\n '--bksw': '100%',\n '--bksh': '100%',\n '--bksb': `${base}px`,\n '--bksci': textColor,\n '--bkscl': lineColor,\n '--bkscf': flatColor,\n})\n\n/** Generates measurement indicators for debugging */\nexport const generateMeasurements = (\n isShown: boolean,\n indicatorNode: SpacerProps['indicatorNode'],\n normWidth: number | string,\n normHeight: number | string,\n): React.ReactNode | null => {\n if (!isShown || !indicatorNode) return null\n\n const width = typeof normWidth === 'number' ? normWidth : 0\n const height = typeof normHeight === 'number' ? normHeight : 0\n\n return (\n <>\n {height !== 0 && (\n <span key=\"height\">\n {indicatorNode(height, 'height')}\n </span>\n )}\n {width !== 0 && (\n <span key=\"width\">\n {indicatorNode(width, 'width')}\n </span>\n )}\n </>\n )\n}\n\n/**\n * Creates empty space for implementing margins, gaps, and spacing.\n *\n * @remarks\n * - Flexible sizing: Set width and height directly\n * - Normalized values: All inputs convert to base unit multiples\n * - Debug visuals: Shows spacing measurements with theming\n * - Automatic: Empty in production, visible in debug mode\n *\n * @example\n * ```tsx\n * // Fixed size spacer\n * <Spacer width={32} height={16} />\n *\n * // Percentage-based spacer with debug hints\n * <Spacer\n * width=\"50%\"\n * height={32}\n * debugging=\"visible\"\n * variant=\"line\"\n * />\n *\n * // Full-width spacer\n * <Spacer height={64} />\n * ```\n */\nexport const Spacer = React.memo(function Spacer({\n height: heightProp,\n width: widthProp,\n indicatorNode,\n debugging: debuggingProp,\n variant: variantProp,\n base: baseProp,\n color: colorProp,\n className,\n style,\n children,\n ssrMode = false,\n ...props\n}: SpacerProps) {\n const ref = React.useRef<HTMLDivElement>(null)\n const config = useConfig('spacer')\n\n const { isShown } = useDebug(debuggingProp, config.debugging)\n const variant = variantProp ?? config.variant\n const base = baseProp ?? config.base\n\n // Add hydration state tracking\n const [isHydrated, setIsHydrated] = React.useState(false)\n \n React.useEffect(() => {\n setIsHydrated(true)\n }, [])\n\n const [normWidth, normHeight] = React.useMemo(() => {\n return normalizeValuePair(\n [widthProp, heightProp],\n [0, 0],\n { base, suppressWarnings: true }\n )\n }, [widthProp, heightProp, base])\n\n // Ensure stable rendering for measurements during SSR\n const shouldShowMeasurements = hydratedValue(\n isHydrated && !ssrMode,\n false, // Don't show measurements during SSR\n isShown && (indicatorNode !== undefined)\n )\n\n // Only generate measurements after hydration\n const measurements = React.useMemo(() => {\n if (!shouldShowMeasurements) {\n return null\n }\n\n return generateMeasurements(\n isShown,\n indicatorNode,\n normWidth,\n normHeight\n )\n }, [shouldShowMeasurements, isShown, indicatorNode, normWidth, normHeight])\n\n const defaultStyles = React.useMemo(\n () =>\n createDefaultSpacerStyles(\n base,\n config.colors.text,\n config.colors.flat,\n config.colors.line,\n ),\n [base, config.colors],\n )\n\n const baseStyles = React.useMemo(() => {\n const heightValue = formatValue(normHeight || '100%')\n const widthValue = formatValue(normWidth || '100%')\n const baseValue = `${base}px`\n\n // Define dimensions that should be skipped when set to 100%\n const dimensionVars = ['--bksw', '--bksh']\n\n const customStyles = {\n ...createStyleOverride({\n key: '--bksh',\n value: heightValue,\n defaultStyles,\n skipDimensions: { fullSize: dimensionVars },\n }),\n ...createStyleOverride({\n key: '--bksw',\n value: widthValue,\n defaultStyles,\n skipDimensions: { fullSize: dimensionVars },\n }),\n // Explicitly set --bksb to ensure it is always applied\n '--bksb': baseValue,\n ...createStyleOverride({\n key: '--bksci',\n value: colorProp ?? config.colors.text,\n defaultStyles,\n }),\n ...createStyleOverride({\n key: '--bkscl',\n value: colorProp ?? config.colors.line,\n defaultStyles,\n }),\n ...createStyleOverride({\n key: '--bkscf',\n value: colorProp ?? config.colors.flat,\n defaultStyles,\n }),\n } as React.CSSProperties\n\n return mergeStyles(customStyles, style)\n }, [\n normWidth,\n normHeight,\n colorProp,\n base,\n config.colors,\n defaultStyles,\n style,\n ])\n\n return (\n <div\n ref={ref}\n data-testid=\"spacer\"\n className={mergeClasses(styles.spr, isShown && styles[variant], className)}\n data-variant={variant}\n style={baseStyles}\n {...props}\n >\n {measurements}\n {children}\n </div>\n )\n})\n","import * as React from 'react'\nimport { useConfig, useDebug, useBaseline } from '@hooks'\nimport {\n mergeClasses,\n mergeStyles,\n parsePadding,\n mergeRefs,\n formatValue,\n hydratedValue\n} from '@utils'\nimport { ComponentsProps, Variant } from '../types'\nimport { Spacer, IndicatorNode } from '../Spacer'\nimport { DebuggingMode } from '@/components'\nimport styles from './styles.module.css'\n\ntype RenderSpacerFn = (\n width: React.CSSProperties['width'],\n height: React.CSSProperties['height'],\n) => React.ReactNode\n\ntype PaddingStyles = {\n paddingBlock?: string;\n paddingInline?: string;\n [key: string]: string | undefined;\n}\n\ntype PadderProps = {\n /** Render function for custom measurement indicators */\n indicatorNode?: IndicatorNode\n /** Flag to enable SSR-compatible mode (simplified initial render) */\n ssrMode?: boolean\n children?: React.ReactNode\n} & ComponentsProps\n\n// Utils -----------------------------------------------------------------------\n\n/** Creates default container styles for Padder */\nexport const createPadderContainerStyles = (\n width: React.CSSProperties['width'],\n height: React.CSSProperties['height'],\n base: number,\n color: string,\n): Record<string, string> => {\n const stylesObj: Record<string, string> = {}\n\n // Only inject width/height if they differ from defaults\n if (width !== 'fit-content') {\n stylesObj['--bkpw'] = formatValue(width || 'fit-content')\n }\n if (height !== 'fit-content') {\n stylesObj['--bkph'] = formatValue(height || 'fit-content')\n }\n // Only inject base if it differs from theme\n if (base !== 8) {\n stylesObj['--bkpb'] = `${base}px`\n }\n // Only inject color if it differs from theme\n if (color !== 'var(--bk-padder-color-theme)') {\n stylesObj['--bkpc'] = color\n }\n\n return stylesObj\n}\n\n/** Creates padding styles when spacers are disabled */\nexport const createDirectPaddingStyles = (\n enableSpacers: boolean,\n padding: {\n top: number;\n right: number;\n bottom: number;\n left: number;\n },\n): PaddingStyles => {\n const { top, right, bottom, left } = padding\n const stylesObj: PaddingStyles = {}\n\n // When spacers are disabled (i.e. debugging === \"none\"), add direct padding styles\n if (!enableSpacers) {\n if (top > 0 || bottom > 0) {\n stylesObj.paddingBlock = `${top}px ${bottom}px`\n }\n if (left > 0 || right > 0) {\n stylesObj.paddingInline = `${left}px ${right}px`\n }\n }\n\n return stylesObj\n}\n\n/** Creates a render function for spacers */\nexport const createRenderSpacerFn = (\n variant: Variant | undefined,\n debugging: DebuggingMode | undefined,\n indicatorNode?: IndicatorNode,\n): RenderSpacerFn => {\n // Default to 'line' if variant is undefined\n const safeVariant = variant || 'line'\n // Default to 'none' if debugging is undefined\n const safeDebugging = debugging || 'none'\n\n const SpacerElement = (widthVal: React.CSSProperties['width'], heightVal: React.CSSProperties['height']) => (\n <Spacer\n variant={safeVariant}\n debugging={(heightVal === 0 || widthVal === 0) ? 'none' : safeDebugging}\n indicatorNode={indicatorNode}\n height={heightVal !== '100%' ? heightVal : undefined}\n width={widthVal !== '100%' ? widthVal : undefined}\n />\n )\n\n // Add display name to satisfy linter\n SpacerElement.displayName = 'PadderSpacer'\n\n return SpacerElement\n}\n\n/**\n * A foundational component that manages consistent padding with visual debugging.\n *\n * @remarks\n * Padder is a low-level utility that:\n * - Applies consistent padding around content\n * - Supports visual debugging of spacing\n * - Maintains baseline grid alignment\n * - Uses Spacer components for visual padding representation\n *\n * When debugging is enabled (`\"visible\"` or `\"hidden\"`), padding is represented\n * using Spacer components. When debugging is `\"none\"`, direct CSS padding is\n * applied for better performance.\n *\n * @example\n * ```tsx\n * // Basic usage\n * <Padder block={16} inline={8}>\n * <div>Content with consistent padding</div>\n * </Padder>\n *\n * // With debug visuals and custom indicators\n * <Padder\n * block={[8, 16]}\n * inline={[16, 24]}\n * debugging=\"visible\"\n * indicatorNode={(value, dim) => (\n * <span className=\"text-sm\">{dim}: {value}px</span>\n * )}\n * >\n * <div>Content with visible padding guides</div>\n * </Padder>\n *\n * // Direct padding mode\n * <Padder\n * block={16}\n * inline={24}\n * debugging=\"none\"\n * >\n * <div>Content with direct CSS padding</div>\n * </Padder>\n * ```\n */\nexport const Padder = React.memo(\n React.forwardRef<HTMLDivElement, PadderProps>(function Padder(\n {\n children,\n className,\n debugging: debuggingProp,\n height,\n indicatorNode,\n style,\n width,\n ssrMode = false,\n ...spacingProps\n },\n ref,\n ) {\n const config = useConfig('padder')\n const { variant } = useConfig('spacer')\n const initialPadding = React.useMemo(\n () => parsePadding(spacingProps),\n [spacingProps],\n )\n const { isShown, isNone, debugging } = useDebug(\n debuggingProp,\n config.debugging,\n )\n const enableSpacers = !isNone\n\n // Add hydration state tracking\n const [isHydrated, setIsHydrated] = React.useState(false)\n \n React.useEffect(() => {\n setIsHydrated(true)\n }, [])\n\n const internalRef = React.useRef<HTMLDivElement | null>(null)\n \n // Get padding calculation from useBaseline\n const baselinePadding = useBaseline(internalRef, {\n base: config.base,\n snapping: 'height',\n spacing: initialPadding,\n warnOnMisalignment: !isNone,\n })\n \n // Create stable initial padding for SSR\n const stablePadding = {\n padding: {\n top: initialPadding.top || 0,\n right: initialPadding.right || 0,\n bottom: initialPadding.bottom || 0,\n left: initialPadding.left || 0\n }\n }\n \n // Use stable padding during SSR and initial render, then switch to dynamic padding\n const { padding } = hydratedValue(\n isHydrated && !ssrMode,\n stablePadding,\n baselinePadding\n )\n\n const setRefs = mergeRefs(ref, internalRef)\n\n const containerStyles = React.useMemo(() => {\n const baseStyles = createPadderContainerStyles(\n width,\n height,\n config.base,\n config.color,\n )\n\n const paddingStyles = createDirectPaddingStyles(\n enableSpacers,\n { top: padding.top, right: padding.right, bottom: padding.bottom, left: padding.left },\n )\n\n return mergeStyles(\n { ...baseStyles, ...paddingStyles } as React.CSSProperties,\n style,\n )\n }, [\n width,\n height,\n config.base,\n config.color,\n enableSpacers,\n padding.top,\n padding.right,\n padding.bottom,\n padding.left,\n style,\n ])\n\n const renderSpacer = React.useMemo(\n () => createRenderSpacerFn(variant, debugging, indicatorNode),\n [variant, debugging, indicatorNode],\n )\n\n // When debugging is \"none\", simply return a container with direct CSS padding\n // and no additional grid/Spacer elements.\n if (!enableSpacers) {\n return (\n <div\n ref={setRefs}\n data-testid=\"padder\"\n className={mergeClasses(styles.pad, className)}\n style={containerStyles}\n >\n {children}\n </div>\n )\n }\n\n // When debugging is enabled, use a grid structure with wrapping spacer elements.\n return (\n <div\n ref={setRefs}\n data-testid=\"padder\"\n className={mergeClasses(styles.pad, isShown && styles.v, className)}\n style={containerStyles}\n >\n <>\n {/* Top spacer - spans full width */}\n {padding.top >= 0 && (\n <div style={{ gridColumn: '1 / -1' }}>\n {renderSpacer('100%', padding.top)}\n </div>\n )}\n\n {/* Left spacer */}\n {padding.left >= 0 && (\n <div style={{ gridRow: '2 / 3' }}>{renderSpacer(padding.left, '100%')}</div>\n )}\n </>\n\n {/* Main content - centered in grid */}\n <div style={{ gridRow: '2 / 3', gridColumn: '2 / 3' }}>{children}</div>\n\n <>\n {/* Right spacer */}\n {padding.right >= 0 && (\n <div style={{ gridRow: '2 / 3' }}>\n {renderSpacer(padding.right, '100%')}\n </div>\n )}\n\n {/* Bottom spacer - spans full width */}\n {padding.bottom >= 0 && (\n <div style={{ gridColumn: '1 / -1' }}>\n {renderSpacer('100%', padding.bottom)}\n </div>\n )}\n </>\n </div>\n )\n }),\n)\n","import * as React from 'react'\nimport type { Gaps } from '@components'\nimport { useConfig, useDebug, useBaseline } from '@hooks'\nimport {\n mergeStyles,\n mergeClasses,\n parsePadding,\n formatValue,\n createStyleOverride,\n hydratedValue\n} from '@utils'\nimport { Config } from '../Config'\nimport { Padder } from '../Padder'\nimport { Spacer } from '../Spacer'\nimport { ComponentsProps, Variant } from '../types'\nimport styles from './styles.module.css'\n\n// Import the IndicatorNode type from Spacer props\ntype IndicatorNode = NonNullable<React.ComponentProps<typeof Spacer>['indicatorNode']>\n\nexport type LayoutProps = {\n /**\n * Grid column definition. Supports:\n * - Number: Equal columns (3 → repeat(3, 1fr))\n * - String: Raw template (\"1fr auto 200px\")\n * - Array: Mixed values ([100, '1fr'] → \"100px 1fr\")\n */\n columns?: number | string | Array<number | string>\n /** Grid row definition (same format as columns) */\n rows?: number | string | Array<number | string>\n /** Controls item alignment along column axis */\n justifyItems?: React.CSSProperties['justifyItems']\n /** Controls item alignment along row axis */\n alignItems?: React.CSSProperties['alignItems']\n /** Controls content distribution along row axis */\n justifyContent?: React.CSSProperties['justifyContent']\n /** Controls content distribution along column axis */\n alignContent?: React.CSSProperties['alignContent']\n /** Custom measurement indicator renderer */\n indicatorNode?: IndicatorNode\n /** Visual style in debug mode */\n variant?: Variant\n /** Flag to enable SSR-compatible mode (simplified initial render) */\n ssrMode?: boolean\n /** Container width (defaults to \"auto\") */\n width?: React.CSSProperties['width']\n /** Container height (defaults to \"auto\") */\n height?: React.CSSProperties['height']\n children?: React.ReactNode\n} & ComponentsProps & Gaps\n\n// Utils -----------------------------------------------------------------------\n\n/** Creates default layout styles with theme colors */\nexport const createDefaultLayoutStyles = (colors: {\n line: string;\n flat: string;\n text: string;\n}): Record<string, string> => ({\n '--bklw': 'auto',\n '--bklh': 'auto',\n '--bklcl': colors.line,\n '--bklcf': colors.flat,\n '--bklci': colors.text,\n})\n\n/** Parses grid template definitions into CSS grid-template values. */\nexport const getGridTemplate = (prop?: number | string | Array<number | string>): string => {\n if (typeof prop === 'number') return `repeat(${prop}, 1fr)`\n if (typeof prop === 'string') return prop\n if (Array.isArray(prop)) {\n return prop.map((p) => (typeof p === 'number' ? `${p}px` : p)).join(' ')\n }\n return 'repeat(auto-fit, minmax(100px, 1fr))'\n}\n\n/** Creates grid gap styles */\nexport const createGridGapStyles = (\n gap?: React.CSSProperties['gap'] | number,\n rowGap?: React.CSSProperties['rowGap'] | number,\n columnGap?: React.CSSProperties['columnGap'] | number,\n): Record<string, string> => {\n const styles: Record<string, string> = {}\n\n if (gap !== undefined) {\n styles.gap = formatValue(gap)\n }\n if (rowGap !== undefined) {\n styles.rowGap = formatValue(rowGap)\n }\n if (columnGap !== undefined) {\n styles.columnGap = formatValue(columnGap)\n }\n\n return styles\n}\n\n/**\n * A grid-based layout component with baseline alignment and responsive columns.\n *\n * @remarks\n * Layout provides a CSS Grid container that:\n * - Supports flexible column definitions\n * - Maintains baseline grid alignment\n * - Includes gap management\n * - Offers comprehensive alignment controls\n * - Provides debug overlays for visual verification\n *\n * When no explicit dimensions are provided, Layout defaults to \"auto\"\n * for both width and height.\n *\n * @example\n * ```tsx\n * // Basic equal columns\n * <Layout columns={3} gap={16}>\n * <div>Column 1</div>\n * <div>Column 2</div>\n * <div>Column 3</div>\n * </Layout>\n *\n * // Mixed column widths with alignment\n * <Layout\n * columns={['200px', '1fr', '2fr']}\n * gap={24}\n * alignItems=\"center\"\n * justifyContent=\"space-between\"\n * >\n * <div>Fixed</div>\n * <div>Flexible</div>\n * <div>Double width</div>\n * </Layout>\n * ```\n */\nexport const Layout = React.memo(function Layout({\n alignContent,\n alignItems,\n children,\n className,\n columns = 'repeat(auto-fit, minmax(100px, 1fr))',\n columnGap,\n debugging: debuggingProp,\n gap,\n height,\n indicatorNode,\n justifyContent,\n justifyItems,\n rowGap,\n rows,\n style,\n variant,\n width,\n ssrMode = false,\n ...spacingProps\n}: LayoutProps) {\n const config = useConfig('layout')\n const { isShown, debugging } = useDebug(debuggingProp, config.debugging)\n \n // Add hydration state tracking\n const [isHydrated, setIsHydrated] = React.useState(false)\n \n React.useEffect(() => {\n setIsHydrated(true)\n }, [])\n \n const layoutRef = React.useRef<HTMLDivElement>(null)\n\n const initialPadding = React.useMemo(\n () => parsePadding(spacingProps),\n [spacingProps],\n )\n \n // Get padding calculation from useBaseline\n const baselinePadding = useBaseline(layoutRef, {\n base: config.base,\n snapping: 'height',\n spacing: initialPadding,\n warnOnMisalignment: true,\n })\n \n // Create stable initial padding for SSR\n const stablePadding = {\n padding: {\n top: initialPadding.top || 0,\n right: initialPadding.right || 0,\n bottom: initialPadding.bottom || 0,\n left: initialPadding.left || 0\n }\n }\n \n // Use stable padding during SSR and initial render, then switch to dynamic padding\n const { padding } = hydratedValue(\n isHydrated && !ssrMode,\n stablePadding,\n baselinePadding\n )\n\n const gridTemplateColumns = React.useMemo(\n () => getGridTemplate(columns),\n [columns],\n )\n\n const gridTemplateRows = React.useMemo(\n () => (rows ? getGridTemplate(rows) : 'auto'),\n [rows],\n )\n\n const defaultLayoutStyles = React.useMemo(\n () => createDefaultLayoutStyles(config.colors),\n [config.colors],\n )\n\n const gridGapStyles = React.useMemo(\n () => createGridGapStyles(gap, rowGap, columnGap),\n [gap, rowGap, columnGap],\n )\n\n const containerStyles = React.useMemo(() => {\n const widthValue = formatValue(width || 'auto')\n const heightValue = formatValue(height || 'auto')\n\n // Define dimensions that should be skipped when set to auto\n const autoDimensions = ['--bklw', '--bklh']\n\n return mergeStyles(\n {\n // Theme overrides\n ...createStyleOverride({\n key: '--bklw',\n value: widthValue,\n defaultStyles: defaultLayoutStyles,\n skipDimensions: { auto: autoDimensions }\n }),\n ...createStyleOverride({\n key: '--bklh',\n value: heightValue,\n defaultStyles: defaultLayoutStyles,\n skipDimensions: { auto: autoDimensions }\n }),\n ...createStyleOverride({\n key: '--bklcl',\n value: config.colors.line,\n defaultStyles: defaultLayoutStyles\n }),\n ...createStyleOverride({\n key: '--bklcf',\n value: config.colors.flat,\n defaultStyles: defaultLayoutStyles\n }),\n ...createStyleOverride({\n key: '--bklci',\n value: config.colors.text,\n defaultStyles: defaultLayoutStyles\n }),\n\n // Grid properties - only inject if different from defaults\n ...(gridTemplateColumns !== 'repeat(auto-fit, minmax(100px, 1fr))' && { '--bklgtc': gridTemplateColumns }),\n ...(gridTemplateRows !== 'auto' && { '--bklgtr': gridTemplateRows }),\n ...(justifyItems && { '--bklji': justifyItems }),\n ...(alignItems && { '--bklai': alignItems }),\n ...(justifyContent && { '--bkljc': justifyContent }),\n ...(alignContent && { '--bklac': alignContent }),\n\n // Include gap styles\n ...gridGapStyles,\n } as React.CSSProperties,\n style,\n )\n }, [\n gridTemplateColumns,\n gridTemplateRows,\n justifyItems,\n alignItems,\n justifyContent,\n alignContent,\n width,\n height,\n config.colors,\n defaultLayoutStyles,\n style,\n gridGapStyles,\n ])\n\n return (\n <Config\n spacer={{ variant: variant ?? 'line' }}\n >\n <Padder\n ref={layoutRef}\n className={isShown ? styles.v : ''}\n block={[padding.top, padding.bottom]}\n {... (indicatorNode ? { indicatorNode } : {})}\n inline={[padding.left, padding.right]}\n debugging={debugging}\n width={width}\n height={height}\n ssrMode={ssrMode}\n >\n <div\n data-testid=\"layout\"\n className={mergeClasses(className, styles.lay)}\n style={containerStyles}\n {...(spacingProps && Object.keys(spacingProps).length > 0 ? \n Object.fromEntries(\n Object.entries(spacingProps).filter(([key]) => key !== 'ssrMode')\n ) : {})}\n >\n {children}\n </div>\n </Padder>\n </Config>\n )\n})\n","import * as React from 'react'\nimport { useConfig, useDebug, useBaseline } from '@hooks'\nimport {\n mergeClasses,\n mergeStyles,\n parsePadding,\n mergeRefs,\n formatValue,\n createGridSpanStyles,\n createStyleOverride,\n hydratedValue\n} from '@utils'\nimport { Config } from '../Config'\nimport { Padder } from '../Padder'\nimport { ComponentsProps } from '../types'\nimport styles from './styles.module.css'\n\n/**\n * Determines how the Box component aligns to the baseline grid.\n *\n * @remarks\n * - `none`: No snapping; uses raw spacing values as provided\n * - `height`: Only container height snaps to base unit multiples\n * - `clamp`: Both height and spacing values snap to base unit multiples\n */\nexport type SnappingMode = 'none' | 'height' | 'clamp'\n\ntype BoxProps = {\n /** Number of columns to span in a grid layout */\n colSpan?: number\n /** Number of rows to span in a grid layout */\n rowSpan?: number\n /** Shorthand for equal column and row span. Takes precedence over individual spans */\n span?: number\n /** Controls baseline grid alignment behavior */\n snapping?: SnappingMode\n /** Flag to enable SSR-compatible mode (simplified initial render) */\n ssrMode?: boolean\n children?: React.ReactNode\n} & ComponentsProps\n\n// Utils -----------------------------------------------------------------------\n\n/**\n * Creates default box styles with theme values.\n * Sets CSS variables for width, height, base unit, and colors.\n */\nexport const createDefaultBoxStyles = (\n base: number,\n lineColor: string\n): Record<string, string> => ({\n '--bkxw': 'fit-content',\n '--bkxh': 'fit-content',\n '--bkxb': `${base}px`,\n '--bkxcl': lineColor,\n})\n\n/** Parameters for creating box custom styles */\ntype BoxCustomStylesParams = {\n /** Width property for the box */\n width?: React.CSSProperties['width'];\n /** Height property for the box */\n height?: React.CSSProperties['height'];\n /** Base unit for measurements */\n base: number;\n /** Line color from theme */\n lineColor: string;\n /** Default styles for comparison */\n defaultStyles: Record<string, string>;\n}\n\n/**\n * Creates custom styles for the box.\n * Combines all style properties and only applies changes when needed.\n */\nexport const createBoxCustomStyles = ({\n width,\n height,\n base,\n lineColor,\n defaultStyles\n}: BoxCustomStylesParams): React.CSSProperties => {\n const widthValue = formatValue(width || 'fit-content')\n const heightValue = formatValue(height || 'fit-content')\n\n // Define box dimensions that should be skipped when set to fit-content\n const dimensionVars = ['--bkxw', '--bkxh']\n\n return {\n ...createStyleOverride({\n key: '--bkxw',\n value: widthValue,\n defaultStyles,\n skipDimensions: { fitContent: dimensionVars }\n }),\n ...createStyleOverride({\n key: '--bkxh',\n value: heightValue,\n defaultStyles,\n skipDimensions: { fitContent: dimensionVars }\n }),\n ...createStyleOverride({\n key: '--bkxb',\n value: `${base}px`,\n defaultStyles\n }),\n ...createStyleOverride({\n key: '--bkxcl',\n value: lineColor,\n defaultStyles\n }),\n } as React.CSSProperties\n}\n\n/**\n * A foundational container component that ensures consistent spacing and baseline alignment.\n *\n * @remarks\n * Box provides a layout container that:\n * - Ensures consistent spacing aligned to the baseline grid\n * - Supports grid layout integration through span props\n * - Offers configurable snapping modes for fine-grained alignment control\n * - Includes debug overlays for visual alignment verification\n *\n * By default, Box uses \"auto\" for both width and height unless explicitly specified.\n *\n * @example\n * ```tsx\n * // Basic usage with spacing\n * <Box block={16} inline={8}>\n * <p>Content aligned to baseline</p>\n * </Box>\n *\n * // With grid spanning and custom snapping\n * <Box\n * colSpan={2}\n * rowSpan={1}\n * snapping=\"height\"\n * debugging=\"visible\"\n * >\n * <p>Grid-integrated content</p>\n * </Box>\n * ```\n */\nexport const Box = React.memo(\n React.forwardRef<HTMLDivElement, BoxProps>(function Box(\n {\n children,\n snapping = 'clamp',\n debugging: debuggingProp,\n className,\n colSpan,\n rowSpan,\n span,\n width,\n height,\n style,\n ssrMode = false,\n ...spacingProps\n },\n ref,\n ) {\n const config = useConfig('box')\n const { isShown, debugging } = useDebug(debuggingProp, config.debugging)\n\n // Add hydration state tracking\n const [isHydrated, setIsHydrated] = React.useState(false)\n \n React.useEffect(() => {\n setIsHydrated(true)\n }, [])\n\n const internalRef = React.useRef<HTMLDivElement | null>(null)\n const { top, bottom, left, right } = parsePadding(spacingProps)\n \n // Get padding calculation from useBaseline\n const baselinePadding = useBaseline(internalRef, {\n base: config.base,\n snapping,\n spacing: { top, bottom, left, right },\n warnOnMisalignment: debugging !== 'none',\n })\n \n // Create stable initial padding for SSR\n const stablePadding = {\n padding: {\n top: top || 0,\n right: right || 0,\n bottom: bottom || 0,\n left: left || 0\n }\n }\n \n // Use stable padding during SSR and initial render, then switch to dynamic padding\n const { padding } = hydratedValue(\n isHydrated && !ssrMode,\n stablePadding,\n baselinePadding\n )\n\n const gridSpanStyles = React.useMemo(\n () => createGridSpanStyles(span, colSpan, rowSpan),\n [colSpan, rowSpan, span]\n )\n\n const defaultBoxStyles = React.useMemo(\n () => createDefaultBoxStyles(config.base, config.colors.line),\n [config.base, config.colors.line]\n )\n\n const boxStyles = React.useMemo(\n () => {\n const customStyles = createBoxCustomStyles({\n width,\n height,\n base: config.base,\n lineColor: config.colors.line,\n defaultStyles: defaultBoxStyles\n })\n return mergeStyles(customStyles, style)\n },\n [config.base, config.colors.line, width, height, defaultBoxStyles, style]\n )\n\n return (\n <div\n ref={mergeRefs(ref, internalRef)}\n data-testid=\"box\"\n className={mergeClasses(styles.box, isShown && styles.v, className)}\n style={mergeStyles(boxStyles, gridSpanStyles)}\n >\n <Config\n base={1}\n spacer={{ variant: 'flat' }}\n >\n <Padder\n block={[padding.top, padding.bottom]}\n inline={[padding.left, padding.right]}\n width=\"fit-content\"\n height={height}\n debugging={debugging}\n ssrMode={ssrMode}\n >\n {children}\n </Padder>\n </Config>\n </div>\n )\n }),\n)\n","import * as React from 'react'\nimport type { Gaps } from '@components'\nimport { useConfig, useDebug, useBaseline } from '@hooks'\nimport {\n mergeClasses,\n mergeStyles,\n parsePadding,\n formatValue,\n createStyleOverride,\n hydratedValue\n} from '@utils'\nimport { Padder } from '../Padder'\nimport { IndicatorNode } from '../Spacer'\nimport { Config } from '../Config'\nimport { ComponentsProps, Variant } from '../types'\nimport styles from './styles.module.css'\n\n// Maps shorthand directions to Flexbox directions\nexport const DIRECTION_AXIS: Record<string, React.CSSProperties['flexDirection']> = {\n x: 'row',\n y: 'column',\n '-x': 'row-reverse',\n '-y': 'column-reverse',\n}\n\nexport type CSSPropertiesDirectionalAxis = keyof typeof DIRECTION_AXIS;\n\nexport type StackProps = {\n /** Main axis orientation */\n direction?: React.CSSProperties['flexDirection'] & CSSPropertiesDirectionalAxis;\n /** Distribution of space on main axis */\n justify?: React.CSSProperties['justifyContent']\n /** Alignment on cross axis */\n align?: React.CSSProperties['alignItems']\n /** Container width (defaults to \"auto\") */\n width?: React.CSSProperties['width']\n /** Container height (defaults to \"auto\") */\n height?: React.CSSProperties['height']\n /** Custom measurement indicator renderer */\n indicatorNode?: IndicatorNode\n /** Visual style in debug mode */\n variant?: Variant\n /** Gap between items in base units */\n gap?: Gaps\n /** Row gap when using different values for rows and columns */\n rowGap?: Gaps\n /** Column gap when using different values for rows and columns */\n columnGap?: Gaps\n /** Flag to enable SSR-compatible mode (simplified initial render) */\n ssrMode?: boolean\n children?: React.ReactNode\n} & ComponentsProps\n\n// Utils -----------------------------------------------------------------------\n\n/** Creates default stack styles with theme colors */\nexport const createDefaultStackStyles = (colors: Record<string, string>) => ({\n '--bkkw': 'auto',\n '--bkkh': 'auto',\n '--bkkcl': colors.line,\n '--bkkcf': colors.flat,\n '--bkkci': colors.text,\n})\n\n/** Creates gap styles for the stack */\nexport const createStackGapStyles = (\n rowGap?: number,\n columnGap?: number,\n gap?: number,\n): Record<string, number | undefined> => ({\n rowGap: gap !== undefined ? gap : rowGap,\n columnGap: gap !== undefined ? gap : columnGap,\n})\n\n/**\n * A flexible container component aligning children to the baseline grid.\n *\n * @remarks\n * Stack provides a flex container that:\n * - Maintains baseline grid alignment\n * - Supports both row and column layouts\n * - Handles consistent spacing between items\n * - Includes visual debug overlays\n *\n * Key features:\n * - Automatic dimension management (defaults to auto)\n * - Direct padding application in non-debug mode\n * - Comprehensive alignment controls\n * - Theme-aware debug visuals\n *\n * @example\n * ```tsx\n * // Basic horizontal stack\n * <Stack gap={16}>\n * <div>Item 1</div>\n * <div>Item 2</div>\n * </Stack>\n *\n * // Vertical stack with alignment\n * <Stack\n * direction=\"column\"\n * gap={24}\n * align=\"center\"\n * justify=\"space-between\"\n * debugging=\"visible\"\n * >\n * <div>Top</div>\n * <div>Middle</div>\n * <div>Bottom</div>\n * </Stack>\n *\n * // Complex layout with padding\n * <Stack\n * direction=\"row\"\n * gap={32}\n * align=\"stretch\"\n * block={[16, 24]}\n * inline={16}\n * debugging=\"visible\"\n * >\n * <div>Panel 1</div>\n * <div>Panel 2</div>\n * </Stack>\n * ```\n */\nexport const Stack = React.memo(function Stack({\n align = 'flex-start',\n children,\n className,\n columnGap,\n debugging: debuggingProp,\n direction = 'row',\n gap,\n height,\n indicatorNode,\n justify = 'flex-start',\n rowGap,\n style,\n variant,\n width,\n ssrMode = false,\n ...spacingProps\n}: StackProps) {\n // Read configuration from context or props\n const config = useConfig('stack')\n const { isShown, debugging } = useDebug(debuggingProp, config.debugging)\n \n // Add hydration state tracking\n const [isHydrated, setIsHydrated] = React.useState(false)\n \n React.useEffect(() => {\n setIsHydrated(true)\n }, [])\n \n const stackRef = React.useRef<HTMLDivElement | null>(null)\n\n // Process spacing props\n const { top, right, bottom, left } = parsePadding({\n ...spacingProps,\n })\n\n // Get padding calculation from useBaseline\n const baselinePadding = useBaseline(stackRef, {\n base: config.base,\n snapping: 'height',\n spacing: { top, right, bottom, left },\n warnOnMisalignment: debugging !== 'none',\n })\n \n // Create stable initial padding for SSR\n const stablePadding = {\n padding: {\n top: top || 0,\n right: right || 0,\n bottom: bottom || 0,\n left: left || 0\n }\n }\n \n // Use stable padding during SSR and initial render, then switch to dynamic padding\n const { padding } = hydratedValue(\n isHydrated && !ssrMode,\n stablePadding,\n baselinePadding\n )\n\n const stackGapStyles = React.useMemo(() => {\n const formattedRowGap = rowGap !== undefined ? Number(rowGap) : undefined\n const formattedColumnGap = columnGap !== undefined ? Number(columnGap) : undefined\n const formattedGap = gap !== undefined ? Number(gap) : undefined\n\n return createStackGapStyles(formattedRowGap, formattedColumnGap, formattedGap)\n }, [rowGap, columnGap, gap])\n\n const defaultStackStyles = React.useMemo(\n () => createDefaultStackStyles(config.colors),\n [config.colors],\n )\n\n const containerStyles = React.useMemo(() => {\n const widthValue = formatValue(width || 'auto')\n const heightValue = formatValue(height || 'auto')\n const flexDirection = DIRECTION_AXIS[direction] || direction\n\n // Define stack dimensions that should be skipped when set to auto\n const dimensionVars = ['--bkkw', '--bkkh']\n\n const customOverrides = {\n ...createStyleOverride({\n key: '--bkkw',\n value: widthValue,\n defaultStyles: defaultStackStyles,\n skipDimensions: { auto: dimensionVars },\n }),\n ...createStyleOverride({\n key: '--bkkh',\n value: heightValue,\n defaultStyles: defaultStackStyles,\n skipDimensions: { auto: dimensionVars },\n }),\n ...createStyleOverride({\n key: '--bkkcl',\n value: config.colors.line,\n defaultStyles: defaultStackStyles,\n }),\n ...createStyleOverride({\n key: '--bkkcf',\n value: config.colors.flat,\n defaultStyles: defaultStackStyles,\n }),\n ...createStyleOverride({\n key: '--bkkci',\n value: config.colors.text,\n defaultStyles: defaultStackStyles,\n }),\n } as React.CSSProperties\n\n const baseStyles = {\n flexDirection,\n justifyContent: justify,\n alignItems: align,\n width,\n height,\n } as React.CSSProperties\n\n return mergeStyles(baseStyles, stackGapStyles, customOverrides, style)\n }, [\n direction,\n justify,\n align,\n width,\n height,\n config.colors.line,\n config.colors.flat,\n config.colors.text,\n defaultStackStyles,\n stackGapStyles,\n style,\n ])\n\n const mergedContainerStyles =\n debugging === 'none'\n ? {\n ...containerStyles,\n paddingBlock: `${padding.top}px ${padding.bottom}px`,\n paddingInline: `${padding.left}px ${padding.right}px`,\n }\n : containerStyles\n\n return (\n <Config\n spacer={{ variant: variant ?? 'line' }}\n >\n <Padder\n ref={stackRef}\n className={isShown ? styles.v : ''}\n block={[padding.top, padding.bottom]}\n inline={[padding.left, padding.right]}\n debugging={debugging}\n indicatorNode={indicatorNode}\n width={width}\n height={height}\n ssrMode={ssrMode}\n >\n <div\n data-testid=\"stack\"\n className={mergeClasses(className, styles.stk)}\n style={mergedContainerStyles}\n {...spacingProps}\n >\n {children}\n </div>\n </Padder>\n </Config>\n )\n})\n","import * as React from 'react'\nimport {\n useConfig,\n useDebug,\n useGuide,\n useMeasure,\n} from '@hooks'\nimport {\n formatValue,\n mergeClasses,\n mergeStyles,\n createStyleOverride,\n hydratedValue\n} from '@utils'\nimport { AutoConfig, FixedConfig, LineConfig, PatternConfig } from './types'\nimport type { ComponentsProps, GuideVariant } from '../types'\nimport styles from './styles.module.css'\n\n/** Merged configuration types that support various grid layout strategies */\nexport type GuideConfig = PatternConfig | AutoConfig | FixedConfig | LineConfig;\n\nexport type GuideProps = {\n /** Controls horizontal alignment of columns within the container */\n align?: React.CSSProperties['justifyContent']\n /** Visual style of the guide */\n variant?: GuideVariant\n /** Number of columns (for fixed/auto variants) */\n columns?: number | readonly (string | number | undefined | 'auto')[]\n /** Column width (for fixed variant) */\n columnWidth?: React.CSSProperties['width']\n /** Gutter width between columns */\n gutterWidth?: React.CSSProperties['width']\n /** Maximum width of the guide */\n maxWidth?: React.CSSProperties['maxWidth']\n /** Color override for guide lines */\n color?: React.CSSProperties['color']\n /** Content to render inside the guide */\n children?: React.ReactNode\n /** Gap between columns */\n gap?: number\n /** Flag to enable SSR-compatible mode (simplified initial render) */\n ssrMode?: boolean\n} & ComponentsProps & Omit<GuideConfig, 'columns' | 'columnWidth' | 'gap'>;\n\n/** Parameters for creating a grid configuration */\ntype GridConfigParams = {\n variant: GuideVariant;\n base: number;\n gap: number;\n columns?: number | readonly (string | number | undefined | 'auto')[];\n columnWidth?: React.CSSProperties['width'];\n}\n\n// Utils -----------------------------------------------------------------------\n\n/** Creates the appropriate grid configuration based on variant */\nexport const createGridConfig = (\n params: GridConfigParams,\n): (PatternConfig | AutoConfig | FixedConfig | LineConfig) => {\n const { variant, base, gap, columns, columnWidth } = params\n\n return {\n line: {\n variant: 'line' as const,\n gap: gap - 1,\n base,\n },\n auto: columnWidth\n ? {\n variant: 'auto' as const,\n columnWidth,\n gap,\n base,\n }\n : null,\n pattern: Array.isArray(columns)\n ? {\n variant: 'pattern' as const,\n columns,\n gap,\n base,\n }\n : null,\n fixed:\n typeof columns === 'number'\n ? {\n variant: 'fixed' as const,\n columns,\n columnWidth,\n gap,\n base,\n }\n : null,\n }[variant] ?? {\n variant: 'line' as const,\n gap: gap - 1,\n base,\n }\n}\n\n/** Creates default guide styles */\nexport const createDefaultGuideStyles = (\n base: number,\n lineColor: string,\n): Record<string, string> => ({\n '--bkgw': 'auto',\n '--bkgh': 'auto',\n '--bkgmw': 'none',\n '--bkgcw': '60px',\n '--bkggw': '24px',\n '--bkgc': '12',\n '--bkgb': `${base}px`,\n '--bkgcl': lineColor,\n})\n\n/**\n * A developer tool component that provides visual grid overlays for alignment.\n *\n * @remarks\n * Guide renders a configurable grid overlay that helps visualize:\n * - Column layouts and spacing\n * - Content alignment\n * - Layout patterns\n *\n * The component supports multiple variants:\n * - \"line\": Simple evenly-spaced vertical lines\n * - \"pattern\": Custom repeating column width patterns\n * - \"fixed\": Fixed number of equal or custom-width columns\n * - \"auto\": Dynamically calculated columns based on container width\n *\n * @example\n * ```tsx\n * // Basic column guide\n * <Guide\n * variant=\"line\"\n * gap={8}\n * debugging=\"visible\"\n * />\n *\n * // Custom column pattern\n * <Guide\n * variant=\"pattern\"\n * columns={['100px', '1fr', '2fr']}\n * gap={16}\n * align=\"center\"\n * debugging=\"visible\"\n * />\n *\n * // Fixed columns with custom width\n * <Guide\n * variant=\"fixed\"\n * columns={12}\n * columnWidth=\"60px\"\n * gap={8}\n * debugging=\"visible\"\n * />\n * ```\n */\nexport const Guide = React.memo(function Guide({\n className,\n debugging,\n style,\n variant: variantProp,\n align = 'start',\n gap: gapProp,\n height,\n width,\n columns,\n columnWidth,\n gutterWidth,\n maxWidth,\n color,\n children,\n ssrMode = false,\n ...props\n}: GuideProps) {\n const config = useConfig('guide')\n const variant = variantProp ?? config.variant\n const gap = typeof gapProp === 'number' ? gapProp : config.base\n \n // Add hydration state tracking\n const [isHydrated, setIsHydrated] = React.useState(false)\n \n React.useEffect(() => {\n setIsHydrated(true)\n }, [])\n\n const containerRef = React.useRef<HTMLDivElement | null>(null)\n \n // Always call useMeasure, but conditionally use its results\n const measuredDimensions = useMeasure(containerRef)\n \n // Choose appropriate dimensions based on rendering environment\n const dimensions = hydratedValue(\n isHydrated && !ssrMode,\n { width: 1024, height: 768, refresh: () => {} },\n measuredDimensions\n )\n \n const { width: containerWidth, height: containerHeight } = dimensions\n\n const { isShown } = useDebug(debugging, config.debugging)\n\n // Create guide configuration based on variant\n const gridConfig = React.useMemo(() => {\n return createGridConfig({\n variant,\n base: config.base,\n gap,\n columns,\n columnWidth,\n })\n }, [variant, config.base, gap, columns, columnWidth])\n\n const {\n template,\n columnsCount,\n calculatedGap,\n } = useGuide(containerRef, gridConfig)\n\n const defaultStyles = React.useMemo(\n () => createDefaultGuideStyles(config.base, config.colors.line),\n [config.base, config.colors.line],\n )\n\n const containerStyles = React.useMemo(() => {\n // Process dimension values\n const widthValue = formatValue(width || containerWidth || 'auto')\n const heightValue = formatValue(height || containerHeight || 'auto')\n const maxWidthValue = formatValue(maxWidth || 'none')\n const columnWidthValue = formatValue(columnWidth || '60px')\n const gutterWidthValue = formatValue(gutterWidth || '24px')\n\n // Define dimensions that should be skipped when set to auto\n const autoDimensions = ['--bkgw', '--bkgh']\n\n // Create custom styles with conditional overrides\n const customStyles = {\n ...createStyleOverride({\n key: '--bkgw',\n value: widthValue,\n defaultStyles,\n skipDimensions: { auto: autoDimensions },\n }),\n ...createStyleOverride({\n key: '--bkgh',\n value: heightValue,\n defaultStyles,\n skipDimensions: { auto: autoDimensions },\n }),\n ...createStyleOverride({\n key: '--bkgmw',\n value: maxWidthValue,\n defaultStyles,\n }),\n ...createStyleOverride({\n key: '--bkgcw',\n value: columnWidthValue,\n defaultStyles,\n }),\n ...createStyleOverride({\n key: '--bkggw',\n value: gutterWidthValue,\n defaultStyles,\n }),\n ...createStyleOverride({\n key: '--bkgc',\n value: `${columnsCount}`,\n defaultStyles,\n }),\n ...createStyleOverride({\n key: '--bkgb',\n value: `${config.base}px`,\n defaultStyles,\n }),\n ...createStyleOverride({\n key: '--bkgcl',\n value: color ?? config.colors.line,\n defaultStyles,\n }),\n // Add the CSS variables expected by tests\n '--bkgg': `${calculatedGap}px`,\n ...(template && template !== 'none' ? { '--bkgt': template } : {}),\n // Add grid template if available\n ...(template && template !== 'none' ? { gridTemplateColumns: template } : {}),\n // Add gap if calculated\n ...(calculatedGap ? { gap: `${calculatedGap}px` } : {}),\n // Add justifyContent based on align\n justifyContent: align,\n } as React.CSSProperties\n\n return mergeStyles(customStyles, style)\n }, [\n width,\n height,\n maxWidth,\n columnWidth,\n gutterWidth,\n columnsCount,\n color,\n template,\n calculatedGap,\n containerWidth,\n containerHeight,\n config.base,\n config.colors.line,\n defaultStyles,\n style,\n align,\n ])\n\n return (\n <div\n ref={containerRef}\n data-testid=\"guide\"\n className={mergeClasses(\n styles.gde,\n className,\n isShown ? styles.v : styles.h,\n variant === 'line' && styles.line,\n )}\n data-variant={variant}\n style={containerStyles}\n {...props}\n >\n {isShown && (\n <div className={styles.cols} data-variant={variant}>\n {Array.from({ length: columnsCount }, (_, i) => {\n const colColor =\n config.colors[variant as keyof typeof config.colors] ?? config.colors.line\n return (\n <div\n key={i}\n className={styles.col}\n data-column-index={i}\n data-variant={variant}\n style={{ backgroundColor: colColor }}\n />\n )\n })}\n </div>\n )}\n {children}\n </div>\n )\n})\n","/**\n * @file validation.ts\n * @description Validation utilities for Guide component configurations\n * @module baseline-kit/components/Guide/validation\n */\n\nimport {\n GRID_ALIGNMENTS,\n GridAlignment,\n GuideColumnsPattern,\n GuideColumnValue,\n GuideConfig,\n} from '@components'\nimport { ABSOLUTE_UNIT_CONVERSIONS, RELATIVE_UNITS } from '@utils'\n\n/**\n * Regular expression for valid CSS unit values.\n * Matches numeric values with supported CSS units.\n */\nconst UNIT_PATTERN = /^\\d*\\.?\\d+(?:fr|px|%|em|rem|vh|vw|vmin|vmax|pt|pc|in|cm|mm)$/\n\n/**\n * Validates individual grid column values.\n *\n * @example\n * ```ts\n * isValidGuideColumnValue(100) // true\n * isValidGuideColumnValue('100px') // true\n * isValidGuideColumnValue('auto') // true\n * isValidGuideColumnValue('foo') // false\n * ```\n */\nexport const isValidGuideColumnValue = (value: unknown): value is GuideColumnValue => {\n if (typeof value === 'number') return Number.isFinite(value) && value >= 0\n if (typeof value !== 'string') return false\n return value === 'auto' || value === '100%' || UNIT_PATTERN.test(value)\n}\n\n/**\n * Validates an array of column values as a grid pattern.\n *\n * @example\n * ```ts\n * isValidGuidePattern(['100px', '1fr']) // true\n * isValidGuidePattern([100, 200]) // true\n * isValidGuidePattern(['invalid']) // false\n * isValidGuidePattern([]) // false\n * ```\n */\nexport const isValidGuidePattern = (pattern: unknown): pattern is GuideColumnsPattern =>\n Array.isArray(pattern) && pattern.length > 0 && pattern.every(isValidGuideColumnValue)\n\n/**\n * Validates CSS grid values against supported units.\n *\n * @example\n * ```ts\n * isGuideValue('100px') // true\n * isGuideValue('2rem') // true\n * isGuideValue('foo') // false\n * ```\n */\nexport const isGuideValue = (value: unknown) => {\n const CSS_UNITS = [...Object.keys(ABSOLUTE_UNIT_CONVERSIONS), ...RELATIVE_UNITS]\n return (\n typeof value === 'number' ||\n (typeof value === 'string' && CSS_UNITS.some(unit => value.endsWith(unit)))\n )\n}\n\n/**\n * Validates grid alignment values.\n *\n * @example\n * ```ts\n * isGuideAlignment('start') // true\n * isGuideAlignment('center') // true\n * isGuideAlignment('foo') // false\n * ```\n */\nexport const isGuideAlignment = (value: unknown): value is GridAlignment =>\n typeof value === 'string' && GRID_ALIGNMENTS.includes(value as GridAlignment)\n\n/**\n * Type guard for object values.\n */\nconst isObject = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && value !== null\n\n/**\n * Validates line-based guide configurations.\n *\n * @example\n * ```ts\n * isGuideLineConfig({ variant: 'line' }) // true\n * isGuideLineConfig({ variant: 'pattern' }) // false\n * ```\n */\nexport const isGuideLineConfig = (config: unknown): config is GuideConfig =>\n isObject(config) && config.variant === 'line'\n\n/**\n * Validates column-based guide configurations.\n *\n * @example\n * ```ts\n * isGuideColumnConfig({ columns: 12 }) // true\n * isGuideColumnConfig({ variant: 'line' }) // false\n * ```\n */\nexport const isGuideColumnConfig = (config: unknown): config is GuideConfig =>\n isObject(config) && 'columns' in config && !('variant' in config)\n\n/**\n * Validates auto-calculated guide configurations.\n *\n * @example\n * ```ts\n * isAutoCalculatedGuide({ columnWidth: '200px' }) // true\n * isAutoCalculatedGuide({ columns: 12 }) // false\n * ```\n */\nexport const isAutoCalculatedGuide = (config: unknown): config is GuideConfig =>\n isObject(config) &&\n 'columnWidth' in config &&\n !('variant' in config) &&\n !('columns' in config)","import * as React from 'react'\nimport { ComponentsProps } from '@components'\nimport { useConfig, useDebug, useVirtual, useMeasure } from '@hooks'\nimport {\n parsePadding,\n normalizeValuePair,\n mergeStyles,\n mergeClasses,\n calculateRowCount,\n formatValue,\n createStyleOverride,\n SSR_DIMENSIONS,\n hydratedValue\n} from '@utils'\nimport { Variant } from '../types'\nimport styles from './styles.module.css'\n\nexport type BaselineVariant = Exclude<Variant, 'pattern'>\n\nexport type BaselineProps = {\n /** Visual style variant for the baseline guides */\n variant?: BaselineVariant\n /** Explicit width for the overlay (e.g., \"1200px\" or 1200) */\n width?: number | string\n /** Explicit height for the overlay (e.g., \"100vh\" or 800) */\n height?: number | string\n /** Base unit for measurements (defaults to theme value) */\n base?: number\n /** Color override for grid lines */\n color?: string\n /** Flag to enable SSR-compatible mode (simplified initial render) */\n ssrMode?: boolean\n} & ComponentsProps\n\n// Utils -----------------------------------------------------------------------\n\n/** Creates default baseline styles */\nexport const createDefaultBaselineStyles = (\n base: number,\n lineColor: string,\n flatColor: string,\n): Record<string, string> => ({\n '--bkbw': '100%',\n '--bkbh': '100%',\n '--bkbb': `${base}px`,\n '--bkbcl': lineColor,\n '--bkbcf': flatColor,\n})\n\n/** Create row styles for baseline lines */\ntype RowStyleParams = {\n /** Row index */\n index: number;\n /** Base unit for calculations */\n base: number;\n /** Baseline visual variant */\n variant: BaselineVariant;\n /** Selected color for the baseline */\n chosenColor: string;\n /** Theme line color */\n lineColor: string;\n /** Theme flat color */\n flatColor: string;\n}\n\n/**\n * Creates styles for an individual baseline row.\n * Applies positioning and visual styling based on variant.\n */\nexport const createBaselineRowStyle = (\n params: RowStyleParams,\n): React.CSSProperties => {\n const { index, base, variant, chosenColor, lineColor, flatColor } = params\n\n // Directly set the CSS variables instead of using createStyleOverride\n return {\n '--bkrt': index === 0 ? '0px' : `${index * base}px`,\n '--bkrh': variant === 'line' ? '1px' : `${base}px`,\n '--bkbc': chosenColor || (variant === 'line' ? lineColor : flatColor),\n } as React.CSSProperties\n}\n\n/**\n * Renders horizontal guidelines for maintaining vertical rhythm and baseline alignment.\n *\n * @remarks\n * Baseline provides horizontal guides that:\n * - Help maintain consistent vertical spacing\n * - Support visual verification of baseline alignment\n * - Optimize performance through virtual rendering\n * - Adapt to container dimensions\n *\n * @example\n * ```tsx\n * // Basic baseline overlay\n * <Baseline\n * height=\"100vh\"\n * base={8}\n * debugging=\"visible\"\n * />\n *\n * // Custom variant with padding\n * <Baseline\n * variant=\"flat\"\n * height=\"100vh\"\n * base={4}\n * block={[16, 0]}\n * debugging=\"visible\"\n * />\n * ```\n */\nexport const Baseline = React.memo(function Baseline({\n className,\n debugging,\n style,\n variant: variantProp,\n height: heightProp,\n width: widthProp,\n base: baseProp,\n color: colorProp,\n ssrMode = false,\n ...spacingProps\n}: BaselineProps) {\n const config = useConfig('baseline')\n const variant = variantProp ?? config.variant\n const base = baseProp ?? config.base\n const { isShown } = useDebug(debugging, config.debugging)\n\n // Use a stable reference that won't cause hydration mismatches\n const containerRef = React.useRef<HTMLDivElement | null>(null)\n \n // Use state to track if we're hydrated\n const [isHydrated, setIsHydrated] = React.useState(false)\n \n // Always call hooks, but conditionally use their results\n const measuredDimensions = useMeasure(containerRef)\n \n // After hydration, we can use real measurement\n React.useEffect(() => {\n setIsHydrated(true)\n }, [])\n \n // Choose appropriate dimensions based on rendering environment using our utility\n const dimensions = hydratedValue(\n isHydrated,\n SSR_DIMENSIONS,\n measuredDimensions\n )\n \n const { width: containerWidth, height: containerHeight } = dimensions\n\n const [_normWidth, normHeight] = React.useMemo(() => {\n return normalizeValuePair(\n [widthProp, heightProp],\n [containerWidth, containerHeight],\n )\n }, [widthProp, heightProp, containerWidth, containerHeight])\n\n const { top, right, bottom, left } = React.useMemo(\n () => parsePadding(spacingProps),\n [spacingProps],\n )\n\n const padding = React.useMemo(() => {\n const paddingValues = [top, right, bottom, left]\n .map((value) => (value ? `${value}px` : '0'))\n .join(' ')\n\n return paddingValues !== '0 0 0 0' ? paddingValues : undefined\n }, [top, right, bottom, left])\n\n const rowCount = React.useMemo(() => {\n return calculateRowCount({\n height: normHeight,\n top,\n bottom,\n base,\n })\n }, [normHeight, top, bottom, base])\n\n // Always call useVirtual but potentially use simpler values\n const virtualResult = useVirtual({\n totalLines: rowCount,\n lineHeight: base,\n containerRef,\n buffer: 160,\n })\n \n // For SSR, use simplistic settings that match between server/client\n const stableVirtualResult = { \n start: 0, \n end: Math.min(10, rowCount)\n }\n \n // Choose appropriate virtualization based on environment\n const { start, end } = hydratedValue(\n isHydrated && !ssrMode,\n stableVirtualResult,\n virtualResult\n )\n\n const chosenColor = colorProp ||\n (variant === 'line' ? config.colors.line : config.colors.flat)\n\n // Create default baseline styles\n const defaultBaselineStyles = React.useMemo(\n () => createDefaultBaselineStyles(\n base,\n config.colors.line,\n config.colors.flat,\n ),\n [base, config.colors.line, config.colors.flat],\n )\n\n const containerStyles = React.useMemo(() => {\n const widthValue = formatValue(widthProp || '100%')\n const heightValue = formatValue(heightProp || '100%')\n\n // Define dimensions that should be skipped when set to 100%\n const dimensionVars = ['--bkbw', '--bkbh']\n\n return mergeStyles(\n {\n ...createStyleOverride({\n key: '--bkbw',\n value: widthValue,\n defaultStyles: defaultBaselineStyles,\n skipDimensions: { fullSize: dimensionVars },\n }),\n ...createStyleOverride({\n key: '--bkbh',\n value: heightValue,\n defaultStyles: defaultBaselineStyles,\n skipDimensions: { fullSize: dimensionVars },\n }),\n ...createStyleOverride({\n key: '--bkbb',\n value: `${base}px`,\n defaultStyles: defaultBaselineStyles,\n }),\n ...createStyleOverride({\n key: '--bkbcl',\n value: colorProp || config.colors.line,\n defaultStyles: defaultBaselineStyles,\n }),\n ...createStyleOverride({\n key: '--bkbcf',\n value: colorProp || config.colors.flat,\n defaultStyles: defaultBaselineStyles,\n }),\n ...(padding && { padding }),\n } as React.CSSProperties,\n style,\n )\n }, [\n widthProp,\n heightProp,\n base,\n colorProp,\n config.colors.line,\n config.colors.flat,\n padding,\n defaultBaselineStyles,\n style,\n ])\n\n const getRowStyle = React.useCallback(\n (index: number) => {\n return createBaselineRowStyle({\n index,\n base,\n variant,\n chosenColor,\n lineColor: config.colors.line,\n flatColor: config.colors.flat,\n })\n },\n [base, variant, chosenColor, config.colors.line, config.colors.flat],\n )\n\n return (\n <div\n ref={containerRef}\n data-testid=\"baseline\"\n className={mergeClasses(\n styles.bas,\n isShown ? styles.v : styles.h,\n className,\n )}\n style={containerStyles}\n {...spacingProps}\n >\n {isShown &&\n Array.from({ length: end - start }, (_, i) => {\n const rowIndex = i + start\n return (\n <div\n className={styles.row}\n key={rowIndex}\n data-row-index={rowIndex}\n style={getRowStyle(rowIndex)}\n />\n )\n })}\n </div>\n )\n})\n","import * as React from 'react'\nimport { DebuggingMode } from './Config/Config'\n\n// Spacing Types --------------------------------------------------------------\n\n/**\n * Defines spacing as either a single value, start/end pair, or object with explicit edges.\n * Used for block and inline spacing across components.\n *\n * @example\n * ```tsx\n * // Single value\n * <Box block={8} />\n *\n * // Start/end pair\n * <Box block={[8, 16]} />\n *\n * // Object with explicit values\n * <Box block={{ start: 8, end: 16 }} />\n * ```\n */\nexport type Spacing =\n | number\n | [number, number]\n | { start?: number; end?: number }\n\n/**\n * Flexible padding definition that supports multiple formats for setting padding on all sides.\n *\n * @example\n * ```tsx\n * // Single value for all sides\n * padding={8}\n *\n * // Block and inline pairs\n * padding={[8, 16]}\n *\n * // Explicit values for each side\n * padding={[8, 16, 8, 16]}\n *\n * // Object with named sides\n * padding={{ top: 8, right: 16, bottom: 8, left: 16 }}\n * ```\n */\nexport type PaddingValue =\n | number\n | [number, number] // [block, inline]\n | [number, number, number, number] // [top, right, bottom, left]\n | {\n top?: number;\n bottom?: number;\n left?: number;\n right?: number;\n}\n\n/** Resolved padding values for all edges after normalization. */\nexport type Padding = {\n top: number;\n right: number;\n bottom: number;\n left: number;\n}\n\n/** Props interface for components that support spacing configuration. */\nexport type SpacingProps = {\n padding?: PaddingValue;\n block?: Spacing;\n inline?: Spacing;\n}\n\n// Grid Types ------------------------------------------------------------------\n\n/** Controls how columns are laid out in grid components. */\nexport type GuideVariant = 'line' | 'pattern' | 'fixed' | 'auto'\n\n/**\n * Valid value types for grid columns. Can be a CSS length, fractional unit,\n * or 'auto' for automatic sizing.\n */\nexport type GuideColumnValue = string | number | undefined | 'auto'\n\n/** Array of column definitions for pattern-based grid layouts. */\nexport type GuideColumnsPattern = readonly GuideColumnValue[]\n\n// === Grid Constants ===\n\n/** Valid grid alignment values. */\nexport const GRID_ALIGNMENTS = ['start', 'center', 'end'] as const\nexport type GridAlignment = typeof GRID_ALIGNMENTS[number]\n\n/** Valid component variants affecting visual style. */\nexport const PADD_VARIANTS = ['line', 'flat'] as const\nexport type PaddedVariant = typeof PADD_VARIANTS[number]\n\n// Component Base Types --------------------------------------------------------\n\n/**\n * Common props shared across library components.\n * Provides consistent sizing, spacing, styling, and debugging options.\n */\nexport type ComponentsProps = {\n debugging?: DebuggingMode;\n className?: string;\n style?: React.CSSProperties;\n height?: React.CSSProperties['height'];\n width?: React.CSSProperties['width'];\n} & SpacingProps\n\n/** Base configuration for components that support padding. */\nexport type PaddedBaseConfig = {\n base?: number;\n color?: React.CSSProperties['color'] | React.CSSProperties['backgroundColor'];\n zIndex?: React.CSSProperties['zIndex'];\n}\n\nexport type Variant = 'line' | 'flat' | 'pattern'\n\nexport type Gaps = {\n gap?: React.CSSProperties['gap']\n rowGap?: never\n columnGap?: never\n} | {\n /** When using separate gaps, omit unified gap */\n gap?: never\n rowGap?: React.CSSProperties['rowGap']\n columnGap?: React.CSSProperties['columnGap']\n}\n"],"names":["REACT_ELEMENT_TYPE","REACT_FRAGMENT_TYPE","jsxProd","type","config","maybeKey","key","propName","reactJsxRuntime_production","getComponentNameFromType","REACT_CLIENT_REFERENCE$2","REACT_PORTAL_TYPE","REACT_PROFILER_TYPE","REACT_STRICT_MODE_TYPE","REACT_SUSPENSE_TYPE","REACT_SUSPENSE_LIST_TYPE","REACT_CONTEXT_TYPE","REACT_CONSUMER_TYPE","REACT_FORWARD_REF_TYPE","innerType","REACT_MEMO_TYPE","REACT_LAZY_TYPE","testStringCoercion","value","checkKeyStringCoercion","JSCompiler_inline_result","JSCompiler_temp_const","JSCompiler_inline_result$jscomp$0","disabledLog","disableLogs","disabledDepth","prevLog","prevInfo","prevWarn","prevError","prevGroup","prevGroupCollapsed","prevGroupEnd","props","reenableLogs","assign","describeBuiltInComponentFrame","name","prefix","x","match","suffix","describeNativeComponentFrame","fn","construct","reentry","frame","componentFrameCache","previousDispatcher","ReactSharedInternals","RunInRootFrame","Fake","control","x$0","x$1","sample","namePropDescriptor","_RunInRootFrame$Deter","sampleStack","controlStack","sampleLines","controlLines","_frame","describeUnknownElementTypeFrameInDEV","prototype","getOwner","dispatcher","hasValidKey","hasOwnProperty","getter","defineKeyPropWarningGetter","displayName","warnAboutAccessingKey","specialPropKeyWarningShown","elementRefGetterWithDeprecationWarning","componentName","didWarnAboutElementRef","ReactElement","self","source","owner","jsxDEVImpl","isStaticChildren","REACT_OFFSCREEN_TYPE","REACT_CLIENT_REFERENCE$1","children","isArrayImpl","validateChildKeys","keys","k","didWarnAboutKeySpread","node","parentType","REACT_CLIENT_REFERENCE","i","child","isValidElement","validateExplicitKey","MAYBE_ITERATOR_SYMBOL","object","element","getCurrentComponentErrorInfo","ownerHasKeyUseWarning","childOwner","prevGetCurrentStack","stack","info","React","require$$0","reactJsxRuntime_development","jsxRuntimeModule","require$$1","parseUnit","num","unit","formatValue","defaultValue","DEFAULT_CONTEXT","ABSOLUTE_UNIT_CONVERSIONS","RELATIVE_UNITS","convertValue","context","parsed","ctx","moduloize","base","options","doRound","clamp","min","max","round","precision","factor","calculateRowCount","params","height","top","bottom","totalHeight","normalizeValue","clampOptions","suppressWarnings","conv","normalized","clamped","normalizeValuePair","values","defaults","first","second","parsePadding","spacing","parsePaddingValue","blockEdges","parseBlock","inlineEdges","parseInline","padding","block","inline","right","left","calculateSnappedSpacing","initial","snapping","pad","remainder","createGridSpanStyles","span","colSpan","rowSpan","gridStyles","mergeClasses","classes","mergeStyles","styles","style","assignRef","ref","error","mergeRefs","refs","createStyleOverride","defaultStyles","val","skipDimensions","_a","_b","_c","debounce","delay","timer","cancel","args","rafThrottle","rafId","lastArgs","isSSR","SSR_DIMENSIONS","safeClientValue","clientFn","fallback","hydratedValue","isHydrated","ssrValue","dynamicValue","useMeasure","dimensions","setDimensions","measure","rect","next","prev","refresh","observer","useVirtual","totalLines","lineHeight","containerRef","buffer","numericBuffer","useMemo","calculateRange","useCallback","offsetTop","viewportTop","viewportBottom","start","end","visibleRange","setVisibleRange","useState","useWindowEvents","updateRangeThrottled","updateRange","useLayoutEffect","events","handler","stableHandler","wrappedHandler","evt","useBaseline","warnOnMisalignment","didSnapRef","hasWarnedRef","initialPadding","isAligned","finalPadding","useGuide","width","variant","gap","columns","isValidGuidePattern","columnsArr","col","c","colCount","colWidth","colWidthStr","pxVal","useConfig","component","defaultConfig","useDefaultConfig","useDebug","debuggingProp","debuggingConfig","effective","GUIDE_COLORS","BASELINE_COLORS","SPACER_COLORS","BOX_COLORS","STACK_COLORS","LAYOUT_COLORS","PADDER_COLOR","DEFAULT_CONFIG","ConfigContext","createCSSVariables","baseline","guide","spacer","layout","box","padder","mergeConfig","parentConfig","Config","jsx","createDefaultSpacerStyles","textColor","flatColor","lineColor","generateMeasurements","isShown","indicatorNode","normWidth","normHeight","jsxs","Fragment","Spacer","heightProp","widthProp","variantProp","baseProp","colorProp","className","ssrMode","setIsHydrated","shouldShowMeasurements","measurements","baseStyles","heightValue","widthValue","baseValue","dimensionVars","customStyles","createPadderContainerStyles","color","stylesObj","createDirectPaddingStyles","enableSpacers","createRenderSpacerFn","debugging","safeVariant","safeDebugging","SpacerElement","widthVal","heightVal","Padder","spacingProps","isNone","internalRef","baselinePadding","stablePadding","setRefs","containerStyles","paddingStyles","renderSpacer","createDefaultLayoutStyles","colors","getGridTemplate","prop","p","createGridGapStyles","rowGap","columnGap","Layout","alignContent","alignItems","justifyContent","justifyItems","rows","layoutRef","gridTemplateColumns","gridTemplateRows","defaultLayoutStyles","gridGapStyles","autoDimensions","createDefaultBoxStyles","createBoxCustomStyles","Box","gridSpanStyles","defaultBoxStyles","boxStyles","DIRECTION_AXIS","createDefaultStackStyles","createStackGapStyles","Stack","align","direction","justify","stackRef","stackGapStyles","formattedRowGap","formattedColumnGap","formattedGap","defaultStackStyles","flexDirection","customOverrides","mergedContainerStyles","createGridConfig","columnWidth","createDefaultGuideStyles","Guide","gapProp","gutterWidth","maxWidth","measuredDimensions","containerWidth","containerHeight","gridConfig","template","columnsCount","calculatedGap","maxWidthValue","columnWidthValue","gutterWidthValue","_","colColor","UNIT_PATTERN","isValidGuideColumnValue","pattern","isGuideValue","CSS_UNITS","isGuideAlignment","GRID_ALIGNMENTS","isObject","isGuideLineConfig","isGuideColumnConfig","isAutoCalculatedGuide","createDefaultBaselineStyles","createBaselineRowStyle","index","chosenColor","Baseline","_normWidth","paddingValues","rowCount","virtualResult","stableVirtual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AAA,CACC,UAAWjH,GAAO,IAElB,iBAAgBwP,EAChB,MAAOD,EAAYC,CAAQ,CAAA,EAFtBA,CAGP,CAEH,CAAA,CAAA,CACL,CAEJ,CAAC,EC3NYjB,GAAkB,CAAC,QAAS,SAAU,KAAK,EAI3CkB,GAAgB,CAAC,OAAQ,MAAM","x_google_ignoreList":[0,1,2]}
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/components/Config/defaults.ts","../src/components/Config/Config.tsx","../src/utils/parse.ts","../src/utils/convert.ts","../src/utils/math.ts","../src/utils/normalize.ts","../src/utils/padding.ts","../src/utils/snapping.ts","../src/utils/grid.ts","../src/utils/merge.ts","../src/utils/timing.ts","../src/hooks/useIsClient.ts","../src/utils/ssr.tsx","../src/hooks/useMeasure.ts","../src/hooks/useVirtual.ts","../src/hooks/useBaseline.ts","../src/components/Spacer/Spacer.tsx","../src/components/Padder/Padder.tsx","../src/components/Layout/Layout.tsx","../src/components/Box/Box.tsx","../src/components/Stack/Stack.tsx","../src/components/Guide/Guide.tsx","../src/components/Guide/validation.ts","../src/hooks/useGuide.ts","../src/hooks/useConfig.ts","../src/hooks/useDebug.ts","../src/components/Baseline/Baseline.tsx"],"sourcesContent":["/**\n * @file defaults.ts\n * @description Default theme and configuration values for baseline-kit\n * @module baseline-kit/components/Config\n */\n\nimport type { ConfigSchema } from './Config'\n\n/**\n * CSS variable-based color configuration for Guide component.\n * Maps each guide variant to its theme color.\n */\nconst GUIDE_COLORS = {\n /** Color for single-line guides */\n line: 'var(--bk-guide-color-line-theme)',\n /** Color for pattern-based guides */\n pattern: 'var(--bk-guide-color-pattern-theme)',\n /** Color for auto-calculated guides */\n auto: 'var(--bk-guide-color-auto-theme)',\n /** Color for fixed-column guides */\n fixed: 'var(--bk-guide-color-fixed-theme)',\n} as const\n\n/**\n * CSS variable-based color configuration for Baseline component.\n */\nconst BASELINE_COLORS = {\n /** Color for line variant */\n line: 'var(--bk-baseline-color-line-theme)',\n /** Color for flat/block variant */\n flat: 'var(--bk-baseline-color-flat-theme)',\n} as const\n\n/**\n * CSS variable-based color configuration for Spacer component.\n */\nconst SPACER_COLORS = {\n /** Color for line-style spacers */\n line: 'var(--bk-spacer-color-line-theme)',\n /** Color for flat/block spacers */\n flat: 'var(--bk-spacer-color-flat-theme)',\n /** Color for measurement indicators */\n text: 'var(--bk-spacer-color-text-theme)',\n} as const\n\n/**\n * CSS variable-based color configuration for Box component.\n */\nconst BOX_COLORS = {\n /** Border color for debug outline */\n line: 'var(--bk-box-color-line-theme)',\n /** Background color for debug mode */\n flat: 'var(--bk-box-color-flat-theme)',\n /** Color for measurement indicators */\n text: 'var(--bk-box-color-text-theme)',\n} as const\n\n/**\n * CSS variable-based color configuration for Stack/Flex component.\n */\nconst STACK_COLORS = {\n /** Border color for debug outline */\n line: 'var(--bk-stack-color-line-theme)',\n /** Background color for debug mode */\n flat: 'var(--bk-stack-color-flat-theme)',\n /** Color for measurement indicators */\n text: 'var(--bk-stack-color-text-theme)',\n} as const\n\n/**\n * CSS variable-based color configuration for Layout component.\n */\nconst LAYOUT_COLORS = {\n /** Border color for debug outline */\n line: 'var(--bk-layout-color-line-theme)',\n /** Background color for debug mode */\n flat: 'var(--bk-layout-color-flat-theme)',\n /** Color for measurement indicators */\n text: 'var(--bk-layout-color-text-theme)',\n} as const\n\n/** CSS variable for Padder component color */\nconst PADDER_COLOR = 'var(--bk-padder-color-theme)'\n\n/**\n * Default configuration for baseline-kit.\n *\n * @remarks\n * Provides the base configuration for all components including:\n * - Base unit for spacing calculations (8px default)\n * - Default component variants\n * - Initial debugging modes\n * - Theme color assignments\n *\n * Each component section includes:\n * - Visual variant selection (where applicable)\n * - Debugging mode setting\n * - Color theme assignments\n *\n * The configuration is marked as const to ensure type safety\n * and prevent accidental modifications.\n */\nexport const DEFAULT_CONFIG: ConfigSchema = {\n /** Base unit for spacing calculations (in pixels) */\n base: 8,\n\n /** Baseline grid configuration */\n baseline: {\n variant: 'line',\n debugging: 'hidden',\n colors: BASELINE_COLORS,\n },\n\n /** Guide overlay configuration */\n guide: {\n variant: 'line',\n debugging: 'hidden',\n colors: GUIDE_COLORS,\n },\n\n /** Spacer component configuration */\n spacer: {\n variant: 'line',\n debugging: 'hidden',\n colors: SPACER_COLORS,\n },\n\n /** Box component configuration */\n box: {\n debugging: 'hidden',\n colors: BOX_COLORS,\n },\n\n /** Stack/Flex component configuration */\n stack: {\n debugging: 'hidden',\n colors: STACK_COLORS,\n },\n\n /** Layout component configuration */\n layout: {\n debugging: 'hidden',\n colors: LAYOUT_COLORS,\n },\n\n /** Padder component configuration */\n padder: {\n debugging: 'hidden',\n color: PADDER_COLOR,\n },\n} as const\n","import * as React from 'react'\nimport { BaselineVariant } from '@/components'\nimport { DEFAULT_CONFIG } from './defaults'\nimport type { GuideVariant, Variant } from '../types'\n\n/**\n * Controls component debugging visibility and behavior.\n *\n * @remarks\n * - `none`: Debug features are fully disabled\n * - `hidden`: Debug elements exist in DOM but are not visible\n * - `visible`: Debug elements are fully rendered and visible\n */\nexport type DebuggingMode = 'none' | 'hidden' | 'visible'\n\n/** Color configuration for component themes. */\ntype Colors = {\n /** Color for line-based visuals */\n line: string\n /** Color for flat surface visuals */\n flat: string\n /** Color for measurement indicators */\n text: string\n}\n\n/** Complete configuration schema for baseline-kit. */\nexport type ConfigSchema = {\n /** Base unit for spacing calculations */\n base: number\n /** Guide component configuration */\n guide: {\n variant: GuideVariant\n debugging: DebuggingMode\n colors: Record<GuideVariant, string>\n }\n /** Baseline component configuration */\n baseline: {\n variant: BaselineVariant\n debugging: DebuggingMode\n colors: Record<BaselineVariant, string>\n }\n /** Stack component configuration */\n stack: {\n colors: Colors\n debugging: DebuggingMode\n }\n /** Layout component configuration */\n layout: {\n colors: Colors\n debugging: DebuggingMode\n }\n /** Spacer component configuration */\n spacer: {\n variant: Variant\n debugging: DebuggingMode\n colors: Colors\n }\n /** Box component configuration */\n box: {\n colors: Colors\n debugging: DebuggingMode\n }\n /** Padder component configuration */\n padder: {\n color: string\n debugging: DebuggingMode\n }\n}\n\n// Create the context\nconst ConfigContext = React.createContext<ConfigSchema>(DEFAULT_CONFIG)\nConfigContext.displayName = 'ConfigContext'\n\n// Update to use React 19's use hook instead of useContext\nexport const useDefaultConfig = () => React.use(ConfigContext)\n\ntype ConfigProps = {\n children: React.ReactNode\n /** Base unit for spacing calculations */\n base?: number\n /** Baseline component overrides */\n baseline?: Partial<ConfigSchema['baseline']>\n /** Flex component overrides */\n stack?: Partial<ConfigSchema['stack']>\n /** Layout component overrides */\n layout?: Partial<ConfigSchema['layout']>\n /** Guide component overrides */\n guide?: Partial<ConfigSchema['guide']>\n /** Spacer component overrides */\n spacer?: Partial<ConfigSchema['spacer']>\n /** Box component overrides */\n box?: Partial<ConfigSchema['box']>\n /** Padder component overrides */\n padder?: Partial<ConfigSchema['padder']>\n}\n\n// Utils -----------------------------------------------------------------------\n\n/** Parameters for creating CSS variables */\ntype CSSVariablesParams = {\n /** Base unit for spacing calculations */\n base: number\n /** Baseline component configuration */\n baseline: ConfigSchema['baseline']\n /** Guide component configuration */\n guide: ConfigSchema['guide']\n /** Stack component configuration */\n stack: ConfigSchema['stack']\n /** Spacer component configuration */\n spacer: ConfigSchema['spacer']\n /** Layout component configuration */\n layout: ConfigSchema['layout']\n /** Box component configuration */\n box: ConfigSchema['box']\n /** Padder component configuration */\n padder: ConfigSchema['padder']\n}\n\n/**\n * Creates CSS variables from the configuration object.\n * These variables are used throughout the component library.\n */\nexport const createCSSVariables = (\n params: CSSVariablesParams\n): Record<string, string> => {\n const { base, baseline, guide, stack, spacer, layout, box, padder } = params\n\n return {\n '--bkb': `${base}px`,\n\n // Baseline Colors\n '--bkbcl': baseline.colors.line,\n '--bkbcf': baseline.colors.flat,\n\n // Guide Colors\n '--bkgcl': guide.colors.line,\n '--bkgcp': guide.colors.pattern,\n '--bkgca': guide.colors.auto,\n '--bkgcf': guide.colors.fixed,\n\n // Spacer Colors\n '--bkscl': spacer.colors.line,\n '--bkscf': spacer.colors.flat,\n '--bksci': spacer.colors.text,\n\n // Box Colors\n '--bkxcl': box.colors.line,\n '--bkxcf': box.colors.flat,\n '--bkxci': box.colors.text,\n\n // Flex Colors\n '--bkkcl': stack.colors.line,\n '--bkkcf': stack.colors.flat,\n '--bkkci': stack.colors.text,\n\n // Layout Colors\n '--bklcl': layout.colors.line,\n '--bklcf': layout.colors.flat,\n '--bklci': layout.colors.text,\n\n // Padder Color\n '--bkpc': padder.color,\n }\n}\n\n/** Parameters for merging configuration */\ntype MergeConfigParams = {\n /** Parent configuration to extend */\n parentConfig: ConfigSchema\n /** Base unit override */\n base?: number\n /** Baseline component overrides */\n baseline?: Partial<ConfigSchema['baseline']>\n /** Guide component overrides */\n guide?: Partial<ConfigSchema['guide']>\n /** Spacer component overrides */\n spacer?: Partial<ConfigSchema['spacer']>\n /** Box component overrides */\n box?: Partial<ConfigSchema['box']>\n /** Stack component overrides */\n stack?: Partial<ConfigSchema['stack']>\n /** Layout component overrides */\n layout?: Partial<ConfigSchema['layout']>\n /** Padder component overrides */\n padder?: Partial<ConfigSchema['padder']>\n}\n\n/**\n * Merges parent config with overrides.\n * Creates a new config object without mutating the parent.\n */\nexport const mergeConfig = (params: MergeConfigParams): ConfigSchema => {\n const {\n parentConfig,\n base,\n baseline,\n guide,\n spacer,\n box,\n stack,\n layout,\n padder,\n } = params\n\n return {\n base: base ?? parentConfig.base,\n baseline: { ...parentConfig.baseline, ...baseline },\n guide: { ...parentConfig.guide, ...guide },\n spacer: { ...parentConfig.spacer, ...spacer },\n box: { ...parentConfig.box, ...box },\n stack: { ...parentConfig.stack, ...stack },\n layout: { ...parentConfig.layout, ...layout },\n padder: { ...parentConfig.padder, ...padder },\n }\n}\n\n/**\n * Configuration provider for baseline-kit components.\n *\n * @remarks\n * Config provides theme and debugging settings to all nested components.\n * It allows for:\n * - Global base unit configuration\n * - Component-specific color themes\n * - Debug mode control\n * - Visual style customization\n *\n * Configs can be nested to override settings for specific sections.\n *\n * @example\n * ```tsx\n * // Basic global configuration\n * <Config base={8}>\n * <App />\n * </Config>\n *\n * // Component-specific overrides\n * <Config\n * base={8}\n * guide={{\n * debugging: \"visible\",\n * colors: {\n * line: \"rgba(255,0,0,0.2)\",\n * pattern: \"rgba(0,0,255,0.2)\"\n * }\n * }}\n * >\n * <Layout>...</Layout>\n * </Config>\n *\n * // Nested configurations\n * <Config base={8}>\n * <div>Uses 8px base</div>\n * <Config base={4}>\n * <div>Uses 4px base</div>\n * </Config>\n * </Config>\n * ```\n */\nexport function Config({\n children,\n base,\n stack,\n baseline,\n guide,\n layout,\n spacer,\n box,\n padder,\n}: ConfigProps) {\n const parentConfig = useDefaultConfig()\n\n const value = React.useMemo(() => {\n return mergeConfig({\n parentConfig,\n base,\n baseline,\n guide,\n spacer,\n box,\n stack,\n layout,\n padder,\n })\n }, [parentConfig, base, baseline, guide, spacer, box, stack, layout, padder])\n\n return <ConfigContext value={value}>{children}</ConfigContext>\n}\n","/**\n * Parses a CSS unit string into its numeric value and unit.\n *\n * @param value - CSS value string to parse\n * @returns Object with value and unit, or null if parsing fails\n */\nexport function parseUnit(\n value: string\n): { value: number; unit: string } | null {\n const match = value.trim().match(/^([+-]?[\\d.]+)([a-zA-Z%]+)$/)\n if (!match) return null\n const num = parseFloat(match[1])\n const unit = match[2]\n return { value: num, unit }\n}\n\n/**\n * Formats a value as a valid CSS string.\n *\n * @param value - Value to format\n * @param defaultValue - Optional default if value is undefined\n * @returns Formatted CSS string\n */\nexport function formatValue(\n value: string | number | undefined,\n defaultValue?: number\n): string {\n if (value === undefined && defaultValue !== undefined)\n return `${defaultValue}px`\n if (\n value === 'auto' ||\n (typeof value === 'string' &&\n /^(auto|100%|0|.*(fr|vh|vw|vmin|vmax|rem))$/.test(value))\n ) {\n return String(value)\n }\n if (typeof value === 'number') return `${value}px`\n return value ?? ''\n}\n","import { parseUnit } from './parse'\n\nexport interface ConversionContext {\n /** Parent element dimension for relative units */\n parentSize?: number\n /** Viewport width for vw units */\n viewportWidth?: number\n /** Viewport height for vh units */\n viewportHeight?: number\n /** Root font size for rem units */\n rootFontSize?: number\n /** Parent font size for em units */\n parentFontSize?: number\n}\n\nconst DEFAULT_CONTEXT: Required<ConversionContext> = {\n parentSize: 0,\n viewportWidth: typeof window !== 'undefined' ? window.innerWidth : 1920,\n viewportHeight: typeof window !== 'undefined' ? window.innerHeight : 1080,\n rootFontSize: 16,\n parentFontSize: 16,\n}\n\n/** Conversion factors for absolute units to pixels */\nexport const ABSOLUTE_UNIT_CONVERSIONS: Record<string, number> = {\n px: 1,\n in: 96, // 1in = 96px\n cm: 37.8, // 1cm = 37.8px\n mm: 3.78, // 1mm = 3.78px\n pt: 1.33, // 1pt = 1.33px\n pc: 16, // 1pc = 16px\n}\n\n/** Supported relative CSS units */\nexport const RELATIVE_UNITS: string[] = [\n 'em',\n 'rem',\n 'vh',\n 'vw',\n 'vmin',\n 'vmax',\n '%',\n]\n\n/**\n * Converts CSS values to pixels.\n *\n * @param value - CSS value to convert\n * @param context - Optional context for relative unit conversion\n * @returns Value in pixels or null if conversion fails\n */\nexport function convertValue(\n value: number | string | undefined,\n context?: ConversionContext\n): number | null {\n if (typeof value === 'number') return value\n if (typeof value !== 'string') return null\n\n const parsed = parseUnit(value)\n if (!parsed) return null\n\n const { value: num, unit } = parsed\n\n // Handle absolute units\n if (unit in ABSOLUTE_UNIT_CONVERSIONS) {\n return num * ABSOLUTE_UNIT_CONVERSIONS[unit]\n }\n\n // Special case for auto\n if (unit === 'auto') return null\n\n // Handle relative units\n if (RELATIVE_UNITS.includes(unit)) {\n const ctx = { ...DEFAULT_CONTEXT, ...context }\n switch (unit) {\n case 'em':\n return num * ctx.parentFontSize\n case 'rem':\n return num * ctx.rootFontSize\n case 'vh':\n return (num / 100) * ctx.viewportHeight\n case 'vw':\n return (num / 100) * ctx.viewportWidth\n case 'vmin':\n return (num / 100) * Math.min(ctx.viewportWidth, ctx.viewportHeight)\n case 'vmax':\n return (num / 100) * Math.max(ctx.viewportWidth, ctx.viewportHeight)\n case '%':\n return (num / 100) * ctx.parentSize\n default:\n return null\n }\n }\n return null\n}\n","import { convertValue } from './convert'\n\n/**\n * Calculates the modulo (remainder) of a CSS value when divided by a base unit.\n *\n * @param value - Input value (number or CSS string)\n * @param base - Base unit to calculate remainder against\n * @param options - Optional calculation controls\n * @returns Remainder in pixel units (e.g., \"6px\")\n */\nexport function moduloize(\n value: number | string | undefined,\n base: number,\n options?: { round?: boolean }\n): string {\n const doRound = options?.round ?? true\n const num =\n value === undefined\n ? 0\n : typeof value === 'number'\n ? value\n : (convertValue(value) ?? 0)\n const normalized = doRound ? Math.round(num) : num\n const remainder = normalized % base\n return `${remainder}px`\n}\n\n/**\n * Constrains a number within a specified range.\n *\n * @param value - Number to clamp\n * @param min - Minimum allowed value\n * @param max - Maximum allowed value\n * @returns Clamped value\n */\nexport function clamp(value: number, min: number, max: number): number {\n return Math.min(Math.max(value, min), max)\n}\n\n/**\n * Rounds a number to specified precision.\n *\n * @param value - Number to round\n * @param precision - Decimal places (default: 0)\n * @returns Rounded number\n */\nexport function round(value: number, precision = 0): number {\n if (precision >= 0) {\n return Number(\n (Math.round(value * 10 ** precision) / 10 ** precision).toFixed(precision)\n )\n } else {\n const factor = 10 ** Math.abs(precision)\n return Math.round(value / factor) * factor\n }\n}\n\n/** Parameters for row count calculation */\ntype RowCountParams = {\n /** Available height for the container */\n height?: number\n /** Top padding/offset value */\n top: number\n /** Bottom padding/offset value */\n bottom: number\n /** Base unit for calculations */\n base: number\n}\n\n/**\n * Calculates the number of rows that fit in the available space.\n * Ensures at least one row is always returned.\n *\n * @param params - Parameters for calculation\n * @returns Number of rows that fit in the space\n */\nexport function calculateRowCount(params: RowCountParams): number {\n const { height, top, bottom, base } = params\n const totalHeight = (height ?? 0) - (top + bottom)\n return Math.max(1, Math.floor(totalHeight / base))\n}\n","import { convertValue } from './convert'\nimport { clamp } from './math'\n\nexport interface NormalizationOptions {\n /** Base unit for normalization */\n base?: number\n /** Whether to round to nearest base multiple */\n round?: boolean\n /** Optional value clamping */\n clamp?: { min?: number; max?: number }\n /** Suppress warning messages */\n suppressWarnings?: boolean\n}\n\n/**\n * Normalizes CSS values to a consistent format based on base unit.\n *\n * @param value - Value to normalize\n * @param options - Normalization configuration\n * @returns Normalized numeric value\n */\nexport function normalizeValue(\n value: string | number | undefined,\n options: NormalizationOptions = {}\n): number {\n const {\n base = 8,\n round: doRound = true,\n clamp: clampOptions,\n suppressWarnings = false,\n } = options\n\n // Handle special cases\n if (value === 'auto') return base\n\n // Convert to number\n let num: number | null = null\n if (typeof value === 'number') {\n num = value\n } else if (typeof value === 'string') {\n const conv = convertValue(value)\n if (conv === null) {\n if (!suppressWarnings) {\n console.error(\n `Failed to convert \"${value}\" to pixels. Falling back to base ${base}.`\n )\n }\n num = base\n } else {\n num = conv\n }\n }\n if (num === null) num = base\n\n // Apply normalization\n const normalized = doRound ? Math.round(num / base) * base : num\n\n // Apply clamping if needed\n const clamped =\n clampOptions !== undefined\n ? clamp(\n normalized,\n clampOptions.min ?? -Infinity,\n clampOptions.max ?? Infinity\n )\n : normalized\n\n // Warn about adjustments\n if (!suppressWarnings && clamped !== num) {\n console.warn(`Normalized ${num} to ${clamped} to match base ${base}px.`)\n }\n\n return clamped\n}\n\n/**\n * Normalizes a pair of CSS values.\n *\n * @param values - Tuple of values to normalize\n * @param defaults - Default values if input is undefined\n * @param options - Normalization options\n * @returns Tuple of normalized values\n */\nexport function normalizeValuePair(\n values:\n | [string | number | undefined, string | number | undefined]\n | undefined,\n defaults: [number, number],\n options?: NormalizationOptions\n): [number, number] {\n if (!values) return defaults\n\n if (values[0] === undefined && values[1] === undefined) {\n return defaults\n }\n\n const first =\n values[0] !== undefined ? normalizeValue(values[0], options) : defaults[0]\n const second =\n values[1] !== undefined ? normalizeValue(values[1], options) : defaults[1]\n return [first, second]\n}\n","import { Padding, PaddingValue, Spacing, SpacingProps } from '@components'\n\n/**\n * Extract numeric top, right, bottom, left (in px) from `padding` or `block/inline`.\n * @param spacing - The props which may include padding, block, inline\n * @returns { top, right, bottom, left } with 0 defaults\n *\n * Priority (if padding is defined, it overrides block/inline):\n * - If `padding` is present, parse it fully (4 edges).\n * - Otherwise, parse `block` for top/bottom and `inline` for left/right.\n */\nexport function parsePadding(spacing: SpacingProps): Padding {\n if ('padding' in spacing && spacing.padding != null) {\n return parsePaddingValue(spacing.padding)\n }\n\n // Otherwise, parse block/inline separately\n const blockEdges =\n 'block' in spacing && spacing.block != null\n ? parseBlock(spacing.block)\n : { top: 0, bottom: 0 }\n const inlineEdges =\n 'inline' in spacing && spacing.inline != null\n ? parseInline(spacing.inline)\n : { left: 0, right: 0 }\n\n // Merge partial edges\n return {\n top: blockEdges.top,\n right: inlineEdges.right,\n bottom: blockEdges.bottom,\n left: inlineEdges.left,\n }\n}\n\n/**\n * Parses `padding` of various shapes to { top, right, bottom, left } in px.\n *\n * @param padding - number | [block, inline] | [top, right, bottom, left] | { start?: number; end?: number; left?: number; right?: number }\n */\nfunction parsePaddingValue(padding: PaddingValue): Padding {\n if (typeof padding === 'number') {\n return { top: padding, right: padding, bottom: padding, left: padding }\n }\n\n if (Array.isArray(padding)) {\n if (padding.length === 2) {\n const [block, inline] = padding\n return { top: block, right: inline, bottom: block, left: inline }\n }\n if (padding.length >= 4) {\n const [top, right, bottom, left] = padding\n return {\n top: top ?? 0,\n right: right ?? 0,\n bottom: bottom ?? 0,\n left: left ?? 0,\n }\n }\n }\n\n if (typeof padding === 'object' && !Array.isArray(padding)) {\n // possible keys: top, bottom, left, right, start, end\n // interpret start => top, end => bottom if you prefer\n const top = padding.top ?? 0\n const bottom = padding.bottom ?? 0\n const left = padding.left ?? 0\n const right = padding.right ?? 0\n return { top, right, bottom, left }\n }\n\n // fallback\n return { top: 0, right: 0, bottom: 0, left: 0 }\n}\n\n/**\n * Parses `block` of various shapes to { top, bottom } in px.\n * @param block - number | [top, bottom] | { start?: number; end?: number }\n */\nfunction parseBlock(block: Spacing): Pick<Padding, 'top' | 'bottom'> {\n if (typeof block === 'number') {\n return { top: block, bottom: block }\n }\n\n // [top, bottom]\n if (Array.isArray(block)) {\n const [top, bottom] = block\n return {\n top: top ?? 0,\n bottom: bottom ?? 0,\n }\n }\n\n // object { start, end }\n if (typeof block === 'object') {\n return {\n top: block.start ?? 0,\n bottom: block.end ?? 0,\n }\n }\n\n return { top: 0, bottom: 0 }\n}\n\n/**\n * Parses `inline` of various shapes to { left, right } in px.\n * @param inline - number | [left, right] | { start?: number; end?: number }\n */\nfunction parseInline(inline: Spacing): Pick<Padding, 'left' | 'right'> {\n if (typeof inline === 'number') {\n return { left: inline, right: inline }\n }\n\n if (Array.isArray(inline)) {\n const [left, right] = inline\n return {\n left: left ?? 0,\n right: right ?? 0,\n }\n }\n\n if (typeof inline === 'object') {\n return {\n left: inline.start ?? 0,\n right: inline.end ?? 0,\n }\n }\n\n return { left: 0, right: 0 }\n}\n","import { SnappingMode, Padding, PaddingValue } from '@components'\nimport { parsePadding } from '@/utils/padding'\n\n/**\n * Calculates spacing adjustments to maintain baseline grid alignment.\n *\n * @remarks\n * Provides different snapping behaviors:\n * - none: No adjustments\n * - height: Adjusts bottom padding only\n * - clamp: Adjusts both top and bottom padding\n *\n * @param height - Measured element height\n * @param base - Grid base unit\n * @param initial - Initial spacing values\n * @param snapping - Snapping mode to apply\n * @returns Adjusted spacing values\n *\n * @example\n * ```ts\n * // Height snapping mode\n * calculateSnappedSpacing(46, 8, { top: 10, bottom: 10 }, 'height')\n * // => { top: 10, right: 0, bottom: 12, left: 0 }\n *\n * // Clamp mode\n * calculateSnappedSpacing(45, 8, { top: 10, bottom: 6 }, 'clamp')\n * // => { top: 2, right: 0, bottom: 1, left: 0 }\n * ```\n */\nexport function calculateSnappedSpacing(\n height: number,\n base: number,\n initial: PaddingValue,\n snapping: SnappingMode\n): Padding {\n const pad: Padding = parsePadding({ padding: initial })\n\n if (snapping === 'none') {\n return pad\n }\n\n if (snapping === 'height') {\n const remainder = height % base\n if (remainder !== 0) {\n pad.bottom += base - remainder\n }\n }\n\n if (snapping === 'clamp') {\n pad.top = pad.top % base\n const remainder = height % base\n if (remainder !== 0) {\n pad.bottom += base - remainder\n }\n pad.bottom = pad.bottom % base\n }\n\n return pad\n}\n","/**\n * @file grid.ts\n * @description Grid layout utilities\n * @module utils\n */\n\nimport * as React from 'react'\n\n/**\n * Creates grid span styles based on span props.\n * Handles both combined span and individual col/row span values.\n *\n * @param span - Optional equal span for both rows and columns\n * @param colSpan - Optional column span value\n * @param rowSpan - Optional row span value\n * @returns CSS properties object with grid span values\n *\n * @example\n * ```ts\n * createGridSpanStyles(2) // => { gridColumn: \"span 2\", gridRow: \"span 2\" }\n * createGridSpanStyles(undefined, 3, 2) // => { gridColumn: \"span 3\", gridRow: \"span 2\" }\n * ```\n */\nexport const createGridSpanStyles = (\n span?: number,\n colSpan?: number,\n rowSpan?: number\n): React.CSSProperties => {\n const gridStyles: React.CSSProperties = {}\n\n if (span !== undefined) {\n gridStyles.gridColumn = `span ${span}`\n gridStyles.gridRow = `span ${span}`\n } else {\n if (colSpan !== undefined) {\n gridStyles.gridColumn = `span ${colSpan}`\n }\n if (rowSpan !== undefined) {\n gridStyles.gridRow = `span ${rowSpan}`\n }\n }\n\n return gridStyles\n}\n","import * as React from 'react'\n\n/**\n * Combines class names, filtering out falsy values.\n *\n * @remarks\n * - Filters out false, null, undefined\n * - Trims whitespace\n * - Preserves order of classes\n *\n * @param classes - Array of potential class names\n * @returns Combined class string\n *\n * @example\n * ```ts\n * mergeClasses('btn', isActive && 'active', undefined)\n * // => \"btn active\"\n * ```\n */\nexport const mergeClasses = (\n ...classes: Array<string | boolean | undefined | null>\n): string => classes.filter(Boolean).join(' ').trim()\n\n/**\n * Combines multiple style objects with type safety.\n *\n * @remarks\n * - Preserves type information\n * - Handles undefined values\n * - Merges deeply nested styles\n *\n * @param styles - Array of style objects\n * @returns Combined style object\n *\n * @example\n * ```ts\n * mergeStyles(\n * { color: 'red' },\n * isLarge && { fontSize: '2em' },\n * customStyles\n * )\n * ```\n */\nexport const mergeStyles = <T extends React.CSSProperties>(\n ...styles: Array<T | undefined>\n): T =>\n Object.assign(\n {},\n ...styles.filter((style): style is T => style !== undefined)\n )\n\n/**\n * Assigns a value to a React ref.\n */\nfunction assignRef<T>(\n ref: React.Ref<T> | null | undefined,\n node: T | null\n): void {\n if (!ref) return\n if (typeof ref === 'function') {\n ref(node)\n } else {\n try {\n Object.assign(ref, { current: node })\n } catch (error) {\n console.error('Error assigning ref:', error)\n }\n }\n}\n\n/**\n * Merges multiple React refs into a single callback ref.\n *\n * @remarks\n * Handles:\n * - Function refs\n * - Object refs\n * - Undefined/null refs\n *\n * @param refs - Array of refs to merge\n * @returns Combined ref callback\n *\n * @example\n * ```tsx\n * const Component = React.forwardRef((props, ref) => {\n * const localRef = useRef(null);\n * const combinedRef = mergeRefs(ref, localRef);\n *\n * return <div ref={combinedRef} />;\n * });\n * ```\n */\nexport function mergeRefs<T>(\n ...refs: Array<React.Ref<T> | null | undefined>\n): React.RefCallback<T> {\n return (node: T | null) => {\n refs.forEach((ref) => {\n assignRef(ref, node)\n })\n }\n}\n\n/**\n * Parameters for creating a style override\n */\nexport type StyleOverrideParams = {\n /** CSS variable key to potentially override */\n key: string\n /** Value to use if override is needed */\n value: string\n /** Default styles to compare against */\n defaultStyles: Record<string, string>\n /** Special case dimensions that should be skipped for specific values */\n skipDimensions?: {\n /** Dimensions that should be skipped when they're set to \"fit-content\" */\n fitContent?: string[]\n /** Dimensions that should be skipped when they're set to \"auto\" */\n auto?: string[]\n /** Dimensions that should be skipped when they're set to % values (like \"100%\") */\n fullSize?: string[]\n }\n}\n\n/**\n * Creates style overrides for CSS variables, conditionally based on comparison to defaults.\n * Only applies overrides when the value differs from the default, optimizing style objects.\n *\n * @param params - Style override parameters or individual arguments\n * @param value\n * @param defaultStyles\n * @returns Style object with override (if needed)\n *\n * @example\n * ```ts\n * // Object parameter style:\n * createStyleOverride({\n * key: '--color',\n * value: 'red',\n * defaultStyles: { '--color': 'blue' }\n * })\n * // => { '--color': 'red' }\n *\n * // With dimension skipping:\n * createStyleOverride({\n * key: '--width',\n * value: 'fit-content',\n * defaultStyles: { '--width': 'auto' },\n * skipDimensions: { fitContent: ['--width', '--height'] }\n * })\n * // => {}\n *\n * // Legacy style with separate arguments:\n * createStyleOverride('--color', 'red', { '--color': 'blue' })\n * // => { '--color': 'red' }\n * ```\n */\nexport function createStyleOverride(\n params: StyleOverrideParams | string,\n value?: string,\n defaultStyles?: Record<string, string>\n): Record<string, string | number> {\n // Handle both object parameter and individual arguments for backward compatibility\n const key = typeof params === 'string' ? params : params.key\n const val = typeof params === 'string' ? value! : params.value\n const defaults =\n typeof params === 'string' ? defaultStyles! : params.defaultStyles\n const skipDimensions =\n typeof params === 'object' ? params.skipDimensions : undefined\n\n // Skip dimensions based on specific values\n if (skipDimensions) {\n // Skip 'fit-content' dimensions (Box, Spacer patterns)\n if (skipDimensions.fitContent?.includes(key) && val === 'fit-content') {\n return {}\n }\n\n // Skip 'auto' dimensions (Stack, Layout patterns)\n if (skipDimensions.auto?.includes(key) && val === 'auto') {\n return {}\n }\n\n // Skip '100%' or '100vh/vw' dimensions (Guide, some Spacer patterns)\n if (\n skipDimensions.fullSize?.includes(key) &&\n (val === '100%' || val === '100vh' || val === '100vw')\n ) {\n return {}\n }\n }\n\n // Only apply override if value differs from default\n return val !== defaults[key] ? { [key]: val } : {}\n}\n","/**\n * Creates a debounced version of a function.\n *\n * @remarks\n * Useful for:\n * - Handling rapid event sequences\n * - Limiting API calls\n * - Performance optimization\n *\n * @param fn - Function to debounce\n * @param delay - Delay in milliseconds\n * @returns Debounced function\n *\n * @example\n * ```ts\n * const handleResize = debounce(() => {\n * // Expensive calculation\n * }, 100);\n *\n * window.addEventListener('resize', handleResize);\n * ```\n */\nexport const debounce = <T extends (...args: unknown[]) => void>(\n fn: T,\n delay: number\n): [T, () => void] => {\n let timer: ReturnType<typeof setTimeout> | null = null\n\n const cancel = () => {\n if (timer) {\n clearTimeout(timer)\n timer = null\n }\n }\n\n const debounced = ((...args) => {\n cancel()\n timer = setTimeout(() => fn(...args), delay)\n }) as T\n\n return [debounced, cancel]\n}\n\n/**\n * Creates a requestAnimationFrame-based throttled function.\n *\n * @remarks\n * Optimizes performance by:\n * - Limiting execution to animation frames\n * - Preventing rapid-fire calls\n * - Maintaining visual smoothness\n *\n * @param fn - Function to throttle\n * @returns RAF-throttled function\n *\n * @example\n * ```ts\n * const updateScroll = rafThrottle(() => {\n * // Update scroll position\n * });\n *\n * document.addEventListener('scroll', updateScroll);\n * ```\n */\nexport const rafThrottle = <T extends (...args: never[]) => void>(fn: T): T => {\n let rafId: number | null = null\n let lastArgs: Parameters<T> | null = null\n\n const throttled = (...args: Parameters<T>) => {\n lastArgs = args\n\n if (rafId !== null) {\n cancelAnimationFrame(rafId)\n }\n\n rafId = requestAnimationFrame(() => {\n fn(...lastArgs!)\n rafId = null\n lastArgs = null\n })\n }\n\n return throttled as T\n}\n","import { useEffect, useState } from 'react'\n\n/**\n * Hook to determine if the code is running on the client side.\n *\n * @returns Boolean indicating if the code is running in a browser environment\n */\nexport function useIsClient() {\n // Start with false for SSR\n const [isClient, setIsClient] = useState(false)\n\n // Only run once on mount\n useEffect(() => {\n setIsClient(true)\n }, [])\n\n return isClient\n}\n","/**\n * SSR (Server-Side Rendering) utility functions for baseline-kit.\n */\nimport * as React from 'react'\nimport { useIsClient } from '../hooks/useIsClient'\n\n/**\n * Detects if code is running in a server-side environment\n */\nexport const isSSR = typeof window === 'undefined'\n\n/**\n * Default dimensions to use during server-side rendering\n */\nexport const SSR_DIMENSIONS = {\n width: 1024,\n height: 768,\n}\n\n/**\n * Safe window-using function that works in both server and client\n * @param clientFn Function that uses window/browser APIs\n * @param fallback Fallback value to use in SSR environment\n * @returns Result of clientFn in browser, fallback in SSR\n */\nexport function safeClientValue<T>(clientFn: () => T, fallback: T): T {\n if (isSSR) {\n return fallback\n }\n\n try {\n return clientFn()\n } catch {\n return fallback\n }\n}\n\n/**\n * Returns a stable value during SSR and initial render, then switches to\n * the dynamic value after hydration\n * @param isHydrated Boolean indicating if component is hydrated\n * @param ssrValue Value to use during SSR/initial render\n * @param dynamicValue Value to use after hydration\n */\nexport function hydratedValue<T>(\n isHydrated: boolean,\n ssrValue: T,\n dynamicValue: T\n): T {\n return !isHydrated || isSSR ? ssrValue : dynamicValue\n}\n\n/**\n * ClientOnly component props\n * @internal\n */\ninterface ClientOnlyProps {\n /**\n * Content to render when on the client-side\n */\n children: React.ReactNode\n /**\n * Optional fallback to show during SSR\n */\n fallback?: React.ReactNode\n}\n\n/**\n * A utility component that only renders its children on the client side.\n * @internal Not part of the public API\n */\nexport function ClientOnly({ children, fallback = null }: ClientOnlyProps) {\n const isClient = useIsClient()\n\n if (!isClient) {\n return <>{fallback}</>\n }\n\n return <>{children}</>\n}\n","import * as React from 'react'\nimport { rafThrottle } from '@utils'\n\nexport interface MeasureResult {\n /** Measured width in pixels */\n width: number\n /** Measured height in pixels */\n height: number\n /** Function to force a remeasurement */\n refresh: () => void\n}\n\n/**\n * Hook for measuring and tracking DOM element dimensions.\n *\n * Provides responsive element measurements using ResizeObserver,\n * with performance optimization (via RAF throttling), error handling,\n * and a manual refresh method.\n *\n * @param ref - Reference to the DOM element to measure\n * @returns Current dimensions and refresh function\n *\n * @example\n * ```tsx\n * function ResponsiveBox() {\n * const ref = React.useRef<HTMLDivElement>(null);\n * const { width, height, refresh } = useMeasure(ref);\n *\n * return (\n * <div ref={ref} className=\"responsive-box\">\n * Width: {width}px, Height: {height}px\n * <button onClick={refresh}>Remeasure</button>\n * </div>\n * );\n * }\n * ```\n */\nexport function useMeasure(\n ref: React.RefObject<HTMLElement | null>\n): MeasureResult {\n const [dimensions, setDimensions] = React.useState({ width: 0, height: 0 })\n\n // measure() reads getBoundingClientRect() from ref.current\n const measure = React.useCallback(() => {\n if (!ref.current) return\n try {\n const rect = ref.current.getBoundingClientRect()\n const next = {\n width: rect ? Math.round(rect.width) : 0,\n height: rect ? Math.round(rect.height) : 0,\n }\n setDimensions((prev) =>\n prev.width === next.width && prev.height === next.height ? prev : next\n )\n } catch {\n setDimensions({ width: 0, height: 0 })\n }\n }, [ref])\n\n // Create a throttled version of measure using RAF.\n const refresh = React.useMemo(() => rafThrottle(measure), [measure])\n\n // On mount (or when ref changes) perform an immediate measurement.\n React.useLayoutEffect(() => {\n if (typeof window === 'undefined') return\n measure()\n }, [measure])\n\n // Set up a ResizeObserver on mount.\n React.useLayoutEffect(() => {\n if (typeof window === 'undefined' || !ref.current) return\n const observer = new ResizeObserver(() => {\n refresh()\n })\n observer.observe(ref.current)\n return () => {\n observer.disconnect()\n }\n }, [ref, refresh])\n\n return { ...dimensions, refresh }\n}\n","import {\n RefObject,\n useCallback,\n useLayoutEffect,\n useMemo,\n useState,\n} from 'react'\nimport { rafThrottle } from '@utils'\n\ntype VirtualResult = {\n /** Total number of items/lines to virtualize */\n totalLines: number\n /** Height of each item in pixels */\n lineHeight: number\n /** Reference to the scrollable container */\n containerRef: RefObject<HTMLDivElement | null>\n /** Additional items to render above/below viewport */\n buffer?: number | string\n}\n\n/**\n * Hook for optimizing large lists through virtual scrolling.\n *\n * @remarks\n * This hook helps manage virtual scrolling by:\n * - Calculating visible item ranges\n * - Handling scroll events efficiently\n * - Managing buffer zones for smooth scrolling\n * - Supporting dynamic container sizes\n *\n * Performance optimizations:\n * - RAF-based scroll handling\n * - Intersection Observer for visibility\n * - Buffer zones to prevent flicker\n * - Efficient range calculations\n *\n * @param options - Virtual scrolling configuration\n * @returns Object containing start and end indices of visible items\n *\n * @example\n * ```tsx\n * function VirtualList() {\n * const containerRef = useRef<HTMLDivElement>(null);\n * const { start, end } = useVirtual({\n * totalLines: 1000,\n * lineHeight: 30,\n * containerRef,\n * buffer: 5\n * });\n *\n * return (\n * <div ref={containerRef} className=\"scroll-container\">\n * <div style={{ height: 1000 * 30 }}>\n * {items.slice(start, end).map(item => (\n * <div key={item.id} style={{ height: 30 }}>\n * {item.content}\n * </div>\n * ))}\n * </div>\n * </div>\n * );\n * }\n * ```\n */\nexport function useVirtual({\n totalLines,\n lineHeight,\n containerRef,\n buffer = 0,\n}: VirtualResult) {\n // Convert buffer to numeric value\n const numericBuffer = useMemo(\n () => (typeof buffer === 'number' ? buffer : parseInt(buffer, 10) || 0),\n [buffer]\n )\n\n /**\n * Calculates the visible range of items based on scroll position\n * and viewport dimensions.\n */\n const calculateRange = useCallback(() => {\n const element = containerRef.current\n if (!element) return { start: 0, end: totalLines }\n\n // Show all lines if container is inside .content-block\n if (element.closest('.block')) {\n return { start: 0, end: totalLines }\n }\n\n // Calculate visible range\n const rect = element.getBoundingClientRect()\n const offsetTop = rect.top + window.scrollY\n const viewportTop = Math.max(0, window.scrollY - offsetTop - numericBuffer)\n const viewportBottom = viewportTop + window.innerHeight + numericBuffer * 2\n\n const start = Math.max(0, Math.floor(viewportTop / lineHeight))\n const end = Math.min(totalLines, Math.ceil(viewportBottom / lineHeight))\n\n return { start, end }\n }, [totalLines, lineHeight, containerRef, numericBuffer])\n\n const [visibleRange, setVisibleRange] = useState(calculateRange)\n\n // Subscribe to window events using our helper\n useWindowEvents(['scroll', 'resize'], () => {\n updateRangeThrottled()\n })\n\n // Throttle updates for performance\n const updateRange = useCallback(() => {\n setVisibleRange((prev) => {\n const next = calculateRange()\n return prev.start !== next.start || prev.end !== next.end ? next : prev\n })\n }, [calculateRange])\n\n const updateRangeThrottled = useMemo(\n () => rafThrottle(updateRange),\n [updateRange]\n )\n\n useLayoutEffect(() => {\n const element = containerRef.current\n if (!element) return\n\n // Use IntersectionObserver for visibility tracking\n const observer = new IntersectionObserver(updateRangeThrottled, {\n threshold: 0,\n })\n observer.observe(element)\n updateRangeThrottled()\n\n return () => {\n observer.disconnect()\n }\n }, [containerRef, calculateRange, updateRangeThrottled])\n\n return visibleRange\n}\n\n/** Helper hook to manage multiple window event listeners. */\nfunction useWindowEvents(events: string[], handler: () => void) {\n const stableHandler = useCallback(handler, [handler])\n\n useLayoutEffect(() => {\n const wrappedHandler = () => stableHandler()\n events.forEach((evt) => window.addEventListener(evt, wrappedHandler))\n return () =>\n events.forEach((evt) => window.removeEventListener(evt, wrappedHandler))\n }, [events, stableHandler])\n}\n","import * as React from 'react'\nimport { useMeasure } from './useMeasure'\nimport { calculateSnappedSpacing } from '@utils'\nimport type { SnappingMode, Padding } from '@components'\nimport { parsePadding } from '@utils'\n\nexport interface BaselineOptions {\n /* Base unit for alignment (default 8). */\n base?: number\n /** Snapping strategy: 'none' | 'height' | 'clamp'. */\n snapping?: SnappingMode\n /** Initial padding config. e.g. { top: 10, bottom: 20 } or just 8, etc. */\n spacing?: Partial<Padding> | number\n /** Whether to warn in the console if the measured height is not a multiple of base. */\n warnOnMisalignment?: boolean\n}\n\nexport interface BaselineResult {\n padding: Padding\n isAligned: boolean\n height: number\n}\n\n/**\n * Hook for managing baseline grid alignment in components.\n *\n * @remarks\n * This hook handles the complex calculations needed to maintain baseline grid\n * alignment, including:\n * ▪\tMeasuring element dimensions\n * ▪\tCalculating padding adjustments\n * ▪\tPotentially snapping values to ensure multiples of the base\n * ▪\tWarning about misalignments in development\n *\n * Different snapping modes affect how spacing is adjusted:\n * ▪\t'none': Uses raw spacing values without adjustment\n * ▪\t'height': Adjusts only the final (bottom) padding to align\n * ▪\t'clamp': Adjusts top and bottom to align\n *\n * @param ref Reference to the DOM element\n * @param options Configuration options for alignment behavior\n * @returns Object with adjusted padding, alignment status, and height\n *\n * @example\n * ```tsx\n * export function MyComponent() {\n * const ref = useRef<HTMLDivElement>(null)\n * const { padding } = useBaseline(ref, {\n * base: 8,\n * snapping: 'height',\n * spacing: {\n * top: 16,\n * bottom: 16\n * }\n * }}\n * >\n * Content\n * </div>\n * )\n * }\n */\nexport function useBaseline(\n ref: React.RefObject<HTMLElement | null>,\n {\n base = 8,\n snapping = 'none',\n spacing = {},\n warnOnMisalignment = false,\n }: BaselineOptions = {}\n): BaselineResult {\n if (base < 1) {\n throw new Error('Base must be >= 1 for baseline alignment.')\n }\n\n const { height } = useMeasure(ref)\n // Track whether we've already snapped once for this component.\n const didSnapRef = React.useRef<boolean>(false)\n const hasWarnedRef = React.useRef<boolean>(false)\n\n return React.useMemo(() => {\n // Convert the spacing prop into { top, right, bottom, left } numeric values.\n const initialPadding = parsePadding({ padding: spacing })\n const isAligned = height % base === 0\n\n // Log the warning only once\n if (\n !isAligned &&\n warnOnMisalignment &&\n process.env.NODE_ENV === 'development'\n ) {\n if (!hasWarnedRef.current) {\n console.warn(\n `[useBaseline] Element height (${height}px) is not aligned with base (${base}px).`\n )\n hasWarnedRef.current = true // Mark warning as logged\n }\n }\n\n // If snapping is disabled, just return the original padding.\n if (snapping === 'none') {\n return { padding: initialPadding, isAligned, height }\n }\n\n // If we've already snapped once, just reuse the original (or store the\n // snapped result in a ref if you prefer).\n if (didSnapRef.current) {\n return { padding: initialPadding, isAligned, height }\n }\n\n // Snap exactly once.\n const finalPadding = calculateSnappedSpacing(\n height,\n base,\n initialPadding,\n snapping\n )\n didSnapRef.current = true\n\n return { padding: finalPadding, isAligned, height }\n }, [base, snapping, spacing, warnOnMisalignment, height])\n}\n","import * as React from 'react'\nimport { useConfig, useDebug } from '@hooks'\nimport {\n mergeStyles,\n mergeClasses,\n formatValue,\n normalizeValuePair,\n createStyleOverride,\n hydratedValue,\n} from '@utils'\nimport { ComponentsProps, Variant } from '../types'\nimport styles from './styles.module.css'\n\n// Type Definitions ------------------------------------------------------------\n\nexport type IndicatorNode = (\n value: number,\n type: 'width' | 'height'\n) => React.ReactNode\n\nexport type SpacerProps = {\n /** Explicit width (takes precedence over block) */\n width?: React.CSSProperties['width']\n /** Explicit height (takes precedence over block) */\n height?: React.CSSProperties['height']\n /** Visual style in debug mode */\n variant?: Variant\n /** Color to use for debug visuals (overrides theme) */\n color?: string\n /** Base unit for measurements (defaults to theme value) */\n base?: number\n /** Custom content to render (for debugging info) */\n children?: React.ReactNode\n /** Custom indicator node rendering function */\n indicatorNode?: IndicatorNode\n /** Flag to enable SSR-compatible mode (simplified initial render) */\n ssrMode?: boolean\n} & ComponentsProps\n\n// Utils -----------------------------------------------------------------------\n\n/** Creates default spacer styles */\nconst createDefaultSpacerStyles = (\n base: number,\n textColor: string,\n flatColor: string,\n lineColor: string\n): Record<string, string> => ({\n '--bksw': '100%',\n '--bksh': '100%',\n '--bksb': `${base}px`,\n '--bksct': textColor,\n '--bkscf': flatColor,\n '--bkscl': lineColor,\n})\n\n/** Generates measurement indicators for debugging */\nconst generateMeasurements = (\n isShown: boolean,\n indicatorNode: SpacerProps['indicatorNode'],\n normWidth: number | string,\n normHeight: number | string\n): React.ReactNode | null => {\n if (!isShown || !indicatorNode) return null\n\n const width = typeof normWidth === 'number' ? normWidth : 0\n const height = typeof normHeight === 'number' ? normHeight : 0\n\n return (\n <>\n {height !== 0 && (\n <span key=\"height\">{indicatorNode(height, 'height')}</span>\n )}\n {width !== 0 && <span key=\"width\">{indicatorNode(width, 'width')}</span>}\n </>\n )\n}\n\n/**\n * Creates empty space for implementing margins, gaps, and spacing.\n *\n * @remarks\n * - Flexible sizing: Set width and height directly\n * - Normalized values: All inputs convert to base unit multiples\n * - Debug visuals: Shows spacing measurements with theming\n * - Automatic: Empty in production, visible in debug mode\n *\n * @example\n * ```tsx\n * // Fixed size spacer\n * <Spacer width={32} height={16} />\n *\n * // Percentage-based spacer with debug hints\n * <Spacer\n * width=\"50%\"\n * height={32}\n * debugging=\"visible\"\n * variant=\"line\"\n * />\n *\n * // Full-width spacer\n * <Spacer height={64} />\n * ```\n */\nexport const Spacer = React.memo(function Spacer({\n height: heightProp,\n width: widthProp,\n indicatorNode,\n debugging: debuggingProp,\n variant: variantProp,\n base: baseProp,\n color: colorProp,\n className,\n style,\n children,\n ssrMode = false,\n ...props\n}: SpacerProps) {\n const ref = React.useRef<HTMLDivElement>(null)\n const config = useConfig('spacer')\n\n const { isShown } = useDebug(debuggingProp, config.debugging)\n const variant = variantProp ?? config.variant\n const base = baseProp ?? config.base\n\n // Add hydration state tracking\n const [isHydrated, setIsHydrated] = React.useState(false)\n\n React.useEffect(() => {\n setIsHydrated(true)\n }, [])\n\n const [normWidth, normHeight] = React.useMemo(() => {\n return normalizeValuePair([widthProp, heightProp], [0, 0], {\n base,\n suppressWarnings: true,\n })\n }, [widthProp, heightProp, base])\n\n // Ensure stable rendering for measurements during SSR\n const shouldShowMeasurements = hydratedValue(\n isHydrated && !ssrMode,\n false, // Don't show measurements during SSR\n isShown && indicatorNode !== undefined\n )\n\n // Only generate measurements after hydration\n const measurements = React.useMemo(() => {\n if (!shouldShowMeasurements) {\n return null\n }\n\n return generateMeasurements(isShown, indicatorNode, normWidth, normHeight)\n }, [shouldShowMeasurements, isShown, indicatorNode, normWidth, normHeight])\n\n const defaultStyles = React.useMemo(\n () =>\n createDefaultSpacerStyles(\n base,\n config.colors.text,\n config.colors.flat,\n config.colors.line\n ),\n [base, config.colors]\n )\n\n const baseStyles = React.useMemo(() => {\n const heightValue = formatValue(normHeight || '100%')\n const widthValue = formatValue(normWidth || '100%')\n const baseValue = `${base}px`\n\n // Define dimensions that should be skipped when set to 100%\n const dimensionVars = ['--bksw', '--bksh']\n\n const customStyles = {\n ...createStyleOverride({\n key: '--bksh',\n value: heightValue,\n defaultStyles,\n skipDimensions: { fullSize: dimensionVars },\n }),\n ...createStyleOverride({\n key: '--bksw',\n value: widthValue,\n defaultStyles,\n skipDimensions: { fullSize: dimensionVars },\n }),\n // Explicitly set --bksb to ensure it is always applied\n '--bksb': baseValue,\n ...createStyleOverride({\n key: '--bksct',\n value: colorProp ?? config.colors.text,\n defaultStyles,\n }),\n ...createStyleOverride({\n key: '--bkscl',\n value: colorProp ?? config.colors.line,\n defaultStyles,\n }),\n ...createStyleOverride({\n key: '--bkscf',\n value: colorProp ?? config.colors.flat,\n defaultStyles,\n }),\n } as React.CSSProperties\n\n return mergeStyles(customStyles, style)\n }, [\n normWidth,\n normHeight,\n colorProp,\n base,\n config.colors,\n defaultStyles,\n style,\n ])\n\n return (\n <div\n ref={ref}\n data-testid=\"spacer\"\n className={mergeClasses(\n styles.spr,\n isShown && styles[variant],\n className\n )}\n data-variant={variant}\n data-height={\n typeof normHeight === 'number' ? `${normHeight}px` : normHeight\n }\n style={baseStyles}\n {...props}\n >\n {measurements}\n {children}\n </div>\n )\n})\n","import * as React from 'react'\nimport { useConfig, useDebug, useBaseline } from '@hooks'\nimport {\n mergeClasses,\n mergeStyles,\n parsePadding,\n mergeRefs,\n formatValue,\n hydratedValue,\n} from '@utils'\nimport { ComponentsProps, Variant } from '../types'\nimport { Spacer, IndicatorNode } from '../Spacer'\nimport { DebuggingMode } from '@/components'\nimport styles from './styles.module.css'\n\ntype RenderSpacerFn = (\n width: React.CSSProperties['width'],\n height: React.CSSProperties['height']\n) => React.ReactNode\n\ntype PaddingStyles = {\n paddingBlock?: string\n paddingInline?: string\n [key: string]: string | undefined\n}\n\nexport type PadderProps = {\n /** Render function for custom measurement indicators */\n indicatorNode?: IndicatorNode\n /** Flag to enable SSR-compatible mode (simplified initial render) */\n ssrMode?: boolean\n children?: React.ReactNode\n} & ComponentsProps\n\n/** Creates default container styles for Padder */\nconst createPadderContainerStyles = (\n width: React.CSSProperties['width'],\n height: React.CSSProperties['height'],\n base: number,\n color: string\n): Record<string, string> => {\n const stylesObj: Record<string, string> = {}\n\n // Only inject width/height if they differ from defaults\n if (width !== 'fit-content') {\n stylesObj['--bkpw'] = formatValue(width || 'fit-content')\n }\n if (height !== 'fit-content') {\n stylesObj['--bkph'] = formatValue(height || 'fit-content')\n }\n\n // Always set base and color\n stylesObj['--bkpb'] = `${base}px`\n stylesObj['--bkpc'] = color\n\n return stylesObj\n}\n\n/** Creates direct padding styles when spacers are disabled */\nconst createDirectPaddingStyles = (\n enableSpacers: boolean,\n padding: {\n top: number\n right: number\n bottom: number\n left: number\n }\n): PaddingStyles => {\n const { top, right, bottom, left } = padding\n const stylesObj: PaddingStyles = {}\n\n // When spacers are disabled (i.e. debugging === \"none\"), add direct padding styles\n if (!enableSpacers) {\n if (top > 0 || bottom > 0) {\n stylesObj.paddingBlock = `${top}px ${bottom}px`\n }\n if (left > 0 || right > 0) {\n stylesObj.paddingInline = `${left}px ${right}px`\n }\n }\n\n return stylesObj\n}\n\n/** Creates a render function for spacers */\nconst createRenderSpacerFn = (\n variant: Variant | undefined,\n debugging: DebuggingMode | undefined,\n indicatorNode?: IndicatorNode\n): RenderSpacerFn => {\n // Default to 'line' if variant is undefined\n const safeVariant = variant || 'line'\n // Default to 'none' if debugging is undefined\n const safeDebugging = debugging || 'none'\n\n const SpacerElement = (\n widthVal: React.CSSProperties['width'],\n heightVal: React.CSSProperties['height']\n ) => (\n <Spacer\n variant={safeVariant}\n debugging={heightVal === 0 || widthVal === 0 ? 'none' : safeDebugging}\n indicatorNode={indicatorNode}\n height={heightVal !== '100%' ? heightVal : undefined}\n width={widthVal !== '100%' ? widthVal : undefined}\n />\n )\n\n // Add display name to satisfy linter\n SpacerElement.displayName = 'PadderSpacer'\n\n return SpacerElement\n}\n\n/**\n * A foundational component that manages consistent padding with visual debugging.\n *\n * @remarks\n * Padder is a low-level utility that:\n * - Applies consistent padding around content\n * - Supports visual debugging of spacing\n * - Maintains baseline grid alignment\n * - Uses Spacer components for visual padding representation\n *\n * When debugging is enabled (`\"visible\"` or `\"hidden\"`), padding is represented\n * using Spacer components. When debugging is `\"none\"`, direct CSS padding is\n * applied for better performance.\n *\n * @example\n * ```tsx\n * // Basic usage\n * <Padder block={16} inline={8}>\n * <div>Content with consistent padding</div>\n * </Padder>\n *\n * // With debug visuals and custom indicators\n * <Padder\n * block={[8, 16]}\n * inline={[16, 24]}\n * debugging=\"visible\"\n * indicatorNode={(value, dim) => (\n * <span className=\"text-sm\">{dim}: {value}px</span>\n * )}\n * >\n * <div>Content with visible padding guides</div>\n * </Padder>\n *\n * // Direct padding mode\n * <Padder\n * block={16}\n * inline={24}\n * debugging=\"none\"\n * >\n * <div>Content with direct CSS padding</div>\n * </Padder>\n * ```\n */\nexport const Padder = React.memo(\n React.forwardRef<HTMLDivElement, PadderProps>(function Padder(\n {\n children,\n className,\n debugging: debuggingProp,\n height,\n indicatorNode,\n style,\n width,\n ssrMode = false,\n ...spacingProps\n },\n ref\n ) {\n const config = useConfig('padder')\n const { variant } = useConfig('spacer')\n const initialPadding = React.useMemo(\n () => parsePadding(spacingProps),\n [spacingProps]\n )\n const { isShown, isNone, debugging } = useDebug(\n debuggingProp,\n config.debugging\n )\n const enableSpacers = !isNone\n\n // Add hydration state tracking\n const [isHydrated, setIsHydrated] = React.useState(false)\n\n React.useEffect(() => {\n setIsHydrated(true)\n }, [])\n\n const internalRef = React.useRef<HTMLDivElement | null>(null)\n\n // Get padding calculation from useBaseline\n const baselinePadding = useBaseline(internalRef, {\n base: config.base,\n snapping: 'height',\n spacing: initialPadding,\n warnOnMisalignment: !isNone,\n })\n\n // Create stable initial padding for SSR\n const stablePadding = {\n padding: {\n top: initialPadding.top || 0,\n right: initialPadding.right || 0,\n bottom: initialPadding.bottom || 0,\n left: initialPadding.left || 0,\n },\n }\n\n // Use stable padding during SSR and initial render, then switch to dynamic padding\n const { padding } = hydratedValue(\n isHydrated && !ssrMode,\n stablePadding,\n baselinePadding\n )\n\n const setRefs = mergeRefs(ref, internalRef)\n\n const containerStyles = React.useMemo(() => {\n const baseStyles = createPadderContainerStyles(\n width,\n height,\n config.base,\n config.color\n )\n\n const paddingStyles = createDirectPaddingStyles(enableSpacers, {\n top: padding.top,\n right: padding.right,\n bottom: padding.bottom,\n left: padding.left,\n })\n\n return mergeStyles(\n { ...baseStyles, ...paddingStyles } as React.CSSProperties,\n style\n )\n }, [\n width,\n height,\n config.base,\n config.color,\n enableSpacers,\n padding.top,\n padding.right,\n padding.bottom,\n padding.left,\n style,\n ])\n\n const renderSpacer = React.useMemo(\n () => createRenderSpacerFn(variant, debugging, indicatorNode),\n [variant, debugging, indicatorNode]\n )\n\n // When debugging is \"none\", simply return a container with direct CSS padding\n // and no additional grid/Spacer elements.\n if (!enableSpacers) {\n return (\n <div\n ref={setRefs}\n data-testid=\"padder\"\n className={mergeClasses(styles.pad, className)}\n style={containerStyles}\n >\n {children}\n </div>\n )\n }\n\n // When debugging is enabled, use a grid structure with wrapping spacer elements.\n return (\n <div\n ref={setRefs}\n data-testid=\"padder\"\n className={mergeClasses(styles.pad, isShown && styles.v, className)}\n style={containerStyles}\n >\n <>\n {/* Top spacer - spans full width */}\n {padding.top >= 0 && (\n <div style={{ gridColumn: '1 / -1' }}>\n {renderSpacer('100%', padding.top)}\n </div>\n )}\n\n {/* Left spacer */}\n {padding.left >= 0 && (\n <div style={{ gridRow: '2 / 3' }}>\n {renderSpacer(padding.left, '100%')}\n </div>\n )}\n </>\n\n {/* Main content - centered in grid */}\n <div style={{ gridRow: '2 / 3', gridColumn: '2 / 3' }}>{children}</div>\n\n <>\n {/* Right spacer */}\n {padding.right >= 0 && (\n <div style={{ gridRow: '2 / 3' }}>\n {renderSpacer(padding.right, '100%')}\n </div>\n )}\n\n {/* Bottom spacer - spans full width */}\n {padding.bottom >= 0 && (\n <div style={{ gridColumn: '1 / -1' }}>\n {renderSpacer('100%', padding.bottom)}\n </div>\n )}\n </>\n </div>\n )\n })\n)\n","import * as React from 'react'\nimport type { Gaps } from '@components'\nimport { useConfig, useDebug, useBaseline } from '@hooks'\nimport {\n mergeStyles,\n mergeClasses,\n parsePadding,\n formatValue,\n createStyleOverride,\n hydratedValue,\n} from '@utils'\nimport { Config } from '../Config'\nimport { Padder } from '../Padder'\nimport { Spacer } from '../Spacer'\nimport { ComponentsProps, Variant } from '../types'\nimport styles from './styles.module.css'\n\n// Import the IndicatorNode type from Spacer props\ntype IndicatorNode = NonNullable<\n React.ComponentProps<typeof Spacer>['indicatorNode']\n>\n\nexport type LayoutProps = {\n /**\n * Grid column definition. Supports:\n * - Number: Equal columns (3 → repeat(3, 1fr))\n * - String: Raw template (\"1fr auto 200px\")\n * - Array: Mixed values ([100, '1fr'] → \"100px 1fr\")\n */\n columns?: number | string | Array<number | string>\n /** Grid row definition (same format as columns) */\n rows?: number | string | Array<number | string>\n /** Controls item alignment along column axis */\n justifyItems?: React.CSSProperties['justifyItems']\n /** Controls item alignment along row axis */\n alignItems?: React.CSSProperties['alignItems']\n /** Controls content distribution along row axis */\n justifyContent?: React.CSSProperties['justifyContent']\n /** Controls content distribution along column axis */\n alignContent?: React.CSSProperties['alignContent']\n /** Custom measurement indicator renderer */\n indicatorNode?: IndicatorNode\n /** Visual style in debug mode */\n variant?: Variant\n /** Flag to enable SSR-compatible mode (simplified initial render) */\n ssrMode?: boolean\n /** Container width (defaults to \"auto\") */\n width?: React.CSSProperties['width']\n /** Container height (defaults to \"auto\") */\n height?: React.CSSProperties['height']\n children?: React.ReactNode\n} & ComponentsProps &\n Gaps\n\n/** Creates default layout styles with theme colors */\nconst createDefaultLayoutStyles = (colors: {\n line: string\n flat: string\n text: string\n}): Record<string, string> => ({\n '--bklw': 'auto',\n '--bklh': 'auto',\n '--bklcl': colors.line,\n '--bklcf': colors.flat,\n '--bklci': colors.text,\n})\n\n/** Parses grid template definitions into CSS grid-template values. */\nconst getGridTemplate = (\n prop?: number | string | Array<number | string>\n): string => {\n if (typeof prop === 'number') return `repeat(${prop}, 1fr)`\n if (typeof prop === 'string') return prop\n if (Array.isArray(prop)) {\n return prop.map((p) => (typeof p === 'number' ? `${p}px` : p)).join(' ')\n }\n return 'repeat(auto-fill, minmax(100px, 1fr))'\n}\n\n/** Creates grid gap styles */\nconst createGridGapStyles = (\n gap?: React.CSSProperties['gap'] | number,\n rowGap?: React.CSSProperties['rowGap'] | number,\n columnGap?: React.CSSProperties['columnGap'] | number\n): Record<string, string> => {\n const styles: Record<string, string> = {}\n\n if (gap !== undefined) {\n styles.gap = formatValue(gap)\n }\n if (rowGap !== undefined) {\n styles.rowGap = formatValue(rowGap)\n }\n if (columnGap !== undefined) {\n styles.columnGap = formatValue(columnGap)\n }\n\n return styles\n}\n\n/**\n * A grid-based layout component with baseline alignment and responsive columns.\n *\n * @remarks\n * Layout provides a CSS Grid container that:\n * - Supports flexible column definitions\n * - Maintains baseline grid alignment\n * - Includes gap management\n * - Offers comprehensive alignment controls\n * - Provides debug overlays for visual verification\n *\n * When no explicit dimensions are provided, Layout defaults to \"auto\"\n * for both width and height.\n *\n * @example\n * ```tsx\n * // Basic equal columns\n * <Layout columns={3} gap={16}>\n * <div>Column 1</div>\n * <div>Column 2</div>\n * <div>Column 3</div>\n * </Layout>\n *\n * // Mixed column widths with alignment\n * <Layout\n * columns={['200px', '1fr', '2fr']}\n * gap={24}\n * alignItems=\"center\"\n * justifyContent=\"space-between\"\n * >\n * <div>Fixed</div>\n * <div>Flexible</div>\n * <div>Double width</div>\n * </Layout>\n * ```\n */\nexport const Layout = React.memo(function Layout({\n alignContent,\n alignItems,\n children,\n className,\n columns = 'repeat(auto-fill, minmax(100px, 1fr))',\n columnGap,\n debugging: debuggingProp,\n gap,\n height,\n indicatorNode,\n justifyContent,\n justifyItems,\n rowGap,\n rows,\n style,\n variant,\n width,\n ssrMode = false,\n ...spacingProps\n}: LayoutProps) {\n const config = useConfig('layout')\n const { isShown, debugging } = useDebug(debuggingProp, config.debugging)\n\n // Add hydration state tracking\n const [isHydrated, setIsHydrated] = React.useState(false)\n\n React.useEffect(() => {\n setIsHydrated(true)\n }, [])\n\n const layoutRef = React.useRef<HTMLDivElement>(null)\n\n const initialPadding = React.useMemo(\n () => parsePadding(spacingProps),\n [spacingProps]\n )\n\n // Get padding calculation from useBaseline\n const baselinePadding = useBaseline(layoutRef, {\n base: config.base,\n snapping: 'height',\n spacing: initialPadding,\n warnOnMisalignment: true,\n })\n\n // Create stable initial padding for SSR\n const stablePadding = {\n padding: {\n top: initialPadding.top || 0,\n right: initialPadding.right || 0,\n bottom: initialPadding.bottom || 0,\n left: initialPadding.left || 0,\n },\n }\n\n // Use stable padding during SSR and initial render, then switch to dynamic padding\n const { padding } = hydratedValue(\n isHydrated && !ssrMode,\n stablePadding,\n baselinePadding\n )\n\n const gridTemplateColumns = React.useMemo(\n () => getGridTemplate(columns),\n [columns]\n )\n\n const gridTemplateRows = React.useMemo(\n () => (rows ? getGridTemplate(rows) : 'auto'),\n [rows]\n )\n\n const defaultLayoutStyles = React.useMemo(\n () => createDefaultLayoutStyles(config.colors),\n [config.colors]\n )\n\n const gridGapStyles = React.useMemo(\n () => createGridGapStyles(gap, rowGap, columnGap),\n [gap, rowGap, columnGap]\n )\n\n const containerStyles = React.useMemo(() => {\n const widthValue = formatValue(width || 'auto')\n const heightValue = formatValue(height || 'auto')\n\n // Define dimensions that should be skipped when set to auto\n const autoDimensions = ['--bklw', '--bklh']\n\n return mergeStyles(\n {\n // Theme overrides\n ...createStyleOverride({\n key: '--bklw',\n value: widthValue,\n defaultStyles: defaultLayoutStyles,\n skipDimensions: { auto: autoDimensions },\n }),\n ...createStyleOverride({\n key: '--bklh',\n value: heightValue,\n defaultStyles: defaultLayoutStyles,\n skipDimensions: { auto: autoDimensions },\n }),\n ...createStyleOverride({\n key: '--bklcl',\n value: config.colors.line,\n defaultStyles: defaultLayoutStyles,\n }),\n ...createStyleOverride({\n key: '--bklcf',\n value: config.colors.flat,\n defaultStyles: defaultLayoutStyles,\n }),\n ...createStyleOverride({\n key: '--bklci',\n value: config.colors.text,\n defaultStyles: defaultLayoutStyles,\n }),\n\n // Grid properties - only inject if different from defaults\n ...(gridTemplateColumns !== 'repeat(auto-fill, minmax(100px, 1fr))' && {\n '--bklgtc': gridTemplateColumns,\n }),\n ...(gridTemplateRows !== 'auto' && { '--bklgtr': gridTemplateRows }),\n ...(justifyItems && { '--bklji': justifyItems }),\n ...(alignItems && { '--bklai': alignItems }),\n ...(justifyContent && { '--bkljc': justifyContent }),\n ...(alignContent && { '--bklac': alignContent }),\n\n // Include gap styles\n ...gridGapStyles,\n } as React.CSSProperties,\n style\n )\n }, [\n gridTemplateColumns,\n gridTemplateRows,\n justifyItems,\n alignItems,\n justifyContent,\n alignContent,\n width,\n height,\n config.colors,\n defaultLayoutStyles,\n style,\n gridGapStyles,\n ])\n\n return (\n <Config spacer={{ variant: variant ?? 'line' }}>\n <Padder\n ref={layoutRef}\n className={isShown ? styles.v : ''}\n block={[padding.top, padding.bottom]}\n {...(indicatorNode ? { indicatorNode } : {})}\n inline={[padding.left, padding.right]}\n debugging={debugging}\n width={width}\n height={height}\n ssrMode={ssrMode}\n >\n <div\n data-testid=\"layout\"\n className={mergeClasses(className, styles.lay)}\n style={containerStyles}\n {...(spacingProps && Object.keys(spacingProps).length > 0\n ? Object.fromEntries(\n Object.entries(spacingProps).filter(\n ([key]) => key !== 'ssrMode'\n )\n )\n : {})}\n >\n {children}\n </div>\n </Padder>\n </Config>\n )\n})\n","import * as React from 'react'\nimport { useConfig, useDebug, useBaseline } from '@hooks'\nimport {\n mergeClasses,\n mergeStyles,\n parsePadding,\n mergeRefs,\n formatValue,\n createGridSpanStyles,\n createStyleOverride,\n hydratedValue,\n} from '@utils'\nimport { Config } from '../Config/Config'\nimport { Padder } from '../Padder'\nimport { ComponentsProps } from '../types'\nimport styles from './styles.module.css'\n\n/**\n * Determines how the Box component aligns to the baseline grid.\n *\n * @remarks\n * - `none`: No snapping; uses raw spacing values as provided\n * - `height`: Only container height snaps to base unit multiples\n * - `clamp`: Both height and spacing values snap to base unit multiples\n */\nexport type SnappingMode = 'none' | 'height' | 'clamp'\n\nexport type BoxProps = {\n /** Number of columns to span in a grid layout */\n colSpan?: number\n /** Number of rows to span in a grid layout */\n rowSpan?: number\n /** Shorthand for equal column and row span. Takes precedence over individual spans */\n span?: number\n /** Controls baseline grid alignment behavior */\n snapping?: SnappingMode\n /** Flag to enable SSR-compatible mode (simplified initial render) */\n ssrMode?: boolean\n children?: React.ReactNode\n} & ComponentsProps\n\n/**\n * Creates default box styles with theme values.\n * Sets CSS variables for width, height, base unit, and colors.\n */\nconst createDefaultBoxStyles = (\n base: number,\n lineColor: string\n): Record<string, string> => ({\n '--bkboxw': 'auto',\n '--bkboxh': 'auto',\n '--bkboxc': lineColor,\n '--bkboxb': `${base}px`,\n})\n\ntype BoxCustomStylesParams = {\n /** Width property for the box */\n width?: React.CSSProperties['width']\n /** Height property for the box */\n height?: React.CSSProperties['height']\n /** Base unit for measurements */\n base: number\n /** Line color from theme */\n lineColor: string\n /** Default styles for comparison */\n defaultStyles: Record<string, string>\n}\n\n/**\n * Creates custom styles for the Box component.\n * Handles dimension overrides and other custom properties.\n */\nconst createBoxCustomStyles = ({\n width,\n height,\n base,\n lineColor,\n defaultStyles,\n}: BoxCustomStylesParams): React.CSSProperties => {\n const widthValue = formatValue(width || 'fit-content')\n const heightValue = formatValue(height || 'fit-content')\n\n // Define box dimensions that should be skipped when set to fit-content\n const dimensionVars = ['--bkboxw', '--bkboxh']\n\n return {\n ...createStyleOverride({\n key: '--bkboxw',\n value: widthValue,\n defaultStyles,\n skipDimensions: { fitContent: dimensionVars },\n }),\n ...createStyleOverride({\n key: '--bkboxh',\n value: heightValue,\n defaultStyles,\n skipDimensions: { fitContent: dimensionVars },\n }),\n ...createStyleOverride({\n key: '--bkboxb',\n value: `${base}px`,\n defaultStyles,\n }),\n ...createStyleOverride({\n key: '--bkboxc',\n value: lineColor,\n defaultStyles,\n }),\n } as React.CSSProperties\n}\n\n/**\n * A foundational container component that ensures consistent spacing and baseline alignment.\n *\n * @remarks\n * Box provides a layout container that:\n * - Ensures consistent spacing aligned to the baseline grid\n * - Supports grid layout integration through span props\n * - Offers configurable snapping modes for fine-grained alignment control\n * - Includes debug overlays for visual alignment verification\n *\n * By default, Box uses \"auto\" for both width and height unless explicitly specified.\n *\n * @example\n * ```tsx\n * // Basic usage with spacing\n * <Box block={16} inline={8}>\n * <p>Content aligned to baseline</p>\n * </Box>\n *\n * // With grid spanning and custom snapping\n * <Box\n * colSpan={2}\n * rowSpan={1}\n * snapping=\"height\"\n * debugging=\"visible\"\n * >\n * <p>Grid-integrated content</p>\n * </Box>\n * ```\n */\nexport const Box = React.memo(\n React.forwardRef<HTMLDivElement, BoxProps>(function Box(\n {\n children,\n snapping = 'clamp',\n debugging: debuggingProp,\n className,\n colSpan,\n rowSpan,\n span,\n width,\n height,\n style,\n ssrMode = false,\n ...spacingProps\n },\n ref\n ) {\n const config = useConfig('box')\n const { isShown, debugging } = useDebug(debuggingProp, config.debugging)\n\n // Add hydration state tracking\n const [isHydrated, setIsHydrated] = React.useState(false)\n\n React.useEffect(() => {\n setIsHydrated(true)\n }, [])\n\n const internalRef = React.useRef<HTMLDivElement | null>(null)\n const { top, bottom, left, right } = parsePadding(spacingProps)\n\n // Get padding calculation from useBaseline\n const baselinePadding = useBaseline(internalRef, {\n base: config.base,\n snapping,\n spacing: { top, bottom, left, right },\n warnOnMisalignment: debugging !== 'none',\n })\n\n // Create stable initial padding for SSR\n const stablePadding = {\n padding: {\n top: top || 0,\n right: right || 0,\n bottom: bottom || 0,\n left: left || 0,\n },\n }\n\n // Use stable padding during SSR and initial render, then switch to dynamic padding\n const { padding } = hydratedValue(\n isHydrated && !ssrMode,\n stablePadding,\n baselinePadding\n )\n\n const gridSpanStyles = React.useMemo(\n () => createGridSpanStyles(span, colSpan, rowSpan),\n [colSpan, rowSpan, span]\n )\n\n const defaultBoxStyles = React.useMemo(\n () => createDefaultBoxStyles(config.base, config.colors.line),\n [config.base, config.colors.line]\n )\n\n const boxStyles = React.useMemo(() => {\n const customStyles = createBoxCustomStyles({\n width,\n height,\n base: config.base,\n lineColor: config.colors.line,\n defaultStyles: defaultBoxStyles,\n })\n return mergeStyles(customStyles, style)\n }, [\n config.base,\n config.colors.line,\n width,\n height,\n defaultBoxStyles,\n style,\n ])\n\n return (\n <div\n ref={mergeRefs(ref, internalRef)}\n data-testid=\"box\"\n className={mergeClasses(styles.box, isShown && styles.v, className)}\n style={mergeStyles(boxStyles, gridSpanStyles)}\n >\n <Config base={1} spacer={{ variant: 'flat' }}>\n <Padder\n block={[padding.top, padding.bottom]}\n inline={[padding.left, padding.right]}\n width=\"fit-content\"\n height={height}\n debugging={debugging}\n ssrMode={ssrMode}\n >\n {children}\n </Padder>\n </Config>\n </div>\n )\n })\n)\n","import * as React from 'react'\nimport type { Gaps } from '@components'\nimport { useConfig, useDebug, useBaseline } from '@hooks'\nimport {\n mergeClasses,\n mergeStyles,\n parsePadding,\n formatValue,\n createStyleOverride,\n hydratedValue,\n} from '@utils'\nimport { Padder } from '../Padder'\nimport { IndicatorNode } from '../Spacer'\nimport { Config } from '../Config'\nimport { ComponentsProps, Variant } from '../types'\nimport styles from './styles.module.css'\n\n// Maps shorthand directions to Flexbox directions\nconst DIRECTION_AXIS: Record<string, React.CSSProperties['flexDirection']> = {\n x: 'row',\n y: 'column',\n '-x': 'row-reverse',\n '-y': 'column-reverse',\n}\n\nexport type CSSPropertiesDirectionalAxis = keyof typeof DIRECTION_AXIS\n\nexport type StackProps = {\n /** Main axis orientation */\n direction?: React.CSSProperties['flexDirection'] &\n CSSPropertiesDirectionalAxis\n /** Distribution of space on main axis */\n justify?: React.CSSProperties['justifyContent']\n /** Alignment on cross axis */\n align?: React.CSSProperties['alignItems']\n /** Container width (defaults to \"auto\") */\n width?: React.CSSProperties['width']\n /** Container height (defaults to \"auto\") */\n height?: React.CSSProperties['height']\n /** Custom measurement indicator renderer */\n indicatorNode?: IndicatorNode\n /** Visual style in debug mode */\n variant?: Variant\n /** Gap between items in base units */\n gap?: Gaps\n /** Row gap when using different values for rows and columns */\n rowGap?: Gaps\n /** Column gap when using different values for rows and columns */\n columnGap?: Gaps\n /** Flag to enable SSR-compatible mode (simplified initial render) */\n ssrMode?: boolean\n children?: React.ReactNode\n} & ComponentsProps\n\n// Utils -----------------------------------------------------------------------\n\n/** Creates default stack styles with theme colors */\nconst createDefaultStackStyles = (colors: Record<string, string>) => ({\n '--bkkw': 'auto',\n '--bkkh': 'auto',\n '--bkkcl': colors.line,\n '--bkkcf': colors.flat,\n '--bkkci': colors.text,\n})\n\n/** Creates gap styles for the stack */\nconst createStackGapStyles = (\n rowGap?: number,\n columnGap?: number,\n gap?: number\n): Record<string, number | undefined> => ({\n rowGap: gap !== undefined ? gap : rowGap,\n columnGap: gap !== undefined ? gap : columnGap,\n})\n\n/**\n * A flexible container component aligning children to the baseline grid.\n *\n * @remarks\n * Stack provides a flex container that:\n * - Maintains baseline grid alignment\n * - Supports both row and column layouts\n * - Handles consistent spacing between items\n * - Includes visual debug overlays\n *\n * Key features:\n * - Automatic dimension management (defaults to auto)\n * - Direct padding application in non-debug mode\n * - Comprehensive alignment controls\n * - Theme-aware debug visuals\n *\n * @example\n * ```tsx\n * // Basic horizontal stack\n * <Stack gap={16}>\n * <div>Item 1</div>\n * <div>Item 2</div>\n * </Stack>\n *\n * // Vertical stack with alignment\n * <Stack\n * direction=\"column\"\n * gap={24}\n * align=\"center\"\n * justify=\"space-between\"\n * debugging=\"visible\"\n * >\n * <div>Top</div>\n * <div>Middle</div>\n * <div>Bottom</div>\n * </Stack>\n *\n * // Complex layout with padding\n * <Stack\n * direction=\"row\"\n * gap={32}\n * align=\"stretch\"\n * block={[16, 24]}\n * inline={16}\n * debugging=\"visible\"\n * >\n * <div>Panel 1</div>\n * <div>Panel 2</div>\n * </Stack>\n * ```\n */\nexport const Stack = React.memo(function Stack({\n align = 'flex-start',\n children,\n className,\n columnGap,\n debugging: debuggingProp,\n direction = 'row',\n gap,\n height,\n indicatorNode,\n justify = 'flex-start',\n rowGap,\n style,\n variant,\n width,\n ssrMode = false,\n ...spacingProps\n}: StackProps) {\n // Read configuration from context or props\n const config = useConfig('stack')\n const { isShown, debugging } = useDebug(debuggingProp, config.debugging)\n\n // Add hydration state tracking\n const [isHydrated, setIsHydrated] = React.useState(false)\n\n React.useEffect(() => {\n setIsHydrated(true)\n }, [])\n\n const stackRef = React.useRef<HTMLDivElement | null>(null)\n\n // Process spacing props\n const { top, right, bottom, left } = parsePadding({\n ...spacingProps,\n })\n\n // Get padding calculation from useBaseline\n const baselinePadding = useBaseline(stackRef, {\n base: config.base,\n snapping: 'height',\n spacing: { top, right, bottom, left },\n warnOnMisalignment: debugging !== 'none',\n })\n\n // Create stable initial padding for SSR\n const stablePadding = {\n padding: {\n top: top || 0,\n right: right || 0,\n bottom: bottom || 0,\n left: left || 0,\n },\n }\n\n // Use stable padding during SSR and initial render, then switch to dynamic padding\n const { padding } = hydratedValue(\n isHydrated && !ssrMode,\n stablePadding,\n baselinePadding\n )\n\n const stackGapStyles = React.useMemo(() => {\n const formattedRowGap = rowGap !== undefined ? Number(rowGap) : undefined\n const formattedColumnGap =\n columnGap !== undefined ? Number(columnGap) : undefined\n const formattedGap = gap !== undefined ? Number(gap) : undefined\n\n return createStackGapStyles(\n formattedRowGap,\n formattedColumnGap,\n formattedGap\n )\n }, [rowGap, columnGap, gap])\n\n const defaultStackStyles = React.useMemo(\n () => createDefaultStackStyles(config.colors),\n [config.colors]\n )\n\n const containerStyles = React.useMemo(() => {\n const widthValue = formatValue(width || 'auto')\n const heightValue = formatValue(height || 'auto')\n const flexDirection = DIRECTION_AXIS[direction] || direction\n\n // Define stack dimensions that should be skipped when set to auto\n const dimensionVars = ['--bkkw', '--bkkh']\n\n const customOverrides = {\n ...createStyleOverride({\n key: '--bkkw',\n value: widthValue,\n defaultStyles: defaultStackStyles,\n skipDimensions: { auto: dimensionVars },\n }),\n ...createStyleOverride({\n key: '--bkkh',\n value: heightValue,\n defaultStyles: defaultStackStyles,\n skipDimensions: { auto: dimensionVars },\n }),\n ...createStyleOverride({\n key: '--bkkcl',\n value: config.colors.line,\n defaultStyles: defaultStackStyles,\n }),\n ...createStyleOverride({\n key: '--bkkcf',\n value: config.colors.flat,\n defaultStyles: defaultStackStyles,\n }),\n ...createStyleOverride({\n key: '--bkkci',\n value: config.colors.text,\n defaultStyles: defaultStackStyles,\n }),\n } as React.CSSProperties\n\n const baseStyles = {\n flexDirection,\n justifyContent: justify,\n alignItems: align,\n width,\n height,\n } as React.CSSProperties\n\n return mergeStyles(baseStyles, stackGapStyles, customOverrides, style)\n }, [\n direction,\n justify,\n align,\n width,\n height,\n config.colors.line,\n config.colors.flat,\n config.colors.text,\n defaultStackStyles,\n stackGapStyles,\n style,\n ])\n\n const mergedContainerStyles =\n debugging === 'none'\n ? {\n ...containerStyles,\n paddingBlock: `${padding.top}px ${padding.bottom}px`,\n paddingInline: `${padding.left}px ${padding.right}px`,\n }\n : containerStyles\n\n return (\n <Config spacer={{ variant: variant ?? 'line' }}>\n <Padder\n ref={stackRef}\n block={[padding.top, padding.bottom]}\n inline={[padding.left, padding.right]}\n debugging={debugging}\n indicatorNode={indicatorNode}\n width={width}\n height={height}\n ssrMode={ssrMode}\n >\n <div\n data-testid=\"stack\"\n className={mergeClasses(className, styles.stk, isShown && styles.v)}\n style={mergedContainerStyles}\n {...spacingProps}\n >\n {children}\n </div>\n </Padder>\n </Config>\n )\n})\n","import * as React from 'react'\nimport { ComponentsProps } from '@components'\nimport { useConfig, useDebug, useGuide, useMeasure } from '@hooks'\nimport {\n formatValue,\n mergeClasses,\n mergeStyles,\n createStyleOverride,\n ClientOnly,\n} from '@utils'\nimport { AutoConfig, FixedConfig, LineConfig, PatternConfig } from './types'\nimport type { GuideVariant } from '../types'\nimport styles from './styles.module.css'\n\n/** Merged configuration types that support various grid layout strategies */\nexport type GuideConfig = PatternConfig | AutoConfig | FixedConfig | LineConfig\n\nexport type GuideProps = {\n /** Controls horizontal alignment of columns within the container */\n align?: React.CSSProperties['justifyContent']\n /** Visual style of the guide */\n variant?: GuideVariant\n /** Number of columns (for fixed/auto variants) */\n columns?: number | readonly (string | number | undefined | 'auto')[]\n /** Column width (for fixed variant) */\n columnWidth?: React.CSSProperties['width']\n /** Maximum width of the guide */\n maxWidth?: React.CSSProperties['maxWidth']\n /** Color override for guide lines */\n color?: React.CSSProperties['color']\n /** Content to render inside the guide */\n children?: React.ReactNode\n /** Gap between columns */\n gap?: number\n /** Flag to enable SSR-compatible mode (simplified initial render) */\n ssrMode?: boolean\n} & ComponentsProps &\n Omit<GuideConfig, 'columns' | 'columnWidth' | 'gap'>\n\n/** Parameters for creating a grid configuration */\ntype GridConfigParams = {\n variant: GuideVariant\n base: number\n gap: number\n columns?: number | readonly (string | number | undefined | 'auto')[]\n columnWidth?: React.CSSProperties['width']\n}\n\n/**\n * Creates a grid configuration based on the specified variant and parameters\n * Internal helper function for Guide component\n */\nconst createGridConfig = (\n params: GridConfigParams\n): PatternConfig | AutoConfig | FixedConfig | LineConfig => {\n const { variant, base, gap, columns, columnWidth } = params\n\n switch (variant) {\n case 'line':\n return {\n variant: 'line',\n gap,\n base,\n } as LineConfig\n\n case 'pattern':\n if (columns && Array.isArray(columns)) {\n return {\n variant: 'pattern',\n columns: columns as readonly (string | number)[],\n gap,\n base,\n } as PatternConfig\n }\n break\n\n case 'fixed':\n if (columns !== undefined) {\n const parsedColumns =\n typeof columns === 'number' ? columns : parseInt(String(columns), 10)\n return {\n variant: 'fixed',\n columns: !isNaN(parsedColumns) ? parsedColumns : 12,\n columnWidth: columnWidth || '60px',\n gap,\n base,\n } as FixedConfig\n }\n break\n }\n\n // Default to auto columns if no valid configuration was created\n return {\n variant: 'auto',\n columnWidth: columnWidth || '1fr',\n gap,\n base,\n } as AutoConfig\n}\n\n/** Creates default guide styles */\nconst createDefaultGuideStyles = (\n base: number,\n lineColor: string\n): Record<string, string> => ({\n '--bkgw': 'auto',\n '--bkgh': 'auto',\n '--bkgmw': 'none',\n '--bkgcw': '60px',\n '--bkggw': '24px',\n '--bkgc': '12',\n '--bkgb': `${base}px`,\n '--bkgcl': lineColor,\n '--bkgg': '0',\n})\n\n/**\n * A developer tool component that provides visual grid overlays for alignment.\n *\n * @remarks\n * Guide renders a configurable grid overlay that helps visualize:\n * - Column layouts and spacing\n * - Content alignment\n * - Layout patterns\n *\n * The component supports multiple variants:\n * - \"line\": Simple evenly-spaced vertical lines\n * - \"pattern\": Custom repeating column width patterns\n * - \"fixed\": Fixed number of equal or custom-width columns\n * - \"auto\": Dynamically calculated columns based on container width\n *\n * @example\n * ```tsx\n * // Basic column guide\n * <Guide\n * variant=\"line\"\n * gap={8}\n * debugging=\"visible\"\n * />\n *\n * // Custom column pattern\n * <Guide\n * variant=\"pattern\"\n * columns={['100px', '1fr', '2fr']}\n * gap={16}\n * align=\"center\"\n * debugging=\"visible\"\n * />\n *\n * // Fixed columns with custom width\n * <Guide\n * variant=\"fixed\"\n * columns={12}\n * columnWidth=\"60px\"\n * gap={8}\n * debugging=\"visible\"\n * />\n * ```\n */\nexport const Guide = React.memo(function Guide({\n className,\n debugging,\n style,\n variant: variantProp,\n align = 'center',\n gap: gapProp,\n height,\n width,\n columns,\n columnWidth,\n maxWidth,\n color,\n children,\n ssrMode = false,\n ...props\n}: GuideProps) {\n const config = useConfig('guide')\n const variant = variantProp ?? config.variant\n const gap = typeof gapProp === 'number' ? gapProp : 0\n const { isShown } = useDebug(debugging, config.debugging)\n\n // If debugging isn't enabled, render a hidden element\n // This ensures tests can find the element even when hidden\n if (!isShown) {\n return (\n <div\n className={mergeClasses(styles.g, styles.h, className)}\n style={style}\n data-testid=\"guide\"\n data-variant={variant}\n {...props}\n >\n {children}\n </div>\n )\n }\n\n // Create a simple SSR fallback with the expected dimensions\n const ssrFallback = (\n <div\n className={mergeClasses(styles.g, styles.h, styles.ssr, className)}\n style={{\n width: width || '100%',\n height: height || '100%',\n maxWidth: maxWidth || 'none',\n ...style,\n }}\n data-testid=\"guide\"\n data-variant={variant}\n >\n {children}\n </div>\n )\n\n // Wrap the actual implementation in ClientOnly\n return (\n <ClientOnly fallback={ssrFallback}>\n <GuideImpl\n className={className}\n debugging={debugging}\n style={style}\n variant={variant}\n align={align}\n gap={gap}\n height={height}\n width={width}\n columns={columns}\n columnWidth={columnWidth}\n maxWidth={maxWidth}\n color={color}\n ssrMode={ssrMode}\n {...props}\n >\n {children}\n </GuideImpl>\n </ClientOnly>\n )\n})\n\n// Implementation component that only renders on the client side\nconst GuideImpl = React.memo(function GuideImpl({\n className,\n debugging,\n style,\n variant,\n align = 'center',\n gap,\n height,\n width,\n columns,\n columnWidth,\n maxWidth,\n color,\n children,\n ssrMode: _ssrMode = false,\n ...props\n}: GuideProps) {\n const config = useConfig('guide')\n const { isShown } = useDebug(debugging, config.debugging)\n const containerRef = React.useRef<HTMLDivElement | null>(null)\n\n // Measure the container dimensions\n const {\n width: containerWidth,\n height: containerHeight,\n refresh, // Keep the refresh function available for dynamic updates\n } = useMeasure(containerRef)\n\n // Effect for handling window resize events\n React.useEffect(() => {\n const handleResize = () => {\n // Trigger a remeasurement when window size changes\n refresh()\n }\n\n window.addEventListener('resize', handleResize)\n return () => {\n window.removeEventListener('resize', handleResize)\n }\n }, [refresh])\n\n // Create guide configuration based on variant\n const gridConfig = React.useMemo(() => {\n // Ensure we have valid values for the grid configuration\n const safeVariant = variant as GuideVariant\n const safeGap = typeof gap === 'number' ? gap : 0\n\n return createGridConfig({\n variant: safeVariant,\n base: config.base,\n gap: safeGap,\n columns,\n columnWidth,\n })\n }, [variant, config.base, gap, columns, columnWidth])\n\n const { template, columnsCount, calculatedGap } = useGuide(\n containerRef,\n gridConfig\n )\n\n const defaultStyles = React.useMemo(\n () => createDefaultGuideStyles(config.base, config.colors.line),\n [config.base, config.colors.line]\n )\n\n const containerStyles = React.useMemo(() => {\n // Process dimension values\n const widthValue = formatValue(width || containerWidth || 'auto')\n const heightValue = formatValue(height || containerHeight || 'auto')\n const maxWidthValue = formatValue(maxWidth || 'none')\n const columnWidthValue = formatValue(columnWidth || '60px')\n\n // Define dimensions that should be skipped when set to auto\n const autoDimensions = ['--bkgw', '--bkgh']\n\n // Create custom styles with conditional overrides\n const customStyles = {\n ...createStyleOverride({\n key: '--bkgw',\n value: widthValue,\n defaultStyles,\n skipDimensions: { auto: autoDimensions },\n }),\n ...createStyleOverride({\n key: '--bkgh',\n value: heightValue,\n defaultStyles,\n skipDimensions: { auto: autoDimensions },\n }),\n ...createStyleOverride({\n key: '--bkgmw',\n value: maxWidthValue,\n defaultStyles,\n }),\n ...createStyleOverride({\n key: '--bkgcw',\n value: columnWidthValue,\n defaultStyles,\n }),\n ...createStyleOverride({\n key: '--bkgc',\n value: `${columnsCount}`,\n defaultStyles,\n }),\n ...createStyleOverride({\n key: '--bkgb',\n value: `0`,\n defaultStyles,\n }),\n ...createStyleOverride({\n key: '--bkgcl',\n value: color ?? config.colors.line,\n defaultStyles,\n }),\n ...createStyleOverride({\n key: '--bkgg',\n value: `${calculatedGap}px`,\n defaultStyles,\n }),\n ...createStyleOverride({\n key: '--bkgj',\n value: align || 'center',\n defaultStyles,\n }),\n ...(template && template !== 'none' ? { '--bkgt': template } : {}),\n // Add grid template if available\n ...(template && template !== 'none'\n ? { gridTemplateColumns: template }\n : {}),\n } as React.CSSProperties\n\n return mergeStyles(customStyles, style)\n }, [\n width,\n height,\n maxWidth,\n columnWidth,\n columnsCount,\n color,\n template,\n calculatedGap,\n containerWidth,\n containerHeight,\n config.colors.line,\n defaultStyles,\n style,\n align,\n ])\n\n // In the component where gap is used:\n const handleGapCalculations = () => {\n // Ensure gap is a number\n const safeGap = typeof gap === 'number' ? gap : 0\n\n // When gap is 0, we need width + 1 columns to fill the space\n // When gap > 0, we need to account for the -1px reduction in each gap\n const finalGap = safeGap === 0 ? 0 : safeGap - 1\n const actualGapWithLine = finalGap + 1\n\n // Rest of the gap calculations...\n return { finalGap, actualGapWithLine }\n }\n\n // Use the gap calculations where needed\n const { finalGap, actualGapWithLine } = handleGapCalculations()\n\n // Ensure width is a number\n const containerWidthValue =\n typeof width === 'number' ? width : containerWidth || 1024\n\n // For line variants, account for the -1px reduction in each gap\n // If we have N columns, we have (N-1) gaps, each reduced by 1px\n // So the total width lost is (N-1) pixels\n let columnCount: number\n\n if (finalGap === 0) {\n // When gap is 0, we need a column per pixel + 1\n columnCount = Math.floor(containerWidthValue) + 1\n } else if (variant === 'line') {\n // For line variant with gap > 0:\n // We need to solve for N in: N * actualGapWithLine - (N-1) = containerWidthValue\n // Which simplifies to: N = (containerWidthValue + 1) / (actualGapWithLine - 1 + 1)\n columnCount = Math.max(\n 1,\n Math.floor((containerWidthValue + 1) / actualGapWithLine) + 1\n )\n } else {\n // For other variants, use the standard formula\n columnCount = Math.max(\n 1,\n Math.floor(containerWidthValue / actualGapWithLine) + 1\n )\n }\n\n return (\n <div\n ref={containerRef}\n data-testid=\"guide\"\n className={mergeClasses(\n styles.gde,\n className,\n isShown ? styles.v : styles.h,\n variant === 'line' && styles.line\n )}\n data-variant={variant}\n style={containerStyles}\n {...props}\n >\n {isShown && (\n <div className={styles.cols} data-variant={variant}>\n {Array.from({ length: columnCount }, (_, i) => {\n const colColor =\n config.colors[variant as keyof typeof config.colors] ??\n config.colors.line\n return (\n <div\n key={i}\n className={styles.col}\n data-column-index={i}\n data-variant={variant}\n style={{ backgroundColor: colColor }}\n />\n )\n })}\n </div>\n )}\n {children}\n </div>\n )\n})\n","/**\n * @file validation.ts\n * @description Validation utilities for Guide component configurations\n * @module baseline-kit/components/Guide/validation\n */\n\nimport {\n GRID_ALIGNMENTS,\n GridAlignment,\n GuideColumnsPattern,\n GuideColumnValue,\n GuideConfig,\n} from '@components'\nimport { ABSOLUTE_UNIT_CONVERSIONS, RELATIVE_UNITS } from '@utils'\n\n/**\n * Regular expression for valid CSS unit values.\n * Matches numeric values with supported CSS units.\n */\nconst UNIT_PATTERN =\n /^\\d*\\.?\\d+(?:fr|px|%|em|rem|vh|vw|vmin|vmax|pt|pc|in|cm|mm)$/\n\n/**\n * Validates individual grid column values.\n *\n * @example\n * ```ts\n * isValidGuideColumnValue(100) // true\n * isValidGuideColumnValue('100px') // true\n * isValidGuideColumnValue('auto') // true\n * isValidGuideColumnValue('foo') // false\n * ```\n */\nexport const isValidGuideColumnValue = (\n value: unknown\n): value is GuideColumnValue => {\n if (typeof value === 'number') return Number.isFinite(value) && value >= 0\n if (typeof value !== 'string') return false\n return value === 'auto' || value === '100%' || UNIT_PATTERN.test(value)\n}\n\n/**\n * Validates an array of column values as a grid pattern.\n *\n * @example\n * ```ts\n * isValidGuidePattern(['100px', '1fr']) // true\n * isValidGuidePattern([100, 200]) // true\n * isValidGuidePattern(['invalid']) // false\n * isValidGuidePattern([]) // false\n * ```\n */\nexport const isValidGuidePattern = (\n pattern: unknown\n): pattern is GuideColumnsPattern =>\n Array.isArray(pattern) &&\n pattern.length > 0 &&\n pattern.every(isValidGuideColumnValue)\n\n/**\n * Validates CSS grid values against supported units.\n *\n * @example\n * ```ts\n * isGuideValue('100px') // true\n * isGuideValue('2rem') // true\n * isGuideValue('foo') // false\n * ```\n */\nexport const isGuideValue = (value: unknown) => {\n const CSS_UNITS = [\n ...Object.keys(ABSOLUTE_UNIT_CONVERSIONS),\n ...RELATIVE_UNITS,\n ]\n return (\n typeof value === 'number' ||\n (typeof value === 'string' &&\n CSS_UNITS.some((unit) => value.endsWith(unit)))\n )\n}\n\n/**\n * Validates grid alignment values.\n *\n * @example\n * ```ts\n * isGuideAlignment('start') // true\n * isGuideAlignment('center') // true\n * isGuideAlignment('foo') // false\n * ```\n */\nexport const isGuideAlignment = (value: unknown): value is GridAlignment =>\n typeof value === 'string' && GRID_ALIGNMENTS.includes(value as GridAlignment)\n\n/**\n * Type guard for object values.\n */\nconst isObject = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && value !== null\n\n/**\n * Validates line-based guide configurations.\n *\n * @example\n * ```ts\n * isGuideLineConfig({ variant: 'line' }) // true\n * isGuideLineConfig({ variant: 'pattern' }) // false\n * ```\n */\nexport const isGuideLineConfig = (config: unknown): config is GuideConfig =>\n isObject(config) && config.variant === 'line'\n\n/**\n * Validates column-based guide configurations.\n *\n * @example\n * ```ts\n * isGuideColumnConfig({ columns: 12 }) // true\n * isGuideColumnConfig({ variant: 'line' }) // false\n * ```\n */\nexport const isGuideColumnConfig = (config: unknown): config is GuideConfig =>\n isObject(config) && 'columns' in config && !('variant' in config)\n\n/**\n * Validates auto-calculated guide configurations.\n *\n * @example\n * ```ts\n * isAutoCalculatedGuide({ columnWidth: '200px' }) // true\n * isAutoCalculatedGuide({ columns: 12 }) // false\n * ```\n */\nexport const isAutoCalculatedGuide = (config: unknown): config is GuideConfig =>\n isObject(config) &&\n 'columnWidth' in config &&\n !('variant' in config) &&\n !('columns' in config)\n","import * as React from 'react'\nimport { GuideConfig, GuideColumnsPattern } from '@components'\nimport { isValidGuidePattern } from '@/components/Guide/validation'\nimport { formatValue, convertValue, normalizeValue } from '@utils'\nimport { useMeasure } from './useMeasure'\n\nexport interface GuideResult {\n /** CSS grid template string */\n template: string\n /** Total number of columns */\n columnsCount: number\n /** Final gap size in pixels */\n calculatedGap: number\n /** Whether the configuration is valid */\n isValid: boolean\n}\n\n/**\n * Hook for calculating grid layout parameters based on container dimensions.\n *\n * @remarks\n * This hook handles complex grid calculations for different layout variants:\n * - 'line': Evenly spaced vertical lines\n * - 'pattern': Custom repeating column patterns\n * - 'fixed': Set number of columns with optional width\n * - 'auto': Dynamic columns based on available space\n *\n * Key features:\n * - Responsive grid calculations\n * - Pattern validation\n * - Gap management\n * - Error handling\n *\n * @param ref - Reference to container element\n * @param config - Grid configuration object\n * @returns Grid calculation results\n *\n * @example\n * ```tsx\n * function GridOverlay() {\n * const ref = useRef<HTMLDivElement>(null);\n * const { template, columnsCount } = useGuide(ref, {\n * variant: 'fixed',\n * columns: 12,\n * gap: 16,\n * base: 8\n * });\n *\n * return (\n * <div\n * ref={ref}\n * style={{\n * display: 'grid',\n * gridTemplateColumns: template,\n * gap: calculatedGap\n * }}\n * >\n * {Array(columnsCount).fill(null).map((_, i) => (\n * <div key={i} className=\"grid-line\" />\n * ))}\n * </div>\n * );\n * }\n * ```\n */\nexport function useGuide(\n ref: React.RefObject<HTMLElement | null>,\n config: GuideConfig\n): GuideResult {\n const { width } = useMeasure(ref)\n const hasWarnedRef = React.useRef<boolean>(false) // Track if warning has been logged\n\n return React.useMemo(() => {\n // Default values\n const variant = config.variant ?? 'line'\n const base = config.base ?? 8\n\n // The gap is already adjusted in createGridConfig for line variants\n // So we should use config.gap directly without further adjustment\n const gap = normalizeValue(config.gap ?? 0, { base })\n\n // Return invalid result if no width\n if (!width) {\n return {\n template: 'none',\n columnsCount: 0,\n calculatedGap: 0,\n isValid: false,\n }\n }\n\n try {\n switch (variant) {\n case 'line': {\n // Simple vertical lines\n // Account for -1px reduction in each gap when gap > 0\n const finalGap = gap === 0 ? 0 : gap - 1\n const actualGapWithLine = finalGap + 1\n\n let columns: number\n\n if (finalGap === 0) {\n // When gap is 0, need a column per pixel + 1\n columns = Math.max(1, Math.floor(width) + 1)\n } else {\n // For line variant with gap > 0:\n // Account for the -1px reduction in each gap\n columns = Math.max(\n 1,\n Math.floor((width + 1) / actualGapWithLine) + 1\n )\n }\n\n return {\n template: `repeat(${columns}, 1px)`,\n columnsCount: columns,\n calculatedGap: gap > 0 ? gap - 1 : gap,\n isValid: true,\n }\n }\n\n case 'pattern': {\n // Custom column pattern\n if (!config.columns || !Array.isArray(config.columns)) {\n throw new Error('Missing or invalid pattern columns')\n }\n\n if (!isValidGuidePattern(config.columns)) {\n throw new Error('Invalid \"pattern\" columns array')\n }\n\n const columnsArr = (config.columns as GuideColumnsPattern).map(\n (col) => {\n if (typeof col === 'number') return `${col}px`\n return col\n }\n )\n\n // Validate no zero widths\n if (columnsArr.some((c) => c === '0' || c === '0px')) {\n return {\n template: 'none',\n columnsCount: 0,\n calculatedGap: 0,\n isValid: false,\n }\n }\n\n return {\n template: columnsArr.join(' '),\n columnsCount: columnsArr.length,\n calculatedGap: gap,\n isValid: true,\n }\n }\n\n case 'fixed': {\n // Fixed number of columns\n const colCount =\n typeof config.columns === 'number' ? config.columns : 0\n if (colCount < 1) {\n throw new Error(`Invalid columns count: ${colCount}`)\n }\n const colWidth = config.columnWidth\n ? formatValue(config.columnWidth)\n : '1fr'\n\n return {\n template: `repeat(${colCount}, ${colWidth})`,\n columnsCount: colCount,\n calculatedGap: gap,\n isValid: true,\n }\n }\n\n case 'auto': {\n // Auto-filling columns\n const colWidth = config.columnWidth ?? 'auto'\n if (colWidth === 'auto') {\n return {\n template: 'repeat(auto-fill, minmax(0, 1fr))',\n columnsCount: 1,\n calculatedGap: gap,\n isValid: true,\n }\n }\n const colWidthStr =\n typeof colWidth === 'number' ? `${colWidth}px` : colWidth.toString()\n\n const pxVal = convertValue(colWidthStr) ?? 0\n const columns =\n pxVal > 0\n ? Math.max(1, Math.floor((width + gap) / (pxVal + gap)))\n : 1\n\n return {\n template: `repeat(auto-fill, ${colWidthStr})`,\n columnsCount: columns,\n calculatedGap: gap,\n isValid: true,\n }\n }\n\n default: {\n if (!hasWarnedRef.current) {\n console.warn(\n `[useGuide] Unknown variant \"${variant}\". Falling back to \"line\".`\n )\n hasWarnedRef.current = true // Mark warning as logged\n }\n const columns = Math.max(1, Math.floor(width / (gap + 1)) + 1)\n return {\n template: `repeat(${columns}, 1px)`,\n columnsCount: columns,\n calculatedGap: gap,\n isValid: true,\n }\n }\n }\n } catch (error) {\n console.warn('Error in useGuide:', error)\n return {\n template: 'none',\n columnsCount: 0,\n calculatedGap: 0,\n isValid: false,\n }\n }\n }, [config, width])\n}\n","import { useMemo } from 'react'\nimport { ConfigSchema, useDefaultConfig } from '@components'\n\n/** Type helper that merges base configuration with component-specific settings. */\nexport type ComponentConfig<K extends keyof ConfigSchema> = ConfigSchema[K] & {\n /** Base unit for spacing calculations */\n base: number\n}\n\n/**\n * Hook for accessing component-specific theme configuration.\n *\n * @remarks\n * This hook provides:\n * - Access to component-specific theme settings\n * - Automatic base unit inheritance\n * - Memoized configuration to prevent unnecessary updates\n * - Type-safe configuration access\n *\n * It merges:\n * - Global base unit settings\n * - Component-specific configurations\n * - Theme-based color schemes\n *\n * @param component - Name of the component requesting configuration\n * @returns Merged configuration for the specific component\n *\n * @example\n * ```tsx\n * function Box() {\n * const config = useConfig('box');\n *\n * return (\n * <div style={{\n * '--box-base': `${config.base}px`,\n * '--box-color': config.colors.line\n * }}>\n * {children}\n * </div>\n * );\n * }\n * ```\n */\nexport function useConfig<K extends keyof ConfigSchema>(\n component: K\n): ComponentConfig<K> {\n const defaultConfig = useDefaultConfig()\n return useMemo(() => {\n return Object.assign(\n { base: defaultConfig.base },\n defaultConfig[component]\n ) as ComponentConfig<K>\n }, [defaultConfig, component])\n}\n","import { useMemo } from 'react'\nimport { DebuggingMode } from '../components/Config/Config'\n\ninterface DebugResult {\n /** Whether debug visuals should be shown */\n isShown: boolean\n /** Whether debug features exist but are hidden */\n isHidden: boolean\n /** Whether debug features are disabled */\n isNone: boolean\n /** Current debugging mode */\n debugging: DebuggingMode | undefined\n}\n\n/**\n * Hook for managing component debug state and visibility.\n *\n * @remarks\n * Determines the active debugging mode by:\n * - Using prop value if provided\n * - Falling back to config value if prop is undefined\n * - Computing visibility states based on active mode\n *\n * This hook helps components:\n * - Control debug visual rendering\n * - Manage debug feature states\n * - Handle prop/config inheritance\n *\n * @param debuggingProp - Optional debugging mode from props\n * @param debuggingConfig - Debugging mode from theme/config\n * @returns Debug state information\n *\n * @example\n * ```tsx\n * function DebugComponent({ debugging: debugProp }) {\n * const { isShown, isHidden, isNone } = useDebug(\n * debugProp,\n * 'hidden' // Default from config\n * );\n *\n * return (\n * <div>\n * {isShown && <DebugOverlay />}\n * {!isNone && <DebugFeatures />}\n * <Content />\n * </div>\n * );\n * }\n * ```\n */\nexport function useDebug(\n debuggingProp?: DebuggingMode,\n debuggingConfig?: DebuggingMode\n): DebugResult {\n return useMemo(() => {\n const effective = debuggingProp ?? debuggingConfig\n return {\n isShown: effective === 'visible',\n isHidden: effective === 'hidden',\n isNone: effective === 'none',\n debugging: effective,\n }\n }, [debuggingProp, debuggingConfig])\n}\n","import * as React from 'react'\nimport { ComponentsProps } from '@components'\nimport { useConfig, useDebug, useVirtual, useMeasure } from '@hooks'\nimport {\n parsePadding,\n normalizeValuePair,\n mergeStyles,\n mergeClasses,\n calculateRowCount,\n formatValue,\n createStyleOverride,\n ClientOnly,\n} from '@utils'\nimport { Variant } from '../types'\nimport styles from './styles.module.css'\n\nexport type BaselineVariant = Exclude<Variant, 'pattern'>\n\nexport type BaselineProps = {\n /** Visual style variant for the baseline guides */\n variant?: BaselineVariant\n /** Explicit width for the overlay (e.g., \"1200px\" or 1200) */\n width?: number | string\n /** Explicit height for the overlay (e.g., \"100vh\" or 800) */\n height?: number | string\n /** Base unit for measurements (defaults to theme value) */\n base?: number\n /** Color override for grid lines */\n color?: string\n /** Flag to enable SSR-compatible mode (simplified initial render) */\n ssrMode?: boolean\n} & ComponentsProps\n\n/** Creates default baseline styles */\nconst createDefaultBaselineStyles = (\n base: number,\n lineColor: string,\n flatColor: string\n): Record<string, string> => ({\n '--bkbw': '100%',\n '--bkbh': '100%',\n '--bkbb': `${base}px`,\n '--bkbcl': lineColor,\n '--bkbcf': flatColor,\n})\n\n/** Create row styles for baseline lines */\ntype RowStyleParams = {\n /** Row index */\n index: number\n /** Base unit for calculations */\n base: number\n /** Baseline visual variant */\n variant: BaselineVariant\n /** Selected color for the baseline */\n chosenColor: string\n /** Theme line color */\n lineColor: string\n /** Theme flat color */\n flatColor: string\n}\n\n/**\n * Creates styles for an individual baseline row.\n * Applies positioning and visual styling based on variant.\n */\nconst createBaselineRowStyle = (\n params: RowStyleParams\n): React.CSSProperties => {\n const { index, base, variant, chosenColor, lineColor, flatColor } = params\n\n // Directly set the CSS variables instead of using createStyleOverride\n return {\n '--bkrt': index === 0 ? '0px' : `${index * base}px`,\n '--bkrh': variant === 'line' ? '1px' : `${base}px`,\n '--bkbc': chosenColor || (variant === 'line' ? lineColor : flatColor),\n } as React.CSSProperties\n}\n\n// Implementation component that only renders on the client side\nconst BaselineImpl = React.memo(function BaselineImpl({\n className,\n debugging,\n style,\n variant,\n height: heightProp,\n width: widthProp,\n base,\n color: colorProp,\n ssrMode: _ssrMode = false,\n ...spacingProps\n}: BaselineProps) {\n const config = useConfig('baseline')\n const { isShown } = useDebug(debugging, config.debugging)\n\n // Use a stable reference that won't cause hydration mismatches\n const containerRef = React.useRef<HTMLDivElement | null>(null)\n\n // Always call hooks, but conditionally use their results\n const {\n width: containerWidth,\n height: containerHeight,\n refresh,\n } = useMeasure(containerRef)\n\n // Effect for handling window resize events\n React.useEffect(() => {\n const handleResize = () => {\n refresh()\n }\n\n window.addEventListener('resize', handleResize)\n return () => {\n window.removeEventListener('resize', handleResize)\n }\n }, [refresh])\n\n const [_normWidth, normHeight] = React.useMemo(() => {\n return normalizeValuePair(\n [widthProp, heightProp],\n [containerWidth, containerHeight]\n )\n }, [widthProp, heightProp, containerWidth, containerHeight])\n\n const { top, right, bottom, left } = React.useMemo(\n () => parsePadding(spacingProps),\n [spacingProps]\n )\n\n const padding = React.useMemo(() => {\n const paddingValues = [top, right, bottom, left]\n .map((value) => (value ? `${value}px` : '0'))\n .join(' ')\n\n return paddingValues !== '0 0 0 0' ? paddingValues : undefined\n }, [top, right, bottom, left])\n\n const rowCount = React.useMemo(() => {\n const baseValue = base || config.base\n return calculateRowCount({\n height: normHeight,\n top,\n bottom,\n base: baseValue,\n })\n }, [normHeight, top, bottom, base, config.base])\n\n // Use virtual rendering for performance\n const { start, end } = useVirtual({\n totalLines: rowCount,\n lineHeight: base || config.base,\n containerRef,\n buffer: 160,\n })\n\n const chosenColor =\n colorProp || (variant === 'line' ? config.colors.line : config.colors.flat)\n\n // Create default baseline styles\n const defaultBaselineStyles = React.useMemo(\n () =>\n createDefaultBaselineStyles(\n base || config.base,\n config.colors.line,\n config.colors.flat\n ),\n [base, config.colors.line, config.colors.flat, config.base]\n )\n\n const containerStyles = React.useMemo(() => {\n const widthValue = formatValue(widthProp || '100%')\n const heightValue = formatValue(heightProp || '100%')\n\n // Define dimensions that should be skipped when set to 100%\n const dimensionVars = ['--bkbw', '--bkbh']\n\n return mergeStyles(\n {\n ...createStyleOverride({\n key: '--bkbw',\n value: widthValue,\n defaultStyles: defaultBaselineStyles,\n skipDimensions: { fullSize: dimensionVars },\n }),\n ...createStyleOverride({\n key: '--bkbh',\n value: heightValue,\n defaultStyles: defaultBaselineStyles,\n skipDimensions: { fullSize: dimensionVars },\n }),\n ...createStyleOverride({\n key: '--bkbb',\n value: `${base}px`,\n defaultStyles: defaultBaselineStyles,\n }),\n ...createStyleOverride({\n key: '--bkbcl',\n value: colorProp || config.colors.line,\n defaultStyles: defaultBaselineStyles,\n }),\n ...createStyleOverride({\n key: '--bkbcf',\n value: colorProp || config.colors.flat,\n defaultStyles: defaultBaselineStyles,\n }),\n ...(padding && { padding }),\n } as React.CSSProperties,\n style\n )\n }, [\n widthProp,\n heightProp,\n base,\n colorProp,\n config.colors.line,\n config.colors.flat,\n padding,\n defaultBaselineStyles,\n style,\n ])\n\n const getRowStyle = React.useCallback(\n (index: number) => {\n // Ensure variant is a BaselineVariant\n const safeVariant = variant as BaselineVariant\n const safeBase = base || config.base\n\n return createBaselineRowStyle({\n index,\n base: safeBase,\n variant: safeVariant,\n chosenColor,\n lineColor: config.colors.line,\n flatColor: config.colors.flat,\n })\n },\n [\n base,\n variant,\n chosenColor,\n config.colors.line,\n config.colors.flat,\n config.base,\n ]\n )\n\n return (\n <div\n ref={containerRef}\n data-testid=\"baseline\"\n className={mergeClasses(\n styles.bas,\n isShown ? styles.v : styles.h,\n className\n )}\n style={containerStyles}\n {...spacingProps}\n >\n {isShown &&\n Array.from({ length: end - start }, (_, i) => {\n const rowIndex = i + start\n return (\n <div\n className={styles.row}\n key={rowIndex}\n data-row-index={rowIndex}\n style={getRowStyle(rowIndex)}\n />\n )\n })}\n </div>\n )\n})\n\n/**\n * Renders horizontal guidelines for maintaining vertical rhythm and baseline alignment.\n *\n * @remarks\n * Baseline provides horizontal guides that:\n * - Help maintain consistent vertical spacing\n * - Support visual verification of baseline alignment\n * - Optimize performance through virtual rendering\n * - Adapt to container dimensions\n *\n * @example\n * ```tsx\n * // Basic baseline overlay\n * <Baseline\n * height=\"100vh\"\n * base={8}\n * debugging=\"visible\"\n * />\n *\n * // Custom variant with padding\n * <Baseline\n * variant=\"flat\"\n * height=\"100vh\"\n * base={4}\n * block={[16, 0]}\n * debugging=\"visible\"\n * />\n * ```\n */\nexport const Baseline = React.memo(function Baseline({\n className,\n debugging,\n style,\n variant: variantProp,\n height: heightProp,\n width: widthProp,\n base: baseProp,\n color: colorProp,\n ssrMode = false,\n ...spacingProps\n}: BaselineProps) {\n const config = useConfig('baseline')\n const variant = variantProp ?? config.variant\n const base = baseProp ?? config.base\n const { isShown } = useDebug(debugging, config.debugging)\n\n // If debugging isn't enabled, render a hidden element\n // This ensures tests can find the element even when hidden\n if (!isShown) {\n return (\n <div\n className={mergeClasses(styles.b, styles.h, className)}\n style={style}\n data-testid=\"baseline\"\n {...spacingProps}\n />\n )\n }\n\n // Create a simple SSR fallback\n const ssrFallback = (\n <div\n className={mergeClasses(styles.b, styles.h, styles.ssr, className)}\n style={{\n width: widthProp || '100%',\n height: heightProp || '100%',\n ...style,\n }}\n data-testid=\"baseline\"\n />\n )\n\n // Wrap the actual implementation in ClientOnly\n return (\n <ClientOnly fallback={ssrFallback}>\n <BaselineImpl\n className={className}\n debugging={debugging}\n style={style}\n variant={variant}\n height={heightProp}\n width={widthProp}\n base={base}\n color={colorProp}\n ssrMode={ssrMode}\n {...spacingProps}\n />\n </ClientOnly>\n )\n})\n"],"names":["GUIDE_COLORS","BASELINE_COLORS","SPACER_COLORS","BOX_COLORS","STACK_COLORS","LAYOUT_COLORS","PADDER_COLOR","DEFAULT_CONFIG","ConfigContext","React","useDefaultConfig","mergeConfig","params","parentConfig","base","baseline","guide","spacer","box","stack","layout","padder","Config","children","value","jsx","parseUnit","match","num","unit","formatValue","defaultValue","DEFAULT_CONTEXT","ABSOLUTE_UNIT_CONVERSIONS","RELATIVE_UNITS","convertValue","context","parsed","ctx","clamp","min","max","calculateRowCount","height","top","bottom","totalHeight","normalizeValue","options","doRound","clampOptions","suppressWarnings","conv","normalized","clamped","normalizeValuePair","values","defaults","first","second","parsePadding","spacing","parsePaddingValue","blockEdges","parseBlock","inlineEdges","parseInline","padding","block","inline","right","left","calculateSnappedSpacing","initial","snapping","pad","remainder","createGridSpanStyles","span","colSpan","rowSpan","gridStyles","mergeClasses","classes","mergeStyles","styles","style","assignRef","ref","node","error","mergeRefs","refs","createStyleOverride","defaultStyles","key","val","skipDimensions","_a","_b","_c","rafThrottle","fn","rafId","lastArgs","args","useIsClient","isClient","setIsClient","useState","useEffect","isSSR","safeClientValue","clientFn","fallback","hydratedValue","isHydrated","ssrValue","dynamicValue","ClientOnly","useMeasure","dimensions","setDimensions","measure","rect","next","prev","refresh","observer","useVirtual","totalLines","lineHeight","containerRef","buffer","numericBuffer","useMemo","calculateRange","useCallback","element","offsetTop","viewportTop","viewportBottom","start","end","visibleRange","setVisibleRange","useWindowEvents","updateRangeThrottled","updateRange","useLayoutEffect","events","handler","stableHandler","wrappedHandler","evt","useBaseline","warnOnMisalignment","didSnapRef","hasWarnedRef","initialPadding","isAligned","finalPadding","createDefaultSpacerStyles","textColor","flatColor","lineColor","generateMeasurements","isShown","indicatorNode","normWidth","normHeight","width","jsxs","Fragment","Spacer","heightProp","widthProp","debuggingProp","variantProp","baseProp","colorProp","className","ssrMode","props","config","useConfig","useDebug","variant","setIsHydrated","shouldShowMeasurements","measurements","baseStyles","heightValue","widthValue","baseValue","dimensionVars","customStyles","createPadderContainerStyles","color","stylesObj","createDirectPaddingStyles","enableSpacers","createRenderSpacerFn","debugging","safeVariant","safeDebugging","SpacerElement","widthVal","heightVal","Padder","spacingProps","isNone","internalRef","baselinePadding","stablePadding","setRefs","containerStyles","paddingStyles","renderSpacer","createDefaultLayoutStyles","colors","getGridTemplate","prop","p","createGridGapStyles","gap","rowGap","columnGap","Layout","alignContent","alignItems","columns","justifyContent","justifyItems","rows","layoutRef","gridTemplateColumns","gridTemplateRows","defaultLayoutStyles","gridGapStyles","autoDimensions","createDefaultBoxStyles","createBoxCustomStyles","Box","gridSpanStyles","defaultBoxStyles","boxStyles","DIRECTION_AXIS","createDefaultStackStyles","createStackGapStyles","Stack","align","direction","justify","stackRef","stackGapStyles","formattedRowGap","formattedColumnGap","formattedGap","defaultStackStyles","flexDirection","customOverrides","mergedContainerStyles","createGridConfig","columnWidth","parsedColumns","createDefaultGuideStyles","Guide","gapProp","maxWidth","ssrFallback","GuideImpl","_ssrMode","containerWidth","containerHeight","handleResize","gridConfig","safeGap","template","columnsCount","calculatedGap","useGuide","maxWidthValue","columnWidthValue","handleGapCalculations","finalGap","actualGapWithLine","containerWidthValue","columnCount","_","i","colColor","UNIT_PATTERN","isValidGuideColumnValue","isValidGuidePattern","pattern","columnsArr","col","colCount","colWidth","colWidthStr","pxVal","component","defaultConfig","debuggingConfig","effective","createDefaultBaselineStyles","createBaselineRowStyle","index","chosenColor","BaselineImpl","_normWidth","paddingValues","rowCount","defaultBaselineStyles","getRowStyle","safeBase","rowIndex","Baseline"],"mappings":"oaAYMA,GAAe,CAEnB,KAAM,mCAEN,QAAS,sCAET,KAAM,mCAEN,MAAO,mCACT,EAKMC,GAAkB,CAEtB,KAAM,sCAEN,KAAM,qCACR,EAKMC,GAAgB,CAEpB,KAAM,oCAEN,KAAM,oCAEN,KAAM,mCACR,EAKMC,GAAa,CAEjB,KAAM,iCAEN,KAAM,iCAEN,KAAM,gCACR,EAKMC,GAAe,CAEnB,KAAM,mCAEN,KAAM,mCAEN,KAAM,kCACR,EAKMC,GAAgB,CAEpB,KAAM,oCAEN,KAAM,oCAEN,KAAM,mCACR,EAGMC,GAAe,+BAoBRC,GAA+B,CAE1C,KAAM,EAGN,SAAU,CACR,QAAS,OACT,UAAW,SACX,OAAQN,EACV,EAGA,MAAO,CACL,QAAS,OACT,UAAW,SACX,OAAQD,EACV,EAGA,OAAQ,CACN,QAAS,OACT,UAAW,SACX,OAAQE,EACV,EAGA,IAAK,CACH,UAAW,SACX,OAAQC,EACV,EAGA,MAAO,CACL,UAAW,SACX,OAAQC,EACV,EAGA,OAAQ,CACN,UAAW,SACX,OAAQC,EACV,EAGA,OAAQ,CACN,UAAW,SACX,MAAOC,EAAA,CAEX,EChFME,GAAgBC,EAAM,cAA4BF,EAAc,EACtEC,GAAc,YAAc,gBAGrB,MAAME,GAAmB,IAAMD,EAAM,IAAID,EAAa,EAqHhDG,GAAeC,GAA4C,CAChE,KAAA,CACJ,aAAAC,EACA,KAAAC,EACA,SAAAC,EACA,MAAAC,EACA,OAAAC,EACA,IAAAC,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