@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/index.es.js
CHANGED
@@ -35,9 +35,14 @@ const KARTE_MODAL_ROOT = 'karte-modal-root';
|
|
35
35
|
/** @internal */
|
36
36
|
const NOOP = (_args) => { }; // eslint-disable-line @typescript-eslint/no-unused-vars
|
37
37
|
/** @internal */
|
38
|
-
const isPreview = () =>
|
39
|
-
|
40
|
-
|
38
|
+
const isPreview = () => (false);
|
39
|
+
const isCanvasPreview = () => typeof document !== 'undefined'
|
40
|
+
? (document?.querySelector('#preview')?.getAttribute('data-canvas-preview') ?? 'false') ===
|
41
|
+
'true'
|
42
|
+
: false;
|
43
|
+
const isOnSite = () => typeof document !== 'undefined'
|
44
|
+
? (document?.querySelector('#preview')?.getAttribute('data-on-site') ?? 'true') === 'true'
|
45
|
+
: true;
|
41
46
|
/** @internal */
|
42
47
|
const setPreviousFocus = () => {
|
43
48
|
const previously_focused = typeof document !== 'undefined' && document.activeElement;
|
@@ -1884,6 +1889,7 @@ function createModal(App, options = {
|
|
1884
1889
|
close(trigger);
|
1885
1890
|
};
|
1886
1891
|
const show = async (trigger = 'none') => {
|
1892
|
+
console.log('show trigger', trigger);
|
1887
1893
|
if (app) {
|
1888
1894
|
return;
|
1889
1895
|
}
|
@@ -3464,33 +3470,7 @@ const EASING = {
|
|
3464
3470
|
* @internal
|
3465
3471
|
*/
|
3466
3472
|
function customAnimation(node, { transforms, animationStyle, delay = 0, duration = 1000 }) {
|
3467
|
-
|
3468
|
-
for (const { query, x: tx, y: ty } of transforms) {
|
3469
|
-
if (query == null || window.matchMedia(query).matches) {
|
3470
|
-
x = tx;
|
3471
|
-
y = ty;
|
3472
|
-
break;
|
3473
|
-
}
|
3474
|
-
}
|
3475
|
-
return {
|
3476
|
-
delay,
|
3477
|
-
duration,
|
3478
|
-
easing: EASING[animationStyle],
|
3479
|
-
css: (progress) => getAnimation({ type: animationStyle, x, y, progress }),
|
3480
|
-
};
|
3481
|
-
}
|
3482
|
-
/**
|
3483
|
-
* The function to activate svelte animation v2.
|
3484
|
-
*
|
3485
|
-
* @param node - A target node of animation. This argument is passed by svelte, by default.
|
3486
|
-
* @param customAnimationOptions - A custom animation option object
|
3487
|
-
*
|
3488
|
-
* @see {@link https://svelte.dev/docs#template-syntax-element-directives-transition-fn-custom-transition-functions| Custom transition functions} for detail documentation
|
3489
|
-
*
|
3490
|
-
* @internal
|
3491
|
-
*/
|
3492
|
-
function customAnimationV2(node, { transforms, animationStyle, delay = 0, duration = 1000, disabled, }) {
|
3493
|
-
if (disabled) {
|
3473
|
+
if (!isOnSite()) {
|
3494
3474
|
return {};
|
3495
3475
|
}
|
3496
3476
|
let [x, y] = [0, 0];
|
@@ -17310,7 +17290,7 @@ function add_css$9(target) {
|
|
17310
17290
|
append_styles(target, "svelte-45ue06", "*{box-sizing:border-box}.modal.svelte-45ue06{position:fixed;z-index:2147483647;display:flex}.modal.svelte-45ue06 > .button{flex:auto;display:flex}@media screen and (min-width: 641px){.modal-bp.svelte-45ue06{height:var(--modal-bp-height-pc) !important;width:var(--modal-bp-width-pc) !important;top:var(--modal-bp-top-pc) !important;left:var(--modal-bp-left-pc) !important;bottom:var(--modal-bp-bottom-pc) !important;right:var(--modal-bp-right-pc) !important;transform:var(--modal-bp-transform-pc);margin:var(--modal-bp-margin-pc) !important}.background-bp-pc{display:block}.background-bp-sp{display:none}}@media screen and (max-width: 640px){.modal-bp.svelte-45ue06{height:var(--modal-bp-height-sp) !important;width:var(--modal-bp-width-sp) !important;top:var(--modal-bp-top-sp) !important;left:var(--modal-bp-left-sp) !important;bottom:var(--modal-bp-bottom-sp) !important;right:var(--modal-bp-right-sp) !important;transform:var(--modal-bp-transform-sp);margin:var(--modal-bp-margin-sp) !important}.background-bp-pc{display:none}.background-bp-sp{display:block}}");
|
17311
17291
|
}
|
17312
17292
|
|
17313
|
-
// (
|
17293
|
+
// (219:0) {:else}
|
17314
17294
|
function create_else_block(ctx) {
|
17315
17295
|
let backgroundoverlay;
|
17316
17296
|
let current;
|
@@ -17354,7 +17334,7 @@ function create_else_block(ctx) {
|
|
17354
17334
|
};
|
17355
17335
|
}
|
17356
17336
|
|
17357
|
-
// (
|
17337
|
+
// (208:24)
|
17358
17338
|
function create_if_block_2(ctx) {
|
17359
17339
|
let backgroundoverlay0;
|
17360
17340
|
let t;
|
@@ -17423,7 +17403,7 @@ function create_if_block_2(ctx) {
|
|
17423
17403
|
};
|
17424
17404
|
}
|
17425
17405
|
|
17426
|
-
// (
|
17406
|
+
// (206:0) {#if isCanvasPreview()}
|
17427
17407
|
function create_if_block_1$1(ctx) {
|
17428
17408
|
return {
|
17429
17409
|
c: noop,
|
@@ -17435,14 +17415,14 @@ function create_if_block_1$1(ctx) {
|
|
17435
17415
|
};
|
17436
17416
|
}
|
17437
17417
|
|
17438
|
-
// (
|
17418
|
+
// (222:0) {#if visible}
|
17439
17419
|
function create_if_block$3(ctx) {
|
17440
17420
|
let div;
|
17441
17421
|
let div_class_value;
|
17442
17422
|
let div_intro;
|
17443
17423
|
let current;
|
17444
|
-
const default_slot_template = /*#slots*/ ctx[
|
17445
|
-
const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[
|
17424
|
+
const default_slot_template = /*#slots*/ ctx[25].default;
|
17425
|
+
const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[24], null);
|
17446
17426
|
|
17447
17427
|
return {
|
17448
17428
|
c() {
|
@@ -17452,7 +17432,7 @@ function create_if_block$3(ctx) {
|
|
17452
17432
|
attr(div, "role", "dialog");
|
17453
17433
|
attr(div, "aria-modal", "true");
|
17454
17434
|
attr(div, "data-layer-id", /*layerId*/ ctx[2]);
|
17455
|
-
attr(div, "style", Array.from(/*modalStyles*/ ctx[
|
17435
|
+
attr(div, "style", Array.from(/*modalStyles*/ ctx[13]).join(';'));
|
17456
17436
|
},
|
17457
17437
|
m(target, anchor) {
|
17458
17438
|
insert(target, div, anchor);
|
@@ -17461,22 +17441,22 @@ function create_if_block$3(ctx) {
|
|
17461
17441
|
default_slot.m(div, null);
|
17462
17442
|
}
|
17463
17443
|
|
17464
|
-
/*div_binding*/ ctx[
|
17444
|
+
/*div_binding*/ ctx[26](div);
|
17465
17445
|
current = true;
|
17466
17446
|
},
|
17467
17447
|
p(new_ctx, dirty) {
|
17468
17448
|
ctx = new_ctx;
|
17469
17449
|
|
17470
17450
|
if (default_slot) {
|
17471
|
-
if (default_slot.p && (!current || dirty & /*$$scope*/
|
17451
|
+
if (default_slot.p && (!current || dirty & /*$$scope*/ 16777216)) {
|
17472
17452
|
update_slot_base(
|
17473
17453
|
default_slot,
|
17474
17454
|
default_slot_template,
|
17475
17455
|
ctx,
|
17476
|
-
/*$$scope*/ ctx[
|
17456
|
+
/*$$scope*/ ctx[24],
|
17477
17457
|
!current
|
17478
|
-
? get_all_dirty_from_scope(/*$$scope*/ ctx[
|
17479
|
-
: get_slot_changes(default_slot_template, /*$$scope*/ ctx[
|
17458
|
+
? get_all_dirty_from_scope(/*$$scope*/ ctx[24])
|
17459
|
+
: get_slot_changes(default_slot_template, /*$$scope*/ ctx[24], dirty, null),
|
17480
17460
|
null
|
17481
17461
|
);
|
17482
17462
|
}
|
@@ -17496,10 +17476,9 @@ function create_if_block$3(ctx) {
|
|
17496
17476
|
|
17497
17477
|
if (!div_intro) {
|
17498
17478
|
add_render_callback(() => {
|
17499
|
-
div_intro = create_in_transition(div,
|
17479
|
+
div_intro = create_in_transition(div, customAnimation, {
|
17500
17480
|
transforms: /*transforms*/ ctx[3],
|
17501
|
-
animationStyle: /*animation*/ ctx[1]
|
17502
|
-
disabled: !/*isOnSite*/ ctx[14]
|
17481
|
+
animationStyle: /*animation*/ ctx[1]
|
17503
17482
|
});
|
17504
17483
|
|
17505
17484
|
div_intro.start();
|
@@ -17515,12 +17494,13 @@ function create_if_block$3(ctx) {
|
|
17515
17494
|
d(detaching) {
|
17516
17495
|
if (detaching) detach(div);
|
17517
17496
|
if (default_slot) default_slot.d(detaching);
|
17518
|
-
/*div_binding*/ ctx[
|
17497
|
+
/*div_binding*/ ctx[26](null);
|
17519
17498
|
}
|
17520
17499
|
};
|
17521
17500
|
}
|
17522
17501
|
|
17523
17502
|
function create_fragment$d(ctx) {
|
17503
|
+
let show_if;
|
17524
17504
|
let current_block_type_index;
|
17525
17505
|
let if_block0;
|
17526
17506
|
let t;
|
@@ -17532,7 +17512,8 @@ function create_fragment$d(ctx) {
|
|
17532
17512
|
const if_blocks = [];
|
17533
17513
|
|
17534
17514
|
function select_block_type(ctx, dirty) {
|
17535
|
-
if (
|
17515
|
+
if (show_if == null) show_if = !!isCanvasPreview();
|
17516
|
+
if (show_if) return 0;
|
17536
17517
|
if (/*useBreakPoint*/ ctx[0]) return 1;
|
17537
17518
|
return 2;
|
17538
17519
|
}
|
@@ -17654,9 +17635,6 @@ function instance$d($$self, $$props, $$invalidate) {
|
|
17654
17635
|
let { closeEventValue = null } = $$props;
|
17655
17636
|
let { layerId = '' } = $$props;
|
17656
17637
|
const { brandKit } = useBrandKit();
|
17657
|
-
const isCanvasPreview = (document.querySelector('#preview')?.getAttribute('data-canvas-preview') ?? 'false') === 'true';
|
17658
|
-
const isOnSite = (document.querySelector('#preview')?.getAttribute('data-on-site') ?? 'true') === 'true';
|
17659
|
-
console.log('isOnSite', isOnSite);
|
17660
17638
|
|
17661
17639
|
// モーダル背景の設定
|
17662
17640
|
const isExistBackgroundOverlayValue = placement && placement.backgroundOverlay !== undefined;
|
@@ -17689,20 +17667,20 @@ function instance$d($$self, $$props, $$invalidate) {
|
|
17689
17667
|
|
17690
17668
|
$$self.$$set = $$props => {
|
17691
17669
|
if ('useBreakPoint' in $$props) $$invalidate(0, useBreakPoint = $$props.useBreakPoint);
|
17692
|
-
if ('placement' in $$props) $$invalidate(
|
17693
|
-
if ('breakPoint' in $$props) $$invalidate(
|
17694
|
-
if ('elasticity' in $$props) $$invalidate(
|
17670
|
+
if ('placement' in $$props) $$invalidate(14, placement = $$props.placement);
|
17671
|
+
if ('breakPoint' in $$props) $$invalidate(15, breakPoint = $$props.breakPoint);
|
17672
|
+
if ('elasticity' in $$props) $$invalidate(16, elasticity = $$props.elasticity);
|
17695
17673
|
if ('animation' in $$props) $$invalidate(1, animation = $$props.animation);
|
17696
|
-
if ('props' in $$props) $$invalidate(
|
17697
|
-
if ('closeEventName' in $$props) $$invalidate(
|
17698
|
-
if ('closeEventValue' in $$props) $$invalidate(
|
17674
|
+
if ('props' in $$props) $$invalidate(17, props = $$props.props);
|
17675
|
+
if ('closeEventName' in $$props) $$invalidate(18, closeEventName = $$props.closeEventName);
|
17676
|
+
if ('closeEventValue' in $$props) $$invalidate(19, closeEventValue = $$props.closeEventValue);
|
17699
17677
|
if ('layerId' in $$props) $$invalidate(2, layerId = $$props.layerId);
|
17700
|
-
if ('$$scope' in $$props) $$invalidate(
|
17678
|
+
if ('$$scope' in $$props) $$invalidate(24, $$scope = $$props.$$scope);
|
17701
17679
|
};
|
17702
17680
|
|
17703
17681
|
$$self.$$.update = () => {
|
17704
|
-
if ($$self.$$.dirty & /*closeEventName, closeEventValue*/
|
17705
|
-
$$invalidate(
|
17682
|
+
if ($$self.$$.dirty & /*closeEventName, closeEventValue*/ 786432) {
|
17683
|
+
$$invalidate(23, close = () => {
|
17706
17684
|
const onClose = { operation: 'closeApp', args: ['button'] };
|
17707
17685
|
|
17708
17686
|
if (closeEventName) {
|
@@ -17713,9 +17691,9 @@ function instance$d($$self, $$props, $$invalidate) {
|
|
17713
17691
|
});
|
17714
17692
|
}
|
17715
17693
|
|
17716
|
-
if ($$self.$$.dirty & /*placement, useBreakPoint, breakPoint*/
|
17694
|
+
if ($$self.$$.dirty & /*placement, useBreakPoint, breakPoint*/ 49153) {
|
17717
17695
|
{
|
17718
|
-
if (!isCanvasPreview && isExistBackgroundOverlayValue) {
|
17696
|
+
if (!isCanvasPreview() && isExistBackgroundOverlayValue) {
|
17719
17697
|
$$invalidate(4, backgroundOverlay = placement.backgroundOverlay);
|
17720
17698
|
}
|
17721
17699
|
|
@@ -17728,29 +17706,29 @@ function instance$d($$self, $$props, $$invalidate) {
|
|
17728
17706
|
}
|
17729
17707
|
}
|
17730
17708
|
|
17731
|
-
if ($$self.$$.dirty & /*placement, useBreakPoint, breakPoint*/
|
17709
|
+
if ($$self.$$.dirty & /*placement, useBreakPoint, breakPoint*/ 49153) {
|
17732
17710
|
{
|
17733
17711
|
if (placement && placement.backgroundClick) {
|
17734
|
-
$$invalidate(
|
17712
|
+
$$invalidate(20, backgroundClickFunction = placement.backgroundClick);
|
17735
17713
|
}
|
17736
17714
|
|
17737
17715
|
if (useBreakPoint) {
|
17738
17716
|
const pc = breakPoint?.PC?.placement?.backgroundClick;
|
17739
17717
|
|
17740
17718
|
if (pc) {
|
17741
|
-
$$invalidate(
|
17719
|
+
$$invalidate(21, backgroundClickFunctionPC = pc);
|
17742
17720
|
}
|
17743
17721
|
|
17744
17722
|
const sp = breakPoint?.SP?.placement?.backgroundClick;
|
17745
17723
|
|
17746
17724
|
if (sp) {
|
17747
|
-
$$invalidate(
|
17725
|
+
$$invalidate(22, backgroundClickFunctionSP = sp);
|
17748
17726
|
}
|
17749
17727
|
}
|
17750
17728
|
}
|
17751
17729
|
}
|
17752
17730
|
|
17753
|
-
if ($$self.$$.dirty & /*closeEventName, closeEventValue, backgroundClickFunction*/
|
17731
|
+
if ($$self.$$.dirty & /*closeEventName, closeEventValue, backgroundClickFunction*/ 1835008) {
|
17754
17732
|
$$invalidate(12, backgroundClick = () => {
|
17755
17733
|
if (closeEventName) {
|
17756
17734
|
send_event(closeEventName, closeEventValue);
|
@@ -17760,7 +17738,7 @@ function instance$d($$self, $$props, $$invalidate) {
|
|
17760
17738
|
});
|
17761
17739
|
}
|
17762
17740
|
|
17763
|
-
if ($$self.$$.dirty & /*closeEventName, closeEventValue, backgroundClickFunctionPC*/
|
17741
|
+
if ($$self.$$.dirty & /*closeEventName, closeEventValue, backgroundClickFunctionPC*/ 2883584) {
|
17764
17742
|
$$invalidate(11, backgroundClickPC = () => {
|
17765
17743
|
if (closeEventName) {
|
17766
17744
|
send_event(closeEventName, closeEventValue);
|
@@ -17770,7 +17748,7 @@ function instance$d($$self, $$props, $$invalidate) {
|
|
17770
17748
|
});
|
17771
17749
|
}
|
17772
17750
|
|
17773
|
-
if ($$self.$$.dirty & /*closeEventName, closeEventValue, backgroundClickFunctionSP*/
|
17751
|
+
if ($$self.$$.dirty & /*closeEventName, closeEventValue, backgroundClickFunctionSP*/ 4980736) {
|
17774
17752
|
$$invalidate(10, backgroundClickSP = () => {
|
17775
17753
|
if (closeEventName) {
|
17776
17754
|
send_event(closeEventName, closeEventValue);
|
@@ -17780,13 +17758,13 @@ function instance$d($$self, $$props, $$invalidate) {
|
|
17780
17758
|
});
|
17781
17759
|
}
|
17782
17760
|
|
17783
|
-
if ($$self.$$.dirty & /*placement, useBreakPoint, breakPoint, transforms*/
|
17761
|
+
if ($$self.$$.dirty & /*placement, useBreakPoint, breakPoint, transforms*/ 49161) {
|
17784
17762
|
// 表示位置のスタイルとアニメーションの動きを設定
|
17785
17763
|
{
|
17786
17764
|
// 表示位置のスタイルの設定
|
17787
17765
|
let position = DefaultModalPlacement.position;
|
17788
17766
|
|
17789
|
-
if (!isCanvasPreview && placement && placement.position !== null) {
|
17767
|
+
if (!isCanvasPreview() && placement && placement.position !== null) {
|
17790
17768
|
position = placement.position;
|
17791
17769
|
}
|
17792
17770
|
|
@@ -17803,7 +17781,7 @@ function instance$d($$self, $$props, $$invalidate) {
|
|
17803
17781
|
$$invalidate(3, transforms = []);
|
17804
17782
|
|
17805
17783
|
DEVICE_IDS.forEach(deviceId => {
|
17806
|
-
if (!isCanvasPreview && useBreakPoint) {
|
17784
|
+
if (!isCanvasPreview() && useBreakPoint) {
|
17807
17785
|
const positionWithBp = breakPoint[deviceId]?.placement?.position;
|
17808
17786
|
|
17809
17787
|
transforms.push({
|
@@ -17828,12 +17806,12 @@ function instance$d($$self, $$props, $$invalidate) {
|
|
17828
17806
|
}
|
17829
17807
|
}
|
17830
17808
|
|
17831
|
-
if ($$self.$$.dirty & /*placement, useBreakPoint, breakPoint, props*/
|
17809
|
+
if ($$self.$$.dirty & /*placement, useBreakPoint, breakPoint, props*/ 180225) {
|
17832
17810
|
// 表示位置の調整のスタイルを設定
|
17833
17811
|
{
|
17834
17812
|
let margin = DefaultModalPlacement.margin;
|
17835
17813
|
|
17836
|
-
if (!isCanvasPreview && placement && placement.margin !== null) {
|
17814
|
+
if (!isCanvasPreview() && placement && placement.margin !== null) {
|
17837
17815
|
margin = placement.margin;
|
17838
17816
|
}
|
17839
17817
|
|
@@ -17844,7 +17822,7 @@ function instance$d($$self, $$props, $$invalidate) {
|
|
17844
17822
|
}
|
17845
17823
|
|
17846
17824
|
DEVICE_IDS.forEach(deviceId => {
|
17847
|
-
if (!isCanvasPreview && useBreakPoint) {
|
17825
|
+
if (!isCanvasPreview() && useBreakPoint) {
|
17848
17826
|
const marginWithBp = breakPoint[deviceId]?.placement?.margin;
|
17849
17827
|
marginStyle = getMarginStyle(marginWithBp);
|
17850
17828
|
}
|
@@ -17872,7 +17850,7 @@ function instance$d($$self, $$props, $$invalidate) {
|
|
17872
17850
|
}
|
17873
17851
|
}
|
17874
17852
|
|
17875
|
-
if ($$self.$$.dirty & /*close*/
|
17853
|
+
if ($$self.$$.dirty & /*close*/ 8388608) {
|
17876
17854
|
$$invalidate(9, handle_keydown = handleKeydown({ Escape: close }));
|
17877
17855
|
}
|
17878
17856
|
};
|
@@ -17896,8 +17874,6 @@ function instance$d($$self, $$props, $$invalidate) {
|
|
17896
17874
|
backgroundClickSP,
|
17897
17875
|
backgroundClickPC,
|
17898
17876
|
backgroundClick,
|
17899
|
-
isCanvasPreview,
|
17900
|
-
isOnSite,
|
17901
17877
|
modalStyles,
|
17902
17878
|
placement,
|
17903
17879
|
breakPoint,
|
@@ -17927,13 +17903,13 @@ class Modal extends SvelteComponent {
|
|
17927
17903
|
safe_not_equal,
|
17928
17904
|
{
|
17929
17905
|
useBreakPoint: 0,
|
17930
|
-
placement:
|
17931
|
-
breakPoint:
|
17932
|
-
elasticity:
|
17906
|
+
placement: 14,
|
17907
|
+
breakPoint: 15,
|
17908
|
+
elasticity: 16,
|
17933
17909
|
animation: 1,
|
17934
|
-
props:
|
17935
|
-
closeEventName:
|
17936
|
-
closeEventValue:
|
17910
|
+
props: 17,
|
17911
|
+
closeEventName: 18,
|
17912
|
+
closeEventValue: 19,
|
17937
17913
|
layerId: 2
|
17938
17914
|
},
|
17939
17915
|
add_css$9
|
@@ -19576,7 +19552,8 @@ function getActionRoot() {
|
|
19576
19552
|
return root.shadowRoot;
|
19577
19553
|
}
|
19578
19554
|
/** @internal */
|
19579
|
-
function ensureActionRoot() {
|
19555
|
+
function ensureActionRoot(useShadow = true) {
|
19556
|
+
console.log('useShadow', useShadow);
|
19580
19557
|
const systemConfig = getSystem();
|
19581
19558
|
const rootAttrs = {
|
19582
19559
|
class: `${KARTE_ACTION_ROOT} ${KARTE_MODAL_ROOT}`,
|
@@ -19587,11 +19564,13 @@ function ensureActionRoot() {
|
|
19587
19564
|
style: { display: 'block' },
|
19588
19565
|
};
|
19589
19566
|
let el = document.querySelector(`.${KARTE_MODAL_ROOT}[data-${KARTE_ACTION_RID}='${actionId}']`);
|
19567
|
+
console.log('el', el);
|
19590
19568
|
if (el == null) {
|
19591
19569
|
el = h('div', rootAttrs);
|
19592
19570
|
document.body.appendChild(el);
|
19593
19571
|
}
|
19594
|
-
const isShadow = !!document.body.attachShadow;
|
19572
|
+
const isShadow = !!document.body.attachShadow && useShadow;
|
19573
|
+
console.log('isShadow', isShadow);
|
19595
19574
|
if (isShadow) {
|
19596
19575
|
return el.shadowRoot ?? el.attachShadow({ mode: 'open' });
|
19597
19576
|
}
|
@@ -19660,7 +19639,7 @@ function createApp(App, options = {
|
|
19660
19639
|
},
|
19661
19640
|
},
|
19662
19641
|
};
|
19663
|
-
const win = ensureModalRoot();
|
19642
|
+
const win = ensureModalRoot(true);
|
19664
19643
|
appArgs.target = win;
|
19665
19644
|
return {
|
19666
19645
|
close,
|
@@ -1419,7 +1419,7 @@ declare function getCssVariables(data: {
|
|
1419
1419
|
*/
|
1420
1420
|
declare function getActionRoot(): ShadowRoot | null;
|
1421
1421
|
/** @internal */
|
1422
|
-
declare function ensureActionRoot(): ShadowRoot | HTMLElement;
|
1422
|
+
declare function ensureActionRoot(useShadow?: boolean): ShadowRoot | HTMLElement;
|
1423
1423
|
/**
|
1424
1424
|
* 非推奨
|
1425
1425
|
*
|
@@ -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;
|
@@ -223,6 +229,10 @@ function onTime(time, fn) {
|
|
223
229
|
const timeoutHandler = setTimeout(fn, time);
|
224
230
|
return () => timeoutHandler && clearTimeout(timeoutHandler);
|
225
231
|
}
|
232
|
+
/** @internal */
|
233
|
+
function randStr(digit = 8) {
|
234
|
+
return Math.random().toString(32).substring(digit);
|
235
|
+
}
|
226
236
|
/**
|
227
237
|
* Goolge Fonts用のURLを生成
|
228
238
|
*
|
@@ -754,7 +764,7 @@ const state = writable('/');
|
|
754
764
|
* @public
|
755
765
|
*/
|
756
766
|
function setState$1(stateId, options) {
|
757
|
-
if (options?.disableInPreview)
|
767
|
+
if (isPreview() && options?.disableInPreview)
|
758
768
|
return;
|
759
769
|
state.set(stateId);
|
760
770
|
}
|
@@ -1198,8 +1208,11 @@ function cloneToJson(data) {
|
|
1198
1208
|
|
1199
1209
|
// prettier-ignore
|
1200
1210
|
/** @internal */
|
1201
|
-
const actionId =
|
1202
|
-
|
1211
|
+
const actionId = isPreview()
|
1212
|
+
? ALL_ACTION_ID
|
1213
|
+
: typeof __FLYER_GEN_ACTION_ID_ON_BUILD__ === 'string'
|
1214
|
+
? __FLYER_GEN_ACTION_ID_ON_BUILD__
|
1215
|
+
: randStr();
|
1203
1216
|
/** @internal */
|
1204
1217
|
const ACTION_DESTROY_EVENT = `KARTE-ACTION-DESTROY-${actionId}`;
|
1205
1218
|
/** @internal */
|
@@ -1553,8 +1566,23 @@ const loadActionTableQuery = async (config, data, api_key, collection_endpoint)
|
|
1553
1566
|
/** @internal */
|
1554
1567
|
const loadActionTable = async (config, data, api_key, collection_endpoint) => {
|
1555
1568
|
console.debug('[debug] loadActionTable', isPreview(), api_key, collection_endpoint, JSON.stringify(config));
|
1556
|
-
const results =
|
1557
|
-
|
1569
|
+
const results = isPreview()
|
1570
|
+
? config.map(c => c.preview_value)
|
1571
|
+
: await Promise.all(config
|
1572
|
+
.filter(c => c.resolver === 'action-table-row' ||
|
1573
|
+
c.resolver === 'action-table-rows' ||
|
1574
|
+
c.resolver === 'action-table-query')
|
1575
|
+
.map(async (c) => {
|
1576
|
+
if (c.resolver === 'action-table-row') {
|
1577
|
+
return await loadActionTableRow(c, data, api_key, collection_endpoint);
|
1578
|
+
}
|
1579
|
+
else if (c.resolver === 'action-table-rows') {
|
1580
|
+
return await loadActionTableRows(c, data, api_key, collection_endpoint);
|
1581
|
+
}
|
1582
|
+
else if (c.resolver === 'action-table-query') {
|
1583
|
+
return await loadActionTableQuery(c, data, api_key, collection_endpoint);
|
1584
|
+
}
|
1585
|
+
}));
|
1558
1586
|
return config.reduce((acc, c, i) => {
|
1559
1587
|
const value = results[i] ?? c.query.default_value;
|
1560
1588
|
if (value) {
|
@@ -1688,6 +1716,7 @@ function createModal(App, options = {
|
|
1688
1716
|
close(trigger);
|
1689
1717
|
};
|
1690
1718
|
const show = async (trigger = 'none') => {
|
1719
|
+
console.log('show trigger', trigger);
|
1691
1720
|
if (app) {
|
1692
1721
|
return;
|
1693
1722
|
}
|
@@ -2245,7 +2274,8 @@ function getActionRoot() {
|
|
2245
2274
|
return root.shadowRoot;
|
2246
2275
|
}
|
2247
2276
|
/** @internal */
|
2248
|
-
function ensureActionRoot() {
|
2277
|
+
function ensureActionRoot(useShadow = true) {
|
2278
|
+
console.log('useShadow', useShadow);
|
2249
2279
|
const systemConfig = getSystem();
|
2250
2280
|
const rootAttrs = {
|
2251
2281
|
class: `${KARTE_ACTION_ROOT} ${KARTE_MODAL_ROOT}`,
|
@@ -2256,11 +2286,13 @@ function ensureActionRoot() {
|
|
2256
2286
|
style: { display: 'block' },
|
2257
2287
|
};
|
2258
2288
|
let el = document.querySelector(`.${KARTE_MODAL_ROOT}[data-${KARTE_ACTION_RID}='${actionId}']`);
|
2289
|
+
console.log('el', el);
|
2259
2290
|
if (el == null) {
|
2260
2291
|
el = h('div', rootAttrs);
|
2261
2292
|
document.body.appendChild(el);
|
2262
2293
|
}
|
2263
|
-
const isShadow = !!document.body.attachShadow;
|
2294
|
+
const isShadow = !!document.body.attachShadow && useShadow;
|
2295
|
+
console.log('isShadow', isShadow);
|
2264
2296
|
if (isShadow) {
|
2265
2297
|
return el.shadowRoot ?? el.attachShadow({ mode: 'open' });
|
2266
2298
|
}
|
@@ -2329,7 +2361,7 @@ function createApp(App, options = {
|
|
2329
2361
|
},
|
2330
2362
|
},
|
2331
2363
|
};
|
2332
|
-
const win = ensureModalRoot();
|
2364
|
+
const win = ensureModalRoot(true);
|
2333
2365
|
appArgs.target = win;
|
2334
2366
|
return {
|
2335
2367
|
close,
|
@@ -2849,9 +2881,11 @@ function Header($$anchor, $$props) {
|
|
2849
2881
|
$fonts()
|
2850
2882
|
),
|
2851
2883
|
() => {
|
2852
|
-
{
|
2884
|
+
if (isPreview()) {
|
2853
2885
|
// フォントのロードが遅れてエディタのプレビューがガタつく対策
|
2854
2886
|
$.set(googleFontUrl, makeGoogleFontUrl(Fonts.filter((font) => font !== SYSTEM_FONT)));
|
2887
|
+
} else if ($fonts().length > 0) {
|
2888
|
+
$.set(googleFontUrl, makeGoogleFontUrl($fonts()));
|
2855
2889
|
}
|
2856
2890
|
}
|
2857
2891
|
);
|
@@ -3411,7 +3445,7 @@ const EASING = {
|
|
3411
3445
|
none: linear,
|
3412
3446
|
};
|
3413
3447
|
/**
|
3414
|
-
* The function to activate svelte animation
|
3448
|
+
* The function to activate svelte animation.
|
3415
3449
|
*
|
3416
3450
|
* @param node - A target node of animation. This argument is passed by svelte, by default.
|
3417
3451
|
* @param customAnimationOptions - A custom animation option object
|
@@ -3420,8 +3454,8 @@ const EASING = {
|
|
3420
3454
|
*
|
3421
3455
|
* @internal
|
3422
3456
|
*/
|
3423
|
-
function
|
3424
|
-
if (
|
3457
|
+
function customAnimation(node, { transforms, animationStyle, delay = 0, duration = 1000 }) {
|
3458
|
+
if (!isOnSite()) {
|
3425
3459
|
return {};
|
3426
3460
|
}
|
3427
3461
|
let [x, y] = [0, 0];
|
@@ -6304,11 +6338,6 @@ function Modal($$anchor, $$props) {
|
|
6304
6338
|
let closeEventValue = $.prop($$props, 'closeEventValue', 8, null);
|
6305
6339
|
let layerId = $.prop($$props, 'layerId', 8, '');
|
6306
6340
|
const { brandKit } = useBrandKit();
|
6307
|
-
const isCanvasPreview = (document.querySelector('#preview')?.getAttribute('data-canvas-preview') ?? 'false') === 'true';
|
6308
|
-
const isOnSite = (document.querySelector('#preview')?.getAttribute('data-on-site') ?? 'true') === 'true';
|
6309
|
-
|
6310
|
-
console.log('isOnSite', isOnSite);
|
6311
|
-
|
6312
6341
|
// モーダル背景の設定
|
6313
6342
|
const isExistBackgroundOverlayValue = placement() && placement().backgroundOverlay !== undefined;
|
6314
6343
|
let backgroundOverlay = $.mutable_state(DefaultModalPlacement.backgroundOverlay);
|
@@ -6354,7 +6383,7 @@ function Modal($$anchor, $$props) {
|
|
6354
6383
|
$.deep_read_state(breakPoint())
|
6355
6384
|
),
|
6356
6385
|
() => {
|
6357
|
-
if (!isCanvasPreview && isExistBackgroundOverlayValue) {
|
6386
|
+
if (!isCanvasPreview() && isExistBackgroundOverlayValue) {
|
6358
6387
|
$.set(backgroundOverlay, placement().backgroundOverlay);
|
6359
6388
|
}
|
6360
6389
|
|
@@ -6460,7 +6489,7 @@ function Modal($$anchor, $$props) {
|
|
6460
6489
|
// 表示位置のスタイルの設定
|
6461
6490
|
let position = DefaultModalPlacement.position;
|
6462
6491
|
|
6463
|
-
if (!isCanvasPreview && placement() && placement().position !== null) {
|
6492
|
+
if (!isCanvasPreview() && placement() && placement().position !== null) {
|
6464
6493
|
position = placement().position;
|
6465
6494
|
}
|
6466
6495
|
|
@@ -6477,7 +6506,7 @@ function Modal($$anchor, $$props) {
|
|
6477
6506
|
$.set(transforms, []);
|
6478
6507
|
|
6479
6508
|
DEVICE_IDS.forEach((deviceId) => {
|
6480
|
-
if (!isCanvasPreview && useBreakPoint()) {
|
6509
|
+
if (!isCanvasPreview() && useBreakPoint()) {
|
6481
6510
|
const positionWithBp = breakPoint()[deviceId]?.placement?.position;
|
6482
6511
|
|
6483
6512
|
$.get(transforms).push({
|
@@ -6513,7 +6542,7 @@ function Modal($$anchor, $$props) {
|
|
6513
6542
|
() => {
|
6514
6543
|
let margin = DefaultModalPlacement.margin;
|
6515
6544
|
|
6516
|
-
if (!isCanvasPreview && placement() && placement().margin !== null) {
|
6545
|
+
if (!isCanvasPreview() && placement() && placement().margin !== null) {
|
6517
6546
|
margin = placement().margin;
|
6518
6547
|
}
|
6519
6548
|
|
@@ -6524,7 +6553,7 @@ function Modal($$anchor, $$props) {
|
|
6524
6553
|
}
|
6525
6554
|
|
6526
6555
|
DEVICE_IDS.forEach((deviceId) => {
|
6527
|
-
if (!isCanvasPreview && useBreakPoint()) {
|
6556
|
+
if (!isCanvasPreview() && useBreakPoint()) {
|
6528
6557
|
const marginWithBp = breakPoint()[deviceId]?.placement?.margin;
|
6529
6558
|
|
6530
6559
|
marginStyle = getMarginStyle(marginWithBp);
|
@@ -6638,7 +6667,7 @@ function Modal($$anchor, $$props) {
|
|
6638
6667
|
};
|
6639
6668
|
|
6640
6669
|
$.if(node, ($$render) => {
|
6641
|
-
if (isCanvasPreview) $$render(consequent); else $$render(alternate, false);
|
6670
|
+
if (isCanvasPreview()) $$render(consequent); else $$render(alternate, false);
|
6642
6671
|
});
|
6643
6672
|
}
|
6644
6673
|
|
@@ -6669,10 +6698,9 @@ function Modal($$anchor, $$props) {
|
|
6669
6698
|
$.derived_safe_equal
|
6670
6699
|
);
|
6671
6700
|
|
6672
|
-
$.transition(1, div, () =>
|
6701
|
+
$.transition(1, div, () => customAnimation, () => ({
|
6673
6702
|
transforms: $.get(transforms),
|
6674
|
-
animationStyle: animation()
|
6675
|
-
disabled: !isOnSite
|
6703
|
+
animationStyle: animation()
|
6676
6704
|
}));
|
6677
6705
|
|
6678
6706
|
$.append($$anchor, div);
|
@@ -1419,7 +1419,7 @@ declare function getCssVariables(data: {
|
|
1419
1419
|
*/
|
1420
1420
|
declare function getActionRoot(): ShadowRoot | null;
|
1421
1421
|
/** @internal */
|
1422
|
-
declare function ensureActionRoot(): ShadowRoot | HTMLElement;
|
1422
|
+
declare function ensureActionRoot(useShadow?: boolean): ShadowRoot | HTMLElement;
|
1423
1423
|
/**
|
1424
1424
|
* 非推奨
|
1425
1425
|
*
|