@plaidev/karte-action-sdk 1.1.179-28041859.8b5339d0 → 1.1.180-28042066.2d66783f
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 +176 -82
- package/dist/hydrate/index.es.js +372 -303
- package/dist/index.es.d.ts +176 -82
- package/dist/index.es.js +425 -356
- package/dist/templates.cjs.js +2 -1
- package/dist/templates.js +2 -1
- package/package.json +2 -2
package/dist/index.es.js
CHANGED
@@ -275,13 +275,6 @@ const NOOP = (_args) => { }; // eslint-disable-line @typescript-eslint/no-unused
|
|
275
275
|
const isPreview = () => {
|
276
276
|
return false;
|
277
277
|
};
|
278
|
-
// prettier-ignore
|
279
|
-
/** @internal */
|
280
|
-
const actionId = typeof __FIX_ACTION_CHANGE_STATE_EVENT__ === 'string'
|
281
|
-
? __FIX_ACTION_CHANGE_STATE_EVENT__
|
282
|
-
: typeof __FLYER_GEN_ACTION_ID_ON_BUILD__ === 'string'
|
283
|
-
? __FLYER_GEN_ACTION_ID_ON_BUILD__
|
284
|
-
: randStr();
|
285
278
|
/** @internal */
|
286
279
|
const setPreviousFocus = () => {
|
287
280
|
const previously_focused = typeof document !== 'undefined' && document.activeElement;
|
@@ -1008,6 +1001,50 @@ function cloneToJson(data) {
|
|
1008
1001
|
}
|
1009
1002
|
}
|
1010
1003
|
|
1004
|
+
// prettier-ignore
|
1005
|
+
/** @internal */
|
1006
|
+
const actionId = typeof __FIX_ACTION_CHANGE_STATE_EVENT__ === 'string'
|
1007
|
+
? __FIX_ACTION_CHANGE_STATE_EVENT__
|
1008
|
+
: typeof __FLYER_GEN_ACTION_ID_ON_BUILD__ === 'string'
|
1009
|
+
? __FLYER_GEN_ACTION_ID_ON_BUILD__
|
1010
|
+
: randStr();
|
1011
|
+
/** @internal */
|
1012
|
+
const ACTION_DESTROY_EVENT = `KARTE-ACTION-DESTROY-${actionId}`;
|
1013
|
+
/** @internal */
|
1014
|
+
const ACTION_SHOW_EVENT = `KARTE-ACTION-SHOW-${actionId}`;
|
1015
|
+
/** @internal */
|
1016
|
+
const ACTION_CLOSE_EVENT = `KARTE-ACTION-CLOSE-${actionId}`;
|
1017
|
+
/** @internal */
|
1018
|
+
const ACTION_CHANGE_STATE_EVENT = `KARTE-ACTION-CHANGE-STATE-${actionId}`;
|
1019
|
+
/** @internal */
|
1020
|
+
const send_event = (event_name, values) => {
|
1021
|
+
const setting = getSetting();
|
1022
|
+
setting?.send?.(event_name, values);
|
1023
|
+
};
|
1024
|
+
/** @internal */
|
1025
|
+
const initialize = (setting) => {
|
1026
|
+
const newSetting = setSetting(setting);
|
1027
|
+
if (newSetting.initialState) {
|
1028
|
+
setState$1(newSetting.initialState);
|
1029
|
+
}
|
1030
|
+
setOpened(true);
|
1031
|
+
setClosed(false); // deprecated
|
1032
|
+
return () => finalize();
|
1033
|
+
};
|
1034
|
+
/** @internal */
|
1035
|
+
const finalize = () => {
|
1036
|
+
resetSetting();
|
1037
|
+
};
|
1038
|
+
/**
|
1039
|
+
* Dispatch the event to destroy KARTE action
|
1040
|
+
*
|
1041
|
+
* @internal
|
1042
|
+
*/
|
1043
|
+
function dispatchDestroyEvent() {
|
1044
|
+
const event = new CustomEvent(ACTION_DESTROY_EVENT);
|
1045
|
+
window.dispatchEvent(event);
|
1046
|
+
}
|
1047
|
+
|
1011
1048
|
/**
|
1012
1049
|
* モーダル(ポップアップ)のロジックを管理する
|
1013
1050
|
*/
|
@@ -1155,20 +1192,6 @@ function checkAndDo(checkFn, fn, ...conditionFns) {
|
|
1155
1192
|
return haveCondition ? cleanupAll : null;
|
1156
1193
|
}
|
1157
1194
|
|
1158
|
-
/** @internal */
|
1159
|
-
const ACTION_DESTROY_EVENT = `KARTE-ACTION-DESTROY-${actionId}`;
|
1160
|
-
/** @internal */
|
1161
|
-
const ACTION_SHOW_EVENT = `KARTE-ACTION-SHOW-${actionId}`;
|
1162
|
-
/** @internal */
|
1163
|
-
const ACTION_CLOSE_EVENT = `KARTE-ACTION-CLOSE-${actionId}`;
|
1164
|
-
/** @internal */
|
1165
|
-
const ACTION_CHANGE_STATE_EVENT = `KARTE-ACTION-CHANGE-STATE-${actionId}`;
|
1166
|
-
/** @internal */
|
1167
|
-
const send_event = (event_name, values) => {
|
1168
|
-
const setting = getSetting();
|
1169
|
-
setting?.send?.(event_name, values);
|
1170
|
-
};
|
1171
|
-
|
1172
1195
|
/**
|
1173
1196
|
* アクションテーブルに関連するコードの管理
|
1174
1197
|
*/
|
@@ -1224,6 +1247,7 @@ function collection$1(config) {
|
|
1224
1247
|
},
|
1225
1248
|
};
|
1226
1249
|
}
|
1250
|
+
/** @internal */
|
1227
1251
|
function request(url, data, cb) {
|
1228
1252
|
console.debug('[debug] request', isPreview(), url, JSON.stringify(data));
|
1229
1253
|
fetch(url, {
|
@@ -1251,6 +1275,7 @@ const loadActionTableRows = async (config, api_key, endpoint) => {
|
|
1251
1275
|
const loadActionTableQuery = async (config, api_key, endpoint) => {
|
1252
1276
|
return new Promise((resolve, reject) => collection$1({ endpoint, api_key, table: config.query.table_name }).getByQuery(config.query.query_name, config.query.params, null, (err, data) => (err ? reject(err) : resolve(data))));
|
1253
1277
|
};
|
1278
|
+
/** @internal */
|
1254
1279
|
const loadActionTable = async (config, api_key, endpoint) => {
|
1255
1280
|
console.debug('[debug] loadActionTable', isPreview(), api_key, endpoint, JSON.stringify(config));
|
1256
1281
|
const results = await Promise.all(config
|
@@ -1276,13 +1301,23 @@ const loadActionTable = async (config, api_key, endpoint) => {
|
|
1276
1301
|
return acc;
|
1277
1302
|
}, {});
|
1278
1303
|
};
|
1304
|
+
/** @internal */
|
1305
|
+
async function setupActionTable(localVariablesQuery, apiKey) {
|
1306
|
+
const result = await loadActionTable(localVariablesQuery, apiKey);
|
1307
|
+
let success = false;
|
1308
|
+
if (Object.keys(result).length === localVariablesQuery.length) {
|
1309
|
+
setVariables(result);
|
1310
|
+
success = true;
|
1311
|
+
}
|
1312
|
+
return {
|
1313
|
+
success,
|
1314
|
+
};
|
1315
|
+
}
|
1279
1316
|
|
1280
1317
|
/**
|
1281
|
-
*
|
1282
|
-
*
|
1283
|
-
* アクションのCreate, Destroyの状態はここで管理する。
|
1318
|
+
* モーダル(ポップアップ)に関連するコードの管理
|
1284
1319
|
*
|
1285
|
-
*
|
1320
|
+
* アクションのShow, Close, ChangeStateの状態はここで管理する。
|
1286
1321
|
*/
|
1287
1322
|
/** @internal */
|
1288
1323
|
const handleState = (event) => {
|
@@ -1291,100 +1326,234 @@ const handleState = (event) => {
|
|
1291
1326
|
setState$1(event.detail.to, { disableInPreview: event.detail.disableInPreview });
|
1292
1327
|
}
|
1293
1328
|
};
|
1294
|
-
/**
|
1295
|
-
|
1296
|
-
|
1297
|
-
|
1298
|
-
|
1329
|
+
/**
|
1330
|
+
* アクションが表示 (show) された後にフックする関数
|
1331
|
+
*
|
1332
|
+
* @param fn - 呼び出されるフック関数
|
1333
|
+
*
|
1334
|
+
* @public
|
1335
|
+
*/
|
1336
|
+
function onShow(fn) {
|
1337
|
+
let { onShowHandlers } = getInternalHandlers();
|
1338
|
+
if (!onShowHandlers) {
|
1339
|
+
onShowHandlers = [];
|
1299
1340
|
}
|
1300
|
-
|
1301
|
-
|
1302
|
-
|
1303
|
-
};
|
1304
|
-
/** @internal */
|
1305
|
-
const finalize = () => {
|
1306
|
-
resetSetting();
|
1307
|
-
};
|
1341
|
+
onShowHandlers.push(fn);
|
1342
|
+
setInternalHandlers({ onShowHandlers });
|
1343
|
+
}
|
1308
1344
|
/**
|
1309
|
-
*
|
1345
|
+
* アクションがクローズ (close) される前にフックする関数
|
1310
1346
|
*
|
1311
|
-
* @param
|
1312
|
-
* @param options - {@link ActionOptions | オプション}
|
1347
|
+
* @param fn - 呼び出されるフック関数
|
1313
1348
|
*
|
1314
|
-
* @
|
1349
|
+
* @public
|
1350
|
+
*/
|
1351
|
+
function onClose(fn) {
|
1352
|
+
let { onCloseHandlers } = getInternalHandlers();
|
1353
|
+
if (!onCloseHandlers) {
|
1354
|
+
onCloseHandlers = [];
|
1355
|
+
}
|
1356
|
+
onCloseHandlers.push(fn);
|
1357
|
+
setInternalHandlers({ onCloseHandlers });
|
1358
|
+
}
|
1359
|
+
/**
|
1360
|
+
* アクションのステートが変更された (changeState) 後にフックする関数
|
1361
|
+
*
|
1362
|
+
* @param fn - 呼び出されるフック関数
|
1315
1363
|
*
|
1316
1364
|
* @public
|
1317
1365
|
*/
|
1318
|
-
function
|
1319
|
-
|
1320
|
-
|
1321
|
-
|
1322
|
-
|
1323
|
-
|
1324
|
-
})
|
1325
|
-
|
1326
|
-
|
1327
|
-
|
1328
|
-
|
1329
|
-
|
1330
|
-
|
1331
|
-
|
1332
|
-
|
1333
|
-
|
1334
|
-
|
1335
|
-
|
1336
|
-
|
1337
|
-
|
1338
|
-
|
1339
|
-
|
1340
|
-
|
1341
|
-
|
1342
|
-
|
1343
|
-
|
1344
|
-
|
1345
|
-
|
1346
|
-
|
1347
|
-
|
1348
|
-
|
1349
|
-
|
1350
|
-
|
1351
|
-
|
1352
|
-
|
1353
|
-
|
1354
|
-
|
1355
|
-
|
1356
|
-
|
1357
|
-
|
1358
|
-
|
1359
|
-
|
1360
|
-
|
1361
|
-
h({ send: options.send, publish: options.publish, data }, trigger);
|
1362
|
-
});
|
1363
|
-
}
|
1364
|
-
finalize();
|
1365
|
-
dispatchDestroyEvent();
|
1366
|
-
app.$destroy();
|
1367
|
-
app = null;
|
1368
|
-
return NOOP;
|
1369
|
-
};
|
1370
|
-
const handleClose = (event) => {
|
1371
|
-
const trigger = event?.detail?.trigger ? event.detail.trigger : 'none';
|
1372
|
-
close(trigger);
|
1373
|
-
};
|
1374
|
-
const show = async (trigger = 'none') => {
|
1375
|
-
if (app) {
|
1366
|
+
function onChangeState(fn) {
|
1367
|
+
let { onChangeStateHandlers } = getInternalHandlers();
|
1368
|
+
if (!onChangeStateHandlers) {
|
1369
|
+
onChangeStateHandlers = [];
|
1370
|
+
}
|
1371
|
+
onChangeStateHandlers.push(fn);
|
1372
|
+
setInternalHandlers({ onChangeStateHandlers });
|
1373
|
+
}
|
1374
|
+
/**
|
1375
|
+
* アクションを表示する
|
1376
|
+
*
|
1377
|
+
* @public
|
1378
|
+
*/
|
1379
|
+
function showAction() {
|
1380
|
+
const event = new CustomEvent(ACTION_SHOW_EVENT, { detail: { trigger: 'custom' } });
|
1381
|
+
window.dispatchEvent(event);
|
1382
|
+
}
|
1383
|
+
/**
|
1384
|
+
* アクションを閉じる
|
1385
|
+
*
|
1386
|
+
* @param trigger - 閉じた時のトリガー。デフォルト `'none'`
|
1387
|
+
*
|
1388
|
+
* @public
|
1389
|
+
*/
|
1390
|
+
function closeAction(trigger = 'none') {
|
1391
|
+
const event = new CustomEvent(ACTION_CLOSE_EVENT, { detail: { trigger } });
|
1392
|
+
window.dispatchEvent(event);
|
1393
|
+
}
|
1394
|
+
/**
|
1395
|
+
* アクションに CSS を適用する
|
1396
|
+
*
|
1397
|
+
* @param css - 適用する CSS
|
1398
|
+
*
|
1399
|
+
* @returns 適用された style 要素を返す Promise
|
1400
|
+
*
|
1401
|
+
* @public
|
1402
|
+
*/
|
1403
|
+
async function applyCss(css) {
|
1404
|
+
return new Promise((resolve, reject) => {
|
1405
|
+
const style = document.createElement('style');
|
1406
|
+
style.textContent = css;
|
1407
|
+
const shadowRoot = getActionRoot();
|
1408
|
+
if (!shadowRoot)
|
1376
1409
|
return;
|
1410
|
+
shadowRoot.append(style);
|
1411
|
+
style.addEventListener('load', () => resolve(style));
|
1412
|
+
style.addEventListener('error', () => reject(style));
|
1413
|
+
});
|
1414
|
+
}
|
1415
|
+
async function fixFontFaceIssue(href, cssRules) {
|
1416
|
+
const css = new CSSStyleSheet();
|
1417
|
+
// @ts-ignore
|
1418
|
+
await css.replace(cssRules);
|
1419
|
+
const rules = [];
|
1420
|
+
const fixedRules = [];
|
1421
|
+
Array.from(css.cssRules).forEach(cssRule => {
|
1422
|
+
if (cssRule.type !== 5) {
|
1423
|
+
rules.push(cssRule.cssText);
|
1377
1424
|
}
|
1378
|
-
|
1425
|
+
// type 5 is @font-face
|
1426
|
+
const split = href.split('/');
|
1427
|
+
const stylePath = split.slice(0, split.length - 1).join('/');
|
1428
|
+
const cssText = cssRule.cssText;
|
1429
|
+
const newCssText = cssText.replace(
|
1430
|
+
// relative paths
|
1431
|
+
/url\s*\(\s*['"]?(?!((\/)|((?:https?:)?\/\/)|(?:data:?:)))([^'")]+)['"]?\s*\)/g, `url("${stylePath}/$4")`);
|
1432
|
+
if (cssText === newCssText)
|
1379
1433
|
return;
|
1380
|
-
|
1381
|
-
|
1382
|
-
|
1383
|
-
|
1384
|
-
|
1385
|
-
|
1386
|
-
|
1387
|
-
|
1434
|
+
fixedRules.push(newCssText);
|
1435
|
+
});
|
1436
|
+
return [rules.join('\n'), fixedRules.join('\n')];
|
1437
|
+
}
|
1438
|
+
/**
|
1439
|
+
* アクションにグローバルなスタイルを読み込む
|
1440
|
+
*
|
1441
|
+
* @param href - style ファイルのリンク URL
|
1442
|
+
*
|
1443
|
+
* @public
|
1444
|
+
*/
|
1445
|
+
async function loadStyle(href) {
|
1446
|
+
const sr = getActionRoot();
|
1447
|
+
if (!sr)
|
1448
|
+
return;
|
1449
|
+
let cssRules = '';
|
1450
|
+
try {
|
1451
|
+
const res = await fetch(href);
|
1452
|
+
cssRules = await res.text();
|
1453
|
+
}
|
1454
|
+
catch (e) {
|
1455
|
+
// pass
|
1456
|
+
}
|
1457
|
+
if (!cssRules)
|
1458
|
+
return;
|
1459
|
+
// Chromeのバグで、Shadow Rootの@font-faceを絶対パスで指定する必要がある
|
1460
|
+
// @see https://stackoverflow.com/a/63717709
|
1461
|
+
const [rules, fontFaceRules] = await fixFontFaceIssue(href, cssRules);
|
1462
|
+
const css = new CSSStyleSheet();
|
1463
|
+
// @ts-ignore
|
1464
|
+
await css.replace(rules);
|
1465
|
+
const fontFaceCss = new CSSStyleSheet();
|
1466
|
+
// @ts-ignore
|
1467
|
+
await fontFaceCss.replace(fontFaceRules);
|
1468
|
+
// @ts-ignore
|
1469
|
+
sr.adoptedStyleSheets = [...sr.adoptedStyleSheets, css, fontFaceCss];
|
1470
|
+
// Chromeのバグで、ページとShadow Rootの両方に、@font-faceを設定する必要がある
|
1471
|
+
// @see https://stackoverflow.com/a/63717709
|
1472
|
+
// @ts-ignore
|
1473
|
+
document.adoptedStyleSheets = [...document.adoptedStyleSheets, css, fontFaceCss];
|
1474
|
+
}
|
1475
|
+
// @internal
|
1476
|
+
function getCssVariables(data) {
|
1477
|
+
return Object.entries(data)
|
1478
|
+
.filter(([key, value]) => {
|
1479
|
+
return ['string', 'number'].includes(typeof value) && key.startsWith('--');
|
1480
|
+
})
|
1481
|
+
.map(([key, value]) => `${key}:${value}`)
|
1482
|
+
.join(';');
|
1483
|
+
}
|
1484
|
+
/**
|
1485
|
+
* アクションのルートの DOM 要素を取得する
|
1486
|
+
*
|
1487
|
+
* @returns アクションがルートの DOM 要素 を持つ場合は DOM 要素を返します。ない場合は `null` を返します
|
1488
|
+
*
|
1489
|
+
* @public
|
1490
|
+
*/
|
1491
|
+
function getActionRoot() {
|
1492
|
+
const root = document.querySelector(`.${KARTE_ACTION_ROOT}[data-${KARTE_ACTION_RID}='${actionId}']`);
|
1493
|
+
if (!root?.shadowRoot) {
|
1494
|
+
return null;
|
1495
|
+
}
|
1496
|
+
return root.shadowRoot;
|
1497
|
+
}
|
1498
|
+
/** @internal */
|
1499
|
+
function createModal(App, options = {
|
1500
|
+
send: () => { },
|
1501
|
+
publish: () => { },
|
1502
|
+
props: {},
|
1503
|
+
variables: {},
|
1504
|
+
localVariablesQuery: undefined,
|
1505
|
+
karteTemplate: {},
|
1506
|
+
}) {
|
1507
|
+
let app = null;
|
1508
|
+
const data = {
|
1509
|
+
...options.props,
|
1510
|
+
...options.variables,
|
1511
|
+
...getVariables(),
|
1512
|
+
};
|
1513
|
+
const actionProps = {
|
1514
|
+
send: options.send,
|
1515
|
+
publish: options.publish,
|
1516
|
+
data,
|
1517
|
+
};
|
1518
|
+
const close = (trigger = 'none') => {
|
1519
|
+
if (!app) {
|
1520
|
+
return NOOP;
|
1521
|
+
}
|
1522
|
+
options.send('message_close', { trigger, state: getState$1() });
|
1523
|
+
setOpened(false);
|
1524
|
+
setClosed(true); // deprecated
|
1525
|
+
const { onCloseHandlers } = getInternalHandlers();
|
1526
|
+
if (onCloseHandlers) {
|
1527
|
+
onCloseHandlers.forEach(h => {
|
1528
|
+
const actionHookLog = { name: 'onClose', values: { trigger } };
|
1529
|
+
console.info(`${ACTION_HOOK_LABEL}:${JSON.stringify(actionHookLog)}`);
|
1530
|
+
h({ send: options.send, publish: options.publish, data }, trigger);
|
1531
|
+
});
|
1532
|
+
}
|
1533
|
+
finalize();
|
1534
|
+
dispatchDestroyEvent();
|
1535
|
+
app.$destroy();
|
1536
|
+
app = null;
|
1537
|
+
return NOOP;
|
1538
|
+
};
|
1539
|
+
const handleClose = (event) => {
|
1540
|
+
const trigger = event?.detail?.trigger ? event.detail.trigger : 'none';
|
1541
|
+
close(trigger);
|
1542
|
+
};
|
1543
|
+
const show = async (trigger = 'none') => {
|
1544
|
+
if (app) {
|
1545
|
+
return;
|
1546
|
+
}
|
1547
|
+
if (trigger === 'custom' && (options.props.show_on_scroll || options.props.show_on_time)) {
|
1548
|
+
return;
|
1549
|
+
}
|
1550
|
+
if (actionTablePromise) {
|
1551
|
+
const result = await actionTablePromise;
|
1552
|
+
if (!result.success)
|
1553
|
+
return;
|
1554
|
+
}
|
1555
|
+
options.send('message_open', { state: getState$1() });
|
1556
|
+
setOpened(true);
|
1388
1557
|
setClosed(false); // deprecated
|
1389
1558
|
// 非同期処理中にappが初期化されている可能性がある
|
1390
1559
|
if (app) {
|
@@ -1463,33 +1632,15 @@ function create(App, options = {
|
|
1463
1632
|
};
|
1464
1633
|
// ここからメインの処理
|
1465
1634
|
initialize({ send: options.send, initialState: data.initial_state });
|
1466
|
-
setSystem({
|
1467
|
-
// @ts-ignore
|
1468
|
-
apiKey: data.api_key || null,
|
1469
|
-
shortenId: data.shorten_id || null,
|
1470
|
-
campaignId: data.campaign_id || null,
|
1471
|
-
});
|
1472
1635
|
// ActionTable APIへの非同期リクエスト
|
1473
1636
|
let actionTablePromise = null;
|
1474
1637
|
if (options.localVariablesQuery && data.api_key) {
|
1475
|
-
actionTablePromise = (
|
1476
|
-
const result = await loadActionTable(options.localVariablesQuery, data.api_key);
|
1477
|
-
let success = false;
|
1478
|
-
if (Object.keys(result).length === options.localVariablesQuery.length) {
|
1479
|
-
setVariables(result);
|
1480
|
-
success = true;
|
1481
|
-
}
|
1482
|
-
return {
|
1483
|
-
success,
|
1484
|
-
};
|
1485
|
-
})();
|
1638
|
+
actionTablePromise = setupActionTable(options.localVariablesQuery, data.api_key);
|
1486
1639
|
}
|
1487
1640
|
// NOTE: onCreateより前にListenする必要がある
|
1488
1641
|
window.addEventListener(ACTION_SHOW_EVENT, handleShow);
|
1489
1642
|
window.addEventListener(ACTION_CLOSE_EVENT, handleClose);
|
1490
1643
|
window.addEventListener(ACTION_CHANGE_STATE_EVENT, handleState);
|
1491
|
-
window.addEventListener(ACTION_DESTROY_EVENT, handleDestroy);
|
1492
|
-
window.addEventListener('beforeunload', dispatchDestroyEvent, false);
|
1493
1644
|
let showTriggerCleanups = [];
|
1494
1645
|
let closeTriggerCleanups = [];
|
1495
1646
|
{
|
@@ -1504,7 +1655,6 @@ function create(App, options = {
|
|
1504
1655
|
console.debug(`${ACTION_HOOK_LABEL}: onCreate`);
|
1505
1656
|
});
|
1506
1657
|
}
|
1507
|
-
// カスタムスクリプトの処理
|
1508
1658
|
if (options.onCreate) {
|
1509
1659
|
options.onCreate(actionProps);
|
1510
1660
|
}
|
@@ -1516,8 +1666,6 @@ function create(App, options = {
|
|
1516
1666
|
window.removeEventListener(ACTION_SHOW_EVENT, handleShow);
|
1517
1667
|
window.removeEventListener(ACTION_CLOSE_EVENT, handleClose);
|
1518
1668
|
window.removeEventListener(ACTION_CHANGE_STATE_EVENT, handleState);
|
1519
|
-
window.removeEventListener(ACTION_DESTROY_EVENT, handleDestroy);
|
1520
|
-
window.removeEventListener('beforeunload', dispatchDestroyEvent, false);
|
1521
1669
|
};
|
1522
1670
|
return appCleanup;
|
1523
1671
|
}
|
@@ -1545,53 +1693,13 @@ function ensureActionRoot(useShadow = true) {
|
|
1545
1693
|
}
|
1546
1694
|
}
|
1547
1695
|
/**
|
1548
|
-
*
|
1549
|
-
*
|
1550
|
-
* @internal
|
1551
|
-
*/
|
1552
|
-
function dispatchDestroyEvent() {
|
1553
|
-
const event = new CustomEvent(ACTION_DESTROY_EVENT);
|
1554
|
-
window.dispatchEvent(event);
|
1555
|
-
}
|
1556
|
-
/**
|
1557
|
-
* アクションの破棄する
|
1558
|
-
*
|
1559
|
-
* @public
|
1560
|
-
*/
|
1561
|
-
function destroyAction() {
|
1562
|
-
setDestroyed(true);
|
1563
|
-
dispatchDestroyEvent();
|
1564
|
-
}
|
1565
|
-
/**
|
1566
|
-
* アクションが作成 (create) される前にフックする関数
|
1567
|
-
*
|
1568
|
-
* @param fn - 呼び出されるフック関数
|
1569
|
-
*
|
1570
|
-
* @public
|
1571
|
-
*/
|
1572
|
-
function onCreate(fn) {
|
1573
|
-
let { onCreateHandlers } = getInternalHandlers();
|
1574
|
-
if (!onCreateHandlers) {
|
1575
|
-
onCreateHandlers = [];
|
1576
|
-
}
|
1577
|
-
onCreateHandlers.push(fn);
|
1578
|
-
setInternalHandlers({ onCreateHandlers });
|
1579
|
-
}
|
1580
|
-
/**
|
1581
|
-
* アクションが破棄 (destroy) される前にフックする関数
|
1696
|
+
* 非推奨
|
1582
1697
|
*
|
1583
|
-
* @
|
1698
|
+
* @deprecated 非推奨
|
1584
1699
|
*
|
1585
|
-
* @
|
1700
|
+
* @internal
|
1586
1701
|
*/
|
1587
|
-
|
1588
|
-
let { onDestroyHandlers } = getInternalHandlers();
|
1589
|
-
if (!onDestroyHandlers) {
|
1590
|
-
onDestroyHandlers = [];
|
1591
|
-
}
|
1592
|
-
onDestroyHandlers.push(fn);
|
1593
|
-
setInternalHandlers({ onDestroyHandlers });
|
1594
|
-
}
|
1702
|
+
const show = showAction;
|
1595
1703
|
/**
|
1596
1704
|
* 非推奨
|
1597
1705
|
*
|
@@ -1599,7 +1707,7 @@ function onDestroy(fn) {
|
|
1599
1707
|
*
|
1600
1708
|
* @internal
|
1601
1709
|
*/
|
1602
|
-
const
|
1710
|
+
const close = closeAction;
|
1603
1711
|
/**
|
1604
1712
|
* 非推奨
|
1605
1713
|
*
|
@@ -1656,17 +1764,6 @@ function createApp(App, options = {
|
|
1656
1764
|
},
|
1657
1765
|
};
|
1658
1766
|
}
|
1659
|
-
/**
|
1660
|
-
* 非推奨
|
1661
|
-
*
|
1662
|
-
* @deprecated 非推奨
|
1663
|
-
*
|
1664
|
-
* @internal
|
1665
|
-
*/
|
1666
|
-
function destroy() {
|
1667
|
-
setDestroyed(true);
|
1668
|
-
dispatchDestroyEvent();
|
1669
|
-
}
|
1670
1767
|
/**
|
1671
1768
|
* 非推奨
|
1672
1769
|
*
|
@@ -1703,6 +1800,43 @@ function createFog({ color = '#000', opacity = '50%', zIndex = 999, onclick, })
|
|
1703
1800
|
/**
|
1704
1801
|
* スクリプト接客が利用するコードの管理
|
1705
1802
|
*/
|
1803
|
+
/** @internal */
|
1804
|
+
async function runScript$1(options = {
|
1805
|
+
send: () => { },
|
1806
|
+
publish: () => { },
|
1807
|
+
props: {},
|
1808
|
+
variables: {},
|
1809
|
+
localVariablesQuery: undefined,
|
1810
|
+
karteTemplate: {},
|
1811
|
+
}) {
|
1812
|
+
if (!options.onCreate)
|
1813
|
+
return;
|
1814
|
+
const data = {
|
1815
|
+
...options.props,
|
1816
|
+
...options.variables,
|
1817
|
+
...getVariables(),
|
1818
|
+
};
|
1819
|
+
const actionProps = {
|
1820
|
+
send: options.send,
|
1821
|
+
publish: options.publish,
|
1822
|
+
data,
|
1823
|
+
};
|
1824
|
+
initialize({ send: options.send, initialState: data.initial_state });
|
1825
|
+
const { success } = await setupActionTable(options.localVariablesQuery, data.api_key);
|
1826
|
+
if (!success)
|
1827
|
+
return;
|
1828
|
+
options.send('script_fired');
|
1829
|
+
// 旧Widget API IFの処理
|
1830
|
+
const { onCreateHandlers } = getInternalHandlers();
|
1831
|
+
if (onCreateHandlers) {
|
1832
|
+
onCreateHandlers.forEach(h => {
|
1833
|
+
h({ send: options.send, publish: options.publish, data });
|
1834
|
+
console.debug(`${ACTION_HOOK_LABEL}: onCreate`);
|
1835
|
+
});
|
1836
|
+
}
|
1837
|
+
options.onCreate(actionProps);
|
1838
|
+
finalize();
|
1839
|
+
}
|
1706
1840
|
/**
|
1707
1841
|
* ES Modules に対応していない JavaScript をページに読み込む
|
1708
1842
|
*
|
@@ -1763,178 +1897,110 @@ async function loadGlobalStyle(href) {
|
|
1763
1897
|
}
|
1764
1898
|
|
1765
1899
|
/**
|
1766
|
-
*
|
1900
|
+
* Edgeが起動するアクションに関連するコードを管理する
|
1767
1901
|
*
|
1768
|
-
* アクションの
|
1902
|
+
* アクションのCreate, Destroyの状態はここで管理する。
|
1769
1903
|
*/
|
1770
1904
|
/**
|
1771
|
-
*
|
1772
|
-
*
|
1773
|
-
* @param fn - 呼び出されるフック関数
|
1905
|
+
* アクションを作成する
|
1774
1906
|
*
|
1775
|
-
* @
|
1776
|
-
|
1777
|
-
function onShow(fn) {
|
1778
|
-
let { onShowHandlers } = getInternalHandlers();
|
1779
|
-
if (!onShowHandlers) {
|
1780
|
-
onShowHandlers = [];
|
1781
|
-
}
|
1782
|
-
onShowHandlers.push(fn);
|
1783
|
-
setInternalHandlers({ onShowHandlers });
|
1784
|
-
}
|
1785
|
-
/**
|
1786
|
-
* アクションがクローズ (close) される前にフックする関数
|
1907
|
+
* @param App - Svelte コンポーネントのエントリポイント
|
1908
|
+
* @param options - {@link ActionOptions | オプション}
|
1787
1909
|
*
|
1788
|
-
* @
|
1910
|
+
* @returns アクションを破棄する関数
|
1789
1911
|
*
|
1790
1912
|
* @public
|
1791
1913
|
*/
|
1792
|
-
function
|
1793
|
-
|
1794
|
-
|
1795
|
-
|
1914
|
+
function create(App, options = {
|
1915
|
+
send: () => { },
|
1916
|
+
publish: () => { },
|
1917
|
+
props: {},
|
1918
|
+
variables: {},
|
1919
|
+
localVariablesQuery: undefined,
|
1920
|
+
karteTemplate: {},
|
1921
|
+
}) {
|
1922
|
+
const data = {
|
1923
|
+
...options.props,
|
1924
|
+
...options.variables,
|
1925
|
+
...getVariables(),
|
1926
|
+
};
|
1927
|
+
const actionProps = {
|
1928
|
+
send: options.send,
|
1929
|
+
publish: options.publish,
|
1930
|
+
data,
|
1931
|
+
};
|
1932
|
+
const handleDestroy = () => {
|
1933
|
+
const { onDestroyHandlers } = getInternalHandlers();
|
1934
|
+
onDestroyHandlers?.forEach(h => {
|
1935
|
+
const actionHookLog = { name: 'onDestroy' };
|
1936
|
+
console.info(`${ACTION_HOOK_LABEL}:${JSON.stringify(actionHookLog)}`);
|
1937
|
+
h(actionProps);
|
1938
|
+
});
|
1939
|
+
// 旧Widget APIの内部で利用するため、実行ログは出力しない
|
1940
|
+
const { onDestroyHandlers: onDestroyWidgetHandlers } = getWidgetHandlers();
|
1941
|
+
if (onDestroyWidgetHandlers) {
|
1942
|
+
onDestroyWidgetHandlers.forEach(h => h(actionProps));
|
1943
|
+
}
|
1944
|
+
};
|
1945
|
+
// ここからメインの処理
|
1946
|
+
setSystem({
|
1947
|
+
// @ts-ignore
|
1948
|
+
apiKey: data.api_key || null,
|
1949
|
+
shortenId: data.shorten_id || null,
|
1950
|
+
campaignId: data.campaign_id || null,
|
1951
|
+
});
|
1952
|
+
window.addEventListener(ACTION_DESTROY_EVENT, handleDestroy);
|
1953
|
+
window.addEventListener('beforeunload', dispatchDestroyEvent, false);
|
1954
|
+
let modalCleanup = NOOP;
|
1955
|
+
if (options.karteTemplate?.template_type === 'script') {
|
1956
|
+
runScript$1(options);
|
1796
1957
|
}
|
1797
|
-
|
1798
|
-
|
1799
|
-
}
|
1800
|
-
/**
|
1801
|
-
* アクションのステートが変更された (changeState) 後にフックする関数
|
1802
|
-
*
|
1803
|
-
* @param fn - 呼び出されるフック関数
|
1804
|
-
*
|
1805
|
-
* @public
|
1806
|
-
*/
|
1807
|
-
function onChangeState(fn) {
|
1808
|
-
let { onChangeStateHandlers } = getInternalHandlers();
|
1809
|
-
if (!onChangeStateHandlers) {
|
1810
|
-
onChangeStateHandlers = [];
|
1958
|
+
else {
|
1959
|
+
modalCleanup = createModal(App, options);
|
1811
1960
|
}
|
1812
|
-
|
1813
|
-
|
1814
|
-
|
1815
|
-
|
1816
|
-
* アクションを表示する
|
1817
|
-
*
|
1818
|
-
* @public
|
1819
|
-
*/
|
1820
|
-
function showAction() {
|
1821
|
-
const event = new CustomEvent(ACTION_SHOW_EVENT, { detail: { trigger: 'custom' } });
|
1822
|
-
window.dispatchEvent(event);
|
1823
|
-
}
|
1824
|
-
/**
|
1825
|
-
* アクションを閉じる
|
1826
|
-
*
|
1827
|
-
* @param trigger - 閉じた時のトリガー。デフォルト `'none'`
|
1828
|
-
*
|
1829
|
-
* @public
|
1830
|
-
*/
|
1831
|
-
function closeAction(trigger = 'none') {
|
1832
|
-
const event = new CustomEvent(ACTION_CLOSE_EVENT, { detail: { trigger } });
|
1833
|
-
window.dispatchEvent(event);
|
1961
|
+
return () => {
|
1962
|
+
modalCleanup();
|
1963
|
+
window.removeEventListener(ACTION_DESTROY_EVENT, handleDestroy);
|
1964
|
+
};
|
1834
1965
|
}
|
1835
1966
|
/**
|
1836
|
-
*
|
1837
|
-
*
|
1838
|
-
* @param css - 適用する CSS
|
1839
|
-
*
|
1840
|
-
* @returns 適用された style 要素を返す Promise
|
1967
|
+
* アクションの破棄する
|
1841
1968
|
*
|
1842
1969
|
* @public
|
1843
1970
|
*/
|
1844
|
-
|
1845
|
-
|
1846
|
-
|
1847
|
-
style.textContent = css;
|
1848
|
-
const shadowRoot = getActionRoot();
|
1849
|
-
if (!shadowRoot)
|
1850
|
-
return;
|
1851
|
-
shadowRoot.append(style);
|
1852
|
-
style.addEventListener('load', () => resolve(style));
|
1853
|
-
style.addEventListener('error', () => reject(style));
|
1854
|
-
});
|
1855
|
-
}
|
1856
|
-
async function fixFontFaceIssue(href, cssRules) {
|
1857
|
-
const css = new CSSStyleSheet();
|
1858
|
-
// @ts-ignore
|
1859
|
-
await css.replace(cssRules);
|
1860
|
-
const rules = [];
|
1861
|
-
const fixedRules = [];
|
1862
|
-
Array.from(css.cssRules).forEach(cssRule => {
|
1863
|
-
if (cssRule.type !== 5) {
|
1864
|
-
rules.push(cssRule.cssText);
|
1865
|
-
}
|
1866
|
-
// type 5 is @font-face
|
1867
|
-
const split = href.split('/');
|
1868
|
-
const stylePath = split.slice(0, split.length - 1).join('/');
|
1869
|
-
const cssText = cssRule.cssText;
|
1870
|
-
const newCssText = cssText.replace(
|
1871
|
-
// relative paths
|
1872
|
-
/url\s*\(\s*['"]?(?!((\/)|((?:https?:)?\/\/)|(?:data:?:)))([^'")]+)['"]?\s*\)/g, `url("${stylePath}/$4")`);
|
1873
|
-
if (cssText === newCssText)
|
1874
|
-
return;
|
1875
|
-
fixedRules.push(newCssText);
|
1876
|
-
});
|
1877
|
-
return [rules.join('\n'), fixedRules.join('\n')];
|
1971
|
+
function destroyAction() {
|
1972
|
+
setDestroyed(true);
|
1973
|
+
dispatchDestroyEvent();
|
1878
1974
|
}
|
1879
1975
|
/**
|
1880
|
-
*
|
1976
|
+
* アクションが作成 (create) される前にフックする関数
|
1881
1977
|
*
|
1882
|
-
* @param
|
1978
|
+
* @param fn - 呼び出されるフック関数
|
1883
1979
|
*
|
1884
1980
|
* @public
|
1885
1981
|
*/
|
1886
|
-
|
1887
|
-
|
1888
|
-
if (!
|
1889
|
-
|
1890
|
-
let cssRules = '';
|
1891
|
-
try {
|
1892
|
-
const res = await fetch(href);
|
1893
|
-
cssRules = await res.text();
|
1894
|
-
}
|
1895
|
-
catch (e) {
|
1896
|
-
// pass
|
1982
|
+
function onCreate(fn) {
|
1983
|
+
let { onCreateHandlers } = getInternalHandlers();
|
1984
|
+
if (!onCreateHandlers) {
|
1985
|
+
onCreateHandlers = [];
|
1897
1986
|
}
|
1898
|
-
|
1899
|
-
|
1900
|
-
// Chromeのバグで、Shadow Rootの@font-faceを絶対パスで指定する必要がある
|
1901
|
-
// @see https://stackoverflow.com/a/63717709
|
1902
|
-
const [rules, fontFaceRules] = await fixFontFaceIssue(href, cssRules);
|
1903
|
-
const css = new CSSStyleSheet();
|
1904
|
-
// @ts-ignore
|
1905
|
-
await css.replace(rules);
|
1906
|
-
const fontFaceCss = new CSSStyleSheet();
|
1907
|
-
// @ts-ignore
|
1908
|
-
await fontFaceCss.replace(fontFaceRules);
|
1909
|
-
// @ts-ignore
|
1910
|
-
sr.adoptedStyleSheets = [...sr.adoptedStyleSheets, css, fontFaceCss];
|
1911
|
-
// Chromeのバグで、ページとShadow Rootの両方に、@font-faceを設定する必要がある
|
1912
|
-
// @see https://stackoverflow.com/a/63717709
|
1913
|
-
// @ts-ignore
|
1914
|
-
document.adoptedStyleSheets = [...document.adoptedStyleSheets, css, fontFaceCss];
|
1915
|
-
}
|
1916
|
-
// @internal
|
1917
|
-
function getCssVariables(data) {
|
1918
|
-
return Object.entries(data)
|
1919
|
-
.filter(([key, value]) => {
|
1920
|
-
return ['string', 'number'].includes(typeof value) && key.startsWith('--');
|
1921
|
-
})
|
1922
|
-
.map(([key, value]) => `${key}:${value}`)
|
1923
|
-
.join(';');
|
1987
|
+
onCreateHandlers.push(fn);
|
1988
|
+
setInternalHandlers({ onCreateHandlers });
|
1924
1989
|
}
|
1925
1990
|
/**
|
1926
|
-
*
|
1991
|
+
* アクションが破棄 (destroy) される前にフックする関数
|
1927
1992
|
*
|
1928
|
-
* @
|
1993
|
+
* @param fn - 呼び出されるフック関数
|
1929
1994
|
*
|
1930
1995
|
* @public
|
1931
1996
|
*/
|
1932
|
-
function
|
1933
|
-
|
1934
|
-
if (!
|
1935
|
-
|
1997
|
+
function onDestroy(fn) {
|
1998
|
+
let { onDestroyHandlers } = getInternalHandlers();
|
1999
|
+
if (!onDestroyHandlers) {
|
2000
|
+
onDestroyHandlers = [];
|
1936
2001
|
}
|
1937
|
-
|
2002
|
+
onDestroyHandlers.push(fn);
|
2003
|
+
setInternalHandlers({ onDestroyHandlers });
|
1938
2004
|
}
|
1939
2005
|
// -------- The following codes are deprecated --------
|
1940
2006
|
/**
|
@@ -1944,7 +2010,7 @@ function getActionRoot() {
|
|
1944
2010
|
*
|
1945
2011
|
* @internal
|
1946
2012
|
*/
|
1947
|
-
const
|
2013
|
+
const showModal = create;
|
1948
2014
|
/**
|
1949
2015
|
* 非推奨
|
1950
2016
|
*
|
@@ -1952,7 +2018,10 @@ const show = showAction;
|
|
1952
2018
|
*
|
1953
2019
|
* @internal
|
1954
2020
|
*/
|
1955
|
-
|
2021
|
+
function destroy() {
|
2022
|
+
setDestroyed(true);
|
2023
|
+
dispatchDestroyEvent();
|
2024
|
+
}
|
1956
2025
|
|
1957
2026
|
/**
|
1958
2027
|
* エディタv1のWidget API 互換のインターフェース
|
@@ -2805,13 +2874,13 @@ function customAnimation(node, { transform, animationStyle, delay = 0, duration
|
|
2805
2874
|
};
|
2806
2875
|
}
|
2807
2876
|
|
2808
|
-
/* src/components/
|
2877
|
+
/* src/components/BackgroundOverlay.svelte generated by Svelte v3.53.1 */
|
2809
2878
|
|
2810
2879
|
function add_css$s(target) {
|
2811
2880
|
append_styles(target, "svelte-1d4fta", ".background.svelte-1d4fta{position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0, 0, 0, 0.3);z-index:2147483646}");
|
2812
2881
|
}
|
2813
2882
|
|
2814
|
-
// (9:0) {#if
|
2883
|
+
// (9:0) {#if backgroundOverlay}
|
2815
2884
|
function create_if_block$7(ctx) {
|
2816
2885
|
let div;
|
2817
2886
|
let mounted;
|
@@ -2841,7 +2910,7 @@ function create_if_block$7(ctx) {
|
|
2841
2910
|
|
2842
2911
|
function create_fragment$v(ctx) {
|
2843
2912
|
let if_block_anchor;
|
2844
|
-
let if_block = /*
|
2913
|
+
let if_block = /*backgroundOverlay*/ ctx[0] && create_if_block$7(ctx);
|
2845
2914
|
|
2846
2915
|
return {
|
2847
2916
|
c() {
|
@@ -2853,7 +2922,7 @@ function create_fragment$v(ctx) {
|
|
2853
2922
|
insert(target, if_block_anchor, anchor);
|
2854
2923
|
},
|
2855
2924
|
p(ctx, [dirty]) {
|
2856
|
-
if (/*
|
2925
|
+
if (/*backgroundOverlay*/ ctx[0]) {
|
2857
2926
|
if (if_block) {
|
2858
2927
|
if_block.p(ctx, dirty);
|
2859
2928
|
} else {
|
@@ -2876,21 +2945,21 @@ function create_fragment$v(ctx) {
|
|
2876
2945
|
}
|
2877
2946
|
|
2878
2947
|
function instance$v($$self, $$props, $$invalidate) {
|
2879
|
-
let {
|
2948
|
+
let { backgroundOverlay = false } = $$props;
|
2880
2949
|
const dispatch = createEventDispatcher();
|
2881
2950
|
const click_handler = () => dispatch('click');
|
2882
2951
|
|
2883
2952
|
$$self.$$set = $$props => {
|
2884
|
-
if ('
|
2953
|
+
if ('backgroundOverlay' in $$props) $$invalidate(0, backgroundOverlay = $$props.backgroundOverlay);
|
2885
2954
|
};
|
2886
2955
|
|
2887
|
-
return [
|
2956
|
+
return [backgroundOverlay, dispatch, click_handler];
|
2888
2957
|
}
|
2889
2958
|
|
2890
|
-
class
|
2959
|
+
class BackgroundOverlay extends SvelteComponent {
|
2891
2960
|
constructor(options) {
|
2892
2961
|
super();
|
2893
|
-
init(this, options, instance$v, create_fragment$v, safe_not_equal, {
|
2962
|
+
init(this, options, instance$v, create_fragment$v, safe_not_equal, { backgroundOverlay: 0 }, add_css$s);
|
2894
2963
|
}
|
2895
2964
|
}
|
2896
2965
|
|
@@ -3603,20 +3672,20 @@ function create_default_slot$6(ctx) {
|
|
3603
3672
|
}
|
3604
3673
|
|
3605
3674
|
function create_fragment$t(ctx) {
|
3606
|
-
let
|
3675
|
+
let backgroundoverlay;
|
3607
3676
|
let t;
|
3608
3677
|
let if_block_anchor;
|
3609
3678
|
let current;
|
3610
3679
|
let mounted;
|
3611
3680
|
let dispose;
|
3612
3681
|
|
3613
|
-
|
3682
|
+
backgroundoverlay = new BackgroundOverlay({
|
3614
3683
|
props: {
|
3615
|
-
|
3684
|
+
backgroundOverlay: /*backgroundOverlay*/ ctx[10]
|
3616
3685
|
}
|
3617
3686
|
});
|
3618
3687
|
|
3619
|
-
|
3688
|
+
backgroundoverlay.$on("click", function () {
|
3620
3689
|
if (is_function(/*backgroundClick*/ ctx[18])) /*backgroundClick*/ ctx[18].apply(this, arguments);
|
3621
3690
|
});
|
3622
3691
|
|
@@ -3624,13 +3693,13 @@ function create_fragment$t(ctx) {
|
|
3624
3693
|
|
3625
3694
|
return {
|
3626
3695
|
c() {
|
3627
|
-
create_component(
|
3696
|
+
create_component(backgroundoverlay.$$.fragment);
|
3628
3697
|
t = space();
|
3629
3698
|
if (if_block) if_block.c();
|
3630
3699
|
if_block_anchor = empty();
|
3631
3700
|
},
|
3632
3701
|
m(target, anchor) {
|
3633
|
-
mount_component(
|
3702
|
+
mount_component(backgroundoverlay, target, anchor);
|
3634
3703
|
insert(target, t, anchor);
|
3635
3704
|
if (if_block) if_block.m(target, anchor);
|
3636
3705
|
insert(target, if_block_anchor, anchor);
|
@@ -3646,9 +3715,9 @@ function create_fragment$t(ctx) {
|
|
3646
3715
|
},
|
3647
3716
|
p(new_ctx, [dirty]) {
|
3648
3717
|
ctx = new_ctx;
|
3649
|
-
const
|
3650
|
-
if (dirty & /*
|
3651
|
-
|
3718
|
+
const backgroundoverlay_changes = {};
|
3719
|
+
if (dirty & /*backgroundOverlay*/ 1024) backgroundoverlay_changes.backgroundOverlay = /*backgroundOverlay*/ ctx[10];
|
3720
|
+
backgroundoverlay.$set(backgroundoverlay_changes);
|
3652
3721
|
|
3653
3722
|
if (/*visible*/ ctx[12]) {
|
3654
3723
|
if (if_block) {
|
@@ -3675,17 +3744,17 @@ function create_fragment$t(ctx) {
|
|
3675
3744
|
},
|
3676
3745
|
i(local) {
|
3677
3746
|
if (current) return;
|
3678
|
-
transition_in(
|
3747
|
+
transition_in(backgroundoverlay.$$.fragment, local);
|
3679
3748
|
transition_in(if_block);
|
3680
3749
|
current = true;
|
3681
3750
|
},
|
3682
3751
|
o(local) {
|
3683
|
-
transition_out(
|
3752
|
+
transition_out(backgroundoverlay.$$.fragment, local);
|
3684
3753
|
transition_out(if_block);
|
3685
3754
|
current = false;
|
3686
3755
|
},
|
3687
3756
|
d(detaching) {
|
3688
|
-
destroy_component(
|
3757
|
+
destroy_component(backgroundoverlay, detaching);
|
3689
3758
|
if (detaching) detach(t);
|
3690
3759
|
if (if_block) if_block.d(detaching);
|
3691
3760
|
if (detaching) detach(if_block_anchor);
|
@@ -3722,7 +3791,7 @@ function instance$t($$self, $$props, $$invalidate) {
|
|
3722
3791
|
let { closeEventValue = null } = $$props;
|
3723
3792
|
let { closeButtonColor = '#000000' } = $$props;
|
3724
3793
|
let { _closeStyle = '' } = $$props;
|
3725
|
-
let
|
3794
|
+
let backgroundOverlay = DefaultModalPlacement.backgroundOverlay;
|
3726
3795
|
let backgroundClickFunction = DefaultModalPlacement.backgroundClick;
|
3727
3796
|
let modal;
|
3728
3797
|
|
@@ -3773,7 +3842,7 @@ function instance$t($$self, $$props, $$invalidate) {
|
|
3773
3842
|
if ($$self.$$.dirty & /*placement*/ 2097152) {
|
3774
3843
|
{
|
3775
3844
|
if (placement && placement.backgroundOverlay) {
|
3776
|
-
$$invalidate(10,
|
3845
|
+
$$invalidate(10, backgroundOverlay = placement.backgroundOverlay);
|
3777
3846
|
}
|
3778
3847
|
}
|
3779
3848
|
}
|
@@ -3845,7 +3914,7 @@ function instance$t($$self, $$props, $$invalidate) {
|
|
3845
3914
|
closeEventValue,
|
3846
3915
|
closeButtonColor,
|
3847
3916
|
_closeStyle,
|
3848
|
-
|
3917
|
+
backgroundOverlay,
|
3849
3918
|
modal,
|
3850
3919
|
visible,
|
3851
3920
|
handle_keydown,
|