@plaidev/karte-action-sdk 1.0.41 → 1.0.44

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.
@@ -1,26 +1,4 @@
1
- /**
2
- * UIから選択できる関数
3
- */
4
1
  import { Writable } from "svelte/store";
5
- type OPTIONS = {
6
- send?: (event_name: string, values?: any) => void;
7
- isPreview?: boolean;
8
- initialState?: string;
9
- };
10
- declare const state: Writable<string>;
11
- declare const closed: Writable<boolean>;
12
- declare const maximumZindex: Writable<number>;
13
- declare const initialize: (options?: OPTIONS) => () => void;
14
- declare const finalize: () => void;
15
- declare const send_event: (event_name: string, values?: any) => void;
16
- declare const isPreview: () => boolean;
17
- declare const setMiximumZindex: (zindex?: number) => void;
18
- // eslint-disable-next-line @typescript-eslint/no-empty-function
19
- declare const none: () => () => void;
20
- declare const moveTo: (to: string) => () => void;
21
- declare const linkTo: (to: string, targetBlank?: boolean) => () => void;
22
- declare const closeApp: () => () => void;
23
- declare const _default: "dummy";
24
2
  declare const PropTypes: readonly [
25
3
  "BooleanKeyword",
26
4
  "NumberKeyword",
@@ -37,7 +15,9 @@ declare const PropTypes: readonly [
37
15
  "Color",
38
16
  "Alignment",
39
17
  "State",
40
- "Style"
18
+ "Style",
19
+ "ModalPlacement",
20
+ "OnClick"
41
21
  ];
42
22
  type PropType = typeof PropTypes[number];
43
23
  type Code = string;
@@ -171,6 +151,97 @@ type ModalPlacement<M = ModalMargin> = {
171
151
  backgroundOverlay?: boolean;
172
152
  };
173
153
  declare const DefaultModalPlacement: Required<ModalPlacement<Required<ModalMargin>>>;
154
+ type I18nLabel<Locale extends string = "ja" | "en"> = {
155
+ [K in Locale]?: string;
156
+ };
157
+ type BaseOperationOptions = ReadonlyArray<{
158
+ name: I18nLabel;
159
+ operation: string;
160
+ args: ReadonlyArray<{
161
+ name: I18nLabel;
162
+ type: keyof OperationArgumentTypes;
163
+ default: any;
164
+ }>;
165
+ }>;
166
+ type OperationArgumentTypes = {
167
+ StringKeyword: string;
168
+ BooleanKeyword: boolean;
169
+ NumberKeyword: number;
170
+ State: string;
171
+ Url: string;
172
+ };
173
+ type ConvertOperationOptions<O extends BaseOperationOptions> = ConvertOperationOption<O[number]>;
174
+ type ConvertOperationOption<Option extends BaseOperationOptions[number]> = Option extends any ? {
175
+ operation: Option["operation"];
176
+ args: ConvertOperationOptionArguments<Option["args"]>;
177
+ } : never;
178
+ type ConvertOperationOptionArguments<Arguments extends BaseOperationOptions[number]["args"]> = {
179
+ -readonly [Index in keyof Arguments]: Arguments[Index] extends BaseOperationOptions[number]["args"][number] ? OperationArgumentTypes[Arguments[Index]["type"]] : never;
180
+ };
181
+ type Operation = ConvertOperationOptions<ReadonlyArray<any>>;
182
+ declare const OnClickOperationOptions: readonly [
183
+ {
184
+ readonly name: {
185
+ readonly ja: "\u64CD\u4F5C\u306A\u3057";
186
+ readonly en: "No Operation";
187
+ };
188
+ readonly operation: "none";
189
+ readonly args: readonly [
190
+ ];
191
+ },
192
+ {
193
+ readonly name: {
194
+ readonly ja: "\u30EA\u30F3\u30AF\u9077\u79FB";
195
+ readonly en: "Link To";
196
+ };
197
+ readonly operation: "linkTo";
198
+ readonly args: readonly [
199
+ {
200
+ readonly name: {
201
+ readonly ja: "URL\u3092\u5165\u529B";
202
+ readonly en: "Enter URL";
203
+ };
204
+ readonly type: "Url";
205
+ readonly default: "";
206
+ },
207
+ {
208
+ readonly name: {
209
+ readonly ja: "\u65B0\u3057\u3044\u30BF\u30D6\u3067\u958B\u304F";
210
+ readonly en: "Open in new tab";
211
+ };
212
+ readonly type: "BooleanKeyword";
213
+ readonly default: true;
214
+ }
215
+ ];
216
+ },
217
+ {
218
+ readonly name: {
219
+ readonly ja: "\u30B9\u30C6\u30FC\u30C8\u9077\u79FB";
220
+ readonly en: "Move To";
221
+ };
222
+ readonly operation: "moveTo";
223
+ readonly args: readonly [
224
+ {
225
+ readonly name: {
226
+ readonly ja: "\u30B9\u30C6\u30FC\u30C8\u3092\u9078\u629E";
227
+ readonly en: "State";
228
+ };
229
+ readonly type: "State";
230
+ readonly default: "/";
231
+ }
232
+ ];
233
+ },
234
+ {
235
+ readonly name: {
236
+ readonly ja: "\u9589\u3058\u308B";
237
+ readonly en: "Close";
238
+ };
239
+ readonly operation: "closeApp";
240
+ readonly args: readonly [
241
+ ];
242
+ }
243
+ ];
244
+ type OnClickOperation = ConvertOperationOptions<typeof OnClickOperationOptions>;
174
245
  type LongText = string;
175
246
  type Url = string;
176
247
  type Image = string;
@@ -218,6 +289,25 @@ declare const BackgroundSizes: readonly [
218
289
  type BackgroundSize = typeof BackgroundSizes[number];
219
290
  type Style = string;
220
291
  type StateName = string;
292
+ type OPTIONS = {
293
+ send?: (event_name: string, values?: any) => void;
294
+ isPreview?: boolean;
295
+ initialState?: string;
296
+ };
297
+ declare const state: Writable<string>;
298
+ declare const closed: Writable<boolean>;
299
+ declare const maximumZindex: Writable<number>;
300
+ declare const initialize: (options?: OPTIONS) => () => void;
301
+ declare const finalize: () => void;
302
+ declare const send_event: (event_name: string, values?: any) => void;
303
+ declare const isPreview: () => boolean;
304
+ declare const setMiximumZindex: (zindex?: number) => void;
305
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
306
+ declare const none: () => () => void;
307
+ declare const moveTo: (to: string) => () => void;
308
+ declare const linkTo: (to: string, targetBlank?: boolean) => () => void;
309
+ declare const closeApp: () => () => void;
310
+ declare const execOnClickOperation: (onClickOperation: OnClickOperation) => void;
221
311
  declare const handleFocus: (node: HTMLElement | null) => (e: any) => void;
222
312
  declare const setPreviousFocus: () => void;
223
313
  declare const handleKeydown: (handlers: {
@@ -230,7 +320,6 @@ declare function onTime(fn: Function, time: number): () => void;
230
320
  declare function hasSuffix<Suffix extends "px" | "em" | "rem" | "%" | "fr" | "vw" | "vh" | "">(value: string, suffix: Suffix): value is `${number}${Suffix}`;
231
321
  declare function toBr(text: string): string;
232
322
  declare function randStr(digit?: number): string;
233
- declare const _default: "dummy";
234
323
  declare function hideOnScroll<Props extends {
235
324
  hide_on_scroll: boolean;
236
325
  hide_on_scroll_rate: number;
@@ -275,7 +364,7 @@ declare const collection: (config: {
275
364
  } | null | undefined, cb: (err: Error | null, items?: any) => void): void;
276
365
  set(key: string, value: string, cb: (err: Error | null) => void): void;
277
366
  };
278
- export { state, closed, maximumZindex, initialize, finalize, send_event, isPreview, setMiximumZindex, none, moveTo, linkTo, closeApp, _default, handleFocus, setPreviousFocus, handleKeydown, getPositionStyle, getMarginStyle, onScroll, onTime, hasSuffix, toBr, randStr, PropTypes, PropType, Code, MediaQueries, MediaQuery, Directions, Direction, AnimationStyles, AnimationStyle, AnimationStyleTranslations, ModalPositions, ModalPosition, ModalPositionTranslations, ModalMarginTranslations, ModalMargin, ModalPlacement, DefaultModalPlacement, LongText, Url, Image, LengthUnits, LengthUnit, Length, Color, Justifies, Justify, Alignments, Alignment, ObjectFits, ObjectFit, Repeats, Repeat, BackgroundSizes, BackgroundSize, Style, StateName, hideOnScroll, hideOnTime, showOnScroll, showOnTime, ensureModalRoot, h, createFog, EmbedLogic, embed, collection };
367
+ export { state, closed, maximumZindex, initialize, finalize, send_event, isPreview, setMiximumZindex, none, moveTo, linkTo, closeApp, execOnClickOperation, handleFocus, setPreviousFocus, handleKeydown, getPositionStyle, getMarginStyle, onScroll, onTime, hasSuffix, toBr, randStr, PropTypes, PropType, Code, MediaQueries, MediaQuery, Directions, Direction, AnimationStyles, AnimationStyle, AnimationStyleTranslations, ModalPositions, ModalPosition, ModalPositionTranslations, ModalMarginTranslations, ModalMargin, ModalPlacement, DefaultModalPlacement, Operation, OnClickOperationOptions, OnClickOperation, LongText, Url, Image, LengthUnits, LengthUnit, Length, Color, Justifies, Justify, Alignments, Alignment, ObjectFits, ObjectFit, Repeats, Repeat, BackgroundSizes, BackgroundSize, Style, StateName, hideOnScroll, hideOnTime, showOnScroll, showOnTime, ensureModalRoot, h, createFog, EmbedLogic, embed, collection };
279
368
  export { default as State } from './components/State.svelte';
280
369
  export { default as StateItem } from './components/StateItem.svelte';
281
370
  export { default as Modal } from './components/Modal.svelte';
package/dist/index.es.js CHANGED
@@ -104,6 +104,9 @@ function randStr(digit = 8) {
104
104
  return Math.random().toString(32).substring(digit);
105
105
  }
106
106
 
107
+ /**
108
+ * UIから選択できる関数
109
+ */
107
110
  const CONSTANTS = {
108
111
  ALL_ACTION_ID: 'KARTE_ALL_ACTION_ID',
109
112
  STATE_EVENT: 'KARTE-ACTION-CHANGE-STATE',
@@ -162,6 +165,17 @@ const closeApp = () => () => {
162
165
  send_event('message_close', null);
163
166
  closed.set(true);
164
167
  };
168
+ const execOnClickOperation = (onClickOperation) => {
169
+ if (onClickOperation.operation === 'linkTo') {
170
+ linkTo(...onClickOperation.args)();
171
+ }
172
+ else if (onClickOperation.operation === 'moveTo') {
173
+ moveTo(...onClickOperation.args)();
174
+ }
175
+ else if (onClickOperation.operation === 'closeApp') {
176
+ closeApp()();
177
+ }
178
+ };
165
179
 
166
180
  const PropTypes = [
167
181
  'BooleanKeyword',
@@ -180,6 +194,8 @@ const PropTypes = [
180
194
  'Alignment',
181
195
  'State',
182
196
  'Style',
197
+ 'ModalPlacement',
198
+ 'OnClick',
183
199
  ];
184
200
  const MediaQueries = {
185
201
  PC: '(\\s*min-width\\s*:\\s*1025px\\s*)',
@@ -304,6 +320,27 @@ const DefaultModalPlacement = {
304
320
  },
305
321
  backgroundOverlay: false,
306
322
  };
323
+ const OnClickOperationOptions = [
324
+ { name: { ja: '操作なし', en: 'No Operation' }, operation: 'none', args: [] },
325
+ {
326
+ name: { ja: 'リンク遷移', en: 'Link To' },
327
+ operation: 'linkTo',
328
+ args: [
329
+ { name: { ja: 'URLを入力', en: 'Enter URL' }, type: 'Url', default: '' },
330
+ {
331
+ name: { ja: '新しいタブで開く', en: 'Open in new tab' },
332
+ type: 'BooleanKeyword',
333
+ default: true,
334
+ },
335
+ ],
336
+ },
337
+ {
338
+ name: { ja: 'ステート遷移', en: 'Move To' },
339
+ operation: 'moveTo',
340
+ args: [{ name: { ja: 'ステートを選択', en: 'State' }, type: 'State', default: '/' }],
341
+ },
342
+ { name: { ja: '閉じる', en: 'Close' }, operation: 'closeApp', args: [] },
343
+ ];
307
344
  const LengthUnits = ['px', 'em', 'rem', 'vw', 'fr', '%'];
308
345
  const Justifies = ['flex-start', 'center', 'flex-end'];
309
346
  const Alignments = ['flex-start', 'center', 'flex-end'];
@@ -873,7 +910,7 @@ function add_css$6(target) {
873
910
  append_styles(target, "svelte-1bxl6mz", ".modal.svelte-1bxl6mz{position:fixed;box-sizing:border-box;z-index:2147483647}.close.svelte-1bxl6mz{position:absolute;display:flex;justify-content:center;align-items:center;background-color:transparent;border:none;cursor:pointer;padding:0;transition:all 0.25s}.close.svelte-1bxl6mz:hover{transform:rotate(90deg)}");
874
911
  }
875
912
 
876
- // (130:4) {#if closable}
913
+ // (148:4) {#if closable}
877
914
  function create_if_block(ctx) {
878
915
  let button;
879
916
  let svg;
@@ -925,7 +962,7 @@ function create_if_block(ctx) {
925
962
  };
926
963
  }
927
964
 
928
- // (117:0) <Animation {animation}>
965
+ // (135:0) <Animation {animation}>
929
966
  function create_default_slot$1(ctx) {
930
967
  let div;
931
968
  let t;
@@ -934,8 +971,8 @@ function create_default_slot$1(ctx) {
934
971
  let mounted;
935
972
  let dispose;
936
973
  let if_block = /*closable*/ ctx[2] && create_if_block(ctx);
937
- const default_slot_template = /*#slots*/ ctx[20].default;
938
- const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[22], null);
974
+ const default_slot_template = /*#slots*/ ctx[22].default;
975
+ const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[24], null);
939
976
 
940
977
  return {
941
978
  c() {
@@ -957,7 +994,7 @@ function create_default_slot$1(ctx) {
957
994
  default_slot.m(div, null);
958
995
  }
959
996
 
960
- /*div_binding*/ ctx[21](div);
997
+ /*div_binding*/ ctx[23](div);
961
998
  current = true;
962
999
 
963
1000
  if (!mounted) {
@@ -980,15 +1017,15 @@ function create_default_slot$1(ctx) {
980
1017
  }
981
1018
 
982
1019
  if (default_slot) {
983
- if (default_slot.p && (!current || dirty & /*$$scope*/ 4194304)) {
1020
+ if (default_slot.p && (!current || dirty & /*$$scope*/ 16777216)) {
984
1021
  update_slot_base(
985
1022
  default_slot,
986
1023
  default_slot_template,
987
1024
  ctx,
988
- /*$$scope*/ ctx[22],
1025
+ /*$$scope*/ ctx[24],
989
1026
  !current
990
- ? get_all_dirty_from_scope(/*$$scope*/ ctx[22])
991
- : get_slot_changes(default_slot_template, /*$$scope*/ ctx[22], dirty, null),
1027
+ ? get_all_dirty_from_scope(/*$$scope*/ ctx[24])
1028
+ : get_slot_changes(default_slot_template, /*$$scope*/ ctx[24], dirty, null),
992
1029
  null
993
1030
  );
994
1031
  }
@@ -1011,7 +1048,7 @@ function create_default_slot$1(ctx) {
1011
1048
  if (detaching) detach(div);
1012
1049
  if (if_block) if_block.d();
1013
1050
  if (default_slot) default_slot.d(detaching);
1014
- /*div_binding*/ ctx[21](null);
1051
+ /*div_binding*/ ctx[23](null);
1015
1052
  mounted = false;
1016
1053
  dispose();
1017
1054
  }
@@ -1066,7 +1103,7 @@ function create_fragment$8(ctx) {
1066
1103
  const animation_1_changes = {};
1067
1104
  if (dirty & /*animation*/ 1) animation_1_changes.animation = /*animation*/ ctx[0];
1068
1105
 
1069
- if (dirty & /*$$scope, pos, marginStyle, _style, modal, $maximumZindex, _closeStyle, closeButtonColor, closable*/ 4195070) {
1106
+ if (dirty & /*$$scope, pos, marginStyle, _style, modal, $maximumZindex, _closeStyle, closeButtonColor, closable*/ 16777982) {
1070
1107
  animation_1_changes.$$scope = { dirty, ctx };
1071
1108
  }
1072
1109
 
@@ -1102,6 +1139,11 @@ function instance$8($$self, $$props, $$invalidate) {
1102
1139
  let $maximumZindex;
1103
1140
  component_subscribe($$self, maximumZindex, $$value => $$invalidate(9, $maximumZindex = $$value));
1104
1141
  let { $$slots: slots = {}, $$scope } = $$props;
1142
+ let { onClick = { operation: 'none', args: [] } } = $$props;
1143
+
1144
+ /**
1145
+ * {"hidden": true}
1146
+ */
1105
1147
  const dispatchClick = createEventDispatcher();
1106
1148
 
1107
1149
  const click = () => {
@@ -1109,7 +1151,11 @@ function instance$8($$self, $$props, $$invalidate) {
1109
1151
  send_event(clickEventName, clickEventValue);
1110
1152
  }
1111
1153
 
1112
- dispatchClick('click');
1154
+ if (onClick.operation !== 'none') {
1155
+ execOnClickOperation(onClick);
1156
+ } else {
1157
+ dispatchClick('click');
1158
+ }
1113
1159
  };
1114
1160
 
1115
1161
  let { clickEventName = '' } = $$props;
@@ -1118,12 +1164,10 @@ function instance$8($$self, $$props, $$invalidate) {
1118
1164
  let { animation = 'none' } = $$props;
1119
1165
  let { _style = '' } = $$props;
1120
1166
  let { closable = true } = $$props;
1167
+ let { onClose = { operation: 'none', args: [] } } = $$props;
1121
1168
 
1122
1169
  /**
1123
- * {
1124
- * "title": {"ja": "タイプ", "en": "Type"},
1125
- * "folder": {"ja": "閉じるボタン", "en": "Close Button"}
1126
- * }
1170
+ * {"hidden": true}
1127
1171
  */
1128
1172
  const dispatchClose = createEventDispatcher();
1129
1173
 
@@ -1132,7 +1176,11 @@ function instance$8($$self, $$props, $$invalidate) {
1132
1176
  send_event(closeEventName, closeEventValue);
1133
1177
  }
1134
1178
 
1135
- dispatchClose('close');
1179
+ if (onClose.operation !== 'none') {
1180
+ execOnClickOperation(onClose);
1181
+ } else {
1182
+ dispatchClose('close');
1183
+ }
1136
1184
  };
1137
1185
 
1138
1186
  let { closeButtonColor = '#000000' } = $$props;
@@ -1151,36 +1199,38 @@ function instance$8($$self, $$props, $$invalidate) {
1151
1199
  }
1152
1200
 
1153
1201
  $$self.$$set = $$props => {
1154
- if ('clickEventName' in $$props) $$invalidate(13, clickEventName = $$props.clickEventName);
1155
- if ('clickEventValue' in $$props) $$invalidate(14, clickEventValue = $$props.clickEventValue);
1156
- if ('placement' in $$props) $$invalidate(15, placement = $$props.placement);
1202
+ if ('onClick' in $$props) $$invalidate(13, onClick = $$props.onClick);
1203
+ if ('clickEventName' in $$props) $$invalidate(14, clickEventName = $$props.clickEventName);
1204
+ if ('clickEventValue' in $$props) $$invalidate(15, clickEventValue = $$props.clickEventValue);
1205
+ if ('placement' in $$props) $$invalidate(16, placement = $$props.placement);
1157
1206
  if ('animation' in $$props) $$invalidate(0, animation = $$props.animation);
1158
1207
  if ('_style' in $$props) $$invalidate(1, _style = $$props._style);
1159
1208
  if ('closable' in $$props) $$invalidate(2, closable = $$props.closable);
1209
+ if ('onClose' in $$props) $$invalidate(17, onClose = $$props.onClose);
1160
1210
  if ('closeButtonColor' in $$props) $$invalidate(3, closeButtonColor = $$props.closeButtonColor);
1161
- if ('closeEventName' in $$props) $$invalidate(16, closeEventName = $$props.closeEventName);
1162
- if ('closeEventValue' in $$props) $$invalidate(17, closeEventValue = $$props.closeEventValue);
1211
+ if ('closeEventName' in $$props) $$invalidate(18, closeEventName = $$props.closeEventName);
1212
+ if ('closeEventValue' in $$props) $$invalidate(19, closeEventValue = $$props.closeEventValue);
1163
1213
  if ('_closeStyle' in $$props) $$invalidate(4, _closeStyle = $$props._closeStyle);
1164
- if ('$$scope' in $$props) $$invalidate(22, $$scope = $$props.$$scope);
1214
+ if ('$$scope' in $$props) $$invalidate(24, $$scope = $$props.$$scope);
1165
1215
  };
1166
1216
 
1167
1217
  $$self.$$.update = () => {
1168
- if ($$self.$$.dirty & /*placement*/ 32768) {
1218
+ if ($$self.$$.dirty & /*placement*/ 65536) {
1169
1219
  $$invalidate(8, backgroundOverray = placement && placement.backgroundOverlay != null
1170
1220
  ? placement.backgroundOverlay
1171
1221
  : DefaultModalPlacement.backgroundOverlay);
1172
1222
  }
1173
1223
 
1174
- if ($$self.$$.dirty & /*placement*/ 32768) {
1175
- $$invalidate(19, overwritePosition = isPreview()
1224
+ if ($$self.$$.dirty & /*placement*/ 65536) {
1225
+ $$invalidate(21, overwritePosition = isPreview()
1176
1226
  ? 'center'
1177
1227
  : placement && placement.position != null
1178
1228
  ? placement.position
1179
1229
  : DefaultModalPlacement.position);
1180
1230
  }
1181
1231
 
1182
- if ($$self.$$.dirty & /*placement*/ 32768) {
1183
- $$invalidate(18, overwriteMargin = isPreview()
1232
+ if ($$self.$$.dirty & /*placement*/ 65536) {
1233
+ $$invalidate(20, overwriteMargin = isPreview()
1184
1234
  ? {
1185
1235
  left: '0px',
1186
1236
  right: '0px',
@@ -1192,11 +1242,11 @@ function instance$8($$self, $$props, $$invalidate) {
1192
1242
  : DefaultModalPlacement.margin);
1193
1243
  }
1194
1244
 
1195
- if ($$self.$$.dirty & /*overwritePosition*/ 524288) {
1245
+ if ($$self.$$.dirty & /*overwritePosition*/ 2097152) {
1196
1246
  $$invalidate(7, pos = getPositionStyle(overwritePosition));
1197
1247
  }
1198
1248
 
1199
- if ($$self.$$.dirty & /*overwriteMargin*/ 262144) {
1249
+ if ($$self.$$.dirty & /*overwriteMargin*/ 1048576) {
1200
1250
  $$invalidate(6, marginStyle = getMarginStyle(overwriteMargin));
1201
1251
  }
1202
1252
  };
@@ -1215,9 +1265,11 @@ function instance$8($$self, $$props, $$invalidate) {
1215
1265
  click,
1216
1266
  close,
1217
1267
  handle_keydown,
1268
+ onClick,
1218
1269
  clickEventName,
1219
1270
  clickEventValue,
1220
1271
  placement,
1272
+ onClose,
1221
1273
  closeEventName,
1222
1274
  closeEventValue,
1223
1275
  overwriteMargin,
@@ -1239,15 +1291,17 @@ class Modal extends SvelteComponent {
1239
1291
  create_fragment$8,
1240
1292
  safe_not_equal,
1241
1293
  {
1242
- clickEventName: 13,
1243
- clickEventValue: 14,
1244
- placement: 15,
1294
+ onClick: 13,
1295
+ clickEventName: 14,
1296
+ clickEventValue: 15,
1297
+ placement: 16,
1245
1298
  animation: 0,
1246
1299
  _style: 1,
1247
1300
  closable: 2,
1301
+ onClose: 17,
1248
1302
  closeButtonColor: 3,
1249
- closeEventName: 16,
1250
- closeEventValue: 17,
1303
+ closeEventName: 18,
1304
+ closeEventValue: 19,
1251
1305
  _closeStyle: 4
1252
1306
  },
1253
1307
  add_css$6
@@ -2178,12 +2232,10 @@ function create_fragment$1(ctx) {
2178
2232
 
2179
2233
  function instance$1($$self, $$props, $$invalidate) {
2180
2234
  let { text = 'ボタンラベル' } = $$props;
2235
+ let { onClick = { operation: 'none', args: [] } } = $$props;
2181
2236
 
2182
2237
  /**
2183
- * {
2184
- * "title": {"ja": "タイプ", "en": "Type"},
2185
- * "folder": {"ja": "クリック時の動作", "en": "Behavior to Click"}
2186
- * }
2238
+ * {"hidden": true}
2187
2239
  */
2188
2240
  const dispatch = createEventDispatcher();
2189
2241
 
@@ -2192,7 +2244,11 @@ function instance$1($$self, $$props, $$invalidate) {
2192
2244
  send_event(eventName);
2193
2245
  }
2194
2246
 
2195
- dispatch('click');
2247
+ if (onClick.operation !== 'none') {
2248
+ execOnClickOperation(onClick);
2249
+ } else {
2250
+ dispatch('click');
2251
+ }
2196
2252
  };
2197
2253
 
2198
2254
  let { eventName = '' } = $$props;
@@ -2201,12 +2257,13 @@ function instance$1($$self, $$props, $$invalidate) {
2201
2257
 
2202
2258
  $$self.$$set = $$props => {
2203
2259
  if ('text' in $$props) $$invalidate(0, text = $$props.text);
2204
- if ('eventName' in $$props) $$invalidate(4, eventName = $$props.eventName);
2260
+ if ('onClick' in $$props) $$invalidate(4, onClick = $$props.onClick);
2261
+ if ('eventName' in $$props) $$invalidate(5, eventName = $$props.eventName);
2205
2262
  if ('_buttonStyle' in $$props) $$invalidate(1, _buttonStyle = $$props._buttonStyle);
2206
2263
  if ('_style' in $$props) $$invalidate(2, _style = $$props._style);
2207
2264
  };
2208
2265
 
2209
- return [text, _buttonStyle, _style, click, eventName];
2266
+ return [text, _buttonStyle, _style, click, onClick, eventName];
2210
2267
  }
2211
2268
 
2212
2269
  class TextButtonBlock extends SvelteComponent {
@@ -2221,7 +2278,8 @@ class TextButtonBlock extends SvelteComponent {
2221
2278
  safe_not_equal,
2222
2279
  {
2223
2280
  text: 0,
2224
- eventName: 4,
2281
+ onClick: 4,
2282
+ eventName: 5,
2225
2283
  _buttonStyle: 1,
2226
2284
  _style: 2
2227
2285
  },
@@ -2302,12 +2360,10 @@ function instance($$self, $$props, $$invalidate) {
2302
2360
  let { src = 'https://admin.karte.io/action-editor2/public/images/no_image_en.svg' } = $$props;
2303
2361
  let { alt = 'No Image' } = $$props;
2304
2362
  let { transport = false } = $$props;
2363
+ let { onClick = { operation: 'none', args: [] } } = $$props;
2305
2364
 
2306
2365
  /**
2307
- * {
2308
- * "title": {"ja": "タイプ", "en": "Type"},
2309
- * "folder": {"ja": "クリック時の動作", "en": "Behavior to Click"}
2310
- * }
2366
+ * {"hidden": true}
2311
2367
  */
2312
2368
  const dispatch = createEventDispatcher();
2313
2369
 
@@ -2316,7 +2372,11 @@ function instance($$self, $$props, $$invalidate) {
2316
2372
  send_event(eventName);
2317
2373
  }
2318
2374
 
2319
- dispatch('click');
2375
+ if (onClick.operation !== 'none') {
2376
+ execOnClickOperation(onClick);
2377
+ } else {
2378
+ dispatch('click');
2379
+ }
2320
2380
  };
2321
2381
 
2322
2382
  let { eventName = '' } = $$props;
@@ -2327,12 +2387,13 @@ function instance($$self, $$props, $$invalidate) {
2327
2387
  if ('src' in $$props) $$invalidate(0, src = $$props.src);
2328
2388
  if ('alt' in $$props) $$invalidate(1, alt = $$props.alt);
2329
2389
  if ('transport' in $$props) $$invalidate(2, transport = $$props.transport);
2330
- if ('eventName' in $$props) $$invalidate(6, eventName = $$props.eventName);
2390
+ if ('onClick' in $$props) $$invalidate(6, onClick = $$props.onClick);
2391
+ if ('eventName' in $$props) $$invalidate(7, eventName = $$props.eventName);
2331
2392
  if ('_imageStyle' in $$props) $$invalidate(3, _imageStyle = $$props._imageStyle);
2332
2393
  if ('_style' in $$props) $$invalidate(4, _style = $$props._style);
2333
2394
  };
2334
2395
 
2335
- return [src, alt, transport, _imageStyle, _style, click, eventName];
2396
+ return [src, alt, transport, _imageStyle, _style, click, onClick, eventName];
2336
2397
  }
2337
2398
 
2338
2399
  class ImageBlock extends SvelteComponent {
@@ -2349,7 +2410,8 @@ class ImageBlock extends SvelteComponent {
2349
2410
  src: 0,
2350
2411
  alt: 1,
2351
2412
  transport: 2,
2352
- eventName: 6,
2413
+ onClick: 6,
2414
+ eventName: 7,
2353
2415
  _imageStyle: 3,
2354
2416
  _style: 4
2355
2417
  },
@@ -2358,4 +2420,4 @@ class ImageBlock extends SvelteComponent {
2358
2420
  }
2359
2421
  }
2360
2422
 
2361
- export { Alignments, AnimationStyleTranslations, AnimationStyles, BackgroundSizes, DefaultModalPlacement, Directions, Flex, FlexItem, Grid, GridItem, GridModalState, ImageBlock, Justifies, LengthUnits, MediaQueries, Modal, ModalMarginTranslations, ModalPositionTranslations, ModalPositions, ObjectFits, PropTypes, Repeats, State, StateItem, TextBlock, TextButtonBlock, closeApp, closed, collection, createFog, embed, ensureModalRoot, finalize, getMarginStyle, getPositionStyle, h, handleFocus, handleKeydown, hasSuffix, hideOnScroll, hideOnTime, initialize, isPreview, linkTo, maximumZindex, moveTo, none, onScroll, onTime, randStr, send_event, setMiximumZindex, setPreviousFocus, showOnScroll, showOnTime, state, toBr };
2423
+ export { Alignments, AnimationStyleTranslations, AnimationStyles, BackgroundSizes, DefaultModalPlacement, Directions, Flex, FlexItem, Grid, GridItem, GridModalState, ImageBlock, Justifies, LengthUnits, MediaQueries, Modal, ModalMarginTranslations, ModalPositionTranslations, ModalPositions, ObjectFits, OnClickOperationOptions, PropTypes, Repeats, State, StateItem, TextBlock, TextButtonBlock, closeApp, closed, collection, createFog, embed, ensureModalRoot, execOnClickOperation, finalize, getMarginStyle, getPositionStyle, h, handleFocus, handleKeydown, hasSuffix, hideOnScroll, hideOnTime, initialize, isPreview, linkTo, maximumZindex, moveTo, none, onScroll, onTime, randStr, send_event, setMiximumZindex, setPreviousFocus, showOnScroll, showOnTime, state, toBr };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plaidev/karte-action-sdk",
3
- "version": "1.0.41",
3
+ "version": "1.0.44",
4
4
  "author": "Plaid Inc.",
5
5
  "license": "Apache-2.0",
6
6
  "module": "./dist/index.es.js",
@@ -70,7 +70,8 @@
70
70
  "prepare": "npm run setup:default && npm run setup:template && npm run setup:concat",
71
71
  "build": "rollup -c",
72
72
  "build:watch": "rollup -c -w",
73
- "check": "svelte-check --tsconfig ./tsconfig.json",
73
+ "check:svelte": "svelte-check --tsconfig ./tsconfig.json",
74
+ "check:type": "tsc --noEmit",
74
75
  "test": "vitest run test",
75
76
  "test:watch": "vitest test",
76
77
  "test:ui": "vitest test --ui",