@charcoal-ui/foundation 1.0.0-alpha.1
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/LICENSE +201 -0
- package/README.md +17 -0
- package/dist/border-radius.d.ts +30 -0
- package/dist/border-radius.d.ts.map +1 -0
- package/dist/breakpoint.d.ts +27 -0
- package/dist/breakpoint.d.ts.map +1 -0
- package/dist/grid.d.ts +15 -0
- package/dist/grid.d.ts.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.modern.js +2 -0
- package/dist/index.modern.js.map +1 -0
- package/dist/index.module.js +2 -0
- package/dist/index.module.js.map +1 -0
- package/dist/spacing.d.ts +15 -0
- package/dist/spacing.d.ts.map +1 -0
- package/dist/typography.d.ts +18 -0
- package/dist/typography.d.ts.map +1 -0
- package/package.json +34 -0
- package/src/border-radius.ts +39 -0
- package/src/breakpoint.ts +39 -0
- package/src/grid.ts +20 -0
- package/src/index.ts +19 -0
- package/src/spacing.ts +28 -0
- package/src/typography.ts +73 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2022 pixiv Inc.
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare type BorderRadius = {
|
|
2
|
+
/**
|
|
3
|
+
* 用途: 打ち消し用クラス(モバイルのときに角丸じゃなくなる、などを表現する)
|
|
4
|
+
*/
|
|
5
|
+
none: number;
|
|
6
|
+
/**
|
|
7
|
+
* 用途: バッジ, 高さ40px以下の要素
|
|
8
|
+
*/
|
|
9
|
+
[4]: number;
|
|
10
|
+
/**
|
|
11
|
+
* 用途: サムネイル
|
|
12
|
+
*/
|
|
13
|
+
[8]: number;
|
|
14
|
+
/**
|
|
15
|
+
* 用途: チュートリアルツールチップ
|
|
16
|
+
*/
|
|
17
|
+
[16]: number;
|
|
18
|
+
/**
|
|
19
|
+
* 用途: モーダル
|
|
20
|
+
*/
|
|
21
|
+
[24]: number;
|
|
22
|
+
/**
|
|
23
|
+
* 真円 or 左右が丸まっている矩形 を作る時に用いる
|
|
24
|
+
*
|
|
25
|
+
* 用途: ボタン
|
|
26
|
+
*/
|
|
27
|
+
oval: number;
|
|
28
|
+
};
|
|
29
|
+
export declare const borderRadius: BorderRadius;
|
|
30
|
+
//# sourceMappingURL=border-radius.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"border-radius.d.ts","sourceRoot":"","sources":["../src/border-radius.ts"],"names":[],"mappings":"AACA,oBAAY,YAAY,GAAG;IACzB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IAEZ;;OAEG;IACH,CAAC,CAAC,CAAC,EAAE,MAAM,CAAA;IACX;;OAEG;IACH,CAAC,CAAC,CAAC,EAAE,MAAM,CAAA;IACX;;OAEG;IACH,CAAC,EAAE,CAAC,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,CAAC,EAAE,CAAC,EAAE,MAAM,CAAA;IACZ;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,YAO1B,CAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const HORIZONTAL_MIN_MARGIN = 72;
|
|
2
|
+
export declare type Breakpoint = {
|
|
3
|
+
/**
|
|
4
|
+
* 6 columns (max 743px)
|
|
5
|
+
*/
|
|
6
|
+
screen1: number;
|
|
7
|
+
/**
|
|
8
|
+
* 8 columns (max 953px)
|
|
9
|
+
*/
|
|
10
|
+
screen2: number;
|
|
11
|
+
/**
|
|
12
|
+
* 10 columns (max 1159px)
|
|
13
|
+
*/
|
|
14
|
+
screen3: number;
|
|
15
|
+
/**
|
|
16
|
+
* 12 columns (max 1367px)
|
|
17
|
+
*/
|
|
18
|
+
screen4: number;
|
|
19
|
+
};
|
|
20
|
+
export declare const breakpoint: Breakpoint;
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated
|
|
23
|
+
*
|
|
24
|
+
* Construct media query from breakpoint
|
|
25
|
+
*/
|
|
26
|
+
export declare function maxWidth(breakpoint: number): string;
|
|
27
|
+
//# sourceMappingURL=breakpoint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"breakpoint.d.ts","sourceRoot":"","sources":["../src/breakpoint.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,qBAAqB,KAAK,CAAA;AAGvC,oBAAY,UAAU,GAAG;IACvB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,eAAO,MAAM,UAAU,EAAE,UAKxB,CAAA;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,UAAU,EAAE,MAAM,UAE1C"}
|
package/dist/grid.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit for grid column (px)
|
|
3
|
+
*/
|
|
4
|
+
export declare const COLUMN_UNIT = 80;
|
|
5
|
+
/**
|
|
6
|
+
* Unit for grid gutter width (px)
|
|
7
|
+
*/
|
|
8
|
+
export declare const GUTTER_UNIT = 24;
|
|
9
|
+
/**
|
|
10
|
+
* Calculate px occupied by the span of the columns
|
|
11
|
+
*
|
|
12
|
+
* @param span column span count
|
|
13
|
+
*/
|
|
14
|
+
export declare function columnPx(span: number): number;
|
|
15
|
+
//# sourceMappingURL=grid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grid.d.ts","sourceRoot":"","sources":["../src/grid.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,WAAW,KAAK,CAAA;AAE7B;;GAEG;AACH,eAAO,MAAM,WAAW,KAAK,CAAA;AAE7B;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,UAEpC"}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function e(e){return 80*e+24*(e-1)}var t={screen1:e(6)+144,screen2:e(8)+144,screen3:e(10)+144,screen4:e(12)+144};exports.COLUMN_UNIT=80,exports.GUTTER_UNIT=24,exports.HORIZONTAL_MIN_MARGIN=72,exports.TYPOGRAPHY_VARIANT=["proportional","monospace"],exports.TYPOGRAPHY_WEIGHT=["regular","bold"],exports.borderRadius={none:0,4:4,8:8,16:16,24:24,oval:999999},exports.breakpoint=t,exports.columnPx=e,exports.halfLeading=function(e){return(e.lineHeight-e.fontSize)/2},exports.maxWidth=function(e){return"(max-width: "+(e-1)+"px)"},exports.spacing={0:0,4:4,8:8,16:16,24:24,40:40,64:64,104:104,168:168,272:272,440:440},exports.typography={12:{fontSize:12,lineHeight:20},14:{fontSize:14,lineHeight:22},16:{fontSize:16,lineHeight:24},20:{fontSize:20,lineHeight:28},32:{fontSize:32,lineHeight:40}};
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/grid.ts","../src/border-radius.ts","../src/breakpoint.ts","../src/typography.ts","../src/spacing.ts"],"sourcesContent":["/**\n * Unit for grid column (px)\n */\nexport const COLUMN_UNIT = 80\n\n/**\n * Unit for grid gutter width (px)\n */\nexport const GUTTER_UNIT = 24\n\n/**\n * Calculate px occupied by the span of the columns\n *\n * @param span column span count\n */\nexport function columnPx(span: number) {\n return span * COLUMN_UNIT + (span - 1) * GUTTER_UNIT\n}\n\n// TODO: Grid definition with breakpoint\n","// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport type BorderRadius = {\n /**\n * 用途: 打ち消し用クラス(モバイルのときに角丸じゃなくなる、などを表現する)\n */\n none: number\n\n /**\n * 用途: バッジ, 高さ40px以下の要素\n */\n [4]: number\n /**\n * 用途: サムネイル\n */\n [8]: number\n /**\n * 用途: チュートリアルツールチップ\n */\n [16]: number\n /**\n * 用途: モーダル\n */\n [24]: number\n /**\n * 真円 or 左右が丸まっている矩形 を作る時に用いる\n *\n * 用途: ボタン\n */\n oval: number\n}\n\nexport const borderRadius: BorderRadius = {\n none: 0,\n 4: 4,\n 8: 8,\n 16: 16,\n 24: 24,\n oval: 999999,\n}\n","import { columnPx } from './grid'\n\nexport const HORIZONTAL_MIN_MARGIN = 72\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport type Breakpoint = {\n /**\n * 6 columns (max 743px)\n */\n screen1: number\n /**\n * 8 columns (max 953px)\n */\n screen2: number\n /**\n * 10 columns (max 1159px)\n */\n screen3: number\n /**\n * 12 columns (max 1367px)\n */\n screen4: number\n}\n\nexport const breakpoint: Breakpoint = {\n screen1: columnPx(6) + HORIZONTAL_MIN_MARGIN * 2,\n screen2: columnPx(8) + HORIZONTAL_MIN_MARGIN * 2,\n screen3: columnPx(10) + HORIZONTAL_MIN_MARGIN * 2,\n screen4: columnPx(12) + HORIZONTAL_MIN_MARGIN * 2,\n}\n\n/**\n * @deprecated\n *\n * Construct media query from breakpoint\n */\nexport function maxWidth(breakpoint: number) {\n return `(max-width: ${breakpoint - 1}px)`\n}\n","export interface TypographyDescriptor {\n lineHeight: number\n fontSize: number\n}\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport type Typography = {\n [12]: TypographyDescriptor\n [14]: TypographyDescriptor\n [16]: TypographyDescriptor\n [20]: TypographyDescriptor\n [32]: TypographyDescriptor\n}\n\nexport const typography: Typography = {\n 12: {\n fontSize: 12,\n lineHeight: 20,\n },\n 14: {\n fontSize: 14,\n lineHeight: 22,\n },\n 16: {\n fontSize: 16,\n lineHeight: 24,\n },\n 20: {\n fontSize: 20,\n lineHeight: 28,\n },\n 32: {\n fontSize: 32,\n lineHeight: 40,\n },\n}\n\nexport const halfLeading = ({ fontSize, lineHeight }: TypographyDescriptor) =>\n (lineHeight - fontSize) / 2\n\nexport const TYPOGRAPHY_WEIGHT = [\n /**\n * Regular font weight\n *\n * <font-weight-absolute> ~ 400\n *\n * It should be the **DEFAULT** weight\n */\n 'regular',\n /**\n * Bolder than `regular` weight\n *\n * <font-weight-absolute> ~ 700\n */\n 'bold',\n] as const\n\nexport type TypographyWeight = typeof TYPOGRAPHY_WEIGHT[number]\n\nexport const TYPOGRAPHY_VARIANT = [\n /**\n * Proportional font (which has the variable amount of horizontal space)\n *\n * It should be the **DEFAULT** variant\n */\n 'proportional',\n /**\n * Monospaced font (which has the same amount of horizontal space)\n */\n 'monospace',\n] as const\n\nexport type TypographyVariant = typeof TYPOGRAPHY_VARIANT[number]\n","// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport type Spacing = {\n [0]: number\n [4]: number\n [8]: number\n [16]: number\n [24]: number\n [40]: number\n [64]: number\n [104]: number\n [168]: number\n [272]: number\n [440]: number\n}\n\nexport const spacing: Spacing = {\n 0: 0,\n 4: 4,\n 8: 8,\n 16: 16,\n 24: 24,\n 40: 40,\n 64: 64,\n 104: 104,\n 168: 168,\n 272: 272,\n 440: 440,\n}\n"],"names":["columnPx","span","borderRadius","breakpoint","screen1","HORIZONTAL_MIN_MARGIN","screen2","screen3","screen4","none","oval","lineHeight","fontSize"],"mappings":"SAegBA,EAASC,GACvB,OAbyB,GAalBA,EARkB,IAQIA,EAAO,GCezBC,ICPAC,EAAyB,CACpCC,QAASJ,EAAS,GAAKK,IACvBC,QAASN,EAAS,GAAKK,IACvBE,QAASP,EAAS,IAAMK,IACxBG,QAASR,EAAS,IAAMK,yBFzBC,uBAKA,iCENU,8BCyDH,CAMhC,eAIA,uCA7B+B,CAQ/B,UAMA,6BFvBwC,CACxCI,KAAM,EACN,EAAG,EACH,EAAG,EACH,GAAI,GACJ,GAAI,GACJC,KAAM,oEEAmB,qBAAaC,aAAVC,UACF,6BDFHT,GACvB,sBAAsBA,EAAa,0BEtBL,CAC9B,EAAG,EACH,EAAG,EACH,EAAG,EACH,GAAI,GACJ,GAAI,GACJ,GAAI,GACJ,GAAI,GACJ,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,wBDZ+B,CACpC,GAAI,CACFS,SAAU,GACVD,WAAY,IAEd,GAAI,CACFC,SAAU,GACVD,WAAY,IAEd,GAAI,CACFC,SAAU,GACVD,WAAY,IAEd,GAAI,CACFC,SAAU,GACVD,WAAY,IAEd,GAAI,CACFC,SAAU,GACVD,WAAY"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { type Typography, typography, type TypographyDescriptor, TYPOGRAPHY_VARIANT, TYPOGRAPHY_WEIGHT, type TypographyVariant, type TypographyWeight, halfLeading, } from './typography';
|
|
2
|
+
export { type Spacing, spacing } from './spacing';
|
|
3
|
+
export { COLUMN_UNIT, GUTTER_UNIT, columnPx } from './grid';
|
|
4
|
+
export { type BorderRadius, borderRadius } from './border-radius';
|
|
5
|
+
export { type Breakpoint, HORIZONTAL_MIN_MARGIN, breakpoint, maxWidth, } from './breakpoint';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,UAAU,EACf,UAAU,EACV,KAAK,oBAAoB,EACzB,kBAAkB,EAClB,iBAAiB,EACjB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,WAAW,GACZ,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,KAAK,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACjD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAC3D,OAAO,EAAE,KAAK,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AACjE,OAAO,EACL,KAAK,UAAU,EACf,qBAAqB,EACrB,UAAU,EACV,QAAQ,GACT,MAAM,cAAc,CAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e={12:{fontSize:12,lineHeight:20},14:{fontSize:14,lineHeight:22},16:{fontSize:16,lineHeight:24},20:{fontSize:20,lineHeight:28},32:{fontSize:32,lineHeight:40}},n=({fontSize:e,lineHeight:n})=>(n-e)/2,i=["regular","bold"],t=["proportional","monospace"],o={0:0,4:4,8:8,16:16,24:24,40:40,64:64,104:104,168:168,272:272,440:440},r=80,l=24;function c(e){return 80*e+24*(e-1)}const f={none:0,4:4,8:8,16:16,24:24,oval:999999},g=72,h={screen1:c(6)+144,screen2:c(8)+144,screen3:c(10)+144,screen4:c(12)+144};function s(e){return`(max-width: ${e-1}px)`}export{r as COLUMN_UNIT,l as GUTTER_UNIT,g as HORIZONTAL_MIN_MARGIN,t as TYPOGRAPHY_VARIANT,i as TYPOGRAPHY_WEIGHT,f as borderRadius,h as breakpoint,c as columnPx,n as halfLeading,s as maxWidth,o as spacing,e as typography};
|
|
2
|
+
//# sourceMappingURL=index.modern.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.modern.js","sources":["../src/typography.ts","../src/spacing.ts","../src/grid.ts","../src/border-radius.ts","../src/breakpoint.ts"],"sourcesContent":["export interface TypographyDescriptor {\n lineHeight: number\n fontSize: number\n}\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport type Typography = {\n [12]: TypographyDescriptor\n [14]: TypographyDescriptor\n [16]: TypographyDescriptor\n [20]: TypographyDescriptor\n [32]: TypographyDescriptor\n}\n\nexport const typography: Typography = {\n 12: {\n fontSize: 12,\n lineHeight: 20,\n },\n 14: {\n fontSize: 14,\n lineHeight: 22,\n },\n 16: {\n fontSize: 16,\n lineHeight: 24,\n },\n 20: {\n fontSize: 20,\n lineHeight: 28,\n },\n 32: {\n fontSize: 32,\n lineHeight: 40,\n },\n}\n\nexport const halfLeading = ({ fontSize, lineHeight }: TypographyDescriptor) =>\n (lineHeight - fontSize) / 2\n\nexport const TYPOGRAPHY_WEIGHT = [\n /**\n * Regular font weight\n *\n * <font-weight-absolute> ~ 400\n *\n * It should be the **DEFAULT** weight\n */\n 'regular',\n /**\n * Bolder than `regular` weight\n *\n * <font-weight-absolute> ~ 700\n */\n 'bold',\n] as const\n\nexport type TypographyWeight = typeof TYPOGRAPHY_WEIGHT[number]\n\nexport const TYPOGRAPHY_VARIANT = [\n /**\n * Proportional font (which has the variable amount of horizontal space)\n *\n * It should be the **DEFAULT** variant\n */\n 'proportional',\n /**\n * Monospaced font (which has the same amount of horizontal space)\n */\n 'monospace',\n] as const\n\nexport type TypographyVariant = typeof TYPOGRAPHY_VARIANT[number]\n","// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport type Spacing = {\n [0]: number\n [4]: number\n [8]: number\n [16]: number\n [24]: number\n [40]: number\n [64]: number\n [104]: number\n [168]: number\n [272]: number\n [440]: number\n}\n\nexport const spacing: Spacing = {\n 0: 0,\n 4: 4,\n 8: 8,\n 16: 16,\n 24: 24,\n 40: 40,\n 64: 64,\n 104: 104,\n 168: 168,\n 272: 272,\n 440: 440,\n}\n","/**\n * Unit for grid column (px)\n */\nexport const COLUMN_UNIT = 80\n\n/**\n * Unit for grid gutter width (px)\n */\nexport const GUTTER_UNIT = 24\n\n/**\n * Calculate px occupied by the span of the columns\n *\n * @param span column span count\n */\nexport function columnPx(span: number) {\n return span * COLUMN_UNIT + (span - 1) * GUTTER_UNIT\n}\n\n// TODO: Grid definition with breakpoint\n","// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport type BorderRadius = {\n /**\n * 用途: 打ち消し用クラス(モバイルのときに角丸じゃなくなる、などを表現する)\n */\n none: number\n\n /**\n * 用途: バッジ, 高さ40px以下の要素\n */\n [4]: number\n /**\n * 用途: サムネイル\n */\n [8]: number\n /**\n * 用途: チュートリアルツールチップ\n */\n [16]: number\n /**\n * 用途: モーダル\n */\n [24]: number\n /**\n * 真円 or 左右が丸まっている矩形 を作る時に用いる\n *\n * 用途: ボタン\n */\n oval: number\n}\n\nexport const borderRadius: BorderRadius = {\n none: 0,\n 4: 4,\n 8: 8,\n 16: 16,\n 24: 24,\n oval: 999999,\n}\n","import { columnPx } from './grid'\n\nexport const HORIZONTAL_MIN_MARGIN = 72\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport type Breakpoint = {\n /**\n * 6 columns (max 743px)\n */\n screen1: number\n /**\n * 8 columns (max 953px)\n */\n screen2: number\n /**\n * 10 columns (max 1159px)\n */\n screen3: number\n /**\n * 12 columns (max 1367px)\n */\n screen4: number\n}\n\nexport const breakpoint: Breakpoint = {\n screen1: columnPx(6) + HORIZONTAL_MIN_MARGIN * 2,\n screen2: columnPx(8) + HORIZONTAL_MIN_MARGIN * 2,\n screen3: columnPx(10) + HORIZONTAL_MIN_MARGIN * 2,\n screen4: columnPx(12) + HORIZONTAL_MIN_MARGIN * 2,\n}\n\n/**\n * @deprecated\n *\n * Construct media query from breakpoint\n */\nexport function maxWidth(breakpoint: number) {\n return `(max-width: ${breakpoint - 1}px)`\n}\n"],"names":["typography","fontSize","lineHeight","halfLeading","TYPOGRAPHY_WEIGHT","TYPOGRAPHY_VARIANT","spacing","COLUMN_UNIT","GUTTER_UNIT","columnPx","span","borderRadius","none","oval","HORIZONTAL_MIN_MARGIN","breakpoint","screen1","screen2","screen3","screen4","maxWidth"],"mappings":"AAcaA,MAAAA,EAAyB,CACpC,GAAI,CACFC,SAAU,GACVC,WAAY,IAEd,GAAI,CACFD,SAAU,GACVC,WAAY,IAEd,GAAI,CACFD,SAAU,GACVC,WAAY,IAEd,GAAI,CACFD,SAAU,GACVC,WAAY,IAEd,GAAI,CACFD,SAAU,GACVC,WAAY,KAIHC,EAAc,EAAGF,SAAAA,EAAUC,WAAAA,MACrCA,EAAaD,GAAY,EAEfG,EAAoB,CAQ/B,UAMA,QAKWC,EAAqB,CAMhC,eAIA,aCtDWC,EAAmB,CAC9B,EAAG,EACH,EAAG,EACH,EAAG,EACH,GAAI,GACJ,GAAI,GACJ,GAAI,GACJ,GAAI,GACJ,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,KCvBMC,EAAc,GAKdC,EAAc,YAOXC,EAASC,GACvB,OAbyB,GAalBA,EARkB,IAQIA,EAAO,GCezBC,MAAAA,EAA6B,CACxCC,KAAM,EACN,EAAG,EACH,EAAG,EACH,GAAI,GACJ,GAAI,GACJC,KAAM,QCnCKC,EAAwB,GAsBxBC,EAAyB,CACpCC,QAASP,EAAS,GAAKK,IACvBG,QAASR,EAAS,GAAKK,IACvBI,QAAST,EAAS,IAAMK,IACxBK,QAASV,EAAS,IAAMK,cAQVM,EAASL,GACvB,qBAAsBA,EAAa"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e={12:{fontSize:12,lineHeight:20},14:{fontSize:14,lineHeight:22},16:{fontSize:16,lineHeight:24},20:{fontSize:20,lineHeight:28},32:{fontSize:32,lineHeight:40}},n=function(e){return(e.lineHeight-e.fontSize)/2},i=["regular","bold"],t=["proportional","monospace"],o={0:0,4:4,8:8,16:16,24:24,40:40,64:64,104:104,168:168,272:272,440:440},r=80,l=24;function f(e){return 80*e+24*(e-1)}var c={none:0,4:4,8:8,16:16,24:24,oval:999999},a=72,g={screen1:f(6)+144,screen2:f(8)+144,screen3:f(10)+144,screen4:f(12)+144};function h(e){return"(max-width: "+(e-1)+"px)"}export{r as COLUMN_UNIT,l as GUTTER_UNIT,a as HORIZONTAL_MIN_MARGIN,t as TYPOGRAPHY_VARIANT,i as TYPOGRAPHY_WEIGHT,c as borderRadius,g as breakpoint,f as columnPx,n as halfLeading,h as maxWidth,o as spacing,e as typography};
|
|
2
|
+
//# sourceMappingURL=index.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.module.js","sources":["../src/typography.ts","../src/spacing.ts","../src/grid.ts","../src/border-radius.ts","../src/breakpoint.ts"],"sourcesContent":["export interface TypographyDescriptor {\n lineHeight: number\n fontSize: number\n}\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport type Typography = {\n [12]: TypographyDescriptor\n [14]: TypographyDescriptor\n [16]: TypographyDescriptor\n [20]: TypographyDescriptor\n [32]: TypographyDescriptor\n}\n\nexport const typography: Typography = {\n 12: {\n fontSize: 12,\n lineHeight: 20,\n },\n 14: {\n fontSize: 14,\n lineHeight: 22,\n },\n 16: {\n fontSize: 16,\n lineHeight: 24,\n },\n 20: {\n fontSize: 20,\n lineHeight: 28,\n },\n 32: {\n fontSize: 32,\n lineHeight: 40,\n },\n}\n\nexport const halfLeading = ({ fontSize, lineHeight }: TypographyDescriptor) =>\n (lineHeight - fontSize) / 2\n\nexport const TYPOGRAPHY_WEIGHT = [\n /**\n * Regular font weight\n *\n * <font-weight-absolute> ~ 400\n *\n * It should be the **DEFAULT** weight\n */\n 'regular',\n /**\n * Bolder than `regular` weight\n *\n * <font-weight-absolute> ~ 700\n */\n 'bold',\n] as const\n\nexport type TypographyWeight = typeof TYPOGRAPHY_WEIGHT[number]\n\nexport const TYPOGRAPHY_VARIANT = [\n /**\n * Proportional font (which has the variable amount of horizontal space)\n *\n * It should be the **DEFAULT** variant\n */\n 'proportional',\n /**\n * Monospaced font (which has the same amount of horizontal space)\n */\n 'monospace',\n] as const\n\nexport type TypographyVariant = typeof TYPOGRAPHY_VARIANT[number]\n","// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport type Spacing = {\n [0]: number\n [4]: number\n [8]: number\n [16]: number\n [24]: number\n [40]: number\n [64]: number\n [104]: number\n [168]: number\n [272]: number\n [440]: number\n}\n\nexport const spacing: Spacing = {\n 0: 0,\n 4: 4,\n 8: 8,\n 16: 16,\n 24: 24,\n 40: 40,\n 64: 64,\n 104: 104,\n 168: 168,\n 272: 272,\n 440: 440,\n}\n","/**\n * Unit for grid column (px)\n */\nexport const COLUMN_UNIT = 80\n\n/**\n * Unit for grid gutter width (px)\n */\nexport const GUTTER_UNIT = 24\n\n/**\n * Calculate px occupied by the span of the columns\n *\n * @param span column span count\n */\nexport function columnPx(span: number) {\n return span * COLUMN_UNIT + (span - 1) * GUTTER_UNIT\n}\n\n// TODO: Grid definition with breakpoint\n","// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport type BorderRadius = {\n /**\n * 用途: 打ち消し用クラス(モバイルのときに角丸じゃなくなる、などを表現する)\n */\n none: number\n\n /**\n * 用途: バッジ, 高さ40px以下の要素\n */\n [4]: number\n /**\n * 用途: サムネイル\n */\n [8]: number\n /**\n * 用途: チュートリアルツールチップ\n */\n [16]: number\n /**\n * 用途: モーダル\n */\n [24]: number\n /**\n * 真円 or 左右が丸まっている矩形 を作る時に用いる\n *\n * 用途: ボタン\n */\n oval: number\n}\n\nexport const borderRadius: BorderRadius = {\n none: 0,\n 4: 4,\n 8: 8,\n 16: 16,\n 24: 24,\n oval: 999999,\n}\n","import { columnPx } from './grid'\n\nexport const HORIZONTAL_MIN_MARGIN = 72\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport type Breakpoint = {\n /**\n * 6 columns (max 743px)\n */\n screen1: number\n /**\n * 8 columns (max 953px)\n */\n screen2: number\n /**\n * 10 columns (max 1159px)\n */\n screen3: number\n /**\n * 12 columns (max 1367px)\n */\n screen4: number\n}\n\nexport const breakpoint: Breakpoint = {\n screen1: columnPx(6) + HORIZONTAL_MIN_MARGIN * 2,\n screen2: columnPx(8) + HORIZONTAL_MIN_MARGIN * 2,\n screen3: columnPx(10) + HORIZONTAL_MIN_MARGIN * 2,\n screen4: columnPx(12) + HORIZONTAL_MIN_MARGIN * 2,\n}\n\n/**\n * @deprecated\n *\n * Construct media query from breakpoint\n */\nexport function maxWidth(breakpoint: number) {\n return `(max-width: ${breakpoint - 1}px)`\n}\n"],"names":["typography","fontSize","lineHeight","halfLeading","TYPOGRAPHY_WEIGHT","TYPOGRAPHY_VARIANT","spacing","COLUMN_UNIT","GUTTER_UNIT","columnPx","span","borderRadius","none","oval","HORIZONTAL_MIN_MARGIN","breakpoint","screen1","screen2","screen3","screen4","maxWidth"],"mappings":"AAcaA,IAAAA,EAAyB,CACpC,GAAI,CACFC,SAAU,GACVC,WAAY,IAEd,GAAI,CACFD,SAAU,GACVC,WAAY,IAEd,GAAI,CACFD,SAAU,GACVC,WAAY,IAEd,GAAI,CACFD,SAAU,GACVC,WAAY,IAEd,GAAI,CACFD,SAAU,GACVC,WAAY,KAIHC,EAAc,qBAAaD,aAAVD,UACF,GAEfG,EAAoB,CAQ/B,UAMA,QAKWC,EAAqB,CAMhC,eAIA,aCtDWC,EAAmB,CAC9B,EAAG,EACH,EAAG,EACH,EAAG,EACH,GAAI,GACJ,GAAI,GACJ,GAAI,GACJ,GAAI,GACJ,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,KCvBMC,EAAc,GAKdC,EAAc,YAOXC,EAASC,GACvB,OAbyB,GAalBA,EARkB,IAQIA,EAAO,GCezBC,IAAAA,EAA6B,CACxCC,KAAM,EACN,EAAG,EACH,EAAG,EACH,GAAI,GACJ,GAAI,GACJC,KAAM,QCnCKC,EAAwB,GAsBxBC,EAAyB,CACpCC,QAASP,EAAS,GAAKK,IACvBG,QAASR,EAAS,GAAKK,IACvBI,QAAST,EAAS,IAAMK,IACxBK,QAASV,EAAS,IAAMK,cAQVM,EAASL,GACvB,sBAAsBA,EAAa"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare type Spacing = {
|
|
2
|
+
[0]: number;
|
|
3
|
+
[4]: number;
|
|
4
|
+
[8]: number;
|
|
5
|
+
[16]: number;
|
|
6
|
+
[24]: number;
|
|
7
|
+
[40]: number;
|
|
8
|
+
[64]: number;
|
|
9
|
+
[104]: number;
|
|
10
|
+
[168]: number;
|
|
11
|
+
[272]: number;
|
|
12
|
+
[440]: number;
|
|
13
|
+
};
|
|
14
|
+
export declare const spacing: Spacing;
|
|
15
|
+
//# sourceMappingURL=spacing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spacing.d.ts","sourceRoot":"","sources":["../src/spacing.ts"],"names":[],"mappings":"AACA,oBAAY,OAAO,GAAG;IACpB,CAAC,CAAC,CAAC,EAAE,MAAM,CAAA;IACX,CAAC,CAAC,CAAC,EAAE,MAAM,CAAA;IACX,CAAC,CAAC,CAAC,EAAE,MAAM,CAAA;IACX,CAAC,EAAE,CAAC,EAAE,MAAM,CAAA;IACZ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAA;IACZ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAA;IACZ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAA;IACZ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAA;IACb,CAAC,GAAG,CAAC,EAAE,MAAM,CAAA;IACb,CAAC,GAAG,CAAC,EAAE,MAAM,CAAA;IACb,CAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAED,eAAO,MAAM,OAAO,EAAE,OAYrB,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface TypographyDescriptor {
|
|
2
|
+
lineHeight: number;
|
|
3
|
+
fontSize: number;
|
|
4
|
+
}
|
|
5
|
+
export declare type Typography = {
|
|
6
|
+
[12]: TypographyDescriptor;
|
|
7
|
+
[14]: TypographyDescriptor;
|
|
8
|
+
[16]: TypographyDescriptor;
|
|
9
|
+
[20]: TypographyDescriptor;
|
|
10
|
+
[32]: TypographyDescriptor;
|
|
11
|
+
};
|
|
12
|
+
export declare const typography: Typography;
|
|
13
|
+
export declare const halfLeading: ({ fontSize, lineHeight }: TypographyDescriptor) => number;
|
|
14
|
+
export declare const TYPOGRAPHY_WEIGHT: readonly ["regular", "bold"];
|
|
15
|
+
export declare type TypographyWeight = typeof TYPOGRAPHY_WEIGHT[number];
|
|
16
|
+
export declare const TYPOGRAPHY_VARIANT: readonly ["proportional", "monospace"];
|
|
17
|
+
export declare type TypographyVariant = typeof TYPOGRAPHY_VARIANT[number];
|
|
18
|
+
//# sourceMappingURL=typography.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typography.d.ts","sourceRoot":"","sources":["../src/typography.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAGD,oBAAY,UAAU,GAAG;IACvB,CAAC,EAAE,CAAC,EAAE,oBAAoB,CAAA;IAC1B,CAAC,EAAE,CAAC,EAAE,oBAAoB,CAAA;IAC1B,CAAC,EAAE,CAAC,EAAE,oBAAoB,CAAA;IAC1B,CAAC,EAAE,CAAC,EAAE,oBAAoB,CAAA;IAC1B,CAAC,EAAE,CAAC,EAAE,oBAAoB,CAAA;CAC3B,CAAA;AAED,eAAO,MAAM,UAAU,EAAE,UAqBxB,CAAA;AAED,eAAO,MAAM,WAAW,6BAA8B,oBAAoB,WAC7C,CAAA;AAE7B,eAAO,MAAM,iBAAiB,8BAepB,CAAA;AAEV,oBAAY,gBAAgB,GAAG,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAA;AAE/D,eAAO,MAAM,kBAAkB,wCAWrB,CAAA;AAEV,oBAAY,iBAAiB,GAAG,OAAO,kBAAkB,CAAC,MAAM,CAAC,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@charcoal-ui/foundation",
|
|
3
|
+
"version": "1.0.0-alpha.1",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"source": "./src/index.ts",
|
|
7
|
+
"main": "./dist/index.cjs",
|
|
8
|
+
"module": "./dist/index.module.js",
|
|
9
|
+
"exports": {
|
|
10
|
+
"require": "./dist/index.cjs",
|
|
11
|
+
"default": "./dist/index.modern.js"
|
|
12
|
+
},
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"sideEffects": false,
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "microbundle -f modern,esm,cjs --tsconfig tsconfig.build.json",
|
|
17
|
+
"typecheck": "tsc --noEmit --project tsconfig.build.json",
|
|
18
|
+
"clean": "rimraf dist"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"microbundle": "^0.14.2",
|
|
22
|
+
"npm-run-all": "^4.1.5",
|
|
23
|
+
"rimraf": "^3.0.2",
|
|
24
|
+
"typescript": "^4.5.5"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"src",
|
|
28
|
+
"dist"
|
|
29
|
+
],
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
},
|
|
33
|
+
"gitHead": "1d09e09a796f92782be600672efb5c80a6a7b51b"
|
|
34
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
|
|
2
|
+
export type BorderRadius = {
|
|
3
|
+
/**
|
|
4
|
+
* 用途: 打ち消し用クラス(モバイルのときに角丸じゃなくなる、などを表現する)
|
|
5
|
+
*/
|
|
6
|
+
none: number
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 用途: バッジ, 高さ40px以下の要素
|
|
10
|
+
*/
|
|
11
|
+
[4]: number
|
|
12
|
+
/**
|
|
13
|
+
* 用途: サムネイル
|
|
14
|
+
*/
|
|
15
|
+
[8]: number
|
|
16
|
+
/**
|
|
17
|
+
* 用途: チュートリアルツールチップ
|
|
18
|
+
*/
|
|
19
|
+
[16]: number
|
|
20
|
+
/**
|
|
21
|
+
* 用途: モーダル
|
|
22
|
+
*/
|
|
23
|
+
[24]: number
|
|
24
|
+
/**
|
|
25
|
+
* 真円 or 左右が丸まっている矩形 を作る時に用いる
|
|
26
|
+
*
|
|
27
|
+
* 用途: ボタン
|
|
28
|
+
*/
|
|
29
|
+
oval: number
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const borderRadius: BorderRadius = {
|
|
33
|
+
none: 0,
|
|
34
|
+
4: 4,
|
|
35
|
+
8: 8,
|
|
36
|
+
16: 16,
|
|
37
|
+
24: 24,
|
|
38
|
+
oval: 999999,
|
|
39
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { columnPx } from './grid'
|
|
2
|
+
|
|
3
|
+
export const HORIZONTAL_MIN_MARGIN = 72
|
|
4
|
+
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
|
|
6
|
+
export type Breakpoint = {
|
|
7
|
+
/**
|
|
8
|
+
* 6 columns (max 743px)
|
|
9
|
+
*/
|
|
10
|
+
screen1: number
|
|
11
|
+
/**
|
|
12
|
+
* 8 columns (max 953px)
|
|
13
|
+
*/
|
|
14
|
+
screen2: number
|
|
15
|
+
/**
|
|
16
|
+
* 10 columns (max 1159px)
|
|
17
|
+
*/
|
|
18
|
+
screen3: number
|
|
19
|
+
/**
|
|
20
|
+
* 12 columns (max 1367px)
|
|
21
|
+
*/
|
|
22
|
+
screen4: number
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const breakpoint: Breakpoint = {
|
|
26
|
+
screen1: columnPx(6) + HORIZONTAL_MIN_MARGIN * 2,
|
|
27
|
+
screen2: columnPx(8) + HORIZONTAL_MIN_MARGIN * 2,
|
|
28
|
+
screen3: columnPx(10) + HORIZONTAL_MIN_MARGIN * 2,
|
|
29
|
+
screen4: columnPx(12) + HORIZONTAL_MIN_MARGIN * 2,
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated
|
|
34
|
+
*
|
|
35
|
+
* Construct media query from breakpoint
|
|
36
|
+
*/
|
|
37
|
+
export function maxWidth(breakpoint: number) {
|
|
38
|
+
return `(max-width: ${breakpoint - 1}px)`
|
|
39
|
+
}
|
package/src/grid.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit for grid column (px)
|
|
3
|
+
*/
|
|
4
|
+
export const COLUMN_UNIT = 80
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Unit for grid gutter width (px)
|
|
8
|
+
*/
|
|
9
|
+
export const GUTTER_UNIT = 24
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Calculate px occupied by the span of the columns
|
|
13
|
+
*
|
|
14
|
+
* @param span column span count
|
|
15
|
+
*/
|
|
16
|
+
export function columnPx(span: number) {
|
|
17
|
+
return span * COLUMN_UNIT + (span - 1) * GUTTER_UNIT
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// TODO: Grid definition with breakpoint
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export {
|
|
2
|
+
type Typography,
|
|
3
|
+
typography,
|
|
4
|
+
type TypographyDescriptor,
|
|
5
|
+
TYPOGRAPHY_VARIANT,
|
|
6
|
+
TYPOGRAPHY_WEIGHT,
|
|
7
|
+
type TypographyVariant,
|
|
8
|
+
type TypographyWeight,
|
|
9
|
+
halfLeading,
|
|
10
|
+
} from './typography'
|
|
11
|
+
export { type Spacing, spacing } from './spacing'
|
|
12
|
+
export { COLUMN_UNIT, GUTTER_UNIT, columnPx } from './grid'
|
|
13
|
+
export { type BorderRadius, borderRadius } from './border-radius'
|
|
14
|
+
export {
|
|
15
|
+
type Breakpoint,
|
|
16
|
+
HORIZONTAL_MIN_MARGIN,
|
|
17
|
+
breakpoint,
|
|
18
|
+
maxWidth,
|
|
19
|
+
} from './breakpoint'
|
package/src/spacing.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
|
|
2
|
+
export type Spacing = {
|
|
3
|
+
[0]: number
|
|
4
|
+
[4]: number
|
|
5
|
+
[8]: number
|
|
6
|
+
[16]: number
|
|
7
|
+
[24]: number
|
|
8
|
+
[40]: number
|
|
9
|
+
[64]: number
|
|
10
|
+
[104]: number
|
|
11
|
+
[168]: number
|
|
12
|
+
[272]: number
|
|
13
|
+
[440]: number
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const spacing: Spacing = {
|
|
17
|
+
0: 0,
|
|
18
|
+
4: 4,
|
|
19
|
+
8: 8,
|
|
20
|
+
16: 16,
|
|
21
|
+
24: 24,
|
|
22
|
+
40: 40,
|
|
23
|
+
64: 64,
|
|
24
|
+
104: 104,
|
|
25
|
+
168: 168,
|
|
26
|
+
272: 272,
|
|
27
|
+
440: 440,
|
|
28
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
export interface TypographyDescriptor {
|
|
2
|
+
lineHeight: number
|
|
3
|
+
fontSize: number
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
|
|
7
|
+
export type Typography = {
|
|
8
|
+
[12]: TypographyDescriptor
|
|
9
|
+
[14]: TypographyDescriptor
|
|
10
|
+
[16]: TypographyDescriptor
|
|
11
|
+
[20]: TypographyDescriptor
|
|
12
|
+
[32]: TypographyDescriptor
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const typography: Typography = {
|
|
16
|
+
12: {
|
|
17
|
+
fontSize: 12,
|
|
18
|
+
lineHeight: 20,
|
|
19
|
+
},
|
|
20
|
+
14: {
|
|
21
|
+
fontSize: 14,
|
|
22
|
+
lineHeight: 22,
|
|
23
|
+
},
|
|
24
|
+
16: {
|
|
25
|
+
fontSize: 16,
|
|
26
|
+
lineHeight: 24,
|
|
27
|
+
},
|
|
28
|
+
20: {
|
|
29
|
+
fontSize: 20,
|
|
30
|
+
lineHeight: 28,
|
|
31
|
+
},
|
|
32
|
+
32: {
|
|
33
|
+
fontSize: 32,
|
|
34
|
+
lineHeight: 40,
|
|
35
|
+
},
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export const halfLeading = ({ fontSize, lineHeight }: TypographyDescriptor) =>
|
|
39
|
+
(lineHeight - fontSize) / 2
|
|
40
|
+
|
|
41
|
+
export const TYPOGRAPHY_WEIGHT = [
|
|
42
|
+
/**
|
|
43
|
+
* Regular font weight
|
|
44
|
+
*
|
|
45
|
+
* <font-weight-absolute> ~ 400
|
|
46
|
+
*
|
|
47
|
+
* It should be the **DEFAULT** weight
|
|
48
|
+
*/
|
|
49
|
+
'regular',
|
|
50
|
+
/**
|
|
51
|
+
* Bolder than `regular` weight
|
|
52
|
+
*
|
|
53
|
+
* <font-weight-absolute> ~ 700
|
|
54
|
+
*/
|
|
55
|
+
'bold',
|
|
56
|
+
] as const
|
|
57
|
+
|
|
58
|
+
export type TypographyWeight = typeof TYPOGRAPHY_WEIGHT[number]
|
|
59
|
+
|
|
60
|
+
export const TYPOGRAPHY_VARIANT = [
|
|
61
|
+
/**
|
|
62
|
+
* Proportional font (which has the variable amount of horizontal space)
|
|
63
|
+
*
|
|
64
|
+
* It should be the **DEFAULT** variant
|
|
65
|
+
*/
|
|
66
|
+
'proportional',
|
|
67
|
+
/**
|
|
68
|
+
* Monospaced font (which has the same amount of horizontal space)
|
|
69
|
+
*/
|
|
70
|
+
'monospace',
|
|
71
|
+
] as const
|
|
72
|
+
|
|
73
|
+
export type TypographyVariant = typeof TYPOGRAPHY_VARIANT[number]
|