@krapwoo/ds-viewer 0.6.1 → 0.6.2

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.
@@ -58,6 +58,9 @@ function toSectionDef(page) {
58
58
  fullWidthLabel: page.fullWidthLabel,
59
59
  specimenSize: page.specimenSize,
60
60
  previewWidths: page.previewWidths,
61
+ // Carried because `blockMinWidth` reads it: the two preview cards have different chrome, so
62
+ // without it `explain` prices a 'table' preview as a frames card.
63
+ previewLayout: page.previewLayout,
61
64
  variants: page.variantsItems ? { itemsFill: page.variantsItemsFill, maxColumns: page.variantsMaxColumns, items: page.variantsItems.map(placeholderItem) } : undefined,
62
65
  states: page.statesItems ? { itemsFill: page.statesItemsFill, maxColumns: page.statesMaxColumns, items: page.statesItems.map(placeholderItem) } : undefined,
63
66
  comparison,
@@ -120,6 +120,19 @@ function readStaticPage(file) {
120
120
  // Anything else (a function call, a non-literal expression) is simply left unset — `previewWidths`
121
121
  // isn't in design §4's literal-checkable list, so it's never a reason to flip `checkable`.
122
122
  }
123
+ const previewLayoutProp = findProp(pageObject, 'previewLayout');
124
+ if (previewLayoutProp) {
125
+ // Unlike `previewWidths`, an unread value here is not harmless: the two card shapes have
126
+ // different chrome, so a missed 'table' would make `explain` price the preview 16px wider
127
+ // than the viewer does.
128
+ const resolved = resolve(previewLayoutProp.initializer, consts, new Set());
129
+ if (ts.isStringLiteral(resolved) && (resolved.text === 'frames' || resolved.text === 'table')) {
130
+ page.previewLayout = resolved.text;
131
+ }
132
+ else {
133
+ page.checkable = false;
134
+ }
135
+ }
123
136
  const fullWidthLabelProp = findProp(pageObject, 'fullWidthLabel');
124
137
  if (fullWidthLabelProp)
125
138
  page.fullWidthLabel = stringLiteral(resolve(fullWidthLabelProp.initializer, consts, new Set()));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krapwoo/ds-viewer",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "description": "A browsable, always-current catalog for an Expo / React Native design system.",