File tree Expand file tree Collapse file tree 4 files changed +25
-39
lines changed Expand file tree Collapse file tree 4 files changed +25
-39
lines changed Original file line number Diff line number Diff line change 1+ const fs = require ( 'fs' ) ;
12const path = require ( 'path' ) ;
23
3- const { tokenList} = require ( './build/cjs/token-list' ) ;
4+ const tokenGroupsDir = path . join ( __dirname , './src/tokens/token-groups' ) ;
5+
6+ /**
7+ * Allowed Polaris token custom properties.
8+ *
9+ * Result: ['--p-background', '--p-text', etc...]
10+ */
11+ const polarisTokenCustomProperties = Array . from (
12+ new Set (
13+ fs
14+ . readdirSync ( tokenGroupsDir )
15+ . map ( ( file ) => {
16+ const tokenGroup = require ( path . join ( tokenGroupsDir , file ) ) ;
17+
18+ return Object . keys ( tokenGroup ) . map ( ( token ) => `--p-${ token } ` ) ;
19+ } )
20+ . flat ( ) ,
21+ ) ,
22+ ) ;
423
524/**
625 * Allowed custom property names in Polaris component styles.
@@ -19,7 +38,10 @@ module.exports = {
1938 polarisComponentCustomProperties ,
2039 ] ,
2140 allowedValues : {
22- '/.+/' : [ polarisComponentCustomProperties , ...tokenList ] ,
41+ '/.+/' : [
42+ polarisComponentCustomProperties ,
43+ ...polarisTokenCustomProperties ,
44+ ] ,
2345 } ,
2446 } ,
2547 } ,
Original file line number Diff line number Diff line change @@ -27,7 +27,6 @@ import type {} from '@shopify/loom-plugin-jest';
2727// eslint-disable-next-line import/no-default-export
2828export default createPackage ( ( pkg ) => {
2929 pkg . entry ( { root : './src/index.ts' } ) ;
30- pkg . entry ( { name : 'token-list' , root : './src/token-list.ts' } ) ;
3130 pkg . use (
3231 buildLibrary ( {
3332 rootEntrypoints : false ,
Original file line number Diff line number Diff line change @@ -693,7 +693,7 @@ function FrameExample() {
693693 >
694694 < Frame
695695 logo= {logo}
696- offset= " 6rem "
696+ offset= " 60px "
697697 globalRibbon= {
698698 < div style= {{background: ' #C0FFEE' , padding: ' 30px' }}>
699699 Global ribbon
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments