@plaidev/karte-action-sdk 1.0.40 → 1.0.43

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