@plaidev/karte-action-sdk 1.1.267-29071733.fabf64a6 → 1.1.267-29082453.379cb476
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.js +65 -75
- package/dist/index.es.js +65 -86
- package/dist/svelte5/hydrate/index.es.d.ts +1 -1
- package/dist/svelte5/hydrate/index.es.js +57 -29
- package/dist/svelte5/index.es.d.ts +1 -1
- package/dist/svelte5/index.es.js +39 -26
- package/dist/svelte5/index.front2.es.js +39 -26
- package/package.json +1 -1
package/dist/svelte5/index.es.js
CHANGED
@@ -38,9 +38,15 @@ const KARTE_MODAL_ROOT = 'karte-modal-root';
|
|
38
38
|
/** @internal */
|
39
39
|
const NOOP = (_args) => { }; // eslint-disable-line @typescript-eslint/no-unused-vars
|
40
40
|
/** @internal */
|
41
|
-
const isPreview = () =>
|
42
|
-
|
43
|
-
|
41
|
+
const isPreview = () => (isInFrame() );
|
42
|
+
const isCanvasPreview = () => typeof document !== 'undefined'
|
43
|
+
? (document?.querySelector('#preview')?.getAttribute('data-canvas-preview') ?? 'false') ===
|
44
|
+
'true'
|
45
|
+
: false;
|
46
|
+
const isOnSite = () => typeof document !== 'undefined'
|
47
|
+
? (document?.querySelector('#preview')?.getAttribute('data-on-site') ?? 'true') === 'true'
|
48
|
+
: true;
|
49
|
+
const isInFrame = () => window && window.self !== window.top;
|
44
50
|
/** @internal */
|
45
51
|
const setPreviousFocus = () => {
|
46
52
|
const previously_focused = typeof document !== 'undefined' && document.activeElement;
|
@@ -758,6 +764,8 @@ const state = writable('/');
|
|
758
764
|
* @public
|
759
765
|
*/
|
760
766
|
function setState$1(stateId, options) {
|
767
|
+
if (isPreview() && options?.disableInPreview)
|
768
|
+
return;
|
761
769
|
state.set(stateId);
|
762
770
|
}
|
763
771
|
/**
|
@@ -1168,7 +1176,9 @@ function cloneToJson(data) {
|
|
1168
1176
|
|
1169
1177
|
// prettier-ignore
|
1170
1178
|
/** @internal */
|
1171
|
-
const actionId =
|
1179
|
+
const actionId = isPreview()
|
1180
|
+
? ALL_ACTION_ID
|
1181
|
+
: typeof __FLYER_GEN_ACTION_ID_ON_BUILD__ === 'string'
|
1172
1182
|
? __FLYER_GEN_ACTION_ID_ON_BUILD__
|
1173
1183
|
: randStr();
|
1174
1184
|
/** @internal */
|
@@ -1576,7 +1586,9 @@ const loadActionTableQuery = async (config, data, api_key, collection_endpoint)
|
|
1576
1586
|
/** @internal */
|
1577
1587
|
const loadActionTable = async (config, data, api_key, collection_endpoint) => {
|
1578
1588
|
console.debug('[debug] loadActionTable', isPreview(), api_key, collection_endpoint, JSON.stringify(config));
|
1579
|
-
const results =
|
1589
|
+
const results = isPreview()
|
1590
|
+
? config.map(c => c.preview_value)
|
1591
|
+
: await Promise.all(config
|
1580
1592
|
.filter(c => c.resolver === 'action-table-row' ||
|
1581
1593
|
c.resolver === 'action-table-rows' ||
|
1582
1594
|
c.resolver === 'action-table-query')
|
@@ -1724,6 +1736,7 @@ function createModal(App, options = {
|
|
1724
1736
|
close(trigger);
|
1725
1737
|
};
|
1726
1738
|
const show = async (trigger = 'none') => {
|
1739
|
+
console.log('show trigger', trigger);
|
1727
1740
|
if (app) {
|
1728
1741
|
return;
|
1729
1742
|
}
|
@@ -2302,7 +2315,8 @@ function getActionRoot() {
|
|
2302
2315
|
return root.shadowRoot;
|
2303
2316
|
}
|
2304
2317
|
/** @internal */
|
2305
|
-
function ensureActionRoot() {
|
2318
|
+
function ensureActionRoot(useShadow = true) {
|
2319
|
+
console.log('useShadow', useShadow);
|
2306
2320
|
const systemConfig = getSystem();
|
2307
2321
|
const rootAttrs = {
|
2308
2322
|
class: `${KARTE_ACTION_ROOT} ${KARTE_MODAL_ROOT}`,
|
@@ -2313,11 +2327,13 @@ function ensureActionRoot() {
|
|
2313
2327
|
style: { display: 'block' },
|
2314
2328
|
};
|
2315
2329
|
let el = document.querySelector(`.${KARTE_MODAL_ROOT}[data-${KARTE_ACTION_RID}='${actionId}']`);
|
2330
|
+
console.log('el', el);
|
2316
2331
|
if (el == null) {
|
2317
2332
|
el = h('div', rootAttrs);
|
2318
2333
|
document.body.appendChild(el);
|
2319
2334
|
}
|
2320
|
-
const isShadow = !!document.body.attachShadow;
|
2335
|
+
const isShadow = !!document.body.attachShadow && useShadow;
|
2336
|
+
console.log('isShadow', isShadow);
|
2321
2337
|
if (isShadow) {
|
2322
2338
|
return el.shadowRoot ?? el.attachShadow({ mode: 'open' });
|
2323
2339
|
}
|
@@ -2386,7 +2402,7 @@ function createApp(App, options = {
|
|
2386
2402
|
},
|
2387
2403
|
},
|
2388
2404
|
};
|
2389
|
-
const win = ensureModalRoot();
|
2405
|
+
const win = ensureModalRoot(true);
|
2390
2406
|
appArgs.target = win;
|
2391
2407
|
return {
|
2392
2408
|
close,
|
@@ -2906,7 +2922,10 @@ function Header($$anchor, $$props) {
|
|
2906
2922
|
$fonts()
|
2907
2923
|
),
|
2908
2924
|
() => {
|
2909
|
-
if (
|
2925
|
+
if (isPreview()) {
|
2926
|
+
// フォントのロードが遅れてエディタのプレビューがガタつく対策
|
2927
|
+
$.set(googleFontUrl, makeGoogleFontUrl(Fonts.filter((font) => font !== SYSTEM_FONT)));
|
2928
|
+
} else if ($fonts().length > 0) {
|
2910
2929
|
$.set(googleFontUrl, makeGoogleFontUrl($fonts()));
|
2911
2930
|
}
|
2912
2931
|
}
|
@@ -3467,7 +3486,7 @@ const EASING = {
|
|
3467
3486
|
none: linear,
|
3468
3487
|
};
|
3469
3488
|
/**
|
3470
|
-
* The function to activate svelte animation
|
3489
|
+
* The function to activate svelte animation.
|
3471
3490
|
*
|
3472
3491
|
* @param node - A target node of animation. This argument is passed by svelte, by default.
|
3473
3492
|
* @param customAnimationOptions - A custom animation option object
|
@@ -3476,8 +3495,8 @@ const EASING = {
|
|
3476
3495
|
*
|
3477
3496
|
* @internal
|
3478
3497
|
*/
|
3479
|
-
function
|
3480
|
-
if (
|
3498
|
+
function customAnimation(node, { transforms, animationStyle, delay = 0, duration = 1000 }) {
|
3499
|
+
if (!isOnSite()) {
|
3481
3500
|
return {};
|
3482
3501
|
}
|
3483
3502
|
let [x, y] = [0, 0];
|
@@ -6360,11 +6379,6 @@ function Modal($$anchor, $$props) {
|
|
6360
6379
|
let closeEventValue = $.prop($$props, 'closeEventValue', 8, null);
|
6361
6380
|
let layerId = $.prop($$props, 'layerId', 8, '');
|
6362
6381
|
const { brandKit } = useBrandKit();
|
6363
|
-
const isCanvasPreview = (document.querySelector('#preview')?.getAttribute('data-canvas-preview') ?? 'false') === 'true';
|
6364
|
-
const isOnSite = (document.querySelector('#preview')?.getAttribute('data-on-site') ?? 'true') === 'true';
|
6365
|
-
|
6366
|
-
console.log('isOnSite', isOnSite);
|
6367
|
-
|
6368
6382
|
// モーダル背景の設定
|
6369
6383
|
const isExistBackgroundOverlayValue = placement() && placement().backgroundOverlay !== undefined;
|
6370
6384
|
let backgroundOverlay = $.mutable_state(DefaultModalPlacement.backgroundOverlay);
|
@@ -6410,7 +6424,7 @@ function Modal($$anchor, $$props) {
|
|
6410
6424
|
$.deep_read_state(breakPoint())
|
6411
6425
|
),
|
6412
6426
|
() => {
|
6413
|
-
if (!isCanvasPreview && isExistBackgroundOverlayValue) {
|
6427
|
+
if (!isCanvasPreview() && isExistBackgroundOverlayValue) {
|
6414
6428
|
$.set(backgroundOverlay, placement().backgroundOverlay);
|
6415
6429
|
}
|
6416
6430
|
|
@@ -6516,7 +6530,7 @@ function Modal($$anchor, $$props) {
|
|
6516
6530
|
// 表示位置のスタイルの設定
|
6517
6531
|
let position = DefaultModalPlacement.position;
|
6518
6532
|
|
6519
|
-
if (!isCanvasPreview && placement() && placement().position !== null) {
|
6533
|
+
if (!isCanvasPreview() && placement() && placement().position !== null) {
|
6520
6534
|
position = placement().position;
|
6521
6535
|
}
|
6522
6536
|
|
@@ -6533,7 +6547,7 @@ function Modal($$anchor, $$props) {
|
|
6533
6547
|
$.set(transforms, []);
|
6534
6548
|
|
6535
6549
|
DEVICE_IDS.forEach((deviceId) => {
|
6536
|
-
if (!isCanvasPreview && useBreakPoint()) {
|
6550
|
+
if (!isCanvasPreview() && useBreakPoint()) {
|
6537
6551
|
const positionWithBp = breakPoint()[deviceId]?.placement?.position;
|
6538
6552
|
|
6539
6553
|
$.get(transforms).push({
|
@@ -6569,7 +6583,7 @@ function Modal($$anchor, $$props) {
|
|
6569
6583
|
() => {
|
6570
6584
|
let margin = DefaultModalPlacement.margin;
|
6571
6585
|
|
6572
|
-
if (!isCanvasPreview && placement() && placement().margin !== null) {
|
6586
|
+
if (!isCanvasPreview() && placement() && placement().margin !== null) {
|
6573
6587
|
margin = placement().margin;
|
6574
6588
|
}
|
6575
6589
|
|
@@ -6580,7 +6594,7 @@ function Modal($$anchor, $$props) {
|
|
6580
6594
|
}
|
6581
6595
|
|
6582
6596
|
DEVICE_IDS.forEach((deviceId) => {
|
6583
|
-
if (!isCanvasPreview && useBreakPoint()) {
|
6597
|
+
if (!isCanvasPreview() && useBreakPoint()) {
|
6584
6598
|
const marginWithBp = breakPoint()[deviceId]?.placement?.margin;
|
6585
6599
|
|
6586
6600
|
marginStyle = getMarginStyle(marginWithBp);
|
@@ -6694,7 +6708,7 @@ function Modal($$anchor, $$props) {
|
|
6694
6708
|
};
|
6695
6709
|
|
6696
6710
|
$.if(node, ($$render) => {
|
6697
|
-
if (isCanvasPreview) $$render(consequent); else $$render(alternate, false);
|
6711
|
+
if (isCanvasPreview()) $$render(consequent); else $$render(alternate, false);
|
6698
6712
|
});
|
6699
6713
|
}
|
6700
6714
|
|
@@ -6725,10 +6739,9 @@ function Modal($$anchor, $$props) {
|
|
6725
6739
|
$.derived_safe_equal
|
6726
6740
|
);
|
6727
6741
|
|
6728
|
-
$.transition(1, div, () =>
|
6742
|
+
$.transition(1, div, () => customAnimation, () => ({
|
6729
6743
|
transforms: $.get(transforms),
|
6730
|
-
animationStyle: animation()
|
6731
|
-
disabled: !isOnSite
|
6744
|
+
animationStyle: animation()
|
6732
6745
|
}));
|
6733
6746
|
|
6734
6747
|
$.append($$anchor, div);
|
@@ -38,9 +38,15 @@ const KARTE_MODAL_ROOT = 'karte-modal-root';
|
|
38
38
|
/** @internal */
|
39
39
|
const NOOP = (_args) => { }; // eslint-disable-line @typescript-eslint/no-unused-vars
|
40
40
|
/** @internal */
|
41
|
-
const isPreview = () =>
|
42
|
-
|
43
|
-
|
41
|
+
const isPreview = () => (isInFrame() );
|
42
|
+
const isCanvasPreview = () => typeof document !== 'undefined'
|
43
|
+
? (document?.querySelector('#preview')?.getAttribute('data-canvas-preview') ?? 'false') ===
|
44
|
+
'true'
|
45
|
+
: false;
|
46
|
+
const isOnSite = () => typeof document !== 'undefined'
|
47
|
+
? (document?.querySelector('#preview')?.getAttribute('data-on-site') ?? 'true') === 'true'
|
48
|
+
: true;
|
49
|
+
const isInFrame = () => window && window.self !== window.top;
|
44
50
|
/** @internal */
|
45
51
|
const setPreviousFocus = () => {
|
46
52
|
const previously_focused = typeof document !== 'undefined' && document.activeElement;
|
@@ -758,6 +764,8 @@ const state = writable('/');
|
|
758
764
|
* @public
|
759
765
|
*/
|
760
766
|
function setState$1(stateId, options) {
|
767
|
+
if (isPreview() && options?.disableInPreview)
|
768
|
+
return;
|
761
769
|
state.set(stateId);
|
762
770
|
}
|
763
771
|
/**
|
@@ -1168,7 +1176,9 @@ function cloneToJson(data) {
|
|
1168
1176
|
|
1169
1177
|
// prettier-ignore
|
1170
1178
|
/** @internal */
|
1171
|
-
const actionId =
|
1179
|
+
const actionId = isPreview()
|
1180
|
+
? ALL_ACTION_ID
|
1181
|
+
: typeof __FLYER_GEN_ACTION_ID_ON_BUILD__ === 'string'
|
1172
1182
|
? __FLYER_GEN_ACTION_ID_ON_BUILD__
|
1173
1183
|
: randStr();
|
1174
1184
|
/** @internal */
|
@@ -1576,7 +1586,9 @@ const loadActionTableQuery = async (config, data, api_key, collection_endpoint)
|
|
1576
1586
|
/** @internal */
|
1577
1587
|
const loadActionTable = async (config, data, api_key, collection_endpoint) => {
|
1578
1588
|
console.debug('[debug] loadActionTable', isPreview(), api_key, collection_endpoint, JSON.stringify(config));
|
1579
|
-
const results =
|
1589
|
+
const results = isPreview()
|
1590
|
+
? config.map(c => c.preview_value)
|
1591
|
+
: await Promise.all(config
|
1580
1592
|
.filter(c => c.resolver === 'action-table-row' ||
|
1581
1593
|
c.resolver === 'action-table-rows' ||
|
1582
1594
|
c.resolver === 'action-table-query')
|
@@ -1724,6 +1736,7 @@ function createModal(App, options = {
|
|
1724
1736
|
close(trigger);
|
1725
1737
|
};
|
1726
1738
|
const show = async (trigger = 'none') => {
|
1739
|
+
console.log('show trigger', trigger);
|
1727
1740
|
if (app) {
|
1728
1741
|
return;
|
1729
1742
|
}
|
@@ -2302,7 +2315,8 @@ function getActionRoot() {
|
|
2302
2315
|
return root.shadowRoot;
|
2303
2316
|
}
|
2304
2317
|
/** @internal */
|
2305
|
-
function ensureActionRoot() {
|
2318
|
+
function ensureActionRoot(useShadow = true) {
|
2319
|
+
console.log('useShadow', useShadow);
|
2306
2320
|
const systemConfig = getSystem();
|
2307
2321
|
const rootAttrs = {
|
2308
2322
|
class: `${KARTE_ACTION_ROOT} ${KARTE_MODAL_ROOT}`,
|
@@ -2313,11 +2327,13 @@ function ensureActionRoot() {
|
|
2313
2327
|
style: { display: 'block' },
|
2314
2328
|
};
|
2315
2329
|
let el = document.querySelector(`.${KARTE_MODAL_ROOT}[data-${KARTE_ACTION_RID}='${actionId}']`);
|
2330
|
+
console.log('el', el);
|
2316
2331
|
if (el == null) {
|
2317
2332
|
el = h('div', rootAttrs);
|
2318
2333
|
document.body.appendChild(el);
|
2319
2334
|
}
|
2320
|
-
const isShadow = !!document.body.attachShadow;
|
2335
|
+
const isShadow = !!document.body.attachShadow && useShadow;
|
2336
|
+
console.log('isShadow', isShadow);
|
2321
2337
|
if (isShadow) {
|
2322
2338
|
return el.shadowRoot ?? el.attachShadow({ mode: 'open' });
|
2323
2339
|
}
|
@@ -2386,7 +2402,7 @@ function createApp(App, options = {
|
|
2386
2402
|
},
|
2387
2403
|
},
|
2388
2404
|
};
|
2389
|
-
const win = ensureModalRoot();
|
2405
|
+
const win = ensureModalRoot(true);
|
2390
2406
|
appArgs.target = win;
|
2391
2407
|
return {
|
2392
2408
|
close,
|
@@ -2906,7 +2922,10 @@ function Header($$anchor, $$props) {
|
|
2906
2922
|
$fonts()
|
2907
2923
|
),
|
2908
2924
|
() => {
|
2909
|
-
if (
|
2925
|
+
if (isPreview()) {
|
2926
|
+
// フォントのロードが遅れてエディタのプレビューがガタつく対策
|
2927
|
+
$.set(googleFontUrl, makeGoogleFontUrl(Fonts.filter((font) => font !== SYSTEM_FONT)));
|
2928
|
+
} else if ($fonts().length > 0) {
|
2910
2929
|
$.set(googleFontUrl, makeGoogleFontUrl($fonts()));
|
2911
2930
|
}
|
2912
2931
|
}
|
@@ -3467,7 +3486,7 @@ const EASING = {
|
|
3467
3486
|
none: linear,
|
3468
3487
|
};
|
3469
3488
|
/**
|
3470
|
-
* The function to activate svelte animation
|
3489
|
+
* The function to activate svelte animation.
|
3471
3490
|
*
|
3472
3491
|
* @param node - A target node of animation. This argument is passed by svelte, by default.
|
3473
3492
|
* @param customAnimationOptions - A custom animation option object
|
@@ -3476,8 +3495,8 @@ const EASING = {
|
|
3476
3495
|
*
|
3477
3496
|
* @internal
|
3478
3497
|
*/
|
3479
|
-
function
|
3480
|
-
if (
|
3498
|
+
function customAnimation(node, { transforms, animationStyle, delay = 0, duration = 1000 }) {
|
3499
|
+
if (!isOnSite()) {
|
3481
3500
|
return {};
|
3482
3501
|
}
|
3483
3502
|
let [x, y] = [0, 0];
|
@@ -6360,11 +6379,6 @@ function Modal($$anchor, $$props) {
|
|
6360
6379
|
let closeEventValue = $.prop($$props, 'closeEventValue', 8, null);
|
6361
6380
|
let layerId = $.prop($$props, 'layerId', 8, '');
|
6362
6381
|
const { brandKit } = useBrandKit();
|
6363
|
-
const isCanvasPreview = (document.querySelector('#preview')?.getAttribute('data-canvas-preview') ?? 'false') === 'true';
|
6364
|
-
const isOnSite = (document.querySelector('#preview')?.getAttribute('data-on-site') ?? 'true') === 'true';
|
6365
|
-
|
6366
|
-
console.log('isOnSite', isOnSite);
|
6367
|
-
|
6368
6382
|
// モーダル背景の設定
|
6369
6383
|
const isExistBackgroundOverlayValue = placement() && placement().backgroundOverlay !== undefined;
|
6370
6384
|
let backgroundOverlay = $.mutable_state(DefaultModalPlacement.backgroundOverlay);
|
@@ -6410,7 +6424,7 @@ function Modal($$anchor, $$props) {
|
|
6410
6424
|
$.deep_read_state(breakPoint())
|
6411
6425
|
),
|
6412
6426
|
() => {
|
6413
|
-
if (!isCanvasPreview && isExistBackgroundOverlayValue) {
|
6427
|
+
if (!isCanvasPreview() && isExistBackgroundOverlayValue) {
|
6414
6428
|
$.set(backgroundOverlay, placement().backgroundOverlay);
|
6415
6429
|
}
|
6416
6430
|
|
@@ -6516,7 +6530,7 @@ function Modal($$anchor, $$props) {
|
|
6516
6530
|
// 表示位置のスタイルの設定
|
6517
6531
|
let position = DefaultModalPlacement.position;
|
6518
6532
|
|
6519
|
-
if (!isCanvasPreview && placement() && placement().position !== null) {
|
6533
|
+
if (!isCanvasPreview() && placement() && placement().position !== null) {
|
6520
6534
|
position = placement().position;
|
6521
6535
|
}
|
6522
6536
|
|
@@ -6533,7 +6547,7 @@ function Modal($$anchor, $$props) {
|
|
6533
6547
|
$.set(transforms, []);
|
6534
6548
|
|
6535
6549
|
DEVICE_IDS.forEach((deviceId) => {
|
6536
|
-
if (!isCanvasPreview && useBreakPoint()) {
|
6550
|
+
if (!isCanvasPreview() && useBreakPoint()) {
|
6537
6551
|
const positionWithBp = breakPoint()[deviceId]?.placement?.position;
|
6538
6552
|
|
6539
6553
|
$.get(transforms).push({
|
@@ -6569,7 +6583,7 @@ function Modal($$anchor, $$props) {
|
|
6569
6583
|
() => {
|
6570
6584
|
let margin = DefaultModalPlacement.margin;
|
6571
6585
|
|
6572
|
-
if (!isCanvasPreview && placement() && placement().margin !== null) {
|
6586
|
+
if (!isCanvasPreview() && placement() && placement().margin !== null) {
|
6573
6587
|
margin = placement().margin;
|
6574
6588
|
}
|
6575
6589
|
|
@@ -6580,7 +6594,7 @@ function Modal($$anchor, $$props) {
|
|
6580
6594
|
}
|
6581
6595
|
|
6582
6596
|
DEVICE_IDS.forEach((deviceId) => {
|
6583
|
-
if (!isCanvasPreview && useBreakPoint()) {
|
6597
|
+
if (!isCanvasPreview() && useBreakPoint()) {
|
6584
6598
|
const marginWithBp = breakPoint()[deviceId]?.placement?.margin;
|
6585
6599
|
|
6586
6600
|
marginStyle = getMarginStyle(marginWithBp);
|
@@ -6694,7 +6708,7 @@ function Modal($$anchor, $$props) {
|
|
6694
6708
|
};
|
6695
6709
|
|
6696
6710
|
$.if(node, ($$render) => {
|
6697
|
-
if (isCanvasPreview) $$render(consequent); else $$render(alternate, false);
|
6711
|
+
if (isCanvasPreview()) $$render(consequent); else $$render(alternate, false);
|
6698
6712
|
});
|
6699
6713
|
}
|
6700
6714
|
|
@@ -6725,10 +6739,9 @@ function Modal($$anchor, $$props) {
|
|
6725
6739
|
$.derived_safe_equal
|
6726
6740
|
);
|
6727
6741
|
|
6728
|
-
$.transition(1, div, () =>
|
6742
|
+
$.transition(1, div, () => customAnimation, () => ({
|
6729
6743
|
transforms: $.get(transforms),
|
6730
|
-
animationStyle: animation()
|
6731
|
-
disabled: !isOnSite
|
6744
|
+
animationStyle: animation()
|
6732
6745
|
}));
|
6733
6746
|
|
6734
6747
|
$.append($$anchor, div);
|