@plaidev/karte-action-sdk 1.1.266 → 1.1.267-29071859.db1ade43

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.
@@ -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__';
@@ -39,8 +39,10 @@ const KARTE_MODAL_ROOT = 'karte-modal-root';
39
39
  const NOOP = (_args) => { }; // eslint-disable-line @typescript-eslint/no-unused-vars
40
40
  /** @internal */
41
41
  const isPreview = () => {
42
- return true;
42
+ return !isOnSite() ;
43
43
  };
44
+ const isCanvasPreview = () => (document.querySelector('#preview')?.getAttribute('data-canvas-preview') ?? 'false') === 'true';
45
+ const isOnSite = () => (document.querySelector('#preview')?.getAttribute('data-on-site') ?? 'true') === 'true';
44
46
  /** @internal */
45
47
  const setPreviousFocus = () => {
46
48
  const previously_focused = typeof document !== 'undefined' && document.activeElement;
@@ -223,6 +225,10 @@ function onTime(time, fn) {
223
225
  const timeoutHandler = setTimeout(fn, time);
224
226
  return () => timeoutHandler && clearTimeout(timeoutHandler);
225
227
  }
228
+ /** @internal */
229
+ function randStr(digit = 8) {
230
+ return Math.random().toString(32).substring(digit);
231
+ }
226
232
  /**
227
233
  * Goolge Fonts用のURLを生成
228
234
  *
@@ -754,7 +760,7 @@ const state = writable('/');
754
760
  * @public
755
761
  */
756
762
  function setState$1(stateId, options) {
757
- if (options?.disableInPreview)
763
+ if (isPreview() && options?.disableInPreview)
758
764
  return;
759
765
  state.set(stateId);
760
766
  }
@@ -1198,8 +1204,11 @@ function cloneToJson(data) {
1198
1204
 
1199
1205
  // prettier-ignore
1200
1206
  /** @internal */
1201
- const actionId = ALL_ACTION_ID
1202
- ;
1207
+ const actionId = isPreview()
1208
+ ? ALL_ACTION_ID
1209
+ : typeof __FLYER_GEN_ACTION_ID_ON_BUILD__ === 'string'
1210
+ ? __FLYER_GEN_ACTION_ID_ON_BUILD__
1211
+ : randStr();
1203
1212
  /** @internal */
1204
1213
  const ACTION_DESTROY_EVENT = `KARTE-ACTION-DESTROY-${actionId}`;
1205
1214
  /** @internal */
@@ -1553,8 +1562,23 @@ const loadActionTableQuery = async (config, data, api_key, collection_endpoint)
1553
1562
  /** @internal */
1554
1563
  const loadActionTable = async (config, data, api_key, collection_endpoint) => {
1555
1564
  console.debug('[debug] loadActionTable', isPreview(), api_key, collection_endpoint, JSON.stringify(config));
1556
- const results = config.map(c => c.preview_value)
1557
- ;
1565
+ const results = isPreview()
1566
+ ? config.map(c => c.preview_value)
1567
+ : await Promise.all(config
1568
+ .filter(c => c.resolver === 'action-table-row' ||
1569
+ c.resolver === 'action-table-rows' ||
1570
+ c.resolver === 'action-table-query')
1571
+ .map(async (c) => {
1572
+ if (c.resolver === 'action-table-row') {
1573
+ return await loadActionTableRow(c, data, api_key, collection_endpoint);
1574
+ }
1575
+ else if (c.resolver === 'action-table-rows') {
1576
+ return await loadActionTableRows(c, data, api_key, collection_endpoint);
1577
+ }
1578
+ else if (c.resolver === 'action-table-query') {
1579
+ return await loadActionTableQuery(c, data, api_key, collection_endpoint);
1580
+ }
1581
+ }));
1558
1582
  return config.reduce((acc, c, i) => {
1559
1583
  const value = results[i] ?? c.query.default_value;
1560
1584
  if (value) {
@@ -2849,9 +2873,11 @@ function Header($$anchor, $$props) {
2849
2873
  $fonts()
2850
2874
  ),
2851
2875
  () => {
2852
- {
2876
+ if (isPreview()) {
2853
2877
  // フォントのロードが遅れてエディタのプレビューがガタつく対策
2854
2878
  $.set(googleFontUrl, makeGoogleFontUrl(Fonts.filter((font) => font !== SYSTEM_FONT)));
2879
+ } else if ($fonts().length > 0) {
2880
+ $.set(googleFontUrl, makeGoogleFontUrl($fonts()));
2855
2881
  }
2856
2882
  }
2857
2883
  );
@@ -3362,6 +3388,54 @@ const execOnClickOperation = (onClickOperation) => {
3362
3388
  bootChat(...onClickOperation.args)();
3363
3389
  }
3364
3390
  };
3391
+ function getAnimation(animation) {
3392
+ switch (animation.type) {
3393
+ case 'fade':
3394
+ return `opacity: ${animation.progress}`;
3395
+ case 'bounce': {
3396
+ const translateX = animation.x;
3397
+ const translateY = animation.y;
3398
+ return `transform: translate3d(${translateX}%, ${translateY}%, 0) scale(${animation.progress});`;
3399
+ }
3400
+ case 'slide-down': {
3401
+ const translateX = animation.x;
3402
+ const translateY = animation.y - 100 * (1 - animation.progress);
3403
+ return `transform: translate3d(${translateX}%, ${translateY}%, 0);`;
3404
+ }
3405
+ case 'slide-up': {
3406
+ const translateX = animation.x;
3407
+ const translateY = animation.y + 100 * (1 - animation.progress);
3408
+ return `transform: translate3d(${translateX}%, ${translateY}%, 0);`;
3409
+ }
3410
+ case 'slide-left': {
3411
+ const translateX = animation.x + 100 * (1 - animation.progress);
3412
+ const translateY = animation.y;
3413
+ return `transform: translate3d(${translateX}%, ${translateY}%, 0);`;
3414
+ }
3415
+ case 'slide-right': {
3416
+ const translateX = animation.x - 100 * (1 - animation.progress);
3417
+ const translateY = animation.y;
3418
+ return `transform: translate3d(${translateX}%, ${translateY}%, 0);`;
3419
+ }
3420
+ case 'none': {
3421
+ const translateX = animation.x;
3422
+ const translateY = animation.y;
3423
+ return `transform: translate3d(${translateX}%, ${translateY}%, 0);`;
3424
+ }
3425
+ default:
3426
+ console.warn(`[action-sdk] invalid '${animation}', so we use 'transform: none' instead`);
3427
+ return 'transform: none';
3428
+ }
3429
+ }
3430
+ const EASING = {
3431
+ fade: linear,
3432
+ bounce: elasticOut,
3433
+ 'slide-down': cubicOut,
3434
+ 'slide-up': cubicOut,
3435
+ 'slide-left': cubicOut,
3436
+ 'slide-right': cubicOut,
3437
+ none: linear,
3438
+ };
3365
3439
  /**
3366
3440
  * The function to activate svelte animation.
3367
3441
  *
@@ -3373,9 +3447,23 @@ const execOnClickOperation = (onClickOperation) => {
3373
3447
  * @internal
3374
3448
  */
3375
3449
  function customAnimation(node, { transforms, animationStyle, delay = 0, duration = 1000 }) {
3376
- {
3450
+ if (isPreview()) {
3377
3451
  return {};
3378
3452
  }
3453
+ let [x, y] = [0, 0];
3454
+ for (const { query, x: tx, y: ty } of transforms) {
3455
+ if (query == null || window.matchMedia(query).matches) {
3456
+ x = tx;
3457
+ y = ty;
3458
+ break;
3459
+ }
3460
+ }
3461
+ return {
3462
+ delay,
3463
+ duration,
3464
+ easing: EASING[animationStyle],
3465
+ css: (progress) => getAnimation({ type: animationStyle, x, y, progress }),
3466
+ };
3379
3467
  }
3380
3468
 
3381
3469
  const getHref = (onClick) => {
@@ -5136,11 +5224,11 @@ const IMAGE_ROUND_STYLES = {
5136
5224
  },
5137
5225
  };
5138
5226
 
5139
- var root_1$3 = $.template(`<img class="image-img svelte-gzaieg">`);
5227
+ var root_1$3 = $.template(`<img class="image-img svelte-rewdem">`);
5140
5228
 
5141
5229
  const $$css$g = {
5142
- hash: 'svelte-gzaieg',
5143
- code: '.image.svelte-gzaieg {max-width:100%;overflow:hidden;display:flex;align-items:center;justify-content:center;flex-shrink:0;}.image-img.svelte-gzaieg {vertical-align:top;width:100%;height:100%;object-fit:cover;user-select:none;-webkit-user-drag:none;}'
5230
+ hash: 'svelte-rewdem',
5231
+ code: '.image.svelte-rewdem {max-width:100%;overflow:hidden;display:flex;align-items:center;justify-content:center;}.image-img.svelte-rewdem {vertical-align:top;width:100%;height:100%;object-fit:cover;user-select:none;-webkit-user-drag:none;}'
5144
5232
  };
5145
5233
 
5146
5234
  function Image($$anchor, $$props) {
@@ -5155,6 +5243,7 @@ function Image($$anchor, $$props) {
5155
5243
 
5156
5244
  const { attributes, element, handleClick } = useClickable(props());
5157
5245
  const aspectVariantStyles = ASPECT_VARIANT[props().aspectVariant]?.getProps();
5246
+ const width = props().width ?? '100%';
5158
5247
 
5159
5248
  $.legacy_pre_effect(
5160
5249
  () => (
@@ -5164,7 +5253,8 @@ function Image($$anchor, $$props) {
5164
5253
  () => {
5165
5254
  $.set(style, objToStyle({
5166
5255
  ...props().borderTopLeftRadius ? toCssRadius(props()) : IMAGE_ROUND_STYLES[props().shape ?? 'square'],
5167
- width: props().width ?? '100%',
5256
+ width,
5257
+ flexShrink: String(width).indexOf('px') !== -1 ? 0 : 1,
5168
5258
  height: props().height ?? 'auto',
5169
5259
  aspectRatio: props().aspect ?? aspectVariantStyles?.aspect,
5170
5260
  ...toCssCommon(props()),
@@ -5191,7 +5281,7 @@ function Image($$anchor, $$props) {
5191
5281
  style: $.get(style),
5192
5282
  'data-layer-id': layerId()
5193
5283
  },
5194
- 'svelte-gzaieg'
5284
+ 'svelte-rewdem'
5195
5285
  ));
5196
5286
 
5197
5287
  $.event('click', $$element, handleClick);
@@ -6230,7 +6320,6 @@ function Modal($$anchor, $$props) {
6230
6320
  const backgroundClickSP = $.mutable_state();
6231
6321
  const handle_keydown = $.mutable_state();
6232
6322
  const visible = $.mutable_state();
6233
- const style = $.mutable_state();
6234
6323
  let useBreakPoint = $.prop($$props, 'useBreakPoint', 8, false);
6235
6324
  let placement = $.prop($$props, 'placement', 8);
6236
6325
  let breakPoint = $.prop($$props, 'breakPoint', 8);
@@ -6241,8 +6330,6 @@ function Modal($$anchor, $$props) {
6241
6330
  let closeEventValue = $.prop($$props, 'closeEventValue', 8, null);
6242
6331
  let layerId = $.prop($$props, 'layerId', 8, '');
6243
6332
  const { brandKit } = useBrandKit();
6244
- // falseが明示的に指定されている場合以外はtrueにする
6245
- const isOnSite = (document.querySelector('#preview')?.getAttribute('data-on-site') ?? 'true') !== 'false';
6246
6333
  // モーダル背景の設定
6247
6334
  const isExistBackgroundOverlayValue = placement() && placement().backgroundOverlay !== undefined;
6248
6335
  let backgroundOverlay = $.mutable_state(DefaultModalPlacement.backgroundOverlay);
@@ -6288,7 +6375,7 @@ function Modal($$anchor, $$props) {
6288
6375
  $.deep_read_state(breakPoint())
6289
6376
  ),
6290
6377
  () => {
6291
- if (isOnSite && isExistBackgroundOverlayValue) {
6378
+ if (!isCanvasPreview() && isExistBackgroundOverlayValue) {
6292
6379
  $.set(backgroundOverlay, placement().backgroundOverlay);
6293
6380
  }
6294
6381
 
@@ -6394,7 +6481,7 @@ function Modal($$anchor, $$props) {
6394
6481
  // 表示位置のスタイルの設定
6395
6482
  let position = DefaultModalPlacement.position;
6396
6483
 
6397
- if (isOnSite && placement() && placement().position !== null) {
6484
+ if (!isCanvasPreview() && placement() && placement().position !== null) {
6398
6485
  position = placement().position;
6399
6486
  }
6400
6487
 
@@ -6411,7 +6498,7 @@ function Modal($$anchor, $$props) {
6411
6498
  $.set(transforms, []);
6412
6499
 
6413
6500
  DEVICE_IDS.forEach((deviceId) => {
6414
- if (isOnSite && useBreakPoint()) {
6501
+ if (!isCanvasPreview() && useBreakPoint()) {
6415
6502
  const positionWithBp = breakPoint()[deviceId]?.placement?.position;
6416
6503
 
6417
6504
  $.get(transforms).push({
@@ -6441,12 +6528,13 @@ function Modal($$anchor, $$props) {
6441
6528
  $.deep_read_state(placement()),
6442
6529
  $.deep_read_state(useBreakPoint()),
6443
6530
  $.deep_read_state(breakPoint()),
6444
- parseStyle
6531
+ $.deep_read_state(props()),
6532
+ toCssBorder
6445
6533
  ),
6446
6534
  () => {
6447
6535
  let margin = DefaultModalPlacement.margin;
6448
6536
 
6449
- if (isOnSite && placement() && placement().margin !== null) {
6537
+ if (!isCanvasPreview() && placement() && placement().margin !== null) {
6450
6538
  margin = placement().margin;
6451
6539
  }
6452
6540
 
@@ -6457,7 +6545,7 @@ function Modal($$anchor, $$props) {
6457
6545
  }
6458
6546
 
6459
6547
  DEVICE_IDS.forEach((deviceId) => {
6460
- if (isOnSite && useBreakPoint()) {
6548
+ if (!isCanvasPreview() && useBreakPoint()) {
6461
6549
  const marginWithBp = breakPoint()[deviceId]?.placement?.margin;
6462
6550
 
6463
6551
  marginStyle = getMarginStyle(marginWithBp);
@@ -6471,6 +6559,18 @@ function Modal($$anchor, $$props) {
6471
6559
 
6472
6560
  modalStyles.add(marginVariables);
6473
6561
  });
6562
+
6563
+ const propsStyle = objToStyle({
6564
+ width: props().width,
6565
+ ...toCssOverflow(props()),
6566
+ ...toCssShadow(props()),
6567
+ ...toCssRadius(props()),
6568
+ ...toCssBackgroundImage(props()),
6569
+ ...toCssBackgroundColor(props()),
6570
+ ...toCssBorder(props())
6571
+ });
6572
+
6573
+ modalStyles.add(propsStyle);
6474
6574
  }
6475
6575
  );
6476
6576
 
@@ -6486,24 +6586,6 @@ function Modal($$anchor, $$props) {
6486
6586
  $.set(visible, false);
6487
6587
  });
6488
6588
 
6489
- $.legacy_pre_effect(
6490
- () => (
6491
- $.deep_read_state(props()),
6492
- toCssBorder
6493
- ),
6494
- () => {
6495
- $.set(style, objToStyle({
6496
- width: props().width,
6497
- ...toCssOverflow(props()),
6498
- ...toCssShadow(props()),
6499
- ...toCssRadius(props()),
6500
- ...toCssBackgroundImage(props()),
6501
- ...toCssBackgroundColor(props()),
6502
- ...toCssBorder(props())
6503
- }));
6504
- }
6505
- );
6506
-
6507
6589
  $.legacy_pre_effect_reset();
6508
6590
  $.init();
6509
6591
 
@@ -6577,7 +6659,7 @@ function Modal($$anchor, $$props) {
6577
6659
  };
6578
6660
 
6579
6661
  $.if(node, ($$render) => {
6580
- if (!isOnSite) $$render(consequent); else $$render(alternate, false);
6662
+ if (isCanvasPreview()) $$render(consequent); else $$render(alternate, false);
6581
6663
  });
6582
6664
  }
6583
6665
 
@@ -6603,10 +6685,7 @@ function Modal($$anchor, $$props) {
6603
6685
  'modal',
6604
6686
  useBreakPoint() ? 'modal-bp' : ''
6605
6687
  ].join(' ')),
6606
- () => [
6607
- Array.from(modalStyles).join(';'),
6608
- $.get(style)
6609
- ].join(' ')
6688
+ () => Array.from(modalStyles).join(';')
6610
6689
  ],
6611
6690
  $.derived_safe_equal
6612
6691
  );
@@ -39,8 +39,10 @@ const KARTE_MODAL_ROOT = 'karte-modal-root';
39
39
  const NOOP = (_args) => { }; // eslint-disable-line @typescript-eslint/no-unused-vars
40
40
  /** @internal */
41
41
  const isPreview = () => {
42
- return false;
42
+ return !isOnSite() ;
43
43
  };
44
+ const isCanvasPreview = () => (document.querySelector('#preview')?.getAttribute('data-canvas-preview') ?? 'false') === 'true';
45
+ const isOnSite = () => (document.querySelector('#preview')?.getAttribute('data-on-site') ?? 'true') === 'true';
44
46
  /** @internal */
45
47
  const setPreviousFocus = () => {
46
48
  const previously_focused = typeof document !== 'undefined' && document.activeElement;
@@ -758,6 +760,8 @@ const state = writable('/');
758
760
  * @public
759
761
  */
760
762
  function setState$1(stateId, options) {
763
+ if (isPreview() && options?.disableInPreview)
764
+ return;
761
765
  state.set(stateId);
762
766
  }
763
767
  /**
@@ -1168,7 +1172,9 @@ function cloneToJson(data) {
1168
1172
 
1169
1173
  // prettier-ignore
1170
1174
  /** @internal */
1171
- const actionId = typeof __FLYER_GEN_ACTION_ID_ON_BUILD__ === 'string'
1175
+ const actionId = isPreview()
1176
+ ? ALL_ACTION_ID
1177
+ : typeof __FLYER_GEN_ACTION_ID_ON_BUILD__ === 'string'
1172
1178
  ? __FLYER_GEN_ACTION_ID_ON_BUILD__
1173
1179
  : randStr();
1174
1180
  /** @internal */
@@ -1576,7 +1582,9 @@ const loadActionTableQuery = async (config, data, api_key, collection_endpoint)
1576
1582
  /** @internal */
1577
1583
  const loadActionTable = async (config, data, api_key, collection_endpoint) => {
1578
1584
  console.debug('[debug] loadActionTable', isPreview(), api_key, collection_endpoint, JSON.stringify(config));
1579
- const results = await Promise.all(config
1585
+ const results = isPreview()
1586
+ ? config.map(c => c.preview_value)
1587
+ : await Promise.all(config
1580
1588
  .filter(c => c.resolver === 'action-table-row' ||
1581
1589
  c.resolver === 'action-table-rows' ||
1582
1590
  c.resolver === 'action-table-query')
@@ -2906,7 +2914,10 @@ function Header($$anchor, $$props) {
2906
2914
  $fonts()
2907
2915
  ),
2908
2916
  () => {
2909
- if ($fonts().length > 0) {
2917
+ if (isPreview()) {
2918
+ // フォントのロードが遅れてエディタのプレビューがガタつく対策
2919
+ $.set(googleFontUrl, makeGoogleFontUrl(Fonts.filter((font) => font !== SYSTEM_FONT)));
2920
+ } else if ($fonts().length > 0) {
2910
2921
  $.set(googleFontUrl, makeGoogleFontUrl($fonts()));
2911
2922
  }
2912
2923
  }
@@ -3477,6 +3488,9 @@ const EASING = {
3477
3488
  * @internal
3478
3489
  */
3479
3490
  function customAnimation(node, { transforms, animationStyle, delay = 0, duration = 1000 }) {
3491
+ if (isPreview()) {
3492
+ return {};
3493
+ }
3480
3494
  let [x, y] = [0, 0];
3481
3495
  for (const { query, x: tx, y: ty } of transforms) {
3482
3496
  if (query == null || window.matchMedia(query).matches) {
@@ -5251,11 +5265,11 @@ const IMAGE_ROUND_STYLES = {
5251
5265
  },
5252
5266
  };
5253
5267
 
5254
- var root_1$3 = $.template(`<img class="image-img svelte-gzaieg">`);
5268
+ var root_1$3 = $.template(`<img class="image-img svelte-rewdem">`);
5255
5269
 
5256
5270
  const $$css$g = {
5257
- hash: 'svelte-gzaieg',
5258
- code: '.image.svelte-gzaieg {max-width:100%;overflow:hidden;display:flex;align-items:center;justify-content:center;flex-shrink:0;}.image-img.svelte-gzaieg {vertical-align:top;width:100%;height:100%;object-fit:cover;user-select:none;-webkit-user-drag:none;}'
5271
+ hash: 'svelte-rewdem',
5272
+ code: '.image.svelte-rewdem {max-width:100%;overflow:hidden;display:flex;align-items:center;justify-content:center;}.image-img.svelte-rewdem {vertical-align:top;width:100%;height:100%;object-fit:cover;user-select:none;-webkit-user-drag:none;}'
5259
5273
  };
5260
5274
 
5261
5275
  function Image($$anchor, $$props) {
@@ -5270,6 +5284,7 @@ function Image($$anchor, $$props) {
5270
5284
 
5271
5285
  const { attributes, element, handleClick } = useClickable(props());
5272
5286
  const aspectVariantStyles = ASPECT_VARIANT[props().aspectVariant]?.getProps();
5287
+ const width = props().width ?? '100%';
5273
5288
 
5274
5289
  $.legacy_pre_effect(
5275
5290
  () => (
@@ -5279,7 +5294,8 @@ function Image($$anchor, $$props) {
5279
5294
  () => {
5280
5295
  $.set(style, objToStyle({
5281
5296
  ...props().borderTopLeftRadius ? toCssRadius(props()) : IMAGE_ROUND_STYLES[props().shape ?? 'square'],
5282
- width: props().width ?? '100%',
5297
+ width,
5298
+ flexShrink: String(width).indexOf('px') !== -1 ? 0 : 1,
5283
5299
  height: props().height ?? 'auto',
5284
5300
  aspectRatio: props().aspect ?? aspectVariantStyles?.aspect,
5285
5301
  ...toCssCommon(props()),
@@ -5306,7 +5322,7 @@ function Image($$anchor, $$props) {
5306
5322
  style: $.get(style),
5307
5323
  'data-layer-id': layerId()
5308
5324
  },
5309
- 'svelte-gzaieg'
5325
+ 'svelte-rewdem'
5310
5326
  ));
5311
5327
 
5312
5328
  $.event('click', $$element, handleClick);
@@ -6345,7 +6361,6 @@ function Modal($$anchor, $$props) {
6345
6361
  const backgroundClickSP = $.mutable_state();
6346
6362
  const handle_keydown = $.mutable_state();
6347
6363
  const visible = $.mutable_state();
6348
- const style = $.mutable_state();
6349
6364
  let useBreakPoint = $.prop($$props, 'useBreakPoint', 8, false);
6350
6365
  let placement = $.prop($$props, 'placement', 8);
6351
6366
  let breakPoint = $.prop($$props, 'breakPoint', 8);
@@ -6356,8 +6371,6 @@ function Modal($$anchor, $$props) {
6356
6371
  let closeEventValue = $.prop($$props, 'closeEventValue', 8, null);
6357
6372
  let layerId = $.prop($$props, 'layerId', 8, '');
6358
6373
  const { brandKit } = useBrandKit();
6359
- // falseが明示的に指定されている場合以外はtrueにする
6360
- const isOnSite = (document.querySelector('#preview')?.getAttribute('data-on-site') ?? 'true') !== 'false';
6361
6374
  // モーダル背景の設定
6362
6375
  const isExistBackgroundOverlayValue = placement() && placement().backgroundOverlay !== undefined;
6363
6376
  let backgroundOverlay = $.mutable_state(DefaultModalPlacement.backgroundOverlay);
@@ -6403,7 +6416,7 @@ function Modal($$anchor, $$props) {
6403
6416
  $.deep_read_state(breakPoint())
6404
6417
  ),
6405
6418
  () => {
6406
- if (isOnSite && isExistBackgroundOverlayValue) {
6419
+ if (!isCanvasPreview() && isExistBackgroundOverlayValue) {
6407
6420
  $.set(backgroundOverlay, placement().backgroundOverlay);
6408
6421
  }
6409
6422
 
@@ -6509,7 +6522,7 @@ function Modal($$anchor, $$props) {
6509
6522
  // 表示位置のスタイルの設定
6510
6523
  let position = DefaultModalPlacement.position;
6511
6524
 
6512
- if (isOnSite && placement() && placement().position !== null) {
6525
+ if (!isCanvasPreview() && placement() && placement().position !== null) {
6513
6526
  position = placement().position;
6514
6527
  }
6515
6528
 
@@ -6526,7 +6539,7 @@ function Modal($$anchor, $$props) {
6526
6539
  $.set(transforms, []);
6527
6540
 
6528
6541
  DEVICE_IDS.forEach((deviceId) => {
6529
- if (isOnSite && useBreakPoint()) {
6542
+ if (!isCanvasPreview() && useBreakPoint()) {
6530
6543
  const positionWithBp = breakPoint()[deviceId]?.placement?.position;
6531
6544
 
6532
6545
  $.get(transforms).push({
@@ -6556,12 +6569,13 @@ function Modal($$anchor, $$props) {
6556
6569
  $.deep_read_state(placement()),
6557
6570
  $.deep_read_state(useBreakPoint()),
6558
6571
  $.deep_read_state(breakPoint()),
6559
- parseStyle
6572
+ $.deep_read_state(props()),
6573
+ toCssBorder
6560
6574
  ),
6561
6575
  () => {
6562
6576
  let margin = DefaultModalPlacement.margin;
6563
6577
 
6564
- if (isOnSite && placement() && placement().margin !== null) {
6578
+ if (!isCanvasPreview() && placement() && placement().margin !== null) {
6565
6579
  margin = placement().margin;
6566
6580
  }
6567
6581
 
@@ -6572,7 +6586,7 @@ function Modal($$anchor, $$props) {
6572
6586
  }
6573
6587
 
6574
6588
  DEVICE_IDS.forEach((deviceId) => {
6575
- if (isOnSite && useBreakPoint()) {
6589
+ if (!isCanvasPreview() && useBreakPoint()) {
6576
6590
  const marginWithBp = breakPoint()[deviceId]?.placement?.margin;
6577
6591
 
6578
6592
  marginStyle = getMarginStyle(marginWithBp);
@@ -6586,6 +6600,18 @@ function Modal($$anchor, $$props) {
6586
6600
 
6587
6601
  modalStyles.add(marginVariables);
6588
6602
  });
6603
+
6604
+ const propsStyle = objToStyle({
6605
+ width: props().width,
6606
+ ...toCssOverflow(props()),
6607
+ ...toCssShadow(props()),
6608
+ ...toCssRadius(props()),
6609
+ ...toCssBackgroundImage(props()),
6610
+ ...toCssBackgroundColor(props()),
6611
+ ...toCssBorder(props())
6612
+ });
6613
+
6614
+ modalStyles.add(propsStyle);
6589
6615
  }
6590
6616
  );
6591
6617
 
@@ -6601,24 +6627,6 @@ function Modal($$anchor, $$props) {
6601
6627
  $.set(visible, false);
6602
6628
  });
6603
6629
 
6604
- $.legacy_pre_effect(
6605
- () => (
6606
- $.deep_read_state(props()),
6607
- toCssBorder
6608
- ),
6609
- () => {
6610
- $.set(style, objToStyle({
6611
- width: props().width,
6612
- ...toCssOverflow(props()),
6613
- ...toCssShadow(props()),
6614
- ...toCssRadius(props()),
6615
- ...toCssBackgroundImage(props()),
6616
- ...toCssBackgroundColor(props()),
6617
- ...toCssBorder(props())
6618
- }));
6619
- }
6620
- );
6621
-
6622
6630
  $.legacy_pre_effect_reset();
6623
6631
  $.init();
6624
6632
 
@@ -6692,7 +6700,7 @@ function Modal($$anchor, $$props) {
6692
6700
  };
6693
6701
 
6694
6702
  $.if(node, ($$render) => {
6695
- if (!isOnSite) $$render(consequent); else $$render(alternate, false);
6703
+ if (isCanvasPreview()) $$render(consequent); else $$render(alternate, false);
6696
6704
  });
6697
6705
  }
6698
6706
 
@@ -6718,10 +6726,7 @@ function Modal($$anchor, $$props) {
6718
6726
  'modal',
6719
6727
  useBreakPoint() ? 'modal-bp' : ''
6720
6728
  ].join(' ')),
6721
- () => [
6722
- Array.from(modalStyles).join(';'),
6723
- $.get(style)
6724
- ].join(' ')
6729
+ () => Array.from(modalStyles).join(';')
6725
6730
  ],
6726
6731
  $.derived_safe_equal
6727
6732
  );