From f4ff18ccce6a4aa8ceb0f0d5c56dba23a33bc3fa Mon Sep 17 00:00:00 2001 From: aron-tw <aron886tw@gmail.com> Date: Thu, 16 Dec 2021 00:18:58 +0800 Subject: [PATCH 1/4] env: fix tsconfig --- tsconfig.prod.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tsconfig.prod.json b/tsconfig.prod.json index b9f7c4fd1..e8a2734e2 100644 --- a/tsconfig.prod.json +++ b/tsconfig.prod.json @@ -1,5 +1,5 @@ { - "extends": "../tsconfig.json", + "extends": "./tsconfig.json", "include": [ "./src/**/*index.ts", "./src/**/*.d.ts", From 0d56625d994c6e0cbe1ec86e9c3b035ec1e69b9f Mon Sep 17 00:00:00 2001 From: aron-tw <aron886tw@gmail.com> Date: Thu, 16 Dec 2021 00:57:30 +0800 Subject: [PATCH 2/4] refactor: minify --- src/package-lock.json | 34 ++++++++++++++++++++++++++++++++++ src/package.json | 4 ++-- webpack.prod.js | 3 +++ 3 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 src/package-lock.json diff --git a/src/package-lock.json b/src/package-lock.json new file mode 100644 index 000000000..a558197df --- /dev/null +++ b/src/package-lock.json @@ -0,0 +1,34 @@ +{ + "name": "@master/styles", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "@master/styles", + "license": "MIT", + "funding": { + "url": "https://opencollective.com/master-style" + }, + "peerDependencies": { + "@master/style": "^1.0.0-alpha.11" + } + }, + "node_modules/@master/style": { + "version": "1.0.0-alpha.12", + "resolved": "https://registry.npmjs.org/@master/style/-/style-1.0.0-alpha.12.tgz", + "integrity": "sha512-65bNQ3VXk+iyEAlRetOZqfHPEGggjNP7i12R2DefYtDZMSdNh2iSd9cIuX0tf1YdDIw0bJPLua7Qzklnxcl9QA==", + "peer": true, + "funding": { + "url": "https://opencollective.com/master-style" + } + } + }, + "dependencies": { + "@master/style": { + "version": "1.0.0-alpha.12", + "resolved": "https://registry.npmjs.org/@master/style/-/style-1.0.0-alpha.12.tgz", + "integrity": "sha512-65bNQ3VXk+iyEAlRetOZqfHPEGggjNP7i12R2DefYtDZMSdNh2iSd9cIuX0tf1YdDIw0bJPLua7Qzklnxcl9QA==", + "peer": true + } + } +} diff --git a/src/package.json b/src/package.json index 4be4874d2..56de768c0 100644 --- a/src/package.json +++ b/src/package.json @@ -16,10 +16,10 @@ "ui" ], "peerDependencies": { - "@master/style": "^1.0.0-alpha" + "@master/style": "^1.0.0-alpha.11" }, "repository": { "type": "git", "url": "https://github.com/master-style/styles.git" } -} \ No newline at end of file +} diff --git a/webpack.prod.js b/webpack.prod.js index cac8014af..256970a0f 100644 --- a/webpack.prod.js +++ b/webpack.prod.js @@ -38,6 +38,9 @@ module.exports = { format: { comments: false, }, + mangle: { + properties: true + } }, extractComments: false, }), From 857bc7b13e09739ebd20d12fd7aa61b9108e9bd6 Mon Sep 17 00:00:00 2001 From: aron-tw <aron886tw@gmail.com> Date: Thu, 16 Dec 2021 01:29:34 +0800 Subject: [PATCH 3/4] refactor: font-weight --- src/display.ts | 51 ++++++++++++++++------------------------------ src/font-weight.ts | 29 +++++++++++++++----------- 2 files changed, 35 insertions(+), 45 deletions(-) diff --git a/src/display.ts b/src/display.ts index f3c716752..88c78818b 100644 --- a/src/display.ts +++ b/src/display.ts @@ -1,43 +1,28 @@ -import { BLOCK, CONTENTS, CAPTION, DASH, DISPLAY, FLEX, GRID, INLINE, TABLE, CELL, GROUP, FOOTER, HEADER, ROW, FLOW, ROOT, ITEM, LIST, HIDDEN, COL, COLUMN } from './constants/css-property-keyword'; +import { BLOCK, CAPTION, DASH, DISPLAY, FLEX, GRID, INLINE, TABLE, CELL, GROUP, FOOTER, HEADER, ROW, FLOW, ROOT, ITEM, LIST, COL, COLUMN } from './constants/css-property-keyword'; import { MasterStyle } from '@master/style'; -const INLINE_BLOCK = INLINE + DASH + BLOCK, - INLINE_FLX = INLINE + DASH + FLEX, - INLINE_GRID = INLINE + DASH + GRID, - INLINE_TABLE = INLINE + DASH + TABLE, - INLINE_CAPTION = TABLE + DASH + CAPTION, - TABLE_CELL = TABLE + DASH + CELL, - TABLE_FOOTER_GROUP = TABLE + DASH + FOOTER + DASH + GROUP, - TABLE_HEADER_GROUP = TABLE + DASH + HEADER + DASH + GROUP, - TABLE_ROW_GROUP = TABLE + DASH + ROW + DASH + GROUP, - TABLE_ROW = TABLE + DASH + ROW, - FLOW_ROOT = FLOW + DASH + ROOT, - LIST_ITEM = LIST + DASH + ITEM; - export class DisplayStyle extends MasterStyle { static override prefixes = /^d:/; static override properties = [DISPLAY]; static override semantics = { - [BLOCK]: BLOCK, - [INLINE_BLOCK]: INLINE_BLOCK, - [INLINE]: INLINE, - [FLEX]: FLEX, - [INLINE_FLX]: INLINE_FLX, - [GRID]: GRID, - [INLINE_GRID]: INLINE_GRID, - [CONTENTS]: CONTENTS, - [TABLE]: TABLE, - [INLINE_TABLE]: INLINE_TABLE, - [INLINE_CAPTION]: INLINE_CAPTION, - [TABLE_CELL]: TABLE_CELL, [TABLE + DASH + COL]: TABLE + DASH + COLUMN, [TABLE + DASH + COL + DASH + GROUP]: TABLE + DASH + COLUMN + DASH + GROUP, - [TABLE_FOOTER_GROUP]: TABLE_FOOTER_GROUP, - [TABLE_HEADER_GROUP]: TABLE_HEADER_GROUP, - [TABLE_ROW_GROUP]: TABLE_ROW_GROUP, - [TABLE_ROW]: TABLE_ROW, - [FLOW_ROOT]: FLOW_ROOT, - [LIST_ITEM]: LIST_ITEM, - [HIDDEN]: HIDDEN } +} + +for (const value of [ + INLINE + DASH + BLOCK, + INLINE + DASH + FLEX, + INLINE + DASH + GRID, + INLINE + DASH + TABLE, + TABLE + DASH + CAPTION, + TABLE + DASH + CELL, + TABLE + DASH + FOOTER + DASH + GROUP, + TABLE + DASH + HEADER + DASH + GROUP, + TABLE + DASH + ROW + DASH + GROUP, + TABLE + DASH + ROW, + FLOW + DASH + ROOT, + LIST + DASH + ITEM +]) { + DisplayStyle.semantics[value] = value } \ No newline at end of file diff --git a/src/font-weight.ts b/src/font-weight.ts index b10f3a103..f4bd87ebe 100644 --- a/src/font-weight.ts +++ b/src/font-weight.ts @@ -2,18 +2,23 @@ import { DASH, FONT, F_PREFIX, WEIGHT } from './constants/css-property-keyword'; import { MasterStyle } from '@master/style'; export class FontWeightStyle extends MasterStyle { - static override prefixes = /^f-weight:/; + static override prefixes = /^f-weight:/; static override properties = [FONT + DASH + WEIGHT]; static override defaultUnit = ''; - static override semantics = { - [F_PREFIX + 'thin']: 100, - [F_PREFIX + 'extralight']: 200, - [F_PREFIX + 'light']: 300, - [F_PREFIX + 'regular']: 400, - [F_PREFIX + 'medium']: 500, - [F_PREFIX + 'semibold']: 600, - [F_PREFIX + 'bold']: 700, - [F_PREFIX + 'extrabold']: 800, - [F_PREFIX + 'heavy']: 900 - } +} + +let weight = 100; +for (const name of [ + 'thin', + 'extralight', + 'light', + 'regular', + 'medium', + 'semibold', + 'bold', + 'extrabold', + 'heavy' +]) { + FontWeightStyle.values[name] = weight; + weight += 100; } \ No newline at end of file From 45d1097656081de2fc03cc5456530d1017495c3a Mon Sep 17 00:00:00 2001 From: aron-tw <aron886tw@gmail.com> Date: Thu, 16 Dec 2021 01:38:45 +0800 Subject: [PATCH 4/4] env: update --- src/package-lock.json | 14 +++++++------- src/package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/package-lock.json b/src/package-lock.json index a558197df..853794d0d 100644 --- a/src/package-lock.json +++ b/src/package-lock.json @@ -10,13 +10,13 @@ "url": "https://opencollective.com/master-style" }, "peerDependencies": { - "@master/style": "^1.0.0-alpha.11" + "@master/style": "^1.0.0-alpha.14" } }, "node_modules/@master/style": { - "version": "1.0.0-alpha.12", - "resolved": "https://registry.npmjs.org/@master/style/-/style-1.0.0-alpha.12.tgz", - "integrity": "sha512-65bNQ3VXk+iyEAlRetOZqfHPEGggjNP7i12R2DefYtDZMSdNh2iSd9cIuX0tf1YdDIw0bJPLua7Qzklnxcl9QA==", + "version": "1.0.0-alpha.14", + "resolved": "https://registry.npmjs.org/@master/style/-/style-1.0.0-alpha.14.tgz", + "integrity": "sha512-RxGrnR55e6pepAaiB6k382xaDu7vcLFcHT5qIygFo34OJ3yKTfNBowfUKg/m8FjOI6l7GQ7CXlqTPvxK0645Cg==", "peer": true, "funding": { "url": "https://opencollective.com/master-style" @@ -25,9 +25,9 @@ }, "dependencies": { "@master/style": { - "version": "1.0.0-alpha.12", - "resolved": "https://registry.npmjs.org/@master/style/-/style-1.0.0-alpha.12.tgz", - "integrity": "sha512-65bNQ3VXk+iyEAlRetOZqfHPEGggjNP7i12R2DefYtDZMSdNh2iSd9cIuX0tf1YdDIw0bJPLua7Qzklnxcl9QA==", + "version": "1.0.0-alpha.14", + "resolved": "https://registry.npmjs.org/@master/style/-/style-1.0.0-alpha.14.tgz", + "integrity": "sha512-RxGrnR55e6pepAaiB6k382xaDu7vcLFcHT5qIygFo34OJ3yKTfNBowfUKg/m8FjOI6l7GQ7CXlqTPvxK0645Cg==", "peer": true } } diff --git a/src/package.json b/src/package.json index 56de768c0..0d7f112c7 100644 --- a/src/package.json +++ b/src/package.json @@ -16,7 +16,7 @@ "ui" ], "peerDependencies": { - "@master/style": "^1.0.0-alpha.11" + "@master/style": "^1.0.0-alpha.14" }, "repository": { "type": "git",