@doubao-dev/taro-runtime 0.9.0 → 0.10.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 +117 -0
- package/assets/refresh-loading.png +0 -0
- package/dist/api/base/can-i-use.d.ts +3 -0
- package/dist/api/base/can-i-use.js +12 -0
- package/dist/api/base/event-center.d.ts +12 -0
- package/dist/api/base/event-center.js +52 -0
- package/dist/api/base/index.d.ts +1 -1
- package/dist/api/base/index.js +1 -1
- package/dist/api/base/next-tick.d.ts +3 -0
- package/dist/api/base/next-tick.js +11 -0
- package/dist/api/canvas/index.d.ts +17 -0
- package/dist/api/canvas/index.js +29 -0
- package/dist/api/create-animation.d.ts +47 -0
- package/dist/api/create-animation.js +98 -0
- package/dist/api/create-intersection-observer/index.d.ts +7 -0
- package/dist/api/create-intersection-observer/index.js +126 -0
- package/dist/api/create-selector-query/index.js +284 -109
- package/dist/api/device/accelerometer.js +1 -1
- package/dist/api/device/accessibility.js +1 -1
- package/dist/api/device/battery.js +1 -1
- package/dist/api/device/beacon.js +1 -1
- package/dist/api/device/bluetooth.js +1 -1
- package/dist/api/device/clipboard.js +1 -1
- package/dist/api/device/compass.js +1 -1
- package/dist/api/device/crypto.js +1 -1
- package/dist/api/device/device-motion.js +1 -1
- package/dist/api/device/gyroscope.js +1 -1
- package/dist/api/device/keyboard.js +1 -1
- package/dist/api/device/scan.js +1 -1
- package/dist/api/device/screen.js +1 -1
- package/dist/api/device/sms.js +1 -1
- package/dist/api/device/vibration.js +1 -1
- package/dist/api/device/wifi.js +1 -1
- package/dist/api/index.d.ts +8 -1
- package/dist/api/index.js +8 -1
- package/dist/api/interaction/index.js +1 -1
- package/dist/api/location/index.d.ts +2 -2
- package/dist/api/location/index.js +1 -1
- package/dist/api/media/image.d.ts +9 -0
- package/dist/api/media/image.js +21 -1
- package/dist/api/media/index.d.ts +2 -0
- package/dist/api/media/index.js +2 -0
- package/dist/api/media/inner-audio.d.ts +5 -0
- package/dist/api/media/inner-audio.js +7 -0
- package/dist/api/media/media.d.ts +6 -0
- package/dist/api/media/media.js +9 -0
- package/dist/api/px-transform.d.ts +11 -0
- package/dist/api/px-transform.js +31 -0
- package/dist/api/request/index.js +1 -1
- package/dist/api/request/websocket.js +1 -1
- package/dist/api/router/current-instance.d.ts +17 -0
- package/dist/api/router/current-instance.js +28 -0
- package/dist/api/router/exit-mini-program.js +1 -1
- package/dist/api/router/get-current-pages.d.ts +13 -1
- package/dist/api/router/get-current-pages.js +5 -3
- package/dist/api/router/index.d.ts +1 -0
- package/dist/api/router/index.js +1 -0
- package/dist/api/router/navigate-back.js +1 -1
- package/dist/api/router/navigate-to.js +1 -1
- package/dist/api/router/re-launch.js +1 -1
- package/dist/api/router/redirect-to.js +1 -1
- package/dist/api/runtime/download.d.ts +11 -0
- package/dist/api/runtime/download.js +18 -0
- package/dist/api/runtime/resize.d.ts +7 -0
- package/dist/api/runtime/resize.js +26 -0
- package/dist/api/runtime/system.d.ts +8 -0
- package/dist/api/runtime/system.js +10 -0
- package/dist/api/show-toast/index.js +1 -1
- package/dist/api/storage/index.d.ts +1 -1
- package/dist/api/storage/index.js +1 -1
- package/dist/api/system/index.js +1 -1
- package/dist/components/Block/index.d.ts +3 -0
- package/dist/components/Block/index.jsx +4 -0
- package/dist/components/Button/index.d.ts +7 -0
- package/dist/components/Button/index.jsx +28 -0
- package/dist/components/Canvas/index.d.ts +4 -0
- package/dist/components/Canvas/index.jsx +25 -0
- package/dist/components/Checkbox/index.d.ts +3 -0
- package/dist/components/Checkbox/index.jsx +17 -0
- package/dist/components/CheckboxGroup/index.d.ts +3 -0
- package/dist/components/CheckboxGroup/index.jsx +13 -0
- package/dist/components/CoverView/index.d.ts +6 -1
- package/dist/components/CoverView/index.js +5 -1
- package/dist/components/Form/index.d.ts +4 -0
- package/dist/components/Form/index.jsx +39 -0
- package/dist/components/Form/use-form-field.d.ts +5 -0
- package/dist/components/Form/use-form-field.js +40 -0
- package/dist/components/Icon/index.d.ts +3 -0
- package/dist/components/Icon/index.jsx +40 -0
- package/dist/components/Image/index.d.ts +3 -1
- package/dist/components/Image/index.jsx +15 -4
- package/dist/components/Input/index.d.ts +1 -1
- package/dist/components/Input/index.jsx +9 -5
- package/dist/components/Input/map.d.ts +1 -1
- package/dist/components/Label/control.d.ts +6 -0
- package/dist/components/Label/control.js +29 -0
- package/dist/components/Label/index.d.ts +3 -0
- package/dist/components/Label/index.jsx +15 -0
- package/dist/components/LivePlayer/index.d.ts +3 -0
- package/dist/components/LivePlayer/index.jsx +8 -0
- package/dist/components/Map/bridge.d.ts +1 -1
- package/dist/components/Map/index.jsx +10 -6
- package/dist/components/Movable/index.d.ts +4 -0
- package/dist/components/Movable/index.jsx +26 -0
- package/dist/components/NavigationBar/index.d.ts +3 -0
- package/dist/components/NavigationBar/index.jsx +16 -0
- package/dist/components/Navigator/index.d.ts +3 -0
- package/dist/components/Navigator/index.jsx +32 -0
- package/dist/components/OpenData/index.d.ts +3 -0
- package/dist/components/OpenData/index.js +4 -0
- package/dist/components/Picker/index.d.ts +6 -0
- package/dist/components/Picker/index.jsx +155 -0
- package/dist/components/Picker/popup.d.ts +18 -0
- package/dist/components/Picker/popup.jsx +105 -0
- package/dist/components/PickerView/index.d.ts +1 -1
- package/dist/components/PickerView/index.jsx +1 -1
- package/dist/components/PickerView/map.d.ts +1 -1
- package/dist/components/Progress/index.d.ts +3 -0
- package/dist/components/Progress/index.jsx +14 -0
- package/dist/components/Radio/index.jsx +9 -5
- package/dist/components/Radio/shared.d.ts +1 -1
- package/dist/components/RadioGroup/context.js +1 -1
- package/dist/components/RadioGroup/index.jsx +8 -4
- package/dist/components/RadioGroup/map.d.ts +1 -1
- package/dist/components/RichText/index.d.ts +3 -0
- package/dist/components/RichText/index.jsx +7 -0
- package/dist/components/ScrollView/index.d.ts +4 -1
- package/dist/components/ScrollView/index.jsx +44 -14
- package/dist/components/ScrollView/map.d.ts +4 -2
- package/dist/components/ScrollView/map.js +19 -1
- package/dist/components/ScrollView/refresh-types.d.ts +25 -0
- package/dist/components/ScrollView/refresh-types.js +2 -0
- package/dist/components/ScrollView/refresh.d.ts +10 -0
- package/dist/components/ScrollView/refresh.jsx +29 -0
- package/dist/components/ScrollView/use-refresher.d.ts +19 -0
- package/dist/components/ScrollView/use-refresher.js +214 -0
- package/dist/components/Slider/index.d.ts +3 -0
- package/dist/components/Slider/index.jsx +13 -0
- package/dist/components/Swiper/index.d.ts +3 -0
- package/dist/components/Swiper/index.jsx +79 -0
- package/dist/components/SwiperItem/index.d.ts +3 -0
- package/dist/components/SwiperItem/index.jsx +18 -0
- package/dist/components/Switch/index.d.ts +3 -0
- package/dist/components/Switch/index.jsx +32 -0
- package/dist/components/Text/format.d.ts +5 -0
- package/dist/components/Text/format.js +51 -0
- package/dist/components/Text/index.d.ts +4 -3
- package/dist/components/Text/index.jsx +3 -2
- package/dist/components/Text/map.js +9 -4
- package/dist/components/Textarea/index.d.ts +3 -0
- package/dist/components/Textarea/index.jsx +30 -0
- package/dist/components/Video/index.d.ts +3 -0
- package/dist/components/Video/index.jsx +22 -0
- package/dist/components/View/index.d.ts +5 -5
- package/dist/components/View/index.jsx +11 -13
- package/dist/components/View/map.js +5 -0
- package/dist/components/base/change-event.d.ts +18 -0
- package/dist/components/base/change-event.js +13 -0
- package/dist/components/base/wrap-text-node.d.ts +3 -0
- package/dist/components/base/wrap-text-node.jsx +34 -0
- package/dist/components/index.d.ts +24 -1
- package/dist/components/index.js +24 -1
- package/dist/exports/app.d.ts +2 -1
- package/dist/exports/app.js +3 -1
- package/dist/exports/common.d.ts +1 -0
- package/dist/exports/common.js +1 -0
- package/dist/exports/view-core.d.ts +2 -1
- package/dist/exports/view-core.js +2 -1
- package/dist/exports/view.d.ts +2 -1
- package/dist/exports/view.js +3 -1
- package/dist/hooks/lifecycle/app.js +1 -1
- package/dist/hooks/use-animation.d.ts +9 -0
- package/dist/hooks/use-animation.js +151 -0
- package/dist/internal/class-components.d.ts +11 -0
- package/dist/internal/class-components.js +42 -0
- package/dist/internal/index.d.ts +1 -0
- package/dist/internal/index.js +1 -0
- package/dist/internal/map-context/index.d.ts +1 -1
- package/dist/internal/query-node.d.ts +9 -0
- package/dist/internal/query-node.js +35 -0
- package/dist/internal/selector-id.d.ts +6 -0
- package/dist/internal/selector-id.js +18 -0
- package/dist/react.d.ts +4 -0
- package/dist/react.js +4 -0
- package/package.json +23 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Checkbox as SDKCheckbox } from '@doubao-dev/framework/components';
|
|
2
|
+
import { useRef } from '@doubao-dev/framework';
|
|
3
|
+
import { useLabelControl } from '../Label/control.js';
|
|
4
|
+
import { changeEvent } from '../base/change-event.js';
|
|
5
|
+
import { wrapTextNode } from '../base/wrap-text-node.jsx';
|
|
6
|
+
export function Checkbox({ id, className, style, value, checked, disabled, color, children, ariaLabel, onClick, onChange }) {
|
|
7
|
+
const ref = useRef(null);
|
|
8
|
+
useLabelControl(id, (event) => ref.current?.toggle(event));
|
|
9
|
+
const isTextContent = typeof children === 'string' || typeof children === 'number';
|
|
10
|
+
return (<SDKCheckbox ref={ref} id={id} className={className} style={style} value={value} checked={checked} disabled={disabled} color={color} ariaLabel={ariaLabel ?? (isTextContent ? undefined : value)} onChange={(nextChecked, event) => {
|
|
11
|
+
onClick?.(event);
|
|
12
|
+
onChange?.(changeEvent('checkbox', id, { value: nextChecked ? [value] : [] }));
|
|
13
|
+
}}>
|
|
14
|
+
{isTextContent ? children : wrapTextNode(children)}
|
|
15
|
+
</SDKCheckbox>);
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=index.jsx.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CheckboxGroup as SDKCheckboxGroup } from '@doubao-dev/framework/components';
|
|
2
|
+
import { useRef } from '@doubao-dev/framework';
|
|
3
|
+
import { useFormFieldReader } from '../Form/use-form-field.js';
|
|
4
|
+
import { changeEvent } from '../base/change-event.js';
|
|
5
|
+
import { wrapTextNode } from '../base/wrap-text-node.jsx';
|
|
6
|
+
export function CheckboxGroup({ id, name, className, style, children, onChange }) {
|
|
7
|
+
const ref = useRef(null);
|
|
8
|
+
useFormFieldReader(name, () => ref.current?.getValue() ?? []);
|
|
9
|
+
return (<SDKCheckboxGroup ref={ref} className={className} style={style} onValueChange={(value) => onChange?.(changeEvent('checkbox-group', id, { value }))}>
|
|
10
|
+
{wrapTextNode(children)}
|
|
11
|
+
</SDKCheckboxGroup>);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=index.jsx.map
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { type ComponentProps } from '@doubao-dev/framework';
|
|
2
|
+
import { View } from '../View/index.jsx';
|
|
3
|
+
export declare function CoverView({ animation: _animation, ...props }: ComponentProps<typeof View>): import("react").FunctionComponentElement<{
|
|
4
|
+
children?: import("react").ReactNode;
|
|
5
|
+
animation?: import("../../api/create-animation.js").AnimationData;
|
|
6
|
+
} & Record<string, unknown> & import("react").RefAttributes<import("@lynx-js/types").NodesRef>>;
|
|
2
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { createElement } from '@doubao-dev/framework';
|
|
2
|
+
import { View } from '../View/index.jsx';
|
|
3
|
+
export function CoverView({ animation: _animation, ...props }) {
|
|
4
|
+
return createElement(View, props);
|
|
5
|
+
}
|
|
2
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { FormProps } from '@tarojs/components';
|
|
2
|
+
export declare const FormResetContext: import("react").Context<(() => void) | undefined>;
|
|
3
|
+
export declare function Form({ id, className, style, children, onSubmit, onReset, reportSubmit, reportSubmitTimeout, reportType, templateId, subscribeId, conversionTarget, clueComponentId }: FormProps): any;
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { FormRoot } from '@lynx-js/lynx-ui-form';
|
|
2
|
+
import { createContext, useState } from '@doubao-dev/framework';
|
|
3
|
+
import { changeEvent } from '../base/change-event.js';
|
|
4
|
+
import { warnUnsupported } from '../base/warn-unsupported.js';
|
|
5
|
+
import { View } from '../View/index.jsx';
|
|
6
|
+
import { FormFieldReaders } from './use-form-field.js';
|
|
7
|
+
export const FormResetContext = createContext(undefined);
|
|
8
|
+
export function Form({ id, className, style, children, onSubmit, onReset, reportSubmit, reportSubmitTimeout, reportType, templateId, subscribeId, conversionTarget, clueComponentId }) {
|
|
9
|
+
const [revision, setRevision] = useState(0);
|
|
10
|
+
const [readers] = useState(() => new Map());
|
|
11
|
+
const reportOptions = {
|
|
12
|
+
reportSubmit: reportSubmit || undefined,
|
|
13
|
+
reportSubmitTimeout,
|
|
14
|
+
reportType,
|
|
15
|
+
templateId,
|
|
16
|
+
subscribeId,
|
|
17
|
+
conversionTarget,
|
|
18
|
+
clueComponentId
|
|
19
|
+
};
|
|
20
|
+
warnUnsupported('Form', Object.entries(reportOptions)
|
|
21
|
+
.filter(([, value]) => value !== undefined)
|
|
22
|
+
.map(([key]) => key));
|
|
23
|
+
return (<View id={id} className={className} style={style}>
|
|
24
|
+
<FormResetContext.Provider value={() => {
|
|
25
|
+
setRevision((current) => current + 1);
|
|
26
|
+
onReset?.(changeEvent('form', id, {}, 'reset'));
|
|
27
|
+
}}>
|
|
28
|
+
<FormFieldReaders.Provider value={readers}>
|
|
29
|
+
<FormRoot key={revision} onSubmit={(value) => {
|
|
30
|
+
const fields = Object.fromEntries([...readers].map(([name, read]) => [name, read()]));
|
|
31
|
+
onSubmit?.(changeEvent('form', id, { value: { ...value, ...fields } }, 'submit'));
|
|
32
|
+
}}>
|
|
33
|
+
{children}
|
|
34
|
+
</FormRoot>
|
|
35
|
+
</FormFieldReaders.Provider>
|
|
36
|
+
</FormResetContext.Provider>
|
|
37
|
+
</View>);
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=index.jsx.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function useFormField(name: string | undefined, value: unknown): ((nextValue: unknown) => void) | undefined;
|
|
2
|
+
/** 提交时读取的字段,用于无法在每次变化时同步值的组件。 */
|
|
3
|
+
export declare const FormFieldReaders: import("react").Context<Map<string, () => unknown> | undefined>;
|
|
4
|
+
export declare function useFormFieldReader(name: string | undefined, read: () => unknown): void;
|
|
5
|
+
//# sourceMappingURL=use-form-field.d.ts.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { createContext, useCallback, useContext, useEffect, useRef } from '@doubao-dev/framework';
|
|
2
|
+
import { FormContext } from '@lynx-js/lynx-ui-form';
|
|
3
|
+
export function useFormField(name, value) {
|
|
4
|
+
const form = useContext(FormContext);
|
|
5
|
+
const onChanged = form?.onChanged;
|
|
6
|
+
const unregisterField = form?.unregisterField;
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
if (name)
|
|
9
|
+
onChanged?.(name, value);
|
|
10
|
+
}, [name, onChanged, value]);
|
|
11
|
+
useEffect(() => () => {
|
|
12
|
+
if (name)
|
|
13
|
+
unregisterField?.(name);
|
|
14
|
+
}, [name, unregisterField]);
|
|
15
|
+
const update = useCallback((nextValue) => {
|
|
16
|
+
if (name)
|
|
17
|
+
onChanged?.(name, nextValue);
|
|
18
|
+
}, [name, onChanged]);
|
|
19
|
+
return name && onChanged ? update : undefined;
|
|
20
|
+
}
|
|
21
|
+
/** 提交时读取的字段,用于无法在每次变化时同步值的组件。 */
|
|
22
|
+
export const FormFieldReaders = createContext(undefined);
|
|
23
|
+
export function useFormFieldReader(name, read) {
|
|
24
|
+
const readers = useContext(FormFieldReaders);
|
|
25
|
+
const latest = useRef(read);
|
|
26
|
+
latest.current = read;
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (!name || !readers) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const reader = () => latest.current();
|
|
32
|
+
readers.set(name, reader);
|
|
33
|
+
return () => {
|
|
34
|
+
if (readers.get(name) === reader) {
|
|
35
|
+
readers.delete(name);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}, [name, readers]);
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=use-form-field.js.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Svg } from '@doubao-dev/framework/components';
|
|
2
|
+
import { View } from '../View/index.jsx';
|
|
3
|
+
const check = 'M6 12l4 4 8-8';
|
|
4
|
+
const cross = 'M8 8l8 8m0-8-8 8';
|
|
5
|
+
const ring = 'M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20';
|
|
6
|
+
const info = 'M12 11v6m0-10v1';
|
|
7
|
+
const paths = {
|
|
8
|
+
success: ring + check,
|
|
9
|
+
success_no_circle: check,
|
|
10
|
+
info,
|
|
11
|
+
info_circle: ring + info,
|
|
12
|
+
warn: `${ring}M12 7v6m0 3v1`,
|
|
13
|
+
waiting: `${ring}M12 6v6l4 2`,
|
|
14
|
+
cancel: ring + cross,
|
|
15
|
+
clear: ring + cross,
|
|
16
|
+
download: `${ring}M12 6v11m-4-4 4 4 4-4`,
|
|
17
|
+
search: 'M10 3a7 7 0 1 0 0 14 7 7 0 0 0 0-14m5 12 6 6',
|
|
18
|
+
circle: ring
|
|
19
|
+
};
|
|
20
|
+
export function Icon({ type, size = 23, color, animation: _animation, ...props }) {
|
|
21
|
+
if (!Object.hasOwn(paths, type)) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
const path = paths[type];
|
|
25
|
+
const safeColor = color ??
|
|
26
|
+
(type.startsWith('success') || type === 'download'
|
|
27
|
+
? '#07c160'
|
|
28
|
+
: type === 'warn' || type === 'cancel'
|
|
29
|
+
? '#fa5151'
|
|
30
|
+
: '#7d8790');
|
|
31
|
+
const stroke = String(safeColor).replace(/[&<>"']/g, (char) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[char] ?? char);
|
|
32
|
+
const dimension = Number(size);
|
|
33
|
+
if (!Number.isFinite(dimension) || dimension <= 0) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
return (<View {...props}>
|
|
37
|
+
<Svg style={{ width: `${dimension}px`, height: `${dimension}px` }} content={`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="${path}" fill="none" stroke="${stroke}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>`}/>
|
|
38
|
+
</View>);
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=index.jsx.map
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import type { CSSProperties } from '@lynx-js/types';
|
|
1
2
|
type ImageProps = {
|
|
2
3
|
src?: string;
|
|
3
4
|
mode?: string;
|
|
5
|
+
style?: CSSProperties | string;
|
|
4
6
|
} & Record<string, unknown>;
|
|
5
|
-
export declare function Image({ src, mode, ...rest }: ImageProps): any;
|
|
7
|
+
export declare function Image({ src, mode, style, ...rest }: ImageProps): any;
|
|
6
8
|
export {};
|
|
7
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
export function Image({ src, mode, ...rest }) {
|
|
1
|
+
export function Image({ src, mode, style, ...rest }) {
|
|
2
2
|
if (src?.endsWith('.svg') || src?.startsWith('data:image/svg')) {
|
|
3
|
-
return <svg src={src} {...rest}/>;
|
|
3
|
+
return <svg src={src} style={style} {...rest}/>;
|
|
4
4
|
}
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
const automaticDimension = mode === 'widthFix' ? 'height' : mode === 'heightFix' ? 'width' : undefined;
|
|
6
|
+
const sizingProps = automaticDimension
|
|
7
|
+
? {
|
|
8
|
+
autoSize: true,
|
|
9
|
+
// Clear this dimension even when a class or inline style specifies both axes.
|
|
10
|
+
// Native auto-size calculates it from the other axis and the image's aspect ratio.
|
|
11
|
+
style: typeof style === 'string'
|
|
12
|
+
? `${style};${automaticDimension}:auto;`
|
|
13
|
+
: { ...style, [automaticDimension]: 'auto' }
|
|
14
|
+
}
|
|
15
|
+
: { style };
|
|
16
|
+
// @ts-expect-error Taro also accepts string styles and mode names outside the SDK's public type.
|
|
17
|
+
return <image {...rest} {...sizingProps} src={src ?? ''} mode={automaticDimension ? 'aspectFit' : mode}/>;
|
|
7
18
|
}
|
|
8
19
|
//# sourceMappingURL=index.jsx.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { InputRef as LynxInputRef } from '@
|
|
1
|
+
import type { InputRef as LynxInputRef } from '@doubao-dev/framework/components';
|
|
2
2
|
import type { InputProps as TaroInputProps } from '@tarojs/components';
|
|
3
3
|
export declare const Input: (props: TaroInputProps & import("react").RefAttributes<LynxInputRef>) => React.ReactElement | null;
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { forwardRef, useCallback, useEffect, useRef } from '@
|
|
1
|
+
import { forwardRef, useCallback, useEffect, useRef } from '@doubao-dev/framework';
|
|
2
2
|
import { warnUnsupported } from '../base/warn-unsupported.js';
|
|
3
3
|
import { mapInputProps, resolveFocusBehavior, toFocusEventDetail, toInputCommonEvent, toInputEventDetail, toSelectionChangeEventDetail, toValueEventDetail } from './map.js';
|
|
4
|
+
import { useFormField } from '../Form/use-form-field.js';
|
|
4
5
|
export const Input = forwardRef(InputImpl);
|
|
5
6
|
function InputImpl(props, ref) {
|
|
6
|
-
const { onInput, onFocus, onBlur, onConfirm, onSelectionChange, ...nonEventProps } = props;
|
|
7
|
+
const { name, onInput, onFocus, onBlur, onConfirm, onSelectionChange, ...nonEventProps } = props;
|
|
7
8
|
const { mapped, unsupported, inputId, resolvedFocus, resolvedAutoFocus } = mapInputProps(nonEventProps);
|
|
8
9
|
const inputRef = useRef(null);
|
|
9
10
|
const hasAutoFocusedRef = useRef(false);
|
|
11
|
+
const updateForm = useFormField(name, props.value ?? '');
|
|
10
12
|
warnUnsupported('Input', unsupported);
|
|
11
13
|
const assignRef = useCallback((instance) => {
|
|
12
14
|
inputRef.current = instance;
|
|
@@ -24,8 +26,10 @@ function InputImpl(props, ref) {
|
|
|
24
26
|
}
|
|
25
27
|
}, [resolvedAutoFocus, resolvedFocus]);
|
|
26
28
|
const handleInput = useCallback((event) => {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
const detail = toInputEventDetail(event);
|
|
30
|
+
updateForm?.(detail.value);
|
|
31
|
+
onInput?.(toInputCommonEvent(detail, 'input', inputId));
|
|
32
|
+
}, [inputId, onInput, updateForm]);
|
|
29
33
|
const handleFocus = useCallback((event) => {
|
|
30
34
|
onFocus?.(toInputCommonEvent(toFocusEventDetail(event), 'focus', inputId));
|
|
31
35
|
}, [inputId, onFocus]);
|
|
@@ -38,7 +42,7 @@ function InputImpl(props, ref) {
|
|
|
38
42
|
const handleSelectionChange = useCallback((event) => {
|
|
39
43
|
onSelectionChange?.(toInputCommonEvent(toSelectionChangeEventDetail(event), 'selectionchange', inputId));
|
|
40
44
|
}, [inputId, onSelectionChange]);
|
|
41
|
-
return (<input {...mapped} ref={assignRef} {...(onInput ? { onInput: handleInput } : {})} {...(onFocus ? { onFocus: handleFocus } : {})} {...(onBlur ? { onBlur: handleBlur } : {})} {...(onConfirm ? { onConfirm: handleConfirm } : {})} {...(onSelectionChange ? { onSelectionChange: handleSelectionChange } : {})}/>);
|
|
45
|
+
return (<input {...mapped} ref={assignRef} {...(onInput || updateForm ? { onInput: handleInput } : {})} {...(onFocus ? { onFocus: handleFocus } : {})} {...(onBlur ? { onBlur: handleBlur } : {})} {...(onConfirm ? { onConfirm: handleConfirm } : {})} {...(onSelectionChange ? { onSelectionChange: handleSelectionChange } : {})}/>);
|
|
42
46
|
}
|
|
43
47
|
function assignForwardedRef(ref, value) {
|
|
44
48
|
if (typeof ref === 'function') {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { InputProps as LynxInputProps } from '@
|
|
1
|
+
import type { InputProps as LynxInputProps } from '@doubao-dev/framework/components';
|
|
2
2
|
import type { InputProps as TaroInputProps } from '@tarojs/components';
|
|
3
3
|
import type { PropMap } from '../types/prop-map.js';
|
|
4
4
|
type LynxInputEvent = Parameters<NonNullable<LynxInputProps['onInput']>>[0];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { TouchEvent } from '@lynx-js/types';
|
|
2
|
+
export type Activate = (event: TouchEvent) => void;
|
|
3
|
+
export declare const LabelControls: import("react").Context<Set<Activate> | undefined>;
|
|
4
|
+
export declare const controlsById: Map<string, Set<Activate>>;
|
|
5
|
+
export declare function useLabelControl(id: string | undefined, activate: Activate, enabled?: boolean): boolean;
|
|
6
|
+
//# sourceMappingURL=control.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createContext, useContext, useEffect, useRef } from '@doubao-dev/framework';
|
|
2
|
+
export const LabelControls = createContext(undefined);
|
|
3
|
+
export const controlsById = new Map();
|
|
4
|
+
export function useLabelControl(id, activate, enabled = true) {
|
|
5
|
+
const controls = useContext(LabelControls);
|
|
6
|
+
const latest = useRef(activate);
|
|
7
|
+
latest.current = activate;
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
if (!enabled || (!id && !controls))
|
|
10
|
+
return;
|
|
11
|
+
const handler = (event) => latest.current(event);
|
|
12
|
+
controls?.add(handler);
|
|
13
|
+
const named = id ? (controlsById.get(id) ?? new Set()) : undefined;
|
|
14
|
+
if (id && named) {
|
|
15
|
+
named.add(handler);
|
|
16
|
+
controlsById.set(id, named);
|
|
17
|
+
}
|
|
18
|
+
return () => {
|
|
19
|
+
controls?.delete(handler);
|
|
20
|
+
if (id && named) {
|
|
21
|
+
named.delete(handler);
|
|
22
|
+
if (!named.size)
|
|
23
|
+
controlsById.delete(id);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}, [controls, enabled, id]);
|
|
27
|
+
return controls !== undefined;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=control.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useState } from '@doubao-dev/framework';
|
|
2
|
+
import { wrapTextNode } from '../base/wrap-text-node.jsx';
|
|
3
|
+
import { LabelControls, controlsById } from './control.js';
|
|
4
|
+
export function Label({ id, className, style, for: controlId, children }) {
|
|
5
|
+
const [controls] = useState(() => new Set());
|
|
6
|
+
return (<LabelControls.Provider value={controls}>
|
|
7
|
+
<view id={id} className={className} style={style} bindtap={(event) => {
|
|
8
|
+
const target = controlId ? controlsById.get(controlId) : controls;
|
|
9
|
+
target?.values().next().value?.(event);
|
|
10
|
+
}}>
|
|
11
|
+
{wrapTextNode(children)}
|
|
12
|
+
</view>
|
|
13
|
+
</LabelControls.Provider>);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=index.jsx.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Text } from '../Text/index.jsx';
|
|
2
|
+
import { View } from '../View/index.jsx';
|
|
3
|
+
export function LivePlayer({ id, className, style }) {
|
|
4
|
+
return (<View id={id} className={className} style={style}>
|
|
5
|
+
<Text>暂不支持的组件</Text>
|
|
6
|
+
</View>);
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=index.jsx.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MapProps as ComponentMapProps, MapMarkerProps } from '@
|
|
1
|
+
import type { MapProps as ComponentMapProps, MapMarkerProps } from '@doubao-dev/framework/components';
|
|
2
2
|
import type { MapProps } from '@tarojs/components';
|
|
3
3
|
export interface NativeMarkerBridgeProps {
|
|
4
4
|
markerId: string | number;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { useEffect, useMemo, useRef, useState } from '@
|
|
1
|
+
import { useEffect, useMemo, useRef, useState } from '@doubao-dev/framework';
|
|
2
2
|
import { registerMapController, unregisterMapController } from '../../internal/map-context/index.js';
|
|
3
|
+
import { useQueryNodeProps } from '../../internal/query-node.js';
|
|
4
|
+
import { withSelectorId } from '../../internal/selector-id.js';
|
|
3
5
|
import { Image } from '../Image/index.jsx';
|
|
4
6
|
import { warnUnsupported } from '../base/warn-unsupported.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
+
import { wrapTextNode } from '../base/wrap-text-node.jsx';
|
|
8
|
+
import { composeMarkers, createMarkerElementProps, dispatchMarkerTapEvent, getNumericMarkerId, hasByClickCallout, hasTapTitle, mapMarkerToNativeProps, mapPolylineTapDetail, mapRegionChangeDetail, mergeMarkersById, removeMarkersByIds, resolveMarkerIconStyle, resolveMarkerTextContent, resolveNativePolygons, resolvePadding, resolvePolylines, shouldAutoSizeMarkerIcon } from './bridge.js';
|
|
9
|
+
import { collectMapUnsupportedWarnings, mergeMapStyle, resolveMapValues, resolveNativeCircles, toCommonEvent } from './mapping.js';
|
|
7
10
|
function DoubaoAppsMap(props) {
|
|
8
11
|
const { id, className, style, hidden, animation, children, onTouchStart, onTouchMove, onTouchCancel, onTouchEnd, onClick: onBaseClick, onLongPress, onLongClick, onTransitionEnd, onAnimationStart, onAnimationIteration, onAnimationEnd, longitude, latitude, scale, minScale, maxScale, markers, covers, polyline, circles, controls, includePoints, showLocation, polygons, subkey, layerStyle, rotate, skew, showCompass, showScale, enableOverlooking, enableZoom, enableScroll, enableRotate, enableSatellite, enableTraffic, setting, includePadding, groundOverlays, tileOverlay, enablePoi, enableBuilding, polygon, customMapStyle, panels, theme, optimize, enableAutoMaxOverlooking, enable3D, onTap, onMarkerTap, onLabelTap, onControlTap, onCalloutTap, onUpdated, onRegionChange, onPoiTap, onPolylineTap, onAbilitySuccess, onAbilityFailed, onAuthSuccess, onInterpolatePoint, onError, onCallOutTap, onAnchorPointTap, onPanelTap, onInitComplete, ...rest } = props;
|
|
9
12
|
const mapRef = useRef(null);
|
|
@@ -38,6 +41,7 @@ function DoubaoAppsMap(props) {
|
|
|
38
41
|
customMapStyle
|
|
39
42
|
});
|
|
40
43
|
const mapId = id ? String(id) : '';
|
|
44
|
+
useQueryNodeProps(mapId, props);
|
|
41
45
|
if (!mapControllerRef.current) {
|
|
42
46
|
mapControllerRef.current = createMapController({
|
|
43
47
|
mapRef,
|
|
@@ -132,7 +136,7 @@ function DoubaoAppsMap(props) {
|
|
|
132
136
|
onCalloutTap !== undefined ||
|
|
133
137
|
onCallOutTap !== undefined;
|
|
134
138
|
const renderMarkers = composeMarkers(resolvedMarkers, imperativeAddedMarkers, imperativeRemovedMarkerIds);
|
|
135
|
-
return (<map className={className
|
|
139
|
+
return (<map {...(mapId ? { id: mapId } : {})} className={withSelectorId(className, mapId)} ref={mapRef} style={mergeMapStyle(style, hidden)}
|
|
136
140
|
// @ts-expect-error
|
|
137
141
|
enableNativeInteraction={rest.enableNativeInteraction} mapStyle={passedThroughMapStyle ?? resolvedMapStyle}
|
|
138
142
|
// @ts-ignore
|
|
@@ -190,9 +194,9 @@ function DoubaoAppsMap(props) {
|
|
|
190
194
|
}
|
|
191
195
|
}
|
|
192
196
|
};
|
|
193
|
-
return <map-marker {...markerElementPropsWithRef}>{markerContent}</map-marker>;
|
|
197
|
+
return <map-marker {...markerElementPropsWithRef}>{wrapTextNode(markerContent)}</map-marker>;
|
|
194
198
|
})}
|
|
195
|
-
{children}
|
|
199
|
+
{wrapTextNode(children)}
|
|
196
200
|
</map>);
|
|
197
201
|
}
|
|
198
202
|
function renderDefaultMarkerContent(marker, markerId, activeCalloutMarkerId, onLayout) {
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { MovableAreaProps, MovableViewProps } from '@tarojs/components';
|
|
2
|
+
export declare function MovableArea({ className, style, children, scaleArea }: MovableAreaProps): any;
|
|
3
|
+
export declare function MovableView({ id, className, style, direction, disabled, scale, inertia, animation, damping, friction, scaleMin, scaleMax, scaleValue, outOfBounds, x, y, children, onChange, onChangeEnd, onScale }: MovableViewProps): any;
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { MovableArea as SDKMovableArea, MovableView as SDKMovableView } from '@doubao-dev/framework/components';
|
|
2
|
+
import { useRef } from '@doubao-dev/framework';
|
|
3
|
+
import { changeEvent } from '../base/change-event.js';
|
|
4
|
+
import { warnUnsupported } from '../base/warn-unsupported.js';
|
|
5
|
+
import { wrapTextNode } from '../base/wrap-text-node.jsx';
|
|
6
|
+
export function MovableArea({ className, style, children, scaleArea }) {
|
|
7
|
+
warnUnsupported('MovableArea', scaleArea ? ['scaleArea'] : []);
|
|
8
|
+
return (<SDKMovableArea className={className} style={style}>
|
|
9
|
+
{wrapTextNode(children)}
|
|
10
|
+
</SDKMovableArea>);
|
|
11
|
+
}
|
|
12
|
+
export function MovableView({ id, className, style, direction, disabled, scale, inertia, animation, damping, friction, scaleMin, scaleMax, scaleValue, outOfBounds, x = 0, y = 0, children, onChange, onChangeEnd, onScale }) {
|
|
13
|
+
const position = useRef({ x: Number(x), y: Number(y) });
|
|
14
|
+
warnUnsupported('MovableView', [
|
|
15
|
+
...(onChangeEnd ? ['onChangeEnd'] : []),
|
|
16
|
+
...(!Number.isFinite(Number(x)) ? ['x'] : []),
|
|
17
|
+
...(!Number.isFinite(Number(y)) ? ['y'] : [])
|
|
18
|
+
]);
|
|
19
|
+
return (<SDKMovableView className={className} style={style} direction={direction} disabled={disabled} scale={scale} inertia={inertia} animation={animation} damping={damping} friction={friction} scaleMin={scaleMin} scaleMax={scaleMax} scaleValue={scaleValue} outOfBounds={outOfBounds} x={Number(x) || 0} y={Number(y) || 0} onDrag={(x, y) => {
|
|
20
|
+
position.current = { x, y };
|
|
21
|
+
onChange?.(changeEvent('movable-view', id, { x, y, source: 'touch' }));
|
|
22
|
+
}} onScale={(scale) => onScale?.(changeEvent('movable-view', id, { ...position.current, scale }, 'scale'))}>
|
|
23
|
+
{wrapTextNode(children)}
|
|
24
|
+
</SDKMovableView>);
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=index.jsx.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { NavigationBarProps } from '@tarojs/components';
|
|
2
|
+
export declare function NavigationBar({ title, loading, frontColor, backgroundColor, colorAnimationDuration, colorAnimationTimingFunc, className, style, ...unsupportedProps }: NavigationBarProps): any;
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { NavigationBar as SDKNavigationBar } from '@doubao-dev/framework/components';
|
|
2
|
+
import { warnUnsupported } from '../base/warn-unsupported.js';
|
|
3
|
+
export function NavigationBar({ title, loading, frontColor, backgroundColor, colorAnimationDuration, colorAnimationTimingFunc, className, style, ...unsupportedProps }) {
|
|
4
|
+
warnUnsupported('NavigationBar', [
|
|
5
|
+
...Object.entries(unsupportedProps)
|
|
6
|
+
.filter(([, value]) => value !== undefined)
|
|
7
|
+
.map(([key]) => key),
|
|
8
|
+
...(colorAnimationDuration !== undefined && Number(colorAnimationDuration) !== 0
|
|
9
|
+
? ['colorAnimationDuration']
|
|
10
|
+
: []),
|
|
11
|
+
...(colorAnimationTimingFunc !== undefined ? ['colorAnimationTimingFunc'] : []),
|
|
12
|
+
...(typeof style === 'string' ? ['style as string'] : [])
|
|
13
|
+
]);
|
|
14
|
+
return (<SDKNavigationBar title={title} loading={loading} color={frontColor} background={backgroundColor} className={className} style={typeof style === 'string' ? undefined : style}/>);
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=index.jsx.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { navigateBack, navigateTo, reLaunch, redirectTo } from '../../api/router/index.js';
|
|
2
|
+
import { changeEvent } from '../base/change-event.js';
|
|
3
|
+
import { warnUnsupported } from '../base/warn-unsupported.js';
|
|
4
|
+
import { wrapTextNode } from '../base/wrap-text-node.jsx';
|
|
5
|
+
export function Navigator({ id, className, style, children, url, delta, target = 'self', openType = 'navigate', onClick, onSuccess, onFail, onComplete }) {
|
|
6
|
+
const route = { navigate: navigateTo, redirect: redirectTo, reLaunch };
|
|
7
|
+
const navigate = route[openType];
|
|
8
|
+
const supported = target === 'self' && (openType === 'navigateBack' || Boolean(navigate));
|
|
9
|
+
warnUnsupported('Navigator', supported ? [] : [target === 'self' ? `openType=${openType}` : `target=${target}`]);
|
|
10
|
+
return (<view id={id} className={className} style={style} bindtap={async (event) => {
|
|
11
|
+
onClick?.(event);
|
|
12
|
+
if (!supported)
|
|
13
|
+
return;
|
|
14
|
+
try {
|
|
15
|
+
const result = openType === 'navigateBack' ? await navigateBack({ delta }) : await navigate({ url: url ?? '' });
|
|
16
|
+
if (openType !== 'reLaunch' && result.errMsg !== '') {
|
|
17
|
+
onFail?.(changeEvent('navigator', id, result, 'fail'));
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
onSuccess?.(changeEvent('navigator', id, result, 'success'));
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
onFail?.(changeEvent('navigator', id, error, 'fail'));
|
|
24
|
+
}
|
|
25
|
+
finally {
|
|
26
|
+
onComplete?.(changeEvent('navigator', id, {}, 'complete'));
|
|
27
|
+
}
|
|
28
|
+
}}>
|
|
29
|
+
{wrapTextNode(children)}
|
|
30
|
+
</view>);
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=index.jsx.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ComponentProps } from '@doubao-dev/framework';
|
|
2
|
+
import type { Picker as TaroPicker } from '@tarojs/components';
|
|
3
|
+
type Props = ComponentProps<typeof TaroPicker>;
|
|
4
|
+
export declare function Picker(props: Props): any;
|
|
5
|
+
export {};
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|