@kbss-cvut/s-forms 0.9.1 → 0.9.2-beta-bfb894d.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.
@@ -18,6 +18,64 @@ export default class MediaAssetViewerUtils {
18
18
  kind: "video" | "image" | "iframe";
19
19
  type: string | null;
20
20
  };
21
+ /**
22
+ * Determines the media kind from an asset identifier. MediaCMS-provided
23
+ * assets encode the kind in their `@id`
24
+ * (e.g. `.../media-metadata/video/<id>/asset`), so the kind can be resolved
25
+ * without inspecting the (extension-less) source URL.
26
+ *
27
+ * @param {string} id - Asset `@id`.
28
+ * @returns {{ kind: "video" | "image", type: string | null } | null}
29
+ */
30
+ static getMediaKindFromId(id: string): {
31
+ kind: "video" | "image";
32
+ type: string | null;
33
+ } | null;
34
+ /**
35
+ * Resolves the media kind synchronously from the information available in the
36
+ * form data: the source URL extension first, then the asset `@id` hint.
37
+ * Returns an `iframe` fallback when neither is conclusive.
38
+ *
39
+ * @returns {{ kind: "video" | "image" | "iframe", type: string | null }}
40
+ */
41
+ static getMediaKind(src: any, id: any): {
42
+ kind: "video" | "image" | "iframe";
43
+ type: string | null;
44
+ };
45
+ /**
46
+ * Maps an HTTP Content-Type to a media kind.
47
+ *
48
+ * @param {string|null} contentType - Raw `Content-Type` header value.
49
+ * @returns {{ kind: "video" | "image", type: string | null } | null}
50
+ * The resolved kind, or `null` when the type is not a renderable media type.
51
+ */
52
+ static getMediaKindFromContentType(contentType: string | null): {
53
+ kind: "video" | "image";
54
+ type: string | null;
55
+ } | null;
56
+ /**
57
+ * Reads the `Content-Type` of a source via a lightweight HEAD request.
58
+ * Returns `null` on any failure (network error, CORS, non-OK response).
59
+ */
60
+ static probeContentType(src: any): Promise<string | null>;
61
+ /**
62
+ * Checks whether a source loads as an image. Works cross-origin without CORS
63
+ * (an `<img>` load is not CORS-gated), so it is a reliable fallback when the
64
+ * Content-Type probe is blocked.
65
+ */
66
+ static probeIsImage(src: any): Promise<any>;
67
+ /**
68
+ * Resolves the media kind for a source. Uses the synchronous hints (URL
69
+ * extension and asset `@id`) first; only when those are inconclusive does it
70
+ * fall back to the response Content-Type and, if that is unavailable (e.g.
71
+ * blocked by CORS), to an image-load probe.
72
+ *
73
+ * @returns {Promise<{ kind: "video" | "image" | "iframe", type: string | null }>}
74
+ */
75
+ static resolveMediaKind(src: any, id: any): Promise<{
76
+ kind: "video" | "image" | "iframe";
77
+ type: string | null;
78
+ }>;
21
79
  /**
22
80
  * Converts normalized annotation points into viewport pixel coordinates.
23
81
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kbss-cvut/s-forms",
3
- "version": "0.9.1",
3
+ "version": "0.9.2-beta-bfb894d.0",
4
4
  "description": "Semantic forms generator and processor",
5
5
  "keywords": [
6
6
  "react",
@@ -1,5 +0,0 @@
1
- export default OptimizedMenuList;
2
- /**
3
- * Uses react-window to optimize menu list in react-select in case it has a lot of options.
4
- */
5
- declare function OptimizedMenuList(props: any): import("react/jsx-runtime").JSX.Element;
@@ -1,29 +0,0 @@
1
- declare class SelectAnswer extends React.Component<any, any, any> {
2
- constructor(props: any);
3
- constructor(props: any, context: any);
4
- _generateSelectOptions(options: any): import("react/jsx-runtime").JSX.Element[];
5
- render(): React.DetailedReactHTMLElement<{
6
- type: string;
7
- label: any;
8
- value: any;
9
- title: any;
10
- validation: any;
11
- onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
12
- disabled: any;
13
- }, HTMLElement>;
14
- }
15
- declare namespace SelectAnswer {
16
- export { ConfigurationContext as contextType };
17
- export namespace propTypes {
18
- let question: PropTypes.Validator<object>;
19
- let label: PropTypes.Validator<object>;
20
- let title: PropTypes.Requireable<string>;
21
- let value: PropTypes.Requireable<string>;
22
- let onChange: PropTypes.Validator<(...args: any[]) => any>;
23
- let validation: PropTypes.Requireable<object>;
24
- }
25
- }
26
- export default SelectAnswer;
27
- import React from "react";
28
- import { ConfigurationContext } from "../../contexts/ConfigurationContext";
29
- import PropTypes from "prop-types";
@@ -1,14 +0,0 @@
1
- export default TypeaheadAnswer;
2
- declare function TypeaheadAnswer(props: any): import("react/jsx-runtime").JSX.Element;
3
- declare namespace TypeaheadAnswer {
4
- namespace propTypes {
5
- let question: PropTypes.Validator<object>;
6
- let answer: PropTypes.Validator<object>;
7
- let label: PropTypes.Validator<NonNullable<NonNullable<string | object | null | undefined>>>;
8
- let title: PropTypes.Requireable<string>;
9
- let value: PropTypes.Requireable<string>;
10
- let onChange: PropTypes.Validator<(...args: any[]) => any>;
11
- let validation: PropTypes.Requireable<object>;
12
- }
13
- }
14
- import PropTypes from "prop-types";
@@ -1,3 +0,0 @@
1
- declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0fc72a6d").R, any>;
2
- export default _default;
3
- export declare const TypeaheadAnswerTree: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, any>;