@plaidev/karte-action-sdk 1.1.268-29111070.d0bdfb56 → 1.1.268-29127338.e0debfc5
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/action.d.ts +63 -0
- package/dist/actionEvent.d.ts +25 -0
- package/dist/collection.d.ts +121 -0
- package/dist/components/index.d.ts +32 -0
- package/dist/components-flex/avatar/styles.d.ts +3 -0
- package/dist/components-flex/avatar/types.d.ts +24 -0
- package/dist/components-flex/brand-kit.d.ts +16 -0
- package/dist/components-flex/button/styles.d.ts +8 -0
- package/dist/components-flex/button/types.d.ts +57 -0
- package/dist/components-flex/button-outlined/styles.d.ts +8 -0
- package/dist/components-flex/button-outlined/types.d.ts +20 -0
- package/dist/components-flex/button-text/styles.d.ts +6 -0
- package/dist/components-flex/button-text/types.d.ts +33 -0
- package/dist/components-flex/clip-copy/types.d.ts +6 -0
- package/dist/components-flex/close-button/types.d.ts +32 -0
- package/dist/components-flex/code/types.d.ts +6 -0
- package/dist/components-flex/count-down/types.d.ts +17 -0
- package/dist/components-flex/icon/styles.d.ts +3 -0
- package/dist/components-flex/icon/types.d.ts +18 -0
- package/dist/components-flex/image/styles.d.ts +3 -0
- package/dist/components-flex/image/types.d.ts +26 -0
- package/dist/components-flex/layout/types.d.ts +20 -0
- package/dist/components-flex/list/types.d.ts +30 -0
- package/dist/components-flex/modal/types.d.ts +5 -0
- package/dist/components-flex/multi-column/types.d.ts +31 -0
- package/dist/components-flex/props.d.ts +91 -0
- package/dist/components-flex/schemas.d.ts +36 -0
- package/dist/components-flex/shared/styles.d.ts +3 -0
- package/dist/components-flex/shared/types.d.ts +13 -0
- package/dist/components-flex/slider/types.d.ts +10 -0
- package/dist/components-flex/styles.d.ts +9 -0
- package/dist/components-flex/text/constants.d.ts +4 -0
- package/dist/components-flex/text/styles.d.ts +7 -0
- package/dist/components-flex/text/types.d.ts +37 -0
- package/dist/components-flex/text-link/styles.d.ts +6 -0
- package/dist/components-flex/text-link/types.d.ts +31 -0
- package/dist/components-flex/utils/color.d.ts +7 -0
- package/dist/components-flex/utils/obj-to-style.d.ts +2 -0
- package/dist/components-flex/utils/parser.d.ts +5 -0
- package/dist/components-flex/utils/prop-to-style.d.ts +11 -0
- package/dist/components-flex/variants.d.ts +42 -0
- package/dist/components-flex/youtube/types.d.ts +16 -0
- package/dist/constants.d.ts +27 -0
- package/dist/display-logic.d.ts +125 -0
- package/dist/enhancedStopPropagation.d.ts +6 -0
- package/dist/form.d.ts +100 -0
- package/dist/functions.d.ts +71 -0
- package/dist/hooks/useClickable.d.ts +7 -0
- package/dist/hooks/useInjectCustomizeCss.d.ts +2 -0
- package/dist/hooks/useText.d.ts +5 -0
- package/dist/hydrate/action.d.ts +63 -0
- package/dist/hydrate/actionEvent.d.ts +25 -0
- package/dist/hydrate/collection.d.ts +121 -0
- package/dist/hydrate/components/index.d.ts +32 -0
- package/dist/hydrate/components-flex/avatar/styles.d.ts +3 -0
- package/dist/hydrate/components-flex/avatar/types.d.ts +24 -0
- package/dist/hydrate/components-flex/brand-kit.d.ts +16 -0
- package/dist/hydrate/components-flex/button/styles.d.ts +8 -0
- package/dist/hydrate/components-flex/button/types.d.ts +57 -0
- package/dist/hydrate/components-flex/button-outlined/styles.d.ts +8 -0
- package/dist/hydrate/components-flex/button-outlined/types.d.ts +20 -0
- package/dist/hydrate/components-flex/button-text/styles.d.ts +6 -0
- package/dist/hydrate/components-flex/button-text/types.d.ts +33 -0
- package/dist/hydrate/components-flex/clip-copy/types.d.ts +6 -0
- package/dist/hydrate/components-flex/close-button/types.d.ts +32 -0
- package/dist/hydrate/components-flex/code/types.d.ts +6 -0
- package/dist/hydrate/components-flex/count-down/types.d.ts +17 -0
- package/dist/hydrate/components-flex/icon/styles.d.ts +3 -0
- package/dist/hydrate/components-flex/icon/types.d.ts +18 -0
- package/dist/hydrate/components-flex/image/styles.d.ts +3 -0
- package/dist/hydrate/components-flex/image/types.d.ts +26 -0
- package/dist/hydrate/components-flex/layout/types.d.ts +20 -0
- package/dist/hydrate/components-flex/list/types.d.ts +30 -0
- package/dist/hydrate/components-flex/modal/types.d.ts +5 -0
- package/dist/hydrate/components-flex/multi-column/types.d.ts +31 -0
- package/dist/hydrate/components-flex/props.d.ts +91 -0
- package/dist/hydrate/components-flex/schemas.d.ts +36 -0
- package/dist/hydrate/components-flex/shared/styles.d.ts +3 -0
- package/dist/hydrate/components-flex/shared/types.d.ts +13 -0
- package/dist/hydrate/components-flex/slider/types.d.ts +10 -0
- package/dist/hydrate/components-flex/styles.d.ts +9 -0
- package/dist/hydrate/components-flex/text/constants.d.ts +4 -0
- package/dist/hydrate/components-flex/text/styles.d.ts +7 -0
- package/dist/hydrate/components-flex/text/types.d.ts +37 -0
- package/dist/hydrate/components-flex/text-link/styles.d.ts +6 -0
- package/dist/hydrate/components-flex/text-link/types.d.ts +31 -0
- package/dist/hydrate/components-flex/utils/color.d.ts +7 -0
- package/dist/hydrate/components-flex/utils/obj-to-style.d.ts +2 -0
- package/dist/hydrate/components-flex/utils/parser.d.ts +5 -0
- package/dist/hydrate/components-flex/utils/prop-to-style.d.ts +11 -0
- package/dist/hydrate/components-flex/variants.d.ts +42 -0
- package/dist/hydrate/components-flex/youtube/types.d.ts +16 -0
- package/dist/hydrate/constants.d.ts +27 -0
- package/dist/hydrate/display-logic.d.ts +125 -0
- package/dist/hydrate/enhancedStopPropagation.d.ts +6 -0
- package/dist/hydrate/form.d.ts +100 -0
- package/dist/hydrate/functions.d.ts +71 -0
- package/dist/hydrate/hooks/useClickable.d.ts +7 -0
- package/dist/hydrate/hooks/useInjectCustomizeCss.d.ts +2 -0
- package/dist/hydrate/hooks/useText.d.ts +5 -0
- package/dist/hydrate/index.d.ts +111 -0
- package/dist/hydrate/index.es.js +12721 -12529
- package/dist/hydrate/index.svelte5.d.ts +79 -0
- package/dist/hydrate/logger.d.ts +48 -0
- package/dist/hydrate/modal.d.ts +214 -0
- package/dist/hydrate/modal.svelte5.d.ts +214 -0
- package/dist/hydrate/prop.d.ts +431 -0
- package/dist/hydrate/script.d.ts +33 -0
- package/dist/hydrate/stores.d.ts +376 -0
- package/dist/hydrate/types.d.ts +183 -0
- package/dist/hydrate/utils.d.ts +171 -0
- package/dist/hydrate/widget.d.ts +148 -0
- package/dist/icons.d.ts +27 -28
- package/dist/icons.js +225 -159
- package/dist/index.es.d.ts +111 -2988
- package/dist/index.es.js +11913 -12372
- package/dist/logger.d.ts +48 -0
- package/dist/modal.d.ts +214 -0
- package/dist/modal.svelte5.d.ts +214 -0
- package/dist/prop.d.ts +431 -0
- package/dist/script.d.ts +33 -0
- package/dist/stores.d.ts +376 -0
- package/dist/svelte5/action.d.ts +63 -0
- package/dist/svelte5/actionEvent.d.ts +25 -0
- package/dist/svelte5/collection.d.ts +121 -0
- package/dist/svelte5/components/index.d.ts +32 -0
- package/dist/svelte5/components-flex/avatar/styles.d.ts +3 -0
- package/dist/svelte5/components-flex/avatar/types.d.ts +24 -0
- package/dist/svelte5/components-flex/brand-kit.d.ts +16 -0
- package/dist/svelte5/components-flex/button/styles.d.ts +8 -0
- package/dist/svelte5/components-flex/button/types.d.ts +57 -0
- package/dist/svelte5/components-flex/button-outlined/styles.d.ts +8 -0
- package/dist/svelte5/components-flex/button-outlined/types.d.ts +20 -0
- package/dist/svelte5/components-flex/button-text/styles.d.ts +6 -0
- package/dist/svelte5/components-flex/button-text/types.d.ts +33 -0
- package/dist/svelte5/components-flex/clip-copy/types.d.ts +6 -0
- package/dist/svelte5/components-flex/close-button/types.d.ts +32 -0
- package/dist/svelte5/components-flex/code/types.d.ts +6 -0
- package/dist/svelte5/components-flex/count-down/types.d.ts +17 -0
- package/dist/svelte5/components-flex/icon/styles.d.ts +3 -0
- package/dist/svelte5/components-flex/icon/types.d.ts +18 -0
- package/dist/svelte5/components-flex/image/styles.d.ts +3 -0
- package/dist/svelte5/components-flex/image/types.d.ts +26 -0
- package/dist/svelte5/components-flex/layout/types.d.ts +20 -0
- package/dist/svelte5/components-flex/list/types.d.ts +30 -0
- package/dist/svelte5/components-flex/modal/types.d.ts +5 -0
- package/dist/svelte5/components-flex/multi-column/types.d.ts +31 -0
- package/dist/svelte5/components-flex/props.d.ts +91 -0
- package/dist/svelte5/components-flex/schemas.d.ts +36 -0
- package/dist/svelte5/components-flex/shared/styles.d.ts +3 -0
- package/dist/svelte5/components-flex/shared/types.d.ts +13 -0
- package/dist/svelte5/components-flex/slider/types.d.ts +10 -0
- package/dist/svelte5/components-flex/styles.d.ts +9 -0
- package/dist/svelte5/components-flex/text/constants.d.ts +4 -0
- package/dist/svelte5/components-flex/text/styles.d.ts +7 -0
- package/dist/svelte5/components-flex/text/types.d.ts +37 -0
- package/dist/svelte5/components-flex/text-link/styles.d.ts +6 -0
- package/dist/svelte5/components-flex/text-link/types.d.ts +31 -0
- package/dist/svelte5/components-flex/utils/color.d.ts +7 -0
- package/dist/svelte5/components-flex/utils/obj-to-style.d.ts +2 -0
- package/dist/svelte5/components-flex/utils/parser.d.ts +5 -0
- package/dist/svelte5/components-flex/utils/prop-to-style.d.ts +11 -0
- package/dist/svelte5/components-flex/variants.d.ts +42 -0
- package/dist/svelte5/components-flex/youtube/types.d.ts +16 -0
- package/dist/svelte5/constants.d.ts +27 -0
- package/dist/svelte5/display-logic.d.ts +125 -0
- package/dist/svelte5/form.d.ts +100 -0
- package/dist/svelte5/functions.d.ts +71 -0
- package/dist/svelte5/hooks/useClickable.d.ts +7 -0
- package/dist/svelte5/hooks/useInjectCustomizeCss.d.ts +2 -0
- package/dist/svelte5/hooks/useText.d.ts +5 -0
- package/dist/svelte5/hydrate/action.d.ts +63 -0
- package/dist/svelte5/hydrate/actionEvent.d.ts +25 -0
- package/dist/svelte5/hydrate/collection.d.ts +121 -0
- package/dist/svelte5/hydrate/components/index.d.ts +32 -0
- package/dist/svelte5/hydrate/components-flex/avatar/styles.d.ts +3 -0
- package/dist/svelte5/hydrate/components-flex/avatar/types.d.ts +24 -0
- package/dist/svelte5/hydrate/components-flex/brand-kit.d.ts +16 -0
- package/dist/svelte5/hydrate/components-flex/button/styles.d.ts +8 -0
- package/dist/svelte5/hydrate/components-flex/button/types.d.ts +57 -0
- package/dist/svelte5/hydrate/components-flex/button-outlined/styles.d.ts +8 -0
- package/dist/svelte5/hydrate/components-flex/button-outlined/types.d.ts +20 -0
- package/dist/svelte5/hydrate/components-flex/button-text/styles.d.ts +6 -0
- package/dist/svelte5/hydrate/components-flex/button-text/types.d.ts +33 -0
- package/dist/svelte5/hydrate/components-flex/clip-copy/types.d.ts +6 -0
- package/dist/svelte5/hydrate/components-flex/close-button/types.d.ts +32 -0
- package/dist/svelte5/hydrate/components-flex/code/types.d.ts +6 -0
- package/dist/svelte5/hydrate/components-flex/count-down/types.d.ts +17 -0
- package/dist/svelte5/hydrate/components-flex/icon/styles.d.ts +3 -0
- package/dist/svelte5/hydrate/components-flex/icon/types.d.ts +18 -0
- package/dist/svelte5/hydrate/components-flex/image/styles.d.ts +3 -0
- package/dist/svelte5/hydrate/components-flex/image/types.d.ts +26 -0
- package/dist/svelte5/hydrate/components-flex/layout/types.d.ts +20 -0
- package/dist/svelte5/hydrate/components-flex/list/types.d.ts +30 -0
- package/dist/svelte5/hydrate/components-flex/modal/types.d.ts +5 -0
- package/dist/svelte5/hydrate/components-flex/multi-column/types.d.ts +31 -0
- package/dist/svelte5/hydrate/components-flex/props.d.ts +91 -0
- package/dist/svelte5/hydrate/components-flex/schemas.d.ts +36 -0
- package/dist/svelte5/hydrate/components-flex/shared/styles.d.ts +3 -0
- package/dist/svelte5/hydrate/components-flex/shared/types.d.ts +13 -0
- package/dist/svelte5/hydrate/components-flex/slider/types.d.ts +10 -0
- package/dist/svelte5/hydrate/components-flex/styles.d.ts +9 -0
- package/dist/svelte5/hydrate/components-flex/text/constants.d.ts +4 -0
- package/dist/svelte5/hydrate/components-flex/text/styles.d.ts +7 -0
- package/dist/svelte5/hydrate/components-flex/text/types.d.ts +37 -0
- package/dist/svelte5/hydrate/components-flex/text-link/styles.d.ts +6 -0
- package/dist/svelte5/hydrate/components-flex/text-link/types.d.ts +31 -0
- package/dist/svelte5/hydrate/components-flex/utils/color.d.ts +7 -0
- package/dist/svelte5/hydrate/components-flex/utils/obj-to-style.d.ts +2 -0
- package/dist/svelte5/hydrate/components-flex/utils/parser.d.ts +5 -0
- package/dist/svelte5/hydrate/components-flex/utils/prop-to-style.d.ts +11 -0
- package/dist/svelte5/hydrate/components-flex/variants.d.ts +42 -0
- package/dist/svelte5/hydrate/components-flex/youtube/types.d.ts +16 -0
- package/dist/svelte5/hydrate/constants.d.ts +27 -0
- package/dist/svelte5/hydrate/display-logic.d.ts +125 -0
- package/dist/svelte5/hydrate/form.d.ts +100 -0
- package/dist/svelte5/hydrate/functions.d.ts +71 -0
- package/dist/svelte5/hydrate/hooks/useClickable.d.ts +7 -0
- package/dist/svelte5/hydrate/hooks/useInjectCustomizeCss.d.ts +2 -0
- package/dist/svelte5/hydrate/hooks/useText.d.ts +5 -0
- package/dist/svelte5/hydrate/index.es.d.ts +79 -2956
- package/dist/svelte5/hydrate/index.es.js +5444 -6490
- package/dist/svelte5/hydrate/logger.d.ts +48 -0
- package/dist/svelte5/hydrate/modal.d.ts +214 -0
- package/dist/svelte5/hydrate/modal.svelte5.d.ts +214 -0
- package/dist/svelte5/hydrate/prop.d.ts +431 -0
- package/dist/svelte5/hydrate/script.d.ts +33 -0
- package/dist/svelte5/hydrate/stores.d.ts +376 -0
- package/dist/svelte5/hydrate/types.d.ts +183 -0
- package/dist/svelte5/hydrate/utils.d.ts +171 -0
- package/dist/svelte5/hydrate/widget.d.ts +148 -0
- package/dist/svelte5/index.es.d.ts +79 -2956
- package/dist/svelte5/index.es.js +5416 -6459
- package/dist/svelte5/index.front2.es.d.ts +1 -2
- package/dist/svelte5/index.front2.es.js +5657 -6715
- package/dist/svelte5/index.svelte5.d.ts +79 -0
- package/dist/svelte5/logger.d.ts +48 -0
- package/dist/svelte5/modal.d.ts +214 -0
- package/dist/svelte5/modal.svelte5.d.ts +214 -0
- package/dist/svelte5/prop.d.ts +431 -0
- package/dist/svelte5/script.d.ts +33 -0
- package/dist/svelte5/stores.d.ts +376 -0
- package/dist/svelte5/types.d.ts +183 -0
- package/dist/svelte5/utils.d.ts +171 -0
- package/dist/svelte5/widget.d.ts +148 -0
- package/dist/templates.cjs.js +38 -47
- package/dist/templates.d.ts +27 -28
- package/dist/templates.js +37 -46
- package/dist/types.d.ts +183 -0
- package/dist/utils.d.ts +171 -0
- package/dist/widget.d.ts +148 -0
- package/package.json +9 -18
- package/dist/hydrate/index.es.d.ts +0 -2988
- package/dist/templates.cjs.d.ts +0 -34
@@ -0,0 +1,148 @@
|
|
1
|
+
import { showAction, closeAction } from "./modal.js";
|
2
|
+
import { collection as newCollection } from "./collection.js";
|
3
|
+
type ChangeValCallbackArg = {
|
4
|
+
newVal: any
|
5
|
+
oldVal: any
|
6
|
+
key: string
|
7
|
+
};
|
8
|
+
type ChangeValCallback = (arg: ChangeValCallbackArg) => void;
|
9
|
+
type EventCallback = (event: any) => void;
|
10
|
+
type WidgetEventName = "hide" | "clickBackdrop" | "destroyed";
|
11
|
+
/**
|
12
|
+
* アクションを表示する
|
13
|
+
*
|
14
|
+
* @remarks
|
15
|
+
* この関数は {@link showAction} のエイリアスです
|
16
|
+
*
|
17
|
+
* @public
|
18
|
+
*/
|
19
|
+
export { showAction as show };
|
20
|
+
/**
|
21
|
+
* アクションを非表示にする
|
22
|
+
*
|
23
|
+
* @remarks
|
24
|
+
* この関数は {@link closeAction} のエイリアスです
|
25
|
+
*
|
26
|
+
* @public
|
27
|
+
*/
|
28
|
+
export { closeAction as hide };
|
29
|
+
/**
|
30
|
+
* 変数を設定する
|
31
|
+
*
|
32
|
+
* @param name - 変数名
|
33
|
+
* @param value - 変数値
|
34
|
+
*
|
35
|
+
* @public
|
36
|
+
*/
|
37
|
+
export declare function setVal(name: string, value: any): void;
|
38
|
+
/**
|
39
|
+
* 変数を取得する
|
40
|
+
*
|
41
|
+
* @param name - 変数名
|
42
|
+
*
|
43
|
+
* @returns 変数値
|
44
|
+
*
|
45
|
+
* @public
|
46
|
+
*/
|
47
|
+
export declare function getVal(name: string): any;
|
48
|
+
/**
|
49
|
+
* 変数が変更されたときに実行されるコールバック関数を設定する
|
50
|
+
*
|
51
|
+
* @param name - 変数名
|
52
|
+
* @param callback - コールバック関数
|
53
|
+
*
|
54
|
+
* @public
|
55
|
+
*/
|
56
|
+
export declare function onChangeVal(name: string, callback: ChangeValCallback): void;
|
57
|
+
/**
|
58
|
+
* WEBのイベントが発生したときに実行されるコールバック関数を設定する
|
59
|
+
*
|
60
|
+
* @param name - WEBのイベント名
|
61
|
+
* @param callback - コールバック関数
|
62
|
+
*
|
63
|
+
* @public
|
64
|
+
*/
|
65
|
+
export declare function method(name: string, callback: EventCallback): void;
|
66
|
+
/**
|
67
|
+
* Widgetのイベントが発生したときに実行されるコールバック関数を設定する
|
68
|
+
*
|
69
|
+
* @param name - Widgetのイベント名
|
70
|
+
* @param callback - コールバック関数
|
71
|
+
*
|
72
|
+
* @public
|
73
|
+
*/
|
74
|
+
export declare function on(name: WidgetEventName, callback: EventCallback): void;
|
75
|
+
/**
|
76
|
+
* 現在のステートを設定する
|
77
|
+
*
|
78
|
+
* @param stateId - ステートID
|
79
|
+
*
|
80
|
+
* @public
|
81
|
+
*/
|
82
|
+
export declare function setState(stateId: string): void;
|
83
|
+
/**
|
84
|
+
* 現在のステートを取得する
|
85
|
+
*
|
86
|
+
* @returns ステートID
|
87
|
+
*
|
88
|
+
* @public
|
89
|
+
*/
|
90
|
+
export declare function getState(): string;
|
91
|
+
/**
|
92
|
+
* ページ内の変数を設定する
|
93
|
+
*
|
94
|
+
* @param key - 変数のキー
|
95
|
+
* @param value - 変数値
|
96
|
+
*
|
97
|
+
* @public
|
98
|
+
*/
|
99
|
+
declare function setMemoryStore(key: string, value: any): void;
|
100
|
+
/**
|
101
|
+
* ページ内の変数を取定する
|
102
|
+
*
|
103
|
+
* @param key - 変数のキー
|
104
|
+
*
|
105
|
+
* @returns 変数
|
106
|
+
*
|
107
|
+
* @public
|
108
|
+
*/
|
109
|
+
declare function getMemoryStore(key: string): any;
|
110
|
+
/**
|
111
|
+
* ページをまたぐ変数を設定する
|
112
|
+
*
|
113
|
+
* @param key - 変数のキー
|
114
|
+
* @param value - 変数値
|
115
|
+
*
|
116
|
+
* @public
|
117
|
+
*/
|
118
|
+
declare function setLocalStore(key: string, value: any, options?: {
|
119
|
+
expire: number | boolean
|
120
|
+
}): void;
|
121
|
+
/**
|
122
|
+
* ページをまたぐ変数を取得設定する
|
123
|
+
*
|
124
|
+
* @param key - 変数のキー
|
125
|
+
*
|
126
|
+
* @returns 変数
|
127
|
+
*
|
128
|
+
* @public
|
129
|
+
*/
|
130
|
+
declare function getLocalStore(key: string): any | undefined;
|
131
|
+
export declare const storage: {
|
132
|
+
memory: {
|
133
|
+
store: typeof setMemoryStore
|
134
|
+
restore: typeof getMemoryStore
|
135
|
+
}
|
136
|
+
local: {
|
137
|
+
store: typeof setLocalStore
|
138
|
+
restore: typeof getLocalStore
|
139
|
+
}
|
140
|
+
};
|
141
|
+
/**
|
142
|
+
* アクションテーブルを操作するオブジェクト
|
143
|
+
*
|
144
|
+
* @param table - アクションテーブル名
|
145
|
+
*
|
146
|
+
* @public
|
147
|
+
*/
|
148
|
+
export declare function collection(table: string): ReturnType<typeof newCollection>;
|
package/dist/templates.cjs.js
CHANGED
@@ -1,16 +1,16 @@
|
|
1
|
-
|
1
|
+
"use strict";
|
2
2
|
|
3
|
+
//#region src/templates.ts
|
3
4
|
/**
|
4
|
-
|
5
|
-
|
5
|
+
* 最新SDKに対応したアクションコードを生成する関数群
|
6
|
+
*/
|
6
7
|
/**
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
function createAppScript(script =
|
12
|
-
|
13
|
-
return `<script lang="ts">
|
8
|
+
* アクションのアプリコード(App.svelte)の初期値の生成
|
9
|
+
*
|
10
|
+
* @internal
|
11
|
+
*/
|
12
|
+
function createAppScript(script = "", icons = [], customComponents = []) {
|
13
|
+
return `<script lang="ts">
|
14
14
|
// DON'T TOUCH THIS: SDK generates the following code
|
15
15
|
import type { ActionProps, ActionVariables } from '@plaidev/karte-action-sdk';
|
16
16
|
import type { Data, Props, Variables } from './gen';
|
@@ -73,16 +73,12 @@ import {
|
|
73
73
|
FlexClipCopy,
|
74
74
|
} from '@plaidev/karte-action-sdk';
|
75
75
|
|
76
|
-
${icons.length > 0
|
77
|
-
? `import {\n ${icons.join(',\n ')},\n} from '@plaidev/karte-action-sdk/icons';`
|
78
|
-
: ''}
|
76
|
+
${icons.length > 0 ? `import {\n ${icons.join(",\n ")},\n} from '@plaidev/karte-action-sdk/icons';` : ""}
|
79
77
|
|
80
|
-
${customComponents
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
})
|
85
|
-
.join('\n')}
|
78
|
+
${customComponents.map((path) => {
|
79
|
+
const componentName = path.split("/").pop().replace(".svelte", "");
|
80
|
+
return `import ${componentName} from '${path}';`;
|
81
|
+
}).join("\n")}
|
86
82
|
|
87
83
|
export let send: (event_name: string, values?: any) => void;
|
88
84
|
let data_: Data;
|
@@ -111,13 +107,12 @@ $: cssVariables = getCssVariables({ ...$data, ...$actionVariables });
|
|
111
107
|
</script>`;
|
112
108
|
}
|
113
109
|
/**
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
function createIndexTsx({ script =
|
119
|
-
|
120
|
-
return `import type { KarteAction, Send, Publish, Props, Variables } from './gen';
|
110
|
+
* アクションのエントリーコード(index.tsx)の初期値の生成
|
111
|
+
*
|
112
|
+
* @internal
|
113
|
+
*/
|
114
|
+
function createIndexTsx({ script = "" } = {}) {
|
115
|
+
return `import type { KarteAction, Send, Publish, Props, Variables } from './gen';
|
121
116
|
import { create } from '@plaidev/karte-action-sdk';
|
122
117
|
|
123
118
|
import { props, localVariablesQuery, karteTemplate } from './gen';
|
@@ -140,26 +135,23 @@ const action = (options: { send: Send; publish: Publish, props: Props; variables
|
|
140
135
|
export default action;`;
|
141
136
|
}
|
142
137
|
/**
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
function createCompatibleCustomScript({ script =
|
154
|
-
|
155
|
-
if (templateType === 'script') {
|
156
|
-
return `\
|
138
|
+
* 後方互換のためのカスタムスクリプトの初期値の生成
|
139
|
+
*
|
140
|
+
* customScript.tsが存在しない場合の後方互換コードを生成する。
|
141
|
+
* 実際のコードはアクションテンプレートごとに異なるため、この関数で生成するコードを不用意に初期値にしないこと。
|
142
|
+
*
|
143
|
+
* export defaultの引数をシンプルにするため、標準のアクションで使わない変数をpropsに入れていない。
|
144
|
+
* 標準以外の使い方をするケースはサポートドキュメントでフォローする。
|
145
|
+
*
|
146
|
+
* @internal
|
147
|
+
*/
|
148
|
+
function createCompatibleCustomScript({ script = "", templateType = "webpopup" } = {}) {
|
149
|
+
if (templateType === "script") return `\
|
157
150
|
${script}
|
158
151
|
export default ({ send, data }) => {
|
159
152
|
// ここにスクリプトを書いてください
|
160
153
|
};`;
|
161
|
-
|
162
|
-
return `\
|
154
|
+
return `\
|
163
155
|
import { showAction } from '@plaidev/karte-action-sdk';
|
164
156
|
${script}
|
165
157
|
export default ({ send, data }) => {
|
@@ -167,13 +159,12 @@ export default ({ send, data }) => {
|
|
167
159
|
showAction();
|
168
160
|
};`;
|
169
161
|
}
|
170
|
-
|
171
|
-
|
172
|
-
function createCustomScript(script = '') {
|
173
|
-
return createCompatibleCustomScript({ script });
|
162
|
+
function createCustomScript(script = "") {
|
163
|
+
return createCompatibleCustomScript({ script });
|
174
164
|
}
|
175
165
|
|
166
|
+
//#endregion
|
176
167
|
exports.createAppScript = createAppScript;
|
177
168
|
exports.createCompatibleCustomScript = createCompatibleCustomScript;
|
178
169
|
exports.createCustomScript = createCustomScript;
|
179
|
-
exports.createIndexTsx = createIndexTsx;
|
170
|
+
exports.createIndexTsx = createIndexTsx;
|
package/dist/templates.d.ts
CHANGED
@@ -1,34 +1,33 @@
|
|
1
1
|
/**
|
2
|
-
|
3
|
-
|
2
|
+
* 最新SDKに対応したアクションコードを生成する関数群
|
3
|
+
*/
|
4
4
|
/**
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
declare function createAppScript(script?: string, icons?: string[], customComponents?: string[]): string;
|
5
|
+
* アクションのアプリコード(App.svelte)の初期値の生成
|
6
|
+
*
|
7
|
+
* @internal
|
8
|
+
*/
|
9
|
+
export declare function createAppScript(script?: string, icons?: string[], customComponents?: string[]): string;
|
10
10
|
/**
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
declare function createIndexTsx({ script }?: {
|
16
|
-
|
11
|
+
* アクションのエントリーコード(index.tsx)の初期値の生成
|
12
|
+
*
|
13
|
+
* @internal
|
14
|
+
*/
|
15
|
+
export declare function createIndexTsx({ script }?: {
|
16
|
+
script?: string
|
17
17
|
}): string;
|
18
18
|
/**
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
declare function createCompatibleCustomScript({ script, templateType
|
30
|
-
|
31
|
-
|
19
|
+
* 後方互換のためのカスタムスクリプトの初期値の生成
|
20
|
+
*
|
21
|
+
* customScript.tsが存在しない場合の後方互換コードを生成する。
|
22
|
+
* 実際のコードはアクションテンプレートごとに異なるため、この関数で生成するコードを不用意に初期値にしないこと。
|
23
|
+
*
|
24
|
+
* export defaultの引数をシンプルにするため、標準のアクションで使わない変数をpropsに入れていない。
|
25
|
+
* 標準以外の使い方をするケースはサポートドキュメントでフォローする。
|
26
|
+
*
|
27
|
+
* @internal
|
28
|
+
*/
|
29
|
+
export declare function createCompatibleCustomScript({ script, templateType }?: {
|
30
|
+
script?: string
|
31
|
+
templateType?: "webpopup" | "script"
|
32
32
|
}): string;
|
33
|
-
declare function createCustomScript(script?: string): ReturnType<typeof createCompatibleCustomScript>;
|
34
|
-
export { createAppScript, createIndexTsx, createCompatibleCustomScript, createCustomScript };
|
33
|
+
export declare function createCustomScript(script?: string): ReturnType<typeof createCompatibleCustomScript>;
|
package/dist/templates.js
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
+
//#region src/templates.ts
|
1
2
|
/**
|
2
|
-
|
3
|
-
|
3
|
+
* 最新SDKに対応したアクションコードを生成する関数群
|
4
|
+
*/
|
4
5
|
/**
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
function createAppScript(script =
|
10
|
-
|
11
|
-
return `<script lang="ts">
|
6
|
+
* アクションのアプリコード(App.svelte)の初期値の生成
|
7
|
+
*
|
8
|
+
* @internal
|
9
|
+
*/
|
10
|
+
function createAppScript(script = "", icons = [], customComponents = []) {
|
11
|
+
return `<script lang="ts">
|
12
12
|
// DON'T TOUCH THIS: SDK generates the following code
|
13
13
|
import type { ActionProps, ActionVariables } from '@plaidev/karte-action-sdk';
|
14
14
|
import type { Data, Props, Variables } from './gen';
|
@@ -71,16 +71,12 @@ import {
|
|
71
71
|
FlexClipCopy,
|
72
72
|
} from '@plaidev/karte-action-sdk';
|
73
73
|
|
74
|
-
${icons.length > 0
|
75
|
-
? `import {\n ${icons.join(',\n ')},\n} from '@plaidev/karte-action-sdk/icons';`
|
76
|
-
: ''}
|
74
|
+
${icons.length > 0 ? `import {\n ${icons.join(",\n ")},\n} from '@plaidev/karte-action-sdk/icons';` : ""}
|
77
75
|
|
78
|
-
${customComponents
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
})
|
83
|
-
.join('\n')}
|
76
|
+
${customComponents.map((path) => {
|
77
|
+
const componentName = path.split("/").pop().replace(".svelte", "");
|
78
|
+
return `import ${componentName} from '${path}';`;
|
79
|
+
}).join("\n")}
|
84
80
|
|
85
81
|
export let send: (event_name: string, values?: any) => void;
|
86
82
|
let data_: Data;
|
@@ -109,13 +105,12 @@ $: cssVariables = getCssVariables({ ...$data, ...$actionVariables });
|
|
109
105
|
</script>`;
|
110
106
|
}
|
111
107
|
/**
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
function createIndexTsx({ script =
|
117
|
-
|
118
|
-
return `import type { KarteAction, Send, Publish, Props, Variables } from './gen';
|
108
|
+
* アクションのエントリーコード(index.tsx)の初期値の生成
|
109
|
+
*
|
110
|
+
* @internal
|
111
|
+
*/
|
112
|
+
function createIndexTsx({ script = "" } = {}) {
|
113
|
+
return `import type { KarteAction, Send, Publish, Props, Variables } from './gen';
|
119
114
|
import { create } from '@plaidev/karte-action-sdk';
|
120
115
|
|
121
116
|
import { props, localVariablesQuery, karteTemplate } from './gen';
|
@@ -138,26 +133,23 @@ const action = (options: { send: Send; publish: Publish, props: Props; variables
|
|
138
133
|
export default action;`;
|
139
134
|
}
|
140
135
|
/**
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
function createCompatibleCustomScript({ script =
|
152
|
-
|
153
|
-
if (templateType === 'script') {
|
154
|
-
return `\
|
136
|
+
* 後方互換のためのカスタムスクリプトの初期値の生成
|
137
|
+
*
|
138
|
+
* customScript.tsが存在しない場合の後方互換コードを生成する。
|
139
|
+
* 実際のコードはアクションテンプレートごとに異なるため、この関数で生成するコードを不用意に初期値にしないこと。
|
140
|
+
*
|
141
|
+
* export defaultの引数をシンプルにするため、標準のアクションで使わない変数をpropsに入れていない。
|
142
|
+
* 標準以外の使い方をするケースはサポートドキュメントでフォローする。
|
143
|
+
*
|
144
|
+
* @internal
|
145
|
+
*/
|
146
|
+
function createCompatibleCustomScript({ script = "", templateType = "webpopup" } = {}) {
|
147
|
+
if (templateType === "script") return `\
|
155
148
|
${script}
|
156
149
|
export default ({ send, data }) => {
|
157
150
|
// ここにスクリプトを書いてください
|
158
151
|
};`;
|
159
|
-
|
160
|
-
return `\
|
152
|
+
return `\
|
161
153
|
import { showAction } from '@plaidev/karte-action-sdk';
|
162
154
|
${script}
|
163
155
|
export default ({ send, data }) => {
|
@@ -165,10 +157,9 @@ export default ({ send, data }) => {
|
|
165
157
|
showAction();
|
166
158
|
};`;
|
167
159
|
}
|
168
|
-
|
169
|
-
|
170
|
-
function createCustomScript(script = '') {
|
171
|
-
return createCompatibleCustomScript({ script });
|
160
|
+
function createCustomScript(script = "") {
|
161
|
+
return createCompatibleCustomScript({ script });
|
172
162
|
}
|
173
163
|
|
174
|
-
|
164
|
+
//#endregion
|
165
|
+
export { createAppScript, createCompatibleCustomScript, createCustomScript, createIndexTsx };
|
package/dist/types.d.ts
ADDED
@@ -0,0 +1,183 @@
|
|
1
|
+
/**
|
2
|
+
* アクションの汎用的なタイプを定義する
|
3
|
+
*
|
4
|
+
* モーダル(ポップアップ)やアクションテーブルなど機能別のタイプは含めない。
|
5
|
+
*/
|
6
|
+
/**
|
7
|
+
* アクションのイベントハンドラ
|
8
|
+
*
|
9
|
+
* @public
|
10
|
+
*/
|
11
|
+
export type ActionEventHandler = (...args: any[]) => any | Promise<any>;
|
12
|
+
/**
|
13
|
+
* アクションの変数
|
14
|
+
*
|
15
|
+
* @public
|
16
|
+
*/
|
17
|
+
export type ActionVariables = {
|
18
|
+
[key: string]: any
|
19
|
+
};
|
20
|
+
/**
|
21
|
+
* アクションの send 関数
|
22
|
+
*
|
23
|
+
* @public
|
24
|
+
*/
|
25
|
+
export type SendFunction = (event_name: string, values?: any) => void;
|
26
|
+
/**
|
27
|
+
* アクションの publish 関数
|
28
|
+
*
|
29
|
+
* @public
|
30
|
+
*/
|
31
|
+
export type PublishFunction = (topic: string, values?: any) => void;
|
32
|
+
/**
|
33
|
+
* アクション設定
|
34
|
+
*
|
35
|
+
* @public
|
36
|
+
*/
|
37
|
+
export type ActionSetting = {
|
38
|
+
send?: SendFunction
|
39
|
+
publish?: PublishFunction
|
40
|
+
initialState?: string
|
41
|
+
};
|
42
|
+
/**
|
43
|
+
* アクションのライフサイクル changeState で呼び出されるフック関数
|
44
|
+
*
|
45
|
+
* @param props - アクションのプロパティ
|
46
|
+
* @param newState - アクションの新しいステート
|
47
|
+
*
|
48
|
+
* @public
|
49
|
+
*/
|
50
|
+
export type ActionChangeStateHook<
|
51
|
+
Props,
|
52
|
+
Variables
|
53
|
+
> = (props: Parameters<ActionHook<Props, Variables & ActionVariables>>[0], newState: string) => void | Promise<void>;
|
54
|
+
/**
|
55
|
+
* アクションのプロパティ
|
56
|
+
*
|
57
|
+
* @public
|
58
|
+
*/
|
59
|
+
export interface ActionProps<
|
60
|
+
Props,
|
61
|
+
Variables
|
62
|
+
> {
|
63
|
+
/**
|
64
|
+
* アクションでイベントがトリガーされたときに受信するための関数
|
65
|
+
*/
|
66
|
+
send: SendFunction;
|
67
|
+
/**
|
68
|
+
* アクション内でタグのQueueにリクエストを発行する関数
|
69
|
+
*/
|
70
|
+
publish: PublishFunction;
|
71
|
+
/**
|
72
|
+
* アクションで使用されるデータ
|
73
|
+
*/
|
74
|
+
data: Props & Variables & ActionVariables;
|
75
|
+
/**
|
76
|
+
* アクションが表示されたときにフックされる {@link onShow}
|
77
|
+
*/
|
78
|
+
onShow?: ActionHook<Props, Variables & ActionVariables>;
|
79
|
+
/**
|
80
|
+
* アクションのステートが変更されたときにフックされる {@link onChangeState}
|
81
|
+
*/
|
82
|
+
onChangeState?: ActionChangeStateHook<Props, Variables & ActionVariables>;
|
83
|
+
}
|
84
|
+
/**
|
85
|
+
* アクションのライフサイクルで呼び出されるフック
|
86
|
+
*
|
87
|
+
* @param props - アクションのプロパティ
|
88
|
+
*
|
89
|
+
* @public
|
90
|
+
*/
|
91
|
+
export type ActionHook<
|
92
|
+
Props,
|
93
|
+
Variables
|
94
|
+
> = (props: ActionProps<Props, Variables & ActionVariables>) => void | Promise<void>;
|
95
|
+
/**
|
96
|
+
* {@link create} 向けのオプション
|
97
|
+
*
|
98
|
+
* @public
|
99
|
+
*/
|
100
|
+
export interface ActionOptions<
|
101
|
+
Props,
|
102
|
+
Variables,
|
103
|
+
VariablesQuery
|
104
|
+
> {
|
105
|
+
/**
|
106
|
+
* アクション内でイベントを発火する関数
|
107
|
+
*
|
108
|
+
* @defaultValue `() => {}`
|
109
|
+
*/
|
110
|
+
send?: SendFunction;
|
111
|
+
/**
|
112
|
+
* アクション内でタグのQueueにリクエストを発行する関数
|
113
|
+
*
|
114
|
+
* @defaultValue `() => {}`
|
115
|
+
*/
|
116
|
+
publish?: PublishFunction;
|
117
|
+
/**
|
118
|
+
* アクションで使用されるプロパティ
|
119
|
+
*
|
120
|
+
* @defaultValue `{}`
|
121
|
+
*/
|
122
|
+
props?: Props;
|
123
|
+
/**
|
124
|
+
* アクションで使用される解析時に取得される変数
|
125
|
+
*
|
126
|
+
* @defaultValue `{}`
|
127
|
+
*/
|
128
|
+
variables?: Variables;
|
129
|
+
/**
|
130
|
+
* アクションで使用されるアクション実行時に取得される変数
|
131
|
+
*
|
132
|
+
* @defaultValue `[]`
|
133
|
+
*/
|
134
|
+
localVariablesQuery?: VariablesQuery;
|
135
|
+
/**
|
136
|
+
* アクションが作成されているときにフックされる {@link onCreate}
|
137
|
+
*
|
138
|
+
* @defaultValue `() => {}`
|
139
|
+
*/
|
140
|
+
onCreate?: ActionHook<Props, Variables & ActionVariables>;
|
141
|
+
/**
|
142
|
+
* KARTEテンプレートの情報
|
143
|
+
*
|
144
|
+
* @defaultValue `{}`
|
145
|
+
*/
|
146
|
+
karteTemplate?: {
|
147
|
+
[key: string]: any
|
148
|
+
};
|
149
|
+
/**
|
150
|
+
* アクション実行時のコンテキスト
|
151
|
+
*/
|
152
|
+
context: ActionRunnerContext;
|
153
|
+
}
|
154
|
+
/**
|
155
|
+
* KARTE のシステム設定情報
|
156
|
+
*
|
157
|
+
* @public
|
158
|
+
*/
|
159
|
+
export type SystemConfig = {
|
160
|
+
/**
|
161
|
+
* API キー
|
162
|
+
*/
|
163
|
+
apiKey?: string
|
164
|
+
collection_endpoint?: string
|
165
|
+
/**
|
166
|
+
* 接客ID
|
167
|
+
*/
|
168
|
+
campaignId?: string
|
169
|
+
shortenId?: string
|
170
|
+
};
|
171
|
+
/** @internal */
|
172
|
+
export type ActionHookLog = {
|
173
|
+
name: string
|
174
|
+
values?: any
|
175
|
+
};
|
176
|
+
/**
|
177
|
+
* アクション実行時のコンテキスト
|
178
|
+
*/
|
179
|
+
export type ActionRunnerContext = {
|
180
|
+
api_key: string
|
181
|
+
collection_endpoint?: string
|
182
|
+
target?: "web" | "native"
|
183
|
+
};
|