@pyreon/coolgrid 0.51.0 → 0.53.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 +4 -0
- package/lib/index.d.ts +0 -1
- package/lib/index.js +12 -6
- package/lib/index.js.map +1 -1
- package/lib/native-plugin.d.ts +41 -0
- package/lib/native-plugin.js +158 -0
- package/lib/native-plugin.js.map +1 -0
- package/package.json +30 -11
package/README.md
CHANGED
|
@@ -177,6 +177,10 @@ Swap any layer's root element via `component`:
|
|
|
177
177
|
|
|
178
178
|
Full docs: [pyreon.dev/docs/coolgrid](https://pyreon.dev/docs/coolgrid) (or `docs/src/content/docs/coolgrid.md` in this repo).
|
|
179
179
|
|
|
180
|
+
## Native (iOS / Android)
|
|
181
|
+
|
|
182
|
+
`Container` and `Row` lower to native stacks, and a `<Col size={n}>` with a literal integer span to a fractional width of a 12-column grid (a responsive or non-literal `size` collapses to an equal-fill child with a named warning). The compile-time half ships in this package (`src/native-plugin/`, declared in `package.json` as `pyreon.native.plugin` and discovered by `pyreon-native`), not in `@pyreon/native-compiler`.
|
|
183
|
+
|
|
180
184
|
## License
|
|
181
185
|
|
|
182
186
|
MIT
|
package/lib/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Provider, extendCss } from "@pyreon/unistyle";
|
|
2
2
|
import { ComponentFn, VNodeChild } from "@pyreon/core";
|
|
3
3
|
import { BreakpointKeys } from "@pyreon/ui-core";
|
|
4
|
-
|
|
5
4
|
//#region src/types.d.ts
|
|
6
5
|
type CreateValueType<T> = T | T[] | Partial<Record<BreakpointKeys, T>>;
|
|
7
6
|
type Value = string | number;
|
package/lib/index.js
CHANGED
|
@@ -91,7 +91,8 @@ const widthStyles = ({ size, columns, gap }, { rootSize }) => {
|
|
|
91
91
|
const g = gap;
|
|
92
92
|
const width = s / c * 100;
|
|
93
93
|
const hasGap = hasValue(gap);
|
|
94
|
-
const
|
|
94
|
+
const val = isCssVarValue(gap) ? `calc(${width}% - ${gap})` : hasGap ? `calc(${width}% - ${g}px)` : `${width}%`;
|
|
95
|
+
const v = value(val, rootSize);
|
|
95
96
|
return css$2`
|
|
96
97
|
flex-grow: 0;
|
|
97
98
|
flex-shrink: 0;
|
|
@@ -105,8 +106,9 @@ const spacingStyles$1 = (type, param, rootSize) => {
|
|
|
105
106
|
${`${type}: calc(${param} * 0.5)`};
|
|
106
107
|
`;
|
|
107
108
|
if (!isNumber(param)) return "";
|
|
109
|
+
const finalStyle = `${type}: ${value(param / 2, rootSize)}`;
|
|
108
110
|
return css$2`
|
|
109
|
-
${
|
|
111
|
+
${finalStyle};
|
|
110
112
|
`;
|
|
111
113
|
};
|
|
112
114
|
/**
|
|
@@ -168,8 +170,9 @@ const Component$2 = (props) => {
|
|
|
168
170
|
"component",
|
|
169
171
|
"css"
|
|
170
172
|
]);
|
|
173
|
+
const parentCtx = useContext(RowContext_default);
|
|
171
174
|
const { colCss, colComponent, columns, gap, size, padding } = useGridContext({
|
|
172
|
-
...
|
|
175
|
+
...parentCtx,
|
|
173
176
|
...rest
|
|
174
177
|
});
|
|
175
178
|
const finalProps = { $coolgrid: {
|
|
@@ -290,16 +293,18 @@ const { styled, css, component } = config;
|
|
|
290
293
|
const spacingStyles = ({ gap, gutter }, { rootSize }) => {
|
|
291
294
|
if (isCssVarValue(gap)) {
|
|
292
295
|
const spacingX = `calc(${gap} * -0.5)`;
|
|
296
|
+
const spacingY = isCssVarValue(gutter) ? `calc(${gutter} - ${gap} * 0.5)` : isNumber(gutter) ? `calc(${value(gutter, rootSize)} - ${gap} * 0.5)` : `calc(${gap} * 0.5)`;
|
|
293
297
|
return css`
|
|
294
|
-
margin: ${
|
|
298
|
+
margin: ${spacingY} ${spacingX};
|
|
295
299
|
`;
|
|
296
300
|
}
|
|
297
301
|
if (!isNumber(gap)) return "";
|
|
298
302
|
const g = gap;
|
|
299
303
|
const getValue = (param) => value(param, rootSize);
|
|
300
304
|
const spacingX = g / 2 * -1;
|
|
305
|
+
const spacingY = isNumber(gutter) ? gutter - g / 2 : g / 2;
|
|
301
306
|
return css`
|
|
302
|
-
margin: ${getValue(
|
|
307
|
+
margin: ${getValue(spacingY)} ${getValue(spacingX)};
|
|
303
308
|
`;
|
|
304
309
|
};
|
|
305
310
|
/** Maps the contentAlignX prop to a CSS justify-content value. */
|
|
@@ -354,8 +359,9 @@ const Component = (props) => {
|
|
|
354
359
|
"css",
|
|
355
360
|
"contentAlignX"
|
|
356
361
|
]);
|
|
362
|
+
const parentCtx = useContext(ContainerContext_default);
|
|
357
363
|
const { columns, gap, gutter, rowComponent, rowCss, contentAlignX, containerWidth, size, padding, colCss, colComponent } = useGridContext({
|
|
358
|
-
...
|
|
364
|
+
...parentCtx,
|
|
359
365
|
...rest
|
|
360
366
|
});
|
|
361
367
|
const context = {
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["spacingStyles","styles","component","DEV_PROPS","Component","RowContext","Styled","name","component","styles","component","DEV_PROPS","Component","ContainerContext","Styled","name","component","ContainerContext","RowContext","Styled","component"],"sources":["../src/constants.ts","../src/context/ContainerContext.ts","../src/context/RowContext.ts","../src/useContext.tsx","../src/utils.ts","../src/Col/styled.ts","../src/Col/component.tsx","../src/Col/index.ts","../src/Container/styled.ts","../src/Container/component.tsx","../src/Container/index.ts","../src/Row/styled.ts","../src/Row/component.tsx","../src/Row/index.ts","../src/theme.ts"],"sourcesContent":["export const PKG_NAME = '@pyreon/coolgrid'\n\n/**\n * Grid configuration keys that are passed through context\n * from Container to Row and from Row to Col components.\n */\nexport const CONTEXT_KEYS = [\n // 'breakpoints',\n // 'rootSize',\n 'columns',\n 'size',\n 'gap',\n 'padding',\n 'gutter',\n 'colCss',\n 'colComponent',\n 'rowCss',\n 'rowComponent',\n 'contentAlignX',\n]\n","import { createContext } from '@pyreon/core'\nimport type { Context as ContextType } from '../types'\n\n/**\n * Context for container-level grid configuration.\n * Provided by the Container component and consumed by Row children\n * to inherit columns, gap, gutter, and other grid settings.\n */\nexport default createContext<ContextType>({})\n","import { createContext } from '@pyreon/core'\nimport type { Context as ContextType } from '../types'\n\n/**\n * Context for row-level grid configuration.\n * Provided by the Row component and consumed by Col children\n * to inherit columns, gap, gutter, and sizing for width calculations.\n */\nexport default createContext<ContextType>({})\n","import { useContext } from '@pyreon/core'\nimport { get, pick } from '@pyreon/ui-core'\nimport { context } from '@pyreon/unistyle'\nimport { CONTEXT_KEYS } from './constants'\nimport type { Context, Obj, ValueType } from './types'\n\n/**\n * Resolves grid columns and container width using a three-layer fallback:\n * 1. Explicit component props (e.g. `columns={6}`)\n * 2. `theme.grid.columns` / `theme.grid.container`\n * 3. `theme.coolgrid.columns` / `theme.coolgrid.container`\n */\ntype GetGridContext = (\n props: Obj,\n theme: Obj,\n) => {\n columns?: ValueType\n containerWidth?: Record<string, number>\n}\n\nexport const getGridContext: GetGridContext = (props = {}, theme = {}) => ({\n // `props` is always a plain object (callers pass a `pick()` result or a\n // user-supplied object literal), so direct property access is safe and\n // skips `get`'s path-parsing for these single-key lookups. Ported from\n // vitus-labs `55402572`. Two `get` calls per `getGridContext` invocation\n // saved; fires once per Container/Row/Col render.\n columns: ((props as Obj).columns ||\n get(theme, 'grid.columns') ||\n get(theme, 'coolgrid.columns')) as ValueType,\n containerWidth: ((props as Obj).width ||\n get(theme, 'grid.container') ||\n get(theme, 'coolgrid.container')) as Record<string, number>,\n})\n\n/**\n * Hook that reads the unistyle theme context and merges it with the\n * component's own props to produce the final grid configuration.\n * Applies the three-layer resolution (props -> grid.* -> coolgrid.*).\n */\ntype UseGridContext = (props: Obj) => Context\nconst useGridContext: UseGridContext = (props) => {\n const getCtx = useContext(context)\n const { theme } = getCtx()\n // Direct `pick` (vs the `pickThemeProps` one-liner wrapper that was\n // removed in vitus-labs `55402572`) saves one function call per render.\n const ctxProps = pick(props, CONTEXT_KEYS as Array<keyof typeof props>)\n const gridContext = getGridContext(ctxProps, theme as Record<string, unknown>)\n\n return { ...gridContext, ...ctxProps }\n}\n\nexport default useGridContext\n","import { omit } from '@pyreon/ui-core'\nimport { CONTEXT_KEYS } from './constants'\n\n/** Checks whether a value is a finite number. */\nexport const isNumber = (value: unknown): value is number => Number.isFinite(value)\n\n/** Checks whether a value is a finite number greater than zero. */\nexport const hasValue = (value: unknown): boolean => isNumber(value) && value > 0\n\n/**\n * A CSS-variables-mode value — a `var(…)`/`calc(…)` reference string produced\n * by the cssVariables theming mode (unistyle's `themeToCssVars` leaves /\n * rocketstyle's mode pairs). Grid math can't run JS arithmetic on these;\n * the styled helpers express the same split with native CSS `calc()`.\n */\nexport const isCssVarValue = (value: unknown): value is string =>\n typeof value === 'string' && (value.startsWith('var(') || value.startsWith('calc('))\n\n/**\n * Determines if a column should be visible. A column is visible when its\n * size is undefined (auto) or a non-zero number. Size 0 hides the column.\n */\nexport const isVisible = (value: unknown): boolean =>\n (isNumber(value) && value !== 0) || value === undefined\n\n/** Returns true when both size and columns are positive numbers, indicating an explicit width can be calculated. */\ntype HasWidth = (size: unknown, columns: unknown) => boolean\nexport const hasWidth: HasWidth = (size, columns) => !!(hasValue(size) && hasValue(columns))\n\n/** Strips grid context keys from a props object so they are not forwarded to the DOM element. */\ntype OmitCtxKeys = (props?: Record<string, any>) => ReturnType<typeof omit>\nexport const omitCtxKeys: OmitCtxKeys = (props) => omit(props, CONTEXT_KEYS)\n","import { config } from '@pyreon/ui-core'\nimport type { MakeItResponsiveStyles } from '@pyreon/unistyle'\nimport { extendCss, makeItResponsive, value } from '@pyreon/unistyle'\nimport type { CssOutput, StyledTypes } from '../types'\nimport { hasValue, isCssVarValue, isNumber, isVisible } from '../utils'\n\nconst { styled, css, component } = config\n\ntype HasWidth = (size?: number, columns?: number) => boolean\n\n/** Returns true when both size and columns are valid, enabling explicit width calculation. */\nconst hasWidth: HasWidth = (size, columns) => hasValue(size) && hasValue(columns)\n\ntype WidthStyles = (\n props: Pick<StyledTypes, 'size' | 'columns' | 'gap'>,\n defaults: { rootSize?: number | undefined },\n) => CssOutput\n\n/**\n * Calculates column width as a percentage of total columns, subtracting\n * the gap when present. Uses `calc(%)` for web.\n */\nconst widthStyles: WidthStyles = ({ size, columns, gap }, { rootSize }) => {\n if (!hasWidth(size, columns)) {\n return ''\n }\n\n const s = size as number\n const c = columns as number\n const g = gap as number\n\n // calculate % of width\n const width = (s / c) * 100\n\n const hasGap = hasValue(gap)\n\n // CSS-variables mode: the var reference already carries its unit — never\n // append `px` (that would emit the malformed `var(--x)px`).\n const val = isCssVarValue(gap)\n ? `calc(${width}% - ${gap})`\n : hasGap\n ? `calc(${width}% - ${g}px)`\n : `${width}%`\n\n const v = value(val, rootSize)\n\n return css`\n flex-grow: 0;\n flex-shrink: 0;\n max-width: ${v};\n flex-basis: ${v};\n `\n}\n\ntype SpacingStyles = (\n type: 'margin' | 'padding',\n param?: number | string,\n rootSize?: number,\n) => CssOutput\n/** Applies half of the given value as either margin or padding (used for gap and padding distribution). */\nconst spacingStyles: SpacingStyles = (type, param, rootSize) => {\n if (isCssVarValue(param)) {\n // CSS-variables mode: halve via native calc() — JS division would NaN.\n // (Multiplication for consistency with Row — see the calc divisor note.)\n return css`\n ${`${type}: calc(${param} * 0.5)`};\n `\n }\n\n if (!isNumber(param)) {\n return ''\n }\n\n const finalStyle = `${type}: ${value((param as number) / 2, rootSize)}`\n\n return css`\n ${finalStyle};\n `\n}\n\n/**\n * Main responsive style block for Col. When the column is visible, applies\n * width, padding, margin, and extra CSS. When hidden (size === 0), moves\n * the element off-screen with fixed positioning.\n */\nconst styles: MakeItResponsiveStyles<StyledTypes> = ({ theme, css: cssFn, rootSize }) => {\n const { size, columns, gap, padding, extraStyles } = theme\n const renderStyles = isVisible(size)\n\n if (renderStyles) {\n return cssFn`\n left: initial;\n position: relative;\n ${widthStyles({ size, columns, gap }, { rootSize })};\n ${spacingStyles('padding', padding, rootSize)};\n ${spacingStyles('margin', gap, rootSize)};\n ${extendCss(extraStyles)};\n `\n }\n\n return cssFn`\n left: -9999px;\n position: fixed;\n margin: 0;\n padding: 0;\n `\n}\n\nexport default styled(component, { layer: 'elements' })`\n box-sizing: border-box;\n justify-content: stretch;\n\n position: relative;\n display: flex;\n flex-basis: 0;\n flex-grow: 1;\n flex-direction: column;\n\n ${makeItResponsive({\n key: '$coolgrid',\n styles,\n css,\n normalize: true,\n })};\n`\n","import { splitProps, useContext } from '@pyreon/core'\nimport { PKG_NAME } from '../constants'\nimport { RowContext } from '../context'\nimport type { ElementFn } from '../types'\nimport useGridContext from '../useContext'\nimport { omitCtxKeys } from '../utils'\nimport Styled from './styled'\n\n/**\n * Col (column) component that reads grid settings from RowContext\n * (columns, gap, gutter) and calculates its own width as a fraction\n * of the total columns. Supports responsive size, padding, and visibility.\n */\n\n/* v8 ignore next — production branch not exercised in tests */\nconst DEV_PROPS: Record<string, string> = process.env.NODE_ENV !== 'production' ? { 'data-coolgrid': 'col' } : {}\n\nconst Component: ElementFn<\n [\n 'containerWidth',\n 'width',\n 'rowComponent',\n 'rowCss',\n 'colCss',\n 'colComponent',\n 'columns',\n 'gap',\n 'gutter',\n 'contentAlignX',\n ]\n> = (props) => {\n const [own, rest] = splitProps(props, ['children', 'component', 'css'])\n const parentCtx = useContext(RowContext)\n const { colCss, colComponent, columns, gap, size, padding } = useGridContext({\n ...parentCtx,\n ...rest,\n })\n\n const finalProps = {\n $coolgrid: {\n columns,\n gap,\n size,\n padding,\n extraStyles: own.css ?? colCss,\n },\n }\n\n return (\n <Styled {...omitCtxKeys(rest)} as={own.component ?? colComponent} {...finalProps} {...DEV_PROPS}>\n {own.children}\n </Styled>\n )\n}\n\nconst name = `${PKG_NAME}/Col`\n\n\n// Branding rides the PURE export expression — a bare top-level\n// `Component.x = y` assignment is an unremovable side effect that pins every\n// component in the package into every consumer bundle (measured on\n// @pyreon/elements: importing just <Portal> paid the whole 7.5KB gz; PR ref\n// in elements/src/Portal/component.tsx).\nexport default /* @__PURE__ */ Object.assign(Component, {\n displayName: name,\n pkgName: PKG_NAME,\n PYREON__COMPONENT: name,\n})\n","import component from './component'\n\nexport default component\n","import { config } from '@pyreon/ui-core'\nimport type { MakeItResponsiveStyles } from '@pyreon/unistyle'\nimport { extendCss, makeItResponsive, value } from '@pyreon/unistyle'\nimport type { StyledTypes } from '../types'\n\nconst { styled, css, component } = config\n\n/** Responsive styles that apply the container's max-width and any extra CSS at each breakpoint. */\nconst styles: MakeItResponsiveStyles<Pick<StyledTypes, 'width' | 'extraStyles'>> = ({\n theme: t,\n css: cssFn,\n rootSize,\n}) => {\n const w = t.width != null && typeof t.width !== 'object' ? t.width : null\n\n return cssFn`\n ${w != null ? `max-width: ${value(w, rootSize)};` : ''};\n ${extendCss(t.extraStyles)};\n `\n}\n\n/** Styled Container element. Centered via auto margins with responsive max-width. */\nexport default styled(component, { layer: 'elements' })`\n display: flex;\n flex-direction: column;\n box-sizing: border-box;\n width: 100%;\n margin-right: auto;\n margin-left: auto;\n\n ${makeItResponsive({\n key: '$coolgrid',\n styles,\n css,\n normalize: true,\n })};\n`\n","import { nativeCompat, provide, splitProps } from '@pyreon/core'\nimport { PKG_NAME } from '../constants'\nimport ContainerContext from '../context/ContainerContext'\nimport type { ElementFn } from '../types'\nimport useGridContext from '../useContext'\nimport { omitCtxKeys } from '../utils'\nimport Styled from './styled'\n\n/**\n * Container component that establishes the outermost grid boundary.\n * Resolves grid config from the theme, provides it to descendant Row/Col\n * components via ContainerContext, and renders a styled wrapper with\n * responsive max-width.\n */\n\n/* v8 ignore next — production branch not exercised in tests */\nconst DEV_PROPS: Record<string, string> = process.env.NODE_ENV !== 'production' ? { 'data-coolgrid': 'container' } : {}\n\nconst Component: ElementFn<['containerWidth']> = (props) => {\n const [own, rest] = splitProps(props, ['children', 'component', 'css', 'width'])\n const {\n containerWidth,\n columns,\n size,\n gap,\n padding,\n gutter,\n colCss,\n colComponent,\n rowCss,\n rowComponent,\n contentAlignX,\n } = useGridContext(rest)\n\n const context = {\n columns,\n size,\n gap,\n padding,\n gutter,\n colCss,\n colComponent,\n rowCss,\n rowComponent,\n contentAlignX,\n }\n\n const finalWidth = (() => {\n if (!own.width) return containerWidth\n if (typeof own.width === 'function') return own.width(containerWidth as Record<string, any>)\n return own.width\n })()\n\n const finalProps = {\n $coolgrid: {\n width: finalWidth,\n extraStyles: own.css,\n },\n }\n\n // Provide container context to descendant Row/Col components\n provide(ContainerContext, context)\n\n return (\n <Styled {...omitCtxKeys(rest)} as={own.component} {...finalProps} {...DEV_PROPS}>\n {own.children}\n </Styled>\n )\n}\n\nconst name = `${PKG_NAME}/Container`\n\n\n// Mark as native — compat-mode jsx() runtimes skip wrapCompatComponent so\n// Container's provide(ContainerContext, ...) reaches descendant Row/Col.\n\n// ASSIGNMENT + /* @__PURE__ */ form (not a bare statement): inside a built\n// lib's shared chunk a bare `nativeCompat(X)` call is an unremovable side\n// effect that RETAINS the component body in every consumer bundle that\n// never imports it (see runtime-dom's native-compat-treeshake lock). The\n// PURE call is droppable exactly when the export is unused; when used it\n// returns the SAME fn with the marker applied.\n// Branding rides the PURE export expression — a bare top-level\n// `Component.x = y` assignment is an unremovable side effect that pins every\n// component in the package into every consumer bundle (measured on\n// @pyreon/elements: importing just <Portal> paid the whole 7.5KB gz; PR ref\n// in elements/src/Portal/component.tsx).\nexport default /* @__PURE__ */ nativeCompat(\n /* @__PURE__ */ Object.assign(Component, {\n displayName: name,\n pkgName: PKG_NAME,\n PYREON__COMPONENT: name,\n }),\n)","import component from './component'\n\nexport default component\n","import { config } from '@pyreon/ui-core'\nimport type { MakeItResponsiveStyles } from '@pyreon/unistyle'\nimport { ALIGN_CONTENT_MAP_X, extendCss, makeItResponsive, value } from '@pyreon/unistyle'\nimport type { CssOutput, StyledTypes } from '../types'\nimport { isCssVarValue, isNumber } from '../utils'\n\nconst { styled, css, component } = config\n\n/**\n * Computes negative horizontal margins to compensate for column gap,\n * and vertical margins that account for gutter (inter-row spacing).\n * This creates the classic grid pattern where column gaps cancel out\n * at the row edges.\n */\ntype SpacingStyles = (\n props: Pick<StyledTypes, 'gap' | 'gutter'>,\n { rootSize }: { rootSize?: number | undefined },\n) => CssOutput\n\nconst spacingStyles: SpacingStyles = ({ gap, gutter }, { rootSize }) => {\n if (isCssVarValue(gap)) {\n // CSS-variables mode: the gap is a var()/calc() reference — express the\n // split with native CSS calc() instead of JS arithmetic (which would\n // produce NaN; pre-fix this path silently SKIPPED all spacing).\n // NOTE: multiplication, not division — `calc(x / -2)` is invalid CSS\n // (divisor must be positive in Chromium's parser) and one invalid\n // component would drop the WHOLE margin shorthand.\n const spacingX = `calc(${gap} * -0.5)`\n const spacingY = isCssVarValue(gutter)\n ? `calc(${gutter} - ${gap} * 0.5)`\n : isNumber(gutter)\n ? `calc(${value(gutter, rootSize)} - ${gap} * 0.5)`\n : `calc(${gap} * 0.5)`\n\n return css`\n margin: ${spacingY} ${spacingX};\n `\n }\n\n if (!isNumber(gap)) return ''\n\n const g = gap as number\n const getValue = (param: string | number | null | undefined) => value(param, rootSize)\n\n const spacingX = (g / 2) * -1\n const spacingY = isNumber(gutter) ? (gutter as number) - g / 2 : g / 2\n\n return css`\n margin: ${getValue(spacingY)} ${getValue(spacingX)};\n `\n}\n\n/** Maps the contentAlignX prop to a CSS justify-content value. */\nconst contentAlign = (align?: StyledTypes['contentAlignX']) => {\n if (!align) return ''\n\n return css`\n justify-content: ${ALIGN_CONTENT_MAP_X[align]};\n `\n}\n\n/** Composes spacing, alignment, and extra CSS into a single responsive style block for the Row. */\nconst styles: MakeItResponsiveStyles<\n Pick<StyledTypes, 'gap' | 'gutter' | 'contentAlignX' | 'extraStyles'>\n> = ({ theme, css: cssFn, rootSize }) => {\n const { gap, gutter, contentAlignX, extraStyles } = theme\n\n return cssFn`\n ${spacingStyles({ gap, gutter }, { rootSize })};\n ${contentAlign(contentAlignX)};\n ${extendCss(extraStyles)};\n `\n}\n\nexport default styled(component, { layer: 'elements' })`\n box-sizing: border-box;\n\n display: flex;\n flex-wrap: wrap;\n align-self: stretch;\n flex-direction: row;\n\n ${makeItResponsive({\n key: '$coolgrid',\n styles,\n css,\n normalize: true,\n })};\n`\n","import { nativeCompat, provide, splitProps, useContext } from '@pyreon/core'\nimport { PKG_NAME } from '../constants'\nimport { ContainerContext, RowContext } from '../context'\nimport type { ElementFn } from '../types'\nimport useGridContext from '../useContext'\nimport { omitCtxKeys } from '../utils'\nimport Styled from './styled'\n\n/**\n * Row component that reads inherited config from ContainerContext, merges\n * it with its own props, and provides the resolved grid settings (columns,\n * gap, gutter) to Col children via RowContext. Renders a flex-wrap container\n * with negative margins to offset column gutters.\n */\n\n/* v8 ignore next — production branch not exercised in tests */\nconst DEV_PROPS: Record<string, string> = process.env.NODE_ENV !== 'production' ? { 'data-coolgrid': 'row' } : {}\n\nconst Component: ElementFn<['containerWidth', 'width', 'rowComponent', 'rowCss']> = (props) => {\n const [own, rest] = splitProps(props, ['children', 'component', 'css', 'contentAlignX'])\n const parentCtx = useContext(ContainerContext)\n\n const {\n columns,\n gap,\n gutter,\n rowComponent,\n rowCss,\n contentAlignX,\n containerWidth,\n size,\n padding,\n colCss,\n colComponent,\n } = useGridContext({ ...parentCtx, ...rest })\n\n const context = {\n containerWidth,\n size,\n padding,\n colCss,\n colComponent,\n columns,\n gap,\n gutter,\n }\n\n const finalProps = {\n $coolgrid: {\n contentAlignX: own.contentAlignX || contentAlignX,\n columns,\n gap,\n gutter,\n extraStyles: own.css || rowCss,\n },\n }\n\n // Provide row context to Col children\n provide(RowContext, context)\n\n return (\n <Styled {...omitCtxKeys(rest)} as={own.component || rowComponent} {...finalProps} {...DEV_PROPS}>\n {own.children}\n </Styled>\n )\n}\n\nconst name = `${PKG_NAME}/Row`\n\n\n// Mark as native — compat-mode jsx() runtimes skip wrapCompatComponent so\n// Row's useContext(ContainerContext) read + provide(RowContext, ...) reach\n// Pyreon's setup frame.\n\n// ASSIGNMENT + /* @__PURE__ */ form (not a bare statement): inside a built\n// lib's shared chunk a bare `nativeCompat(X)` call is an unremovable side\n// effect that RETAINS the component body in every consumer bundle that\n// never imports it (see runtime-dom's native-compat-treeshake lock). The\n// PURE call is droppable exactly when the export is unused; when used it\n// returns the SAME fn with the marker applied.\n// Branding rides the PURE export expression — a bare top-level\n// `Component.x = y` assignment is an unremovable side effect that pins every\n// component in the package into every consumer bundle (measured on\n// @pyreon/elements: importing just <Portal> paid the whole 7.5KB gz; PR ref\n// in elements/src/Portal/component.tsx).\nexport default /* @__PURE__ */ nativeCompat(\n /* @__PURE__ */ Object.assign(Component, {\n displayName: name,\n pkgName: PKG_NAME,\n PYREON__COMPONENT: name,\n }),\n)","import component from './component'\n\nexport default component\n","/**\n * Default Bootstrap-like grid configuration. Provides 5 breakpoints (xs-xl),\n * a 12-column grid, and responsive container max-widths matching Bootstrap 4.\n */\nexport default {\n rootSize: 16,\n breakpoints: {\n xs: 0,\n sm: 576,\n md: 768,\n lg: 992,\n xl: 1200,\n },\n grid: {\n columns: 12,\n container: {\n xs: '100%',\n sm: 540,\n md: 720,\n lg: 960,\n xl: 1140,\n },\n },\n} as const\n\nexport const defaultBreakpoints: Record<string, number> = {\n xs: 0,\n sm: 576,\n md: 768,\n lg: 992,\n xl: 1200,\n}\n\nexport const defaultContainerWidths: Record<string, string | number> = {\n xs: '100%',\n sm: 540,\n md: 720,\n lg: 960,\n xl: 1140,\n}\n"],"mappings":";;;;;;AAAA,MAAa,WAAW;;;;;AAMxB,MAAa,eAAe;CAG1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;;;;;;;;ACXA,+BAAe,cAA2B,CAAC,CAAC;;;;;;;;;ACA5C,yBAAe,cAA2B,CAAC,CAAC;;;;ACY5C,MAAa,kBAAkC,QAAQ,CAAC,GAAG,QAAQ,CAAC,OAAO;CAMzE,SAAW,MAAc,WACvB,IAAI,OAAO,cAAc,KACzB,IAAI,OAAO,kBAAkB;CAC/B,gBAAkB,MAAc,SAC9B,IAAI,OAAO,gBAAgB,KAC3B,IAAI,OAAO,oBAAoB;AACnC;AAQA,MA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vF,MAAM,EACJ,SACA,KACA,QACA,cACA,QACA,eACA,gBACA,MACA,SACA,QACA,iBACE,eAAe;EAAE,GAdH,WAAWC,wBAcG;EAAG,GAAG;CAAK,CAAC;CAE5C,MAAM,UAAU;EACd;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CAEA,MAAM,aAAa,EACjB,WAAW;EACT,eAAe,IAAI,iBAAiB;EACpC;EACA;EACA;EACA,aAAa,IAAI,OAAO;CAC1B,EACF;CAGA,QAAQC,oBAAY,OAAO;CAE3B,OACE,oBAACC,gBAAD;EAAQ,GAAI,YAAY,IAAI;EAAG,IAAI,IAAI,aAAa;EAAc,GAAI;EAAY,GAAI;YACnF,IAAI;CACC;AAEZ;AAEA,MAAM,OAAO,GAAG,SAAS;AAkBzB,wBAA+B,6BACb,uBAAO,OAAO,WAAW;CACvC,aAAa;CACb,SAAS;CACT,mBAAmB;AACrB,CAAC,CACH;;;;ACzFA,kBAAeC;;;;;;;;ACEf,oBAAe;CACb,UAAU;CACV,aAAa;EACX,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;CACN;CACA,MAAM;EACJ,SAAS;EACT,WAAW;GACT,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;EACN;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["spacingStyles","styles","component","DEV_PROPS","Component","RowContext","Styled","name","component","styles","component","DEV_PROPS","Component","ContainerContext","Styled","name","component","ContainerContext","RowContext","Styled","component"],"sources":["../src/constants.ts","../src/context/ContainerContext.ts","../src/context/RowContext.ts","../src/useContext.tsx","../src/utils.ts","../src/Col/styled.ts","../src/Col/component.tsx","../src/Col/index.ts","../src/Container/styled.ts","../src/Container/component.tsx","../src/Container/index.ts","../src/Row/styled.ts","../src/Row/component.tsx","../src/Row/index.ts","../src/theme.ts"],"sourcesContent":["export const PKG_NAME = '@pyreon/coolgrid'\n\n/**\n * Grid configuration keys that are passed through context\n * from Container to Row and from Row to Col components.\n */\nexport const CONTEXT_KEYS = [\n // 'breakpoints',\n // 'rootSize',\n 'columns',\n 'size',\n 'gap',\n 'padding',\n 'gutter',\n 'colCss',\n 'colComponent',\n 'rowCss',\n 'rowComponent',\n 'contentAlignX',\n]\n","import { createContext } from '@pyreon/core'\nimport type { Context as ContextType } from '../types'\n\n/**\n * Context for container-level grid configuration.\n * Provided by the Container component and consumed by Row children\n * to inherit columns, gap, gutter, and other grid settings.\n */\nexport default createContext<ContextType>({})\n","import { createContext } from '@pyreon/core'\nimport type { Context as ContextType } from '../types'\n\n/**\n * Context for row-level grid configuration.\n * Provided by the Row component and consumed by Col children\n * to inherit columns, gap, gutter, and sizing for width calculations.\n */\nexport default createContext<ContextType>({})\n","import { useContext } from '@pyreon/core'\nimport { get, pick } from '@pyreon/ui-core'\nimport { context } from '@pyreon/unistyle'\nimport { CONTEXT_KEYS } from './constants'\nimport type { Context, Obj, ValueType } from './types'\n\n/**\n * Resolves grid columns and container width using a three-layer fallback:\n * 1. Explicit component props (e.g. `columns={6}`)\n * 2. `theme.grid.columns` / `theme.grid.container`\n * 3. `theme.coolgrid.columns` / `theme.coolgrid.container`\n */\ntype GetGridContext = (\n props: Obj,\n theme: Obj,\n) => {\n columns?: ValueType\n containerWidth?: Record<string, number>\n}\n\nexport const getGridContext: GetGridContext = (props = {}, theme = {}) => ({\n // `props` is always a plain object (callers pass a `pick()` result or a\n // user-supplied object literal), so direct property access is safe and\n // skips `get`'s path-parsing for these single-key lookups. Ported from\n // vitus-labs `55402572`. Two `get` calls per `getGridContext` invocation\n // saved; fires once per Container/Row/Col render.\n columns: ((props as Obj).columns ||\n get(theme, 'grid.columns') ||\n get(theme, 'coolgrid.columns')) as ValueType,\n containerWidth: ((props as Obj).width ||\n get(theme, 'grid.container') ||\n get(theme, 'coolgrid.container')) as Record<string, number>,\n})\n\n/**\n * Hook that reads the unistyle theme context and merges it with the\n * component's own props to produce the final grid configuration.\n * Applies the three-layer resolution (props -> grid.* -> coolgrid.*).\n */\ntype UseGridContext = (props: Obj) => Context\nconst useGridContext: UseGridContext = (props) => {\n const getCtx = useContext(context)\n const { theme } = getCtx()\n // Direct `pick` (vs the `pickThemeProps` one-liner wrapper that was\n // removed in vitus-labs `55402572`) saves one function call per render.\n const ctxProps = pick(props, CONTEXT_KEYS as Array<keyof typeof props>)\n const gridContext = getGridContext(ctxProps, theme as Record<string, unknown>)\n\n return { ...gridContext, ...ctxProps }\n}\n\nexport default useGridContext\n","import { omit } from '@pyreon/ui-core'\nimport { CONTEXT_KEYS } from './constants'\n\n/** Checks whether a value is a finite number. */\nexport const isNumber = (value: unknown): value is number => Number.isFinite(value)\n\n/** Checks whether a value is a finite number greater than zero. */\nexport const hasValue = (value: unknown): boolean => isNumber(value) && value > 0\n\n/**\n * A CSS-variables-mode value — a `var(…)`/`calc(…)` reference string produced\n * by the cssVariables theming mode (unistyle's `themeToCssVars` leaves /\n * rocketstyle's mode pairs). Grid math can't run JS arithmetic on these;\n * the styled helpers express the same split with native CSS `calc()`.\n */\nexport const isCssVarValue = (value: unknown): value is string =>\n typeof value === 'string' && (value.startsWith('var(') || value.startsWith('calc('))\n\n/**\n * Determines if a column should be visible. A column is visible when its\n * size is undefined (auto) or a non-zero number. Size 0 hides the column.\n */\nexport const isVisible = (value: unknown): boolean =>\n (isNumber(value) && value !== 0) || value === undefined\n\n/** Returns true when both size and columns are positive numbers, indicating an explicit width can be calculated. */\ntype HasWidth = (size: unknown, columns: unknown) => boolean\nexport const hasWidth: HasWidth = (size, columns) => !!(hasValue(size) && hasValue(columns))\n\n/** Strips grid context keys from a props object so they are not forwarded to the DOM element. */\ntype OmitCtxKeys = (props?: Record<string, any>) => ReturnType<typeof omit>\nexport const omitCtxKeys: OmitCtxKeys = (props) => omit(props, CONTEXT_KEYS)\n","import { config } from '@pyreon/ui-core'\nimport type { MakeItResponsiveStyles } from '@pyreon/unistyle'\nimport { extendCss, makeItResponsive, value } from '@pyreon/unistyle'\nimport type { CssOutput, StyledTypes } from '../types'\nimport { hasValue, isCssVarValue, isNumber, isVisible } from '../utils'\n\nconst { styled, css, component } = config\n\ntype HasWidth = (size?: number, columns?: number) => boolean\n\n/** Returns true when both size and columns are valid, enabling explicit width calculation. */\nconst hasWidth: HasWidth = (size, columns) => hasValue(size) && hasValue(columns)\n\ntype WidthStyles = (\n props: Pick<StyledTypes, 'size' | 'columns' | 'gap'>,\n defaults: { rootSize?: number | undefined },\n) => CssOutput\n\n/**\n * Calculates column width as a percentage of total columns, subtracting\n * the gap when present. Uses `calc(%)` for web.\n */\nconst widthStyles: WidthStyles = ({ size, columns, gap }, { rootSize }) => {\n if (!hasWidth(size, columns)) {\n return ''\n }\n\n const s = size as number\n const c = columns as number\n const g = gap as number\n\n // calculate % of width\n const width = (s / c) * 100\n\n const hasGap = hasValue(gap)\n\n // CSS-variables mode: the var reference already carries its unit — never\n // append `px` (that would emit the malformed `var(--x)px`).\n const val = isCssVarValue(gap)\n ? `calc(${width}% - ${gap})`\n : hasGap\n ? `calc(${width}% - ${g}px)`\n : `${width}%`\n\n const v = value(val, rootSize)\n\n return css`\n flex-grow: 0;\n flex-shrink: 0;\n max-width: ${v};\n flex-basis: ${v};\n `\n}\n\ntype SpacingStyles = (\n type: 'margin' | 'padding',\n param?: number | string,\n rootSize?: number,\n) => CssOutput\n/** Applies half of the given value as either margin or padding (used for gap and padding distribution). */\nconst spacingStyles: SpacingStyles = (type, param, rootSize) => {\n if (isCssVarValue(param)) {\n // CSS-variables mode: halve via native calc() — JS division would NaN.\n // (Multiplication for consistency with Row — see the calc divisor note.)\n return css`\n ${`${type}: calc(${param} * 0.5)`};\n `\n }\n\n if (!isNumber(param)) {\n return ''\n }\n\n const finalStyle = `${type}: ${value((param as number) / 2, rootSize)}`\n\n return css`\n ${finalStyle};\n `\n}\n\n/**\n * Main responsive style block for Col. When the column is visible, applies\n * width, padding, margin, and extra CSS. When hidden (size === 0), moves\n * the element off-screen with fixed positioning.\n */\nconst styles: MakeItResponsiveStyles<StyledTypes> = ({ theme, css: cssFn, rootSize }) => {\n const { size, columns, gap, padding, extraStyles } = theme\n const renderStyles = isVisible(size)\n\n if (renderStyles) {\n return cssFn`\n left: initial;\n position: relative;\n ${widthStyles({ size, columns, gap }, { rootSize })};\n ${spacingStyles('padding', padding, rootSize)};\n ${spacingStyles('margin', gap, rootSize)};\n ${extendCss(extraStyles)};\n `\n }\n\n return cssFn`\n left: -9999px;\n position: fixed;\n margin: 0;\n padding: 0;\n `\n}\n\nexport default styled(component, { layer: 'elements' })`\n box-sizing: border-box;\n justify-content: stretch;\n\n position: relative;\n display: flex;\n flex-basis: 0;\n flex-grow: 1;\n flex-direction: column;\n\n ${makeItResponsive({\n key: '$coolgrid',\n styles,\n css,\n normalize: true,\n })};\n`\n","import { splitProps, useContext } from '@pyreon/core'\nimport { PKG_NAME } from '../constants'\nimport { RowContext } from '../context'\nimport type { ElementFn } from '../types'\nimport useGridContext from '../useContext'\nimport { omitCtxKeys } from '../utils'\nimport Styled from './styled'\n\n/**\n * Col (column) component that reads grid settings from RowContext\n * (columns, gap, gutter) and calculates its own width as a fraction\n * of the total columns. Supports responsive size, padding, and visibility.\n */\n\n/* v8 ignore next — production branch not exercised in tests */\nconst DEV_PROPS: Record<string, string> = process.env.NODE_ENV !== 'production' ? { 'data-coolgrid': 'col' } : {}\n\nconst Component: ElementFn<\n [\n 'containerWidth',\n 'width',\n 'rowComponent',\n 'rowCss',\n 'colCss',\n 'colComponent',\n 'columns',\n 'gap',\n 'gutter',\n 'contentAlignX',\n ]\n> = (props) => {\n const [own, rest] = splitProps(props, ['children', 'component', 'css'])\n const parentCtx = useContext(RowContext)\n const { colCss, colComponent, columns, gap, size, padding } = useGridContext({\n ...parentCtx,\n ...rest,\n })\n\n const finalProps = {\n $coolgrid: {\n columns,\n gap,\n size,\n padding,\n extraStyles: own.css ?? colCss,\n },\n }\n\n return (\n <Styled {...omitCtxKeys(rest)} as={own.component ?? colComponent} {...finalProps} {...DEV_PROPS}>\n {own.children}\n </Styled>\n )\n}\n\nconst name = `${PKG_NAME}/Col`\n\n\n// Branding rides the PURE export expression — a bare top-level\n// `Component.x = y` assignment is an unremovable side effect that pins every\n// component in the package into every consumer bundle (measured on\n// @pyreon/elements: importing just <Portal> paid the whole 7.5KB gz; PR ref\n// in elements/src/Portal/component.tsx).\nexport default /* @__PURE__ */ Object.assign(Component, {\n displayName: name,\n pkgName: PKG_NAME,\n PYREON__COMPONENT: name,\n})\n","import component from './component'\n\nexport default component\n","import { config } from '@pyreon/ui-core'\nimport type { MakeItResponsiveStyles } from '@pyreon/unistyle'\nimport { extendCss, makeItResponsive, value } from '@pyreon/unistyle'\nimport type { StyledTypes } from '../types'\n\nconst { styled, css, component } = config\n\n/** Responsive styles that apply the container's max-width and any extra CSS at each breakpoint. */\nconst styles: MakeItResponsiveStyles<Pick<StyledTypes, 'width' | 'extraStyles'>> = ({\n theme: t,\n css: cssFn,\n rootSize,\n}) => {\n const w = t.width != null && typeof t.width !== 'object' ? t.width : null\n\n return cssFn`\n ${w != null ? `max-width: ${value(w, rootSize)};` : ''};\n ${extendCss(t.extraStyles)};\n `\n}\n\n/** Styled Container element. Centered via auto margins with responsive max-width. */\nexport default styled(component, { layer: 'elements' })`\n display: flex;\n flex-direction: column;\n box-sizing: border-box;\n width: 100%;\n margin-right: auto;\n margin-left: auto;\n\n ${makeItResponsive({\n key: '$coolgrid',\n styles,\n css,\n normalize: true,\n })};\n`\n","import { nativeCompat, provide, splitProps } from '@pyreon/core'\nimport { PKG_NAME } from '../constants'\nimport ContainerContext from '../context/ContainerContext'\nimport type { ElementFn } from '../types'\nimport useGridContext from '../useContext'\nimport { omitCtxKeys } from '../utils'\nimport Styled from './styled'\n\n/**\n * Container component that establishes the outermost grid boundary.\n * Resolves grid config from the theme, provides it to descendant Row/Col\n * components via ContainerContext, and renders a styled wrapper with\n * responsive max-width.\n */\n\n/* v8 ignore next — production branch not exercised in tests */\nconst DEV_PROPS: Record<string, string> = process.env.NODE_ENV !== 'production' ? { 'data-coolgrid': 'container' } : {}\n\nconst Component: ElementFn<['containerWidth']> = (props) => {\n const [own, rest] = splitProps(props, ['children', 'component', 'css', 'width'])\n const {\n containerWidth,\n columns,\n size,\n gap,\n padding,\n gutter,\n colCss,\n colComponent,\n rowCss,\n rowComponent,\n contentAlignX,\n } = useGridContext(rest)\n\n const context = {\n columns,\n size,\n gap,\n padding,\n gutter,\n colCss,\n colComponent,\n rowCss,\n rowComponent,\n contentAlignX,\n }\n\n const finalWidth = (() => {\n if (!own.width) return containerWidth\n if (typeof own.width === 'function') return own.width(containerWidth as Record<string, any>)\n return own.width\n })()\n\n const finalProps = {\n $coolgrid: {\n width: finalWidth,\n extraStyles: own.css,\n },\n }\n\n // Provide container context to descendant Row/Col components\n provide(ContainerContext, context)\n\n return (\n <Styled {...omitCtxKeys(rest)} as={own.component} {...finalProps} {...DEV_PROPS}>\n {own.children}\n </Styled>\n )\n}\n\nconst name = `${PKG_NAME}/Container`\n\n\n// Mark as native — compat-mode jsx() runtimes skip wrapCompatComponent so\n// Container's provide(ContainerContext, ...) reaches descendant Row/Col.\n\n// ASSIGNMENT + /* @__PURE__ */ form (not a bare statement): inside a built\n// lib's shared chunk a bare `nativeCompat(X)` call is an unremovable side\n// effect that RETAINS the component body in every consumer bundle that\n// never imports it (see runtime-dom's native-compat-treeshake lock). The\n// PURE call is droppable exactly when the export is unused; when used it\n// returns the SAME fn with the marker applied.\n// Branding rides the PURE export expression — a bare top-level\n// `Component.x = y` assignment is an unremovable side effect that pins every\n// component in the package into every consumer bundle (measured on\n// @pyreon/elements: importing just <Portal> paid the whole 7.5KB gz; PR ref\n// in elements/src/Portal/component.tsx).\nexport default /* @__PURE__ */ nativeCompat(\n /* @__PURE__ */ Object.assign(Component, {\n displayName: name,\n pkgName: PKG_NAME,\n PYREON__COMPONENT: name,\n }),\n)","import component from './component'\n\nexport default component\n","import { config } from '@pyreon/ui-core'\nimport type { MakeItResponsiveStyles } from '@pyreon/unistyle'\nimport { ALIGN_CONTENT_MAP_X, extendCss, makeItResponsive, value } from '@pyreon/unistyle'\nimport type { CssOutput, StyledTypes } from '../types'\nimport { isCssVarValue, isNumber } from '../utils'\n\nconst { styled, css, component } = config\n\n/**\n * Computes negative horizontal margins to compensate for column gap,\n * and vertical margins that account for gutter (inter-row spacing).\n * This creates the classic grid pattern where column gaps cancel out\n * at the row edges.\n */\ntype SpacingStyles = (\n props: Pick<StyledTypes, 'gap' | 'gutter'>,\n { rootSize }: { rootSize?: number | undefined },\n) => CssOutput\n\nconst spacingStyles: SpacingStyles = ({ gap, gutter }, { rootSize }) => {\n if (isCssVarValue(gap)) {\n // CSS-variables mode: the gap is a var()/calc() reference — express the\n // split with native CSS calc() instead of JS arithmetic (which would\n // produce NaN; pre-fix this path silently SKIPPED all spacing).\n // NOTE: multiplication, not division — `calc(x / -2)` is invalid CSS\n // (divisor must be positive in Chromium's parser) and one invalid\n // component would drop the WHOLE margin shorthand.\n const spacingX = `calc(${gap} * -0.5)`\n const spacingY = isCssVarValue(gutter)\n ? `calc(${gutter} - ${gap} * 0.5)`\n : isNumber(gutter)\n ? `calc(${value(gutter, rootSize)} - ${gap} * 0.5)`\n : `calc(${gap} * 0.5)`\n\n return css`\n margin: ${spacingY} ${spacingX};\n `\n }\n\n if (!isNumber(gap)) return ''\n\n const g = gap as number\n const getValue = (param: string | number | null | undefined) => value(param, rootSize)\n\n const spacingX = (g / 2) * -1\n const spacingY = isNumber(gutter) ? (gutter as number) - g / 2 : g / 2\n\n return css`\n margin: ${getValue(spacingY)} ${getValue(spacingX)};\n `\n}\n\n/** Maps the contentAlignX prop to a CSS justify-content value. */\nconst contentAlign = (align?: StyledTypes['contentAlignX']) => {\n if (!align) return ''\n\n return css`\n justify-content: ${ALIGN_CONTENT_MAP_X[align]};\n `\n}\n\n/** Composes spacing, alignment, and extra CSS into a single responsive style block for the Row. */\nconst styles: MakeItResponsiveStyles<\n Pick<StyledTypes, 'gap' | 'gutter' | 'contentAlignX' | 'extraStyles'>\n> = ({ theme, css: cssFn, rootSize }) => {\n const { gap, gutter, contentAlignX, extraStyles } = theme\n\n return cssFn`\n ${spacingStyles({ gap, gutter }, { rootSize })};\n ${contentAlign(contentAlignX)};\n ${extendCss(extraStyles)};\n `\n}\n\nexport default styled(component, { layer: 'elements' })`\n box-sizing: border-box;\n\n display: flex;\n flex-wrap: wrap;\n align-self: stretch;\n flex-direction: row;\n\n ${makeItResponsive({\n key: '$coolgrid',\n styles,\n css,\n normalize: true,\n })};\n`\n","import { nativeCompat, provide, splitProps, useContext } from '@pyreon/core'\nimport { PKG_NAME } from '../constants'\nimport { ContainerContext, RowContext } from '../context'\nimport type { ElementFn } from '../types'\nimport useGridContext from '../useContext'\nimport { omitCtxKeys } from '../utils'\nimport Styled from './styled'\n\n/**\n * Row component that reads inherited config from ContainerContext, merges\n * it with its own props, and provides the resolved grid settings (columns,\n * gap, gutter) to Col children via RowContext. Renders a flex-wrap container\n * with negative margins to offset column gutters.\n */\n\n/* v8 ignore next — production branch not exercised in tests */\nconst DEV_PROPS: Record<string, string> = process.env.NODE_ENV !== 'production' ? { 'data-coolgrid': 'row' } : {}\n\nconst Component: ElementFn<['containerWidth', 'width', 'rowComponent', 'rowCss']> = (props) => {\n const [own, rest] = splitProps(props, ['children', 'component', 'css', 'contentAlignX'])\n const parentCtx = useContext(ContainerContext)\n\n const {\n columns,\n gap,\n gutter,\n rowComponent,\n rowCss,\n contentAlignX,\n containerWidth,\n size,\n padding,\n colCss,\n colComponent,\n } = useGridContext({ ...parentCtx, ...rest })\n\n const context = {\n containerWidth,\n size,\n padding,\n colCss,\n colComponent,\n columns,\n gap,\n gutter,\n }\n\n const finalProps = {\n $coolgrid: {\n contentAlignX: own.contentAlignX || contentAlignX,\n columns,\n gap,\n gutter,\n extraStyles: own.css || rowCss,\n },\n }\n\n // Provide row context to Col children\n provide(RowContext, context)\n\n return (\n <Styled {...omitCtxKeys(rest)} as={own.component || rowComponent} {...finalProps} {...DEV_PROPS}>\n {own.children}\n </Styled>\n )\n}\n\nconst name = `${PKG_NAME}/Row`\n\n\n// Mark as native — compat-mode jsx() runtimes skip wrapCompatComponent so\n// Row's useContext(ContainerContext) read + provide(RowContext, ...) reach\n// Pyreon's setup frame.\n\n// ASSIGNMENT + /* @__PURE__ */ form (not a bare statement): inside a built\n// lib's shared chunk a bare `nativeCompat(X)` call is an unremovable side\n// effect that RETAINS the component body in every consumer bundle that\n// never imports it (see runtime-dom's native-compat-treeshake lock). The\n// PURE call is droppable exactly when the export is unused; when used it\n// returns the SAME fn with the marker applied.\n// Branding rides the PURE export expression — a bare top-level\n// `Component.x = y` assignment is an unremovable side effect that pins every\n// component in the package into every consumer bundle (measured on\n// @pyreon/elements: importing just <Portal> paid the whole 7.5KB gz; PR ref\n// in elements/src/Portal/component.tsx).\nexport default /* @__PURE__ */ nativeCompat(\n /* @__PURE__ */ Object.assign(Component, {\n displayName: name,\n pkgName: PKG_NAME,\n PYREON__COMPONENT: name,\n }),\n)","import component from './component'\n\nexport default component\n","/**\n * Default Bootstrap-like grid configuration. Provides 5 breakpoints (xs-xl),\n * a 12-column grid, and responsive container max-widths matching Bootstrap 4.\n */\nexport default {\n rootSize: 16,\n breakpoints: {\n xs: 0,\n sm: 576,\n md: 768,\n lg: 992,\n xl: 1200,\n },\n grid: {\n columns: 12,\n container: {\n xs: '100%',\n sm: 540,\n md: 720,\n lg: 960,\n xl: 1140,\n },\n },\n} as const\n\nexport const defaultBreakpoints: Record<string, number> = {\n xs: 0,\n sm: 576,\n md: 768,\n lg: 992,\n xl: 1200,\n}\n\nexport const defaultContainerWidths: Record<string, string | number> = {\n xs: '100%',\n sm: 540,\n md: 720,\n lg: 960,\n xl: 1140,\n}\n"],"mappings":";;;;;;AAAA,MAAa,WAAW;;;;;AAMxB,MAAa,eAAe;CAG1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;;;;;;;;ACXA,+BAAe,cAA2B,CAAC,CAAC;;;;;;;;;ACA5C,yBA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"@pyreon/native-compiler/plugin-api";
|
|
2
|
+
//#region src/native-plugin/plugin.d.ts
|
|
3
|
+
/** coolgrid tags this lowering claims. */
|
|
4
|
+
export declare const COOLGRID_TAGS: readonly ["Container", "Row", "Col"];
|
|
5
|
+
export declare function isCoolgridTag(name: string): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* `<Container>` → a vertical `<Stack>`; `<Row>` → a horizontal `<Stack>`. Grid-
|
|
8
|
+
* specific props (columns/gutter/size/contentAlignX) are stripped; `gap` (raw px)
|
|
9
|
+
* is converted to the Stack's scale index; padding/style pass through. (`<Col>`
|
|
10
|
+
* is emitted separately — it needs the equal-fill modifier.)
|
|
11
|
+
*/
|
|
12
|
+
export declare function coolgridToStack(e: JsxElementIR): JsxElementIR;
|
|
13
|
+
/** The default coolgrid column count. A `<Col size>` is a span out of this.
|
|
14
|
+
* v1 assumes the default — a custom `columns` on the Row is not threaded to
|
|
15
|
+
* its Cols (documented). */
|
|
16
|
+
export declare const DEFAULT_COLUMNS = 12;
|
|
17
|
+
/** True if `<Col size=…>` carries an explicit span (of any shape — literal,
|
|
18
|
+
* responsive object/array, or non-literal). */
|
|
19
|
+
export declare function colHasExplicitSize(e: JsxElementIR): boolean;
|
|
20
|
+
/** The `<Col size={n}>` LITERAL integer span (clamped to 1..DEFAULT_COLUMNS), or
|
|
21
|
+
* null when absent / non-literal / responsive (`{ xs, md }` / `[a,b]`). Only a
|
|
22
|
+
* plain literal integer gets a fractional width; every other shape falls back
|
|
23
|
+
* to an equal column (the caller warns on a present-but-non-literal size). */
|
|
24
|
+
export declare function colSizeLiteral(e: JsxElementIR): number | null;
|
|
25
|
+
/** The `<Col>` body as a plain `<Stack>` (its children, column direction) — the
|
|
26
|
+
* emit wraps THIS with the per-target equal-fill modifier.
|
|
27
|
+
*
|
|
28
|
+
* `dropTestId` moves the column's `data-testid` OUT of the inner stack so the
|
|
29
|
+
* caller can put it on the node that actually carries the WIDTH. Device-found:
|
|
30
|
+
* with the id on the inner stack, the tagged node hugs its glyph (a 3/12
|
|
31
|
+
* column measured 7.2dp of a 308dp row — 2.3%, not 25%), so the column's real
|
|
32
|
+
* geometry was unaddressable and therefore unassertable. Same class as the
|
|
33
|
+
* `<Link>` identifier drop: an element you cannot select is an element nobody
|
|
34
|
+
* can prove works. Swift never had the split — it puts
|
|
35
|
+
* `.accessibilityIdentifier` and `.containerRelativeFrame` on one node. */
|
|
36
|
+
export declare function colToStack(e: JsxElementIR, dropTestId?: boolean): JsxElementIR;
|
|
37
|
+
export declare const coolgridLowering: ElementLowering;
|
|
38
|
+
/** The `@pyreon/coolgrid` native plugin — discovered from the package manifest when a source imports it. */
|
|
39
|
+
export declare const coolgridPlugin: CompilerPlugin;
|
|
40
|
+
//#endregion
|
|
41
|
+
export { coolgridPlugin as default };
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
//#region src/native-plugin/plugin.ts
|
|
2
|
+
/** coolgrid tags this lowering claims. */
|
|
3
|
+
const COOLGRID_TAGS = [
|
|
4
|
+
"Container",
|
|
5
|
+
"Row",
|
|
6
|
+
"Col"
|
|
7
|
+
];
|
|
8
|
+
function isCoolgridTag(name) {
|
|
9
|
+
return COOLGRID_TAGS.includes(name);
|
|
10
|
+
}
|
|
11
|
+
const STRIP = /* @__PURE__ */ new Set([
|
|
12
|
+
"columns",
|
|
13
|
+
"gutter",
|
|
14
|
+
"size",
|
|
15
|
+
"contentAlignX"
|
|
16
|
+
]);
|
|
17
|
+
const PX_TO_SPACE_INDEX = {
|
|
18
|
+
0: 0,
|
|
19
|
+
4: 1,
|
|
20
|
+
8: 2,
|
|
21
|
+
12: 3,
|
|
22
|
+
16: 4,
|
|
23
|
+
20: 5,
|
|
24
|
+
24: 6,
|
|
25
|
+
32: 7,
|
|
26
|
+
40: 8,
|
|
27
|
+
48: 9
|
|
28
|
+
};
|
|
29
|
+
function directionAttr(value) {
|
|
30
|
+
return {
|
|
31
|
+
kind: "attr",
|
|
32
|
+
name: "direction",
|
|
33
|
+
value: {
|
|
34
|
+
kind: "literal",
|
|
35
|
+
value
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/** Translate a coolgrid `gap` attr (raw px) to the Stack `gap` (scale index).
|
|
40
|
+
* A non-scale px value (e.g. 10) has no index → dropped. */
|
|
41
|
+
function translateGap(a) {
|
|
42
|
+
const v = a.value;
|
|
43
|
+
if (v.kind !== "literal" || typeof v.value !== "number") return a;
|
|
44
|
+
const idx = PX_TO_SPACE_INDEX[v.value];
|
|
45
|
+
if (idx === void 0) return null;
|
|
46
|
+
return {
|
|
47
|
+
kind: "attr",
|
|
48
|
+
name: "gap",
|
|
49
|
+
value: {
|
|
50
|
+
kind: "literal",
|
|
51
|
+
value: idx
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* `<Container>` → a vertical `<Stack>`; `<Row>` → a horizontal `<Stack>`. Grid-
|
|
57
|
+
* specific props (columns/gutter/size/contentAlignX) are stripped; `gap` (raw px)
|
|
58
|
+
* is converted to the Stack's scale index; padding/style pass through. (`<Col>`
|
|
59
|
+
* is emitted separately — it needs the equal-fill modifier.)
|
|
60
|
+
*/
|
|
61
|
+
function coolgridToStack(e) {
|
|
62
|
+
const dir = e.tag === "Row" ? "row" : "column";
|
|
63
|
+
const attrs = [];
|
|
64
|
+
for (const a of e.attrs) {
|
|
65
|
+
if (a.kind === "attr" && STRIP.has(a.name)) continue;
|
|
66
|
+
if (a.kind === "attr" && a.name === "gap") {
|
|
67
|
+
const translated = translateGap(a);
|
|
68
|
+
if (translated) attrs.push(translated);
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
attrs.push(a);
|
|
72
|
+
}
|
|
73
|
+
attrs.push(directionAttr(dir));
|
|
74
|
+
return {
|
|
75
|
+
...e,
|
|
76
|
+
tag: "Stack",
|
|
77
|
+
attrs
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
/** The default coolgrid column count. A `<Col size>` is a span out of this.
|
|
81
|
+
* v1 assumes the default — a custom `columns` on the Row is not threaded to
|
|
82
|
+
* its Cols (documented). */
|
|
83
|
+
const DEFAULT_COLUMNS = 12;
|
|
84
|
+
/** True if `<Col size=…>` carries an explicit span (of any shape — literal,
|
|
85
|
+
* responsive object/array, or non-literal). */
|
|
86
|
+
function colHasExplicitSize(e) {
|
|
87
|
+
return e.attrs.some((a) => a.kind === "attr" && a.name === "size");
|
|
88
|
+
}
|
|
89
|
+
/** The `<Col size={n}>` LITERAL integer span (clamped to 1..DEFAULT_COLUMNS), or
|
|
90
|
+
* null when absent / non-literal / responsive (`{ xs, md }` / `[a,b]`). Only a
|
|
91
|
+
* plain literal integer gets a fractional width; every other shape falls back
|
|
92
|
+
* to an equal column (the caller warns on a present-but-non-literal size). */
|
|
93
|
+
function colSizeLiteral(e) {
|
|
94
|
+
const a = e.attrs.find((x) => x.kind === "attr" && x.name === "size");
|
|
95
|
+
if (!a || a.kind !== "attr") return null;
|
|
96
|
+
const v = a.value;
|
|
97
|
+
if (v.kind !== "literal" || typeof v.value !== "number" || !Number.isInteger(v.value) || v.value <= 0) return null;
|
|
98
|
+
return Math.min(v.value, 12);
|
|
99
|
+
}
|
|
100
|
+
/** The `<Col>` body as a plain `<Stack>` (its children, column direction) — the
|
|
101
|
+
* emit wraps THIS with the per-target equal-fill modifier.
|
|
102
|
+
*
|
|
103
|
+
* `dropTestId` moves the column's `data-testid` OUT of the inner stack so the
|
|
104
|
+
* caller can put it on the node that actually carries the WIDTH. Device-found:
|
|
105
|
+
* with the id on the inner stack, the tagged node hugs its glyph (a 3/12
|
|
106
|
+
* column measured 7.2dp of a 308dp row — 2.3%, not 25%), so the column's real
|
|
107
|
+
* geometry was unaddressable and therefore unassertable. Same class as the
|
|
108
|
+
* `<Link>` identifier drop: an element you cannot select is an element nobody
|
|
109
|
+
* can prove works. Swift never had the split — it puts
|
|
110
|
+
* `.accessibilityIdentifier` and `.containerRelativeFrame` on one node. */
|
|
111
|
+
function colToStack(e, dropTestId = false) {
|
|
112
|
+
const attrs = e.attrs.filter((a) => !(a.kind === "attr" && (STRIP.has(a.name) || dropTestId && a.name === "data-testid")));
|
|
113
|
+
attrs.push(directionAttr("column"));
|
|
114
|
+
return {
|
|
115
|
+
...e,
|
|
116
|
+
tag: "Stack",
|
|
117
|
+
attrs
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
function warnNonLiteralSize(e, ctx) {
|
|
121
|
+
if (colHasExplicitSize(e)) ctx.warn("<Col size=…>: only a LITERAL integer span lowers to a fractional width; a responsive ({ xs, md } / [a,b]) or non-literal size lowers as an EQUAL column.");
|
|
122
|
+
}
|
|
123
|
+
function emitSwiftCol(e, ctx) {
|
|
124
|
+
const body = ctx.emit(colToStack(e));
|
|
125
|
+
const size = colSizeLiteral(e);
|
|
126
|
+
if (size !== null) return `${body}.containerRelativeFrame(.horizontal, count: ${12}, span: ${size}, spacing: 0)`;
|
|
127
|
+
warnNonLiteralSize(e, ctx);
|
|
128
|
+
return `${body}.frame(maxWidth: .infinity)`;
|
|
129
|
+
}
|
|
130
|
+
function emitKotlinCol(e, ctx) {
|
|
131
|
+
const p = ctx.pad();
|
|
132
|
+
const colTestId = ctx.staticAttr(e, "data-testid");
|
|
133
|
+
const idMod = typeof colTestId === "string" ? `.testTag(${ctx.stringLiteral(colTestId)})` : "";
|
|
134
|
+
const inner = `${ctx.pad(ctx.indent + 2)}${ctx.emit(colToStack(e, true), ctx.indent + 2)}`;
|
|
135
|
+
const size = colSizeLiteral(e);
|
|
136
|
+
if (size !== null) return `Box(modifier = Modifier.weight(${size}f)${idMod}) {\n${inner}\n${p}}`;
|
|
137
|
+
warnNonLiteralSize(e, ctx);
|
|
138
|
+
return `Box(modifier = Modifier.weight(1f)${idMod}) {\n${inner}\n${p}}`;
|
|
139
|
+
}
|
|
140
|
+
const coolgridLowering = Object.freeze({
|
|
141
|
+
module: "@pyreon/coolgrid",
|
|
142
|
+
tags: COOLGRID_TAGS,
|
|
143
|
+
retag: (e) => e.tag === "Col" ? void 0 : coolgridToStack(e),
|
|
144
|
+
emit: Object.freeze({
|
|
145
|
+
swift: emitSwiftCol,
|
|
146
|
+
kotlin: emitKotlinCol
|
|
147
|
+
})
|
|
148
|
+
});
|
|
149
|
+
/** The `@pyreon/coolgrid` native plugin — discovered from the package manifest when a source imports it. */
|
|
150
|
+
const coolgridPlugin = Object.freeze({
|
|
151
|
+
name: coolgridLowering.module,
|
|
152
|
+
apiVersion: 2,
|
|
153
|
+
elements: Object.freeze([coolgridLowering])
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
//#endregion
|
|
157
|
+
export { COOLGRID_TAGS, DEFAULT_COLUMNS, colHasExplicitSize, colSizeLiteral, colToStack, coolgridLowering, coolgridPlugin, coolgridPlugin as default, coolgridToStack, isCoolgridTag };
|
|
158
|
+
//# sourceMappingURL=native-plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native-plugin.js","names":[],"sources":["../src/native-plugin/plugin.ts"],"sourcesContent":["// ============================================================================\n// `@pyreon/coolgrid` native FRONTEND — the 12-column responsive grid onto native\n// layout. `<Container>` / `<Row>` / `<Col>` are a Bootstrap-style flex grid:\n// Container (flex-direction: column) → a vertical Stack\n// Row (flex-direction: row) → a horizontal Stack\n// Col (width = size/columns) → a fractional (or equal-fill) child\n//\n// Container/Row are exactly the canonical Stack in a different vocabulary, so\n// they retag to `<Stack>` and the existing emit lowers them. Col is emitted\n// specially:\n// - `<Col size={8}>` (a LITERAL integer span) → a FRACTIONAL width of a\n// 12-column grid: SwiftUI `.containerRelativeFrame(.horizontal, count: 12,\n// span: 8, spacing: 0)` (iOS 17 native grid-column primitive), Compose\n// `Modifier.fillMaxWidth(8f / 12f)`. Both give the same size/12 absolute\n// fraction, so a partial row (cols summing < 12) leaves the rest empty —\n// faithful to coolgrid.\n// - `<Col>` with no size → an EQUAL-fill child (SwiftUI `.frame(maxWidth:\n// .infinity)`, Compose `Modifier.weight(1f)`), valid because a Col always\n// sits inside a Row = a horizontal Stack.\n//\n// SCOPE (v1) + honest caveats: only a LITERAL integer `size` is fractional; a\n// responsive `size` ({ xs, md } / [a,b,c]) or non-literal collapses to equal +\n// warns. The grid is assumed 12-column — a custom `columns` on the Row is not\n// threaded to its Cols. SwiftUI's `containerRelativeFrame` is relative to the\n// nearest CONTAINER (≈ the Row when the Container is full-width, the coolgrid\n// norm; a deeply-nested narrow row is approximate); the gutter is not subtracted\n// from the fractional width (cols summing to exactly 12 + a large gap can\n// slightly overflow on a very narrow screen). Compose `fillMaxWidth` is exact +\n// parent-relative.\n// ============================================================================\n\nimport {\n type AttrIR,\n type CompilerPlugin,\n type ElementLowering,\n type EmitContext,\n type JsxElementIR,\n} from '@pyreon/native-compiler/plugin-api'\n\n/** coolgrid tags this lowering claims. */\nexport const COOLGRID_TAGS = ['Container', 'Row', 'Col'] as const\n\nexport function isCoolgridTag(name: string): boolean {\n return (COOLGRID_TAGS as readonly string[]).includes(name)\n}\n\n// coolgrid props with no canonical-Stack equivalent (grid math) — stripped.\nconst STRIP = new Set(['columns', 'gutter', 'size', 'contentAlignX'])\n\n// coolgrid `gap` is a RAW PIXEL number; the canonical Stack's `gap` is a SCALE\n// INDEX (0→0, 1→4, …, 9→48px). This reverse map converts a raw-px gap to the\n// matching Stack index so `gap={16}` → 16px (index 4), not \"index 16\" (= 0).\nconst PX_TO_SPACE_INDEX: Record<number, number> = {\n 0: 0, 4: 1, 8: 2, 12: 3, 16: 4, 20: 5, 24: 6, 32: 7, 40: 8, 48: 9,\n}\n\nfunction directionAttr(value: string): AttrIR {\n return { kind: 'attr', name: 'direction', value: { kind: 'literal', value } }\n}\n\n/** Translate a coolgrid `gap` attr (raw px) to the Stack `gap` (scale index).\n * A non-scale px value (e.g. 10) has no index → dropped. */\nfunction translateGap(a: Extract<AttrIR, { kind: 'attr' }>): AttrIR | null {\n const v = a.value\n if (v.kind !== 'literal' || typeof v.value !== 'number') return a // token/non-literal → pass through\n const idx = PX_TO_SPACE_INDEX[v.value]\n if (idx === undefined) return null // off-scale px → drop\n return { kind: 'attr', name: 'gap', value: { kind: 'literal', value: idx } }\n}\n\n/**\n * `<Container>` → a vertical `<Stack>`; `<Row>` → a horizontal `<Stack>`. Grid-\n * specific props (columns/gutter/size/contentAlignX) are stripped; `gap` (raw px)\n * is converted to the Stack's scale index; padding/style pass through. (`<Col>`\n * is emitted separately — it needs the equal-fill modifier.)\n */\nexport function coolgridToStack(e: JsxElementIR): JsxElementIR {\n const dir = e.tag === 'Row' ? 'row' : 'column'\n const attrs: AttrIR[] = []\n for (const a of e.attrs) {\n if (a.kind === 'attr' && STRIP.has(a.name)) continue\n if (a.kind === 'attr' && a.name === 'gap') {\n const translated = translateGap(a)\n if (translated) attrs.push(translated)\n continue\n }\n attrs.push(a)\n }\n attrs.push(directionAttr(dir))\n return { ...e, tag: 'Stack', attrs }\n}\n\n/** The default coolgrid column count. A `<Col size>` is a span out of this.\n * v1 assumes the default — a custom `columns` on the Row is not threaded to\n * its Cols (documented). */\nexport const DEFAULT_COLUMNS = 12\n\n/** True if `<Col size=…>` carries an explicit span (of any shape — literal,\n * responsive object/array, or non-literal). */\nexport function colHasExplicitSize(e: JsxElementIR): boolean {\n return e.attrs.some((a) => a.kind === 'attr' && a.name === 'size')\n}\n\n/** The `<Col size={n}>` LITERAL integer span (clamped to 1..DEFAULT_COLUMNS), or\n * null when absent / non-literal / responsive (`{ xs, md }` / `[a,b]`). Only a\n * plain literal integer gets a fractional width; every other shape falls back\n * to an equal column (the caller warns on a present-but-non-literal size). */\nexport function colSizeLiteral(e: JsxElementIR): number | null {\n const a = e.attrs.find((x) => x.kind === 'attr' && x.name === 'size')\n if (!a || a.kind !== 'attr') return null\n const v = a.value\n if (v.kind !== 'literal' || typeof v.value !== 'number' || !Number.isInteger(v.value) || v.value <= 0) {\n return null\n }\n return Math.min(v.value, DEFAULT_COLUMNS)\n}\n\n/** The `<Col>` body as a plain `<Stack>` (its children, column direction) — the\n * emit wraps THIS with the per-target equal-fill modifier.\n *\n * `dropTestId` moves the column's `data-testid` OUT of the inner stack so the\n * caller can put it on the node that actually carries the WIDTH. Device-found:\n * with the id on the inner stack, the tagged node hugs its glyph (a 3/12\n * column measured 7.2dp of a 308dp row — 2.3%, not 25%), so the column's real\n * geometry was unaddressable and therefore unassertable. Same class as the\n * `<Link>` identifier drop: an element you cannot select is an element nobody\n * can prove works. Swift never had the split — it puts\n * `.accessibilityIdentifier` and `.containerRelativeFrame` on one node. */\nexport function colToStack(e: JsxElementIR, dropTestId = false): JsxElementIR {\n const attrs = e.attrs.filter(\n (a) => !(a.kind === 'attr' && (STRIP.has(a.name) || (dropTestId && a.name === 'data-testid'))),\n )\n attrs.push(directionAttr('column'))\n return { ...e, tag: 'Stack', attrs }\n}\n\nfunction warnNonLiteralSize(e: JsxElementIR, ctx: EmitContext): void {\n if (colHasExplicitSize(e)) {\n // A responsive / non-literal `size` can't resolve to a static span → equal.\n ctx.warn(\n `<Col size=…>: only a LITERAL integer span lowers to a fractional width; ` +\n `a responsive ({ xs, md } / [a,b]) or non-literal size lowers as an EQUAL column.`,\n )\n }\n}\n\nfunction emitSwiftCol(e: JsxElementIR, ctx: EmitContext): string {\n const body = ctx.emit(colToStack(e))\n const size = colSizeLiteral(e)\n if (size !== null) {\n // Fractional span of a 12-column grid — iOS 17's native grid-column\n // primitive (relative to the nearest container; greediness-free, unlike a\n // GeometryReader). A partial row (cols summing < 12) leaves the rest empty.\n return `${body}.containerRelativeFrame(.horizontal, count: ${DEFAULT_COLUMNS}, span: ${size}, spacing: 0)`\n }\n warnNonLiteralSize(e, ctx)\n return `${body}.frame(maxWidth: .infinity)`\n}\n\nfunction emitKotlinCol(e: JsxElementIR, ctx: EmitContext): string {\n const p = ctx.pad()\n // The test id rides the SIZED node (the Box), not the inner stack — see\n // colToStack's `dropTestId`. The id is emitted here as part of the Box's\n // modifier chain so exactly one node carries it.\n const colTestId = ctx.staticAttr(e, 'data-testid')\n const idMod = typeof colTestId === 'string' ? `.testTag(${ctx.stringLiteral(colTestId)})` : ''\n const inner = `${ctx.pad(ctx.indent + 2)}${ctx.emit(colToStack(e, true), ctx.indent + 2)}`\n const size = colSizeLiteral(e)\n if (size !== null) {\n // A 12-column span lowers to RowScope `weight`, NOT `fillMaxWidth(n/12)`.\n // Device-found: a Row measures each child against the REMAINING width, so\n // fractional fills compound — 3/12 then 9/12 yields 25% + 56%, and the row\n // never adds up. `weight(3f)` + `weight(9f)` divides the row exactly, which\n // is what a grid means and what the Swift twin's\n // `containerRelativeFrame(count:span:)` already did.\n return `Box(modifier = Modifier.weight(${size}f)${idMod}) {\\n${inner}\\n${p}}`\n }\n warnNonLiteralSize(e, ctx)\n return `Box(modifier = Modifier.weight(1f)${idMod}) {\\n${inner}\\n${p}}`\n}\n\nexport const coolgridLowering: ElementLowering = Object.freeze({\n module: '@pyreon/coolgrid',\n tags: COOLGRID_TAGS,\n retag: (e: JsxElementIR) => (e.tag === 'Col' ? undefined : coolgridToStack(e)),\n emit: Object.freeze({ swift: emitSwiftCol, kotlin: emitKotlinCol }),\n})\n\n/** The `@pyreon/coolgrid` native plugin — discovered from the package manifest when a source imports it. */\nexport const coolgridPlugin: CompilerPlugin = Object.freeze({\n name: coolgridLowering.module,\n apiVersion: 2,\n elements: Object.freeze([coolgridLowering]),\n})\n"],"mappings":";;AAwCA,MAAa,gBAAgB;CAAC;CAAa;CAAO;AAAK;AAEvD,SAAgB,cAAc,MAAuB;CACnD,OAAQ,cAAoC,SAAS,IAAI;AAC3D;AAGA,MAAM,wBAAQ,IAAI,IAAI;CAAC;CAAW;CAAU;CAAQ;AAAe,CAAC;AAKpE,MAAM,oBAA4C;CAChD,GAAG;CAAG,GAAG;CAAG,GAAG;CAAG,IAAI;CAAG,IAAI;CAAG,IAAI;CAAG,IAAI;CAAG,IAAI;CAAG,IAAI;CAAG,IAAI;AAClE;AAEA,SAAS,cAAc,OAAuB;CAC5C,OAAO;EAAE,MAAM;EAAQ,MAAM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AAO,OAAO;EAAE,OAAO;EAAc,QAAQ;CAAc,CAAC;AACpE,CAAC;;AAGD,MAAa,iBAAiC,OAAO,OAAO;CAC1D,MAAM,iBAAiB;CACvB,YAAY;CACZ,UAAU,OAAO,OAAO,CAAC,gBAAgB,CAAC;AAC5C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pyreon/coolgrid",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.53.0",
|
|
4
4
|
"description": "Responsive grid system for Pyreon",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/pyreon/pyreon/tree/main/packages/ui-system/coolgrid#readme",
|
|
@@ -20,6 +20,10 @@
|
|
|
20
20
|
".": {
|
|
21
21
|
"import": "./lib/index.js",
|
|
22
22
|
"types": "./lib/index.d.ts"
|
|
23
|
+
},
|
|
24
|
+
"./native-plugin": {
|
|
25
|
+
"import": "./lib/native-plugin.js",
|
|
26
|
+
"types": "./lib/native-plugin.d.ts"
|
|
23
27
|
}
|
|
24
28
|
},
|
|
25
29
|
"files": [
|
|
@@ -40,27 +44,42 @@
|
|
|
40
44
|
"typecheck": "tsc --noEmit"
|
|
41
45
|
},
|
|
42
46
|
"peerDependencies": {
|
|
43
|
-
"@pyreon/core": "^0.
|
|
44
|
-
"@pyreon/reactivity": "^0.
|
|
47
|
+
"@pyreon/core": "^0.53.0",
|
|
48
|
+
"@pyreon/reactivity": "^0.53.0",
|
|
49
|
+
"@pyreon/native-compiler": "^0.53.0"
|
|
45
50
|
},
|
|
46
51
|
"dependencies": {
|
|
47
|
-
"@pyreon/ui-core": "^0.
|
|
48
|
-
"@pyreon/unistyle": "^0.
|
|
52
|
+
"@pyreon/ui-core": "^0.53.0",
|
|
53
|
+
"@pyreon/unistyle": "^0.53.0"
|
|
49
54
|
},
|
|
50
55
|
"devDependencies": {
|
|
51
56
|
"@pyreon/manifest": "0.50.0",
|
|
52
|
-
"@pyreon/
|
|
53
|
-
"@pyreon/
|
|
54
|
-
"@pyreon/
|
|
55
|
-
"@pyreon/
|
|
57
|
+
"@pyreon/native-compiler": "0.53.0",
|
|
58
|
+
"@pyreon/styler": "^0.53.0",
|
|
59
|
+
"@pyreon/test-utils": "^0.50.3",
|
|
60
|
+
"@pyreon/tsconfig": "0.50.3",
|
|
61
|
+
"@pyreon/typescript": "^0.53.0",
|
|
56
62
|
"@pyreon/vitest-config": "0.50.0",
|
|
57
|
-
"@vitest/browser-playwright": "^
|
|
58
|
-
"@vitus-labs/tools-rolldown": "^2.
|
|
63
|
+
"@vitest/browser-playwright": "^5.0.2",
|
|
64
|
+
"@vitus-labs/tools-rolldown": "^2.6.3"
|
|
59
65
|
},
|
|
60
66
|
"engines": {
|
|
61
67
|
"node": ">= 22"
|
|
62
68
|
},
|
|
63
69
|
"publishConfig": {
|
|
64
70
|
"access": "public"
|
|
71
|
+
},
|
|
72
|
+
"peerDependenciesMeta": {
|
|
73
|
+
"@pyreon/native-compiler": {
|
|
74
|
+
"optional": true
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"pyreon": {
|
|
78
|
+
"native": {
|
|
79
|
+
"plugin": "./lib/native-plugin.js",
|
|
80
|
+
"modules": [
|
|
81
|
+
"@pyreon/coolgrid"
|
|
82
|
+
]
|
|
83
|
+
}
|
|
65
84
|
}
|
|
66
85
|
}
|