@multiplatform.one/theme 7.2.2 → 7.4.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/package.json +5 -5
- package/src/theme/Surface.spec.tsx +1 -1
- package/src/theme/createDefaultThemeConfig.spec.ts +5 -5
- package/src/theme/index.ts +1 -0
- package/src/theme/layoutTokens.spec.ts +3 -2
- package/src/theme/layoutTokens.ts +22 -10
- package/src/theme/mpo13Proof.spec.ts +149 -0
- package/src/theme/recipeInputs.ts +70 -30
- package/src/theme/resolveKnobs.spec.ts +5 -5
- package/src/theme/sizeRecipes.spec.ts +44 -42
- package/src/theme/sizeRecipes.ts +19 -5
- package/src/theme/tileSizes.spec.ts +139 -0
- package/src/theme/tileSizes.ts +291 -0
- package/types/theme/index.d.ts +1 -0
- package/types/theme/index.d.ts.map +1 -1
- package/types/theme/layoutTokens.d.ts +22 -10
- package/types/theme/layoutTokens.d.ts.map +1 -1
- package/types/theme/recipeInputs.d.ts +14 -4
- package/types/theme/recipeInputs.d.ts.map +1 -1
- package/types/theme/sizeRecipes.d.ts +9 -1
- package/types/theme/sizeRecipes.d.ts.map +1 -1
- package/types/theme/tileSizes.d.ts +139 -0
- package/types/theme/tileSizes.d.ts.map +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sizeRecipes.d.ts","sourceRoot":"","sources":["../../src/theme/sizeRecipes.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"sizeRecipes.d.ts","sourceRoot":"","sources":["../../src/theme/sizeRecipes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EACL,0BAA0B,EAC1B,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,wBAAwB,EACxB,mBAAmB,EACnB,iBAAiB,EACjB,uBAAuB,GACxB,M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AAM,GAAE,YAAY,CAAC,QAAQ,CAAyB,GACrD,UAAU,CAEZ;AAOD,wBAAgB,eAAe,CAC7B,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,OAAO,EACd,MAAM,CAAC,EAAE,gBAAgB,GAAG,gBAAgB,GAC3C,UAAU,CAQZ;AAED,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,gBAAgB,GAAG,gBAAgB,CAAA;CAAE,GAC1E,UAAU,CAKZ;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAE/C"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tile-size ladder + media-aspect vocabulary (MPO-31, design-system/12 D.3
|
|
3
|
+
* holes H1/H2).
|
|
4
|
+
*
|
|
5
|
+
* Every tile wall needs the same two decisions: HOW BIG is a tile (a small
|
|
6
|
+
* named ladder a person can pick from — the user-facing S/M/L/XL control)
|
|
7
|
+
* and WHAT SHAPE is its media (so the loading skeleton is the same shape as
|
|
8
|
+
* the image that replaces it). Before this module both were app-invented:
|
|
9
|
+
* the console's `launcherGeometry.ts` (03-our-surfaces.md DL-9) and
|
|
10
|
+
* Lookout's private `TILE_SIZES` were the same gap twice.
|
|
11
|
+
*
|
|
12
|
+
* Like the control-size recipes (LC-70 RECIPE-INPUTS), STORED INPUTS are the
|
|
13
|
+
* source of truth and the ladder table is DERIVED — never handwritten at a
|
|
14
|
+
* call site. The default rung values are the MEASURED ladders from the two
|
|
15
|
+
* real consumers, not invented numbers:
|
|
16
|
+
*
|
|
17
|
+
* | rung | minWidth | maxWidth | measured from |
|
|
18
|
+
* |------|----------|----------|------------------------------------------------|
|
|
19
|
+
* | xs | 104 | 143 | launcher icon-plate track `minmax(104px,1fr)` |
|
|
20
|
+
* | sm | 220 | 300 | Lookout `TILE_SIZES.s` / SPA `TILE_MIN.s` |
|
|
21
|
+
* | md | 320 | 440 | Lookout `TILE_SIZES.m` / SPA `TILE_MIN.m` |
|
|
22
|
+
* | lg | 480 | 720 | Lookout `TILE_SIZES.l` / SPA `TILE_MIN.l` |
|
|
23
|
+
* | xl | 720 | 1400 | Lookout `TILE_SIZES.xl` / SPA `TILE_MIN.xl` |
|
|
24
|
+
*
|
|
25
|
+
* `{ baseWidth: 280 }` (no rungWidths / widthFactors) regenerates the whole
|
|
26
|
+
* ladder geometrically from `baseWidth * stepRatio ** step`, the same
|
|
27
|
+
* override contract `resolveSizeRecipeInputs` gives `baseHeight`.
|
|
28
|
+
*
|
|
29
|
+
* OWNERSHIP (12-one-design.md Part B): the RUNGS are universal — generated
|
|
30
|
+
* here, restyled only through recipe inputs
|
|
31
|
+
* (`setSizeRecipeInputs({ tile })` / `createDefaultThemeConfig({ recipeInputs:
|
|
32
|
+
* { tile } })`). WHICH rung a surface shows is per-app (a prop, often
|
|
33
|
+
* persisted per user). Tile gutters stay on the space knob and tile rounding
|
|
34
|
+
* on the borderRadius knob — this module never emits a gap or a radius.
|
|
35
|
+
*
|
|
36
|
+
* DENSITY (LC-76): density moves SPACE only. A compact density steps the
|
|
37
|
+
* gutters between tiles (via the space knob) and must never re-rung the
|
|
38
|
+
* ladder — tile magnitude is content scale, not chrome scale, so nothing
|
|
39
|
+
* here reads the density knob.
|
|
40
|
+
*/
|
|
41
|
+
export declare const tileSizeRungs: readonly ["xs", "sm", "md", "lg", "xl"];
|
|
42
|
+
export type TileSizeRung = (typeof tileSizeRungs)[number];
|
|
43
|
+
/** One rung: the narrowest a tile may render, and the widest. */
|
|
44
|
+
export type TileSizeStop = {
|
|
45
|
+
minWidth: number;
|
|
46
|
+
maxWidth: number;
|
|
47
|
+
};
|
|
48
|
+
export type TileSizeLadder = Record<TileSizeRung, TileSizeStop>;
|
|
49
|
+
export type TileSizeInputs = {
|
|
50
|
+
/** Desktop px min-width of the `md` rung. */
|
|
51
|
+
baseWidth: number;
|
|
52
|
+
/** Rung-to-rung ratio when regenerating geometrically. */
|
|
53
|
+
stepRatio: number;
|
|
54
|
+
/** Exponent of each rung relative to `md` (0). */
|
|
55
|
+
rungSteps: Record<TileSizeRung, number>;
|
|
56
|
+
/**
|
|
57
|
+
* Absolute desktop px min-widths. When omitted, min-widths come from
|
|
58
|
+
* `baseWidth * stepRatio ** step` (or `widthFactors`).
|
|
59
|
+
*/
|
|
60
|
+
rungWidths?: Partial<Record<TileSizeRung, number>>;
|
|
61
|
+
/**
|
|
62
|
+
* Optional per-rung scale relative to `baseWidth`. Used only when
|
|
63
|
+
* `rungWidths` is omitted. Factors are `stepRatio ** exponent` otherwise.
|
|
64
|
+
*/
|
|
65
|
+
widthFactors?: Partial<Record<TileSizeRung, number>>;
|
|
66
|
+
/** maxWidth = minWidth * maxRatio for any rung `rungMaxWidths` does not pin. */
|
|
67
|
+
maxRatio: number;
|
|
68
|
+
/** Absolute desktop px max-widths (measured pins win over `maxRatio`). */
|
|
69
|
+
rungMaxWidths?: Partial<Record<TileSizeRung, number>>;
|
|
70
|
+
};
|
|
71
|
+
export declare const tileSizeStepExponents: Record<TileSizeRung, number>;
|
|
72
|
+
/** Lossless relative table: the measured 104/220/320/480/720 ramp at baseWidth 320. */
|
|
73
|
+
export declare const defaultWidthFactors: Record<TileSizeRung, number>;
|
|
74
|
+
export declare const defaultTileSizeInputs: TileSizeInputs;
|
|
75
|
+
/**
|
|
76
|
+
* Deep copy that PRESERVES partiality: keys the caller never set stay
|
|
77
|
+
* unset, so a later `resolveTileSizeInputs` still sees them as defaults
|
|
78
|
+
* rather than explicit undefineds.
|
|
79
|
+
*/
|
|
80
|
+
export declare function cloneTileSizeInputs<T extends Partial<TileSizeInputs>>(inputs: T): T;
|
|
81
|
+
/**
|
|
82
|
+
* Fill defaults. `{ baseWidth: 280 }` (any scaling override without explicit
|
|
83
|
+
* tables) drops the measured rungWidths/widthFactors/rungMaxWidths so every
|
|
84
|
+
* rung regenerates from `stepRatio` — the `resolveSizeRecipeInputs` contract.
|
|
85
|
+
*/
|
|
86
|
+
export declare function resolveTileSizeInputs(partial?: Partial<TileSizeInputs>): TileSizeInputs;
|
|
87
|
+
/** Derive the full ladder from resolved inputs. Tables are generated, never handwritten. */
|
|
88
|
+
export declare function generateTileSizeLadder(inputs: TileSizeInputs): TileSizeLadder;
|
|
89
|
+
export type TileRungFlexProps = {
|
|
90
|
+
flexGrow: number;
|
|
91
|
+
flexBasis: number;
|
|
92
|
+
minWidth: number;
|
|
93
|
+
maxWidth: number;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Style fragment for a tile in a wrapping flex wall (the Lookout idiom:
|
|
97
|
+
* tiles grow from `minWidth` and stop at `maxWidth`). Spread it on the tile
|
|
98
|
+
* surface; gutters stay on the container's space-knob gap.
|
|
99
|
+
*/
|
|
100
|
+
export declare function tileRungFlexProps(stop: TileSizeStop): TileRungFlexProps;
|
|
101
|
+
/**
|
|
102
|
+
* Column count for a fixed-column tile grid (the ImageGrid / springboard
|
|
103
|
+
* idiom): as many columns as fit at the rung's minWidth. `gutter` is the
|
|
104
|
+
* inter-column gap (the space knob's value), never baked into the rung.
|
|
105
|
+
*
|
|
106
|
+
* The count is min-driven on purpose: adding a column to honor `maxWidth`
|
|
107
|
+
* would, by construction of the fit, drop every cell below `minWidth`
|
|
108
|
+
* (`(fit+1)` cells at minWidth already overflow the width). `maxWidth`
|
|
109
|
+
* binds in the wrapping-flex idiom (`tileRungFlexProps`), where a tile can
|
|
110
|
+
* stop growing without forcing a new column.
|
|
111
|
+
*
|
|
112
|
+
* At the springboard's own numbers this reproduces the launcher's split:
|
|
113
|
+
* `xs` (104) with the 8px launcher gutter yields 6 columns at the 700px
|
|
114
|
+
* wide-breakpoint and 4 in the phone band.
|
|
115
|
+
*/
|
|
116
|
+
export declare function tileColumnsForWidth(width: number, stop: TileSizeStop, gutter?: number): number;
|
|
117
|
+
/**
|
|
118
|
+
* Named media aspect ratios (width / height). A skeleton twin drawn at the
|
|
119
|
+
* wrong aspect produces the exact layout jump it exists to prevent
|
|
120
|
+
* (ImageGrid hardcoded 1; Lookout frames are 16:10).
|
|
121
|
+
*/
|
|
122
|
+
export declare const mediaAspectRatios: {
|
|
123
|
+
/** Album art, avatars, icon plates. */
|
|
124
|
+
readonly square: 1;
|
|
125
|
+
/** Stills cameras, 4:3. */
|
|
126
|
+
readonly photo: number;
|
|
127
|
+
/** Desktop screen captures, 16:10 — the Lookout frame shape. */
|
|
128
|
+
readonly screen: number;
|
|
129
|
+
/** Video stills, 16:9. */
|
|
130
|
+
readonly video: number;
|
|
131
|
+
/** Portrait media, 3:4. */
|
|
132
|
+
readonly portrait: number;
|
|
133
|
+
};
|
|
134
|
+
export type MediaAspectName = keyof typeof mediaAspectRatios;
|
|
135
|
+
/** A named aspect or an explicit width/height number. */
|
|
136
|
+
export type MediaAspect = MediaAspectName | number;
|
|
137
|
+
/** Resolve a name or number to a positive width/height ratio (default `square`). */
|
|
138
|
+
export declare function resolveMediaAspect(aspect?: MediaAspect | null): number;
|
|
139
|
+
//# sourceMappingURL=tileSizes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tileSizes.d.ts","sourceRoot":"","sources":["../../src/theme/tileSizes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAIH,eAAO,MAAM,aAAa,yCAA0C,CAAC;AAErE,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1D,iEAAiE;AACjE,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;AAIhE,MAAM,MAAM,cAAc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