@plaidev/karte-action-sdk 1.1.126-27950980.e8e536b0 → 1.1.126-27952306.7e987116

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.
@@ -890,21 +890,28 @@ declare function onTime(time: number, fn: Function): () => void;
890
890
  /**
891
891
  * アクションのログの記録の管理
892
892
  */
893
+ /** @internal */
893
894
  type LogLevel = "info" | "error" | "warn";
895
+ /** @internal */
894
896
  type Log = {
895
897
  level: LogLevel;
896
898
  messages: any;
897
899
  date?: Date;
898
900
  };
901
+ /** @internal */
899
902
  type Event = {
900
903
  name: string;
901
904
  values?: any;
902
905
  date?: Date;
903
906
  };
907
+ /** @internal */
904
908
  declare function getLogs(): Log[];
909
+ /** @internal */
905
910
  declare function getEvents(): Event[];
906
911
  /**
907
912
  * ログを送信する関数群
913
+ *
914
+ * @internal
908
915
  */
909
916
  declare const logger: {
910
917
  info: (...messages: any[]) => void;
@@ -917,6 +924,8 @@ declare const logger: {
917
924
  };
918
925
  /**
919
926
  * メッセージを実行ログに表示する
927
+ *
928
+ * @internal
920
929
  */
921
930
  declare function listenLogger(): () => void;
922
931
  /**
@@ -1116,6 +1125,13 @@ declare const loadActionTableRows: (config: ActionTableRowsRequestConfig, api_ke
1116
1125
  declare const loadActionTableQuery: (config: ActionTableQueryRequestConfig, api_key: string, endpoint?: string) => Promise<unknown>;
1117
1126
  declare const loadActionTable: (config: Array<ActionTableRequestConfig>, api_key: string, endpoint?: string) => Promise<{}>;
1118
1127
  type _Props$0 = Props;
1128
+ /** @internal */
1129
+ declare const ACTION_HOOK_LABEL = "__ACTION_HOOK__";
1130
+ /** @internal */
1131
+ type ActionHookLog = {
1132
+ name: string;
1133
+ values?: any;
1134
+ };
1119
1135
  /**
1120
1136
  * アクションのライフサイクルで呼び出されるフック
1121
1137
  *
@@ -2127,6 +2143,8 @@ declare namespace widget {
2127
2143
  /**
2128
2144
  * {@link setInternalHandlers} function to set internal event handlers.
2129
2145
  *
2146
+ * @param handlers - New internal event handlers
2147
+ *
2130
2148
  * @internal
2131
2149
  */
2132
2150
  function setInternalHandlers(handlers: {
@@ -2144,6 +2162,34 @@ declare namespace widget {
2144
2162
  }): {
2145
2163
  [key: string]: ActionEventHandler[];
2146
2164
  };
2165
+ /**
2166
+ * Store to handle internal event handlers for widget API
2167
+ *
2168
+ * @internal
2169
+ */
2170
+ const widgetHandlers: Store<{
2171
+ [key: string]: ActionEventHandler[];
2172
+ }>;
2173
+ /**
2174
+ * {@link getWidgetHandlers} function to get internal event handlers for widget API.
2175
+ *
2176
+ * @param handlers - New internal widget event handlers
2177
+ *
2178
+ * @returns Current internal widget handlers
2179
+ *
2180
+ * @internal
2181
+ */
2182
+ function getWidgetHandlers(): {
2183
+ [key: string]: ActionEventHandler[];
2184
+ };
2185
+ /**
2186
+ * {@link setWidgetHandlers} function to set internal event handlers.
2187
+ *
2188
+ * @internal
2189
+ */
2190
+ function setWidgetHandlers(handlers: {
2191
+ [key: string]: ActionEventHandler[];
2192
+ }): void;
2147
2193
  /**
2148
2194
  * Store to handle custom event handlers
2149
2195
  *
@@ -2556,6 +2602,13 @@ declare namespace widget {
2556
2602
  hide_on_time_count?: number;
2557
2603
  }
2558
2604
  type _Props = Props;
2605
+ /** @internal */
2606
+ const ACTION_HOOK_LABEL = "__ACTION_HOOK__";
2607
+ /** @internal */
2608
+ type ActionHookLog = {
2609
+ name: string;
2610
+ values?: any;
2611
+ };
2559
2612
  /**
2560
2613
  * アクションのライフサイクルで呼び出されるフック
2561
2614
  *
@@ -3017,8 +3070,8 @@ declare namespace widget {
3017
3070
  */
3018
3071
  export { showAction as show, closeAction as hide };
3019
3072
  }
3020
- export { loadGlobalScript, loadGlobalStyle, applyGlobalCss, initialize, finalize, setAutoStart, getState, setState, getStates, isOpened, getCustomVariables, setCustomVariables, updateCustomVariables, getCustomHandlers, setCustomHandlers, updateCustomHandlers, getSystem, setActionSetting, customHandlers, customVariables, formData, state, opened, closed, destroyed, stopped, isClosed, setClosed, getStoreState, onScroll, onTime, getLogs, getEvents, logger, listenLogger, hideOnScroll, hideOnTime, showOnScroll, showOnTime, PropTypes, PropType, Code, MediaQueries, MediaQuery, Directions, Direction, AnimationStyles, AnimationStyle, ModalPositions, ModalPosition, ModalMargin, ModalPlacement, DefaultModalPlacement, Elasticities, Elasticity, ElasticityStyle, TextDirections, TextDirection, OperationArgumentType, Operation, OnClickOperationOptions, OnClickOperation, LongText, Url, Image, LengthUnits, LengthUnit, Length, Color, Justifies, Justify, Alignments, Alignment, ObjectFits, ObjectFit, ClipPaths, ClipPath, Repeats, Repeat, BackgroundSizes, BackgroundSize, Cursors, Cursor, Overflows, Overflow, Border, BorderStyle, BorderWidth, Style, StateName, WritingModes, WritingMode, ListSeparatorTypes, EdgePosition, DefaultEdgePosition, ListSeparatorNone, ListSeparatorBorder, ListSeparatorGap, ListSeparator, DefaultListSeparatorNone, DefaultListSeparatorBorder, DefaultListSeparatorGap, DefaultListSeparator, ListBackgroundTypes, ListBackgroundNone, ListBackgroundStripe, ListBackground, DefaultListBackgroundNone, DefaultListBackgroundStripe, DefaultListBackground, ListDirections, ListDirection, ListContext, SlideButtonIcon, SlideButtonText, SlideButton, DefaultSlideButton, SlideButtonPosition, SlideNavigationButton, DefaultSlideNavigationButton, FormInputName, FormButtonStyle, DefaultFormButtonStyle, FormSelectStyle, DefaultFormSelectStyle, FormRatingButtonType, FormRatingButtonTypes, DefaultFormRatingButtonType, create, destroy, closeAction, showAction, loadStyle, applyCss, getActionShadowRoot, onCreate, onShow, onClose, onDestroy, onChangeState, showModal, ensureModalRoot, show, close, createApp, createFog, KARTE_MODAL_ROOT, collection, loadActionTableRow, loadActionTableRows, loadActionTableQuery, loadActionTable, widget };
3021
- export type { CloseTrigger, CustomVariables, ActionEventHandler, SystemConfig, OnScrollContext, OnScrollFunction, ScrollDirection, LogLevel, Log, Event, ActionProps, ActionOptions, ActionHook, ActionCloseHook, ActionChangeStateHook, SendFunction, CollectionConfig, ActionTableRowRequestConfig, ActionTableRowsRequestConfig, ActionTableQueryRequestConfig, ActionTableRequestConfig };
3073
+ export { loadGlobalScript, loadGlobalStyle, applyGlobalCss, initialize, finalize, setAutoStart, getState, setState, getStates, isOpened, getCustomVariables, setCustomVariables, updateCustomVariables, getCustomHandlers, setCustomHandlers, updateCustomHandlers, getSystem, setActionSetting, customHandlers, customVariables, formData, state, opened, closed, destroyed, stopped, isClosed, setClosed, getStoreState, onScroll, onTime, getLogs, getEvents, logger, listenLogger, hideOnScroll, hideOnTime, showOnScroll, showOnTime, PropTypes, PropType, Code, MediaQueries, MediaQuery, Directions, Direction, AnimationStyles, AnimationStyle, ModalPositions, ModalPosition, ModalMargin, ModalPlacement, DefaultModalPlacement, Elasticities, Elasticity, ElasticityStyle, TextDirections, TextDirection, OperationArgumentType, Operation, OnClickOperationOptions, OnClickOperation, LongText, Url, Image, LengthUnits, LengthUnit, Length, Color, Justifies, Justify, Alignments, Alignment, ObjectFits, ObjectFit, ClipPaths, ClipPath, Repeats, Repeat, BackgroundSizes, BackgroundSize, Cursors, Cursor, Overflows, Overflow, Border, BorderStyle, BorderWidth, Style, StateName, WritingModes, WritingMode, ListSeparatorTypes, EdgePosition, DefaultEdgePosition, ListSeparatorNone, ListSeparatorBorder, ListSeparatorGap, ListSeparator, DefaultListSeparatorNone, DefaultListSeparatorBorder, DefaultListSeparatorGap, DefaultListSeparator, ListBackgroundTypes, ListBackgroundNone, ListBackgroundStripe, ListBackground, DefaultListBackgroundNone, DefaultListBackgroundStripe, DefaultListBackground, ListDirections, ListDirection, ListContext, SlideButtonIcon, SlideButtonText, SlideButton, DefaultSlideButton, SlideButtonPosition, SlideNavigationButton, DefaultSlideNavigationButton, FormInputName, FormButtonStyle, DefaultFormButtonStyle, FormSelectStyle, DefaultFormSelectStyle, FormRatingButtonType, FormRatingButtonTypes, DefaultFormRatingButtonType, create, destroy, closeAction, showAction, loadStyle, applyCss, getActionShadowRoot, onCreate, onShow, onClose, onDestroy, onChangeState, showModal, ensureModalRoot, show, close, createApp, createFog, KARTE_MODAL_ROOT, ACTION_HOOK_LABEL, collection, loadActionTableRow, loadActionTableRows, loadActionTableQuery, loadActionTable, widget };
3074
+ export type { CloseTrigger, CustomVariables, ActionEventHandler, SystemConfig, OnScrollContext, OnScrollFunction, ScrollDirection, LogLevel, Log, Event, ActionProps, ActionOptions, ActionHook, ActionCloseHook, ActionChangeStateHook, SendFunction, ActionHookLog, CollectionConfig, ActionTableRowRequestConfig, ActionTableRowsRequestConfig, ActionTableQueryRequestConfig, ActionTableRequestConfig };
3022
3075
  export { default as State } from './components/State.svelte';
3023
3076
  export { default as StateItem } from './components/StateItem.svelte';
3024
3077
  export { default as Modal } from './components/Modal.svelte';
@@ -437,6 +437,32 @@ function updateInternalHandlers(handlers) {
437
437
  });
438
438
  return getInternalHandlers();
439
439
  }
440
+ /**
441
+ * Store to handle internal event handlers for widget API
442
+ *
443
+ * @internal
444
+ */
445
+ const widgetHandlers = writable({});
446
+ /**
447
+ * {@link getWidgetHandlers} function to get internal event handlers for widget API.
448
+ *
449
+ * @param handlers - New internal widget event handlers
450
+ *
451
+ * @returns Current internal widget handlers
452
+ *
453
+ * @internal
454
+ */
455
+ function getWidgetHandlers() {
456
+ return get(widgetHandlers);
457
+ }
458
+ /**
459
+ * {@link setWidgetHandlers} function to set internal event handlers.
460
+ *
461
+ * @internal
462
+ */
463
+ function setWidgetHandlers(handlers) {
464
+ widgetHandlers.set(handlers);
465
+ }
440
466
  /**
441
467
  * Store to handle custom event handlers
442
468
  *
@@ -908,9 +934,11 @@ const EVENTS_LIMIT = 1000;
908
934
  let logs = [];
909
935
  // KARTEイベント
910
936
  let events = [];
937
+ /** @internal */
911
938
  function getLogs() {
912
939
  return logs;
913
940
  }
941
+ /** @internal */
914
942
  function getEvents() {
915
943
  return events;
916
944
  }
@@ -920,22 +948,24 @@ function w(w) {
920
948
  }
921
949
  /**
922
950
  * ログを送信する関数群
951
+ *
952
+ * @internal
923
953
  */
924
954
  const logger = {
925
955
  info: (...messages) => {
926
- const log = { level: 'info', messages, date: new Date() };
956
+ const log = cloneToJson({ level: 'info', messages, date: new Date() });
927
957
  w(window).postMessage({ type: 'KARTE-ACTION-LOGGER', detail: { method: 'log', log } }, '*');
928
958
  },
929
959
  log: (...messages) => {
930
- const log = { level: 'info', messages, date: new Date() };
960
+ const log = cloneToJson({ level: 'info', messages, date: new Date() });
931
961
  w(window).postMessage({ type: 'KARTE-ACTION-LOGGER', detail: { method: 'log', log } }, '*');
932
962
  },
933
963
  error: (...messages) => {
934
- const log = { level: 'error', messages, date: new Date() };
964
+ const log = cloneToJson({ level: 'error', messages, date: new Date() });
935
965
  w(window).postMessage({ type: 'KARTE-ACTION-LOGGER', detail: { method: 'log', log } }, '*');
936
966
  },
937
967
  warn: (...messages) => {
938
- const log = { level: 'warn', messages, date: new Date() };
968
+ const log = cloneToJson({ level: 'warn', messages, date: new Date() });
939
969
  w(window).postMessage({ type: 'KARTE-ACTION-LOGGER', detail: { method: 'log', log } }, '*');
940
970
  },
941
971
  event: (name, values) => {
@@ -954,6 +984,8 @@ const logger = {
954
984
  };
955
985
  /**
956
986
  * メッセージを実行ログに表示する
987
+ *
988
+ * @internal
957
989
  */
958
990
  function listenLogger() {
959
991
  const handler = (event) => {
@@ -997,6 +1029,8 @@ function listenLogger() {
997
1029
  const { info, log, error, warn } = console;
998
1030
  /**
999
1031
  * consoleログを実行ログに表示する
1032
+ *
1033
+ * @internal
1000
1034
  */
1001
1035
  function listenConsoleLogger() {
1002
1036
  const cleanup = listenLogger();
@@ -1024,6 +1058,14 @@ function listenConsoleLogger() {
1024
1058
  console.warn = warn;
1025
1059
  };
1026
1060
  }
1061
+ function cloneToJson(data) {
1062
+ try {
1063
+ return JSON.parse(JSON.stringify(data));
1064
+ }
1065
+ catch (e) {
1066
+ return data;
1067
+ }
1068
+ }
1027
1069
 
1028
1070
  function doPresent({ direction, deltaRate }, downFn, upFn, condition = false) {
1029
1071
  if (direction === 'down' && deltaRate > 0) {
@@ -1442,6 +1484,8 @@ const loadActionTable = async (config, api_key, endpoint) => {
1442
1484
  }, {});
1443
1485
  };
1444
1486
 
1487
+ /** @internal */
1488
+ const ACTION_HOOK_LABEL = '__ACTION_HOOK__';
1445
1489
  /**
1446
1490
  * アクションが作成 (create) される前にフックする関数
1447
1491
  *
@@ -1495,12 +1539,12 @@ function onClose(fn) {
1495
1539
  * @public
1496
1540
  */
1497
1541
  function onDestroy(fn) {
1498
- let { onDestoryHandlers } = getInternalHandlers();
1499
- if (!onDestoryHandlers) {
1500
- onDestoryHandlers = [];
1542
+ let { onDestroyHandlers } = getInternalHandlers();
1543
+ if (!onDestroyHandlers) {
1544
+ onDestroyHandlers = [];
1501
1545
  }
1502
- onDestoryHandlers.push(fn);
1503
- updateInternalHandlers({ onDestoryHandlers });
1546
+ onDestroyHandlers.push(fn);
1547
+ updateInternalHandlers({ onDestroyHandlers });
1504
1548
  }
1505
1549
  /**
1506
1550
  * アクションのステートが変更された (changeState) 後にフックする関数
@@ -1541,13 +1585,21 @@ function create(App, options = {
1541
1585
  };
1542
1586
  const actionProps = { send: options.send, data };
1543
1587
  initialize({ send: options.send });
1544
- // NOTE: onCreateより前にListenする必要がある
1545
- window.addEventListener(ACTION_DESTROY_EVENT, () => {
1588
+ const handleDestroy = () => {
1546
1589
  const { onDestroyHandlers } = getInternalHandlers();
1547
- onDestroyHandlers?.forEach(h => h(actionProps));
1548
- // 複数回onDestroyを呼ばないようにする処理
1549
- window.removeEventListener('beforeunload', dispatchDestroyEvent);
1550
- });
1590
+ onDestroyHandlers?.forEach(h => {
1591
+ const actionHookLog = { name: 'onDestroy' };
1592
+ console.info(`${ACTION_HOOK_LABEL}:${JSON.stringify(actionHookLog)}`);
1593
+ h(actionProps);
1594
+ });
1595
+ // 旧Widget APIの内部で利用するため、実行ログは出力しない
1596
+ const { onDestroyHandlers: onDestroyWidgetHandlers } = getWidgetHandlers();
1597
+ if (onDestroyWidgetHandlers) {
1598
+ onDestroyWidgetHandlers.forEach(h => h(actionProps));
1599
+ }
1600
+ };
1601
+ // NOTE: onCreateより前にListenする必要がある
1602
+ window.addEventListener(ACTION_DESTROY_EVENT, handleDestroy);
1551
1603
  window.addEventListener('beforeunload', dispatchDestroyEvent, false);
1552
1604
  setSystem({
1553
1605
  // @ts-ignore
@@ -1569,9 +1621,14 @@ function create(App, options = {
1569
1621
  window.removeEventListener(ACTION_CHANGE_STATE_EVENT, handleState);
1570
1622
  const { onCloseHandlers } = getInternalHandlers();
1571
1623
  if (onCloseHandlers) {
1572
- onCloseHandlers.forEach(h => h({ send: options.send, data }, trigger));
1624
+ onCloseHandlers.forEach(h => {
1625
+ const actionHookLog = { name: 'onClose', values: { trigger } };
1626
+ console.info(`${ACTION_HOOK_LABEL}:${JSON.stringify(actionHookLog)}`);
1627
+ h({ send: options.send, data }, trigger);
1628
+ });
1573
1629
  }
1574
1630
  finalize();
1631
+ dispatchDestroyEvent();
1575
1632
  app.$destroy();
1576
1633
  app = null;
1577
1634
  };
@@ -1597,12 +1654,28 @@ function create(App, options = {
1597
1654
  onShow: (props) => {
1598
1655
  const { onShowHandlers } = getInternalHandlers();
1599
1656
  if (onShowHandlers) {
1600
- onShowHandlers.forEach(h => h(props));
1657
+ onShowHandlers.forEach(h => {
1658
+ const actionHookLog = { name: 'onShow' };
1659
+ console.info(`${ACTION_HOOK_LABEL}:${JSON.stringify(actionHookLog)}`);
1660
+ h(props);
1661
+ });
1601
1662
  }
1602
1663
  },
1603
1664
  onChangeState: (props, newState) => {
1604
1665
  const { onChangeStateHandlers } = getInternalHandlers();
1605
1666
  if (onChangeStateHandlers) {
1667
+ onChangeStateHandlers.forEach(h => {
1668
+ const actionHookLog = {
1669
+ name: 'onChangeState',
1670
+ values: { newState },
1671
+ };
1672
+ console.info(`${ACTION_HOOK_LABEL}:${JSON.stringify(actionHookLog)}`);
1673
+ h(props, newState);
1674
+ });
1675
+ }
1676
+ // 旧Widget APIの内部で利用するため、実行ログは出力しない
1677
+ const { onChangeStateHandlers: onChangeWidgetStateHandlers } = getWidgetHandlers();
1678
+ if (onChangeWidgetStateHandlers) {
1606
1679
  onChangeStateHandlers.forEach(h => h(props, newState));
1607
1680
  }
1608
1681
  },
@@ -1636,14 +1709,20 @@ function create(App, options = {
1636
1709
  }
1637
1710
  const { onCreateHandlers } = getInternalHandlers();
1638
1711
  if (onCreateHandlers) {
1639
- onCreateHandlers.forEach(h => h({ send: options.send, data }));
1712
+ onCreateHandlers.forEach(h => {
1713
+ h({ send: options.send, data });
1714
+ console.debug(`${ACTION_HOOK_LABEL}: onCreate`);
1715
+ });
1640
1716
  }
1641
1717
  // 初期化処理
1642
1718
  // NOTE: onCreateの後に実行する必要がある
1643
1719
  if (isDestroyed()) {
1644
1720
  return () => {
1721
+ loggerCleanup();
1645
1722
  window.removeEventListener(ACTION_SHOW_EVENT, show);
1646
1723
  window.removeEventListener(ACTION_CLOSE_EVENT, handleClose);
1724
+ window.removeEventListener(ACTION_DESTROY_EVENT, handleDestroy);
1725
+ window.removeEventListener('beforeunload', dispatchDestroyEvent, false);
1647
1726
  };
1648
1727
  }
1649
1728
  let hideCleanup = NOOP;
@@ -1659,6 +1738,8 @@ function create(App, options = {
1659
1738
  loggerCleanup();
1660
1739
  window.removeEventListener(ACTION_SHOW_EVENT, show);
1661
1740
  window.removeEventListener(ACTION_CLOSE_EVENT, handleClose);
1741
+ window.removeEventListener(ACTION_DESTROY_EVENT, handleDestroy);
1742
+ window.removeEventListener('beforeunload', dispatchDestroyEvent, false);
1662
1743
  };
1663
1744
  }
1664
1745
  /**
@@ -1974,15 +2055,21 @@ const STORE_LS_KEY_PREFIX = 'krt___';
1974
2055
  const valCallbacks = {};
1975
2056
  const eventCallbacks = {};
1976
2057
  const memoryStore = {};
1977
- onChangeState((_props, newState) => {
1978
- setVal('state', newState);
1979
- });
1980
- onDestroy(() => {
1981
- Object.entries(eventCallbacks).map(([name, cbs]) => {
1982
- cbs.forEach(cb => {
1983
- window.removeEventListener(name, cb);
1984
- });
1985
- });
2058
+ setWidgetHandlers({
2059
+ onChangeState: [
2060
+ (_props, newState) => {
2061
+ setVal('state', newState);
2062
+ },
2063
+ ],
2064
+ onDestroy: [
2065
+ () => {
2066
+ Object.entries(eventCallbacks).map(([name, cbs]) => {
2067
+ cbs.forEach(cb => {
2068
+ window.removeEventListener(name, cb);
2069
+ });
2070
+ });
2071
+ },
2072
+ ],
1986
2073
  });
1987
2074
  /**
1988
2075
  * 変数を設定する
@@ -8444,4 +8531,4 @@ class ImageBlock extends SvelteComponent {
8444
8531
  }
8445
8532
  }
8446
8533
 
8447
- export { 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 };
8534
+ 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 };
@@ -890,21 +890,28 @@ declare function onTime(time: number, fn: Function): () => void;
890
890
  /**
891
891
  * アクションのログの記録の管理
892
892
  */
893
+ /** @internal */
893
894
  type LogLevel = "info" | "error" | "warn";
895
+ /** @internal */
894
896
  type Log = {
895
897
  level: LogLevel;
896
898
  messages: any;
897
899
  date?: Date;
898
900
  };
901
+ /** @internal */
899
902
  type Event = {
900
903
  name: string;
901
904
  values?: any;
902
905
  date?: Date;
903
906
  };
907
+ /** @internal */
904
908
  declare function getLogs(): Log[];
909
+ /** @internal */
905
910
  declare function getEvents(): Event[];
906
911
  /**
907
912
  * ログを送信する関数群
913
+ *
914
+ * @internal
908
915
  */
909
916
  declare const logger: {
910
917
  info: (...messages: any[]) => void;
@@ -917,6 +924,8 @@ declare const logger: {
917
924
  };
918
925
  /**
919
926
  * メッセージを実行ログに表示する
927
+ *
928
+ * @internal
920
929
  */
921
930
  declare function listenLogger(): () => void;
922
931
  /**
@@ -1116,6 +1125,13 @@ declare const loadActionTableRows: (config: ActionTableRowsRequestConfig, api_ke
1116
1125
  declare const loadActionTableQuery: (config: ActionTableQueryRequestConfig, api_key: string, endpoint?: string) => Promise<unknown>;
1117
1126
  declare const loadActionTable: (config: Array<ActionTableRequestConfig>, api_key: string, endpoint?: string) => Promise<{}>;
1118
1127
  type _Props$0 = Props;
1128
+ /** @internal */
1129
+ declare const ACTION_HOOK_LABEL = "__ACTION_HOOK__";
1130
+ /** @internal */
1131
+ type ActionHookLog = {
1132
+ name: string;
1133
+ values?: any;
1134
+ };
1119
1135
  /**
1120
1136
  * アクションのライフサイクルで呼び出されるフック
1121
1137
  *
@@ -2127,6 +2143,8 @@ declare namespace widget {
2127
2143
  /**
2128
2144
  * {@link setInternalHandlers} function to set internal event handlers.
2129
2145
  *
2146
+ * @param handlers - New internal event handlers
2147
+ *
2130
2148
  * @internal
2131
2149
  */
2132
2150
  function setInternalHandlers(handlers: {
@@ -2144,6 +2162,34 @@ declare namespace widget {
2144
2162
  }): {
2145
2163
  [key: string]: ActionEventHandler[];
2146
2164
  };
2165
+ /**
2166
+ * Store to handle internal event handlers for widget API
2167
+ *
2168
+ * @internal
2169
+ */
2170
+ const widgetHandlers: Store<{
2171
+ [key: string]: ActionEventHandler[];
2172
+ }>;
2173
+ /**
2174
+ * {@link getWidgetHandlers} function to get internal event handlers for widget API.
2175
+ *
2176
+ * @param handlers - New internal widget event handlers
2177
+ *
2178
+ * @returns Current internal widget handlers
2179
+ *
2180
+ * @internal
2181
+ */
2182
+ function getWidgetHandlers(): {
2183
+ [key: string]: ActionEventHandler[];
2184
+ };
2185
+ /**
2186
+ * {@link setWidgetHandlers} function to set internal event handlers.
2187
+ *
2188
+ * @internal
2189
+ */
2190
+ function setWidgetHandlers(handlers: {
2191
+ [key: string]: ActionEventHandler[];
2192
+ }): void;
2147
2193
  /**
2148
2194
  * Store to handle custom event handlers
2149
2195
  *
@@ -2556,6 +2602,13 @@ declare namespace widget {
2556
2602
  hide_on_time_count?: number;
2557
2603
  }
2558
2604
  type _Props = Props;
2605
+ /** @internal */
2606
+ const ACTION_HOOK_LABEL = "__ACTION_HOOK__";
2607
+ /** @internal */
2608
+ type ActionHookLog = {
2609
+ name: string;
2610
+ values?: any;
2611
+ };
2559
2612
  /**
2560
2613
  * アクションのライフサイクルで呼び出されるフック
2561
2614
  *
@@ -3017,8 +3070,8 @@ declare namespace widget {
3017
3070
  */
3018
3071
  export { showAction as show, closeAction as hide };
3019
3072
  }
3020
- export { loadGlobalScript, loadGlobalStyle, applyGlobalCss, initialize, finalize, setAutoStart, getState, setState, getStates, isOpened, getCustomVariables, setCustomVariables, updateCustomVariables, getCustomHandlers, setCustomHandlers, updateCustomHandlers, getSystem, setActionSetting, customHandlers, customVariables, formData, state, opened, closed, destroyed, stopped, isClosed, setClosed, getStoreState, onScroll, onTime, getLogs, getEvents, logger, listenLogger, hideOnScroll, hideOnTime, showOnScroll, showOnTime, PropTypes, PropType, Code, MediaQueries, MediaQuery, Directions, Direction, AnimationStyles, AnimationStyle, ModalPositions, ModalPosition, ModalMargin, ModalPlacement, DefaultModalPlacement, Elasticities, Elasticity, ElasticityStyle, TextDirections, TextDirection, OperationArgumentType, Operation, OnClickOperationOptions, OnClickOperation, LongText, Url, Image, LengthUnits, LengthUnit, Length, Color, Justifies, Justify, Alignments, Alignment, ObjectFits, ObjectFit, ClipPaths, ClipPath, Repeats, Repeat, BackgroundSizes, BackgroundSize, Cursors, Cursor, Overflows, Overflow, Border, BorderStyle, BorderWidth, Style, StateName, WritingModes, WritingMode, ListSeparatorTypes, EdgePosition, DefaultEdgePosition, ListSeparatorNone, ListSeparatorBorder, ListSeparatorGap, ListSeparator, DefaultListSeparatorNone, DefaultListSeparatorBorder, DefaultListSeparatorGap, DefaultListSeparator, ListBackgroundTypes, ListBackgroundNone, ListBackgroundStripe, ListBackground, DefaultListBackgroundNone, DefaultListBackgroundStripe, DefaultListBackground, ListDirections, ListDirection, ListContext, SlideButtonIcon, SlideButtonText, SlideButton, DefaultSlideButton, SlideButtonPosition, SlideNavigationButton, DefaultSlideNavigationButton, FormInputName, FormButtonStyle, DefaultFormButtonStyle, FormSelectStyle, DefaultFormSelectStyle, FormRatingButtonType, FormRatingButtonTypes, DefaultFormRatingButtonType, create, destroy, closeAction, showAction, loadStyle, applyCss, getActionShadowRoot, onCreate, onShow, onClose, onDestroy, onChangeState, showModal, ensureModalRoot, show, close, createApp, createFog, KARTE_MODAL_ROOT, collection, loadActionTableRow, loadActionTableRows, loadActionTableQuery, loadActionTable, widget };
3021
- export type { CloseTrigger, CustomVariables, ActionEventHandler, SystemConfig, OnScrollContext, OnScrollFunction, ScrollDirection, LogLevel, Log, Event, ActionProps, ActionOptions, ActionHook, ActionCloseHook, ActionChangeStateHook, SendFunction, CollectionConfig, ActionTableRowRequestConfig, ActionTableRowsRequestConfig, ActionTableQueryRequestConfig, ActionTableRequestConfig };
3073
+ export { loadGlobalScript, loadGlobalStyle, applyGlobalCss, initialize, finalize, setAutoStart, getState, setState, getStates, isOpened, getCustomVariables, setCustomVariables, updateCustomVariables, getCustomHandlers, setCustomHandlers, updateCustomHandlers, getSystem, setActionSetting, customHandlers, customVariables, formData, state, opened, closed, destroyed, stopped, isClosed, setClosed, getStoreState, onScroll, onTime, getLogs, getEvents, logger, listenLogger, hideOnScroll, hideOnTime, showOnScroll, showOnTime, PropTypes, PropType, Code, MediaQueries, MediaQuery, Directions, Direction, AnimationStyles, AnimationStyle, ModalPositions, ModalPosition, ModalMargin, ModalPlacement, DefaultModalPlacement, Elasticities, Elasticity, ElasticityStyle, TextDirections, TextDirection, OperationArgumentType, Operation, OnClickOperationOptions, OnClickOperation, LongText, Url, Image, LengthUnits, LengthUnit, Length, Color, Justifies, Justify, Alignments, Alignment, ObjectFits, ObjectFit, ClipPaths, ClipPath, Repeats, Repeat, BackgroundSizes, BackgroundSize, Cursors, Cursor, Overflows, Overflow, Border, BorderStyle, BorderWidth, Style, StateName, WritingModes, WritingMode, ListSeparatorTypes, EdgePosition, DefaultEdgePosition, ListSeparatorNone, ListSeparatorBorder, ListSeparatorGap, ListSeparator, DefaultListSeparatorNone, DefaultListSeparatorBorder, DefaultListSeparatorGap, DefaultListSeparator, ListBackgroundTypes, ListBackgroundNone, ListBackgroundStripe, ListBackground, DefaultListBackgroundNone, DefaultListBackgroundStripe, DefaultListBackground, ListDirections, ListDirection, ListContext, SlideButtonIcon, SlideButtonText, SlideButton, DefaultSlideButton, SlideButtonPosition, SlideNavigationButton, DefaultSlideNavigationButton, FormInputName, FormButtonStyle, DefaultFormButtonStyle, FormSelectStyle, DefaultFormSelectStyle, FormRatingButtonType, FormRatingButtonTypes, DefaultFormRatingButtonType, create, destroy, closeAction, showAction, loadStyle, applyCss, getActionShadowRoot, onCreate, onShow, onClose, onDestroy, onChangeState, showModal, ensureModalRoot, show, close, createApp, createFog, KARTE_MODAL_ROOT, ACTION_HOOK_LABEL, collection, loadActionTableRow, loadActionTableRows, loadActionTableQuery, loadActionTable, widget };
3074
+ export type { CloseTrigger, CustomVariables, ActionEventHandler, SystemConfig, OnScrollContext, OnScrollFunction, ScrollDirection, LogLevel, Log, Event, ActionProps, ActionOptions, ActionHook, ActionCloseHook, ActionChangeStateHook, SendFunction, ActionHookLog, CollectionConfig, ActionTableRowRequestConfig, ActionTableRowsRequestConfig, ActionTableQueryRequestConfig, ActionTableRequestConfig };
3022
3075
  export { default as State } from './components/State.svelte';
3023
3076
  export { default as StateItem } from './components/StateItem.svelte';
3024
3077
  export { default as Modal } from './components/Modal.svelte';
package/dist/index.es.js CHANGED
@@ -439,6 +439,32 @@ function updateInternalHandlers(handlers) {
439
439
  });
440
440
  return getInternalHandlers();
441
441
  }
442
+ /**
443
+ * Store to handle internal event handlers for widget API
444
+ *
445
+ * @internal
446
+ */
447
+ const widgetHandlers = writable({});
448
+ /**
449
+ * {@link getWidgetHandlers} function to get internal event handlers for widget API.
450
+ *
451
+ * @param handlers - New internal widget event handlers
452
+ *
453
+ * @returns Current internal widget handlers
454
+ *
455
+ * @internal
456
+ */
457
+ function getWidgetHandlers() {
458
+ return get(widgetHandlers);
459
+ }
460
+ /**
461
+ * {@link setWidgetHandlers} function to set internal event handlers.
462
+ *
463
+ * @internal
464
+ */
465
+ function setWidgetHandlers(handlers) {
466
+ widgetHandlers.set(handlers);
467
+ }
442
468
  /**
443
469
  * Store to handle custom event handlers
444
470
  *
@@ -958,9 +984,11 @@ const EVENTS_LIMIT = 1000;
958
984
  let logs = [];
959
985
  // KARTEイベント
960
986
  let events = [];
987
+ /** @internal */
961
988
  function getLogs() {
962
989
  return logs;
963
990
  }
991
+ /** @internal */
964
992
  function getEvents() {
965
993
  return events;
966
994
  }
@@ -970,22 +998,24 @@ function w(w) {
970
998
  }
971
999
  /**
972
1000
  * ログを送信する関数群
1001
+ *
1002
+ * @internal
973
1003
  */
974
1004
  const logger = {
975
1005
  info: (...messages) => {
976
- const log = { level: 'info', messages, date: new Date() };
1006
+ const log = cloneToJson({ level: 'info', messages, date: new Date() });
977
1007
  w(window).postMessage({ type: 'KARTE-ACTION-LOGGER', detail: { method: 'log', log } }, '*');
978
1008
  },
979
1009
  log: (...messages) => {
980
- const log = { level: 'info', messages, date: new Date() };
1010
+ const log = cloneToJson({ level: 'info', messages, date: new Date() });
981
1011
  w(window).postMessage({ type: 'KARTE-ACTION-LOGGER', detail: { method: 'log', log } }, '*');
982
1012
  },
983
1013
  error: (...messages) => {
984
- const log = { level: 'error', messages, date: new Date() };
1014
+ const log = cloneToJson({ level: 'error', messages, date: new Date() });
985
1015
  w(window).postMessage({ type: 'KARTE-ACTION-LOGGER', detail: { method: 'log', log } }, '*');
986
1016
  },
987
1017
  warn: (...messages) => {
988
- const log = { level: 'warn', messages, date: new Date() };
1018
+ const log = cloneToJson({ level: 'warn', messages, date: new Date() });
989
1019
  w(window).postMessage({ type: 'KARTE-ACTION-LOGGER', detail: { method: 'log', log } }, '*');
990
1020
  },
991
1021
  event: (name, values) => {
@@ -1004,6 +1034,8 @@ const logger = {
1004
1034
  };
1005
1035
  /**
1006
1036
  * メッセージを実行ログに表示する
1037
+ *
1038
+ * @internal
1007
1039
  */
1008
1040
  function listenLogger() {
1009
1041
  const handler = (event) => {
@@ -1044,6 +1076,14 @@ function listenLogger() {
1044
1076
  window.removeEventListener('message', handler, false);
1045
1077
  };
1046
1078
  }
1079
+ function cloneToJson(data) {
1080
+ try {
1081
+ return JSON.parse(JSON.stringify(data));
1082
+ }
1083
+ catch (e) {
1084
+ return data;
1085
+ }
1086
+ }
1047
1087
 
1048
1088
  function doPresent({ direction, deltaRate }, downFn, upFn, condition = false) {
1049
1089
  if (direction === 'down' && deltaRate > 0) {
@@ -1527,6 +1567,8 @@ const loadActionTable = async (config, api_key, endpoint) => {
1527
1567
  }, {});
1528
1568
  };
1529
1569
 
1570
+ /** @internal */
1571
+ const ACTION_HOOK_LABEL = '__ACTION_HOOK__';
1530
1572
  /**
1531
1573
  * アクションが作成 (create) される前にフックする関数
1532
1574
  *
@@ -1580,12 +1622,12 @@ function onClose(fn) {
1580
1622
  * @public
1581
1623
  */
1582
1624
  function onDestroy(fn) {
1583
- let { onDestoryHandlers } = getInternalHandlers();
1584
- if (!onDestoryHandlers) {
1585
- onDestoryHandlers = [];
1625
+ let { onDestroyHandlers } = getInternalHandlers();
1626
+ if (!onDestroyHandlers) {
1627
+ onDestroyHandlers = [];
1586
1628
  }
1587
- onDestoryHandlers.push(fn);
1588
- updateInternalHandlers({ onDestoryHandlers });
1629
+ onDestroyHandlers.push(fn);
1630
+ updateInternalHandlers({ onDestroyHandlers });
1589
1631
  }
1590
1632
  /**
1591
1633
  * アクションのステートが変更された (changeState) 後にフックする関数
@@ -1626,13 +1668,21 @@ function create(App, options = {
1626
1668
  };
1627
1669
  const actionProps = { send: options.send, data };
1628
1670
  initialize({ send: options.send });
1629
- // NOTE: onCreateより前にListenする必要がある
1630
- window.addEventListener(ACTION_DESTROY_EVENT, () => {
1671
+ const handleDestroy = () => {
1631
1672
  const { onDestroyHandlers } = getInternalHandlers();
1632
- onDestroyHandlers?.forEach(h => h(actionProps));
1633
- // 複数回onDestroyを呼ばないようにする処理
1634
- window.removeEventListener('beforeunload', dispatchDestroyEvent);
1635
- });
1673
+ onDestroyHandlers?.forEach(h => {
1674
+ const actionHookLog = { name: 'onDestroy' };
1675
+ console.info(`${ACTION_HOOK_LABEL}:${JSON.stringify(actionHookLog)}`);
1676
+ h(actionProps);
1677
+ });
1678
+ // 旧Widget APIの内部で利用するため、実行ログは出力しない
1679
+ const { onDestroyHandlers: onDestroyWidgetHandlers } = getWidgetHandlers();
1680
+ if (onDestroyWidgetHandlers) {
1681
+ onDestroyWidgetHandlers.forEach(h => h(actionProps));
1682
+ }
1683
+ };
1684
+ // NOTE: onCreateより前にListenする必要がある
1685
+ window.addEventListener(ACTION_DESTROY_EVENT, handleDestroy);
1636
1686
  window.addEventListener('beforeunload', dispatchDestroyEvent, false);
1637
1687
  setSystem({
1638
1688
  // @ts-ignore
@@ -1654,9 +1704,14 @@ function create(App, options = {
1654
1704
  window.removeEventListener(ACTION_CHANGE_STATE_EVENT, handleState);
1655
1705
  const { onCloseHandlers } = getInternalHandlers();
1656
1706
  if (onCloseHandlers) {
1657
- onCloseHandlers.forEach(h => h({ send: options.send, data }, trigger));
1707
+ onCloseHandlers.forEach(h => {
1708
+ const actionHookLog = { name: 'onClose', values: { trigger } };
1709
+ console.info(`${ACTION_HOOK_LABEL}:${JSON.stringify(actionHookLog)}`);
1710
+ h({ send: options.send, data }, trigger);
1711
+ });
1658
1712
  }
1659
1713
  finalize();
1714
+ dispatchDestroyEvent();
1660
1715
  app.$destroy();
1661
1716
  app = null;
1662
1717
  };
@@ -1682,12 +1737,28 @@ function create(App, options = {
1682
1737
  onShow: (props) => {
1683
1738
  const { onShowHandlers } = getInternalHandlers();
1684
1739
  if (onShowHandlers) {
1685
- onShowHandlers.forEach(h => h(props));
1740
+ onShowHandlers.forEach(h => {
1741
+ const actionHookLog = { name: 'onShow' };
1742
+ console.info(`${ACTION_HOOK_LABEL}:${JSON.stringify(actionHookLog)}`);
1743
+ h(props);
1744
+ });
1686
1745
  }
1687
1746
  },
1688
1747
  onChangeState: (props, newState) => {
1689
1748
  const { onChangeStateHandlers } = getInternalHandlers();
1690
1749
  if (onChangeStateHandlers) {
1750
+ onChangeStateHandlers.forEach(h => {
1751
+ const actionHookLog = {
1752
+ name: 'onChangeState',
1753
+ values: { newState },
1754
+ };
1755
+ console.info(`${ACTION_HOOK_LABEL}:${JSON.stringify(actionHookLog)}`);
1756
+ h(props, newState);
1757
+ });
1758
+ }
1759
+ // 旧Widget APIの内部で利用するため、実行ログは出力しない
1760
+ const { onChangeStateHandlers: onChangeWidgetStateHandlers } = getWidgetHandlers();
1761
+ if (onChangeWidgetStateHandlers) {
1691
1762
  onChangeStateHandlers.forEach(h => h(props, newState));
1692
1763
  }
1693
1764
  },
@@ -1732,7 +1803,10 @@ function create(App, options = {
1732
1803
  }
1733
1804
  const { onCreateHandlers } = getInternalHandlers();
1734
1805
  if (onCreateHandlers) {
1735
- onCreateHandlers.forEach(h => h({ send: options.send, data }));
1806
+ onCreateHandlers.forEach(h => {
1807
+ h({ send: options.send, data });
1808
+ console.debug(`${ACTION_HOOK_LABEL}: onCreate`);
1809
+ });
1736
1810
  }
1737
1811
  // 初期化処理
1738
1812
  // NOTE: onCreateの後に実行する必要がある
@@ -1740,6 +1814,8 @@ function create(App, options = {
1740
1814
  return () => {
1741
1815
  window.removeEventListener(ACTION_SHOW_EVENT, show);
1742
1816
  window.removeEventListener(ACTION_CLOSE_EVENT, handleClose);
1817
+ window.removeEventListener(ACTION_DESTROY_EVENT, handleDestroy);
1818
+ window.removeEventListener('beforeunload', dispatchDestroyEvent, false);
1743
1819
  };
1744
1820
  }
1745
1821
  let hideCleanup = NOOP;
@@ -1754,6 +1830,8 @@ function create(App, options = {
1754
1830
  showCleanup();
1755
1831
  window.removeEventListener(ACTION_SHOW_EVENT, show);
1756
1832
  window.removeEventListener(ACTION_CLOSE_EVENT, handleClose);
1833
+ window.removeEventListener(ACTION_DESTROY_EVENT, handleDestroy);
1834
+ window.removeEventListener('beforeunload', dispatchDestroyEvent, false);
1757
1835
  };
1758
1836
  }
1759
1837
  /**
@@ -2068,15 +2146,21 @@ const STORE_LS_KEY_PREFIX = 'krt___';
2068
2146
  const valCallbacks = {};
2069
2147
  const eventCallbacks = {};
2070
2148
  const memoryStore = {};
2071
- onChangeState((_props, newState) => {
2072
- setVal('state', newState);
2073
- });
2074
- onDestroy(() => {
2075
- Object.entries(eventCallbacks).map(([name, cbs]) => {
2076
- cbs.forEach(cb => {
2077
- window.removeEventListener(name, cb);
2078
- });
2079
- });
2149
+ setWidgetHandlers({
2150
+ onChangeState: [
2151
+ (_props, newState) => {
2152
+ setVal('state', newState);
2153
+ },
2154
+ ],
2155
+ onDestroy: [
2156
+ () => {
2157
+ Object.entries(eventCallbacks).map(([name, cbs]) => {
2158
+ cbs.forEach(cb => {
2159
+ window.removeEventListener(name, cb);
2160
+ });
2161
+ });
2162
+ },
2163
+ ],
2080
2164
  });
2081
2165
  /**
2082
2166
  * 変数を設定する
@@ -7917,4 +8001,4 @@ class ImageBlock extends SvelteComponent {
7917
8001
  }
7918
8002
  }
7919
8003
 
7920
- export { 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 };
8004
+ 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 };
@@ -64,7 +64,7 @@ function createIndexTsx(script = '') {
64
64
  import "https://polyfill.io/v3/polyfill.min.js?features=IntersectionObserver";
65
65
  import { create } from "@plaidev/karte-action-sdk";
66
66
 
67
- import { props } from "./gen";
67
+ import { props, localVariablesQuery } from "./gen";
68
68
  import App from "./App.svelte";
69
69
  import onCreate from "./customScript";
70
70
  ${script}
@@ -73,6 +73,7 @@ const action = (options: { send: Send; props: Props; variables: Variables }): Ka
73
73
  props,
74
74
  send: options.send,
75
75
  variables: options.variables,
76
+ localVariablesQuery,
76
77
  onCreate,
77
78
  });
78
79
  };
package/dist/templates.js CHANGED
@@ -62,7 +62,7 @@ function createIndexTsx(script = '') {
62
62
  import "https://polyfill.io/v3/polyfill.min.js?features=IntersectionObserver";
63
63
  import { create } from "@plaidev/karte-action-sdk";
64
64
 
65
- import { props } from "./gen";
65
+ import { props, localVariablesQuery } from "./gen";
66
66
  import App from "./App.svelte";
67
67
  import onCreate from "./customScript";
68
68
  ${script}
@@ -71,6 +71,7 @@ const action = (options: { send: Send; props: Props; variables: Variables }): Ka
71
71
  props,
72
72
  send: options.send,
73
73
  variables: options.variables,
74
+ localVariablesQuery,
74
75
  onCreate,
75
76
  });
76
77
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plaidev/karte-action-sdk",
3
- "version": "1.1.126-27950980.e8e536b0",
3
+ "version": "1.1.126-27952306.7e987116",
4
4
  "author": "Plaid Inc.",
5
5
  "license": "Apache-2.0",
6
6
  "module": "./dist/index.es.js",