@plaidev/karte-action-sdk 1.1.114 → 1.1.115-27927583.61884118
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hydrate/index.es.d.ts +959 -848
- package/dist/hydrate/index.es.js +434 -315
- package/dist/index.es.d.ts +959 -848
- package/dist/index.es.js +487 -362
- package/package.json +2 -1
package/dist/hydrate/index.es.js
CHANGED
|
@@ -3,16 +3,13 @@ import 'svelte/easing';
|
|
|
3
3
|
import { SvelteComponent, init, safe_not_equal, append_styles, create_slot, create_component, space, claim_component, claim_space, mount_component, insert_hydration, update_slot_base, get_all_dirty_from_scope, get_slot_changes, transition_in, transition_out, destroy_component, detach, empty, group_outros, check_outros, component_subscribe, element, claim_element, children, attr, noop, listen, is_function, append_hydration, add_render_callback, create_in_transition, svg_element, claim_svg_element, binding_callbacks, destroy_each, text, claim_text, set_data, null_to_empty, src_url_equal, set_style, run_all } from 'svelte/internal';
|
|
4
4
|
import { setContext, getContext, createEventDispatcher, onMount, onDestroy as onDestroy$1 } from 'svelte';
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* @internal
|
|
8
|
-
*/
|
|
6
|
+
/** @internal */
|
|
9
7
|
const NOOP = (_args) => { }; // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
10
|
-
/**
|
|
11
|
-
* @internal
|
|
12
|
-
*/
|
|
8
|
+
/** @internal */
|
|
13
9
|
const isPreview = () => {
|
|
14
10
|
return true;
|
|
15
11
|
};
|
|
12
|
+
/** @internal */
|
|
16
13
|
const handleFocus = (node) => (e) => {
|
|
17
14
|
if (node) {
|
|
18
15
|
// trap focus
|
|
@@ -27,12 +24,14 @@ const handleFocus = (node) => (e) => {
|
|
|
27
24
|
e.preventDefault();
|
|
28
25
|
}
|
|
29
26
|
};
|
|
27
|
+
/** @internal */
|
|
30
28
|
const setPreviousFocus = () => {
|
|
31
29
|
const previously_focused = typeof document !== 'undefined' && document.activeElement;
|
|
32
30
|
if (previously_focused) {
|
|
33
31
|
previously_focused?.focus();
|
|
34
32
|
}
|
|
35
33
|
};
|
|
34
|
+
/** @internal */
|
|
36
35
|
const handleKeydown = (handlers) => (e) => {
|
|
37
36
|
if (handlers[e.key]) {
|
|
38
37
|
handlers[e.key](e);
|
|
@@ -62,6 +61,7 @@ const TRANSFORM = {
|
|
|
62
61
|
'bottom-right': [0, 0],
|
|
63
62
|
none: [0, 0],
|
|
64
63
|
};
|
|
64
|
+
/** @internal */
|
|
65
65
|
const getPositionStyle = (position) => {
|
|
66
66
|
const style = POSITION_STYLES[position];
|
|
67
67
|
if (style != null) {
|
|
@@ -72,6 +72,7 @@ const getPositionStyle = (position) => {
|
|
|
72
72
|
return POSITION_STYLES['center'];
|
|
73
73
|
}
|
|
74
74
|
};
|
|
75
|
+
/** @internal */
|
|
75
76
|
const getTransform = (position) => {
|
|
76
77
|
const transform = TRANSFORM[position];
|
|
77
78
|
if (transform != null) {
|
|
@@ -82,6 +83,7 @@ const getTransform = (position) => {
|
|
|
82
83
|
return TRANSFORM['center'];
|
|
83
84
|
}
|
|
84
85
|
};
|
|
86
|
+
/** @internal */
|
|
85
87
|
const getMarginStyle = (margin) => {
|
|
86
88
|
return `margin: ${margin?.top ?? 0} ${margin?.right ?? 0} ${margin?.bottom ?? 0} ${margin?.left ?? 0};`;
|
|
87
89
|
};
|
|
@@ -92,6 +94,8 @@ const getMarginStyle = (margin) => {
|
|
|
92
94
|
* @param fn - スクロール率が達したときに呼び出されるコールバック関数
|
|
93
95
|
*
|
|
94
96
|
* @returns スクロール率によって呼び出されるコールバックを停止する関数を返します
|
|
97
|
+
*
|
|
98
|
+
* @public
|
|
95
99
|
*/
|
|
96
100
|
function onScroll(rate, fn) {
|
|
97
101
|
const rates = Array.isArray(rate) ? rate : [rate];
|
|
@@ -178,25 +182,24 @@ function onScroll(rate, fn) {
|
|
|
178
182
|
* @param fn - 指定した時間が経過後に呼び出されるコールバック関数
|
|
179
183
|
*
|
|
180
184
|
* @returns コールバックを呼び出すためのタイマーを停止する関数を返します
|
|
185
|
+
*
|
|
186
|
+
* @public
|
|
181
187
|
*/
|
|
182
188
|
function onTime(time, fn) {
|
|
183
189
|
const timeoutHandler = setTimeout(fn, time);
|
|
184
190
|
return () => timeoutHandler && clearTimeout(timeoutHandler);
|
|
185
191
|
}
|
|
192
|
+
/** @internal */
|
|
186
193
|
function hasSuffix(value, suffix) {
|
|
187
194
|
return new RegExp(`[0-9]${suffix}$`).test(value);
|
|
188
195
|
}
|
|
189
|
-
function toBr(text) {
|
|
190
|
-
return text.replace(/\r?\n/g, '<br>');
|
|
191
|
-
}
|
|
192
|
-
function randStr(digit = 8) {
|
|
193
|
-
return Math.random().toString(32).substring(digit);
|
|
194
|
-
}
|
|
195
196
|
|
|
196
197
|
/**
|
|
197
198
|
* get store state value
|
|
198
199
|
*
|
|
199
200
|
* @deprecated 非推奨
|
|
201
|
+
*
|
|
202
|
+
* @internal
|
|
200
203
|
*/
|
|
201
204
|
const getStoreState = get;
|
|
202
205
|
/**
|
|
@@ -207,16 +210,23 @@ const actionSetting = writable({ autoStart: true });
|
|
|
207
210
|
* {@link getActionSetting} function to get action setting.
|
|
208
211
|
*
|
|
209
212
|
* @returns Current action setting
|
|
213
|
+
*
|
|
214
|
+
* @internal
|
|
210
215
|
*/
|
|
211
216
|
function getActionSetting() {
|
|
212
217
|
return get(actionSetting);
|
|
213
218
|
}
|
|
214
219
|
/**
|
|
215
|
-
*
|
|
220
|
+
* アクション設定を更新する
|
|
216
221
|
*
|
|
217
|
-
* @
|
|
222
|
+
* @remarks
|
|
223
|
+
* アクションの自動起動 (autoStart) を設定できます。
|
|
224
|
+
*
|
|
225
|
+
* @param setting - 更新するアクション設定
|
|
218
226
|
*
|
|
219
|
-
* @returns
|
|
227
|
+
* @returns 新しいアクション設定
|
|
228
|
+
*
|
|
229
|
+
* @public
|
|
220
230
|
*/
|
|
221
231
|
function setActionSetting(setting) {
|
|
222
232
|
actionSetting.update(current => {
|
|
@@ -228,6 +238,8 @@ function setActionSetting(setting) {
|
|
|
228
238
|
}
|
|
229
239
|
/**
|
|
230
240
|
* {@link resetActionSetting} function to reset action setting
|
|
241
|
+
*
|
|
242
|
+
* @internal
|
|
231
243
|
*/
|
|
232
244
|
function resetActionSetting() {
|
|
233
245
|
actionSetting.set({ autoStart: true });
|
|
@@ -238,15 +250,23 @@ function resetActionSetting() {
|
|
|
238
250
|
*/
|
|
239
251
|
const system = writable({});
|
|
240
252
|
/**
|
|
241
|
-
*
|
|
253
|
+
* KARTE の設定を取得する
|
|
254
|
+
*
|
|
255
|
+
* @remarks
|
|
256
|
+
* アクションが表示されて設定されるため、{@link onShow} フック関数で利用できます。
|
|
257
|
+
* 取得できる設定は、APIキー、接客ID、アクションショートIDなどです。
|
|
242
258
|
*
|
|
243
|
-
* @returns
|
|
259
|
+
* @returns 現在の KARTE システムの設定を返します
|
|
260
|
+
*
|
|
261
|
+
* @public
|
|
244
262
|
*/
|
|
245
263
|
function getSystem() {
|
|
246
264
|
return get(system);
|
|
247
265
|
}
|
|
248
266
|
/**
|
|
249
267
|
* {@link setSystem} function to set KARTE system config.
|
|
268
|
+
*
|
|
269
|
+
* @internal
|
|
250
270
|
*/
|
|
251
271
|
function setSystem(config) {
|
|
252
272
|
system.set(config);
|
|
@@ -256,10 +276,17 @@ function setSystem(config) {
|
|
|
256
276
|
*
|
|
257
277
|
* This is exported becase of compatible interface for App.svelte.
|
|
258
278
|
* Don't use directly.
|
|
279
|
+
*
|
|
280
|
+
* @internal
|
|
259
281
|
*/
|
|
260
282
|
const state = writable('/');
|
|
261
283
|
/**
|
|
262
|
-
*
|
|
284
|
+
* 現在のステートを設定する
|
|
285
|
+
*
|
|
286
|
+
* @param stateId - 表示するステートID
|
|
287
|
+
* @param force - 強制的にステートを設定するフラグ。デフォルトは `false`
|
|
288
|
+
*
|
|
289
|
+
* @public
|
|
263
290
|
*/
|
|
264
291
|
function setState$1(stateId, force = false) {
|
|
265
292
|
if (!force && isPreview())
|
|
@@ -267,21 +294,30 @@ function setState$1(stateId, force = false) {
|
|
|
267
294
|
state.set(stateId);
|
|
268
295
|
}
|
|
269
296
|
/**
|
|
270
|
-
*
|
|
297
|
+
* 現在のステートを取得する
|
|
298
|
+
*
|
|
299
|
+
* @remarks
|
|
300
|
+
* アクションが表示されて設定されるため、{@link onShow} フック関数で利用できます。
|
|
301
|
+
*
|
|
302
|
+
* @returns 現在のステートID
|
|
271
303
|
*
|
|
272
|
-
* @
|
|
304
|
+
* @public
|
|
273
305
|
*/
|
|
274
306
|
function getState$1() {
|
|
275
307
|
return get(state);
|
|
276
308
|
}
|
|
277
309
|
/**
|
|
278
310
|
* Store to handle all state IDs
|
|
311
|
+
*
|
|
312
|
+
* @internal
|
|
279
313
|
*/
|
|
280
314
|
const states = writable([]);
|
|
281
315
|
/**
|
|
282
316
|
* {@link getStates} function to add new state ID to list of state IDs.
|
|
283
317
|
*
|
|
284
318
|
* @param stateId - New state ID
|
|
319
|
+
*
|
|
320
|
+
* @internal
|
|
285
321
|
*/
|
|
286
322
|
function addState(stateId) {
|
|
287
323
|
states.update(current => {
|
|
@@ -290,27 +326,38 @@ function addState(stateId) {
|
|
|
290
326
|
});
|
|
291
327
|
}
|
|
292
328
|
/**
|
|
293
|
-
*
|
|
329
|
+
* ステートID一覧を取得する
|
|
330
|
+
*
|
|
331
|
+
* @remarks
|
|
332
|
+
* アクションが表示されて設定されるため、{@link onShow} フック関数で利用できます。
|
|
333
|
+
*
|
|
334
|
+
* @returns すべてのステートID
|
|
294
335
|
*
|
|
295
|
-
* @
|
|
336
|
+
* @public
|
|
296
337
|
*/
|
|
297
338
|
function getStates() {
|
|
298
339
|
return get(states);
|
|
299
340
|
}
|
|
300
341
|
/**
|
|
301
342
|
* Store to handle visibility of action
|
|
343
|
+
*
|
|
344
|
+
* @internal
|
|
302
345
|
*/
|
|
303
346
|
const opened = writable(true);
|
|
304
347
|
/**
|
|
305
|
-
*
|
|
348
|
+
* アクションの表示・非表示の状態を取得する
|
|
349
|
+
*
|
|
350
|
+
* @returns アクションが表示されているときは `true`、非表示のときは `false` を返します。
|
|
306
351
|
*
|
|
307
|
-
* @
|
|
352
|
+
* @public
|
|
308
353
|
*/
|
|
309
354
|
function isOpened() {
|
|
310
355
|
return get(opened);
|
|
311
356
|
}
|
|
312
357
|
/**
|
|
313
358
|
* {@link setOpened} function to set if action is opened.
|
|
359
|
+
*
|
|
360
|
+
* @internal
|
|
314
361
|
*/
|
|
315
362
|
function setOpened(on) {
|
|
316
363
|
opened.set(on);
|
|
@@ -319,6 +366,8 @@ function setOpened(on) {
|
|
|
319
366
|
* Store to handle visibility of action
|
|
320
367
|
*
|
|
321
368
|
* @deprecated 非推奨
|
|
369
|
+
*
|
|
370
|
+
* @internal
|
|
322
371
|
*/
|
|
323
372
|
const closed = writable(false); // deprecated
|
|
324
373
|
/**
|
|
@@ -327,6 +376,8 @@ const closed = writable(false); // deprecated
|
|
|
327
376
|
* @returns Flag if action is closed / true: Closed, false: Not closed
|
|
328
377
|
*
|
|
329
378
|
* @deprecated 非推奨
|
|
379
|
+
*
|
|
380
|
+
* @internal
|
|
330
381
|
*/
|
|
331
382
|
function isClosed() {
|
|
332
383
|
return get(closed);
|
|
@@ -335,16 +386,22 @@ function isClosed() {
|
|
|
335
386
|
* {@link setClosed} function to set if action is closed.
|
|
336
387
|
*
|
|
337
388
|
* @deprecated 非推奨
|
|
389
|
+
*
|
|
390
|
+
* @internal
|
|
338
391
|
*/
|
|
339
392
|
function setClosed(on) {
|
|
340
393
|
closed.set(on);
|
|
341
394
|
}
|
|
342
395
|
/**
|
|
343
396
|
* Store to handle max z-index for grid items
|
|
397
|
+
*
|
|
398
|
+
* @internal
|
|
344
399
|
*/
|
|
345
400
|
const maximumZindex = writable(0);
|
|
346
401
|
/**
|
|
347
402
|
* Set maximum z-index.
|
|
403
|
+
*
|
|
404
|
+
* @internal
|
|
348
405
|
*/
|
|
349
406
|
const setMaximumZindex = (zindex) => {
|
|
350
407
|
if (!zindex || zindex < get(maximumZindex))
|
|
@@ -354,23 +411,19 @@ const setMaximumZindex = (zindex) => {
|
|
|
354
411
|
/**
|
|
355
412
|
* Store to handle internal event handlers
|
|
356
413
|
*
|
|
357
|
-
*
|
|
414
|
+
* @internal
|
|
358
415
|
*/
|
|
359
416
|
const internalHandlers = writable({});
|
|
360
417
|
/**
|
|
361
418
|
* {@link getInternalHandlers} function to get internal event handlers.
|
|
362
419
|
*
|
|
363
420
|
* @returns Current internal handlers
|
|
421
|
+
*
|
|
422
|
+
* @internal
|
|
364
423
|
*/
|
|
365
424
|
function getInternalHandlers() {
|
|
366
425
|
return get(internalHandlers);
|
|
367
426
|
}
|
|
368
|
-
/**
|
|
369
|
-
* {@link setInternalHandlers} function to set internal event handlers.
|
|
370
|
-
*/
|
|
371
|
-
function setInternalHandlers(handlers) {
|
|
372
|
-
internalHandlers.set(handlers);
|
|
373
|
-
}
|
|
374
427
|
/**
|
|
375
428
|
* {@link updateInternalHandlers} function to update internal event handlers.
|
|
376
429
|
*
|
|
@@ -388,30 +441,41 @@ function updateInternalHandlers(handlers) {
|
|
|
388
441
|
* Store to handle custom event handlers
|
|
389
442
|
*
|
|
390
443
|
* This is used internally.
|
|
444
|
+
*
|
|
445
|
+
* @internal
|
|
391
446
|
*/
|
|
392
447
|
const customHandlers = writable({});
|
|
393
448
|
/**
|
|
394
|
-
*
|
|
449
|
+
* カスタムイベントハンドラーの一覧を取得する
|
|
395
450
|
*
|
|
396
|
-
* @returns
|
|
451
|
+
* @returns 現在のカスタムイベントハンドラー
|
|
452
|
+
*
|
|
453
|
+
* @public
|
|
397
454
|
*/
|
|
398
455
|
function getCustomHandlers() {
|
|
399
456
|
return get(customHandlers);
|
|
400
457
|
}
|
|
401
458
|
/**
|
|
402
|
-
*
|
|
459
|
+
* カスタムイベントハンドラーを登録する
|
|
460
|
+
*
|
|
461
|
+
* @remarks
|
|
462
|
+
* 登録したカスタムイベントハンドラーは、ビジュアルエディタでアクション本体とのテキストボタンのクリック時の動作で利用できます。
|
|
403
463
|
*
|
|
404
|
-
* @param handlers -
|
|
464
|
+
* @param handlers - 登録するカスタムイベントハンドラー
|
|
465
|
+
*
|
|
466
|
+
* @public
|
|
405
467
|
*/
|
|
406
468
|
function setCustomHandlers(handlers) {
|
|
407
469
|
customHandlers.set(handlers);
|
|
408
470
|
}
|
|
409
471
|
/**
|
|
410
|
-
*
|
|
472
|
+
* カスタムイベントハンドラーを更新する
|
|
411
473
|
*
|
|
412
|
-
* @param handlers -
|
|
474
|
+
* @param handlers - 対象となるカスタムイベントハンドラー
|
|
413
475
|
*
|
|
414
|
-
* @returns
|
|
476
|
+
* @returns 新しいカスタムイベントハンドラーを返します。
|
|
477
|
+
*
|
|
478
|
+
* @public
|
|
415
479
|
*/
|
|
416
480
|
function updateCustomHandlers(handlers) {
|
|
417
481
|
customHandlers.update(current => {
|
|
@@ -421,23 +485,32 @@ function updateCustomHandlers(handlers) {
|
|
|
421
485
|
}
|
|
422
486
|
/**
|
|
423
487
|
* Store to handle destruction of action
|
|
488
|
+
*
|
|
489
|
+
* @internal
|
|
424
490
|
*/
|
|
425
491
|
const destroyed = writable(false);
|
|
426
492
|
/**
|
|
427
493
|
* {@link isDestroyed} function to check if action is destroyed.
|
|
428
494
|
*
|
|
429
495
|
* @returns Flag if action is destoryed / true: Destroyed, false: Not Destroyed
|
|
496
|
+
*
|
|
497
|
+
* @internal
|
|
430
498
|
*/
|
|
431
499
|
function isDestroyed() {
|
|
432
500
|
return get(destroyed);
|
|
433
501
|
}
|
|
434
502
|
/**
|
|
435
|
-
* {@link setDestroyed} function to set if action is destroyed.
|
|
503
|
+
* {@link setDestroyed} function to set if action is destroyed.
|
|
504
|
+
*
|
|
505
|
+
* @internal
|
|
506
|
+
*/
|
|
436
507
|
function setDestroyed(on) {
|
|
437
508
|
destroyed.set(on);
|
|
438
509
|
}
|
|
439
510
|
/**
|
|
440
511
|
* Store to handle stopping action
|
|
512
|
+
*
|
|
513
|
+
* @internal
|
|
441
514
|
*/
|
|
442
515
|
const stopped = writable(false);
|
|
443
516
|
/**
|
|
@@ -450,6 +523,8 @@ function isStopped() {
|
|
|
450
523
|
}
|
|
451
524
|
/**
|
|
452
525
|
* {@link setStopped} function to set if action is stopped.
|
|
526
|
+
*
|
|
527
|
+
* @internal
|
|
453
528
|
*/
|
|
454
529
|
function setStopped(on) {
|
|
455
530
|
{
|
|
@@ -458,30 +533,41 @@ function setStopped(on) {
|
|
|
458
533
|
}
|
|
459
534
|
/**
|
|
460
535
|
* Store to handle custom variables
|
|
536
|
+
*
|
|
537
|
+
* @internal
|
|
461
538
|
*/
|
|
462
539
|
const customVariables = writable({});
|
|
463
540
|
/**
|
|
464
|
-
*
|
|
541
|
+
* カスタム変数の一覧を取得する
|
|
542
|
+
*
|
|
543
|
+
* @returns 現在のカスタム変数の一覧
|
|
465
544
|
*
|
|
466
|
-
* @
|
|
545
|
+
* @public
|
|
467
546
|
*/
|
|
468
547
|
function getCustomVariables() {
|
|
469
548
|
return get(customVariables);
|
|
470
549
|
}
|
|
471
550
|
/**
|
|
472
|
-
*
|
|
551
|
+
* カスタム変数を設定する
|
|
552
|
+
*
|
|
553
|
+
* @remarks
|
|
554
|
+
* 設定した変数は、ビジュアルエディタのテキストフォームなどで利用できます。
|
|
555
|
+
*
|
|
556
|
+
* @param variables - カスタム変数
|
|
473
557
|
*
|
|
474
|
-
* @
|
|
558
|
+
* @public
|
|
475
559
|
*/
|
|
476
560
|
function setCustomVariables(variables) {
|
|
477
561
|
customVariables.set(variables);
|
|
478
562
|
}
|
|
479
563
|
/**
|
|
480
|
-
*
|
|
564
|
+
* カスタム変数を更新する
|
|
565
|
+
*
|
|
566
|
+
* @param variables - 更新するカスタム変数
|
|
481
567
|
*
|
|
482
|
-
* @
|
|
568
|
+
* @returns 新しいカスタム変数を返します。
|
|
483
569
|
*
|
|
484
|
-
* @
|
|
570
|
+
* @public
|
|
485
571
|
*/
|
|
486
572
|
function updateCustomVariables(variables) {
|
|
487
573
|
customVariables.update(current => {
|
|
@@ -491,21 +577,32 @@ function updateCustomVariables(variables) {
|
|
|
491
577
|
}
|
|
492
578
|
/**
|
|
493
579
|
* Store for form data
|
|
580
|
+
*
|
|
581
|
+
* @internal
|
|
494
582
|
*/
|
|
495
583
|
const formData = writable({});
|
|
496
584
|
|
|
585
|
+
/** @internal */
|
|
497
586
|
const ALL_ACTION_ID = 'KARTE_ALL_ACTION_ID';
|
|
587
|
+
/** @internal */
|
|
498
588
|
const ALL_ACTION_SHORTEN_ID = 'KARTE_ALL_ACTION_SHORTEN_ID';
|
|
589
|
+
/** @internal */
|
|
499
590
|
const actionId = ALL_ACTION_ID ;
|
|
591
|
+
/** @internal */
|
|
500
592
|
const ACTION_SHOW_EVENT = `KARTE-ACTION-SHOW-${actionId}`;
|
|
593
|
+
/** @internal */
|
|
501
594
|
const ACTION_CLOSE_EVENT = `KARTE-ACTION-CLOSE-${actionId}`;
|
|
595
|
+
/** @internal */
|
|
502
596
|
const ACTION_DESTROY_EVENT = `KARTE-ACTION-DESTROY-${actionId}`;
|
|
597
|
+
/** @internal */
|
|
503
598
|
const ACTION_CHANGE_STATE_EVENT = `KARTE-ACTION-CHANGE-STATE-${actionId}`;
|
|
599
|
+
/** @internal */
|
|
504
600
|
const handleState = (event) => {
|
|
505
601
|
if (event.detail.actionId === actionId || event.detail.actionId === ALL_ACTION_ID) {
|
|
506
602
|
setState$1(event.detail.to, event.detail.force);
|
|
507
603
|
}
|
|
508
604
|
};
|
|
605
|
+
/** @internal */
|
|
509
606
|
const initialize = (setting) => {
|
|
510
607
|
const newSetting = setActionSetting(setting);
|
|
511
608
|
if (newSetting.initialState) {
|
|
@@ -519,19 +616,21 @@ const initialize = (setting) => {
|
|
|
519
616
|
setClosed(false); // deprecated
|
|
520
617
|
return () => finalize();
|
|
521
618
|
};
|
|
619
|
+
/** @internal */
|
|
522
620
|
const finalize = () => {
|
|
523
621
|
resetActionSetting();
|
|
524
622
|
};
|
|
623
|
+
/** @internal */
|
|
525
624
|
const send_event = (event_name, values) => {
|
|
526
625
|
const setting = getActionSetting();
|
|
527
626
|
setting?.send?.(event_name, values);
|
|
528
627
|
};
|
|
529
|
-
|
|
530
|
-
const none = () => () => { };
|
|
628
|
+
/** @internal */
|
|
531
629
|
const moveTo = (to) => () => {
|
|
532
630
|
send_event('_message_state_changed', { state: to });
|
|
533
631
|
window.dispatchEvent(new CustomEvent(ACTION_CHANGE_STATE_EVENT, { detail: { to, actionId } }));
|
|
534
632
|
};
|
|
633
|
+
/** @internal */
|
|
535
634
|
const linkTo = (to, targetBlank = true) => () => {
|
|
536
635
|
send_event('message_click', { url: to, state: getState$1() });
|
|
537
636
|
if (targetBlank) {
|
|
@@ -541,9 +640,11 @@ const linkTo = (to, targetBlank = true) => () => {
|
|
|
541
640
|
location.href = to;
|
|
542
641
|
}
|
|
543
642
|
};
|
|
643
|
+
/** @internal */
|
|
544
644
|
const closeApp = (trigger) => () => {
|
|
545
645
|
window.dispatchEvent(new CustomEvent(ACTION_CLOSE_EVENT, { detail: { trigger } }));
|
|
546
646
|
};
|
|
647
|
+
/** @internal */
|
|
547
648
|
const runScript = (handlerName) => () => {
|
|
548
649
|
const handlers = get(customHandlers);
|
|
549
650
|
const handler = handlers[handlerName];
|
|
@@ -556,6 +657,7 @@ const runScript = (handlerName) => () => {
|
|
|
556
657
|
console.warn('Failed to run custom handler', handlerName, e);
|
|
557
658
|
}
|
|
558
659
|
};
|
|
660
|
+
/** @internal */
|
|
559
661
|
const execOnClickOperation = (onClickOperation) => {
|
|
560
662
|
if (onClickOperation.operation === 'linkTo') {
|
|
561
663
|
linkTo(...onClickOperation.args)();
|
|
@@ -570,6 +672,7 @@ const execOnClickOperation = (onClickOperation) => {
|
|
|
570
672
|
runScript(onClickOperation.args[0])();
|
|
571
673
|
}
|
|
572
674
|
};
|
|
675
|
+
/** @internal */
|
|
573
676
|
const haveFunction = (onClickOperation) => {
|
|
574
677
|
return onClickOperation.operation !== 'none';
|
|
575
678
|
};
|
|
@@ -580,6 +683,8 @@ const haveFunction = (onClickOperation) => {
|
|
|
580
683
|
* @param customAnimationOptions - A custom animation option object
|
|
581
684
|
*
|
|
582
685
|
* @see {@link https://svelte.dev/docs#template-syntax-element-directives-transition-fn-custom-transition-functions| Custom transition functions} for detail documentation
|
|
686
|
+
*
|
|
687
|
+
* @internal
|
|
583
688
|
*/
|
|
584
689
|
function customAnimation(node, { transform, animationStyle, delay = 0, duration = 1000 }) {
|
|
585
690
|
{
|
|
@@ -587,9 +692,11 @@ function customAnimation(node, { transform, animationStyle, delay = 0, duration
|
|
|
587
692
|
}
|
|
588
693
|
}
|
|
589
694
|
/**
|
|
590
|
-
*
|
|
695
|
+
* ES Modules に対応していない JavaScript をページに読み込む
|
|
696
|
+
*
|
|
697
|
+
* @param src - JavaScript ファイルのリンク URL
|
|
591
698
|
*
|
|
592
|
-
* @
|
|
699
|
+
* @public
|
|
593
700
|
*/
|
|
594
701
|
async function loadGlobalScript(src) {
|
|
595
702
|
return new Promise((resolve, reject) => {
|
|
@@ -601,9 +708,11 @@ async function loadGlobalScript(src) {
|
|
|
601
708
|
});
|
|
602
709
|
}
|
|
603
710
|
/**
|
|
604
|
-
*
|
|
711
|
+
* グローバル CSS をページに適用する
|
|
605
712
|
*
|
|
606
713
|
* @param css - CSS
|
|
714
|
+
*
|
|
715
|
+
* @public
|
|
607
716
|
*/
|
|
608
717
|
async function applyGlobalCss(css) {
|
|
609
718
|
return new Promise((resolve, reject) => {
|
|
@@ -615,9 +724,11 @@ async function applyGlobalCss(css) {
|
|
|
615
724
|
});
|
|
616
725
|
}
|
|
617
726
|
/**
|
|
618
|
-
*
|
|
727
|
+
* style ファイルをページに読み込む
|
|
728
|
+
*
|
|
729
|
+
* @param href - style ファイルのリンク URL
|
|
619
730
|
*
|
|
620
|
-
* @
|
|
731
|
+
* @public
|
|
621
732
|
*/
|
|
622
733
|
async function loadGlobalStyle(href) {
|
|
623
734
|
return new Promise((resolve, reject) => {
|
|
@@ -637,6 +748,8 @@ async function loadGlobalStyle(href) {
|
|
|
637
748
|
* @returns Hashed string
|
|
638
749
|
*
|
|
639
750
|
* @see https://stackoverflow.com/a/22429679
|
|
751
|
+
*
|
|
752
|
+
* @internal
|
|
640
753
|
*/
|
|
641
754
|
function hashCode(s) {
|
|
642
755
|
const SEED = 0x41653150;
|
|
@@ -653,14 +766,106 @@ function hashCode(s) {
|
|
|
653
766
|
* @param on - true: auto start, false: not auto start
|
|
654
767
|
*
|
|
655
768
|
* @deprecated 非推奨。`setActionConfig({ autoStart: false })` を使ってください。
|
|
769
|
+
*
|
|
770
|
+
* @internal
|
|
656
771
|
*/
|
|
657
772
|
const setAutoStart = (on = true) => {
|
|
658
773
|
setStopped();
|
|
659
774
|
};
|
|
660
775
|
|
|
776
|
+
function doPresent({ direction, deltaRate }, downFn, upFn, condition = false) {
|
|
777
|
+
if (direction === 'down' && deltaRate > 0) {
|
|
778
|
+
downFn();
|
|
779
|
+
}
|
|
780
|
+
else if (condition && direction === 'up' && deltaRate < 0) {
|
|
781
|
+
upFn();
|
|
782
|
+
}
|
|
783
|
+
return true;
|
|
784
|
+
}
|
|
785
|
+
/**
|
|
786
|
+
* スクロールに応じてアクションを非表示にするトリガー関数
|
|
787
|
+
*
|
|
788
|
+
* @remarks
|
|
789
|
+
* スクロール率が `hide_on_scroll_rate` に達したときに `hide` 関数を呼び出します。
|
|
790
|
+
* `show_on_scroll_reenter` が `true` で、かつ `hide_on_scroll_rate` またはその値以下の場合、アクションに対して `show` 関数が呼び出されます。
|
|
791
|
+
*
|
|
792
|
+
* @param props - アクションのプロパティ。プロパティには `hide_on_scroll`、`hide_on_scroll_rate` そして `show_on_scroll_reenter` が必要です。
|
|
793
|
+
* @param hide - アクションを非表示にするロジックが実装された関数。指定ない場合は noop 関数が使用されます。
|
|
794
|
+
* @param show - アクションを再び表示するロジックが実装された関数。指定ない場合は noop 関数が使用されます。
|
|
795
|
+
*
|
|
796
|
+
* @returns
|
|
797
|
+
* スクロールが開始された場合は、クリーンアップする関数を返します。そうでない場合は `null` を返します。
|
|
798
|
+
*
|
|
799
|
+
* @internal
|
|
800
|
+
*/
|
|
801
|
+
function hideOnScroll(props, hide = NOOP, show = NOOP) {
|
|
802
|
+
const { hide_on_scroll, hide_on_scroll_rate, show_on_scroll_reenter } = props;
|
|
803
|
+
return hide_on_scroll && hide_on_scroll_rate
|
|
804
|
+
? onScroll(hide_on_scroll_rate / 100, ctx => doPresent(ctx, hide, show, show_on_scroll_reenter))
|
|
805
|
+
: null;
|
|
806
|
+
}
|
|
807
|
+
/**
|
|
808
|
+
* 時間に応じてアクションを非表示にするトリガー関数
|
|
809
|
+
*
|
|
810
|
+
* @remarks
|
|
811
|
+
* 時間のカウントが `hide_on_time_count` に達したときに `hide` 関数を呼び出します。
|
|
812
|
+
*
|
|
813
|
+
* @param props - アクションのプロパティ。プロパティには `hide_on_time` そして `hide_on_time_count` が必要です。
|
|
814
|
+
* @param hide - アクションを非表示にするロジックが実装された関数。指定ない場合は noop 関数が使用されます。
|
|
815
|
+
*
|
|
816
|
+
* @returns
|
|
817
|
+
* タイマーが開始された場合、タイマーをクリーンアップする関数を返します。それ以外は `null` を返します。
|
|
818
|
+
*
|
|
819
|
+
* @internal
|
|
820
|
+
*/
|
|
821
|
+
function hideOnTime(props, hide = NOOP) {
|
|
822
|
+
return props.hide_on_time && props.hide_on_time_count
|
|
823
|
+
? onTime(props.hide_on_time_count * 1000, () => hide())
|
|
824
|
+
: null;
|
|
825
|
+
}
|
|
826
|
+
/**
|
|
827
|
+
* スクロールに応じてアクションを表示するトリガー関数
|
|
828
|
+
*
|
|
829
|
+
* @remarks
|
|
830
|
+
* スクロール率が `show_on_scroll_rate` に達したときに `show` 関数を呼び出します。
|
|
831
|
+
* `hide_on_scroll_releave` が `true` で、かつ `show_on_scroll_rate` 以下の場合は、アクションに対して `hide` 関数が呼び出されます。
|
|
832
|
+
*
|
|
833
|
+
* @param props - アクションのプロパティ。プロパティには `show_on_scroll`、`show_on_scroll_rate` そして `hide_on_scroll_releave` が必要です。
|
|
834
|
+
* @param show - アクションを表示するロジックが実装された関数。指定ない場合は noop 関数が使用されます。
|
|
835
|
+
* @param hide - アクションを非表示にするロジックが実装された関数。指定ない場合は noop 関数が使用されます。
|
|
836
|
+
*
|
|
837
|
+
* @returns
|
|
838
|
+
* スクロールが開始されている場合は、クリーンアップ関数を返します。そうでない場合は `null` を返します
|
|
839
|
+
*
|
|
840
|
+
* @internal
|
|
841
|
+
*/
|
|
842
|
+
function showOnScroll(props, show = NOOP, hide = NOOP) {
|
|
843
|
+
const { show_on_scroll, show_on_scroll_rate, hide_on_scroll_releave } = props;
|
|
844
|
+
return show_on_scroll && show_on_scroll_rate
|
|
845
|
+
? onScroll(show_on_scroll_rate / 100, ctx => doPresent(ctx, show, hide, hide_on_scroll_releave))
|
|
846
|
+
: null;
|
|
847
|
+
}
|
|
661
848
|
/**
|
|
849
|
+
* 時間に応じてアクションを表示するトリガー関数
|
|
850
|
+
*
|
|
851
|
+
* @param props - アクションのプロパティ。プロパティには `show_on_time` そして `show_on_time_count` が必要です。
|
|
852
|
+
* @param show - アクションを表示するロジックが実装された関数。指定ない場合は noop 関数が使用されます。
|
|
853
|
+
*
|
|
854
|
+
* @remarks
|
|
855
|
+
* 時間のカウントが `show_on_time_count` に達したときに `show` 関数を呼び出します。
|
|
856
|
+
*
|
|
857
|
+
* @returns
|
|
858
|
+
* タイマーが開始された場合、タイマーをクリーンアップする関数を返します。それ以外は `null` を返します。
|
|
859
|
+
*
|
|
662
860
|
* @internal
|
|
663
861
|
*/
|
|
862
|
+
function showOnTime(props, show = NOOP) {
|
|
863
|
+
return props.show_on_time && props.show_on_time_count
|
|
864
|
+
? onTime(props.show_on_time_count * 1000, () => show())
|
|
865
|
+
: null;
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
/** @internal */
|
|
664
869
|
const PropTypes = [
|
|
665
870
|
'BooleanKeyword',
|
|
666
871
|
'NumberKeyword',
|
|
@@ -682,21 +887,15 @@ const PropTypes = [
|
|
|
682
887
|
'ModalPlacement',
|
|
683
888
|
'OnClick',
|
|
684
889
|
];
|
|
685
|
-
/**
|
|
686
|
-
* @internal
|
|
687
|
-
*/
|
|
890
|
+
/** @internal */
|
|
688
891
|
const MediaQueries = {
|
|
689
892
|
PC: '(\\s*min-width\\s*:\\s*1025px\\s*)',
|
|
690
893
|
Tablet: '(\\s*min-width\\s*:\\s*897px)\\s+and\\s+(\\s*max-width\\s*:\\s*1024px\\s*)',
|
|
691
894
|
Mobile: '(\\s*max-width\\s*:\\s*896px\\s*)',
|
|
692
895
|
};
|
|
693
|
-
/**
|
|
694
|
-
* @internal
|
|
695
|
-
*/
|
|
896
|
+
/** @internal */
|
|
696
897
|
const Directions = ['row', 'column'];
|
|
697
|
-
/**
|
|
698
|
-
* @internal
|
|
699
|
-
*/
|
|
898
|
+
/** @internal */
|
|
700
899
|
const AnimationStyles = [
|
|
701
900
|
'none',
|
|
702
901
|
'fade',
|
|
@@ -706,9 +905,7 @@ const AnimationStyles = [
|
|
|
706
905
|
'slide-left',
|
|
707
906
|
'slide-right',
|
|
708
907
|
];
|
|
709
|
-
/**
|
|
710
|
-
* @internal
|
|
711
|
-
*/
|
|
908
|
+
/** @internal */
|
|
712
909
|
const ModalPositions = [
|
|
713
910
|
'top-left',
|
|
714
911
|
'top-center',
|
|
@@ -721,9 +918,7 @@ const ModalPositions = [
|
|
|
721
918
|
'bottom-right',
|
|
722
919
|
'none',
|
|
723
920
|
];
|
|
724
|
-
/**
|
|
725
|
-
* @internal
|
|
726
|
-
*/
|
|
921
|
+
/** @internal */
|
|
727
922
|
const DefaultModalPlacement = {
|
|
728
923
|
position: 'center',
|
|
729
924
|
margin: {
|
|
@@ -735,25 +930,17 @@ const DefaultModalPlacement = {
|
|
|
735
930
|
backgroundOverlay: false,
|
|
736
931
|
backgroundClick: { operation: 'closeApp', args: ['overlay'] },
|
|
737
932
|
};
|
|
738
|
-
/**
|
|
739
|
-
* @internal
|
|
740
|
-
*/
|
|
933
|
+
/** @internal */
|
|
741
934
|
const Elasticities = ['none', 'vertical', 'horizontal'];
|
|
742
|
-
/**
|
|
743
|
-
* @internal
|
|
744
|
-
*/
|
|
935
|
+
/** @internal */
|
|
745
936
|
const ElasticityStyle = {
|
|
746
937
|
none: '',
|
|
747
938
|
vertical: 'height: 100%',
|
|
748
939
|
horizontal: 'width: 100%',
|
|
749
940
|
};
|
|
750
|
-
/**
|
|
751
|
-
* @internal
|
|
752
|
-
*/
|
|
941
|
+
/** @internal */
|
|
753
942
|
const TextDirections = ['horizontal', 'vertical'];
|
|
754
|
-
/**
|
|
755
|
-
* @internal
|
|
756
|
-
*/
|
|
943
|
+
/** @internal */
|
|
757
944
|
const OnClickOperationOptions = [
|
|
758
945
|
{
|
|
759
946
|
operation: 'none',
|
|
@@ -800,9 +987,7 @@ const OnClickOperationOptions = [
|
|
|
800
987
|
],
|
|
801
988
|
},
|
|
802
989
|
];
|
|
803
|
-
/**
|
|
804
|
-
* @internal
|
|
805
|
-
*/
|
|
990
|
+
/** @internal */
|
|
806
991
|
const FormOperationOptions = [
|
|
807
992
|
{
|
|
808
993
|
operation: 'submit',
|
|
@@ -832,101 +1017,61 @@ const FormOperationOptions = [
|
|
|
832
1017
|
],
|
|
833
1018
|
},
|
|
834
1019
|
];
|
|
835
|
-
/**
|
|
836
|
-
* @internal
|
|
837
|
-
*/
|
|
1020
|
+
/** @internal */
|
|
838
1021
|
const LengthUnits = ['px', 'em', 'rem', 'vw', 'fr', '%'];
|
|
839
|
-
/**
|
|
840
|
-
* @internal
|
|
841
|
-
*/
|
|
1022
|
+
/** @internal */
|
|
842
1023
|
const Justifies = ['flex-start', 'center', 'flex-end'];
|
|
843
|
-
/**
|
|
844
|
-
* @internal
|
|
845
|
-
*/
|
|
1024
|
+
/** @internal */
|
|
846
1025
|
const Alignments = ['flex-start', 'center', 'flex-end'];
|
|
847
|
-
/**
|
|
848
|
-
* @internal
|
|
849
|
-
*/
|
|
1026
|
+
/** @internal */
|
|
850
1027
|
const ObjectFits = ['fill', 'contain', 'cover'];
|
|
851
|
-
/**
|
|
852
|
-
* @internal
|
|
853
|
-
*/
|
|
1028
|
+
/** @internal */
|
|
854
1029
|
const ClipPaths = ['none', 'circle(closest-side)'];
|
|
855
|
-
/**
|
|
856
|
-
* @internal
|
|
857
|
-
*/
|
|
1030
|
+
/** @internal */
|
|
858
1031
|
const Repeats = ['repeat', 'space', 'round', 'no-repeat'];
|
|
859
|
-
/**
|
|
860
|
-
* @internal
|
|
861
|
-
*/
|
|
1032
|
+
/** @internal */
|
|
862
1033
|
const BackgroundSizes = ['cover', 'contain', 'auto'];
|
|
863
|
-
/**
|
|
864
|
-
* @internal
|
|
865
|
-
*/
|
|
1034
|
+
/** @internal */
|
|
866
1035
|
const Cursors = ['default', 'pointer'];
|
|
867
|
-
/**
|
|
868
|
-
* @internal
|
|
869
|
-
*/
|
|
1036
|
+
/** @internal */
|
|
870
1037
|
const Overflows = ['visible', 'auto', 'hidden'];
|
|
871
|
-
/**
|
|
872
|
-
* @internal
|
|
873
|
-
*/
|
|
1038
|
+
/** @internal */
|
|
874
1039
|
const WritingModes = ['horizontal-tb', 'vertical-lr'];
|
|
875
|
-
/**
|
|
876
|
-
* @internal
|
|
877
|
-
*/
|
|
1040
|
+
/** @internal */
|
|
878
1041
|
const ListSeparatorTypes = ['none', 'border', 'gap'];
|
|
879
|
-
/**
|
|
880
|
-
* @internal
|
|
881
|
-
*/
|
|
1042
|
+
/** @internal */
|
|
882
1043
|
const DefaultListSeparatorNone = {
|
|
883
1044
|
type: 'none',
|
|
884
1045
|
};
|
|
885
|
-
/**
|
|
886
|
-
* @internal
|
|
887
|
-
*/
|
|
1046
|
+
/** @internal */
|
|
888
1047
|
const DefaultListSeparatorBorder = {
|
|
889
1048
|
type: 'border',
|
|
890
1049
|
borderStyle: 'solid',
|
|
891
1050
|
borderWidth: '1px',
|
|
892
1051
|
borderColor: 'rgba(0, 0, 0, 0.06)',
|
|
893
1052
|
};
|
|
894
|
-
/**
|
|
895
|
-
* @internal
|
|
896
|
-
*/
|
|
1053
|
+
/** @internal */
|
|
897
1054
|
const DefaultListSeparatorGap = {
|
|
898
1055
|
type: 'gap',
|
|
899
1056
|
gap: '8px',
|
|
900
1057
|
};
|
|
901
|
-
/**
|
|
902
|
-
* @internal
|
|
903
|
-
*/
|
|
1058
|
+
/** @internal */
|
|
904
1059
|
const DefaultListSeparator = DefaultListSeparatorBorder;
|
|
905
|
-
/**
|
|
906
|
-
* @internal
|
|
907
|
-
*/
|
|
1060
|
+
/** @internal */
|
|
908
1061
|
const ListBackgroundTypes = ['none', 'stripe'];
|
|
909
|
-
/**
|
|
910
|
-
* @internal
|
|
911
|
-
*/
|
|
1062
|
+
/** @internal */
|
|
912
1063
|
const DefaultListBackgroundNone = {
|
|
913
1064
|
type: 'none',
|
|
914
1065
|
};
|
|
915
|
-
/**
|
|
916
|
-
* @internal
|
|
917
|
-
*/
|
|
1066
|
+
/** @internal */
|
|
918
1067
|
const DefaultListBackgroundStripe = {
|
|
919
1068
|
type: 'stripe',
|
|
920
1069
|
background1: 'rgba(0, 0, 0, 0.06)',
|
|
921
1070
|
background2: '#fff',
|
|
922
1071
|
};
|
|
923
|
-
/**
|
|
924
|
-
* @internal
|
|
925
|
-
*/
|
|
1072
|
+
/** @internal */
|
|
926
1073
|
const DefaultListBackground = DefaultListBackgroundNone;
|
|
927
|
-
/**
|
|
928
|
-
* @internal
|
|
929
|
-
*/
|
|
1074
|
+
/** @internal */
|
|
930
1075
|
const ListDirections = ['vertical', 'horizontal'];
|
|
931
1076
|
const DefaultSliderButton = {
|
|
932
1077
|
type: 'icon',
|
|
@@ -942,97 +1087,88 @@ const DefaultSliderNavigationButton = {
|
|
|
942
1087
|
colorActive: '#666',
|
|
943
1088
|
};
|
|
944
1089
|
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
1090
|
+
/**
|
|
1091
|
+
* アクションが作成 (create) される前にフックする関数
|
|
1092
|
+
*
|
|
1093
|
+
* @param fn - 呼び出されるフック関数
|
|
1094
|
+
*
|
|
1095
|
+
* @public
|
|
1096
|
+
*/
|
|
1097
|
+
function onCreate(fn) {
|
|
1098
|
+
let { onCreateHandlers } = getInternalHandlers();
|
|
1099
|
+
if (!onCreateHandlers) {
|
|
1100
|
+
onCreateHandlers = [];
|
|
951
1101
|
}
|
|
952
|
-
|
|
1102
|
+
onCreateHandlers.push(fn);
|
|
1103
|
+
updateInternalHandlers({ onCreateHandlers });
|
|
953
1104
|
}
|
|
954
1105
|
/**
|
|
955
|
-
*
|
|
1106
|
+
* アクションが表示 (show) された後にフックする関数
|
|
956
1107
|
*
|
|
957
|
-
* @
|
|
958
|
-
* スクロール率が `hide_on_scroll_rate` に達したときに `hide` 関数を呼び出します。
|
|
959
|
-
* `show_on_scroll_reenter` が `true` で、かつ `hide_on_scroll_rate` またはその値以下の場合、アクションに対して `show` 関数が呼び出されます。
|
|
960
|
-
*
|
|
961
|
-
* @param props - アクションのプロパティ。プロパティには `hide_on_scroll`、`hide_on_scroll_rate` そして `show_on_scroll_reenter` が必要です。
|
|
962
|
-
* @param hide - アクションを非表示にするロジックが実装された関数。指定ない場合は noop 関数が使用されます。
|
|
963
|
-
* @param show - アクションを再び表示するロジックが実装された関数。指定ない場合は noop 関数が使用されます。
|
|
1108
|
+
* @param fn - 呼び出されるフック関数
|
|
964
1109
|
*
|
|
965
|
-
* @
|
|
966
|
-
* スクロールが開始された場合は、クリーンアップする関数を返します。そうでない場合は `null` を返します。
|
|
1110
|
+
* @public
|
|
967
1111
|
*/
|
|
968
|
-
function
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
1112
|
+
function onShow(fn) {
|
|
1113
|
+
let { onShowHandlers } = getInternalHandlers();
|
|
1114
|
+
if (!onShowHandlers) {
|
|
1115
|
+
onShowHandlers = [];
|
|
1116
|
+
}
|
|
1117
|
+
onShowHandlers.push(fn);
|
|
1118
|
+
updateInternalHandlers({ onShowHandlers });
|
|
973
1119
|
}
|
|
974
1120
|
/**
|
|
975
|
-
*
|
|
976
|
-
*
|
|
977
|
-
* @remarks
|
|
978
|
-
* 時間のカウントが `hide_on_time_count` に達したときに `hide` 関数を呼び出します。
|
|
1121
|
+
* アクションがクローズ (close) される前にフックする関数
|
|
979
1122
|
*
|
|
980
|
-
* @param
|
|
981
|
-
* @param hide - アクションを非表示にするロジックが実装された関数。指定ない場合は noop 関数が使用されます。
|
|
1123
|
+
* @param fn - 呼び出されるフック関数
|
|
982
1124
|
*
|
|
983
|
-
* @
|
|
984
|
-
* タイマーが開始された場合、タイマーをクリーンアップする関数を返します。それ以外は `null` を返します。
|
|
1125
|
+
* @public
|
|
985
1126
|
*/
|
|
986
|
-
function
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
1127
|
+
function onClose(fn) {
|
|
1128
|
+
let { onCloseHandlers } = getInternalHandlers();
|
|
1129
|
+
if (!onCloseHandlers) {
|
|
1130
|
+
onCloseHandlers = [];
|
|
1131
|
+
}
|
|
1132
|
+
onCloseHandlers.push(fn);
|
|
1133
|
+
updateInternalHandlers({ onCloseHandlers });
|
|
990
1134
|
}
|
|
991
1135
|
/**
|
|
992
|
-
*
|
|
993
|
-
*
|
|
994
|
-
* @remarks
|
|
995
|
-
* スクロール率が `show_on_scroll_rate` に達したときに `show` 関数を呼び出します。
|
|
996
|
-
* `hide_on_scroll_releave` が `true` で、かつ `show_on_scroll_rate` 以下の場合は、アクションに対して `hide` 関数が呼び出されます。
|
|
1136
|
+
* アクションが破棄 (destroy) される前にフックする関数
|
|
997
1137
|
*
|
|
998
|
-
* @param
|
|
999
|
-
* @param show - アクションを表示するロジックが実装された関数。指定ない場合は noop 関数が使用されます。
|
|
1000
|
-
* @param hide - アクションを非表示にするロジックが実装された関数。指定ない場合は noop 関数が使用されます。
|
|
1138
|
+
* @param fn - 呼び出されるフック関数
|
|
1001
1139
|
*
|
|
1002
|
-
* @
|
|
1003
|
-
* スクロールが開始されている場合は、クリーンアップ関数を返します。そうでない場合は `null` を返します
|
|
1140
|
+
* @public
|
|
1004
1141
|
*/
|
|
1005
|
-
function
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1142
|
+
function onDestroy(fn) {
|
|
1143
|
+
let { onDestoryHandlers } = getInternalHandlers();
|
|
1144
|
+
if (!onDestoryHandlers) {
|
|
1145
|
+
onDestoryHandlers = [];
|
|
1146
|
+
}
|
|
1147
|
+
onDestoryHandlers.push(fn);
|
|
1148
|
+
updateInternalHandlers({ onDestoryHandlers });
|
|
1010
1149
|
}
|
|
1011
1150
|
/**
|
|
1012
|
-
*
|
|
1013
|
-
*
|
|
1014
|
-
* @param props - アクションのプロパティ。プロパティには `show_on_time` そして `show_on_time_count` が必要です。
|
|
1015
|
-
* @param show - アクションを表示するロジックが実装された関数。指定ない場合は noop 関数が使用されます。
|
|
1151
|
+
* アクションのステートが変更された (changeState) 後にフックする関数
|
|
1016
1152
|
*
|
|
1017
|
-
* @
|
|
1018
|
-
* 時間のカウントが `show_on_time_count` に達したときに `show` 関数を呼び出します。
|
|
1153
|
+
* @param fn - 呼び出されるフック関数
|
|
1019
1154
|
*
|
|
1020
|
-
* @
|
|
1021
|
-
* タイマーが開始された場合、タイマーをクリーンアップする関数を返します。それ以外は `null` を返します。
|
|
1155
|
+
* @public
|
|
1022
1156
|
*/
|
|
1023
|
-
function
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1157
|
+
function onChangeState(fn) {
|
|
1158
|
+
let { onChangeStateHandlers } = getInternalHandlers();
|
|
1159
|
+
if (!onChangeStateHandlers) {
|
|
1160
|
+
onChangeStateHandlers = [];
|
|
1161
|
+
}
|
|
1162
|
+
onChangeStateHandlers.push(fn);
|
|
1163
|
+
updateInternalHandlers({ onChangeStateHandlers });
|
|
1027
1164
|
}
|
|
1028
|
-
|
|
1029
1165
|
/**
|
|
1030
|
-
*
|
|
1166
|
+
* アクションを作成する
|
|
1031
1167
|
*
|
|
1032
1168
|
* @param App - Svelte コンポーネントのエントリポイント
|
|
1033
1169
|
* @param options - {@link ActionOptions | オプション}
|
|
1034
1170
|
*
|
|
1035
|
-
* @returns
|
|
1171
|
+
* @returns アクションを破棄する関数
|
|
1036
1172
|
*
|
|
1037
1173
|
* @public
|
|
1038
1174
|
*/
|
|
@@ -1173,29 +1309,41 @@ function dispatchDestroyEvent() {
|
|
|
1173
1309
|
window.dispatchEvent(event);
|
|
1174
1310
|
}
|
|
1175
1311
|
/**
|
|
1176
|
-
*
|
|
1312
|
+
* アクションの破棄する
|
|
1313
|
+
*
|
|
1314
|
+
* @public
|
|
1177
1315
|
*/
|
|
1178
1316
|
function destroy() {
|
|
1179
1317
|
setDestroyed(true);
|
|
1180
1318
|
dispatchDestroyEvent();
|
|
1181
1319
|
}
|
|
1182
1320
|
/**
|
|
1183
|
-
*
|
|
1321
|
+
* アクションを表示する
|
|
1322
|
+
*
|
|
1323
|
+
* @public
|
|
1184
1324
|
*/
|
|
1185
1325
|
function showAction() {
|
|
1186
1326
|
const event = new CustomEvent(ACTION_SHOW_EVENT);
|
|
1187
1327
|
window.dispatchEvent(event);
|
|
1188
1328
|
}
|
|
1189
1329
|
/**
|
|
1190
|
-
*
|
|
1330
|
+
* アクションを閉じる
|
|
1331
|
+
*
|
|
1332
|
+
* @param trigger - 閉じた時のトリガー。デフォルト `'none'`
|
|
1333
|
+
*
|
|
1334
|
+
* @public
|
|
1191
1335
|
*/
|
|
1192
1336
|
function closeAction(trigger = 'none') {
|
|
1193
1337
|
const event = new CustomEvent(ACTION_CLOSE_EVENT, { detail: { trigger } });
|
|
1194
1338
|
window.dispatchEvent(event);
|
|
1195
1339
|
}
|
|
1340
|
+
/** @internal */
|
|
1196
1341
|
const KARTE_ACTION_ROOT = 'karte-action-root';
|
|
1342
|
+
/** @internal */
|
|
1197
1343
|
const KARTE_ACTION_RID = 'karte-action-rid';
|
|
1344
|
+
/** @internal */
|
|
1198
1345
|
const KARTE_ACTION_SHORTEN_ID = 'karte-action-id';
|
|
1346
|
+
/** @internal */
|
|
1199
1347
|
function ensureActionRoot(useShadow = true) {
|
|
1200
1348
|
const systemConfig = getSystem();
|
|
1201
1349
|
const rootAttrs = {
|
|
@@ -1218,81 +1366,7 @@ function ensureActionRoot(useShadow = true) {
|
|
|
1218
1366
|
return el;
|
|
1219
1367
|
}
|
|
1220
1368
|
}
|
|
1221
|
-
/**
|
|
1222
|
-
* アクションが作成 (create) される前にフックする
|
|
1223
|
-
*
|
|
1224
|
-
* @param fn - 呼び出されるフック関数
|
|
1225
|
-
*
|
|
1226
|
-
* @public
|
|
1227
|
-
*/
|
|
1228
|
-
function onCreate(fn) {
|
|
1229
|
-
let { onCreateHandlers } = getInternalHandlers();
|
|
1230
|
-
if (!onCreateHandlers) {
|
|
1231
|
-
onCreateHandlers = [];
|
|
1232
|
-
}
|
|
1233
|
-
onCreateHandlers.push(fn);
|
|
1234
|
-
updateInternalHandlers({ onCreateHandlers });
|
|
1235
|
-
}
|
|
1236
|
-
/**
|
|
1237
|
-
* アクションが表示 (show) された後にフックする
|
|
1238
|
-
*
|
|
1239
|
-
* @param fn - 呼び出されるフック関数
|
|
1240
|
-
*
|
|
1241
|
-
* @public
|
|
1242
|
-
*/
|
|
1243
|
-
function onShow(fn) {
|
|
1244
|
-
let { onShowHandlers } = getInternalHandlers();
|
|
1245
|
-
if (!onShowHandlers) {
|
|
1246
|
-
onShowHandlers = [];
|
|
1247
|
-
}
|
|
1248
|
-
onShowHandlers.push(fn);
|
|
1249
|
-
updateInternalHandlers({ onShowHandlers });
|
|
1250
|
-
}
|
|
1251
|
-
/**
|
|
1252
|
-
* アクションがクローズ (close) される前にフックする
|
|
1253
|
-
*
|
|
1254
|
-
* @param fn - 呼び出されるフック関数
|
|
1255
|
-
*
|
|
1256
|
-
* @public
|
|
1257
|
-
*/
|
|
1258
|
-
function onClose(fn) {
|
|
1259
|
-
let { onCloseHandlers } = getInternalHandlers();
|
|
1260
|
-
if (!onCloseHandlers) {
|
|
1261
|
-
onCloseHandlers = [];
|
|
1262
|
-
}
|
|
1263
|
-
onCloseHandlers.push(fn);
|
|
1264
|
-
updateInternalHandlers({ onCloseHandlers });
|
|
1265
|
-
}
|
|
1266
|
-
/**
|
|
1267
|
-
* アクションが破棄 (destroy) される前にフックする
|
|
1268
|
-
*
|
|
1269
|
-
* @param fn - 呼び出されるフック関数
|
|
1270
|
-
*
|
|
1271
|
-
* @public
|
|
1272
|
-
*/
|
|
1273
|
-
function onDestroy(fn) {
|
|
1274
|
-
let { onDestoryHandlers } = getInternalHandlers();
|
|
1275
|
-
if (!onDestoryHandlers) {
|
|
1276
|
-
onDestoryHandlers = [];
|
|
1277
|
-
}
|
|
1278
|
-
onDestoryHandlers.push(fn);
|
|
1279
|
-
updateInternalHandlers({ onDestoryHandlers });
|
|
1280
|
-
}
|
|
1281
|
-
/**
|
|
1282
|
-
* アクションのステートが変更された (changeState) 後にフックする
|
|
1283
|
-
*
|
|
1284
|
-
* @param fn - 呼び出されるフック関数
|
|
1285
|
-
*
|
|
1286
|
-
* @public
|
|
1287
|
-
*/
|
|
1288
|
-
function onChangeState(fn) {
|
|
1289
|
-
let { onChangeStateHandlers } = getInternalHandlers();
|
|
1290
|
-
if (!onChangeStateHandlers) {
|
|
1291
|
-
onChangeStateHandlers = [];
|
|
1292
|
-
}
|
|
1293
|
-
onChangeStateHandlers.push(fn);
|
|
1294
|
-
updateInternalHandlers({ onChangeStateHandlers });
|
|
1295
|
-
}
|
|
1369
|
+
/** @internal */
|
|
1296
1370
|
const h = (type, props, ...children) => {
|
|
1297
1371
|
const el = document.createElement(type);
|
|
1298
1372
|
for (const key of Object.keys(props)) {
|
|
@@ -1313,6 +1387,8 @@ const h = (type, props, ...children) => {
|
|
|
1313
1387
|
* create a fog element
|
|
1314
1388
|
*
|
|
1315
1389
|
* @deprecated 非推奨
|
|
1390
|
+
*
|
|
1391
|
+
* @internal
|
|
1316
1392
|
*/
|
|
1317
1393
|
function createFog({ color = '#000', opacity = '50%', zIndex = 999, onclick, }) {
|
|
1318
1394
|
const root = ensureModalRoot(false);
|
|
@@ -1339,25 +1415,14 @@ function createFog({ color = '#000', opacity = '50%', zIndex = 999, onclick, })
|
|
|
1339
1415
|
root.appendChild(fog);
|
|
1340
1416
|
return { fog, close };
|
|
1341
1417
|
}
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
}
|
|
1351
|
-
else if (embed_method == 'prepend') {
|
|
1352
|
-
target.prepend(replace);
|
|
1353
|
-
}
|
|
1354
|
-
else if (embed_method == 'after') {
|
|
1355
|
-
target.after(replace);
|
|
1356
|
-
}
|
|
1357
|
-
else if (embed_method == 'before') {
|
|
1358
|
-
target.before(replace);
|
|
1359
|
-
}
|
|
1360
|
-
}
|
|
1418
|
+
/**
|
|
1419
|
+
* アクションの Shadow Root の Element を取得する
|
|
1420
|
+
*
|
|
1421
|
+
* @returns
|
|
1422
|
+
* アクションが Shadow Root を持つ場合は Shadow Root の Element 返します。ない場合は `null` を返します
|
|
1423
|
+
*
|
|
1424
|
+
* @public
|
|
1425
|
+
*/
|
|
1361
1426
|
function getActionShadowRoot() {
|
|
1362
1427
|
const root = document.querySelector(`.${KARTE_ACTION_ROOT}[data-${KARTE_ACTION_RID}='${actionId}']`);
|
|
1363
1428
|
if (!root || !root.shadowRoot) {
|
|
@@ -1366,11 +1431,13 @@ function getActionShadowRoot() {
|
|
|
1366
1431
|
return root.shadowRoot;
|
|
1367
1432
|
}
|
|
1368
1433
|
/**
|
|
1369
|
-
*
|
|
1434
|
+
* アクションに CSS を適用する
|
|
1370
1435
|
*
|
|
1371
1436
|
* @param css - 適用する CSS
|
|
1372
1437
|
*
|
|
1373
1438
|
* @returns 適用された style 要素を返す Promise
|
|
1439
|
+
*
|
|
1440
|
+
* @public
|
|
1374
1441
|
*/
|
|
1375
1442
|
async function applyCss(css) {
|
|
1376
1443
|
return new Promise((resolve, reject) => {
|
|
@@ -1408,9 +1475,11 @@ async function fixFontFaceIssue(href, cssRules) {
|
|
|
1408
1475
|
return [rules.join('\n'), fixedRules.join('\n')];
|
|
1409
1476
|
}
|
|
1410
1477
|
/**
|
|
1411
|
-
*
|
|
1478
|
+
* アクションにグローバルなスタイルを読み込む
|
|
1479
|
+
*
|
|
1480
|
+
* @param href - style ファイルのリンク URL
|
|
1412
1481
|
*
|
|
1413
|
-
* @
|
|
1482
|
+
* @public
|
|
1414
1483
|
*/
|
|
1415
1484
|
async function loadStyle(href) {
|
|
1416
1485
|
const sr = getActionShadowRoot();
|
|
@@ -1443,11 +1512,46 @@ async function loadStyle(href) {
|
|
|
1443
1512
|
document.adoptedStyleSheets = [...document.adoptedStyleSheets, css, fontFaceCss];
|
|
1444
1513
|
}
|
|
1445
1514
|
// -------- The following codes are deprecated --------
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1515
|
+
/**
|
|
1516
|
+
* 非推奨です
|
|
1517
|
+
*
|
|
1518
|
+
* @deprecated 非推奨
|
|
1519
|
+
*
|
|
1520
|
+
* @internal
|
|
1521
|
+
*/
|
|
1522
|
+
const showModal = create;
|
|
1523
|
+
/**
|
|
1524
|
+
* 非推奨です
|
|
1525
|
+
*
|
|
1526
|
+
* @deprecated 非推奨
|
|
1527
|
+
*
|
|
1528
|
+
* @internal
|
|
1529
|
+
*/
|
|
1530
|
+
const KARTE_MODAL_ROOT = 'karte-modal-root';
|
|
1531
|
+
/**
|
|
1532
|
+
* 非推奨です
|
|
1533
|
+
*
|
|
1534
|
+
* @deprecated 非推奨
|
|
1535
|
+
*
|
|
1536
|
+
* @internal
|
|
1537
|
+
*/
|
|
1538
|
+
const ensureModalRoot = ensureActionRoot;
|
|
1539
|
+
/**
|
|
1540
|
+
* 非推奨です
|
|
1541
|
+
*
|
|
1542
|
+
* @deprecated 非推奨
|
|
1543
|
+
*
|
|
1544
|
+
* @internal
|
|
1545
|
+
*/
|
|
1546
|
+
const show = showAction;
|
|
1547
|
+
/**
|
|
1548
|
+
* 非推奨です
|
|
1549
|
+
*
|
|
1550
|
+
* @deprecated 非推奨
|
|
1551
|
+
*
|
|
1552
|
+
* @internal
|
|
1553
|
+
*/
|
|
1554
|
+
const close = closeAction;
|
|
1451
1555
|
/**
|
|
1452
1556
|
* Create an application instance
|
|
1453
1557
|
*
|
|
@@ -1457,6 +1561,8 @@ const close = closeAction; // deprecated
|
|
|
1457
1561
|
* @returns A function to close the modal
|
|
1458
1562
|
*
|
|
1459
1563
|
* @deprecated 非推奨
|
|
1564
|
+
*
|
|
1565
|
+
* @internal
|
|
1460
1566
|
*/
|
|
1461
1567
|
function createApp(App, options = {
|
|
1462
1568
|
send: () => { },
|
|
@@ -1498,7 +1604,16 @@ function createApp(App, options = {
|
|
|
1498
1604
|
};
|
|
1499
1605
|
}
|
|
1500
1606
|
|
|
1501
|
-
|
|
1607
|
+
/**
|
|
1608
|
+
* アクションテーブルを管理するメソッドを取得する
|
|
1609
|
+
*
|
|
1610
|
+
* @param config - 設定情報
|
|
1611
|
+
*
|
|
1612
|
+
* @returns メソッドを返します
|
|
1613
|
+
*
|
|
1614
|
+
* @public
|
|
1615
|
+
*/
|
|
1616
|
+
function collection$1(config) {
|
|
1502
1617
|
const endpoint = config.endpoint || "https://t.karte.test/collection";
|
|
1503
1618
|
const api_key = config.api_key;
|
|
1504
1619
|
const table = config.table;
|
|
@@ -1537,7 +1652,7 @@ const collection$1 = (config) => {
|
|
|
1537
1652
|
}, cb);
|
|
1538
1653
|
},
|
|
1539
1654
|
};
|
|
1540
|
-
}
|
|
1655
|
+
}
|
|
1541
1656
|
function request(url, data, cb) {
|
|
1542
1657
|
const xhr = new XMLHttpRequest();
|
|
1543
1658
|
xhr.onreadystatechange = () => {
|
|
@@ -5006,6 +5121,7 @@ class MovieVimeoElement extends SvelteComponent {
|
|
|
5006
5121
|
}
|
|
5007
5122
|
}
|
|
5008
5123
|
|
|
5124
|
+
/** @internal */
|
|
5009
5125
|
function registerInput({ name, statePath, validator = () => true, initialValue, }) {
|
|
5010
5126
|
const writableValue = {
|
|
5011
5127
|
subscribe(run) {
|
|
@@ -5040,6 +5156,7 @@ function registerInput({ name, statePath, validator = () => true, initialValue,
|
|
|
5040
5156
|
writableValue.set(initialValue);
|
|
5041
5157
|
return writableValue;
|
|
5042
5158
|
}
|
|
5159
|
+
/** @internal */
|
|
5043
5160
|
function deleteValues(statePath) {
|
|
5044
5161
|
formData.update(prev => {
|
|
5045
5162
|
const targetNames = Object.entries(prev)
|
|
@@ -5051,6 +5168,7 @@ function deleteValues(statePath) {
|
|
|
5051
5168
|
return { ...prev };
|
|
5052
5169
|
});
|
|
5053
5170
|
}
|
|
5171
|
+
/** @internal */
|
|
5054
5172
|
const getValuesAreValidReader = statePath => ({
|
|
5055
5173
|
subscribe(callback) {
|
|
5056
5174
|
return formData.subscribe(formData => {
|
|
@@ -5086,6 +5204,7 @@ function formDataToEventValues(campaignId, formData) {
|
|
|
5086
5204
|
},
|
|
5087
5205
|
};
|
|
5088
5206
|
}
|
|
5207
|
+
/** @internal */
|
|
5089
5208
|
function submit() {
|
|
5090
5209
|
const systemConfig = getSystem();
|
|
5091
5210
|
const campaignId = systemConfig.campaignId;
|
|
@@ -7303,4 +7422,4 @@ class ImageBlock extends SvelteComponent {
|
|
|
7303
7422
|
}
|
|
7304
7423
|
}
|
|
7305
7424
|
|
|
7306
|
-
export {
|
|
7425
|
+
export { Alignments, AnimationStyles, BackgroundSizes, ClipPaths, Cursors, DefaultListBackground, DefaultListBackgroundNone, DefaultListBackgroundStripe, DefaultListSeparator, DefaultListSeparatorBorder, DefaultListSeparatorGap, DefaultListSeparatorNone, DefaultModalPlacement, DefaultSliderButton, DefaultSliderNavigationButton, Directions, Elasticities, ElasticityStyle, EmbedElement, Flex, FlexItem, FormButton, FormCheckBoxes, FormOperationOptions, FormRadioButtons, 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, Slider, SliderItem, 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, getState$1 as getState, getStates, getStoreState, getSystem, hideOnScroll, hideOnTime, initialize, isClosed, isOpened, loadGlobalScript, loadGlobalStyle, loadStyle, 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 };
|