speakid-build-a-sentence 1.0.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/README.md ADDED
@@ -0,0 +1,67 @@
1
+ # @speakid/build-a-sentence
2
+
3
+ Magic Sentence Game - Interactive word building game for SPEAKID platform
4
+
5
+ ## Установка
6
+
7
+ ```bash
8
+ npm install @speakid/build-a-sentence
9
+ ```
10
+
11
+ ## Использование
12
+
13
+ ### Базовое использование
14
+ ```tsx
15
+ import { MagicSentence, ErrorBoundary } from '@speakid/build-a-sentence';
16
+
17
+ function GamePage() {
18
+ return (
19
+ <div style={{ width: '100%', height: '100vh' }}>
20
+ <ErrorBoundary>
21
+ <MagicSentence />
22
+ </ErrorBoundary>
23
+ </div>
24
+ );
25
+ }
26
+ ```
27
+
28
+ ### Использование с baseURL (для SPEAKID)
29
+ ```tsx
30
+ import { MagicSentence, ErrorBoundary } from '@speakid/build-a-sentence';
31
+
32
+ function GamePage() {
33
+ // Для MinIO с URL encoding (рекомендуется)
34
+ const baseURL = window.origin + "/cloud/speakid/games/magic%20sentence";
35
+
36
+ return (
37
+ <div style={{ width: '100%', height: '100vh' }}>
38
+ <ErrorBoundary>
39
+ <MagicSentence baseURL={baseURL} />
40
+ </ErrorBoundary>
41
+ </div>
42
+ );
43
+ }
44
+ ```
45
+
46
+ **Примечание**:
47
+ - Логотип должен быть загружен в `/cloud/speakid/games/magic sentence/logo.svg`
48
+ - Компонент автоматически добавит `/logo.svg` к переданному baseURL
49
+ - URL с `%20` (URL-encoded пробел) работает корректно
50
+
51
+ ### Дополнительные опции
52
+ ```tsx
53
+ // С кастомным логотипом
54
+ <MagicSentence logoUrl="https://speakid.com/logo.svg" />
55
+
56
+ // Без логотипа
57
+ <MagicSentence showLogo={false} />
58
+
59
+ // С baseURL для изображений
60
+ <MagicSentence baseURL="https://speakid.com/cloud/games/" />
61
+ ```
62
+
63
+ ## Требования
64
+
65
+ - React >= 18.2.0
66
+ - React DOM >= 18.2.0
67
+ - Webpack (CRA совместимый)
package/dist/Game.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ export interface GameProps {
2
+ logoUrl?: string;
3
+ showLogo?: boolean;
4
+ baseURL?: string;
5
+ }
6
+ export default function Game({ logoUrl, showLogo, baseURL }?: GameProps): import("react/jsx-runtime").JSX.Element;
7
+ //# sourceMappingURL=Game.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Game.d.ts","sourceRoot":"","sources":["../src/Game.tsx"],"names":[],"mappings":"AAkDA,MAAM,WAAW,SAAS;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,EAAE,OAAO,EAAE,QAAe,EAAE,OAAO,EAAE,GAAE,SAAc,2CA09BjF"}
@@ -0,0 +1,3 @@
1
+ import { CSSProperties } from "react";
2
+ export declare const styles: Record<string, CSSProperties>;
3
+ //# sourceMappingURL=Game.styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Game.styles.d.ts","sourceRoot":"","sources":["../src/Game.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAoEtC,eAAO,MAAM,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CA4MhD,CAAC"}
@@ -0,0 +1,19 @@
1
+ import React, { Component, ErrorInfo, ReactNode } from 'react';
2
+ interface Props {
3
+ children: ReactNode;
4
+ fallback?: ReactNode;
5
+ }
6
+ interface State {
7
+ hasError: boolean;
8
+ error?: Error;
9
+ errorInfo?: ErrorInfo;
10
+ }
11
+ export declare class ErrorBoundary extends Component<Props, State> {
12
+ constructor(props: Props);
13
+ static getDerivedStateFromError(error: Error): State;
14
+ componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
15
+ handleReset: () => void;
16
+ render(): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined;
17
+ }
18
+ export {};
19
+ //# sourceMappingURL=ErrorBoundary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ErrorBoundary.d.ts","sourceRoot":"","sources":["../../src/components/ErrorBoundary.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE/D,UAAU,KAAK;IACb,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,UAAU,KAAK;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAED,qBAAa,aAAc,SAAQ,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC;gBAC5C,KAAK,EAAE,KAAK;IAKxB,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK;IAOpD,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS;IAYpD,WAAW,aAET;IAEF,MAAM;CAoEP"}
@@ -0,0 +1,15 @@
1
+ export interface ValidationError {
2
+ type: 'length' | 'characters' | 'empty' | 'duplicate';
3
+ message: string;
4
+ }
5
+ export interface ValidationResult {
6
+ isValid: boolean;
7
+ errors: ValidationError[];
8
+ }
9
+ export declare const useValidation: () => {
10
+ errors: ValidationError[];
11
+ validateSentence: (sentence: string, index: number, allSentences: string[]) => ValidationResult;
12
+ validateAllSentences: (sentences: string[]) => ValidationResult;
13
+ clearErrors: () => void;
14
+ };
15
+ //# sourceMappingURL=useValidation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useValidation.d.ts","sourceRoot":"","sources":["../../src/hooks/useValidation.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,QAAQ,GAAG,YAAY,GAAG,OAAO,GAAG,WAAW,CAAC;IACtD,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,eAAe,EAAE,CAAC;CAC3B;AAED,eAAO,MAAM,aAAa;;iCAGwB,MAAM,SAAS,MAAM,gBAAgB,MAAM,EAAE,KAAG,gBAAgB;sCA4C3D,MAAM,EAAE,KAAG,gBAAgB;;CA2BjF,CAAC"}
@@ -0,0 +1,9 @@
1
+ import Game from "./Game";
2
+ import { ErrorBoundary } from "./components/ErrorBoundary";
3
+ import { useValidation } from "./hooks/useValidation";
4
+ import { createAriaLabel, handleKeyDown, announceToScreenReader } from "./utils/accessibility";
5
+ export default Game;
6
+ export { Game, ErrorBoundary, useValidation, createAriaLabel, handleKeyDown, announceToScreenReader };
7
+ export type { ValidationError, ValidationResult } from "./hooks/useValidation";
8
+ export type { GameProps } from "./Game";
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAG/F,eAAe,IAAI,CAAC;AAGpB,OAAO,EACL,IAAI,EACJ,aAAa,EACb,aAAa,EACb,eAAe,EACf,aAAa,EACb,sBAAsB,EACvB,CAAC;AAGF,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAG/E,YAAY,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC"}
package/dist/logo.png ADDED
Binary file