@plaidev/karte-action-sdk 1.1.267 → 1.1.268

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/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
- return false;
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;
@@ -3464,6 +3469,9 @@ const EASING = {
3464
3469
  * @internal
3465
3470
  */
3466
3471
  function customAnimation(node, { transforms, animationStyle, delay = 0, duration = 1000 }) {
3472
+ if (!isOnSite()) {
3473
+ return {};
3474
+ }
3467
3475
  let [x, y] = [0, 0];
3468
3476
  for (const { query, x: tx, y: ty } of transforms) {
3469
3477
  if (query == null || window.matchMedia(query).matches) {
@@ -17281,7 +17289,7 @@ function add_css$9(target) {
17281
17289
  append_styles(target, "svelte-15b58xm", "*{box-sizing:border-box}.modal.svelte-15b58xm{position:fixed;z-index:2147483647;display:flex}.modal.svelte-15b58xm > .button{flex:auto;display:flex}@media screen and (min-width: 641px){.modal-bp.svelte-15b58xm{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-15b58xm{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}}");
17282
17290
  }
17283
17291
 
17284
- // (220:0) {:else}
17292
+ // (219:0) {:else}
17285
17293
  function create_else_block(ctx) {
17286
17294
  let backgroundoverlay;
17287
17295
  let current;
@@ -17325,7 +17333,7 @@ function create_else_block(ctx) {
17325
17333
  };
17326
17334
  }
17327
17335
 
17328
- // (209:24)
17336
+ // (208:24)
17329
17337
  function create_if_block_2(ctx) {
17330
17338
  let backgroundoverlay0;
17331
17339
  let t;
@@ -17394,7 +17402,7 @@ function create_if_block_2(ctx) {
17394
17402
  };
17395
17403
  }
17396
17404
 
17397
- // (207:0) {#if isCanvasPreview}
17405
+ // (206:0) {#if isCanvasPreview()}
17398
17406
  function create_if_block_1$1(ctx) {
17399
17407
  return {
17400
17408
  c: noop,
@@ -17406,14 +17414,14 @@ function create_if_block_1$1(ctx) {
17406
17414
  };
17407
17415
  }
17408
17416
 
17409
- // (223:0) {#if visible}
17417
+ // (222:0) {#if visible}
17410
17418
  function create_if_block$3(ctx) {
17411
17419
  let div;
17412
17420
  let div_class_value;
17413
17421
  let div_intro;
17414
17422
  let current;
17415
- const default_slot_template = /*#slots*/ ctx[26].default;
17416
- const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[25], null);
17423
+ const default_slot_template = /*#slots*/ ctx[25].default;
17424
+ const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[24], null);
17417
17425
 
17418
17426
  return {
17419
17427
  c() {
@@ -17423,7 +17431,7 @@ function create_if_block$3(ctx) {
17423
17431
  attr(div, "role", "dialog");
17424
17432
  attr(div, "aria-modal", "true");
17425
17433
  attr(div, "data-layer-id", /*layerId*/ ctx[2]);
17426
- attr(div, "style", Array.from(/*modalStyles*/ ctx[14]).join(';'));
17434
+ attr(div, "style", Array.from(/*modalStyles*/ ctx[13]).join(';'));
17427
17435
  },
17428
17436
  m(target, anchor) {
17429
17437
  insert(target, div, anchor);
@@ -17432,22 +17440,22 @@ function create_if_block$3(ctx) {
17432
17440
  default_slot.m(div, null);
17433
17441
  }
17434
17442
 
17435
- /*div_binding*/ ctx[27](div);
17443
+ /*div_binding*/ ctx[26](div);
17436
17444
  current = true;
17437
17445
  },
17438
17446
  p(new_ctx, dirty) {
17439
17447
  ctx = new_ctx;
17440
17448
 
17441
17449
  if (default_slot) {
17442
- if (default_slot.p && (!current || dirty & /*$$scope*/ 33554432)) {
17450
+ if (default_slot.p && (!current || dirty & /*$$scope*/ 16777216)) {
17443
17451
  update_slot_base(
17444
17452
  default_slot,
17445
17453
  default_slot_template,
17446
17454
  ctx,
17447
- /*$$scope*/ ctx[25],
17455
+ /*$$scope*/ ctx[24],
17448
17456
  !current
17449
- ? get_all_dirty_from_scope(/*$$scope*/ ctx[25])
17450
- : get_slot_changes(default_slot_template, /*$$scope*/ ctx[25], dirty, null),
17457
+ ? get_all_dirty_from_scope(/*$$scope*/ ctx[24])
17458
+ : get_slot_changes(default_slot_template, /*$$scope*/ ctx[24], dirty, null),
17451
17459
  null
17452
17460
  );
17453
17461
  }
@@ -17485,12 +17493,13 @@ function create_if_block$3(ctx) {
17485
17493
  d(detaching) {
17486
17494
  if (detaching) detach(div);
17487
17495
  if (default_slot) default_slot.d(detaching);
17488
- /*div_binding*/ ctx[27](null);
17496
+ /*div_binding*/ ctx[26](null);
17489
17497
  }
17490
17498
  };
17491
17499
  }
17492
17500
 
17493
17501
  function create_fragment$d(ctx) {
17502
+ let show_if;
17494
17503
  let current_block_type_index;
17495
17504
  let if_block0;
17496
17505
  let t;
@@ -17502,7 +17511,8 @@ function create_fragment$d(ctx) {
17502
17511
  const if_blocks = [];
17503
17512
 
17504
17513
  function select_block_type(ctx, dirty) {
17505
- if (/*isCanvasPreview*/ ctx[13]) return 0;
17514
+ if (show_if == null) show_if = !!isCanvasPreview();
17515
+ if (show_if) return 0;
17506
17516
  if (/*useBreakPoint*/ ctx[0]) return 1;
17507
17517
  return 2;
17508
17518
  }
@@ -17624,7 +17634,6 @@ function instance$d($$self, $$props, $$invalidate) {
17624
17634
  let { closeEventValue = null } = $$props;
17625
17635
  let { layerId = '' } = $$props;
17626
17636
  const { brandKit } = useBrandKit();
17627
- const isCanvasPreview = (document.querySelector('#preview')?.getAttribute('data-canvas-preview') ?? 'false') === 'true';
17628
17637
 
17629
17638
  // モーダル背景の設定
17630
17639
  const isExistBackgroundOverlayValue = placement && placement.backgroundOverlay !== undefined;
@@ -17657,20 +17666,20 @@ function instance$d($$self, $$props, $$invalidate) {
17657
17666
 
17658
17667
  $$self.$$set = $$props => {
17659
17668
  if ('useBreakPoint' in $$props) $$invalidate(0, useBreakPoint = $$props.useBreakPoint);
17660
- if ('placement' in $$props) $$invalidate(15, placement = $$props.placement);
17661
- if ('breakPoint' in $$props) $$invalidate(16, breakPoint = $$props.breakPoint);
17662
- if ('elasticity' in $$props) $$invalidate(17, elasticity = $$props.elasticity);
17669
+ if ('placement' in $$props) $$invalidate(14, placement = $$props.placement);
17670
+ if ('breakPoint' in $$props) $$invalidate(15, breakPoint = $$props.breakPoint);
17671
+ if ('elasticity' in $$props) $$invalidate(16, elasticity = $$props.elasticity);
17663
17672
  if ('animation' in $$props) $$invalidate(1, animation = $$props.animation);
17664
- if ('props' in $$props) $$invalidate(18, props = $$props.props);
17665
- if ('closeEventName' in $$props) $$invalidate(19, closeEventName = $$props.closeEventName);
17666
- if ('closeEventValue' in $$props) $$invalidate(20, closeEventValue = $$props.closeEventValue);
17673
+ if ('props' in $$props) $$invalidate(17, props = $$props.props);
17674
+ if ('closeEventName' in $$props) $$invalidate(18, closeEventName = $$props.closeEventName);
17675
+ if ('closeEventValue' in $$props) $$invalidate(19, closeEventValue = $$props.closeEventValue);
17667
17676
  if ('layerId' in $$props) $$invalidate(2, layerId = $$props.layerId);
17668
- if ('$$scope' in $$props) $$invalidate(25, $$scope = $$props.$$scope);
17677
+ if ('$$scope' in $$props) $$invalidate(24, $$scope = $$props.$$scope);
17669
17678
  };
17670
17679
 
17671
17680
  $$self.$$.update = () => {
17672
- if ($$self.$$.dirty & /*closeEventName, closeEventValue*/ 1572864) {
17673
- $$invalidate(24, close = () => {
17681
+ if ($$self.$$.dirty & /*closeEventName, closeEventValue*/ 786432) {
17682
+ $$invalidate(23, close = () => {
17674
17683
  const onClose = { operation: 'closeApp', args: ['button'] };
17675
17684
 
17676
17685
  if (closeEventName) {
@@ -17681,9 +17690,9 @@ function instance$d($$self, $$props, $$invalidate) {
17681
17690
  });
17682
17691
  }
17683
17692
 
17684
- if ($$self.$$.dirty & /*placement, useBreakPoint, breakPoint*/ 98305) {
17693
+ if ($$self.$$.dirty & /*placement, useBreakPoint, breakPoint*/ 49153) {
17685
17694
  {
17686
- if (!isCanvasPreview && isExistBackgroundOverlayValue) {
17695
+ if (!isCanvasPreview() && isExistBackgroundOverlayValue) {
17687
17696
  $$invalidate(4, backgroundOverlay = placement.backgroundOverlay);
17688
17697
  }
17689
17698
 
@@ -17696,29 +17705,29 @@ function instance$d($$self, $$props, $$invalidate) {
17696
17705
  }
17697
17706
  }
17698
17707
 
17699
- if ($$self.$$.dirty & /*placement, useBreakPoint, breakPoint*/ 98305) {
17708
+ if ($$self.$$.dirty & /*placement, useBreakPoint, breakPoint*/ 49153) {
17700
17709
  {
17701
17710
  if (placement && placement.backgroundClick) {
17702
- $$invalidate(21, backgroundClickFunction = placement.backgroundClick);
17711
+ $$invalidate(20, backgroundClickFunction = placement.backgroundClick);
17703
17712
  }
17704
17713
 
17705
17714
  if (useBreakPoint) {
17706
17715
  const pc = breakPoint?.PC?.placement?.backgroundClick;
17707
17716
 
17708
17717
  if (pc) {
17709
- $$invalidate(22, backgroundClickFunctionPC = pc);
17718
+ $$invalidate(21, backgroundClickFunctionPC = pc);
17710
17719
  }
17711
17720
 
17712
17721
  const sp = breakPoint?.SP?.placement?.backgroundClick;
17713
17722
 
17714
17723
  if (sp) {
17715
- $$invalidate(23, backgroundClickFunctionSP = sp);
17724
+ $$invalidate(22, backgroundClickFunctionSP = sp);
17716
17725
  }
17717
17726
  }
17718
17727
  }
17719
17728
  }
17720
17729
 
17721
- if ($$self.$$.dirty & /*closeEventName, closeEventValue, backgroundClickFunction*/ 3670016) {
17730
+ if ($$self.$$.dirty & /*closeEventName, closeEventValue, backgroundClickFunction*/ 1835008) {
17722
17731
  $$invalidate(12, backgroundClick = () => {
17723
17732
  if (closeEventName) {
17724
17733
  send_event(closeEventName, closeEventValue);
@@ -17728,7 +17737,7 @@ function instance$d($$self, $$props, $$invalidate) {
17728
17737
  });
17729
17738
  }
17730
17739
 
17731
- if ($$self.$$.dirty & /*closeEventName, closeEventValue, backgroundClickFunctionPC*/ 5767168) {
17740
+ if ($$self.$$.dirty & /*closeEventName, closeEventValue, backgroundClickFunctionPC*/ 2883584) {
17732
17741
  $$invalidate(11, backgroundClickPC = () => {
17733
17742
  if (closeEventName) {
17734
17743
  send_event(closeEventName, closeEventValue);
@@ -17738,7 +17747,7 @@ function instance$d($$self, $$props, $$invalidate) {
17738
17747
  });
17739
17748
  }
17740
17749
 
17741
- if ($$self.$$.dirty & /*closeEventName, closeEventValue, backgroundClickFunctionSP*/ 9961472) {
17750
+ if ($$self.$$.dirty & /*closeEventName, closeEventValue, backgroundClickFunctionSP*/ 4980736) {
17742
17751
  $$invalidate(10, backgroundClickSP = () => {
17743
17752
  if (closeEventName) {
17744
17753
  send_event(closeEventName, closeEventValue);
@@ -17748,13 +17757,13 @@ function instance$d($$self, $$props, $$invalidate) {
17748
17757
  });
17749
17758
  }
17750
17759
 
17751
- if ($$self.$$.dirty & /*placement, useBreakPoint, breakPoint, transforms*/ 98313) {
17760
+ if ($$self.$$.dirty & /*placement, useBreakPoint, breakPoint, transforms*/ 49161) {
17752
17761
  // 表示位置のスタイルとアニメーションの動きを設定
17753
17762
  {
17754
17763
  // 表示位置のスタイルの設定
17755
17764
  let position = DefaultModalPlacement.position;
17756
17765
 
17757
- if (!isCanvasPreview && placement && placement.position !== null) {
17766
+ if (!isCanvasPreview() && placement && placement.position !== null) {
17758
17767
  position = placement.position;
17759
17768
  }
17760
17769
 
@@ -17771,7 +17780,7 @@ function instance$d($$self, $$props, $$invalidate) {
17771
17780
  $$invalidate(3, transforms = []);
17772
17781
 
17773
17782
  DEVICE_IDS.forEach(deviceId => {
17774
- if (!isCanvasPreview && useBreakPoint) {
17783
+ if (!isCanvasPreview() && useBreakPoint) {
17775
17784
  const positionWithBp = breakPoint[deviceId]?.placement?.position;
17776
17785
 
17777
17786
  transforms.push({
@@ -17796,12 +17805,12 @@ function instance$d($$self, $$props, $$invalidate) {
17796
17805
  }
17797
17806
  }
17798
17807
 
17799
- if ($$self.$$.dirty & /*placement, useBreakPoint, breakPoint, props*/ 360449) {
17808
+ if ($$self.$$.dirty & /*placement, useBreakPoint, breakPoint, props*/ 180225) {
17800
17809
  // 表示位置の調整のスタイルを設定
17801
17810
  {
17802
17811
  let margin = DefaultModalPlacement.margin;
17803
17812
 
17804
- if (!isCanvasPreview && placement && placement.margin !== null) {
17813
+ if (!isCanvasPreview() && placement && placement.margin !== null) {
17805
17814
  margin = placement.margin;
17806
17815
  }
17807
17816
 
@@ -17812,7 +17821,7 @@ function instance$d($$self, $$props, $$invalidate) {
17812
17821
  }
17813
17822
 
17814
17823
  DEVICE_IDS.forEach(deviceId => {
17815
- if (!isCanvasPreview && useBreakPoint) {
17824
+ if (!isCanvasPreview() && useBreakPoint) {
17816
17825
  const marginWithBp = breakPoint[deviceId]?.placement?.margin;
17817
17826
  marginStyle = getMarginStyle(marginWithBp);
17818
17827
  }
@@ -17840,7 +17849,7 @@ function instance$d($$self, $$props, $$invalidate) {
17840
17849
  }
17841
17850
  }
17842
17851
 
17843
- if ($$self.$$.dirty & /*close*/ 16777216) {
17852
+ if ($$self.$$.dirty & /*close*/ 8388608) {
17844
17853
  $$invalidate(9, handle_keydown = handleKeydown({ Escape: close }));
17845
17854
  }
17846
17855
  };
@@ -17864,7 +17873,6 @@ function instance$d($$self, $$props, $$invalidate) {
17864
17873
  backgroundClickSP,
17865
17874
  backgroundClickPC,
17866
17875
  backgroundClick,
17867
- isCanvasPreview,
17868
17876
  modalStyles,
17869
17877
  placement,
17870
17878
  breakPoint,
@@ -17894,13 +17902,13 @@ class Modal extends SvelteComponent {
17894
17902
  safe_not_equal,
17895
17903
  {
17896
17904
  useBreakPoint: 0,
17897
- placement: 15,
17898
- breakPoint: 16,
17899
- elasticity: 17,
17905
+ placement: 14,
17906
+ breakPoint: 15,
17907
+ elasticity: 16,
17900
17908
  animation: 1,
17901
- props: 18,
17902
- closeEventName: 19,
17903
- closeEventValue: 20,
17909
+ props: 17,
17910
+ closeEventName: 18,
17911
+ closeEventValue: 19,
17904
17912
  layerId: 2
17905
17913
  },
17906
17914
  add_css$9
@@ -19543,7 +19551,7 @@ function getActionRoot() {
19543
19551
  return root.shadowRoot;
19544
19552
  }
19545
19553
  /** @internal */
19546
- function ensureActionRoot() {
19554
+ function ensureActionRoot(useShadow = true) {
19547
19555
  const systemConfig = getSystem();
19548
19556
  const rootAttrs = {
19549
19557
  class: `${KARTE_ACTION_ROOT} ${KARTE_MODAL_ROOT}`,
@@ -19558,7 +19566,7 @@ function ensureActionRoot() {
19558
19566
  el = h('div', rootAttrs);
19559
19567
  document.body.appendChild(el);
19560
19568
  }
19561
- const isShadow = !!document.body.attachShadow;
19569
+ const isShadow = !!document.body.attachShadow && useShadow;
19562
19570
  if (isShadow) {
19563
19571
  return el.shadowRoot ?? el.attachShadow({ mode: 'open' });
19564
19572
  }
@@ -19627,7 +19635,7 @@ function createApp(App, options = {
19627
19635
  },
19628
19636
  },
19629
19637
  };
19630
- const win = ensureModalRoot();
19638
+ const win = ensureModalRoot(true);
19631
19639
  appArgs.target = win;
19632
19640
  return {
19633
19641
  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
  *
@@ -4,7 +4,7 @@ import { onMount as onMount$1, onDestroy as onDestroy$1, beforeUpdate as beforeU
4
4
  import 'svelte/internal/disclose-version';
5
5
  import 'svelte/internal/flags/legacy';
6
6
  import * as $ from 'svelte/internal/client';
7
- import 'svelte/easing';
7
+ import { linear, elasticOut, cubicOut } from 'svelte/easing';
8
8
 
9
9
  /** @internal */
10
10
  const ACTION_HOOK_LABEL = '__ACTION_HOOK__';
@@ -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
- return true;
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 = ALL_ACTION_ID
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 = config.map(c => c.preview_value)
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) {
@@ -2245,7 +2273,7 @@ function getActionRoot() {
2245
2273
  return root.shadowRoot;
2246
2274
  }
2247
2275
  /** @internal */
2248
- function ensureActionRoot() {
2276
+ function ensureActionRoot(useShadow = true) {
2249
2277
  const systemConfig = getSystem();
2250
2278
  const rootAttrs = {
2251
2279
  class: `${KARTE_ACTION_ROOT} ${KARTE_MODAL_ROOT}`,
@@ -2260,7 +2288,7 @@ function ensureActionRoot() {
2260
2288
  el = h('div', rootAttrs);
2261
2289
  document.body.appendChild(el);
2262
2290
  }
2263
- const isShadow = !!document.body.attachShadow;
2291
+ const isShadow = !!document.body.attachShadow && useShadow;
2264
2292
  if (isShadow) {
2265
2293
  return el.shadowRoot ?? el.attachShadow({ mode: 'open' });
2266
2294
  }
@@ -2329,7 +2357,7 @@ function createApp(App, options = {
2329
2357
  },
2330
2358
  },
2331
2359
  };
2332
- const win = ensureModalRoot();
2360
+ const win = ensureModalRoot(true);
2333
2361
  appArgs.target = win;
2334
2362
  return {
2335
2363
  close,
@@ -2849,9 +2877,11 @@ function Header($$anchor, $$props) {
2849
2877
  $fonts()
2850
2878
  ),
2851
2879
  () => {
2852
- {
2880
+ if (isPreview()) {
2853
2881
  // フォントのロードが遅れてエディタのプレビューがガタつく対策
2854
2882
  $.set(googleFontUrl, makeGoogleFontUrl(Fonts.filter((font) => font !== SYSTEM_FONT)));
2883
+ } else if ($fonts().length > 0) {
2884
+ $.set(googleFontUrl, makeGoogleFontUrl($fonts()));
2855
2885
  }
2856
2886
  }
2857
2887
  );
@@ -3362,6 +3392,54 @@ const execOnClickOperation = (onClickOperation) => {
3362
3392
  bootChat(...onClickOperation.args)();
3363
3393
  }
3364
3394
  };
3395
+ function getAnimation(animation) {
3396
+ switch (animation.type) {
3397
+ case 'fade':
3398
+ return `opacity: ${animation.progress}`;
3399
+ case 'bounce': {
3400
+ const translateX = animation.x;
3401
+ const translateY = animation.y;
3402
+ return `transform: translate3d(${translateX}%, ${translateY}%, 0) scale(${animation.progress});`;
3403
+ }
3404
+ case 'slide-down': {
3405
+ const translateX = animation.x;
3406
+ const translateY = animation.y - 100 * (1 - animation.progress);
3407
+ return `transform: translate3d(${translateX}%, ${translateY}%, 0);`;
3408
+ }
3409
+ case 'slide-up': {
3410
+ const translateX = animation.x;
3411
+ const translateY = animation.y + 100 * (1 - animation.progress);
3412
+ return `transform: translate3d(${translateX}%, ${translateY}%, 0);`;
3413
+ }
3414
+ case 'slide-left': {
3415
+ const translateX = animation.x + 100 * (1 - animation.progress);
3416
+ const translateY = animation.y;
3417
+ return `transform: translate3d(${translateX}%, ${translateY}%, 0);`;
3418
+ }
3419
+ case 'slide-right': {
3420
+ const translateX = animation.x - 100 * (1 - animation.progress);
3421
+ const translateY = animation.y;
3422
+ return `transform: translate3d(${translateX}%, ${translateY}%, 0);`;
3423
+ }
3424
+ case 'none': {
3425
+ const translateX = animation.x;
3426
+ const translateY = animation.y;
3427
+ return `transform: translate3d(${translateX}%, ${translateY}%, 0);`;
3428
+ }
3429
+ default:
3430
+ console.warn(`[action-sdk] invalid '${animation}', so we use 'transform: none' instead`);
3431
+ return 'transform: none';
3432
+ }
3433
+ }
3434
+ const EASING = {
3435
+ fade: linear,
3436
+ bounce: elasticOut,
3437
+ 'slide-down': cubicOut,
3438
+ 'slide-up': cubicOut,
3439
+ 'slide-left': cubicOut,
3440
+ 'slide-right': cubicOut,
3441
+ none: linear,
3442
+ };
3365
3443
  /**
3366
3444
  * The function to activate svelte animation.
3367
3445
  *
@@ -3373,9 +3451,23 @@ const execOnClickOperation = (onClickOperation) => {
3373
3451
  * @internal
3374
3452
  */
3375
3453
  function customAnimation(node, { transforms, animationStyle, delay = 0, duration = 1000 }) {
3376
- {
3454
+ if (!isOnSite()) {
3377
3455
  return {};
3378
3456
  }
3457
+ let [x, y] = [0, 0];
3458
+ for (const { query, x: tx, y: ty } of transforms) {
3459
+ if (query == null || window.matchMedia(query).matches) {
3460
+ x = tx;
3461
+ y = ty;
3462
+ break;
3463
+ }
3464
+ }
3465
+ return {
3466
+ delay,
3467
+ duration,
3468
+ easing: EASING[animationStyle],
3469
+ css: (progress) => getAnimation({ type: animationStyle, x, y, progress }),
3470
+ };
3379
3471
  }
3380
3472
 
3381
3473
  const getHref = (onClick) => {
@@ -6242,7 +6334,6 @@ function Modal($$anchor, $$props) {
6242
6334
  let closeEventValue = $.prop($$props, 'closeEventValue', 8, null);
6243
6335
  let layerId = $.prop($$props, 'layerId', 8, '');
6244
6336
  const { brandKit } = useBrandKit();
6245
- const isCanvasPreview = (document.querySelector('#preview')?.getAttribute('data-canvas-preview') ?? 'false') === 'true';
6246
6337
  // モーダル背景の設定
6247
6338
  const isExistBackgroundOverlayValue = placement() && placement().backgroundOverlay !== undefined;
6248
6339
  let backgroundOverlay = $.mutable_state(DefaultModalPlacement.backgroundOverlay);
@@ -6288,7 +6379,7 @@ function Modal($$anchor, $$props) {
6288
6379
  $.deep_read_state(breakPoint())
6289
6380
  ),
6290
6381
  () => {
6291
- if (!isCanvasPreview && isExistBackgroundOverlayValue) {
6382
+ if (!isCanvasPreview() && isExistBackgroundOverlayValue) {
6292
6383
  $.set(backgroundOverlay, placement().backgroundOverlay);
6293
6384
  }
6294
6385
 
@@ -6394,7 +6485,7 @@ function Modal($$anchor, $$props) {
6394
6485
  // 表示位置のスタイルの設定
6395
6486
  let position = DefaultModalPlacement.position;
6396
6487
 
6397
- if (!isCanvasPreview && placement() && placement().position !== null) {
6488
+ if (!isCanvasPreview() && placement() && placement().position !== null) {
6398
6489
  position = placement().position;
6399
6490
  }
6400
6491
 
@@ -6411,7 +6502,7 @@ function Modal($$anchor, $$props) {
6411
6502
  $.set(transforms, []);
6412
6503
 
6413
6504
  DEVICE_IDS.forEach((deviceId) => {
6414
- if (!isCanvasPreview && useBreakPoint()) {
6505
+ if (!isCanvasPreview() && useBreakPoint()) {
6415
6506
  const positionWithBp = breakPoint()[deviceId]?.placement?.position;
6416
6507
 
6417
6508
  $.get(transforms).push({
@@ -6447,7 +6538,7 @@ function Modal($$anchor, $$props) {
6447
6538
  () => {
6448
6539
  let margin = DefaultModalPlacement.margin;
6449
6540
 
6450
- if (!isCanvasPreview && placement() && placement().margin !== null) {
6541
+ if (!isCanvasPreview() && placement() && placement().margin !== null) {
6451
6542
  margin = placement().margin;
6452
6543
  }
6453
6544
 
@@ -6458,7 +6549,7 @@ function Modal($$anchor, $$props) {
6458
6549
  }
6459
6550
 
6460
6551
  DEVICE_IDS.forEach((deviceId) => {
6461
- if (!isCanvasPreview && useBreakPoint()) {
6552
+ if (!isCanvasPreview() && useBreakPoint()) {
6462
6553
  const marginWithBp = breakPoint()[deviceId]?.placement?.margin;
6463
6554
 
6464
6555
  marginStyle = getMarginStyle(marginWithBp);
@@ -6572,7 +6663,7 @@ function Modal($$anchor, $$props) {
6572
6663
  };
6573
6664
 
6574
6665
  $.if(node, ($$render) => {
6575
- if (isCanvasPreview) $$render(consequent); else $$render(alternate, false);
6666
+ if (isCanvasPreview()) $$render(consequent); else $$render(alternate, false);
6576
6667
  });
6577
6668
  }
6578
6669
 
@@ -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
  *