@nakamura-123/pages 1.4.1 → 1.4.3
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/dist/component/Article/ArticleContentView.d.ts +5 -1
- package/dist/component/Article/ArticleContentView.js +199 -34
- package/dist/component/Article/ArticleContents.js +5 -4
- package/dist/component/Article/ArticleImage.d.ts +9 -0
- package/dist/component/Article/ArticleImage.js +46 -0
- package/dist/component/Article/ArticleSectionPager.d.ts +17 -0
- package/dist/component/Article/ArticleSectionPager.js +193 -0
- package/dist/component/Article/ArticleTable.d.ts +10 -0
- package/dist/component/Article/ArticleTable.js +74 -0
- package/dist/component/Article/ChipStrip.d.ts +10 -0
- package/dist/component/Article/ChipStrip.js +82 -0
- package/dist/component/Article/Cloze.d.ts +31 -0
- package/dist/component/Article/Cloze.js +338 -0
- package/dist/component/Article/FramesFigure.d.ts +27 -0
- package/dist/component/Article/FramesFigure.js +438 -0
- package/dist/component/Article/RefLink.d.ts +42 -0
- package/dist/component/Article/RefLink.js +184 -0
- package/dist/component/Basic/BasicContents.js +5 -4
- package/dist/component/Basic/MiniTestCard.js +3 -2
- package/dist/component/Grade/GAllTags.js +3 -4
- package/dist/component/Rating/RatingBar.d.ts +9 -0
- package/dist/component/Rating/RatingBar.js +358 -0
- package/dist/component/Rating/keyboardScroll.d.ts +7 -0
- package/dist/component/Rating/keyboardScroll.js +37 -0
- package/dist/component/Result/QuizFlatList.js +11 -10
- package/dist/component/Result/ResultActions.js +151 -58
- package/dist/component/Result/ResultHero.js +19 -18
- package/dist/component/SettingBtns/LanguageModal.js +1 -0
- package/dist/functions/articleContentFnc.d.ts +49 -1
- package/dist/functions/articleContentFnc.js +191 -2
- package/dist/functions/joinTitleFnc.d.ts +1 -0
- package/dist/functions/joinTitleFnc.js +15 -0
- package/dist/functions/ratingFnc.d.ts +4 -0
- package/dist/functions/ratingFnc.js +30 -0
- package/dist/hooks/resultHook.d.ts +2 -1
- package/dist/hooks/resultHook.js +13 -1
- package/dist/page/ArticleDetail.js +58 -15
- package/dist/page/ArticlePage.js +4 -1
- package/dist/page/BasicPage.js +4 -1
- package/dist/page/ImgZoom.d.ts +4 -3
- package/dist/page/ImgZoom.js +16 -2
- package/dist/page/QuizPage.js +23 -11
- package/dist/page/ReportPage.js +3 -2
- package/dist/quiz/QuizContentsDrill.js +26 -16
- package/dist/quiz/common/MyTextqqyy.d.ts +4 -0
- package/dist/quiz/common/MyTextqqyy.js +14 -4
- package/dist/quiz/common/renderTransUdl.d.ts +3 -0
- package/dist/quiz/common/renderTransUdl.js +20 -0
- package/dist/quiz/explain/ExplainLogic.d.ts +1 -0
- package/dist/quiz/explain/ExplainLogic.js +3 -2
- package/dist/quiz/explain/NormalExplain.js +3 -0
- package/dist/quiz/grammar/GQuestion.js +13 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.ExampleText = exports.ClozeText = exports.RUBY_LINE_EM = exports.ClozeBar = exports.useLessonSearch = exports.ClozeProvider = void 0;
|
|
27
|
+
const react_1 = __importStar(require("react"));
|
|
28
|
+
const react_native_1 = require("react-native");
|
|
29
|
+
const lib_1 = require("@nakamura-123/lib");
|
|
30
|
+
const common_1 = require("@nakamura-123/common");
|
|
31
|
+
const MyTextqqyy_1 = require("../../quiz/common/MyTextqqyy");
|
|
32
|
+
const RefLink_1 = require("./RefLink");
|
|
33
|
+
const articleContentFnc_1 = require("../../functions/articleContentFnc");
|
|
34
|
+
const MathView = require("react-native-math-view").default;
|
|
35
|
+
const ClozeContext = (0, react_1.createContext)(null);
|
|
36
|
+
// 開いたかどうかは保存しない(10/24の決定)。LESSONではページごと、名札の無い記事では記事全体で1つ持つ。
|
|
37
|
+
// 開いた答えは押しても閉じない(押すのは検索に使う)。隠し直すのはページの上の「全部隠す」で行う
|
|
38
|
+
const ClozeProvider = ({ blocks, searchEnabled, children }) => {
|
|
39
|
+
const groups = (0, react_1.useMemo)(() => (0, articleContentFnc_1.clozeGroups)(blocks), [blocks]);
|
|
40
|
+
const pageImages = (0, react_1.useMemo)(() => blocks.flatMap((b) => (b.type === "image" ? [b.name] : [])), [blocks]);
|
|
41
|
+
const [opened, setOpened] = (0, react_1.useState)(new Set());
|
|
42
|
+
const value = (0, react_1.useMemo)(() => ({
|
|
43
|
+
groups,
|
|
44
|
+
opened,
|
|
45
|
+
open: (group) => setOpened((prev) => prev.has(group) ? prev : new Set(prev).add(group)),
|
|
46
|
+
setAll: (open) => setOpened(open ? new Set(groups) : new Set()),
|
|
47
|
+
searchEnabled,
|
|
48
|
+
pageImages,
|
|
49
|
+
}), [groups, opened, searchEnabled, pageImages]);
|
|
50
|
+
return (<ClozeContext.Provider value={value}>{children}</ClozeContext.Provider>);
|
|
51
|
+
};
|
|
52
|
+
exports.ClozeProvider = ClozeProvider;
|
|
53
|
+
const useLessonSearch = () => { var _a, _b; return (_b = (_a = (0, react_1.useContext)(ClozeContext)) === null || _a === void 0 ? void 0 : _a.searchEnabled) !== null && _b !== void 0 ? _b : false; };
|
|
54
|
+
exports.useLessonSearch = useLessonSearch;
|
|
55
|
+
// 穴の数と、全部を開ける・隠すボタン。穴の無いページには出さない。
|
|
56
|
+
// 1つでも閉じていれば「全部見る」、1つでも開いていれば「全部隠す」を出す(途中までは両方)
|
|
57
|
+
const ClozeBar = () => {
|
|
58
|
+
const cloze = (0, react_1.useContext)(ClozeContext);
|
|
59
|
+
const { t } = (0, common_1.useDrillTranslation)();
|
|
60
|
+
if (!cloze || cloze.groups.length === 0)
|
|
61
|
+
return null;
|
|
62
|
+
const openCount = cloze.groups.filter((g) => cloze.opened.has(g)).length;
|
|
63
|
+
return (<react_native_1.View style={styles.bar}>
|
|
64
|
+
<common_1.MyText fsize="xs" weight={700} color="ltBlack">
|
|
65
|
+
{t("article.clozeCount", {
|
|
66
|
+
open: openCount,
|
|
67
|
+
total: cloze.groups.length,
|
|
68
|
+
})}
|
|
69
|
+
</common_1.MyText>
|
|
70
|
+
<react_native_1.View style={styles.barButtons}>
|
|
71
|
+
{openCount > 0 && (<common_1.PressAnimatedWrap onPress={() => cloze.setAll(false)} style={styles.barButton}>
|
|
72
|
+
<common_1.MyText fsize="xs" weight={700} color="text">
|
|
73
|
+
{t("article.hideAllAnswers")}
|
|
74
|
+
</common_1.MyText>
|
|
75
|
+
</common_1.PressAnimatedWrap>)}
|
|
76
|
+
{openCount < cloze.groups.length && (<common_1.PressAnimatedWrap onPress={() => cloze.setAll(true)} style={styles.barButton}>
|
|
77
|
+
<common_1.MyText fsize="xs" weight={700} color="text">
|
|
78
|
+
{t("article.showAllAnswers")}
|
|
79
|
+
</common_1.MyText>
|
|
80
|
+
</common_1.PressAnimatedWrap>)}
|
|
81
|
+
</react_native_1.View>
|
|
82
|
+
</react_native_1.View>);
|
|
83
|
+
};
|
|
84
|
+
exports.ClozeBar = ClozeBar;
|
|
85
|
+
// ふりがなのある例文の行の高さ(文字の何個分か)。よみの分だけ上を空ける
|
|
86
|
+
exports.RUBY_LINE_EM = 2.3;
|
|
87
|
+
// よみと漢字を縦に積んだ箱。文の中の箱は下端が基準線にそろうので、漢字の下の空き(descent)の分だけ下げて外の文字と並べる。
|
|
88
|
+
// 箱の幅は漢字の幅にし、よみは左右にはみ出して置く(よみの幅で箱を取ると「新 しい」のように漢字の後ろが空く)
|
|
89
|
+
const RubyWord = ({ base, ruby, fsize, weight }) => {
|
|
90
|
+
const px = (0, articleContentFnc_1.fsizeToPx)(fsize);
|
|
91
|
+
const rubyLine = px * 0.62;
|
|
92
|
+
return (<react_native_1.View style={{
|
|
93
|
+
paddingTop: rubyLine,
|
|
94
|
+
transform: [{ translateY: px * 0.57 }],
|
|
95
|
+
}}>
|
|
96
|
+
<common_1.MyText fsize={fsize} weight={weight} color="text" style={{ lineHeight: px * 1.2 }}>
|
|
97
|
+
{base}
|
|
98
|
+
</common_1.MyText>
|
|
99
|
+
<common_1.MyText fsize="xs" weight={500} color="ltBlack" numberOfLines={1} style={[
|
|
100
|
+
styles.rubyText,
|
|
101
|
+
{
|
|
102
|
+
left: -px,
|
|
103
|
+
right: -px,
|
|
104
|
+
fontSize: px * 0.5,
|
|
105
|
+
lineHeight: rubyLine,
|
|
106
|
+
},
|
|
107
|
+
]}>
|
|
108
|
+
{ruby}
|
|
109
|
+
</common_1.MyText>
|
|
110
|
+
</react_native_1.View>);
|
|
111
|
+
};
|
|
112
|
+
// 穴は文字の並びの中に置く箱で描く(数式の部品と同じやり方)。押すと箱が答えの幅まで広がり、後ろの文字は少しずつ押し出される
|
|
113
|
+
// (一度に答えを入れると、後ろの文字が一瞬で飛んで読みにくいため)
|
|
114
|
+
const ClozeText = ({ text, fsize, weight, style, groupOf, holeEm = 4.5, ruby = false, }) => {
|
|
115
|
+
const cloze = (0, react_1.useContext)(ClozeContext);
|
|
116
|
+
const figRef = (0, RefLink_1.useRefLink)();
|
|
117
|
+
const parts = (0, articleContentFnc_1.splitCloze)(text);
|
|
118
|
+
// 何番目の穴か(表のセルの穴の組の名前に使う)
|
|
119
|
+
const holeIndex = parts.map((_, i) => parts.slice(0, i).filter((p) => p.type === "hole").length);
|
|
120
|
+
const px = (0, articleContentFnc_1.fsizeToPx)(fsize);
|
|
121
|
+
// 行の高さを決めた文(段落・ポイント枠)では、高い箱を置いても行が広がらず、上の行に重なる
|
|
122
|
+
const isFixedLine = typeof (style === null || style === void 0 ? void 0 : style.lineHeight) === "number";
|
|
123
|
+
const lineHeight = isFixedLine ? style.lineHeight : px * 1.45;
|
|
124
|
+
const hasMath = parts.some((p) => p.type === "math");
|
|
125
|
+
const [containerWidth, setContainerWidth] = (0, react_1.useState)(0);
|
|
126
|
+
const [sizes, setSizes] = (0, react_1.useState)({});
|
|
127
|
+
return (<react_native_1.View onLayout={(e) => setContainerWidth(e.nativeEvent.layout.width)}>
|
|
128
|
+
<common_1.MyText fsize={fsize} weight={weight} color="text"
|
|
129
|
+
// 数式のある行は、数式の部品(MyTextqqyy)と同じく上を少し空ける
|
|
130
|
+
style={Object.assign(Object.assign({}, style), (hasMath ? styles.mathLine : null))}>
|
|
131
|
+
{parts.map((part, i) => {
|
|
132
|
+
var _a, _b;
|
|
133
|
+
if (part.type === "text")
|
|
134
|
+
return ruby
|
|
135
|
+
? (0, articleContentFnc_1.splitRuby)(part.content).map((r, k) => r.ruby ? (<RubyWord key={`${i}-${k}`} base={r.base} ruby={r.ruby} fsize={fsize} weight={weight}/>) : (r.base))
|
|
136
|
+
: part.content;
|
|
137
|
+
// 検索語は解説と同じ形(下線を引いた灰色の文字)
|
|
138
|
+
if (part.type === "search")
|
|
139
|
+
return (cloze === null || cloze === void 0 ? void 0 : cloze.searchEnabled) ? (<common_1.MyText key={i} fsize={fsize} weight={weight} color="ltBlack" style={styles.searchText} onPress={() => lib_1.utilFnc.handleSearch(part.content)}>
|
|
140
|
+
{part.content}
|
|
141
|
+
</common_1.MyText>) : (part.content);
|
|
142
|
+
if (part.type === "figref") {
|
|
143
|
+
// 図は指す文より上に置く決まりなので「上の図」。2枚あれば名前で分ける
|
|
144
|
+
if (cloze === null || cloze === void 0 ? void 0 : cloze.pageImages.includes(part.content))
|
|
145
|
+
return cloze.pageImages.length === 1
|
|
146
|
+
? "上の図"
|
|
147
|
+
: `${(_a = figRef === null || figRef === void 0 ? void 0 : figRef.nameOf(part.content)) !== null && _a !== void 0 ? _a : part.content}の図`;
|
|
148
|
+
return <RefLink_1.FigChip key={i} name={part.content} fsize={fsize}/>;
|
|
149
|
+
}
|
|
150
|
+
if (part.type === "math")
|
|
151
|
+
return (<MathView key={i} math={part.content} config={MyTextqqyy_1.mathConfigs[fsize]}/>);
|
|
152
|
+
const g = groupOf ? groupOf(holeIndex[i]) : (0, articleContentFnc_1.holeGroup)(part.content);
|
|
153
|
+
return (<HoleBox key={i} answer={ruby ? (0, articleContentFnc_1.stripRuby)(part.content) : part.content} isOpen={(_b = cloze === null || cloze === void 0 ? void 0 : cloze.opened.has(g)) !== null && _b !== void 0 ? _b : true} onOpen={() => cloze === null || cloze === void 0 ? void 0 : cloze.open(g)} onSearch={part.search && (cloze === null || cloze === void 0 ? void 0 : cloze.searchEnabled)
|
|
154
|
+
? () => lib_1.utilFnc.handleSearch(part.content)
|
|
155
|
+
: undefined} fsize={fsize} px={px} lineHeight={lineHeight} closedWidth={px * holeEm} maxWidth={containerWidth} size={sizes[i]} canGrow={!isFixedLine}/>);
|
|
156
|
+
})}
|
|
157
|
+
</common_1.MyText>
|
|
158
|
+
{/* 答えの幅を測るための見えない文字。文の幅で折り返させ、行の数と一番長い行の幅を取る。
|
|
159
|
+
Androidでは文字にpointerEventsが効かず、見えない文字が段落の上の行に乗って穴を押せなくなる(2026-11-08、Pixel 8a)。
|
|
160
|
+
押しても素通りする箱に入れる */}
|
|
161
|
+
<react_native_1.View pointerEvents="none" style={react_native_1.StyleSheet.absoluteFill}>
|
|
162
|
+
{containerWidth > 0 &&
|
|
163
|
+
parts.map((part, i) => part.type === "hole" ? (<common_1.MyText key={`m${i}`} fsize={fsize} weight={700} style={[styles.measure, { width: containerWidth, lineHeight }]} onTextLayout={(e) => {
|
|
164
|
+
const lines = e.nativeEvent.lines;
|
|
165
|
+
const width = Math.max(0, ...lines.map((l) => l.width));
|
|
166
|
+
setSizes((prev) => {
|
|
167
|
+
var _a, _b;
|
|
168
|
+
return ((_a = prev[i]) === null || _a === void 0 ? void 0 : _a.width) === width && ((_b = prev[i]) === null || _b === void 0 ? void 0 : _b.lines) === lines.length
|
|
169
|
+
? prev
|
|
170
|
+
: Object.assign(Object.assign({}, prev), { [i]: { width, lines: lines.length } });
|
|
171
|
+
});
|
|
172
|
+
}}>
|
|
173
|
+
{ruby ? (0, articleContentFnc_1.stripRuby)(part.content) : part.content}
|
|
174
|
+
</common_1.MyText>) : null)}
|
|
175
|
+
</react_native_1.View>
|
|
176
|
+
</react_native_1.View>);
|
|
177
|
+
};
|
|
178
|
+
exports.ClozeText = ClozeText;
|
|
179
|
+
// 説明の例文。穴(ana[])は例文ごとに1組で開き、LESSONと同じ箱で描く。
|
|
180
|
+
// ふりがな((漢字)ff(よみ))は、よみと漢字を縦に積んだ小さな箱を文字の並びに置いて描く
|
|
181
|
+
const ExampleText = ({ text, group, fsize, weight, style, }) => {
|
|
182
|
+
const ruby = (0, articleContentFnc_1.hasRuby)(text);
|
|
183
|
+
if (ruby || (0, articleContentFnc_1.hasCloze)(text))
|
|
184
|
+
return (<exports.ClozeText text={text} fsize={fsize} weight={weight}
|
|
185
|
+
// ふりがなの箱が上の行に重ならないよう、行を高くそろえる(行ごとに高さが変わると読みにくい)
|
|
186
|
+
style={ruby
|
|
187
|
+
? Object.assign(Object.assign({}, style), { lineHeight: (0, articleContentFnc_1.fsizeToPx)(fsize) * exports.RUBY_LINE_EM }) : style} groupOf={() => group} ruby={ruby}/>);
|
|
188
|
+
return (<common_1.MyText fsize={fsize} weight={weight} color="text" style={style}>
|
|
189
|
+
{text}
|
|
190
|
+
</common_1.MyText>);
|
|
191
|
+
};
|
|
192
|
+
exports.ExampleText = ExampleText;
|
|
193
|
+
const HOLE_MARGIN = 2;
|
|
194
|
+
// MyTextの太字の字間
|
|
195
|
+
const BOLD_LETTER_SPACING = 0.6;
|
|
196
|
+
// 箱が広がる・縮む時間。短いと一度に飛んで見え、長いと待たされる。シミュレータで見て決める
|
|
197
|
+
const HOLE_DURATION = 250;
|
|
198
|
+
const HoleBox = ({ answer, isOpen, onOpen, onSearch, fsize, px, lineHeight, closedWidth, maxWidth, size, canGrow, }) => {
|
|
199
|
+
var _a;
|
|
200
|
+
const progress = (0, react_1.useRef)(new react_native_1.Animated.Value(isOpen ? 1 : 0)).current;
|
|
201
|
+
(0, react_1.useEffect)(() => {
|
|
202
|
+
react_native_1.Animated.timing(progress, {
|
|
203
|
+
toValue: isOpen ? 1 : 0,
|
|
204
|
+
duration: HOLE_DURATION,
|
|
205
|
+
easing: react_native_1.Easing.out(react_native_1.Easing.cubic),
|
|
206
|
+
// 幅は並びを決める値なので、描く側(ネイティブ)だけでは動かせない
|
|
207
|
+
useNativeDriver: false,
|
|
208
|
+
}).start();
|
|
209
|
+
}, [isOpen]);
|
|
210
|
+
// 文の中の箱は下端が基準線にそろう。高さを基準線より上の分(1.16em)にして、行を押し広げないようにする。
|
|
211
|
+
// 答えが行の幅を超えるときは、箱の中で折り返し、増えた行の分だけ箱を高くする
|
|
212
|
+
const closedHeight = px * 1.16;
|
|
213
|
+
const lines = (_a = size === null || size === void 0 ? void 0 : size.lines) !== null && _a !== void 0 ? _a : 1;
|
|
214
|
+
// 1行に入らない長い答え(段落の4,004個のうち3個)は、箱にせず文字として折り返して出す。広がる動きは無い
|
|
215
|
+
if (lines > 1 && !canGrow && isOpen)
|
|
216
|
+
return (<common_1.MyText fsize={fsize} weight={700} color="red" style={onSearch ? styles.searchAnswer : undefined} onPress={onSearch}>
|
|
217
|
+
{answer}
|
|
218
|
+
</common_1.MyText>);
|
|
219
|
+
const isWrappedText = lines > 1 && !canGrow;
|
|
220
|
+
const openWidth = isWrappedText
|
|
221
|
+
? closedWidth
|
|
222
|
+
: size
|
|
223
|
+
? // 測った幅には最後の文字の後ろの字間(太字で0.6)も入るので、その分を詰める
|
|
224
|
+
Math.min(Math.ceil(size.width - BOLD_LETTER_SPACING), maxWidth)
|
|
225
|
+
: closedWidth;
|
|
226
|
+
const openHeight = isWrappedText
|
|
227
|
+
? closedHeight
|
|
228
|
+
: closedHeight + (lines - 1) * lineHeight;
|
|
229
|
+
const width = progress.interpolate({
|
|
230
|
+
inputRange: [0, 1],
|
|
231
|
+
outputRange: [closedWidth, openWidth],
|
|
232
|
+
});
|
|
233
|
+
const height = progress.interpolate({
|
|
234
|
+
inputRange: [0, 1],
|
|
235
|
+
outputRange: [closedHeight, openHeight],
|
|
236
|
+
});
|
|
237
|
+
// 箱の中の文字を、外の文字と同じ高さの行に置く(箱の上端は基準線から1.16em上)
|
|
238
|
+
const textTop = -(lineHeight - px * 1.45) / 2;
|
|
239
|
+
return (<react_native_1.Animated.View style={{
|
|
240
|
+
width,
|
|
241
|
+
height,
|
|
242
|
+
// 閉じた箱どうし・文字との間を少し空ける。開いたら答えは文の一部なので空けない
|
|
243
|
+
marginHorizontal: progress.interpolate({
|
|
244
|
+
inputRange: [0, 1],
|
|
245
|
+
outputRange: [HOLE_MARGIN, 0],
|
|
246
|
+
}),
|
|
247
|
+
}}>
|
|
248
|
+
<react_native_1.Animated.View style={[
|
|
249
|
+
react_native_1.StyleSheet.absoluteFill,
|
|
250
|
+
styles.hole,
|
|
251
|
+
{
|
|
252
|
+
opacity: progress.interpolate({
|
|
253
|
+
inputRange: [0, 1],
|
|
254
|
+
outputRange: [1, 0],
|
|
255
|
+
}),
|
|
256
|
+
},
|
|
257
|
+
]}/>
|
|
258
|
+
<react_native_1.Animated.View style={[
|
|
259
|
+
styles.answerClip,
|
|
260
|
+
{ top: textTop, width, height: lines * lineHeight },
|
|
261
|
+
]}>
|
|
262
|
+
<react_native_1.Animated.View style={{ opacity: progress }}>
|
|
263
|
+
<common_1.MyText fsize={fsize} weight={700} color="red"
|
|
264
|
+
// 測ったときと同じ幅で並べる(箱の幅で並べると、詰めた分で最後の文字が次の行へ送られて隠れてしまう)
|
|
265
|
+
style={[
|
|
266
|
+
{ width: maxWidth, lineHeight },
|
|
267
|
+
onSearch ? styles.searchAnswer : null,
|
|
268
|
+
]}>
|
|
269
|
+
{answer}
|
|
270
|
+
</common_1.MyText>
|
|
271
|
+
</react_native_1.Animated.View>
|
|
272
|
+
</react_native_1.Animated.View>
|
|
273
|
+
{(!isOpen || onSearch) && (<react_native_1.Pressable style={styles.holeTouch} onPress={isOpen ? onSearch : onOpen}/>)}
|
|
274
|
+
</react_native_1.Animated.View>);
|
|
275
|
+
};
|
|
276
|
+
const styles = react_native_1.StyleSheet.create({
|
|
277
|
+
bar: {
|
|
278
|
+
flexDirection: "row",
|
|
279
|
+
alignItems: "center",
|
|
280
|
+
justifyContent: "space-between",
|
|
281
|
+
marginBottom: 10,
|
|
282
|
+
},
|
|
283
|
+
barButtons: {
|
|
284
|
+
flexDirection: "row",
|
|
285
|
+
gap: 6,
|
|
286
|
+
},
|
|
287
|
+
barButton: {
|
|
288
|
+
paddingHorizontal: 10,
|
|
289
|
+
paddingVertical: 4,
|
|
290
|
+
borderRadius: 999,
|
|
291
|
+
borderWidth: 1,
|
|
292
|
+
borderColor: lib_1.colors.light,
|
|
293
|
+
backgroundColor: lib_1.colors.white,
|
|
294
|
+
},
|
|
295
|
+
hole: {
|
|
296
|
+
borderRadius: 4,
|
|
297
|
+
backgroundColor: lib_1.colors.beige,
|
|
298
|
+
borderBottomWidth: 2,
|
|
299
|
+
borderBottomColor: lib_1.colors.red,
|
|
300
|
+
},
|
|
301
|
+
searchText: {
|
|
302
|
+
textDecorationLine: "underline",
|
|
303
|
+
textDecorationColor: lib_1.colors.black,
|
|
304
|
+
},
|
|
305
|
+
// 検索語にした答え。開いた後に下線が出て、押せば検索できると分かる
|
|
306
|
+
searchAnswer: {
|
|
307
|
+
textDecorationLine: "underline",
|
|
308
|
+
textDecorationColor: lib_1.colors.red,
|
|
309
|
+
},
|
|
310
|
+
mathLine: {
|
|
311
|
+
marginTop: 5,
|
|
312
|
+
},
|
|
313
|
+
rubyText: {
|
|
314
|
+
position: "absolute",
|
|
315
|
+
top: 0,
|
|
316
|
+
textAlign: "center",
|
|
317
|
+
letterSpacing: 0,
|
|
318
|
+
},
|
|
319
|
+
measure: {
|
|
320
|
+
position: "absolute",
|
|
321
|
+
left: 0,
|
|
322
|
+
top: 0,
|
|
323
|
+
opacity: 0,
|
|
324
|
+
},
|
|
325
|
+
answerClip: {
|
|
326
|
+
position: "absolute",
|
|
327
|
+
left: 0,
|
|
328
|
+
overflow: "hidden",
|
|
329
|
+
},
|
|
330
|
+
// 押せる所は、箱の上下に少し広げる(文字1行の高さでは押しにくいため)
|
|
331
|
+
holeTouch: {
|
|
332
|
+
position: "absolute",
|
|
333
|
+
left: 0,
|
|
334
|
+
right: 0,
|
|
335
|
+
top: -6,
|
|
336
|
+
bottom: -6,
|
|
337
|
+
},
|
|
338
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { StackNavigationProp } from "@react-navigation/stack";
|
|
3
|
+
import { Nav } from "@nakamura-123/types";
|
|
4
|
+
export interface FrameNode {
|
|
5
|
+
t: string;
|
|
6
|
+
a: Record<string, string>;
|
|
7
|
+
c?: FrameNode[];
|
|
8
|
+
x?: string;
|
|
9
|
+
s?: number;
|
|
10
|
+
u?: number;
|
|
11
|
+
}
|
|
12
|
+
export interface FramesData {
|
|
13
|
+
v: [number, number, number, number];
|
|
14
|
+
steps: number;
|
|
15
|
+
captions: string[];
|
|
16
|
+
defs: FrameNode[];
|
|
17
|
+
nodes: FrameNode[];
|
|
18
|
+
}
|
|
19
|
+
interface Props {
|
|
20
|
+
name: string;
|
|
21
|
+
data: FramesData;
|
|
22
|
+
startAt: "first" | "last";
|
|
23
|
+
navigation: StackNavigationProp<Nav.RootStackParamList>;
|
|
24
|
+
zoomPath?: number;
|
|
25
|
+
}
|
|
26
|
+
declare const FramesFigure: React.FC<Props>;
|
|
27
|
+
export default FramesFigure;
|