@mingjing-me/bazi-engine 0.0.0-stage → 0.2.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/CHANGELOG.md +21 -0
- package/LICENSE +199 -0
- package/README.md +108 -2
- package/dist/chart.d.ts +81 -0
- package/dist/chart.d.ts.map +1 -0
- package/dist/chart.js +167 -0
- package/dist/chart.js.map +1 -0
- package/dist/core.d.ts +29 -0
- package/dist/core.d.ts.map +1 -0
- package/dist/core.js +78 -0
- package/dist/core.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/liuyao.d.ts +61 -0
- package/dist/liuyao.d.ts.map +1 -0
- package/dist/liuyao.js +156 -0
- package/dist/liuyao.js.map +1 -0
- package/dist/mcp.d.ts +3 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +99 -0
- package/dist/mcp.js.map +1 -0
- package/dist/reverse.d.ts +27 -0
- package/dist/reverse.d.ts.map +1 -0
- package/dist/reverse.js +83 -0
- package/dist/reverse.js.map +1 -0
- package/dist/solar.d.ts +29 -0
- package/dist/solar.d.ts.map +1 -0
- package/dist/solar.js +60 -0
- package/dist/solar.js.map +1 -0
- package/dist/xiangfa.d.ts +28 -0
- package/dist/xiangfa.d.ts.map +1 -0
- package/dist/xiangfa.js +198 -0
- package/dist/xiangfa.js.map +1 -0
- package/package.json +66 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# CHANGELOG
|
|
2
|
+
|
|
3
|
+
## 0.2.0 — 2026-12-05
|
|
4
|
+
|
|
5
|
+
- 新增 MCP server(stdio):5 个工具 build_chart / build_chart_lunar / reverse_lookup / cast_liuyao / list_places,全部只读纯计算注解
|
|
6
|
+
- 登记进 MCP 官方 Registry:io.github.mingjing-me/bazi-engine
|
|
7
|
+
- 测试扩至 20 例(含 6 例 MCP stdio 按名调用)
|
|
8
|
+
|
|
9
|
+
## 0.1.0 — 2026-12-04
|
|
10
|
+
|
|
11
|
+
首个公开版本。明镜解ME 线上站同源事实层底座抽包:
|
|
12
|
+
|
|
13
|
+
- 四柱排盘:干支、十神、藏干分层、纳音、旬空、星运/自坐、神煞(11 种)、胎元胎息命宫身宫
|
|
14
|
+
- 大运起运细算:三天折一年,交节日时刻修正(1976 立冬案)
|
|
15
|
+
- 真太阳时:经度修正 + 均时差,内置约 48 城经度表
|
|
16
|
+
- 农历输入:含闰月(leapMonth)
|
|
17
|
+
- 晚子时双口径:默认东森口径换日(不认分早晚子时),same-day 兼容开关
|
|
18
|
+
- 排盘反查:任意柱组合反推阳历日期(默认 1900–2100)
|
|
19
|
+
- 六爻装卦事实层:世应、纳甲、六亲、六神、旬空、伏神、进退神(《火珠林》正法)
|
|
20
|
+
- 年代边界实测 1885–2150,与 lunar_python 交叉对照
|
|
21
|
+
- 测试 14 例全绿
|
package/LICENSE
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
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 infringement of copyrights) as
|
|
161
|
+
all liability is hereby expressly disclaimed.
|
|
162
|
+
|
|
163
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
164
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
165
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
166
|
+
or other liability obligations and/or rights consistent with this
|
|
167
|
+
License. However, in accepting such obligations, You may act only
|
|
168
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
169
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
170
|
+
defend, and hold each Contributor harmless for any liability
|
|
171
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
172
|
+
of your accepting any such warranty or additional liability.
|
|
173
|
+
|
|
174
|
+
END OF TERMS AND CONDITIONS
|
|
175
|
+
|
|
176
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
177
|
+
|
|
178
|
+
To apply the Apache License to your work, attach the following
|
|
179
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
180
|
+
replaced with your own identifying information. (Don't include
|
|
181
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
182
|
+
comment syntax for the file format. We also recommend that a
|
|
183
|
+
file or class name and description of purpose be included on the
|
|
184
|
+
same "printed page" as the copyright notice for easier
|
|
185
|
+
identification within third-party archives.
|
|
186
|
+
|
|
187
|
+
Copyright 2026 明镜解ME (mingjing.me)
|
|
188
|
+
|
|
189
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
190
|
+
you may not use this file except in compliance with the License.
|
|
191
|
+
You may obtain a copy of the License at
|
|
192
|
+
|
|
193
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
194
|
+
|
|
195
|
+
Unless required by applicable law or agreed to in writing, software
|
|
196
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
197
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
198
|
+
See the License for the specific language governing permissions and
|
|
199
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,109 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @mingjing-me/bazi-engine
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**八字排盘事实层引擎(TypeScript)** — 明镜解ME(mingjing.me)线上站同源底座。
|
|
4
|
+
|
|
5
|
+
只做「排盘事实」:四柱、藏干、十神、纳音、旬空、十二长生、神煞、胎元胎息命宫身宫、大运起运细算、六爻装卦。**不做吉凶判定**——强弱、格局、喜用是各家体系的分水岭,不在本库。
|
|
6
|
+
|
|
7
|
+
## 为什么是事实层
|
|
8
|
+
|
|
9
|
+
排盘错一点,后面全错。而排盘恰恰是命理工程里最「可验证」的部分:交节时刻、五鼠遁、六十甲子,全部有标准答案。本库把这些答案钉死成代码 + 测试,并与独立历法库(Python `lunar_python`)交叉对照。
|
|
10
|
+
|
|
11
|
+
## 安装
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @mingjing-me/bazi-engine
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## 给 AI 用(MCP)
|
|
18
|
+
|
|
19
|
+
本库自带 MCP server,AI 客户端(Claude / Kimi / Cursor 等)可直接调用排盘:
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
{ "mcpServers": { "bazi-engine": { "command": "npx", "args": ["@mingjing-me/bazi-engine"] } } }
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
5 个工具(全部只读纯计算):`build_chart`(阳历排盘)、`build_chart_lunar`(农历排盘)、`reverse_lookup`(排盘反查)、`cast_liuyao`(六爻装卦)、`list_places`(城市经度表)。
|
|
26
|
+
已登记进 MCP 官方 Registry:`io.github.mingjing-me/bazi-engine`。
|
|
27
|
+
|
|
28
|
+
## 快速上手
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import { buildChart, buildChartFromLunar, reverseLookup, castLiuYao } from '@mingjing-me/bazi-engine';
|
|
32
|
+
|
|
33
|
+
// 阳历排盘
|
|
34
|
+
const chart = buildChart(1990, 5, 20, 14, 30, '男');
|
|
35
|
+
console.log(chart.pillars.year.gan + chart.pillars.year.zhi); // 庚午
|
|
36
|
+
console.log(chart.daYunList.map(d => d.ganZhi)); // 大运序列
|
|
37
|
+
|
|
38
|
+
// 真太阳时:给城市名或经度
|
|
39
|
+
const c2 = buildChart(2000, 6, 1, 12, 30, '男', { place: '乌鲁木齐' });
|
|
40
|
+
console.log(c2.trueSolarText); // '2000-06-01 10:22'(钟表 12:30 → 真太阳时 10:22)
|
|
41
|
+
|
|
42
|
+
// 农历入口(闰月加 leapMonth)
|
|
43
|
+
const c3 = buildChartFromLunar(2023, 2, 15, 8, 0, '男', { leapMonth: true });
|
|
44
|
+
|
|
45
|
+
// 排盘反查:给任意柱组合,反推阳历日期
|
|
46
|
+
const hits = reverseLookup({ year: '己卯', month: '丙子', day: '戊午' }, { startYear: 1999, endYear: 2001 });
|
|
47
|
+
console.log(hits[0].solarText); // '2000-01-01'
|
|
48
|
+
|
|
49
|
+
// 六爻装卦(事实层:世应、纳甲、六亲、六神、旬空、伏神、进退神)
|
|
50
|
+
const gua = castLiuYao([7, 7, 7, 9, 8, 6], '甲子', '午');
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## 口径声明(重要)
|
|
54
|
+
|
|
55
|
+
排盘的「错」大半出在口径没说清。本库口径全部写死、全部可测:
|
|
56
|
+
|
|
57
|
+
### 1. 晚子时(23:00–23:59)换日
|
|
58
|
+
|
|
59
|
+
- **默认 `ziHourStyle: 'next-day'`**:晚子时日柱按次日排,时柱随次日日干起子。**作者(东森)不认「分早晚子时」**——同一夜的子时跨午夜必须同柱,这是本库默认且推荐的口径。
|
|
60
|
+
- `ziHourStyle: 'same-day'` 仅为兼容不换日流派保留,结果由调用方自行负责。
|
|
61
|
+
|
|
62
|
+
### 2. 交节日修正
|
|
63
|
+
|
|
64
|
+
底层历法库(lunar-javascript)的月柱/起运按「交节日 0 点」切。生在节气**当天、交节时刻之前**的,本库自动把月柱与大运整体退回上一节。
|
|
65
|
+
(锚定案:1976-11-07 立冬 14:58——当天 10:00 出生月柱戊戌,16:00 出生月柱己亥。)
|
|
66
|
+
|
|
67
|
+
### 3. 起运细算
|
|
68
|
+
|
|
69
|
+
顺行数到下一个节、逆行数到上一个节,三天折一年、一天折四个月(72 小时 ↔ 360 天)。节气表自动扩到前后各 40 天,年初年末出生不会落入兜底。
|
|
70
|
+
|
|
71
|
+
### 4. 农历闰月
|
|
72
|
+
|
|
73
|
+
`buildChartFromLunar(year, month, day, ...)` 遇闰月传 `{ leapMonth: true }`(底层历法库口径:闰月内部记为负月)。闰二月十五与二月十五是两个不同的日子,本库不会混排。
|
|
74
|
+
|
|
75
|
+
### 5. 真太阳时
|
|
76
|
+
|
|
77
|
+
`place`(内置约 48 城经度表)或 `longitude` 直接给经度;默认叠加均时差(`useEot: false` 可关)。交节判断与晚子时判定都以修正后时间为准。查不到的地名会抛错,不会静默按北京时间排。
|
|
78
|
+
|
|
79
|
+
### 6. 排盘反查精度
|
|
80
|
+
|
|
81
|
+
反查按「交节日 0 点」口径比对年/月柱(未细分交节时刻);交节日当天的临界盘请用 `buildChart` 复核。非法干支(含阴阳不配的「甲丑」一类)直接抛错。
|
|
82
|
+
|
|
83
|
+
## 年代范围
|
|
84
|
+
|
|
85
|
+
实测 1885–2150 正常出盘(测试覆盖),且与独立历法库 `lunar_python` 交叉验证一致。不做「1900 前 / 2100 后不能排」的人为限制。
|
|
86
|
+
|
|
87
|
+
## 数据层清单(每柱)
|
|
88
|
+
|
|
89
|
+
干支、十神(干/藏干/支本气)、藏干分层(本气/中气/余气)、纳音、所在旬、本柱旬空、星运(日主十二长生)、自坐(本干十二长生)、神煞(天乙贵人/文昌/桃花/驿马/华盖/羊刃/禄神/国印/金舆/天德/月德)、空亡标注;另有胎元、胎息、命宫、身宫四件套与大运序列(起运年、十神、五行)。
|
|
90
|
+
|
|
91
|
+
## 测试
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
npm test # tsc 构建 + node --test(14 例:交节临界/双口径/真太阳时/闰月/反查/边界/象法/六爻)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## 依赖与致谢
|
|
98
|
+
|
|
99
|
+
历法换算依赖 [lunar-javascript](https://github.com/6tail/lunar-javascript)(作者 6tail,MIT 许可)。本库在其历法能力之上做口径修正、象法数据层与工程封装。
|
|
100
|
+
|
|
101
|
+
## 边界声明
|
|
102
|
+
|
|
103
|
+
本库是**排盘底座**,不是断命程序。输出的是「盘上写着什么」,不是「这个命好不好」。判定层(强弱、格局、喜用、断语)属明镜解ME 私有体系,不开源。
|
|
104
|
+
|
|
105
|
+
## 作者与许可
|
|
106
|
+
|
|
107
|
+
**东森(明镜解ME)** · https://mingjing.me · mingjing.oss@qq.com
|
|
108
|
+
|
|
109
|
+
Apache-2.0。可自由使用(含商用);引用请注明出处。
|
package/dist/chart.d.ts
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { Gan, Zhi, WuXing, ShiShen } from './core.js';
|
|
2
|
+
import type { ChartGongs } from './xiangfa.js';
|
|
3
|
+
export interface Pillar {
|
|
4
|
+
gan: Gan;
|
|
5
|
+
zhi: Zhi;
|
|
6
|
+
ganShiShen: ShiShen | '日主';
|
|
7
|
+
cangGan: {
|
|
8
|
+
gan: Gan;
|
|
9
|
+
shiShen: ShiShen;
|
|
10
|
+
layer: '本气' | '中气' | '余气';
|
|
11
|
+
}[];
|
|
12
|
+
zhiShiShen: ShiShen;
|
|
13
|
+
isVoid: boolean;
|
|
14
|
+
nayin: string;
|
|
15
|
+
xun: string;
|
|
16
|
+
xunKong: string;
|
|
17
|
+
xingYun: string;
|
|
18
|
+
ziZuo: string;
|
|
19
|
+
shenSha: string[];
|
|
20
|
+
}
|
|
21
|
+
export interface DaYunInfo {
|
|
22
|
+
ganZhi: string;
|
|
23
|
+
gan: Gan;
|
|
24
|
+
zhi: Zhi;
|
|
25
|
+
ganShiShen: ShiShen;
|
|
26
|
+
zhiShiShen: ShiShen;
|
|
27
|
+
startYear: number;
|
|
28
|
+
endYear: number;
|
|
29
|
+
wuxing: {
|
|
30
|
+
gan: WuXing;
|
|
31
|
+
zhi: WuXing;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export interface Chart extends ChartGongs {
|
|
35
|
+
gender: '男' | '女';
|
|
36
|
+
solarText: string;
|
|
37
|
+
trueSolarText?: string;
|
|
38
|
+
lunarText?: string;
|
|
39
|
+
ziHourStyle: 'next-day' | 'same-day';
|
|
40
|
+
pillars: {
|
|
41
|
+
year: Pillar;
|
|
42
|
+
month: Pillar;
|
|
43
|
+
day: Pillar;
|
|
44
|
+
time: Pillar;
|
|
45
|
+
};
|
|
46
|
+
dayMaster: Gan;
|
|
47
|
+
dayMasterWuxing: WuXing;
|
|
48
|
+
dayMasterYinyang: '阳' | '阴';
|
|
49
|
+
monthZhi: Zhi;
|
|
50
|
+
voidZhi: [Zhi, Zhi];
|
|
51
|
+
yearVoidZhi: [Zhi, Zhi];
|
|
52
|
+
daYunList: DaYunInfo[];
|
|
53
|
+
qiYunAge: number;
|
|
54
|
+
startSolarText: string;
|
|
55
|
+
}
|
|
56
|
+
export interface ChartOptions {
|
|
57
|
+
/** 出生地:城市名(内置经度表)或经度数字。不给则不修正 */
|
|
58
|
+
place?: string | number;
|
|
59
|
+
/** 出生地经度(与 place 二选一,place 优先) */
|
|
60
|
+
longitude?: number;
|
|
61
|
+
/** 时区(小时),默认 8 */
|
|
62
|
+
tzOffset?: number;
|
|
63
|
+
/** 是否叠加均时差,默认 true(仅在给定经度时生效) */
|
|
64
|
+
useEot?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* 晚子时(23:00-23:59)口径:
|
|
67
|
+
* 'next-day' 日柱按次日排(东森定口径,默认);'same-day' 不换日(兼容流派)。
|
|
68
|
+
*/
|
|
69
|
+
ziHourStyle?: 'next-day' | 'same-day';
|
|
70
|
+
}
|
|
71
|
+
export declare function buildPillar(ganzhi: string, dayGan: Gan, voidZhi: Zhi[]): Pillar;
|
|
72
|
+
export declare function buildChart(year: number, month: number, day: number, hour: number, minute: number, gender: '男' | '女', opts?: ChartOptions): Chart;
|
|
73
|
+
/**
|
|
74
|
+
* 农历入口:农历年月日(+时辰)排盘。
|
|
75
|
+
* @param lunarMonth 农历月份 1-12;闰月传 opts.leapMonth=true(历法库口径:闰月内部记为负月)
|
|
76
|
+
* 其余选项(真太阳时、晚子时口径)与 buildChart 一致——农历输入同样支持出生地修正。
|
|
77
|
+
*/
|
|
78
|
+
export declare function buildChartFromLunar(lunarYear: number, lunarMonth: number, lunarDay: number, hour: number, minute: number, gender: '男' | '女', opts?: ChartOptions & {
|
|
79
|
+
leapMonth?: boolean;
|
|
80
|
+
}): Chart;
|
|
81
|
+
//# sourceMappingURL=chart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart.d.ts","sourceRoot":"","sources":["../src/chart.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAG3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,WAAW,MAAM;IACrB,GAAG,EAAE,GAAG,CAAC;IAAC,GAAG,EAAE,GAAG,CAAC;IACnB,UAAU,EAAE,OAAO,GAAG,IAAI,CAAC;IAC3B,OAAO,EAAE;QAAE,GAAG,EAAE,GAAG,CAAC;QAAC,OAAO,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,IAAI,GAAC,IAAI,GAAC,IAAI,CAAA;KAAE,EAAE,CAAC;IACjE,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;IAEhB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,GAAG,CAAC;IAAC,GAAG,EAAE,GAAG,CAAC;IACnC,UAAU,EAAE,OAAO,CAAC;IAAC,UAAU,EAAE,OAAO,CAAC;IACzC,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IACnC,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;CACtC;AAED,MAAM,WAAW,KAAM,SAAQ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,EAAE,MAAM,EAAE,MAAM,EACtE,MAAM,EAAE,GAAG,GAAC,GAAG,EAAE,IAAI,GAAE,YAAiB,GACvC,KAAK,CA2HP;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EACvD,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAC,GAAG,EAC7C,IAAI,GAAE,YAAY,GAAG;IAAE,SAAS,CAAC,EAAE,OAAO,CAAA;CAAO,GAChD,KAAK,CAOP"}
|
package/dist/chart.js
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
// 八字排盘核心:四柱、大运起运细算、象法回填
|
|
2
|
+
// 口径说明(与原明镜解ME引擎同源):
|
|
3
|
+
// - 晚子时换日(东森 2026-10-14 定口径):晚子时(23:00-23:59)日柱按次日排,时柱随次日日干起子。
|
|
4
|
+
// 本库同时提供 ziHourStyle 开关兼容不换日流派(详见 README)。
|
|
5
|
+
// - 交节日修正:lunar-javascript 的月柱/起运按「交节日 0 点」切,生在节气当天、交节时刻之前的,
|
|
6
|
+
// 月柱与大运整体退回上一节(1976 年立冬 11-07 14:58 案)。
|
|
7
|
+
// - 起运细算:顺行数到下一个节、逆行数到上一个节,三天折一年、一天折四个月(72小时↔360天)。
|
|
8
|
+
import { Solar, Lunar } from 'lunar-javascript';
|
|
9
|
+
import { GANS, ZHIS, GAN_WUXING, ZHI_WUXING, GAN_YINYANG, ZHI_CANGGAN, shiShenOf, } from './core.js';
|
|
10
|
+
import { NAYIN, xunOf, xunKongOfGanZhi, changShengOf, shenShaOn, chartGongsOf } from './xiangfa.js';
|
|
11
|
+
import { resolveLongitude, solarCorrectionMinutes, applyCorrection } from './solar.js';
|
|
12
|
+
export function buildPillar(ganzhi, dayGan, voidZhi) {
|
|
13
|
+
const gan = ganzhi[0], zhi = ganzhi[1];
|
|
14
|
+
const cang = ZHI_CANGGAN[zhi];
|
|
15
|
+
return {
|
|
16
|
+
gan, zhi,
|
|
17
|
+
ganShiShen: gan === dayGan ? '日主' : shiShenOf(dayGan, gan),
|
|
18
|
+
cangGan: cang.map((g, i) => ({
|
|
19
|
+
gan: g, shiShen: shiShenOf(dayGan, g),
|
|
20
|
+
// 藏干分层:两支藏干者(午、亥)第二气为中气而非余气——午中己、亥中甲按中气计权
|
|
21
|
+
layer: (cang.length === 1 || i === 0) ? '本气' : (i === 1 ? '中气' : '余气')
|
|
22
|
+
})),
|
|
23
|
+
zhiShiShen: shiShenOf(dayGan, cang[0]),
|
|
24
|
+
isVoid: voidZhi.includes(zhi),
|
|
25
|
+
nayin: NAYIN[ganzhi] || '',
|
|
26
|
+
xun: xunOf(ganzhi),
|
|
27
|
+
xunKong: xunKongOfGanZhi(ganzhi).join(''),
|
|
28
|
+
xingYun: changShengOf(dayGan, zhi),
|
|
29
|
+
ziZuo: changShengOf(gan, zhi),
|
|
30
|
+
shenSha: [],
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
const fmt = (y, m, d, h, mi) => `${y}-${String(m).padStart(2, '0')}-${String(d).padStart(2, '0')} ${String(h).padStart(2, '0')}:${String(mi).padStart(2, '0')}`;
|
|
34
|
+
export function buildChart(year, month, day, hour, minute, gender, opts = {}) {
|
|
35
|
+
// ① 真太阳时修正(可选):钟表时间 → 当地真太阳时。交节判断与晚子时判定都以修正后时间为准。
|
|
36
|
+
let t = { year, month, day, hour, minute };
|
|
37
|
+
let trueSolarText;
|
|
38
|
+
const lon = opts.place !== undefined ? resolveLongitude(opts.place)
|
|
39
|
+
: (opts.longitude !== undefined ? resolveLongitude(opts.longitude) : undefined);
|
|
40
|
+
if (lon !== undefined) {
|
|
41
|
+
const corr = solarCorrectionMinutes(t.year, t.month, t.day, { longitude: lon, tzOffset: opts.tzOffset, useEot: opts.useEot });
|
|
42
|
+
t = applyCorrection(t, corr);
|
|
43
|
+
trueSolarText = fmt(t.year, t.month, t.day, t.hour, t.minute);
|
|
44
|
+
}
|
|
45
|
+
// ② 晚子时换日(东森 2026-10-14 定口径,默认):晚子时(23:00-23:59)日柱按次日排,时柱随次日日干起子。
|
|
46
|
+
// 早子时(00:00-00:59)日柱就是当日,不做平移——同一夜的子时跨午夜必须同柱。
|
|
47
|
+
// ziHourStyle='same-day' 时跳过平移(兼容不换日流派)。
|
|
48
|
+
// ③ 真实出生时刻(不做晚子时平移):交节日修正必须以此为准——
|
|
49
|
+
// 晚子时(23点)先平移到次日再对节气表,平移后的日期不是交节日,修正不触发
|
|
50
|
+
// (2026-06-05 23:45 芒种前3分钟案:月柱应为癸巳,误排甲午)。
|
|
51
|
+
const ziHourStyle = opts.ziHourStyle ?? 'next-day';
|
|
52
|
+
const birthSolar = Solar.fromYmdHms(t.year, t.month, t.day, t.hour, t.minute, 0);
|
|
53
|
+
let calcSolar = birthSolar;
|
|
54
|
+
if (ziHourStyle === 'next-day' && t.hour === 23) {
|
|
55
|
+
const nextDay = birthSolar.next(1); // 次日
|
|
56
|
+
calcSolar = Solar.fromYmdHms(nextDay.getYear(), nextDay.getMonth(), nextDay.getDay(), 0, t.minute, 0);
|
|
57
|
+
}
|
|
58
|
+
const lunar = calcSolar.getLunar();
|
|
59
|
+
const ec = lunar.getEightChar();
|
|
60
|
+
const dayGan = ec.getDayGan();
|
|
61
|
+
const voidZhi = ec.getDayXunKong().split('');
|
|
62
|
+
const yearVoidZhi = ec.getYearXunKong().split('');
|
|
63
|
+
// 交节日口径修正:lunar-javascript 的月柱/起运按「交节日 0 点」切,
|
|
64
|
+
// 生在节气当天、交节时刻之前的,月柱与大运整体退回上一节。
|
|
65
|
+
const JIE_ORDER = ['小寒', '立春', '惊蛰', '清明', '立夏', '芒种', '小暑', '立秋', '白露', '寒露', '立冬', '大雪'];
|
|
66
|
+
const fixTerm = (() => {
|
|
67
|
+
const ymd = `${birthSolar.getYear()}-${String(birthSolar.getMonth()).padStart(2, '0')}-${String(birthSolar.getDay()).padStart(2, '0')}`;
|
|
68
|
+
for (const name of JIE_ORDER) {
|
|
69
|
+
const term = birthSolar.getLunar().getJieQiTable()[name];
|
|
70
|
+
if (term && term.toYmd() === ymd) {
|
|
71
|
+
const bt = birthSolar.getHour() * 3600 + birthSolar.getMinute() * 60;
|
|
72
|
+
const tt = term.getHour() * 3600 + term.getMinute() * 60 + term.getSecond();
|
|
73
|
+
return { name, termSolar: term, beforeTerm: bt < tt };
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return null;
|
|
77
|
+
})();
|
|
78
|
+
let monthGanZhi = ec.getMonth();
|
|
79
|
+
let yun = ec.getYun(gender === '男' ? 1 : 0);
|
|
80
|
+
if (fixTerm?.beforeTerm) {
|
|
81
|
+
// 用前一天的月柱(必在上一节区间内),大运与起运手工重排
|
|
82
|
+
monthGanZhi = birthSolar.next(-1).getLunar().getEightChar().getMonth();
|
|
83
|
+
const mg = monthGanZhi[0], mz = monthGanZhi[1];
|
|
84
|
+
const forward = (GAN_YINYANG[ec.getYearGan()] === '阳') === (gender === '男'); // 阳男阴女顺行
|
|
85
|
+
const step = forward ? 1 : -1;
|
|
86
|
+
// 起运:节气表扩到前后各40天三张表——年初年末出生的「上一个节」查不到会落入72小时兜底
|
|
87
|
+
const birthMs = Date.UTC(birthSolar.getYear(), birthSolar.getMonth() - 1, birthSolar.getDay(), birthSolar.getHour(), birthSolar.getMinute());
|
|
88
|
+
const jieSolars = Array.from(new Map([birthSolar, birthSolar.next(-40), birthSolar.next(40)]
|
|
89
|
+
.flatMap(s => JIE_ORDER.map(n => s.getLunar().getJieQiTable()[n]))
|
|
90
|
+
.filter(Boolean)
|
|
91
|
+
.map((s) => [Date.UTC(s.getYear(), s.getMonth() - 1, s.getDay(), s.getHour(), s.getMinute()), s])).entries()).map(([ms, s]) => ({ ms, s })).sort((a, b) => a.ms - b.ms);
|
|
92
|
+
const target = forward
|
|
93
|
+
? jieSolars.find(j => j.ms > birthMs)
|
|
94
|
+
: [...jieSolars].reverse().find(j => j.ms <= birthMs);
|
|
95
|
+
const hoursToTerm = target ? Math.abs(target.ms - birthMs) / 3600000 : 72;
|
|
96
|
+
const qiYunMs = birthMs + (hoursToTerm / 72) * 360 * 86400000;
|
|
97
|
+
const qiYunDate = new Date(qiYunMs);
|
|
98
|
+
const qiYunYear = qiYunDate.getUTCFullYear();
|
|
99
|
+
const gI = GANS.indexOf(mg), zI = ZHIS.indexOf(mz);
|
|
100
|
+
const manual = [];
|
|
101
|
+
for (let i = 1; i <= 8; i++) {
|
|
102
|
+
const g = GANS[(gI + step * i + 120) % 10], z = ZHIS[(zI + step * i + 120) % 12];
|
|
103
|
+
manual.push({
|
|
104
|
+
ganZhi: g + z, gan: g, zhi: z,
|
|
105
|
+
ganShiShen: shiShenOf(dayGan, g),
|
|
106
|
+
zhiShiShen: shiShenOf(dayGan, ZHI_CANGGAN[z][0]),
|
|
107
|
+
startYear: qiYunYear + (i - 1) * 10,
|
|
108
|
+
endYear: qiYunYear + (i - 1) * 10 + 9,
|
|
109
|
+
wuxing: { gan: GAN_WUXING[g], zhi: ZHI_WUXING[z] },
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
yun = { getStartSolar: () => Solar.fromYmd(qiYunYear, qiYunDate.getUTCMonth() + 1, qiYunDate.getUTCDate()), getDaYun: () => [], _manual: manual };
|
|
113
|
+
}
|
|
114
|
+
const pillars = {
|
|
115
|
+
year: buildPillar(ec.getYear(), dayGan, voidZhi),
|
|
116
|
+
month: buildPillar(monthGanZhi, dayGan, voidZhi),
|
|
117
|
+
day: buildPillar(ec.getDay(), dayGan, voidZhi),
|
|
118
|
+
time: buildPillar(ec.getTime(), dayGan, voidZhi),
|
|
119
|
+
};
|
|
120
|
+
const startSolar = yun.getStartSolar();
|
|
121
|
+
const qiYunAge = startSolar.getYear() - t.year;
|
|
122
|
+
// 神煞按柱回填(年支、日支双查锚;月支作天德月德锚)
|
|
123
|
+
const anchors = [pillars.year.zhi, pillars.day.zhi];
|
|
124
|
+
[pillars.year, pillars.month, pillars.day, pillars.time]
|
|
125
|
+
.forEach(p => { p.shenSha = shenShaOn(p.gan, p.zhi, dayGan, anchors, pillars.month.zhi); });
|
|
126
|
+
const daYunList = (yun._manual || yun.getDaYun().slice(1, 9)).map((dy) => {
|
|
127
|
+
if (yun._manual)
|
|
128
|
+
return dy;
|
|
129
|
+
const gz = dy.getGanZhi();
|
|
130
|
+
const g = gz[0], z = gz[1];
|
|
131
|
+
return {
|
|
132
|
+
ganZhi: gz, gan: g, zhi: z,
|
|
133
|
+
ganShiShen: shiShenOf(dayGan, g),
|
|
134
|
+
zhiShiShen: shiShenOf(dayGan, ZHI_CANGGAN[z][0]),
|
|
135
|
+
startYear: dy.getStartYear(), endYear: dy.getEndYear(),
|
|
136
|
+
wuxing: { gan: GAN_WUXING[g], zhi: ZHI_WUXING[z] }
|
|
137
|
+
};
|
|
138
|
+
});
|
|
139
|
+
return {
|
|
140
|
+
gender,
|
|
141
|
+
solarText: fmt(year, month, day, hour, minute),
|
|
142
|
+
...(trueSolarText ? { trueSolarText } : {}),
|
|
143
|
+
ziHourStyle,
|
|
144
|
+
pillars, dayMaster: dayGan,
|
|
145
|
+
dayMasterWuxing: GAN_WUXING[dayGan],
|
|
146
|
+
dayMasterYinyang: GAN_YINYANG[dayGan],
|
|
147
|
+
monthZhi: pillars.month.zhi,
|
|
148
|
+
voidZhi, yearVoidZhi,
|
|
149
|
+
daYunList, qiYunAge,
|
|
150
|
+
startSolarText: startSolar.toYmd(),
|
|
151
|
+
...chartGongsOf(pillars.year.gan, monthGanZhi, ec.getDay(), pillars.time.zhi),
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* 农历入口:农历年月日(+时辰)排盘。
|
|
156
|
+
* @param lunarMonth 农历月份 1-12;闰月传 opts.leapMonth=true(历法库口径:闰月内部记为负月)
|
|
157
|
+
* 其余选项(真太阳时、晚子时口径)与 buildChart 一致——农历输入同样支持出生地修正。
|
|
158
|
+
*/
|
|
159
|
+
export function buildChartFromLunar(lunarYear, lunarMonth, lunarDay, hour, minute, gender, opts = {}) {
|
|
160
|
+
const lunar = Lunar.fromYmdHms(lunarYear, opts.leapMonth ? -lunarMonth : lunarMonth, lunarDay, hour, minute, 0);
|
|
161
|
+
const solar = lunar.getSolar();
|
|
162
|
+
const chart = buildChart(solar.getYear(), solar.getMonth(), solar.getDay(), hour, minute, gender, opts);
|
|
163
|
+
const leapMark = opts.leapMonth ? '闰' : '';
|
|
164
|
+
chart.lunarText = `农历${lunarYear}年${leapMark}${lunarMonth}月${lunarDay}日`;
|
|
165
|
+
return chart;
|
|
166
|
+
}
|
|
167
|
+
//# sourceMappingURL=chart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart.js","sourceRoot":"","sources":["../src/chart.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,qBAAqB;AACrB,gEAAgE;AAChE,8CAA8C;AAC9C,8DAA8D;AAC9D,2CAA2C;AAC3C,qDAAqD;AACrD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EACL,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAC5D,SAAS,GACV,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACpG,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AA2DvF,MAAM,UAAU,WAAW,CAAC,MAAc,EAAE,MAAW,EAAE,OAAc;IACrE,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAQ,EAAE,GAAG,GAAG,MAAM,CAAC,CAAC,CAAQ,CAAC;IACrD,MAAM,IAAI,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;IAC9B,OAAO;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,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;IAChH,MAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC/B,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,CAAC,QAAQ,EAAE,EAAE,KAAK,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IACxG,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3C,KAAK,CAAC,SAAS,GAAG,KAAK,SAAS,IAAI,QAAQ,GAAG,UAAU,IAAI,QAAQ,GAAG,CAAC;IACzE,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/core.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export type Gan = '甲' | '乙' | '丙' | '丁' | '戊' | '己' | '庚' | '辛' | '壬' | '癸';
|
|
2
|
+
export type Zhi = '子' | '丑' | '寅' | '卯' | '辰' | '巳' | '午' | '未' | '申' | '酉' | '戌' | '亥';
|
|
3
|
+
export type WuXing = '木' | '火' | '土' | '金' | '水';
|
|
4
|
+
export declare const GANS: Gan[];
|
|
5
|
+
export declare const ZHIS: Zhi[];
|
|
6
|
+
export declare const GAN_WUXING: Record<Gan, WuXing>;
|
|
7
|
+
export declare const ZHI_WUXING: Record<Zhi, WuXing>;
|
|
8
|
+
export declare const GAN_YINYANG: Record<Gan, '阳' | '阴'>;
|
|
9
|
+
export declare const ZHI_CANGGAN: Record<Zhi, Gan[]>;
|
|
10
|
+
export declare const SHENG: Record<WuXing, WuXing>;
|
|
11
|
+
export declare const KE: Record<WuXing, WuXing>;
|
|
12
|
+
export type ShiShen = '比肩' | '劫财' | '食神' | '伤官' | '偏财' | '正财' | '七杀' | '正官' | '偏印' | '正印';
|
|
13
|
+
export declare function shiShenOf(dayGan: Gan, otherGan: Gan): ShiShen;
|
|
14
|
+
export declare function shiShenGroup(s: ShiShen): '比劫' | '食伤' | '财' | '官杀' | '印';
|
|
15
|
+
export declare const CHONG: [Zhi, Zhi][];
|
|
16
|
+
export declare const LIUHE: [Zhi, Zhi][];
|
|
17
|
+
export declare const HAI: [Zhi, Zhi][];
|
|
18
|
+
export declare const SANHE: [Zhi, Zhi, Zhi, WuXing][];
|
|
19
|
+
export declare const SANHUI: [Zhi, Zhi, Zhi, WuXing][];
|
|
20
|
+
export declare const SANXING: [Zhi, Zhi, Zhi][];
|
|
21
|
+
export declare const HUXING: [Zhi, Zhi][];
|
|
22
|
+
export declare const ZIXING: Zhi[];
|
|
23
|
+
export declare const GANHE: [Gan, Gan, WuXing][];
|
|
24
|
+
export declare const GANCHONG: [Gan, Gan][];
|
|
25
|
+
export declare const ZHANGSHENG: Record<Gan, Zhi>;
|
|
26
|
+
export declare const LU: Record<Gan, Zhi>;
|
|
27
|
+
export declare const DIWANG: Record<Gan, Zhi>;
|
|
28
|
+
export declare const MUKU: Record<WuXing, Zhi>;
|
|
29
|
+
//# sourceMappingURL=core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,GAAG,GAAG,GAAG,GAAC,GAAG,GAAC,GAAG,GAAC,GAAG,GAAC,GAAG,GAAC,GAAG,GAAC,GAAG,GAAC,GAAG,GAAC,GAAG,GAAC,GAAG,CAAC;AAC1D,MAAM,MAAM,GAAG,GAAG,GAAG,GAAC,GAAG,GAAC,GAAG,GAAC,GAAG,GAAC,GAAG,GAAC,GAAG,GAAC,GAAG,GAAC,GAAG,GAAC,GAAG,GAAC,GAAG,GAAC,GAAG,GAAC,GAAG,CAAC;AAClE,MAAM,MAAM,MAAM,GAAG,GAAG,GAAC,GAAG,GAAC,GAAG,GAAC,GAAG,GAAC,GAAG,CAAC;AAEzC,eAAO,MAA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