@plaidev/karte-action-sdk 1.1.129 → 1.1.130-27958202.2eba0943
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/hydrate/index.es.d.ts +331 -109
- package/dist/hydrate/index.es.js +193 -65
- package/dist/index.es.d.ts +331 -109
- package/dist/index.es.js +193 -65
- package/dist/templates.cjs.js +6 -13
- package/dist/templates.js +6 -13
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
@@ -209,13 +209,13 @@ const getStoreState = get;
|
|
209
209
|
*/
|
210
210
|
const actionSetting = writable({ autoStart: true });
|
211
211
|
/**
|
212
|
-
* {@link
|
212
|
+
* {@link getSetting} function to get action setting.
|
213
213
|
*
|
214
214
|
* @returns Current action setting
|
215
215
|
*
|
216
216
|
* @internal
|
217
217
|
*/
|
218
|
-
function
|
218
|
+
function getSetting() {
|
219
219
|
return get(actionSetting);
|
220
220
|
}
|
221
221
|
/**
|
@@ -230,23 +230,14 @@ function getActionSetting() {
|
|
230
230
|
*
|
231
231
|
* @public
|
232
232
|
*/
|
233
|
-
function
|
233
|
+
function setSetting(setting) {
|
234
234
|
actionSetting.update(current => {
|
235
235
|
return { ...current, ...setting };
|
236
236
|
});
|
237
|
-
const current =
|
237
|
+
const current = getSetting();
|
238
238
|
setStopped(!current.autoStart);
|
239
239
|
return current;
|
240
240
|
}
|
241
|
-
/**
|
242
|
-
* {@link resetActionSetting} function to reset action setting
|
243
|
-
*
|
244
|
-
* @internal
|
245
|
-
*/
|
246
|
-
function resetActionSetting() {
|
247
|
-
actionSetting.set({ autoStart: true });
|
248
|
-
setStopped(false);
|
249
|
-
}
|
250
241
|
/**
|
251
242
|
* Store to read KARTE system config
|
252
243
|
*
|
@@ -466,50 +457,50 @@ function setWidgetHandlers(handlers) {
|
|
466
457
|
widgetHandlers.set(handlers);
|
467
458
|
}
|
468
459
|
/**
|
469
|
-
* Store to handle
|
460
|
+
* Store to handle event handlers
|
470
461
|
*
|
471
462
|
* This is used internally.
|
472
463
|
*
|
473
464
|
* @internal
|
474
465
|
*/
|
475
|
-
const
|
466
|
+
const eventHandlers = writable({});
|
476
467
|
/**
|
477
|
-
*
|
468
|
+
* イベントハンドラーの一覧を取得する
|
478
469
|
*
|
479
|
-
* @returns
|
470
|
+
* @returns 現在のイベントハンドラー
|
480
471
|
*
|
481
472
|
* @public
|
482
473
|
*/
|
483
|
-
function
|
484
|
-
return get(
|
474
|
+
function getEventHandlers() {
|
475
|
+
return get(eventHandlers);
|
485
476
|
}
|
486
477
|
/**
|
487
|
-
*
|
478
|
+
* イベントハンドラーを登録する
|
488
479
|
*
|
489
480
|
* @remarks
|
490
|
-
*
|
481
|
+
* 登録したイベントハンドラーは、ビジュアルエディタでアクション本体とのテキストボタンのクリック時の動作で利用できます。
|
491
482
|
*
|
492
|
-
* @param handlers -
|
483
|
+
* @param handlers - 登録するイベントハンドラー
|
493
484
|
*
|
494
485
|
* @public
|
495
486
|
*/
|
496
|
-
function
|
497
|
-
|
487
|
+
function setEventHandlers(handlers) {
|
488
|
+
eventHandlers.set(handlers);
|
498
489
|
}
|
499
490
|
/**
|
500
|
-
*
|
491
|
+
* イベントハンドラーを更新する
|
501
492
|
*
|
502
|
-
* @param handlers -
|
493
|
+
* @param handlers - 対象となるイベントハンドラー
|
503
494
|
*
|
504
|
-
* @returns
|
495
|
+
* @returns 新しいイベントハンドラーを返します。
|
505
496
|
*
|
506
497
|
* @public
|
507
498
|
*/
|
508
|
-
function
|
509
|
-
|
499
|
+
function updateEventHandlers(handlers) {
|
500
|
+
eventHandlers.update(current => {
|
510
501
|
return { ...current, ...handlers };
|
511
502
|
});
|
512
|
-
return
|
503
|
+
return getEventHandlers();
|
513
504
|
}
|
514
505
|
/**
|
515
506
|
* Store to handle destruction of action
|
@@ -560,42 +551,130 @@ function setStopped(on) {
|
|
560
551
|
}
|
561
552
|
}
|
562
553
|
/**
|
563
|
-
* Store to handle
|
554
|
+
* Store to handle variables
|
564
555
|
*
|
565
556
|
* @internal
|
566
557
|
*/
|
567
|
-
const
|
558
|
+
const variables = writable({});
|
568
559
|
/**
|
569
|
-
*
|
560
|
+
* 変数の一覧を取得する
|
570
561
|
*
|
571
|
-
* @returns
|
562
|
+
* @returns 現在の変数の一覧
|
572
563
|
*
|
573
|
-
* @
|
564
|
+
* @internal
|
574
565
|
*/
|
575
|
-
function
|
576
|
-
return get(
|
566
|
+
function getVariables() {
|
567
|
+
return get(variables);
|
577
568
|
}
|
578
569
|
/**
|
579
|
-
*
|
570
|
+
* 変数を設定する
|
580
571
|
*
|
581
572
|
* @remarks
|
582
573
|
* 設定した変数は、ビジュアルエディタのテキストフォームなどで利用できます。
|
583
574
|
*
|
584
|
-
* @param
|
575
|
+
* @param vars - 変数
|
585
576
|
*
|
586
|
-
* @
|
577
|
+
* @internal
|
578
|
+
*/
|
579
|
+
function setVariables(vars) {
|
580
|
+
variables.set(vars);
|
581
|
+
}
|
582
|
+
/**
|
583
|
+
* 変数を更新する
|
584
|
+
*
|
585
|
+
* @param variables - 更新する変数
|
586
|
+
*
|
587
|
+
* @returns 新しい変数を返します。
|
588
|
+
*
|
589
|
+
* @internal
|
590
|
+
*/
|
591
|
+
function updateVariables(vars) {
|
592
|
+
variables.update(current => {
|
593
|
+
return { ...current, ...vars };
|
594
|
+
});
|
595
|
+
return getVariables();
|
596
|
+
}
|
597
|
+
/**
|
598
|
+
* Store for form data
|
599
|
+
*
|
600
|
+
* @internal
|
601
|
+
*/
|
602
|
+
const formData = writable({});
|
603
|
+
/**
|
604
|
+
* 非推奨
|
605
|
+
*
|
606
|
+
* @deprecated 非推奨
|
607
|
+
*
|
608
|
+
* @internal
|
609
|
+
*/
|
610
|
+
const customHandlers = writable({});
|
611
|
+
/**
|
612
|
+
* 非推奨
|
613
|
+
*
|
614
|
+
* @deprecated 非推奨
|
615
|
+
*
|
616
|
+
* @internal
|
617
|
+
*/
|
618
|
+
function getCustomHandlers() {
|
619
|
+
return get(customHandlers);
|
620
|
+
}
|
621
|
+
/**
|
622
|
+
* 非推奨
|
623
|
+
*
|
624
|
+
* @deprecated 非推奨
|
625
|
+
*
|
626
|
+
* @internal
|
627
|
+
*/
|
628
|
+
function setCustomHandlers(handlers) {
|
629
|
+
customHandlers.set(handlers);
|
630
|
+
}
|
631
|
+
/**
|
632
|
+
* 非推奨
|
633
|
+
*
|
634
|
+
* @deprecated 非推奨
|
635
|
+
*
|
636
|
+
* @internal
|
637
|
+
*/
|
638
|
+
function updateCustomHandlers(handlers) {
|
639
|
+
customHandlers.update(current => {
|
640
|
+
return { ...current, ...handlers };
|
641
|
+
});
|
642
|
+
return getCustomHandlers();
|
643
|
+
}
|
644
|
+
/**
|
645
|
+
* 非推奨
|
646
|
+
*
|
647
|
+
* @deprecated 非推奨
|
648
|
+
*
|
649
|
+
* @internal
|
650
|
+
*/
|
651
|
+
const customVariables = writable({});
|
652
|
+
/**
|
653
|
+
* 非推奨
|
654
|
+
*
|
655
|
+
* @deprecated 非推奨
|
656
|
+
*
|
657
|
+
* @internal
|
658
|
+
*/
|
659
|
+
function getCustomVariables() {
|
660
|
+
return get(customVariables);
|
661
|
+
}
|
662
|
+
/**
|
663
|
+
* 非推奨
|
664
|
+
*
|
665
|
+
* @deprecated 非推奨
|
666
|
+
*
|
667
|
+
* @internal
|
587
668
|
*/
|
588
669
|
function setCustomVariables(variables) {
|
589
670
|
customVariables.set(variables);
|
590
671
|
}
|
591
672
|
/**
|
592
|
-
*
|
673
|
+
* 非推奨
|
593
674
|
*
|
594
|
-
* @
|
595
|
-
*
|
596
|
-
* @returns 新しいカスタム変数を返します。
|
675
|
+
* @deprecated 非推奨
|
597
676
|
*
|
598
|
-
* @
|
677
|
+
* @internal
|
599
678
|
*/
|
600
679
|
function updateCustomVariables(variables) {
|
601
680
|
customVariables.update(current => {
|
@@ -604,11 +683,41 @@ function updateCustomVariables(variables) {
|
|
604
683
|
return getCustomVariables();
|
605
684
|
}
|
606
685
|
/**
|
607
|
-
*
|
686
|
+
* 非推奨
|
687
|
+
*
|
688
|
+
* @deprecated 非推奨
|
608
689
|
*
|
609
690
|
* @internal
|
610
691
|
*/
|
611
|
-
|
692
|
+
function getActionSetting() {
|
693
|
+
return get(actionSetting);
|
694
|
+
}
|
695
|
+
/**
|
696
|
+
* 非推奨
|
697
|
+
*
|
698
|
+
* @deprecated 非推奨
|
699
|
+
*
|
700
|
+
* @internal
|
701
|
+
*/
|
702
|
+
function setActionSetting(setting) {
|
703
|
+
actionSetting.update(current => {
|
704
|
+
return { ...current, ...setting };
|
705
|
+
});
|
706
|
+
const current = getActionSetting();
|
707
|
+
setStopped(!current.autoStart);
|
708
|
+
return current;
|
709
|
+
}
|
710
|
+
/**
|
711
|
+
* 非推奨
|
712
|
+
*
|
713
|
+
* @deprecated 非推奨
|
714
|
+
*
|
715
|
+
* @internal
|
716
|
+
*/
|
717
|
+
function resetActionSetting() {
|
718
|
+
actionSetting.set({ autoStart: true });
|
719
|
+
setStopped(false);
|
720
|
+
}
|
612
721
|
|
613
722
|
function isEmpty(value) {
|
614
723
|
if (Array.isArray(value)) {
|
@@ -1819,7 +1928,7 @@ function dispatchDestroyEvent() {
|
|
1819
1928
|
*
|
1820
1929
|
* @public
|
1821
1930
|
*/
|
1822
|
-
function
|
1931
|
+
function destroyAction() {
|
1823
1932
|
setDestroyed(true);
|
1824
1933
|
dispatchDestroyEvent();
|
1825
1934
|
}
|
@@ -1890,7 +1999,7 @@ const h = (type, props, ...children) => {
|
|
1890
1999
|
return el;
|
1891
2000
|
};
|
1892
2001
|
/**
|
1893
|
-
*
|
2002
|
+
* 非推奨
|
1894
2003
|
*
|
1895
2004
|
* @deprecated 非推奨
|
1896
2005
|
*
|
@@ -1922,14 +2031,13 @@ function createFog({ color = '#000', opacity = '50%', zIndex = 999, onclick, })
|
|
1922
2031
|
return { fog, close };
|
1923
2032
|
}
|
1924
2033
|
/**
|
1925
|
-
*
|
2034
|
+
* アクションのルートの DOM 要素を取得する
|
1926
2035
|
*
|
1927
|
-
* @returns
|
1928
|
-
* アクションが Shadow Root を持つ場合は Shadow Root の Element 返します。ない場合は `null` を返します
|
2036
|
+
* @returns アクションがルートの DOM 要素 を持つ場合は DOM 要素を返します。ない場合は `null` を返します
|
1929
2037
|
*
|
1930
2038
|
* @public
|
1931
2039
|
*/
|
1932
|
-
function
|
2040
|
+
function getActionRoot() {
|
1933
2041
|
const root = document.querySelector(`.${KARTE_ACTION_ROOT}[data-${KARTE_ACTION_RID}='${actionId}']`);
|
1934
2042
|
if (!root?.shadowRoot) {
|
1935
2043
|
return null;
|
@@ -2019,7 +2127,7 @@ async function loadStyle(href) {
|
|
2019
2127
|
}
|
2020
2128
|
// -------- The following codes are deprecated --------
|
2021
2129
|
/**
|
2022
|
-
*
|
2130
|
+
* 非推奨
|
2023
2131
|
*
|
2024
2132
|
* @deprecated 非推奨
|
2025
2133
|
*
|
@@ -2027,7 +2135,7 @@ async function loadStyle(href) {
|
|
2027
2135
|
*/
|
2028
2136
|
const showModal = create;
|
2029
2137
|
/**
|
2030
|
-
*
|
2138
|
+
* 非推奨
|
2031
2139
|
*
|
2032
2140
|
* @deprecated 非推奨
|
2033
2141
|
*
|
@@ -2035,7 +2143,7 @@ const showModal = create;
|
|
2035
2143
|
*/
|
2036
2144
|
const KARTE_MODAL_ROOT = 'karte-modal-root';
|
2037
2145
|
/**
|
2038
|
-
*
|
2146
|
+
* 非推奨
|
2039
2147
|
*
|
2040
2148
|
* @deprecated 非推奨
|
2041
2149
|
*
|
@@ -2043,7 +2151,7 @@ const KARTE_MODAL_ROOT = 'karte-modal-root';
|
|
2043
2151
|
*/
|
2044
2152
|
const ensureModalRoot = ensureActionRoot;
|
2045
2153
|
/**
|
2046
|
-
*
|
2154
|
+
* 非推奨
|
2047
2155
|
*
|
2048
2156
|
* @deprecated 非推奨
|
2049
2157
|
*
|
@@ -2051,7 +2159,7 @@ const ensureModalRoot = ensureActionRoot;
|
|
2051
2159
|
*/
|
2052
2160
|
const show = showAction;
|
2053
2161
|
/**
|
2054
|
-
*
|
2162
|
+
* 非推奨
|
2055
2163
|
*
|
2056
2164
|
* @deprecated 非推奨
|
2057
2165
|
*
|
@@ -2059,12 +2167,7 @@ const show = showAction;
|
|
2059
2167
|
*/
|
2060
2168
|
const close = closeAction;
|
2061
2169
|
/**
|
2062
|
-
*
|
2063
|
-
*
|
2064
|
-
* @param App - An entry point of svelte component.
|
2065
|
-
* @param options - An {@link AppOptions | options}
|
2066
|
-
*
|
2067
|
-
* @returns A function to close the modal
|
2170
|
+
* 非推奨
|
2068
2171
|
*
|
2069
2172
|
* @deprecated 非推奨
|
2070
2173
|
*
|
@@ -2109,6 +2212,31 @@ function createApp(App, options = {
|
|
2109
2212
|
},
|
2110
2213
|
};
|
2111
2214
|
}
|
2215
|
+
/**
|
2216
|
+
* 非推奨
|
2217
|
+
*
|
2218
|
+
* @deprecated 非推奨
|
2219
|
+
*
|
2220
|
+
* @internal
|
2221
|
+
*/
|
2222
|
+
function getActionShadowRoot() {
|
2223
|
+
const root = document.querySelector(`.${KARTE_ACTION_ROOT}[data-${KARTE_ACTION_RID}='${actionId}']`);
|
2224
|
+
if (!root?.shadowRoot) {
|
2225
|
+
return null;
|
2226
|
+
}
|
2227
|
+
return root.shadowRoot;
|
2228
|
+
}
|
2229
|
+
/**
|
2230
|
+
* 非推奨
|
2231
|
+
*
|
2232
|
+
* @deprecated 非推奨
|
2233
|
+
*
|
2234
|
+
* @internal
|
2235
|
+
*/
|
2236
|
+
function destroy() {
|
2237
|
+
setDestroyed(true);
|
2238
|
+
dispatchDestroyEvent();
|
2239
|
+
}
|
2112
2240
|
|
2113
2241
|
/**
|
2114
2242
|
* Widget API 互換のインターフェース
|
@@ -7972,4 +8100,4 @@ class ImageBlock extends SvelteComponent {
|
|
7972
8100
|
}
|
7973
8101
|
}
|
7974
8102
|
|
7975
|
-
export { ACTION_HOOK_LABEL, Alignments, AnimationStyles, BackgroundSizes, ClipPaths, Cursors, DefaultEdgePosition, DefaultFormButtonStyle, DefaultFormRatingButtonType, DefaultFormSelectStyle, DefaultListBackground, DefaultListBackgroundNone, DefaultListBackgroundStripe, DefaultListSeparator, DefaultListSeparatorBorder, DefaultListSeparatorGap, DefaultListSeparatorNone, DefaultModalPlacement, DefaultSlideButton, DefaultSlideNavigationButton, Directions, Elasticities, ElasticityStyle, EmbedElement, Flex, FlexItem, FormCheckBoxes, FormRadioButtons, FormRatingButtonTypes, FormRatingButtons, FormSelect, FormTextarea, Grid, GridItem, GridModalState, ImageBlock, ImageElement, Justifies, KARTE_MODAL_ROOT, LengthUnits, List, ListBackgroundTypes, ListDirections, ListItem, ListSeparatorTypes, MediaQueries, Modal, ModalPositions, MovieVimeoElement, MovieYouTubeElement, ObjectFits, OnClickOperationOptions, Overflows, PropTypes, Repeats, Slide, SlideItem, State, StateItem, TextBlock, TextButtonBlock, TextButtonElement, TextDirections, TextElement, WritingModes, applyCss, applyGlobalCss, close, closeAction, closed, collection$1 as collection, create, createApp, createFog, customHandlers, customVariables, destroy, destroyed, ensureModalRoot, finalize, formData, getActionShadowRoot, getCustomHandlers, getCustomVariables, getEvents, getLogs, getState$1 as getState, getStates, getStoreState, getSystem, hideOnScroll, hideOnTime, initialize, isClosed, isOpened, listenLogger, loadActionTable, loadActionTableQuery, loadActionTableRow, loadActionTableRows, loadGlobalScript, loadGlobalStyle, loadStyle, logger, onChangeState, onClose, onCreate, onDestroy, onScroll, onShow, onTime, opened, setActionSetting, setAutoStart, setClosed, setCustomHandlers, setCustomVariables, setState$1 as setState, show, showAction, showModal, showOnScroll, showOnTime, state, stopped, updateCustomHandlers, updateCustomVariables, widget };
|
8103
|
+
export { ACTION_HOOK_LABEL, Alignments, AnimationStyles, BackgroundSizes, ClipPaths, Cursors, DefaultEdgePosition, DefaultFormButtonStyle, DefaultFormRatingButtonType, DefaultFormSelectStyle, DefaultListBackground, DefaultListBackgroundNone, DefaultListBackgroundStripe, DefaultListSeparator, DefaultListSeparatorBorder, DefaultListSeparatorGap, DefaultListSeparatorNone, DefaultModalPlacement, DefaultSlideButton, DefaultSlideNavigationButton, Directions, Elasticities, ElasticityStyle, EmbedElement, Flex, FlexItem, FormCheckBoxes, FormRadioButtons, FormRatingButtonTypes, FormRatingButtons, FormSelect, FormTextarea, Grid, GridItem, GridModalState, ImageBlock, ImageElement, Justifies, KARTE_MODAL_ROOT, LengthUnits, List, ListBackgroundTypes, ListDirections, ListItem, ListSeparatorTypes, MediaQueries, Modal, ModalPositions, MovieVimeoElement, MovieYouTubeElement, ObjectFits, OnClickOperationOptions, Overflows, PropTypes, Repeats, Slide, SlideItem, State, StateItem, TextBlock, TextButtonBlock, TextButtonElement, TextDirections, TextElement, WritingModes, applyCss, applyGlobalCss, close, closeAction, closed, collection$1 as collection, create, createApp, createFog, customHandlers, customVariables, destroy, destroyAction, destroyed, ensureModalRoot, eventHandlers, finalize, formData, getActionRoot, getActionShadowRoot, getCustomHandlers, getCustomVariables, getEventHandlers, getEvents, getLogs, getState$1 as getState, getStates, getStoreState, getSystem, getVariables, hideOnScroll, hideOnTime, initialize, isClosed, isOpened, listenLogger, loadActionTable, loadActionTableQuery, loadActionTableRow, loadActionTableRows, loadGlobalScript, loadGlobalStyle, loadStyle, logger, onChangeState, onClose, onCreate, onDestroy, onScroll, onShow, onTime, opened, setActionSetting, setAutoStart, setClosed, setCustomHandlers, setCustomVariables, setEventHandlers, setSetting, setState$1 as setState, setVariables, show, showAction, showModal, showOnScroll, showOnTime, state, stopped, updateCustomHandlers, updateCustomVariables, updateEventHandlers, updateVariables, variables, widget };
|
package/dist/templates.cjs.js
CHANGED
@@ -81,25 +81,18 @@ const action = (options: { send: Send; props: Props; variables: Variables }): Ka
|
|
81
81
|
export default action;`;
|
82
82
|
}
|
83
83
|
function createCustomScript(script = '') {
|
84
|
-
return
|
85
|
-
* アクションをカスタマイズするスクリプト
|
86
|
-
*/
|
87
|
-
// ここでSDKをインポートしてください
|
88
|
-
//import jQuery from "jquery";
|
84
|
+
return `
|
89
85
|
//import {
|
90
86
|
// onShow,
|
91
87
|
// onClose,
|
92
88
|
// onChangeState,
|
93
|
-
// onDestroy
|
94
|
-
// setCustomVariables,
|
95
|
-
// setCustomHandlers,
|
89
|
+
// onDestroy
|
96
90
|
//} from "@plaidev/karte-action-sdk";
|
97
|
-
${script}
|
98
|
-
const onCreate = ({ send, data }) => {
|
99
|
-
// ここでアクションが作成される時のスクリプトを書いてください
|
100
|
-
};
|
101
91
|
|
102
|
-
|
92
|
+
${script}
|
93
|
+
export default ({ send, data }) => {
|
94
|
+
// ここにスクリプトを書いてください
|
95
|
+
};`;
|
103
96
|
}
|
104
97
|
|
105
98
|
exports.createAppScript = createAppScript;
|
package/dist/templates.js
CHANGED
@@ -79,25 +79,18 @@ const action = (options: { send: Send; props: Props; variables: Variables }): Ka
|
|
79
79
|
export default action;`;
|
80
80
|
}
|
81
81
|
function createCustomScript(script = '') {
|
82
|
-
return
|
83
|
-
* アクションをカスタマイズするスクリプト
|
84
|
-
*/
|
85
|
-
// ここでSDKをインポートしてください
|
86
|
-
//import jQuery from "jquery";
|
82
|
+
return `
|
87
83
|
//import {
|
88
84
|
// onShow,
|
89
85
|
// onClose,
|
90
86
|
// onChangeState,
|
91
|
-
// onDestroy
|
92
|
-
// setCustomVariables,
|
93
|
-
// setCustomHandlers,
|
87
|
+
// onDestroy
|
94
88
|
//} from "@plaidev/karte-action-sdk";
|
95
|
-
${script}
|
96
|
-
const onCreate = ({ send, data }) => {
|
97
|
-
// ここでアクションが作成される時のスクリプトを書いてください
|
98
|
-
};
|
99
89
|
|
100
|
-
|
90
|
+
${script}
|
91
|
+
export default ({ send, data }) => {
|
92
|
+
// ここにスクリプトを書いてください
|
93
|
+
};`;
|
101
94
|
}
|
102
95
|
|
103
96
|
export { createAppScript, createCustomScript, createIndexTsx };
|