@jxsuite/studio 2.0.1 → 2.1.0
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/canvas.html +21 -0
- package/dist/chunks/Overlay.dev-qfjzkms8.js +23 -0
- package/dist/chunks/{Overlay.dev-cszx7yn5.js.map → Overlay.dev-qfjzkms8.js.map} +1 -1
- package/dist/chunks/{adapter-z8fkmbmv.js → adapter-qfnesn5v.js} +2 -2
- package/dist/chunks/{cf-settings-mmyv436d.js → cf-settings-73sh5z4p.js} +3 -3
- package/dist/chunks/{components-799jpvhm.js → components-2bpqp4mq.js} +5 -7
- package/dist/chunks/{components-799jpvhm.js.map → components-2bpqp4mq.js.map} +1 -1
- package/dist/chunks/content-source-34gnkbnn.js +38 -0
- package/dist/chunks/content-source-34gnkbnn.js.map +9 -0
- package/dist/chunks/convert-to-repeater-t8kxre5s.js +258 -0
- package/dist/chunks/convert-to-repeater-t8kxre5s.js.map +10 -0
- package/dist/chunks/extension-sections-6mqydz35.js +301 -0
- package/dist/chunks/extension-sections-6mqydz35.js.map +11 -0
- package/dist/chunks/files-8kn321h1.js +70 -0
- package/dist/chunks/files-8kn321h1.js.map +9 -0
- package/dist/chunks/{format-host-8jxwts2p.js → format-host-mkwsmt8d.js} +3 -3
- package/dist/chunks/git-panel-tjbr191d.js +51 -0
- package/dist/chunks/git-panel-tjbr191d.js.map +9 -0
- package/dist/chunks/{index-baeg2x3y.js → index-7pxchcce.js} +4 -3
- package/dist/chunks/{index-baeg2x3y.js.map → index-7pxchcce.js.map} +3 -3
- package/dist/chunks/{jx-validate-qx8degj7.js → jx-validate-v6qgknrs.js} +3 -3
- package/dist/chunks/layers-panel-87pb25km.js +58 -0
- package/dist/chunks/layers-panel-87pb25km.js.map +9 -0
- package/dist/chunks/{monaco-setup-zjdp9zdw.js → monaco-setup-e0yh25j4.js} +4 -75
- package/dist/chunks/{monaco-setup-zjdp9zdw.js.map → monaco-setup-e0yh25j4.js.map} +3 -4
- package/dist/chunks/publish-panel-m0fcgdrt.js +21 -0
- package/dist/chunks/publish-panel-m0fcgdrt.js.map +9 -0
- package/dist/chunks/quick-search-rhs6cbsb.js +53 -0
- package/dist/chunks/quick-search-rhs6cbsb.js.map +9 -0
- package/dist/chunks/right-panel-zpdxd98t.js +37 -0
- package/dist/chunks/right-panel-zpdxd98t.js.map +9 -0
- package/dist/chunks/section-registry-zmckaxf4.js +30 -0
- package/dist/chunks/section-registry-zmckaxf4.js.map +9 -0
- package/dist/chunks/sp-overlay.dev-9ran0sfq.js +18 -0
- package/dist/chunks/sp-overlay.dev-9ran0sfq.js.map +9 -0
- package/dist/chunks/sp-popover.dev-rebmdncr.js +9 -0
- package/dist/chunks/sp-popover.dev-rebmdncr.js.map +9 -0
- package/dist/chunks/sp-progress-circle.dev-5vkppfkt.js +15 -0
- package/dist/chunks/sp-progress-circle.dev-5vkppfkt.js.map +9 -0
- package/dist/chunks/sp-tooltip.dev-ykqrg8h5.js +15 -0
- package/dist/chunks/sp-tooltip.dev-ykqrg8h5.js.map +9 -0
- package/dist/chunks/{sp-tray.dev-pb2fsd65.js → sp-tray.dev-ey59vfh7.js} +10 -8
- package/dist/chunks/{sp-tray.dev-pb2fsd65.js.map → sp-tray.dev-ey59vfh7.js.map} +2 -2
- package/dist/chunks/{studio-9qr6fq7p.js → studio-0rqqhrdy.js} +10 -378
- package/dist/chunks/{studio-9qr6fq7p.js.map → studio-0rqqhrdy.js.map} +4 -14
- package/dist/chunks/{studio-5x6tqqec.js → studio-2sj1jj3v.js} +10 -8
- package/dist/chunks/{studio-5x6tqqec.js.map → studio-2sj1jj3v.js.map} +2 -2
- package/dist/chunks/{studio-h3fw0wn8.js → studio-3fk1ac9z.js} +6 -4
- package/dist/chunks/{studio-h3fw0wn8.js.map → studio-3fk1ac9z.js.map} +2 -2
- package/dist/chunks/studio-41exgzhq.js +6690 -0
- package/dist/chunks/studio-41exgzhq.js.map +38 -0
- package/dist/chunks/{studio-7v2bpweq.js → studio-4mqb9a0j.js} +6 -4
- package/dist/chunks/{studio-7v2bpweq.js.map → studio-4mqb9a0j.js.map} +2 -2
- package/dist/chunks/studio-50k77cca.js +1787 -0
- package/dist/chunks/studio-50k77cca.js.map +18 -0
- package/dist/chunks/{studio-56v3zwk6.js → studio-6a0h7sne.js} +10 -8
- package/dist/chunks/{studio-56v3zwk6.js.map → studio-6a0h7sne.js.map} +2 -2
- package/dist/chunks/studio-6f0am8f2.js +53 -0
- package/dist/chunks/studio-6f0am8f2.js.map +10 -0
- package/dist/chunks/studio-6nmjc5qk.js +7002 -0
- package/dist/chunks/studio-6nmjc5qk.js.map +32 -0
- package/dist/chunks/studio-7afd21nw.js +67 -0
- package/dist/chunks/studio-7afd21nw.js.map +10 -0
- package/dist/chunks/{studio-xze4zrs1.js → studio-7bmdvzne.js} +2 -2
- package/dist/chunks/studio-7bmdvzne.js.map +10 -0
- package/dist/chunks/studio-8jpzqk5s.js +128 -0
- package/dist/chunks/studio-8jpzqk5s.js.map +10 -0
- package/dist/chunks/studio-94m77tgk.js +1482 -0
- package/dist/chunks/studio-94m77tgk.js.map +13 -0
- package/dist/chunks/studio-9je6w5sq.js +1000 -0
- package/dist/chunks/studio-9je6w5sq.js.map +16 -0
- package/dist/chunks/{studio-w7c6kvk7.js → studio-a7pzveq1.js} +2 -2
- package/dist/chunks/{studio-gs6kqdt1.js → studio-adn0z1k3.js} +14 -8
- package/dist/chunks/{studio-gs6kqdt1.js.map → studio-adn0z1k3.js.map} +3 -3
- package/dist/chunks/{studio-kr88ryr7.js → studio-bsxxx3x2.js} +17 -15
- package/dist/chunks/{studio-kr88ryr7.js.map → studio-bsxxx3x2.js.map} +7 -6
- package/dist/chunks/studio-bw5dz6km.js +608 -0
- package/dist/chunks/studio-bw5dz6km.js.map +21 -0
- package/dist/chunks/studio-c6s5getc.js +4232 -0
- package/dist/chunks/studio-c6s5getc.js.map +39 -0
- package/dist/chunks/studio-cjm7fdjf.js +451 -0
- package/dist/chunks/studio-cjm7fdjf.js.map +14 -0
- package/dist/chunks/{studio-cx91mnh8.js → studio-ckwz4d3x.js} +53 -53
- package/dist/chunks/{studio-cx91mnh8.js.map → studio-ckwz4d3x.js.map} +5 -5
- package/dist/chunks/studio-dg7zyt5x.js +28 -0
- package/dist/chunks/studio-dg7zyt5x.js.map +10 -0
- package/dist/chunks/studio-dzcyvvvz.js +166 -0
- package/dist/chunks/studio-dzcyvvvz.js.map +10 -0
- package/dist/chunks/{studio-7kqe41sa.js → studio-evkr5d3b.js} +15 -7
- package/dist/chunks/{studio-7kqe41sa.js.map → studio-evkr5d3b.js.map} +5 -4
- package/dist/chunks/studio-f12h6177.js +411 -0
- package/dist/chunks/studio-f12h6177.js.map +13 -0
- package/dist/chunks/studio-hbp1s8m9.js +1817 -0
- package/dist/chunks/studio-hbp1s8m9.js.map +14 -0
- package/dist/chunks/studio-k2sxjph5.js +15295 -0
- package/dist/chunks/studio-k2sxjph5.js.map +235 -0
- package/dist/chunks/studio-myje51t3.js +385 -0
- package/dist/chunks/studio-myje51t3.js.map +12 -0
- package/dist/chunks/studio-na6rwzhw.js +353 -0
- package/dist/chunks/studio-na6rwzhw.js.map +11 -0
- package/dist/chunks/{studio-4k0m4fmp.js → studio-p471gg5n.js} +126 -3
- package/dist/chunks/studio-p471gg5n.js.map +14 -0
- package/dist/chunks/{studio-9bjwf0d4.js → studio-rgwcpast.js} +5 -46
- package/dist/chunks/{studio-9bjwf0d4.js.map → studio-rgwcpast.js.map} +4 -5
- package/dist/chunks/{studio-esrewxap.js → studio-s519zc99.js} +3 -3
- package/dist/chunks/studio-sas7mt3k.js +75 -0
- package/dist/chunks/studio-sas7mt3k.js.map +10 -0
- package/dist/chunks/studio-t5wqwzdh.js +74 -0
- package/dist/chunks/studio-t5wqwzdh.js.map +10 -0
- package/dist/chunks/{studio-9qpspwfn.js → studio-temv5bw4.js} +5 -5
- package/dist/chunks/{studio-9qpspwfn.js.map → studio-temv5bw4.js.map} +1 -1
- package/dist/chunks/{studio-qkvt37c0.js → studio-tr20m8g8.js} +669 -18
- package/dist/chunks/studio-tr20m8g8.js.map +9 -0
- package/dist/chunks/{studio-v7jkjqng.js → studio-v96qfnww.js} +5514 -4291
- package/dist/chunks/studio-v96qfnww.js.map +54 -0
- package/dist/chunks/studio-vcetc91k.js +659 -0
- package/dist/chunks/studio-vcetc91k.js.map +10 -0
- package/dist/chunks/{studio-jm0z592w.js → studio-vmymjefp.js} +2972 -4937
- package/dist/chunks/studio-vmymjefp.js.map +98 -0
- package/dist/chunks/{studio-bghqfmea.js → studio-wwseqyw0.js} +2 -2
- package/dist/chunks/studio-x9hmy5kr.js +390 -0
- package/dist/chunks/studio-x9hmy5kr.js.map +10 -0
- package/dist/chunks/studio-xa0ce0n7.js +335 -0
- package/dist/chunks/studio-xa0ce0n7.js.map +10 -0
- package/dist/chunks/studio-xm3dbxvn.js +378 -0
- package/dist/chunks/studio-xm3dbxvn.js.map +19 -0
- package/dist/chunks/{studio-nqw433kv.js → studio-xmvbhg31.js} +2 -2
- package/dist/chunks/studio-zv37yrfa.js +1054 -0
- package/dist/chunks/studio-zv37yrfa.js.map +13 -0
- package/dist/chunks/{ws-client-q7hkz3j9.js → ws-client-654ts66j.js} +6 -4
- package/dist/chunks/ws-client-654ts66j.js.map +11 -0
- package/dist/iframe-entry.js +668 -230
- package/dist/studio.js +21080 -32585
- package/index.html +35 -4685
- package/package.json +17 -15
- package/src/about/about-modal.ts +42 -11
- package/src/browse/library-commands.ts +240 -0
- package/src/browse/library-layouts.ts +369 -0
- package/src/browse/library-model.ts +396 -0
- package/src/browse/library-pane.ts +1049 -0
- package/src/browse/library-preview.ts +252 -0
- package/src/browse/library-source.ts +150 -0
- package/src/canvas/canvas-helpers.ts +33 -9
- package/src/canvas/canvas-live-render.ts +45 -29
- package/src/canvas/canvas-patcher.ts +151 -31
- package/src/canvas/canvas-perf.ts +46 -7
- package/src/canvas/canvas-render.ts +1092 -220
- package/src/canvas/canvas-surface.ts +240 -0
- package/src/canvas/canvas-utils.ts +1166 -124
- package/src/canvas/iframe-drop.ts +2 -1
- package/src/canvas/iframe-entry.ts +241 -4
- package/src/canvas/iframe-host.ts +1226 -143
- package/src/canvas/iframe-inline-edit.ts +31 -0
- package/src/canvas/iframe-interaction.ts +76 -16
- package/src/canvas/iframe-keys.ts +107 -45
- package/src/canvas/iframe-overlay.ts +38 -1
- package/src/canvas/iframe-protocol.ts +137 -2
- package/src/canvas/iframe-render.ts +70 -2
- package/src/canvas/iframe-slash.ts +6 -0
- package/src/canvas/path-mapping.ts +56 -6
- package/src/canvas/surface-registry.ts +292 -0
- package/src/collab/collab-commands.ts +244 -0
- package/src/collab/collab-session.ts +198 -32
- package/src/collab/collab-state.ts +28 -2
- package/src/collab/presence-chips.ts +100 -9
- package/src/commands/active-registry.ts +42 -0
- package/src/commands/app-commands.ts +176 -0
- package/src/commands/budget.ts +158 -0
- package/src/commands/command-args.ts +253 -0
- package/src/commands/context.ts +387 -0
- package/src/commands/defaults.ts +580 -0
- package/src/commands/keymap.ts +571 -0
- package/src/commands/levels.ts +345 -0
- package/src/commands/live-context.ts +193 -0
- package/src/commands/reference.ts +227 -0
- package/src/commands/registry.ts +293 -0
- package/src/component-props.ts +3 -2
- package/src/content/draft-state.ts +106 -0
- package/src/content/entry-commands.ts +282 -0
- package/src/content/entry-editor.ts +327 -0
- package/src/content/entry-fields.ts +116 -0
- package/src/content/entry-model.ts +175 -0
- package/src/editor/canvas-context-menu.ts +17 -11
- package/src/editor/canvas-slash-bridge.ts +11 -4
- package/src/editor/context-menu.ts +804 -204
- package/src/editor/convert-to-component.ts +31 -10
- package/src/editor/convert-to-repeater.ts +3 -2
- package/src/editor/inline-edit-apply.ts +5 -5
- package/src/editor/inline-edit.ts +86 -50
- package/src/editor/insert-zone-action.ts +1 -1
- package/src/editor/shortcuts.ts +1043 -329
- package/src/editor/slash-menu.ts +1 -0
- package/src/files/elements.ts +166 -0
- package/src/files/file-ops.ts +178 -31
- package/src/files/files.ts +898 -268
- package/src/files/fs-events.ts +21 -0
- package/src/files/media-meta.ts +203 -0
- package/src/files/media-paths.ts +141 -0
- package/src/files/media-upload.ts +7 -3
- package/src/files/media-usage.ts +189 -0
- package/src/github/github-auth.ts +235 -33
- package/src/github/github-publish.ts +80 -21
- package/src/grid/grid-controller.ts +152 -12
- package/src/grid/grid-layout.ts +225 -20
- package/src/grid/grid-open.ts +120 -0
- package/src/grid/grid-panel.ts +554 -39
- package/src/grid/grid-source.ts +27 -1
- package/src/grid/redirects-grid.ts +599 -0
- package/src/grid/redirects.ts +398 -0
- package/src/grid/sources/content-source.ts +108 -2
- package/src/i18n/i18n-commands.ts +322 -0
- package/src/new-project/add-repo-modal.ts +8 -10
- package/src/new-project/import-tab.ts +7 -0
- package/src/new-project/location-fields.ts +9 -1
- package/src/new-project/new-project-modal.ts +221 -245
- package/src/packages/jxsuite-update.ts +97 -48
- package/src/packages/pull-package-sync.ts +18 -9
- package/src/page-params.ts +2 -1
- package/src/panels/activity-bar.ts +152 -91
- package/src/panels/activity-panel.ts +481 -0
- package/src/panels/ai-chat/chat-markdown.ts +8 -3
- package/src/panels/ai-chat/chat-view.ts +245 -18
- package/src/panels/ai-chat/composer.ts +31 -5
- package/src/panels/ai-chat/sessions-view.ts +17 -10
- package/src/panels/ai-panel.ts +279 -53
- package/src/panels/block-action-bar.ts +1115 -224
- package/src/panels/bottom-dock.ts +337 -0
- package/src/panels/canvas-dnd-bridge.ts +37 -8
- package/src/panels/chat-panel.ts +29 -12
- package/src/panels/data-explorer.ts +254 -112
- package/src/panels/data-grid.ts +10 -4
- package/src/panels/dnd.ts +28 -51
- package/src/panels/editors.ts +434 -107
- package/src/panels/elements-panel.ts +66 -2
- package/src/panels/empty-state.ts +112 -0
- package/src/panels/events-panel.ts +596 -82
- package/src/panels/formula-workspace.ts +408 -218
- package/src/panels/frontmatter-fields.ts +51 -10
- package/src/panels/frontmatter-panel.ts +357 -79
- package/src/panels/git-panel.ts +375 -164
- package/src/panels/head-panel.ts +791 -85
- package/src/panels/i18n-panel.ts +592 -0
- package/src/panels/imports-panel.ts +95 -85
- package/src/panels/jump-bar.ts +584 -0
- package/src/panels/layers-panel.ts +1106 -328
- package/src/panels/left-panel.ts +109 -204
- package/src/panels/navigator-panels.ts +131 -0
- package/src/panels/overlays.ts +7 -2
- package/src/panels/pane-context.ts +1477 -0
- package/src/panels/pane-grid.ts +406 -0
- package/src/panels/panel-registry.ts +340 -0
- package/src/panels/panel-scheduler.ts +75 -0
- package/src/panels/problems-panel.ts +234 -0
- package/src/panels/properties-panel.ts +946 -1139
- package/src/panels/provenance.ts +258 -0
- package/src/panels/quick-search.ts +791 -122
- package/src/panels/right-panel.ts +228 -102
- package/src/panels/seo-modal.ts +395 -0
- package/src/panels/settings-pane.ts +203 -0
- package/src/panels/signals-panel.ts +354 -137
- package/src/panels/statement-editor.ts +41 -25
- package/src/panels/statusbar.ts +342 -106
- package/src/panels/style-panel.ts +974 -463
- package/src/panels/style-utils.ts +3 -3
- package/src/panels/stylebook-doc.ts +4 -2
- package/src/panels/stylebook-layers-panel.ts +3 -2
- package/src/panels/stylebook-panel.ts +51 -26
- package/src/panels/tab-strip.ts +1058 -78
- package/src/panels/target-line.ts +274 -0
- package/src/panels/toolbar.ts +631 -484
- package/src/panels/welcome-screen.ts +301 -198
- package/src/platform-errors.ts +26 -3
- package/src/platform.ts +96 -2
- package/src/platforms/cloud.ts +71 -8
- package/src/platforms/devserver.ts +92 -29
- package/src/publish/deploy-checklist.ts +383 -0
- package/src/publish/pages-service.ts +10 -1
- package/src/publish/publish-commands.ts +218 -0
- package/src/publish/publish-panel.ts +110 -16
- package/src/recent-projects.ts +3 -2
- package/src/services/a11y-report.ts +505 -0
- package/src/services/ai-models.ts +30 -1
- package/src/services/ai-project-tools.ts +29 -10
- package/src/services/ai-system-prompt.ts +53 -14
- package/src/services/ai-tools.ts +39 -3
- package/src/services/ai-writes.ts +154 -0
- package/src/services/announce.ts +97 -0
- package/src/services/automation.ts +424 -175
- package/src/services/cem-export.ts +9 -4
- package/src/services/clock.ts +61 -0
- package/src/services/document-assistant.ts +36 -8
- package/src/services/idle.ts +179 -0
- package/src/services/import-client.ts +26 -0
- package/src/services/monaco-buffer.ts +627 -0
- package/src/services/monaco-lazy.ts +36 -0
- package/src/services/notify.ts +271 -0
- package/src/services/profile.ts +155 -0
- package/src/services/references.ts +0 -0
- package/src/services/token-lint.ts +3 -2
- package/src/services/tool-executor.ts +53 -7
- package/src/services/trusted-types.ts +123 -0
- package/src/settings/contexts-section.ts +427 -0
- package/src/settings/contributed-section.ts +149 -11
- package/src/settings/css-vars-editor.ts +306 -349
- package/src/settings/defs-editor.ts +93 -34
- package/src/settings/dependencies-editor.ts +7 -7
- package/src/settings/extension-sections.ts +37 -5
- package/src/settings/general-settings.ts +204 -121
- package/src/settings/locales-section.ts +347 -0
- package/src/settings/preferences-accounts.ts +140 -0
- package/src/settings/preferences-dialog.ts +620 -0
- package/src/settings/preferences-keymap.ts +270 -0
- package/src/settings/project-sections.ts +260 -0
- package/src/settings/section-registry.ts +169 -0
- package/src/settings/settings-document.ts +385 -0
- package/src/shell.ts +1549 -0
- package/src/site-context.ts +45 -20
- package/src/state.ts +14 -275
- package/src/store.ts +88 -43
- package/src/studio.ts +790 -346
- package/src/style/live-preview.ts +36 -0
- package/src/style/project-styles.ts +349 -0
- package/src/style/token-ref.ts +123 -0
- package/src/tabs/patch-ops.ts +16 -4
- package/src/tabs/project-config.ts +416 -0
- package/src/tabs/selection.ts +323 -0
- package/src/tabs/tab.ts +182 -47
- package/src/tabs/transact.ts +209 -28
- package/src/types.ts +68 -13
- package/src/ui/ai-credentials-form.ts +39 -35
- package/src/ui/ai-managed-connect.ts +7 -1
- package/src/ui/dynamic-slot.ts +224 -81
- package/src/ui/expression-editor.ts +71 -63
- package/src/ui/field-input.ts +4 -6
- package/src/ui/field-row.ts +215 -38
- package/src/ui/form-controls.ts +194 -7
- package/src/ui/layers.ts +492 -69
- package/src/ui/media-picker.ts +115 -25
- package/src/ui/panel-resize.ts +109 -91
- package/src/ui/progress-modal.ts +131 -50
- package/src/ui/regions.ts +462 -0
- package/src/ui/schema-form.ts +229 -45
- package/src/ui/spectrum.ts +24 -8
- package/src/ui/timing.ts +49 -0
- package/src/ui/value-selector.ts +20 -0
- package/src/ui/value-source.ts +348 -0
- package/src/ui/virtual-window.ts +400 -0
- package/src/utils/edit-display.ts +3 -2
- package/src/utils/inherited-style.ts +67 -37
- package/src/view.ts +64 -78
- package/src/workspace/pane-derive.ts +1258 -0
- package/src/workspace/session.ts +317 -0
- package/src/workspace/workspace.ts +1345 -23
- package/styles/canvas.css +653 -0
- package/styles/forced-colors.css +106 -0
- package/styles/inspector.css +1454 -0
- package/styles/overlays.css +2704 -0
- package/styles/panels.css +1701 -0
- package/styles/shell.css +1423 -0
- package/styles/tokens.css +151 -0
- package/dist/chunks/Overlay.dev-cszx7yn5.js +0 -22
- package/dist/chunks/extension-sections-qr3drkkw.js +0 -531
- package/dist/chunks/extension-sections-qr3drkkw.js.map +0 -12
- package/dist/chunks/files-j8a1t06k.js +0 -50
- package/dist/chunks/files-j8a1t06k.js.map +0 -9
- package/dist/chunks/git-panel-xtq5z81x.js +0 -28
- package/dist/chunks/git-panel-xtq5z81x.js.map +0 -9
- package/dist/chunks/layers-panel-ancn2wpq.js +0 -26
- package/dist/chunks/layers-panel-ancn2wpq.js.map +0 -9
- package/dist/chunks/settings-modal-17ttr96g.js +0 -29
- package/dist/chunks/settings-modal-17ttr96g.js.map +0 -9
- package/dist/chunks/sp-overlay.dev-earn5as8.js +0 -17
- package/dist/chunks/sp-overlay.dev-earn5as8.js.map +0 -9
- package/dist/chunks/sp-popover.dev-frxtfejn.js +0 -8
- package/dist/chunks/sp-popover.dev-frxtfejn.js.map +0 -9
- package/dist/chunks/sp-progress-circle.dev-7tvw34h8.js +0 -14
- package/dist/chunks/sp-progress-circle.dev-7tvw34h8.js.map +0 -9
- package/dist/chunks/sp-tooltip.dev-a9fywesm.js +0 -21
- package/dist/chunks/sp-tooltip.dev-a9fywesm.js.map +0 -10
- package/dist/chunks/studio-0xgs7xrs.js +0 -429
- package/dist/chunks/studio-0xgs7xrs.js.map +0 -13
- package/dist/chunks/studio-4d8hzcz5.js +0 -3427
- package/dist/chunks/studio-4d8hzcz5.js.map +0 -26
- package/dist/chunks/studio-4k0m4fmp.js.map +0 -13
- package/dist/chunks/studio-9smfzqhc.js +0 -19
- package/dist/chunks/studio-9smfzqhc.js.map +0 -10
- package/dist/chunks/studio-jm0z592w.js.map +0 -115
- package/dist/chunks/studio-m2t4mdg5.js +0 -1854
- package/dist/chunks/studio-m2t4mdg5.js.map +0 -18
- package/dist/chunks/studio-n4p11dfy.js +0 -853
- package/dist/chunks/studio-n4p11dfy.js.map +0 -12
- package/dist/chunks/studio-qkvt37c0.js.map +0 -9
- package/dist/chunks/studio-sjh1wt1a.js +0 -3744
- package/dist/chunks/studio-sjh1wt1a.js.map +0 -22
- package/dist/chunks/studio-v7jkjqng.js.map +0 -46
- package/dist/chunks/studio-xq0t7n5t.js +0 -140
- package/dist/chunks/studio-xq0t7n5t.js.map +0 -10
- package/dist/chunks/studio-xze4zrs1.js.map +0 -10
- package/dist/chunks/studio-yfcstdzy.js +0 -399
- package/dist/chunks/studio-yfcstdzy.js.map +0 -12
- package/dist/chunks/studio-zp7jncs8.js +0 -469
- package/dist/chunks/studio-zp7jncs8.js.map +0 -14
- package/dist/chunks/ws-client-q7hkz3j9.js.map +0 -11
- package/src/browse/browse-modal.ts +0 -69
- package/src/browse/browse.ts +0 -904
- package/src/canvas/canvas-diff.ts +0 -216
- package/src/canvas/nested-site-style.ts +0 -58
- package/src/new-project/design-fields.ts +0 -264
- package/src/new-project/templates.ts +0 -61
- package/src/panels/tab-bar.ts +0 -548
- package/src/settings/settings-modal.ts +0 -203
- /package/dist/chunks/{adapter-z8fkmbmv.js.map → adapter-qfnesn5v.js.map} +0 -0
- /package/dist/chunks/{cf-settings-mmyv436d.js.map → cf-settings-73sh5z4p.js.map} +0 -0
- /package/dist/chunks/{format-host-8jxwts2p.js.map → format-host-mkwsmt8d.js.map} +0 -0
- /package/dist/chunks/{jx-validate-qx8degj7.js.map → jx-validate-v6qgknrs.js.map} +0 -0
- /package/dist/chunks/{studio-w7c6kvk7.js.map → studio-a7pzveq1.js.map} +0 -0
- /package/dist/chunks/{studio-esrewxap.js.map → studio-s519zc99.js.map} +0 -0
- /package/dist/chunks/{studio-bghqfmea.js.map → studio-wwseqyw0.js.map} +0 -0
- /package/dist/chunks/{studio-nqw433kv.js.map → studio-xmvbhg31.js.map} +0 -0
package/dist/iframe-entry.js
CHANGED
|
@@ -31,6 +31,88 @@ function postMessageChannel(opts) {
|
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
// ../schema/src/guards.ts
|
|
35
|
+
function isJsonObject(value) {
|
|
36
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
37
|
+
}
|
|
38
|
+
function isRef(value) {
|
|
39
|
+
return isJsonObject(value) && typeof value.$ref === "string";
|
|
40
|
+
}
|
|
41
|
+
function isFunctionDef(value) {
|
|
42
|
+
return isJsonObject(value) && value.$prototype === "Function";
|
|
43
|
+
}
|
|
44
|
+
function isExpressionDef(value) {
|
|
45
|
+
return isJsonObject(value) && isJsonObject(value.$expression);
|
|
46
|
+
}
|
|
47
|
+
function isNamedFormulaDef(value) {
|
|
48
|
+
return isExpressionDef(value) && Array.isArray(value.parameters) && value.parameters.length > 0;
|
|
49
|
+
}
|
|
50
|
+
function hasStructuredBody(value) {
|
|
51
|
+
return isFunctionDef(value) && Array.isArray(value.body);
|
|
52
|
+
}
|
|
53
|
+
function isPrototypeDef(value) {
|
|
54
|
+
return isJsonObject(value) && typeof value.$prototype === "string" && value.$prototype !== "Function";
|
|
55
|
+
}
|
|
56
|
+
function isServerFnDef(value) {
|
|
57
|
+
return isJsonObject(value) && value.timing === "server" && typeof value.$src === "string" && typeof value.$export === "string" && !value.$prototype;
|
|
58
|
+
}
|
|
59
|
+
var SCHEMA_KEYWORDS = new Set([
|
|
60
|
+
"type",
|
|
61
|
+
"enum",
|
|
62
|
+
"minimum",
|
|
63
|
+
"maximum",
|
|
64
|
+
"minLength",
|
|
65
|
+
"maxLength",
|
|
66
|
+
"pattern",
|
|
67
|
+
"format",
|
|
68
|
+
"items",
|
|
69
|
+
"properties",
|
|
70
|
+
"required",
|
|
71
|
+
"description",
|
|
72
|
+
"title",
|
|
73
|
+
"$comment"
|
|
74
|
+
]);
|
|
75
|
+
function isMappedArray(value) {
|
|
76
|
+
return isJsonObject(value) && value.$prototype === "Array";
|
|
77
|
+
}
|
|
78
|
+
function isTemplateString(value) {
|
|
79
|
+
return typeof value === "string" && value.includes("${");
|
|
80
|
+
}
|
|
81
|
+
function bodyReturnsValue(body) {
|
|
82
|
+
return /\breturn\b[^\S\n]*(?![;}\s]|$)/.test(body);
|
|
83
|
+
}
|
|
84
|
+
function isEventBinding(value) {
|
|
85
|
+
return isRef(value) || isFunctionDef(value) || isExpressionDef(value);
|
|
86
|
+
}
|
|
87
|
+
function paramNames(parameters) {
|
|
88
|
+
if (!parameters) {
|
|
89
|
+
return [];
|
|
90
|
+
}
|
|
91
|
+
return parameters.map((p) => typeof p === "string" ? p : p.name);
|
|
92
|
+
}
|
|
93
|
+
function isTagExpression(tagName) {
|
|
94
|
+
return isJsonObject(tagName) && isJsonObject(tagName.$expression);
|
|
95
|
+
}
|
|
96
|
+
function tagNameCandidates(tagName) {
|
|
97
|
+
if (typeof tagName === "string") {
|
|
98
|
+
return [tagName];
|
|
99
|
+
}
|
|
100
|
+
if (!isTagExpression(tagName)) {
|
|
101
|
+
return [];
|
|
102
|
+
}
|
|
103
|
+
const expression = tagName.$expression;
|
|
104
|
+
if (expression.operator === "?:") {
|
|
105
|
+
return [...new Set([expression.value, expression.initial])];
|
|
106
|
+
}
|
|
107
|
+
return [...new Set([...Object.values(expression.cases), expression.default])];
|
|
108
|
+
}
|
|
109
|
+
function displayTagName(tagName) {
|
|
110
|
+
return typeof tagName === "string" ? tagName : tagNameCandidates(tagName).join("|");
|
|
111
|
+
}
|
|
112
|
+
function isPrivateStateKey(key) {
|
|
113
|
+
return key.startsWith("#");
|
|
114
|
+
}
|
|
115
|
+
|
|
34
116
|
// ../../node_modules/@vue/shared/dist/shared.esm-bundler.js
|
|
35
117
|
function makeMap(str) {
|
|
36
118
|
const map = /* @__PURE__ */ Object.create(null);
|
|
@@ -77,7 +159,7 @@ var toHandlerKey = cacheStringFunction((str) => {
|
|
|
77
159
|
});
|
|
78
160
|
var hasChanged = (value, oldValue) => !Object.is(value, oldValue);
|
|
79
161
|
var specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
|
|
80
|
-
var isBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,
|
|
162
|
+
var isBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`);
|
|
81
163
|
|
|
82
164
|
// ../../node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js
|
|
83
165
|
function warn(msg, ...args) {
|
|
@@ -947,7 +1029,7 @@ class BaseReactiveHandler {
|
|
|
947
1029
|
return hasOwnProperty2;
|
|
948
1030
|
}
|
|
949
1031
|
}
|
|
950
|
-
const res = Reflect.get(target, key,
|
|
1032
|
+
const res = Reflect.get(target, key, isRef2(target) ? target : receiver);
|
|
951
1033
|
if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
|
|
952
1034
|
return res;
|
|
953
1035
|
}
|
|
@@ -957,7 +1039,7 @@ class BaseReactiveHandler {
|
|
|
957
1039
|
if (isShallow2) {
|
|
958
1040
|
return res;
|
|
959
1041
|
}
|
|
960
|
-
if (
|
|
1042
|
+
if (isRef2(res)) {
|
|
961
1043
|
const value = targetIsArray && isIntegerKey(key) ? res : res.value;
|
|
962
1044
|
return isReadonly2 && isObject(value) ? readonly(value) : value;
|
|
963
1045
|
}
|
|
@@ -981,7 +1063,7 @@ class MutableReactiveHandler extends BaseReactiveHandler {
|
|
|
981
1063
|
oldValue = toRaw(oldValue);
|
|
982
1064
|
value = toRaw(value);
|
|
983
1065
|
}
|
|
984
|
-
if (!isArrayWithIntegerKey &&
|
|
1066
|
+
if (!isArrayWithIntegerKey && isRef2(oldValue) && !isRef2(value)) {
|
|
985
1067
|
if (isOldValueReadonly) {
|
|
986
1068
|
if (true) {
|
|
987
1069
|
warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target[key]);
|
|
@@ -994,7 +1076,7 @@ class MutableReactiveHandler extends BaseReactiveHandler {
|
|
|
994
1076
|
}
|
|
995
1077
|
}
|
|
996
1078
|
const hadKey = isArrayWithIntegerKey ? Number(key) < target.length : hasOwn(target, key);
|
|
997
|
-
const result = Reflect.set(target, key, value,
|
|
1079
|
+
const result = Reflect.set(target, key, value, isRef2(target) ? target : receiver);
|
|
998
1080
|
if (target === toRaw(receiver) && result) {
|
|
999
1081
|
if (!hadKey) {
|
|
1000
1082
|
trigger(target, "add", key, value);
|
|
@@ -1305,14 +1387,14 @@ function toRaw(observed) {
|
|
|
1305
1387
|
}
|
|
1306
1388
|
var toReactive = (value) => isObject(value) ? /* @__PURE__ */ reactive(value) : value;
|
|
1307
1389
|
var toReadonly = (value) => isObject(value) ? /* @__PURE__ */ readonly(value) : value;
|
|
1308
|
-
function
|
|
1390
|
+
function isRef2(r) {
|
|
1309
1391
|
return r ? r["__v_isRef"] === true : false;
|
|
1310
1392
|
}
|
|
1311
1393
|
function ref(value) {
|
|
1312
1394
|
return createRef(value, false);
|
|
1313
1395
|
}
|
|
1314
1396
|
function createRef(rawValue, shallow) {
|
|
1315
|
-
if (/* @__PURE__ */
|
|
1397
|
+
if (/* @__PURE__ */ isRef2(rawValue)) {
|
|
1316
1398
|
return rawValue;
|
|
1317
1399
|
}
|
|
1318
1400
|
return new RefImpl(rawValue, shallow);
|
|
@@ -1417,6 +1499,80 @@ function computed(getterOrOptions, debugOptions, isSSR = false) {
|
|
|
1417
1499
|
return cRef;
|
|
1418
1500
|
}
|
|
1419
1501
|
|
|
1502
|
+
// ../schema/src/intl.ts
|
|
1503
|
+
var DEFAULT_FORMAT_LOCALE = "en-US";
|
|
1504
|
+
var DEFAULT_TIME_ZONE = "UTC";
|
|
1505
|
+
var INTL_HELPERS = [
|
|
1506
|
+
{
|
|
1507
|
+
api: "Intl.NumberFormat",
|
|
1508
|
+
params: ["value", "locale", "options"],
|
|
1509
|
+
path: "Intl/formatNumber",
|
|
1510
|
+
summary: "Format a number for a locale — grouping, decimals, currency, percent, units."
|
|
1511
|
+
},
|
|
1512
|
+
{
|
|
1513
|
+
api: "Intl.DateTimeFormat",
|
|
1514
|
+
params: ["value", "locale", "options"],
|
|
1515
|
+
path: "Intl/formatDate",
|
|
1516
|
+
summary: "Format a date or timestamp for a locale. Pass `timeZone` in options."
|
|
1517
|
+
},
|
|
1518
|
+
{
|
|
1519
|
+
api: "Intl.RelativeTimeFormat",
|
|
1520
|
+
params: ["value", "unit", "locale", "options"],
|
|
1521
|
+
path: "Intl/formatRelativeTime",
|
|
1522
|
+
summary: 'Format a relative time — `-3, "day"` becomes "3 days ago".'
|
|
1523
|
+
},
|
|
1524
|
+
{
|
|
1525
|
+
api: "Intl.ListFormat",
|
|
1526
|
+
params: ["values", "locale", "options"],
|
|
1527
|
+
path: "Intl/formatList",
|
|
1528
|
+
summary: 'Join a list the way a locale does — "a, b, and c", not a hand-written comma join.'
|
|
1529
|
+
},
|
|
1530
|
+
{
|
|
1531
|
+
api: "Intl.PluralRules",
|
|
1532
|
+
params: ["value", "locale", "options"],
|
|
1533
|
+
path: "Intl/plural",
|
|
1534
|
+
summary: 'Which plural category a number falls in ("one", "few", "other") — many languages have ' + "more than two, so a ternary on `n === 1` is wrong outside English."
|
|
1535
|
+
},
|
|
1536
|
+
{
|
|
1537
|
+
api: "Intl.Collator",
|
|
1538
|
+
params: ["a", "b", "locale", "options"],
|
|
1539
|
+
path: "Intl/compare",
|
|
1540
|
+
summary: "Compare two strings for sorting. `<` and `sort()` order by UTF-16 code unit, which puts " + '"Zebra" before "apple" and sorts every accented word into the wrong place.'
|
|
1541
|
+
},
|
|
1542
|
+
{
|
|
1543
|
+
api: "Intl.DisplayNames",
|
|
1544
|
+
params: ["code", "type", "locale", "options"],
|
|
1545
|
+
path: "Intl/displayName",
|
|
1546
|
+
summary: 'The name of a language, region, script or currency in a locale — "de" as "German" or ' + '"Deutsch", from CLDR rather than a hand-kept table.'
|
|
1547
|
+
},
|
|
1548
|
+
{
|
|
1549
|
+
api: "Intl.Segmenter",
|
|
1550
|
+
params: ["value", "granularity", "locale"],
|
|
1551
|
+
path: "Intl/segment",
|
|
1552
|
+
summary: "Split text into graphemes, words or sentences (UAX #29). `[...str]` splits code points, " + "so it cuts an emoji with a skin-tone modifier in half."
|
|
1553
|
+
}
|
|
1554
|
+
];
|
|
1555
|
+
var INTL_HELPER_PATHS = INTL_HELPERS.map((helper) => helper.path);
|
|
1556
|
+
var INTL_LOCALE_PARAM = Object.fromEntries(INTL_HELPERS.map((helper) => [helper.path, helper.params.indexOf("locale")]));
|
|
1557
|
+
|
|
1558
|
+
// ../runtime/src/pointer.ts
|
|
1559
|
+
function unescapeToken(token) {
|
|
1560
|
+
return token.replaceAll("~1", "/").replaceAll("~0", "~");
|
|
1561
|
+
}
|
|
1562
|
+
function refSegments(path) {
|
|
1563
|
+
if (path === "") {
|
|
1564
|
+
return [];
|
|
1565
|
+
}
|
|
1566
|
+
return path.split("/").map((token) => unescapeToken(token));
|
|
1567
|
+
}
|
|
1568
|
+
function readPath(root, path) {
|
|
1569
|
+
let current = root;
|
|
1570
|
+
for (const key of refSegments(path)) {
|
|
1571
|
+
current = current?.[key];
|
|
1572
|
+
}
|
|
1573
|
+
return current;
|
|
1574
|
+
}
|
|
1575
|
+
|
|
1420
1576
|
// ../runtime/src/expression.ts
|
|
1421
1577
|
function scopeMap(state) {
|
|
1422
1578
|
const map = state.$map;
|
|
@@ -1537,15 +1693,42 @@ var BLESSED_GLOBALS = new Set([
|
|
|
1537
1693
|
"Array/of",
|
|
1538
1694
|
"String/fromCharCode",
|
|
1539
1695
|
"String/fromCodePoint",
|
|
1540
|
-
|
|
1541
|
-
"Intl/formatDate",
|
|
1542
|
-
"Intl/formatRelativeTime"
|
|
1696
|
+
...INTL_HELPER_PATHS
|
|
1543
1697
|
]);
|
|
1544
1698
|
var BLESSED_HELPERS = {
|
|
1545
|
-
"Intl/
|
|
1546
|
-
"Intl/
|
|
1547
|
-
|
|
1699
|
+
"Intl/compare": (a, b, locale, options) => new Intl.Collator(locale ?? DEFAULT_FORMAT_LOCALE, options).compare(a, b),
|
|
1700
|
+
"Intl/displayName": (code, type, locale, options) => new Intl.DisplayNames(locale ?? DEFAULT_FORMAT_LOCALE, {
|
|
1701
|
+
...options,
|
|
1702
|
+
type: type ?? "language"
|
|
1703
|
+
}).of(code),
|
|
1704
|
+
"Intl/formatDate": (value, locale, options) => new Intl.DateTimeFormat(locale ?? DEFAULT_FORMAT_LOCALE, {
|
|
1705
|
+
timeZone: DEFAULT_TIME_ZONE,
|
|
1706
|
+
...options
|
|
1707
|
+
}).format(new Date(value)),
|
|
1708
|
+
"Intl/formatList": (values, locale, options) => new Intl.ListFormat(locale ?? DEFAULT_FORMAT_LOCALE, options).format(values),
|
|
1709
|
+
"Intl/formatNumber": (value, locale, options) => new Intl.NumberFormat(locale ?? DEFAULT_FORMAT_LOCALE, options).format(value),
|
|
1710
|
+
"Intl/formatRelativeTime": (value, unit, locale, options) => new Intl.RelativeTimeFormat(locale ?? DEFAULT_FORMAT_LOCALE, options).format(value, unit),
|
|
1711
|
+
"Intl/plural": (value, locale, options) => new Intl.PluralRules(locale ?? DEFAULT_FORMAT_LOCALE, options).select(value),
|
|
1712
|
+
"Intl/segment": (value, granularity, locale) => [
|
|
1713
|
+
...new Intl.Segmenter(locale ?? DEFAULT_FORMAT_LOCALE, {
|
|
1714
|
+
granularity: granularity ?? "grapheme"
|
|
1715
|
+
}).segment(value)
|
|
1716
|
+
].map((part) => part.segment)
|
|
1548
1717
|
};
|
|
1718
|
+
function withPageLocale(path, args, state) {
|
|
1719
|
+
const index = INTL_LOCALE_PARAM[path];
|
|
1720
|
+
if (index === undefined || index < 0 || args[index] != null) {
|
|
1721
|
+
return args;
|
|
1722
|
+
}
|
|
1723
|
+
const page = state.$page;
|
|
1724
|
+
const locale = page?.locale;
|
|
1725
|
+
if (typeof locale !== "string" || locale === "") {
|
|
1726
|
+
return args;
|
|
1727
|
+
}
|
|
1728
|
+
const filled = [...args];
|
|
1729
|
+
filled[index] = locale;
|
|
1730
|
+
return filled;
|
|
1731
|
+
}
|
|
1549
1732
|
function isBlessedGlobal(ref2) {
|
|
1550
1733
|
return ref2.startsWith("window#/") && BLESSED_GLOBALS.has(ref2.slice("window#/".length));
|
|
1551
1734
|
}
|
|
@@ -1617,15 +1800,10 @@ function resolveExprRef(ref2, state, event, iterCtx) {
|
|
|
1617
1800
|
return parts.length > 2 ? getPath(base, parts.slice(2).join("/")) : base;
|
|
1618
1801
|
}
|
|
1619
1802
|
if (ref2.startsWith("#/state/")) {
|
|
1620
|
-
|
|
1621
|
-
const slash = sub.indexOf("/");
|
|
1622
|
-
if (slash === -1) {
|
|
1623
|
-
return state[sub];
|
|
1624
|
-
}
|
|
1625
|
-
return getPath(state[sub.slice(0, slash)], sub.slice(slash + 1));
|
|
1803
|
+
return readPath(state, ref2.slice("#/state/".length));
|
|
1626
1804
|
}
|
|
1627
1805
|
if (ref2.startsWith("parent#/")) {
|
|
1628
|
-
return state
|
|
1806
|
+
return readPath(state, ref2.slice("parent#/".length));
|
|
1629
1807
|
}
|
|
1630
1808
|
if (ref2.startsWith("window#/")) {
|
|
1631
1809
|
return getPath(globalThis.window, ref2.slice("window#/".length));
|
|
@@ -1633,7 +1811,7 @@ function resolveExprRef(ref2, state, event, iterCtx) {
|
|
|
1633
1811
|
if (ref2.startsWith("document#/")) {
|
|
1634
1812
|
return getPath(globalThis.document, ref2.slice("document#/".length));
|
|
1635
1813
|
}
|
|
1636
|
-
return state
|
|
1814
|
+
return readPath(state, ref2) ?? null;
|
|
1637
1815
|
}
|
|
1638
1816
|
function resolveWritableRef(ref2, state, _event, iterCtx) {
|
|
1639
1817
|
if (ref2.startsWith("$map/")) {
|
|
@@ -1665,7 +1843,7 @@ function resolveWritableRef(ref2, state, _event, iterCtx) {
|
|
|
1665
1843
|
if (slash === -1) {
|
|
1666
1844
|
return { key: sub, obj: state };
|
|
1667
1845
|
}
|
|
1668
|
-
const parts = sub
|
|
1846
|
+
const parts = refSegments(sub);
|
|
1669
1847
|
const lastKey = parts.pop();
|
|
1670
1848
|
let obj = state;
|
|
1671
1849
|
for (const p of parts) {
|
|
@@ -1711,7 +1889,7 @@ function evaluateNode(node, state, event, iterCtx, trace) {
|
|
|
1711
1889
|
const globalPath = calleeRef.slice("window#/".length);
|
|
1712
1890
|
const helper = BLESSED_HELPERS[globalPath];
|
|
1713
1891
|
if (helper) {
|
|
1714
|
-
return helper(...argValues);
|
|
1892
|
+
return helper(...withPageLocale(globalPath, argValues, state));
|
|
1715
1893
|
}
|
|
1716
1894
|
const fn = getPath(globalThis.window, globalPath);
|
|
1717
1895
|
const lastSlash = globalPath.lastIndexOf("/");
|
|
@@ -1900,76 +2078,12 @@ function evaluateNode(node, state, event, iterCtx, trace) {
|
|
|
1900
2078
|
return;
|
|
1901
2079
|
}
|
|
1902
2080
|
function getPath(obj, path) {
|
|
1903
|
-
|
|
1904
|
-
for (const k of path.split(/[./]/)) {
|
|
1905
|
-
current = current?.[k];
|
|
1906
|
-
}
|
|
1907
|
-
return current;
|
|
2081
|
+
return readPath(obj, path);
|
|
1908
2082
|
}
|
|
1909
2083
|
function evaluateOperand(operand, state, event, iterCtx) {
|
|
1910
2084
|
return resolveOperand(operand, state, event, iterCtx);
|
|
1911
2085
|
}
|
|
1912
2086
|
|
|
1913
|
-
// ../schema/src/guards.ts
|
|
1914
|
-
function isJsonObject(value) {
|
|
1915
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1916
|
-
}
|
|
1917
|
-
function isRef2(value) {
|
|
1918
|
-
return isJsonObject(value) && typeof value.$ref === "string";
|
|
1919
|
-
}
|
|
1920
|
-
function isFunctionDef(value) {
|
|
1921
|
-
return isJsonObject(value) && value.$prototype === "Function";
|
|
1922
|
-
}
|
|
1923
|
-
function isExpressionDef(value) {
|
|
1924
|
-
return isJsonObject(value) && isJsonObject(value.$expression);
|
|
1925
|
-
}
|
|
1926
|
-
function isNamedFormulaDef(value) {
|
|
1927
|
-
return isExpressionDef(value) && Array.isArray(value.parameters) && value.parameters.length > 0;
|
|
1928
|
-
}
|
|
1929
|
-
function hasStructuredBody(value) {
|
|
1930
|
-
return isFunctionDef(value) && Array.isArray(value.body);
|
|
1931
|
-
}
|
|
1932
|
-
function isPrototypeDef(value) {
|
|
1933
|
-
return isJsonObject(value) && typeof value.$prototype === "string" && value.$prototype !== "Function";
|
|
1934
|
-
}
|
|
1935
|
-
function isServerFnDef(value) {
|
|
1936
|
-
return isJsonObject(value) && value.timing === "server" && typeof value.$src === "string" && typeof value.$export === "string" && !value.$prototype;
|
|
1937
|
-
}
|
|
1938
|
-
var SCHEMA_KEYWORDS = new Set([
|
|
1939
|
-
"type",
|
|
1940
|
-
"enum",
|
|
1941
|
-
"minimum",
|
|
1942
|
-
"maximum",
|
|
1943
|
-
"minLength",
|
|
1944
|
-
"maxLength",
|
|
1945
|
-
"pattern",
|
|
1946
|
-
"format",
|
|
1947
|
-
"items",
|
|
1948
|
-
"properties",
|
|
1949
|
-
"required",
|
|
1950
|
-
"description",
|
|
1951
|
-
"title",
|
|
1952
|
-
"$comment"
|
|
1953
|
-
]);
|
|
1954
|
-
function isMappedArray(value) {
|
|
1955
|
-
return isJsonObject(value) && value.$prototype === "Array";
|
|
1956
|
-
}
|
|
1957
|
-
function isTemplateString(value) {
|
|
1958
|
-
return typeof value === "string" && value.includes("${");
|
|
1959
|
-
}
|
|
1960
|
-
function bodyReturnsValue(body) {
|
|
1961
|
-
return /\breturn\b[^\S\n]*(?![;}\s]|$)/.test(body);
|
|
1962
|
-
}
|
|
1963
|
-
function isEventBinding(value) {
|
|
1964
|
-
return isRef2(value) || isFunctionDef(value) || isExpressionDef(value);
|
|
1965
|
-
}
|
|
1966
|
-
function paramNames(parameters) {
|
|
1967
|
-
if (!parameters) {
|
|
1968
|
-
return [];
|
|
1969
|
-
}
|
|
1970
|
-
return parameters.map((p) => typeof p === "string" ? p : p.name);
|
|
1971
|
-
}
|
|
1972
|
-
|
|
1973
2087
|
// ../runtime/src/statements.ts
|
|
1974
2088
|
function statementKind(statement) {
|
|
1975
2089
|
if ("operator" in statement) {
|
|
@@ -2038,6 +2152,45 @@ async function runStatements(statements, state, event, opts = {}) {
|
|
|
2038
2152
|
}
|
|
2039
2153
|
}
|
|
2040
2154
|
|
|
2155
|
+
// ../runtime/src/cookie.ts
|
|
2156
|
+
var HOST_PREFIX = "__Host-";
|
|
2157
|
+
var SECURE_PREFIX = "__Secure-";
|
|
2158
|
+
function readCookie(header, name) {
|
|
2159
|
+
for (const pair of header.split(";")) {
|
|
2160
|
+
const eq = pair.indexOf("=");
|
|
2161
|
+
if (eq === -1) {
|
|
2162
|
+
continue;
|
|
2163
|
+
}
|
|
2164
|
+
if (pair.slice(0, eq).trim() === name) {
|
|
2165
|
+
return pair.slice(eq + 1);
|
|
2166
|
+
}
|
|
2167
|
+
}
|
|
2168
|
+
return null;
|
|
2169
|
+
}
|
|
2170
|
+
function serializeCookie(name, value, options) {
|
|
2171
|
+
const hostPrefixed = name.startsWith(HOST_PREFIX);
|
|
2172
|
+
const parts = [`${name}=${encodeURIComponent(JSON.stringify(value))}`];
|
|
2173
|
+
if (options.maxAge !== undefined) {
|
|
2174
|
+
parts.push(`Max-Age=${options.maxAge}`);
|
|
2175
|
+
}
|
|
2176
|
+
const path = hostPrefixed ? "/" : options.path;
|
|
2177
|
+
if (path) {
|
|
2178
|
+
parts.push(`Path=${path}`);
|
|
2179
|
+
}
|
|
2180
|
+
if (options.domain && !hostPrefixed) {
|
|
2181
|
+
parts.push(`Domain=${options.domain}`);
|
|
2182
|
+
}
|
|
2183
|
+
const { sameSite } = options;
|
|
2184
|
+
const secure = options.secure === true || hostPrefixed || name.startsWith(SECURE_PREFIX) || sameSite?.toLowerCase() === "none";
|
|
2185
|
+
if (secure) {
|
|
2186
|
+
parts.push("Secure");
|
|
2187
|
+
}
|
|
2188
|
+
if (sameSite) {
|
|
2189
|
+
parts.push(`SameSite=${sameSite}`);
|
|
2190
|
+
}
|
|
2191
|
+
return parts.join("; ");
|
|
2192
|
+
}
|
|
2193
|
+
|
|
2041
2194
|
// ../runtime/src/runtime.ts
|
|
2042
2195
|
var _resolveCache = new Map;
|
|
2043
2196
|
async function resolve(source) {
|
|
@@ -2153,7 +2306,7 @@ function boundPropKey(key, val, state) {
|
|
|
2153
2306
|
return null;
|
|
2154
2307
|
}
|
|
2155
2308
|
const stored = toRaw(state)[sub];
|
|
2156
|
-
if (
|
|
2309
|
+
if (isRef2(stored) || typeof stored === "function") {
|
|
2157
2310
|
return null;
|
|
2158
2311
|
}
|
|
2159
2312
|
if (typeof stored === "object" && stored !== null) {
|
|
@@ -2433,7 +2586,7 @@ function renderNode(def2, state, options) {
|
|
|
2433
2586
|
console.warn(`Jx: a $ref child ("${refTarget}") is not a supported component instance; register the ` + `component in $elements and use its custom-element tag instead (spec §13).`);
|
|
2434
2587
|
}
|
|
2435
2588
|
}
|
|
2436
|
-
const tagName = def2.tagName
|
|
2589
|
+
const tagName = resolveTagName(def2.tagName, localState);
|
|
2437
2590
|
const isCustomEl = tagName.includes("-") && customElements.get(tagName);
|
|
2438
2591
|
if (def2.$props && isCustomEl) {
|
|
2439
2592
|
return renderCustomElementWithProps(def2, localState, options, path);
|
|
@@ -2733,9 +2886,23 @@ function renderMappedArrayInto(parentEl, arrayDef, state, options) {
|
|
|
2733
2886
|
});
|
|
2734
2887
|
});
|
|
2735
2888
|
}
|
|
2889
|
+
function resolveTagName(tagName, scope) {
|
|
2890
|
+
if (typeof tagName === "string") {
|
|
2891
|
+
return tagName;
|
|
2892
|
+
}
|
|
2893
|
+
if (!isTagExpression(tagName)) {
|
|
2894
|
+
return "div";
|
|
2895
|
+
}
|
|
2896
|
+
const expression = tagName.$expression;
|
|
2897
|
+
if (expression.operator === "?:") {
|
|
2898
|
+
return evaluateOperand(expression.target, scope, null) ? expression.value : expression.initial;
|
|
2899
|
+
}
|
|
2900
|
+
const key = evaluateOperand(expression.target, scope, null);
|
|
2901
|
+
return expression.cases[String(key)] ?? expression.default;
|
|
2902
|
+
}
|
|
2736
2903
|
function renderSwitch(def2, state, options) {
|
|
2737
2904
|
const path = options?._path ?? [];
|
|
2738
|
-
const container = document.createElement(def2.tagName
|
|
2905
|
+
const container = document.createElement(resolveTagName(def2.tagName, state));
|
|
2739
2906
|
if (options?.onNodeCreated) {
|
|
2740
2907
|
options.onNodeCreated(container, path, def2, state);
|
|
2741
2908
|
}
|
|
@@ -2744,7 +2911,7 @@ function renderSwitch(def2, state, options) {
|
|
|
2744
2911
|
applyAttributes(container, def2.attributes ?? {}, state);
|
|
2745
2912
|
let generation = 0;
|
|
2746
2913
|
effect(() => {
|
|
2747
|
-
container.
|
|
2914
|
+
container.replaceChildren();
|
|
2748
2915
|
if (!isRefObj(def2.$switch)) {
|
|
2749
2916
|
return;
|
|
2750
2917
|
}
|
|
@@ -2754,7 +2921,8 @@ function renderSwitch(def2, state, options) {
|
|
|
2754
2921
|
return;
|
|
2755
2922
|
}
|
|
2756
2923
|
if (isRefObj(caseDef)) {
|
|
2757
|
-
|
|
2924
|
+
generation += 1;
|
|
2925
|
+
const gen = generation;
|
|
2758
2926
|
const { href } = new URL(caseDef.$ref, location.href);
|
|
2759
2927
|
resolve(href).then(async (doc) => {
|
|
2760
2928
|
if (gen !== generation) {
|
|
@@ -2764,7 +2932,7 @@ function renderSwitch(def2, state, options) {
|
|
|
2764
2932
|
if (gen !== generation) {
|
|
2765
2933
|
return;
|
|
2766
2934
|
}
|
|
2767
|
-
container.
|
|
2935
|
+
container.replaceChildren();
|
|
2768
2936
|
const childOpts2 = options ? { ...options, _path: [...path, "cases", key] } : undefined;
|
|
2769
2937
|
container.append(renderNode(doc, childScope, childOpts2));
|
|
2770
2938
|
}).catch((error) => console.error("Jx $switch: failed to load external case", caseDef.$ref, error));
|
|
@@ -2865,36 +3033,19 @@ async function resolvePrototype(def2, state, key, base) {
|
|
|
2865
3033
|
case "Cookie": {
|
|
2866
3034
|
const name = def2.name ?? key;
|
|
2867
3035
|
const read = () => {
|
|
2868
|
-
const
|
|
2869
|
-
if (
|
|
3036
|
+
const raw = readCookie(document.cookie, name);
|
|
3037
|
+
if (raw === null) {
|
|
2870
3038
|
return null;
|
|
2871
3039
|
}
|
|
2872
3040
|
try {
|
|
2873
|
-
return JSON.parse(decodeURIComponent(
|
|
3041
|
+
return JSON.parse(decodeURIComponent(raw));
|
|
2874
3042
|
} catch {
|
|
2875
|
-
return
|
|
3043
|
+
return raw;
|
|
2876
3044
|
}
|
|
2877
3045
|
};
|
|
2878
3046
|
const cookieState = ref(read() ?? def2.default ?? null);
|
|
2879
3047
|
effect(() => {
|
|
2880
|
-
|
|
2881
|
-
let s = `${name}=${encodeURIComponent(JSON.stringify(v))}`;
|
|
2882
|
-
if (def2.maxAge !== undefined) {
|
|
2883
|
-
s += `; Max-Age=${def2.maxAge}`;
|
|
2884
|
-
}
|
|
2885
|
-
if (def2.path) {
|
|
2886
|
-
s += `; Path=${def2.path}`;
|
|
2887
|
-
}
|
|
2888
|
-
if (def2.domain) {
|
|
2889
|
-
s += `; Domain=${def2.domain}`;
|
|
2890
|
-
}
|
|
2891
|
-
if (def2.secure) {
|
|
2892
|
-
s += `; Secure`;
|
|
2893
|
-
}
|
|
2894
|
-
if (def2.sameSite) {
|
|
2895
|
-
s += `; SameSite=${def2.sameSite}`;
|
|
2896
|
-
}
|
|
2897
|
-
document.cookie = s;
|
|
3048
|
+
document.cookie = serializeCookie(name, cookieState.value, def2);
|
|
2898
3049
|
});
|
|
2899
3050
|
return cookieState;
|
|
2900
3051
|
}
|
|
@@ -3302,15 +3453,10 @@ function resolveRef(refPath, state) {
|
|
|
3302
3453
|
return parts.length > 2 ? getPath2(base, parts.slice(2).join("/")) : base;
|
|
3303
3454
|
}
|
|
3304
3455
|
if (refPath.startsWith("#/state/")) {
|
|
3305
|
-
|
|
3306
|
-
const slash = sub.indexOf("/");
|
|
3307
|
-
if (slash === -1) {
|
|
3308
|
-
return state[sub];
|
|
3309
|
-
}
|
|
3310
|
-
return getPath2(state[sub.slice(0, slash)], sub.slice(slash + 1));
|
|
3456
|
+
return readPath(state, refPath.slice("#/state/".length));
|
|
3311
3457
|
}
|
|
3312
3458
|
if (refPath.startsWith("parent#/")) {
|
|
3313
|
-
return state
|
|
3459
|
+
return readPath(state, refPath.slice("parent#/".length));
|
|
3314
3460
|
}
|
|
3315
3461
|
if (refPath.startsWith("window#/")) {
|
|
3316
3462
|
return getPath2(globalThis.window, refPath.slice("window#/".length));
|
|
@@ -3318,24 +3464,35 @@ function resolveRef(refPath, state) {
|
|
|
3318
3464
|
if (refPath.startsWith("document#/")) {
|
|
3319
3465
|
return getPath2(globalThis.document, refPath.slice("document#/".length));
|
|
3320
3466
|
}
|
|
3321
|
-
return state
|
|
3467
|
+
return readPath(state, refPath) ?? null;
|
|
3322
3468
|
}
|
|
3323
3469
|
function isRefObj(v) {
|
|
3324
|
-
return
|
|
3470
|
+
return isRef(v);
|
|
3325
3471
|
}
|
|
3326
3472
|
function isNestedSelector(k) {
|
|
3327
3473
|
return k.startsWith(":") || k.startsWith(".") || k.startsWith("&") || k.startsWith("[");
|
|
3328
3474
|
}
|
|
3329
3475
|
function getPath2(obj, path) {
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3476
|
+
return readPath(obj, path);
|
|
3477
|
+
}
|
|
3478
|
+
var _privatePropWarned = new Set;
|
|
3479
|
+
function refusePrivateProp(key, where) {
|
|
3480
|
+
if (!isPrivateStateKey(key)) {
|
|
3481
|
+
return false;
|
|
3333
3482
|
}
|
|
3334
|
-
|
|
3483
|
+
const seen = where === undefined ? key : `${where}:${key}`;
|
|
3484
|
+
if (!_privatePropWarned.has(seen)) {
|
|
3485
|
+
_privatePropWarned.add(seen);
|
|
3486
|
+
console.warn(`Jx: "${key}" is private state (spec.md §5.6) and cannot be set through $props` + `${where === undefined ? "" : ` (${where})`}. The write was ignored; rename the entry without the leading # to make it part of the component's interface.`);
|
|
3487
|
+
}
|
|
3488
|
+
return true;
|
|
3335
3489
|
}
|
|
3336
3490
|
function mergeProps(def2, parentState) {
|
|
3337
3491
|
const child = Object.create(parentState);
|
|
3338
3492
|
for (const [k, v] of Object.entries(def2.$props ?? {})) {
|
|
3493
|
+
if (refusePrivateProp(k, "$props")) {
|
|
3494
|
+
continue;
|
|
3495
|
+
}
|
|
3339
3496
|
child[k] = isRefObj(v) ? resolveRef(v.$ref, parentState) : v;
|
|
3340
3497
|
}
|
|
3341
3498
|
return child;
|
|
@@ -3443,6 +3600,9 @@ async function defineElement(source, baseUrl) {
|
|
|
3443
3600
|
try {
|
|
3444
3601
|
const props = JSON.parse(propsAttr);
|
|
3445
3602
|
for (const [key, val] of Object.entries(props)) {
|
|
3603
|
+
if (refusePrivateProp(key, "data-jx-props")) {
|
|
3604
|
+
continue;
|
|
3605
|
+
}
|
|
3446
3606
|
if (key in (def2.state ?? {})) {
|
|
3447
3607
|
state[key] = val;
|
|
3448
3608
|
}
|
|
@@ -3453,17 +3613,27 @@ async function defineElement(source, baseUrl) {
|
|
|
3453
3613
|
const propAttrNames = this.getAttributeNames().filter((name) => name.startsWith("props.") && name.length > "props.".length);
|
|
3454
3614
|
for (const name of propAttrNames) {
|
|
3455
3615
|
const key = name.slice("props.".length);
|
|
3616
|
+
if (refusePrivateProp(key, "props.* attribute")) {
|
|
3617
|
+
this.removeAttribute(name);
|
|
3618
|
+
continue;
|
|
3619
|
+
}
|
|
3456
3620
|
if (key in (def2.state ?? {})) {
|
|
3457
3621
|
state[key] = this.getAttribute(name);
|
|
3458
3622
|
this.removeAttribute(name);
|
|
3459
3623
|
}
|
|
3460
3624
|
}
|
|
3461
3625
|
for (const key of Object.keys(def2.state ?? {})) {
|
|
3626
|
+
if (isPrivateStateKey(key)) {
|
|
3627
|
+
continue;
|
|
3628
|
+
}
|
|
3462
3629
|
if (key in this && this[key] !== undefined) {
|
|
3463
3630
|
state[key] = this[key];
|
|
3464
3631
|
}
|
|
3465
3632
|
}
|
|
3466
3633
|
for (const key of Object.keys(def2.state ?? {})) {
|
|
3634
|
+
if (isPrivateStateKey(key)) {
|
|
3635
|
+
continue;
|
|
3636
|
+
}
|
|
3467
3637
|
if (!(key in HTMLElement.prototype)) {
|
|
3468
3638
|
Object.defineProperty(this, key, {
|
|
3469
3639
|
configurable: true,
|
|
@@ -3476,7 +3646,7 @@ async function defineElement(source, baseUrl) {
|
|
|
3476
3646
|
}
|
|
3477
3647
|
this._state = state;
|
|
3478
3648
|
const slottedChildren = [...this.childNodes];
|
|
3479
|
-
this.
|
|
3649
|
+
this.replaceChildren();
|
|
3480
3650
|
if (!this.style.display) {
|
|
3481
3651
|
this.style.display = "block";
|
|
3482
3652
|
}
|
|
@@ -3520,11 +3690,14 @@ async function defineElement(source, baseUrl) {
|
|
|
3520
3690
|
customElements.define(tagName, ElementClass);
|
|
3521
3691
|
}
|
|
3522
3692
|
function renderCustomElementWithProps(def2, state, options, path) {
|
|
3523
|
-
const el = document.createElement(def2.tagName
|
|
3693
|
+
const el = document.createElement(resolveTagName(def2.tagName, state));
|
|
3524
3694
|
if (options?.onNodeCreated) {
|
|
3525
3695
|
options.onNodeCreated(el, path ?? [], def2, state);
|
|
3526
3696
|
}
|
|
3527
3697
|
for (const [key, val] of Object.entries(def2.$props ?? {})) {
|
|
3698
|
+
if (refusePrivateProp(key, "$props")) {
|
|
3699
|
+
continue;
|
|
3700
|
+
}
|
|
3528
3701
|
if (isRefObj(val)) {
|
|
3529
3702
|
const refVal = val;
|
|
3530
3703
|
const resolved = resolveRef(refVal.$ref, state);
|
|
@@ -3574,7 +3747,7 @@ function distributeSlots(host, slottedChildren) {
|
|
|
3574
3747
|
const name = slot.getAttribute("name");
|
|
3575
3748
|
const matches = name ? named.get(name) ?? [] : unnamed;
|
|
3576
3749
|
if (matches.length > 0) {
|
|
3577
|
-
slot.
|
|
3750
|
+
slot.replaceChildren();
|
|
3578
3751
|
for (const child of matches) {
|
|
3579
3752
|
slot.append(child);
|
|
3580
3753
|
}
|
|
@@ -3583,9 +3756,22 @@ function distributeSlots(host, slottedChildren) {
|
|
|
3583
3756
|
}
|
|
3584
3757
|
|
|
3585
3758
|
// src/canvas/path-mapping.ts
|
|
3759
|
+
function wrapsPageContent(path, prefix) {
|
|
3760
|
+
if (!prefix) {
|
|
3761
|
+
return false;
|
|
3762
|
+
}
|
|
3763
|
+
return path.length <= prefix.length && path.every((seg, i) => prefix[i] === seg);
|
|
3764
|
+
}
|
|
3586
3765
|
function classifyRenderNode(path, def2, ctx) {
|
|
3587
|
-
|
|
3588
|
-
|
|
3766
|
+
const marker = ctx.layoutWrapped && typeof def2 === "object" ? def2?.$__layout : undefined;
|
|
3767
|
+
if (marker) {
|
|
3768
|
+
const origin = typeof marker === "object" ? marker : {};
|
|
3769
|
+
return {
|
|
3770
|
+
chrome: path.length > 0 && !wrapsPageContent(path, ctx.pageContentPrefix),
|
|
3771
|
+
kind: "layout",
|
|
3772
|
+
layoutFile: typeof origin.file === "string" ? origin.file : "",
|
|
3773
|
+
layoutPath: Array.isArray(origin.path) ? origin.path : []
|
|
3774
|
+
};
|
|
3589
3775
|
}
|
|
3590
3776
|
let mappedPath = path;
|
|
3591
3777
|
if (ctx.layoutWrapped && ctx.pageContentPrefix) {
|
|
@@ -3787,6 +3973,36 @@ var EDIT_PLACEHOLDER_CSS = `
|
|
|
3787
3973
|
font-size: 13px;
|
|
3788
3974
|
pointer-events: none;
|
|
3789
3975
|
}
|
|
3976
|
+
[data-jx-layout-region] {
|
|
3977
|
+
position: relative;
|
|
3978
|
+
opacity: 0.5;
|
|
3979
|
+
transition: opacity 120ms ease;
|
|
3980
|
+
}
|
|
3981
|
+
[data-jx-layout-region]:hover {
|
|
3982
|
+
opacity: 0.85;
|
|
3983
|
+
outline: 1px dashed color-mix(in srgb, #808080 55%, transparent);
|
|
3984
|
+
outline-offset: -1px;
|
|
3985
|
+
}
|
|
3986
|
+
[data-jx-layout-region] [data-jx-layout-region] {
|
|
3987
|
+
opacity: 1;
|
|
3988
|
+
}
|
|
3989
|
+
[data-jx-layout-region]::before {
|
|
3990
|
+
content: "LAYOUT \\00B7 " attr(data-jx-layout-file);
|
|
3991
|
+
position: absolute;
|
|
3992
|
+
top: 0;
|
|
3993
|
+
left: 0;
|
|
3994
|
+
z-index: 2;
|
|
3995
|
+
padding: 1px 5px;
|
|
3996
|
+
border-radius: 0 0 3px 0;
|
|
3997
|
+
background: color-mix(in srgb, #808080 78%, transparent);
|
|
3998
|
+
color: #fff;
|
|
3999
|
+
font: 700 9px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
4000
|
+
letter-spacing: 0.08em;
|
|
4001
|
+
pointer-events: none;
|
|
4002
|
+
}
|
|
4003
|
+
[data-jx-layout-region] [data-jx-layout-region]::before {
|
|
4004
|
+
content: none;
|
|
4005
|
+
}
|
|
3790
4006
|
`;
|
|
3791
4007
|
function syncEditModeCss(doc, mode) {
|
|
3792
4008
|
const existing = doc.head.querySelector(`#${EDIT_PLACEHOLDER_STYLE_ID}`);
|
|
@@ -3802,6 +4018,9 @@ function syncEditModeCss(doc, mode) {
|
|
|
3802
4018
|
style.textContent = EDIT_PLACEHOLDER_CSS;
|
|
3803
4019
|
doc.head.append(style);
|
|
3804
4020
|
}
|
|
4021
|
+
function syncPreviewShell(doc, mode) {
|
|
4022
|
+
doc.documentElement.toggleAttribute("data-jx-preview", mode === "preview");
|
|
4023
|
+
}
|
|
3805
4024
|
function isEditableMode(mode) {
|
|
3806
4025
|
return mode === "design" || mode === "edit";
|
|
3807
4026
|
}
|
|
@@ -3989,7 +4208,16 @@ function makeStamper(ctx) {
|
|
|
3989
4208
|
}
|
|
3990
4209
|
const classified = classifyRenderNode(path, def2, ctx);
|
|
3991
4210
|
if (classified.kind === "layout") {
|
|
3992
|
-
created.dataset.
|
|
4211
|
+
created.dataset.jxLayoutPath = serializeJxPath(classified.layoutPath);
|
|
4212
|
+
if (classified.layoutFile) {
|
|
4213
|
+
created.dataset.jxLayoutFile = classified.layoutFile;
|
|
4214
|
+
}
|
|
4215
|
+
if (classified.chrome) {
|
|
4216
|
+
created.dataset.jxLayoutRegion = "";
|
|
4217
|
+
if (isEditableMode(ctx.canvasMode)) {
|
|
4218
|
+
created.contentEditable = "false";
|
|
4219
|
+
}
|
|
4220
|
+
}
|
|
3993
4221
|
return;
|
|
3994
4222
|
}
|
|
3995
4223
|
created.dataset.jxPath = serializeJxPath(classified.path);
|
|
@@ -4028,6 +4256,7 @@ async function renderResolvedDocument(opts) {
|
|
|
4028
4256
|
applySiteStyle(opts.siteStyle, opts.doc.$media ?? {});
|
|
4029
4257
|
injectHead(opts.doc);
|
|
4030
4258
|
syncEditModeCss(opts.container.ownerDocument, opts.mode);
|
|
4259
|
+
syncPreviewShell(opts.container.ownerDocument, opts.mode);
|
|
4031
4260
|
syncStylebookCss(opts.container.ownerDocument, opts.mode);
|
|
4032
4261
|
setRootMedia(opts.doc.$media ?? {});
|
|
4033
4262
|
await registerElements2(opts.doc, opts.docBase);
|
|
@@ -4201,15 +4430,13 @@ var elements_meta_default = {
|
|
|
4201
4430
|
tag: "strong",
|
|
4202
4431
|
label: "Bold",
|
|
4203
4432
|
icon: "sp-icon-text-bold",
|
|
4204
|
-
command: "bold"
|
|
4205
|
-
shortcut: "Cmd+B"
|
|
4433
|
+
command: "bold"
|
|
4206
4434
|
},
|
|
4207
4435
|
{
|
|
4208
4436
|
tag: "em",
|
|
4209
4437
|
label: "Italic",
|
|
4210
4438
|
icon: "sp-icon-text-italic",
|
|
4211
|
-
command: "italic"
|
|
4212
|
-
shortcut: "Cmd+I"
|
|
4439
|
+
command: "italic"
|
|
4213
4440
|
},
|
|
4214
4441
|
{
|
|
4215
4442
|
tag: "u",
|
|
@@ -4247,15 +4474,13 @@ var elements_meta_default = {
|
|
|
4247
4474
|
tag: "strong",
|
|
4248
4475
|
label: "Bold",
|
|
4249
4476
|
icon: "sp-icon-text-bold",
|
|
4250
|
-
command: "bold"
|
|
4251
|
-
shortcut: "Cmd+B"
|
|
4477
|
+
command: "bold"
|
|
4252
4478
|
},
|
|
4253
4479
|
{
|
|
4254
4480
|
tag: "em",
|
|
4255
4481
|
label: "Italic",
|
|
4256
4482
|
icon: "sp-icon-text-italic",
|
|
4257
|
-
command: "italic"
|
|
4258
|
-
shortcut: "Cmd+I"
|
|
4483
|
+
command: "italic"
|
|
4259
4484
|
},
|
|
4260
4485
|
{ tag: "code", label: "Code", icon: "sp-icon-code", command: "code" },
|
|
4261
4486
|
{ tag: "a", label: "Link", icon: "sp-icon-link", command: "link" }
|
|
@@ -4482,15 +4707,13 @@ var elements_meta_default = {
|
|
|
4482
4707
|
tag: "strong",
|
|
4483
4708
|
label: "Bold",
|
|
4484
4709
|
icon: "sp-icon-text-bold",
|
|
4485
|
-
command: "bold"
|
|
4486
|
-
shortcut: "Cmd+B"
|
|
4710
|
+
command: "bold"
|
|
4487
4711
|
},
|
|
4488
4712
|
{
|
|
4489
4713
|
tag: "em",
|
|
4490
4714
|
label: "Italic",
|
|
4491
4715
|
icon: "sp-icon-text-italic",
|
|
4492
|
-
command: "italic"
|
|
4493
|
-
shortcut: "Cmd+I"
|
|
4716
|
+
command: "italic"
|
|
4494
4717
|
},
|
|
4495
4718
|
{ tag: "code", label: "Code", icon: "sp-icon-code", command: "code" }
|
|
4496
4719
|
]
|
|
@@ -5033,6 +5256,9 @@ function getActiveElement() {
|
|
|
5033
5256
|
function getActivePath() {
|
|
5034
5257
|
return activePath;
|
|
5035
5258
|
}
|
|
5259
|
+
function isSlashActive() {
|
|
5260
|
+
return slash.isOpen();
|
|
5261
|
+
}
|
|
5036
5262
|
function handleKeydown(e) {
|
|
5037
5263
|
if (_plainMode) {
|
|
5038
5264
|
if (e.key === "Escape") {
|
|
@@ -5053,46 +5279,11 @@ function handleKeydown(e) {
|
|
|
5053
5279
|
if ((e.ctrlKey || e.metaKey) && ["b", "i", "u", "`"].includes(e.key)) {
|
|
5054
5280
|
e.preventDefault();
|
|
5055
5281
|
}
|
|
5056
|
-
return;
|
|
5057
|
-
}
|
|
5058
|
-
if (e.key === "/" && !e.ctrlKey && !e.metaKey) {
|
|
5059
|
-
const sel = window.getSelection();
|
|
5060
|
-
if (sel && sel.rangeCount > 0) {
|
|
5061
|
-
const range = sel.getRangeAt(0);
|
|
5062
|
-
const textBefore = getTextBeforeCursor(range);
|
|
5063
|
-
if (textBefore === "" || textBefore.endsWith(" ") || textBefore.endsWith(`
|
|
5064
|
-
`)) {
|
|
5065
|
-
requestAnimationFrame(() => openSlashMenu());
|
|
5066
|
-
return;
|
|
5067
|
-
}
|
|
5068
|
-
}
|
|
5069
|
-
}
|
|
5070
|
-
if (e.ctrlKey || e.metaKey) {
|
|
5071
|
-
switch (e.key) {
|
|
5072
|
-
case "b": {
|
|
5073
|
-
e.preventDefault();
|
|
5074
|
-
toggleInlineFormat("strong", activeEl);
|
|
5075
|
-
break;
|
|
5076
|
-
}
|
|
5077
|
-
case "i": {
|
|
5078
|
-
e.preventDefault();
|
|
5079
|
-
toggleInlineFormat("em", activeEl);
|
|
5080
|
-
break;
|
|
5081
|
-
}
|
|
5082
|
-
case "`": {
|
|
5083
|
-
e.preventDefault();
|
|
5084
|
-
toggleInlineFormat("code", activeEl);
|
|
5085
|
-
break;
|
|
5086
|
-
}
|
|
5087
|
-
default: {
|
|
5088
|
-
break;
|
|
5089
|
-
}
|
|
5090
|
-
}
|
|
5091
5282
|
}
|
|
5092
5283
|
}
|
|
5093
5284
|
function handleInput() {
|
|
5094
5285
|
if (slash.isOpen()) {
|
|
5095
|
-
|
|
5286
|
+
refreshSlashMenu();
|
|
5096
5287
|
}
|
|
5097
5288
|
}
|
|
5098
5289
|
function handlePaste(e) {
|
|
@@ -5271,7 +5462,8 @@ function getTextBeforeCursor(range) {
|
|
|
5271
5462
|
return preRange.toString();
|
|
5272
5463
|
}
|
|
5273
5464
|
var _slashFilterStart = 0;
|
|
5274
|
-
|
|
5465
|
+
var _slashAnchored = true;
|
|
5466
|
+
function openSlashMenu(opts) {
|
|
5275
5467
|
if (!activeEl || !insertFn || !activePath) {
|
|
5276
5468
|
return;
|
|
5277
5469
|
}
|
|
@@ -5280,11 +5472,29 @@ function openSlashMenu() {
|
|
|
5280
5472
|
return;
|
|
5281
5473
|
}
|
|
5282
5474
|
const range = sel.getRangeAt(0);
|
|
5475
|
+
_slashAnchored = opts?.anchored !== false;
|
|
5283
5476
|
_slashFilterStart = getTextBeforeCursor(range).length;
|
|
5284
|
-
slash.show(activeEl, "", {
|
|
5477
|
+
slash.show(activeEl, "", {
|
|
5478
|
+
onSelect: handleSlashSelect,
|
|
5479
|
+
..._slashAnchored ? {} : { showFilter: true }
|
|
5480
|
+
});
|
|
5285
5481
|
}
|
|
5286
|
-
function
|
|
5287
|
-
if (!activeEl) {
|
|
5482
|
+
function handleSlashTrigger(e) {
|
|
5483
|
+
if (e.key !== "/" || e.ctrlKey || e.metaKey || !activeEl) {
|
|
5484
|
+
return;
|
|
5485
|
+
}
|
|
5486
|
+
const sel = window.getSelection();
|
|
5487
|
+
if (!sel || sel.rangeCount === 0) {
|
|
5488
|
+
return;
|
|
5489
|
+
}
|
|
5490
|
+
const textBefore = getTextBeforeCursor(sel.getRangeAt(0));
|
|
5491
|
+
if (textBefore === "" || textBefore.endsWith(" ") || textBefore.endsWith(`
|
|
5492
|
+
`)) {
|
|
5493
|
+
requestAnimationFrame(() => openSlashMenu());
|
|
5494
|
+
}
|
|
5495
|
+
}
|
|
5496
|
+
function refreshSlashMenu() {
|
|
5497
|
+
if (!activeEl || !_slashAnchored) {
|
|
5288
5498
|
return;
|
|
5289
5499
|
}
|
|
5290
5500
|
const sel = window.getSelection();
|
|
@@ -5306,7 +5516,7 @@ function handleSlashSelect(cmd) {
|
|
|
5306
5516
|
if (!activeEl || !insertFn || !activePath) {
|
|
5307
5517
|
return;
|
|
5308
5518
|
}
|
|
5309
|
-
const sel = window.getSelection();
|
|
5519
|
+
const sel = _slashAnchored ? window.getSelection() : null;
|
|
5310
5520
|
if (sel && sel.rangeCount) {
|
|
5311
5521
|
const range = sel.getRangeAt(0);
|
|
5312
5522
|
const fullText = getTextBeforeCursor(range);
|
|
@@ -5387,22 +5597,36 @@ function startInteraction(channel, doc = document, deps) {
|
|
|
5387
5597
|
let lastHoverKey = null;
|
|
5388
5598
|
let lastZonesKey = null;
|
|
5389
5599
|
let lastGen = deps?.getGen?.() ?? 0;
|
|
5600
|
+
const isPreview = () => deps?.getMode?.() === "preview";
|
|
5601
|
+
const onPointerDown = () => {
|
|
5602
|
+
channel.post({ kind: "paneFocus" });
|
|
5603
|
+
};
|
|
5390
5604
|
const onClick = (e) => {
|
|
5391
|
-
if (
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
|
|
5395
|
-
|
|
5396
|
-
|
|
5397
|
-
|
|
5605
|
+
if (isPreview()) {
|
|
5606
|
+
if (e.target instanceof Element) {
|
|
5607
|
+
const anchor = e.target.closest("a[href]");
|
|
5608
|
+
const href = anchor?.getAttribute("href");
|
|
5609
|
+
if (href && !href.startsWith("#")) {
|
|
5610
|
+
e.preventDefault();
|
|
5611
|
+
channel.post({ href, kind: "previewNavigate" });
|
|
5612
|
+
}
|
|
5398
5613
|
}
|
|
5614
|
+
return;
|
|
5399
5615
|
}
|
|
5400
5616
|
const hit = nearestHit(e.target);
|
|
5401
5617
|
if (hit) {
|
|
5402
|
-
|
|
5618
|
+
const mouse = e;
|
|
5619
|
+
channel.post({
|
|
5620
|
+
additive: mouse.ctrlKey === true || mouse.metaKey === true,
|
|
5621
|
+
hit,
|
|
5622
|
+
kind: "hit"
|
|
5623
|
+
});
|
|
5403
5624
|
}
|
|
5404
5625
|
};
|
|
5405
5626
|
const reportHover = (el) => {
|
|
5627
|
+
if (isPreview()) {
|
|
5628
|
+
return;
|
|
5629
|
+
}
|
|
5406
5630
|
const key = el?.dataset.jxPath ?? null;
|
|
5407
5631
|
if (key === lastHoverKey) {
|
|
5408
5632
|
return;
|
|
@@ -5418,7 +5642,7 @@ function startInteraction(channel, doc = document, deps) {
|
|
|
5418
5642
|
}
|
|
5419
5643
|
};
|
|
5420
5644
|
const reportInsertZones = (target, cursor) => {
|
|
5421
|
-
if (!deps || deps.getMode?.() === "stylebook") {
|
|
5645
|
+
if (!deps || deps.getMode?.() === "stylebook" || isPreview()) {
|
|
5422
5646
|
return;
|
|
5423
5647
|
}
|
|
5424
5648
|
syncZoneGen();
|
|
@@ -5460,26 +5684,33 @@ function startInteraction(channel, doc = document, deps) {
|
|
|
5460
5684
|
return;
|
|
5461
5685
|
}
|
|
5462
5686
|
reportHover(null);
|
|
5463
|
-
if (deps && lastZonesKey !== "none") {
|
|
5687
|
+
if (deps && !isPreview() && lastZonesKey !== "none") {
|
|
5464
5688
|
lastZonesKey = "none";
|
|
5465
5689
|
channel.post({ kind: "insertZones", zones: null });
|
|
5466
5690
|
}
|
|
5467
5691
|
};
|
|
5468
5692
|
const onContextMenu = (e) => {
|
|
5469
5693
|
const me = e;
|
|
5694
|
+
if (isPreview()) {
|
|
5695
|
+
return;
|
|
5696
|
+
}
|
|
5470
5697
|
const active = isEditing() ? getActiveElement() : null;
|
|
5471
5698
|
if (active && e.target instanceof Node && active.contains(e.target)) {
|
|
5472
5699
|
return;
|
|
5473
5700
|
}
|
|
5474
|
-
e.preventDefault();
|
|
5475
5701
|
const hit = nearestHit(e.target);
|
|
5702
|
+
if (!hit) {
|
|
5703
|
+
return;
|
|
5704
|
+
}
|
|
5705
|
+
e.preventDefault();
|
|
5476
5706
|
channel.post({
|
|
5477
5707
|
kind: "contextMenu",
|
|
5478
|
-
path: hit
|
|
5708
|
+
path: hit.path,
|
|
5479
5709
|
x: me.clientX,
|
|
5480
5710
|
y: me.clientY
|
|
5481
5711
|
});
|
|
5482
5712
|
};
|
|
5713
|
+
doc.addEventListener("pointerdown", onPointerDown, true);
|
|
5483
5714
|
doc.addEventListener("click", onClick, true);
|
|
5484
5715
|
doc.addEventListener("pointermove", onMove, true);
|
|
5485
5716
|
doc.addEventListener("pointerleave", onLeave, true);
|
|
@@ -5489,6 +5720,7 @@ function startInteraction(channel, doc = document, deps) {
|
|
|
5489
5720
|
cancelRaf(movePending);
|
|
5490
5721
|
movePending = 0;
|
|
5491
5722
|
}
|
|
5723
|
+
doc.removeEventListener("pointerdown", onPointerDown, true);
|
|
5492
5724
|
doc.removeEventListener("click", onClick, true);
|
|
5493
5725
|
doc.removeEventListener("pointermove", onMove, true);
|
|
5494
5726
|
doc.removeEventListener("pointerleave", onLeave, true);
|
|
@@ -5549,7 +5781,7 @@ function computeDropInstruction(targetEl, cursorY, shadowDoc, src) {
|
|
|
5549
5781
|
return null;
|
|
5550
5782
|
}
|
|
5551
5783
|
const node = getNodeAtPath(shadowDoc, targetPath);
|
|
5552
|
-
const tag = (node?.tagName || "div").toLowerCase();
|
|
5784
|
+
const tag = (displayTagName(node?.tagName) || "div").toLowerCase();
|
|
5553
5785
|
const hasElementChildren = Array.isArray(node?.children) && node.children.some((c) => c != null && typeof c === "object");
|
|
5554
5786
|
const isLeaf = VOID_TAGS.has(tag) || !hasElementChildren;
|
|
5555
5787
|
const rect = rectFor2(targetEl);
|
|
@@ -6181,10 +6413,10 @@ function computeEmptyPlaceholderClass(node) {
|
|
|
6181
6413
|
if (Array.isArray(node.children) && node.children.length > 0) {
|
|
6182
6414
|
return null;
|
|
6183
6415
|
}
|
|
6184
|
-
if (textTags.has(node.tagName)) {
|
|
6416
|
+
if (textTags.has(displayTagName(node.tagName))) {
|
|
6185
6417
|
return "empty-text-placeholder";
|
|
6186
6418
|
}
|
|
6187
|
-
if (containerTags.has(node.tagName)) {
|
|
6419
|
+
if (containerTags.has(displayTagName(node.tagName))) {
|
|
6188
6420
|
return "empty-container-placeholder";
|
|
6189
6421
|
}
|
|
6190
6422
|
return null;
|
|
@@ -6620,6 +6852,14 @@ function startIframeInlineEdit(channel, container, opts) {
|
|
|
6620
6852
|
onSelectionChange: () => onSelectionChange(),
|
|
6621
6853
|
onSplit: () => splitActiveBlock()
|
|
6622
6854
|
});
|
|
6855
|
+
const onSlashKey = (e) => handleSlashTrigger(e);
|
|
6856
|
+
const onSlashInput = () => {
|
|
6857
|
+
if (isSlashActive()) {
|
|
6858
|
+
refreshSlashMenu();
|
|
6859
|
+
}
|
|
6860
|
+
};
|
|
6861
|
+
container.addEventListener("keydown", onSlashKey);
|
|
6862
|
+
container.addEventListener("input", onSlashInput);
|
|
6623
6863
|
doc.addEventListener("mouseup", onMouseUp, true);
|
|
6624
6864
|
doc.addEventListener("keyup", onKeyUp, true);
|
|
6625
6865
|
doc.addEventListener("blur", onBlurCapture, true);
|
|
@@ -6628,6 +6868,10 @@ function startIframeInlineEdit(channel, container, opts) {
|
|
|
6628
6868
|
applyFormatIntent(msg.intent);
|
|
6629
6869
|
return;
|
|
6630
6870
|
}
|
|
6871
|
+
if (msg.kind === "openSlash") {
|
|
6872
|
+
openSlashMenu({ anchored: false });
|
|
6873
|
+
return;
|
|
6874
|
+
}
|
|
6631
6875
|
if (msg.kind === "flushEdits") {
|
|
6632
6876
|
root.flush();
|
|
6633
6877
|
channel.post({ kind: "flushComplete", reqId: msg.reqId });
|
|
@@ -6651,6 +6895,8 @@ function startIframeInlineEdit(channel, container, opts) {
|
|
|
6651
6895
|
}
|
|
6652
6896
|
});
|
|
6653
6897
|
return () => {
|
|
6898
|
+
container.removeEventListener("keydown", onSlashKey);
|
|
6899
|
+
container.removeEventListener("input", onSlashInput);
|
|
6654
6900
|
doc.removeEventListener("mouseup", onMouseUp, true);
|
|
6655
6901
|
doc.removeEventListener("keyup", onKeyUp, true);
|
|
6656
6902
|
doc.removeEventListener("blur", onBlurCapture, true);
|
|
@@ -6691,7 +6937,8 @@ function startIframeSlashBridge(channel, doc) {
|
|
|
6691
6937
|
channel.post({
|
|
6692
6938
|
filter,
|
|
6693
6939
|
kind: "slashShow",
|
|
6694
|
-
rect: { height: r.height, width: r.width, x: r.left, y: r.top }
|
|
6940
|
+
rect: { height: r.height, width: r.width, x: r.left, y: r.top },
|
|
6941
|
+
...cbs.showFilter === true ? { showFilter: true } : {}
|
|
6695
6942
|
});
|
|
6696
6943
|
}
|
|
6697
6944
|
};
|
|
@@ -6735,33 +6982,90 @@ function startIframeSlashBridge(channel, doc) {
|
|
|
6735
6982
|
};
|
|
6736
6983
|
}
|
|
6737
6984
|
|
|
6985
|
+
// src/commands/levels.ts
|
|
6986
|
+
var KEY_SCOPES = ["global", "canvas", "caret", "grid", "code", "dock", "palette"];
|
|
6987
|
+
|
|
6988
|
+
// src/commands/keymap.ts
|
|
6989
|
+
var MODIFIER_ORDER = ["mod", "ctrl", "alt", "shift"];
|
|
6990
|
+
var MODIFIER_ALIASES = {
|
|
6991
|
+
mod: "mod",
|
|
6992
|
+
cmd: "mod",
|
|
6993
|
+
command: "mod",
|
|
6994
|
+
meta: "mod",
|
|
6995
|
+
super: "mod",
|
|
6996
|
+
ctrl: "ctrl",
|
|
6997
|
+
control: "ctrl",
|
|
6998
|
+
alt: "alt",
|
|
6999
|
+
opt: "alt",
|
|
7000
|
+
option: "alt",
|
|
7001
|
+
shift: "shift"
|
|
7002
|
+
};
|
|
7003
|
+
var KEY_ALIASES = {
|
|
7004
|
+
up: "arrowup",
|
|
7005
|
+
down: "arrowdown",
|
|
7006
|
+
left: "arrowleft",
|
|
7007
|
+
right: "arrowright",
|
|
7008
|
+
esc: "escape",
|
|
7009
|
+
space: " ",
|
|
7010
|
+
spacebar: " ",
|
|
7011
|
+
del: "delete",
|
|
7012
|
+
plus: "=",
|
|
7013
|
+
return: "enter"
|
|
7014
|
+
};
|
|
7015
|
+
function serializeChord(parsed) {
|
|
7016
|
+
const parts = MODIFIER_ORDER.filter((modifier) => parsed[modifier]);
|
|
7017
|
+
return [...parts, parsed.key].join("+");
|
|
7018
|
+
}
|
|
7019
|
+
function digitFromCode(code) {
|
|
7020
|
+
const match = /^Digit(\d)$/.exec(code ?? "");
|
|
7021
|
+
return match?.[1];
|
|
7022
|
+
}
|
|
7023
|
+
function chordFromEvent(event, mac) {
|
|
7024
|
+
const key = digitFromCode(event.code) ?? event.key.toLowerCase();
|
|
7025
|
+
if (MODIFIER_ALIASES[key]) {
|
|
7026
|
+
return "";
|
|
7027
|
+
}
|
|
7028
|
+
const parsed = {
|
|
7029
|
+
mod: mac ? event.metaKey : event.ctrlKey,
|
|
7030
|
+
ctrl: mac ? event.ctrlKey : false,
|
|
7031
|
+
alt: event.altKey,
|
|
7032
|
+
shift: event.shiftKey,
|
|
7033
|
+
key: KEY_ALIASES[key] ?? key
|
|
7034
|
+
};
|
|
7035
|
+
return serializeChord(parsed);
|
|
7036
|
+
}
|
|
7037
|
+
var DISPATCHABLE_SCOPES = [
|
|
7038
|
+
"global",
|
|
7039
|
+
...KEY_SCOPES.filter((scope) => scope !== "global" && scope !== "palette")
|
|
7040
|
+
];
|
|
7041
|
+
|
|
6738
7042
|
// src/canvas/iframe-keys.ts
|
|
6739
|
-
var
|
|
6740
|
-
|
|
6741
|
-
|
|
6742
|
-
|
|
6743
|
-
|
|
6744
|
-
"ArrowUp",
|
|
6745
|
-
"ArrowDown",
|
|
6746
|
-
"ArrowLeft",
|
|
6747
|
-
"ArrowRight"
|
|
6748
|
-
]);
|
|
6749
|
-
var EDITOR_OWNED_CHORDS = new Set(["b", "i", "u", "`"]);
|
|
6750
|
-
function isEditableTarget(el) {
|
|
7043
|
+
var CARET_STACK = ["caret", "global"];
|
|
7044
|
+
var CANVAS_STACK = ["canvas", "global"];
|
|
7045
|
+
var GLOBAL_STACK = ["global"];
|
|
7046
|
+
var NO_TABLE = { chords: [], mac: false };
|
|
7047
|
+
function isPageTextEntry(el) {
|
|
6751
7048
|
if (!(el instanceof HTMLElement)) {
|
|
6752
7049
|
return false;
|
|
6753
7050
|
}
|
|
6754
|
-
if (el.isContentEditable) {
|
|
6755
|
-
return true;
|
|
6756
|
-
}
|
|
6757
7051
|
return el.tagName === "INPUT" || el.tagName === "TEXTAREA" || el.tagName === "SELECT";
|
|
6758
7052
|
}
|
|
6759
|
-
function
|
|
6760
|
-
|
|
6761
|
-
|
|
6762
|
-
|
|
7053
|
+
function frameScopeStack(sessionLive, mode) {
|
|
7054
|
+
if (sessionLive) {
|
|
7055
|
+
return CARET_STACK;
|
|
7056
|
+
}
|
|
7057
|
+
return mode === "preview" ? GLOBAL_STACK : CANVAS_STACK;
|
|
7058
|
+
}
|
|
7059
|
+
function shouldForwardKey(e, table = NO_TABLE, sessionLive = false, mode = "design") {
|
|
7060
|
+
if (isPageTextEntry(e.target)) {
|
|
7061
|
+
return false;
|
|
7062
|
+
}
|
|
7063
|
+
const chord = chordFromEvent(e, table.mac);
|
|
7064
|
+
if (!chord) {
|
|
7065
|
+
return false;
|
|
6763
7066
|
}
|
|
6764
|
-
|
|
7067
|
+
const stack = frameScopeStack(sessionLive, mode);
|
|
7068
|
+
return table.chords.some((entry) => entry.chord === chord && stack.includes(entry.scope));
|
|
6765
7069
|
}
|
|
6766
7070
|
function serializeKey(e) {
|
|
6767
7071
|
return {
|
|
@@ -6773,9 +7077,9 @@ function serializeKey(e) {
|
|
|
6773
7077
|
shiftKey: e.shiftKey
|
|
6774
7078
|
};
|
|
6775
7079
|
}
|
|
6776
|
-
function startKeyForwarding(channel, doc = document) {
|
|
7080
|
+
function startKeyForwarding(channel, doc = document, isSessionLive = () => false, getTable = () => NO_TABLE, getMode = () => "design") {
|
|
6777
7081
|
const onKey = (e) => {
|
|
6778
|
-
if (!shouldForwardKey(e)) {
|
|
7082
|
+
if (!shouldForwardKey(e, getTable(), isSessionLive(), getMode())) {
|
|
6779
7083
|
return;
|
|
6780
7084
|
}
|
|
6781
7085
|
e.preventDefault();
|
|
@@ -7314,7 +7618,26 @@ function fileDropHitFor(targetEl, shadowDoc) {
|
|
|
7314
7618
|
return {
|
|
7315
7619
|
path,
|
|
7316
7620
|
rect: rectFor2(targetEl),
|
|
7317
|
-
tagName: (node?.tagName
|
|
7621
|
+
tagName: (displayTagName(node?.tagName) || targetEl.tagName).toLowerCase()
|
|
7622
|
+
};
|
|
7623
|
+
}
|
|
7624
|
+
function layoutHitFor(target) {
|
|
7625
|
+
if (!(target instanceof Element)) {
|
|
7626
|
+
return null;
|
|
7627
|
+
}
|
|
7628
|
+
if (target.closest("[data-jx-path]")) {
|
|
7629
|
+
return null;
|
|
7630
|
+
}
|
|
7631
|
+
const el = target.closest("[data-jx-layout-region]");
|
|
7632
|
+
if (!(el instanceof HTMLElement)) {
|
|
7633
|
+
return null;
|
|
7634
|
+
}
|
|
7635
|
+
return {
|
|
7636
|
+
className: typeof el.className === "string" ? el.className : "",
|
|
7637
|
+
layoutFile: el.dataset.jxLayoutFile ?? "",
|
|
7638
|
+
layoutPath: parseJxPath(el.dataset.jxLayoutPath ?? "[]"),
|
|
7639
|
+
rect: rectFor2(el),
|
|
7640
|
+
tagName: el.tagName.toLowerCase()
|
|
7318
7641
|
};
|
|
7319
7642
|
}
|
|
7320
7643
|
var IN_PLACE_KEYS = new Set(["style", "textContent"]);
|
|
@@ -7345,6 +7668,9 @@ function patchDisturbsActiveEdit(forwardOps) {
|
|
|
7345
7668
|
}
|
|
7346
7669
|
return false;
|
|
7347
7670
|
}
|
|
7671
|
+
var IDLE_QUIET_FRAMES = 2;
|
|
7672
|
+
var IDLE_WATCH_MAX_MS = 5000;
|
|
7673
|
+
var IMAGE_RETRY_WINDOW_MS = 500;
|
|
7348
7674
|
function startCanvasIframe(opts) {
|
|
7349
7675
|
const { channel, container } = opts;
|
|
7350
7676
|
let handle = null;
|
|
@@ -7353,6 +7679,7 @@ function startCanvasIframe(opts) {
|
|
|
7353
7679
|
let shadowDoc = null;
|
|
7354
7680
|
let renderedGen = -1;
|
|
7355
7681
|
let currentMode = "design";
|
|
7682
|
+
let forwardTable = NO_TABLE;
|
|
7356
7683
|
let renderCtx = null;
|
|
7357
7684
|
let dragSrc = null;
|
|
7358
7685
|
let dragGen = -1;
|
|
@@ -7413,7 +7740,17 @@ function startCanvasIframe(opts) {
|
|
|
7413
7740
|
getMode: () => currentMode,
|
|
7414
7741
|
getShadowDoc: () => shadowDoc
|
|
7415
7742
|
});
|
|
7416
|
-
const
|
|
7743
|
+
const onLayoutClick = (e) => {
|
|
7744
|
+
if (currentMode !== "design" && currentMode !== "edit") {
|
|
7745
|
+
return;
|
|
7746
|
+
}
|
|
7747
|
+
const hit = layoutHitFor(e.target);
|
|
7748
|
+
if (hit) {
|
|
7749
|
+
channel.post({ hit, kind: "layoutHit" });
|
|
7750
|
+
}
|
|
7751
|
+
};
|
|
7752
|
+
container.ownerDocument.addEventListener("click", onLayoutClick, true);
|
|
7753
|
+
const stopKeyForwarding = startKeyForwarding(channel, container.ownerDocument, isEditing, () => forwardTable, () => currentMode);
|
|
7417
7754
|
const stopInlineEdit = startIframeInlineEdit(channel, container, {
|
|
7418
7755
|
getMode: () => currentMode,
|
|
7419
7756
|
getShadowDoc: () => shadowDoc
|
|
@@ -7429,12 +7766,84 @@ function startCanvasIframe(opts) {
|
|
|
7429
7766
|
const root = container.firstElementChild;
|
|
7430
7767
|
const fragment = root instanceof HTMLElement && root.dataset.jxDefinitionRoot !== undefined;
|
|
7431
7768
|
channel.post({ fragment, height: measured, kind: "contentHeight" });
|
|
7769
|
+
armIdleWatch();
|
|
7432
7770
|
}
|
|
7433
7771
|
}
|
|
7434
7772
|
const ResizeObs = win?.ResizeObserver;
|
|
7435
7773
|
const heightObserver = ResizeObs ? new ResizeObs(() => postContentHeight()) : null;
|
|
7774
|
+
const frameDoc = container.ownerDocument;
|
|
7775
|
+
let idleFrame = 0;
|
|
7776
|
+
let quietFrames = 0;
|
|
7777
|
+
let idleDeadline = 0;
|
|
7778
|
+
let lastIdleKey = "";
|
|
7779
|
+
const retryingImages = new Map;
|
|
7780
|
+
function pendingImageRetries() {
|
|
7781
|
+
const now = Date.now();
|
|
7782
|
+
for (const [img, deadline] of retryingImages) {
|
|
7783
|
+
if (deadline <= now) {
|
|
7784
|
+
retryingImages.delete(img);
|
|
7785
|
+
}
|
|
7786
|
+
}
|
|
7787
|
+
return retryingImages.size;
|
|
7788
|
+
}
|
|
7789
|
+
function sampleIdle() {
|
|
7790
|
+
const running = typeof frameDoc.getAnimations === "function" ? frameDoc.getAnimations().filter((a) => a.playState === "running").length : 0;
|
|
7791
|
+
return {
|
|
7792
|
+
animations: running,
|
|
7793
|
+
fonts: frameDoc.fonts ? frameDoc.fonts.status === "loaded" : true,
|
|
7794
|
+
gen: renderedGen,
|
|
7795
|
+
images: pendingImageRetries(),
|
|
7796
|
+
kind: "idle"
|
|
7797
|
+
};
|
|
7798
|
+
}
|
|
7799
|
+
function idleTick() {
|
|
7800
|
+
idleFrame = 0;
|
|
7801
|
+
const sample = sampleIdle();
|
|
7802
|
+
const key = `${sample.gen}|${sample.fonts}|${sample.animations}|${sample.images}`;
|
|
7803
|
+
const changed = key !== lastIdleKey;
|
|
7804
|
+
if (changed) {
|
|
7805
|
+
lastIdleKey = key;
|
|
7806
|
+
channel.post(sample);
|
|
7807
|
+
}
|
|
7808
|
+
const quiet = sample.fonts && sample.animations === 0 && sample.images === 0;
|
|
7809
|
+
quietFrames = quiet ? changed ? 1 : quietFrames + 1 : 0;
|
|
7810
|
+
if (quietFrames >= IDLE_QUIET_FRAMES) {
|
|
7811
|
+
return;
|
|
7812
|
+
}
|
|
7813
|
+
if (Date.now() >= idleDeadline) {
|
|
7814
|
+
return;
|
|
7815
|
+
}
|
|
7816
|
+
idleFrame = win ? win.requestAnimationFrame(idleTick) : 0;
|
|
7817
|
+
}
|
|
7818
|
+
function armIdleWatch() {
|
|
7819
|
+
quietFrames = 0;
|
|
7820
|
+
idleDeadline = Date.now() + IDLE_WATCH_MAX_MS;
|
|
7821
|
+
if (!idleFrame && win) {
|
|
7822
|
+
idleFrame = win.requestAnimationFrame(idleTick);
|
|
7823
|
+
}
|
|
7824
|
+
}
|
|
7825
|
+
const onImageError = (event) => {
|
|
7826
|
+
if (event.target instanceof HTMLImageElement) {
|
|
7827
|
+
retryingImages.set(event.target, Date.now() + IMAGE_RETRY_WINDOW_MS);
|
|
7828
|
+
armIdleWatch();
|
|
7829
|
+
}
|
|
7830
|
+
};
|
|
7831
|
+
const onImageLoad = (event) => {
|
|
7832
|
+
if (event.target instanceof HTMLImageElement && retryingImages.delete(event.target)) {
|
|
7833
|
+
armIdleWatch();
|
|
7834
|
+
}
|
|
7835
|
+
};
|
|
7836
|
+
container.addEventListener("error", onImageError, true);
|
|
7837
|
+
container.addEventListener("load", onImageLoad, true);
|
|
7838
|
+
armIdleWatch();
|
|
7436
7839
|
heightObserver?.observe(container);
|
|
7437
7840
|
const onWheel = (e) => {
|
|
7841
|
+
if (currentMode === "preview") {
|
|
7842
|
+
if (e.ctrlKey || e.metaKey) {
|
|
7843
|
+
e.preventDefault();
|
|
7844
|
+
}
|
|
7845
|
+
return;
|
|
7846
|
+
}
|
|
7438
7847
|
e.preventDefault();
|
|
7439
7848
|
channel.post({
|
|
7440
7849
|
ctrlKey: e.ctrlKey,
|
|
@@ -7537,6 +7946,7 @@ function startCanvasIframe(opts) {
|
|
|
7537
7946
|
if (msg.kind === "patch") {
|
|
7538
7947
|
const { gen: gen2 } = msg;
|
|
7539
7948
|
if (gen2 < renderedGen) {
|
|
7949
|
+
channel.post({ gen: gen2, kind: "patchError", message: "patch-behind-render" });
|
|
7540
7950
|
return;
|
|
7541
7951
|
}
|
|
7542
7952
|
if (gen2 > renderedGen || !shadowDoc || !renderCtx) {
|
|
@@ -7556,6 +7966,7 @@ function startCanvasIframe(opts) {
|
|
|
7556
7966
|
restoreDocSelection(container, caret);
|
|
7557
7967
|
}
|
|
7558
7968
|
channel.post({ gen: gen2, kind: "patchComplete" });
|
|
7969
|
+
armIdleWatch();
|
|
7559
7970
|
} catch (error) {
|
|
7560
7971
|
channel.post({
|
|
7561
7972
|
gen: gen2,
|
|
@@ -7610,10 +8021,25 @@ function startCanvasIframe(opts) {
|
|
|
7610
8021
|
stopAutoScroll();
|
|
7611
8022
|
return;
|
|
7612
8023
|
}
|
|
8024
|
+
if (msg.kind === "keymap") {
|
|
8025
|
+
forwardTable = { chords: msg.chords, mac: msg.mac };
|
|
8026
|
+
return;
|
|
8027
|
+
}
|
|
7613
8028
|
if (msg.kind === "setColorScheme") {
|
|
7614
8029
|
applyPreviewColorScheme(container.ownerDocument, msg.scheme);
|
|
7615
8030
|
return;
|
|
7616
8031
|
}
|
|
8032
|
+
if (msg.kind === "setLocale") {
|
|
8033
|
+
const root = container.ownerDocument.documentElement;
|
|
8034
|
+
if (msg.locale === null) {
|
|
8035
|
+
root.removeAttribute("lang");
|
|
8036
|
+
root.removeAttribute("dir");
|
|
8037
|
+
} else {
|
|
8038
|
+
root.setAttribute("lang", msg.locale);
|
|
8039
|
+
root.setAttribute("dir", msg.dir);
|
|
8040
|
+
}
|
|
8041
|
+
return;
|
|
8042
|
+
}
|
|
7617
8043
|
if (msg.kind === "siteStyleUpdate") {
|
|
7618
8044
|
applySiteStyle(msg.siteStyle, msg.media);
|
|
7619
8045
|
return;
|
|
@@ -7656,6 +8082,7 @@ function startCanvasIframe(opts) {
|
|
|
7656
8082
|
renderedGen = gen;
|
|
7657
8083
|
currentMode = msg.mode;
|
|
7658
8084
|
channel.post({ gen, kind: "renderComplete" });
|
|
8085
|
+
armIdleWatch();
|
|
7659
8086
|
const defs = handle.ctx.defs;
|
|
7660
8087
|
stopDataScopeWatch = observeScope(() => {
|
|
7661
8088
|
try {
|
|
@@ -7681,8 +8108,15 @@ function startCanvasIframe(opts) {
|
|
|
7681
8108
|
stopInlineEdit();
|
|
7682
8109
|
stopSlashBridge();
|
|
7683
8110
|
stopImageRetry();
|
|
8111
|
+
if (idleFrame && win) {
|
|
8112
|
+
win.cancelAnimationFrame(idleFrame);
|
|
8113
|
+
}
|
|
8114
|
+
idleFrame = 0;
|
|
8115
|
+
container.removeEventListener("error", onImageError, true);
|
|
8116
|
+
container.removeEventListener("load", onImageLoad, true);
|
|
7684
8117
|
stopAutoScroll();
|
|
7685
8118
|
heightObserver?.disconnect();
|
|
8119
|
+
container.ownerDocument.removeEventListener("click", onLayoutClick, true);
|
|
7686
8120
|
container.ownerDocument.removeEventListener("wheel", onWheel);
|
|
7687
8121
|
container.ownerDocument.removeEventListener("dragenter", onNativeDragOver, true);
|
|
7688
8122
|
container.ownerDocument.removeEventListener("dragleave", onNativeDragLeave, true);
|
|
@@ -7716,10 +8150,14 @@ if (typeof window !== "undefined" && window.parent !== window) {
|
|
|
7716
8150
|
export {
|
|
7717
8151
|
startCanvasIframe,
|
|
7718
8152
|
patchDisturbsActiveEdit,
|
|
8153
|
+
layoutHitFor,
|
|
7719
8154
|
isExternalFileDrag,
|
|
7720
8155
|
fileDropHitFor,
|
|
7721
|
-
bootCanvasIframe
|
|
8156
|
+
bootCanvasIframe,
|
|
8157
|
+
IMAGE_RETRY_WINDOW_MS,
|
|
8158
|
+
IDLE_WATCH_MAX_MS,
|
|
8159
|
+
IDLE_QUIET_FRAMES
|
|
7722
8160
|
};
|
|
7723
8161
|
|
|
7724
|
-
//# debugId=
|
|
8162
|
+
//# debugId=3844B899CF37A35C64756E2164756E21
|
|
7725
8163
|
//# sourceMappingURL=iframe-entry.js.map
|