@plitzi/sdk-elements 0.38.16 → 0.38.18
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/CHANGELOG.md +123 -0
- package/dist/Component/ComponentProvider.mjs +3 -3
- package/dist/Element/ElementContext.mjs +1 -1
- package/dist/Element/ElementParentContext.mjs +1 -1
- package/dist/Element/JsxManager.mjs +2 -2
- package/dist/Element/LayoutBody.mjs +1 -1
- package/dist/Element/PluginManager.mjs +2 -2
- package/dist/Element/PluginRemote.mjs +4 -4
- package/dist/Element/ReplicaProvider.mjs +1 -1
- package/dist/Element/RootElement.mjs +4 -4
- package/dist/Element/helpers/declaredAttributes.mjs +1 -1
- package/dist/Element/helpers/getInteractions.mjs +4 -5
- package/dist/Element/hocs/withElement.mjs +2 -2
- package/dist/Element/hooks/useEditableContent.mjs +2 -2
- package/dist/Element/hooks/useElementDataSource.mjs +1 -1
- package/dist/Element/hooks/useElementInternal.mjs +2 -2
- package/dist/Element/hooks/useElementVisible.mjs +1 -1
- package/dist/Element/hooks/useInternalClassName.mjs +1 -1
- package/dist/Element/hooks/useInternalItems.mjs +2 -2
- package/dist/Element/hooks/useIntervalTriggers.mjs +1 -1
- package/dist/Element/hooks/useKeyTriggers.mjs +1 -1
- package/dist/Element/hooks/useLayoutChain.d.ts +1 -1
- package/dist/Element/hooks/useLayoutChain.mjs +4 -4
- package/dist/Element/hooks/usePluginTrigger.mjs +2 -2
- package/dist/Element/hooks/useRootElementInteractions.mjs +26 -27
- package/dist/Element/hooks/useRscData.d.ts +1 -1
- package/dist/Element/hooks/useRscData.mjs +1 -2
- package/dist/Element/hooks/useScrollInteractions.mjs +20 -21
- package/dist/builder/index.d.ts +5 -0
- package/dist/builder/index.mjs +1 -0
- package/dist/canvas/useAnimationFrame.mjs +1 -1
- package/dist/components/ElementAdvancedEditor.mjs +30 -30
- package/dist/components/IconField/index.mjs +1 -2
- package/dist/components/IconPicker/index.mjs +1 -2
- package/dist/components/MarkdownDocument/components/CodeBlock/CodeBlock.mjs +13 -13
- package/dist/dataSource/GlobalSources.mjs +45 -45
- package/dist/dataSource/getSourcesByElementId.mjs +1 -1
- package/dist/dataSource/index.d.ts +3 -0
- package/dist/dataSource/index.mjs +6 -3
- package/dist/dataSource/pathFields.mjs +1 -1
- package/dist/dataSource/sourceStore.mjs +1 -1
- package/dist/dataSource/useRegisterSource.d.ts +9 -0
- package/dist/dataSource/useRegisterSource.mjs +40 -0
- package/dist/dataSource/useResolvedVariables.d.ts +12 -0
- package/dist/dataSource/useResolvedVariables.mjs +27 -0
- package/dist/elements/advanced/BlockHtml/BlockHtml.d.ts +1 -1
- package/dist/elements/advanced/BlockHtml/BlockHtml.mjs +1 -1
- package/dist/elements/advanced/BlockHtml/declaration.d.ts +2 -2
- package/dist/elements/advanced/BlockHtml/declaration.mjs +1 -1
- package/dist/elements/advanced/BlockHtml/index.d.ts +3 -3
- package/dist/elements/advanced/BlockJsx/BlockJsx.d.ts +1 -1
- package/dist/elements/advanced/BlockJsx/Settings.mjs +25 -29
- package/dist/elements/advanced/BlockJsx/declaration.d.ts +2 -2
- package/dist/elements/advanced/BlockJsx/declaration.mjs +1 -1
- package/dist/elements/advanced/BlockJsx/index.d.ts +3 -3
- package/dist/elements/advanced/Custom/Custom.d.ts +1 -1
- package/dist/elements/advanced/Custom/Custom.mjs +2 -2
- package/dist/elements/advanced/Custom/Settings.mjs +3 -6
- package/dist/elements/advanced/Custom/declaration.d.ts +2 -2
- package/dist/elements/advanced/Custom/declaration.mjs +1 -1
- package/dist/elements/advanced/Custom/index.d.ts +3 -3
- package/dist/elements/advanced/NodeHtml/NodeHtml.d.ts +1 -1
- package/dist/elements/advanced/NodeHtml/declaration.d.ts +2 -2
- package/dist/elements/advanced/NodeHtml/declaration.mjs +1 -1
- package/dist/elements/advanced/NodeHtml/index.d.ts +3 -3
- package/dist/elements/advanced/PlitziSdk/declaration.d.ts +1 -1
- package/dist/elements/advanced/PlitziSdk/declaration.mjs +1 -1
- package/dist/elements/advanced/Reference/Reference.d.ts +1 -1
- package/dist/elements/advanced/Reference/Reference.mjs +3 -3
- package/dist/elements/advanced/Reference/declaration.d.ts +2 -2
- package/dist/elements/advanced/Reference/declaration.mjs +1 -1
- package/dist/elements/advanced/Reference/index.d.ts +3 -3
- package/dist/elements/basic/Button/Button.d.ts +1 -1
- package/dist/elements/basic/Button/Button.mjs +1 -1
- package/dist/elements/basic/Button/declaration.d.ts +3 -3
- package/dist/elements/basic/Button/declaration.mjs +1 -1
- package/dist/elements/basic/Button/index.d.ts +4 -4
- package/dist/elements/basic/Dropdown/Dropdown.d.ts +1 -1
- package/dist/elements/basic/Dropdown/Dropdown.mjs +12 -12
- package/dist/elements/basic/Dropdown/DropdownPopup/DropdownPopup.d.ts +1 -1
- package/dist/elements/basic/Dropdown/DropdownPopup/declaration.d.ts +2 -2
- package/dist/elements/basic/Dropdown/DropdownPopup/declaration.mjs +1 -1
- package/dist/elements/basic/Dropdown/DropdownPopup/index.d.ts +3 -3
- package/dist/elements/basic/Dropdown/declaration.d.ts +2 -2
- package/dist/elements/basic/Dropdown/declaration.mjs +1 -1
- package/dist/elements/basic/Dropdown/index.d.ts +5 -5
- package/dist/elements/basic/Dropdown/useDropdown.mjs +1 -5
- package/dist/elements/basic/Dropdown/useDropdownTrigger.mjs +1 -7
- package/dist/elements/basic/Heading/Heading.d.ts +1 -1
- package/dist/elements/basic/Heading/declaration.d.ts +2 -2
- package/dist/elements/basic/Heading/declaration.mjs +1 -1
- package/dist/elements/basic/Heading/index.d.ts +3 -3
- package/dist/elements/basic/Link/Link.d.ts +1 -1
- package/dist/elements/basic/Link/Link.mjs +2 -2
- package/dist/elements/basic/Link/Settings.mjs +2 -2
- package/dist/elements/basic/Link/declaration.d.ts +3 -3
- package/dist/elements/basic/Link/declaration.mjs +1 -1
- package/dist/elements/basic/Link/index.d.ts +4 -4
- package/dist/elements/basic/Markdown/Markdown.d.ts +1 -1
- package/dist/elements/basic/Markdown/Markdown.mjs +8 -8
- package/dist/elements/basic/Markdown/declaration.d.ts +2 -2
- package/dist/elements/basic/Markdown/declaration.mjs +1 -1
- package/dist/elements/basic/Markdown/hooks/useMarkdownClassNames.mjs +1 -1
- package/dist/elements/basic/Markdown/index.d.ts +3 -3
- package/dist/elements/basic/Paragraph/Paragraph.d.ts +1 -1
- package/dist/elements/basic/Paragraph/declaration.d.ts +2 -2
- package/dist/elements/basic/Paragraph/declaration.mjs +1 -1
- package/dist/elements/basic/Paragraph/index.d.ts +3 -3
- package/dist/elements/basic/RichText/RichText.d.ts +1 -1
- package/dist/elements/basic/RichText/RichText.mjs +14 -14
- package/dist/elements/basic/RichText/declaration.d.ts +2 -2
- package/dist/elements/basic/RichText/declaration.mjs +1 -1
- package/dist/elements/basic/RichText/index.d.ts +3 -3
- package/dist/elements/basic/Text/Text.d.ts +1 -1
- package/dist/elements/basic/Text/declaration.d.ts +2 -2
- package/dist/elements/basic/Text/declaration.mjs +1 -1
- package/dist/elements/basic/Text/index.d.ts +3 -3
- package/dist/elements/basic/ThemeToggle/ThemeToggle.d.ts +1 -1
- package/dist/elements/basic/ThemeToggle/ThemeToggle.mjs +3 -3
- package/dist/elements/basic/ThemeToggle/declaration.d.ts +2 -2
- package/dist/elements/basic/ThemeToggle/declaration.mjs +1 -1
- package/dist/elements/basic/ThemeToggle/index.d.ts +3 -3
- package/dist/elements/declarations/index.d.ts +66 -52
- package/dist/elements/declarations/index.mjs +45 -42
- package/dist/elements/form/Form/Form.d.ts +1 -1
- package/dist/elements/form/Form/Form.mjs +37 -37
- package/dist/elements/form/Form/declaration.d.ts +2 -2
- package/dist/elements/form/Form/declaration.mjs +1 -1
- package/dist/elements/form/Form/index.d.ts +1 -1
- package/dist/elements/form/FormControl/FormControl.d.ts +1 -1
- package/dist/elements/form/FormControl/FormControl.mjs +2 -2
- package/dist/elements/form/FormControl/Settings.mjs +1 -5
- package/dist/elements/form/FormControl/declaration.d.ts +2 -2
- package/dist/elements/form/FormControl/declaration.mjs +1 -1
- package/dist/elements/form/FormControl/hocs/withFieldValue.mjs +12 -16
- package/dist/elements/form/FormControl/index.d.ts +1 -1
- package/dist/elements/internal/LayoutContainer/LayoutContainer.d.ts +1 -1
- package/dist/elements/internal/LayoutContainer/LayoutContainer.mjs +1 -1
- package/dist/elements/internal/LayoutContainer/declaration.d.ts +2 -2
- package/dist/elements/internal/LayoutContainer/declaration.mjs +1 -1
- package/dist/elements/internal/LayoutContainer/index.d.ts +3 -3
- package/dist/elements/internal/LayoutPicker/LayoutPicker.mjs +7 -7
- package/dist/elements/internal/Loading/Loading.d.ts +1 -1
- package/dist/elements/internal/Loading/declaration.d.ts +2 -2
- package/dist/elements/internal/Loading/declaration.mjs +1 -1
- package/dist/elements/internal/Loading/index.d.ts +3 -3
- package/dist/elements/internal/NotFound/NotFound.d.ts +1 -1
- package/dist/elements/internal/NotFound/NotFound.mjs +1 -1
- package/dist/elements/internal/NotFound/declaration.d.ts +2 -2
- package/dist/elements/internal/NotFound/declaration.mjs +1 -1
- package/dist/elements/internal/NotFound/index.d.ts +3 -3
- package/dist/elements/internal/Page/Page.d.ts +1 -1
- package/dist/elements/internal/Page/Page.mjs +2 -2
- package/dist/elements/internal/Page/PageHead.mjs +7 -7
- package/dist/elements/internal/Page/Settings.mjs +1 -1
- package/dist/elements/internal/Page/declaration.d.ts +2 -2
- package/dist/elements/internal/Page/declaration.mjs +1 -1
- package/dist/elements/internal/Page/index.d.ts +3 -3
- package/dist/elements/media/Embed/Embed.d.ts +1 -1
- package/dist/elements/media/Embed/Embed.mjs +1 -1
- package/dist/elements/media/Embed/declaration.d.ts +2 -2
- package/dist/elements/media/Embed/declaration.mjs +1 -1
- package/dist/elements/media/Embed/index.d.ts +3 -3
- package/dist/elements/media/FontAwesome/FontAwesome.d.ts +1 -1
- package/dist/elements/media/FontAwesome/declaration.d.ts +2 -2
- package/dist/elements/media/FontAwesome/declaration.mjs +1 -1
- package/dist/elements/media/FontAwesome/index.d.ts +3 -3
- package/dist/elements/media/Image/Image.d.ts +1 -1
- package/dist/elements/media/Image/Image.mjs +12 -12
- package/dist/elements/media/Image/declaration.d.ts +2 -2
- package/dist/elements/media/Image/declaration.mjs +1 -1
- package/dist/elements/media/Image/index.d.ts +3 -3
- package/dist/elements/media/Svg/Svg.d.ts +1 -1
- package/dist/elements/media/Svg/Svg.mjs +11 -11
- package/dist/elements/media/Svg/declaration.d.ts +2 -2
- package/dist/elements/media/Svg/declaration.mjs +1 -1
- package/dist/elements/media/Svg/index.d.ts +3 -3
- package/dist/elements/media/Video/Video.d.ts +1 -1
- package/dist/elements/media/Video/Video.mjs +1 -1
- package/dist/elements/media/Video/declaration.d.ts +2 -2
- package/dist/elements/media/Video/declaration.mjs +1 -1
- package/dist/elements/media/Video/index.d.ts +3 -3
- package/dist/elements/provider/ApiContainer/ApiContainer.d.ts +1 -1
- package/dist/elements/provider/ApiContainer/ApiContainer.mjs +40 -48
- package/dist/elements/provider/ApiContainer/Settings.mjs +6 -10
- package/dist/elements/provider/ApiContainer/declaration.d.ts +2 -2
- package/dist/elements/provider/ApiContainer/declaration.mjs +1 -1
- package/dist/elements/provider/ApiContainer/helpers/serverMock.mjs +1 -1
- package/dist/elements/provider/ApiContainer/hooks/useApi.mjs +5 -5
- package/dist/elements/provider/ApiContainer/hooks/useProviderPagination.mjs +3 -12
- package/dist/elements/provider/ApiContainer/index.d.ts +3 -3
- package/dist/elements/provider/Channel/Channel.d.ts +1 -1
- package/dist/elements/provider/Channel/Channel.mjs +24 -24
- package/dist/elements/provider/Channel/declaration.d.ts +2 -2
- package/dist/elements/provider/Channel/declaration.mjs +1 -1
- package/dist/elements/provider/Channel/index.d.ts +3 -3
- package/dist/elements/settings.mjs +84 -85
- package/dist/elements/structure/Carousel/Carousel.d.ts +1 -1
- package/dist/elements/structure/Carousel/Carousel.mjs +27 -39
- package/dist/elements/structure/Carousel/CarouselTrack/CarouselTrack.d.ts +1 -1
- package/dist/elements/structure/Carousel/CarouselTrack/components/CarouselSlide/index.mjs +1 -2
- package/dist/elements/structure/Carousel/CarouselTrack/components/MarqueeTrack/index.mjs +1 -2
- package/dist/elements/structure/Carousel/CarouselTrack/components/ScrollTrack/index.mjs +1 -2
- package/dist/elements/structure/Carousel/CarouselTrack/declaration.d.ts +2 -2
- package/dist/elements/structure/Carousel/CarouselTrack/declaration.mjs +1 -1
- package/dist/elements/structure/Carousel/CarouselTrack/index.d.ts +3 -3
- package/dist/elements/structure/Carousel/declaration.d.ts +2 -2
- package/dist/elements/structure/Carousel/declaration.mjs +1 -1
- package/dist/elements/structure/Carousel/index.d.ts +5 -5
- package/dist/elements/structure/Container/Container.d.ts +1 -1
- package/dist/elements/structure/Container/declaration.d.ts +2 -2
- package/dist/elements/structure/Container/declaration.mjs +1 -1
- package/dist/elements/structure/Container/index.d.ts +3 -3
- package/dist/elements/structure/DialogContainer/DialogContainer.d.ts +1 -1
- package/dist/elements/structure/DialogContainer/declaration.d.ts +2 -2
- package/dist/elements/structure/DialogContainer/declaration.mjs +1 -1
- package/dist/elements/structure/DialogContainer/index.d.ts +3 -3
- package/dist/elements/structure/List/List.d.ts +1 -1
- package/dist/elements/structure/List/ListItem/ListItem.d.ts +1 -1
- package/dist/elements/structure/List/ListItem/declaration.d.ts +2 -2
- package/dist/elements/structure/List/ListItem/declaration.mjs +1 -1
- package/dist/elements/structure/List/ListItem/index.d.ts +3 -3
- package/dist/elements/structure/List/declaration.d.ts +2 -2
- package/dist/elements/structure/List/declaration.mjs +1 -1
- package/dist/elements/structure/List/index.d.ts +5 -5
- package/dist/elements/structure/List/modes/ListControlled/ListControlled.mjs +23 -23
- package/dist/elements/structure/ModalContainer/ModalContainer.d.ts +1 -1
- package/dist/elements/structure/ModalContainer/declaration.d.ts +2 -2
- package/dist/elements/structure/ModalContainer/declaration.mjs +1 -1
- package/dist/elements/structure/ModalContainer/index.d.ts +3 -3
- package/dist/elements/structure/Overlay/metadataOf.mjs +1 -1
- package/dist/elements/structure/Overlay/useOverlay.mjs +19 -19
- package/dist/elements/structure/Pagination/Pagination.d.ts +1 -1
- package/dist/elements/structure/Pagination/Pagination.mjs +3 -3
- package/dist/elements/structure/Pagination/declaration.d.ts +2 -2
- package/dist/elements/structure/Pagination/declaration.mjs +1 -1
- package/dist/elements/structure/Pagination/index.d.ts +3 -3
- package/dist/elements/structure/TabContainer/TabContainer.d.ts +1 -1
- package/dist/elements/structure/TabContainer/TabContainerBody/TabContainerBody.d.ts +1 -1
- package/dist/elements/structure/TabContainer/TabContainerBody/declaration.d.ts +2 -2
- package/dist/elements/structure/TabContainer/TabContainerBody/declaration.mjs +1 -1
- package/dist/elements/structure/TabContainer/TabContainerBody/index.d.ts +3 -3
- package/dist/elements/structure/TabContainer/TabContainerHeader/TabContainerHeader.d.ts +1 -1
- package/dist/elements/structure/TabContainer/TabContainerHeader/declaration.d.ts +2 -2
- package/dist/elements/structure/TabContainer/TabContainerHeader/declaration.mjs +1 -1
- package/dist/elements/structure/TabContainer/TabContainerHeader/index.d.ts +3 -3
- package/dist/elements/structure/TabContainer/TabContainerItem/TabContainerItem.d.ts +1 -1
- package/dist/elements/structure/TabContainer/TabContainerItem/declaration.d.ts +2 -2
- package/dist/elements/structure/TabContainer/TabContainerItem/declaration.mjs +1 -1
- package/dist/elements/structure/TabContainer/TabContainerItem/index.d.ts +3 -3
- package/dist/elements/structure/TabContainer/declaration.d.ts +2 -2
- package/dist/elements/structure/TabContainer/declaration.mjs +1 -1
- package/dist/elements/structure/TabContainer/index.d.ts +11 -11
- package/dist/index.d.ts +133 -121
- package/dist/index.mjs +85 -76
- package/package.json +18 -1408
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,128 @@
|
|
|
1
1
|
# @plitzi/sdk-elements
|
|
2
2
|
|
|
3
|
+
## 0.38.18
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- b3023c9: ## Security
|
|
8
|
+
|
|
9
|
+
- **A page of the same site on another origin is no longer this server's own** (`@plitzi/sdk-server`): the guard
|
|
10
|
+
against writes another page caused (`crossSiteWrites`, the sign-in's login-CSRF check and `createOriginGuardMiddleware`)
|
|
11
|
+
trusted `Sec-Fetch-Site: same-site` — and a site has no port and spans every sub-domain, so another port of the host
|
|
12
|
+
(where `createAuthoringHost` serves pages an agent wrote) or a sibling sub-domain (every space of a platform on one
|
|
13
|
+
domain) could write as if it were the server's own page. Now only `same-origin` (and `none`, a typed URL) is; `same-site`
|
|
14
|
+
is refused 403 `reason: 'foreign'` unless its origin is named (`crossSiteWrites.origins`, `identity.platformOrigins`),
|
|
15
|
+
and the `Origin` fallback compares host and port. In production an app and its spaces are already on different sites,
|
|
16
|
+
so a deployment that works there needs nothing; one that relied on a sibling sub-domain locally names it.
|
|
17
|
+
`createAuthoringHost`'s docs now say to serve on a host of its own — a cookie belongs to a host whatever its port.
|
|
18
|
+
|
|
19
|
+
## Server
|
|
20
|
+
- **An open page takes a new version of its space where it stands** (`@plitzi/sdk-server`, `@plitzi/plitzi-sdk`):
|
|
21
|
+
`server.updatePages(documents, { draft? })` hands the pages showing that space — or that draft — its new documents,
|
|
22
|
+
and each swaps them in place, its state, scroll and focus kept (`replaceSpace` on what the SDK's `render` returns;
|
|
23
|
+
`false`, and the page loads again, for a page with elements the server draws). The development loop of a project uses
|
|
24
|
+
it: a save to the space no longer reloads the open page. `createAuthoringHost`'s `put` over an id that pages show
|
|
25
|
+
hands them the new version and answers how many took it (`updated`), so a page an agent keeps improving is seen to
|
|
26
|
+
grow instead of reloading — no second iframe needed.
|
|
27
|
+
- **`devReload` is `livePages`** (`@plitzi/sdk-server`): the channel the open pages listen on now carries the space,
|
|
28
|
+
not only "load again", and a host that is not developing uses it too. Its address is `/__plitzi/live`; a draft's page
|
|
29
|
+
listens for its own changes alone (`?__pt=`). A plugin swapped where it is drawn stays a development server's
|
|
30
|
+
(`devMode`). `plitzi upgrade migrations --write` renames the option in a project's code (`livePagesOption`).
|
|
31
|
+
|
|
32
|
+
## Packages
|
|
33
|
+
- **`@plitzi/sdk-server` starts in half the time** (`@plitzi/sdk-shared`, `@plitzi/sdk-server`): importing it took
|
|
34
|
+
~310 ms, ~200 of them `date-fns` — 108 modules nothing on the server uses, brought by `@plitzi/sdk-shared/helpers` —
|
|
35
|
+
and loaded the browser's hooks and contexts of every folder of `@plitzi/sdk-shared` it read, `@plitzi/nexus/react`
|
|
36
|
+
with them. Now ~150 ms (`@plitzi/sdk-shared` 139 → 113 modules, `@plitzi/nexus` 53 → 31). What moved, each
|
|
37
|
+
rewritten by `plitzi upgrade migrations --write` (`movedExports`):
|
|
38
|
+
- the dates — `formatDate`, `formatDateUTC`, `formatFromNow`, `formatUTCToLocal`, `getDurationMs`, `isDate`,
|
|
39
|
+
`isValidFormat`, `parseDate`, `toUnixSeconds`, `SupportedLocale` — from `@plitzi/sdk-shared/helpers` to
|
|
40
|
+
`@plitzi/sdk-shared/dates`;
|
|
41
|
+
- React's bindings to an entry of their own beside each area, as `@plitzi/nexus/react` is: `useDisplayMode`,
|
|
42
|
+
`useElementSize` → `@plitzi/sdk-shared/style/react`; `SchemaContext` → `schema/react`; `PluginsContext` →
|
|
43
|
+
`plugins/react`; `DevToolsContext` → `devTools/react`; `useFlagResolution` → `flags/react` (`flagUserFrom` stays
|
|
44
|
+
in `flags`);
|
|
45
|
+
- `PROJECT_DATA_PREFIX` from `@plitzi/sdk-shared/server` to `@plitzi/sdk-shared/project/paths` — the project's
|
|
46
|
+
layout names, an entry a browser imports too (`@plitzi/sdk-shared/project` stays Node only and re-exports them).
|
|
47
|
+
The theme cookie's helpers (`themeFromCookies`…) are also `@plitzi/sdk-shared/theme/cookie`, still exported by
|
|
48
|
+
`@plitzi/sdk-shared/theme`.
|
|
49
|
+
|
|
50
|
+
`yarn check:server-footprint` (in CI after the build) holds what the server's root loads, package by package — Plitzi's
|
|
51
|
+
and every other — to a budget: a heavy library or a folder of hooks coming back fails with what came in.
|
|
52
|
+
|
|
53
|
+
## CLI
|
|
54
|
+
- **`plitzi upgrade migrations --write` writes a file import's new home when it has one** (`@plitzi/cli`): the
|
|
55
|
+
`folderImports` migration of 0.38.17 named every import of a package's FILE and wrote none. It now reads the installed
|
|
56
|
+
declarations with the project's own TypeScript and rewrites each `import` / `export … from` whose every name the folder
|
|
57
|
+
exports under one name — `import usePlitzi from '@plitzi/sdk-shared/hooks/usePlitzi'` →
|
|
58
|
+
`import { usePlitzi } from '@plitzi/sdk-shared/hooks'`, `type` modifiers and aliases kept. What has no one answer is
|
|
59
|
+
said with why (a namespace import, an `import()` or mock, a name the folder does not export, a project with no
|
|
60
|
+
TypeScript). The report says which places `--write` writes (`writable` in `--json`) instead of calling every one
|
|
61
|
+
"yours to change"; a migration now gives each place its own `edit` in place of a whole-file `rewrite`
|
|
62
|
+
(`docs/en/releases.md`).
|
|
63
|
+
- **`plitzi doctor` says an import of a path the installed package does not export** (`@plitzi/cli`):
|
|
64
|
+
`import-not-exported`, an error, at the importing file — what Node otherwise reports at start as an
|
|
65
|
+
`ERR_MODULE_NOT_FOUND` into the package's `dist`, which reads as a broken install rather than a changed API. For a
|
|
66
|
+
`@plitzi` package the fix names `plitzi upgrade migrations --write`; for any other, its `exports`. Asked only of a
|
|
67
|
+
package that is installed.
|
|
68
|
+
|
|
69
|
+
- Updated dependencies [b3023c9]
|
|
70
|
+
- @plitzi/sdk-auth@0.38.18
|
|
71
|
+
- @plitzi/sdk-event-bridge@0.38.18
|
|
72
|
+
- @plitzi/sdk-interactions@0.38.18
|
|
73
|
+
- @plitzi/sdk-navigation@0.38.18
|
|
74
|
+
- @plitzi/sdk-schema@0.38.18
|
|
75
|
+
- @plitzi/sdk-shared@0.38.18
|
|
76
|
+
|
|
77
|
+
## 0.38.17
|
|
78
|
+
|
|
79
|
+
### Patch Changes
|
|
80
|
+
|
|
81
|
+
- 4f8dc37: ## Packages
|
|
82
|
+
|
|
83
|
+
- **A library package is imported by its root and its folders, never by a file** (`@plitzi/sdk-shared`, `sdk-schema`,
|
|
84
|
+
`sdk-style`, `sdk-elements`, `sdk-interactions`, `sdk-auth`, `sdk-dev-tools`, `sdk-event-bridge`, `sdk-navigation`,
|
|
85
|
+
`sdk-plugins`, `sdk-variables`): each `exports` is now `"."` and `"./*"`, the latter a folder's `index`.
|
|
86
|
+
`@plitzi/sdk-shared/helpers/isRecord` becomes `import { isRecord } from '@plitzi/sdk-shared/helpers'`, and a default
|
|
87
|
+
export by the name its folder gives it — almost always its file's (`import usePlitzi from '…/hooks/usePlitzi'` →
|
|
88
|
+
`import { usePlitzi } from '@plitzi/sdk-shared/hooks'`). A file-level specifier now fails with `ERR_MODULE_NOT_FOUND`.
|
|
89
|
+
New entries where a folder barrel would have brought more than was asked for: `@plitzi/sdk-shared/project` and
|
|
90
|
+
`@plitzi/sdk-shared/plugins/bundle` (Node only), `@plitzi/sdk-interactions/declarations` (the global callbacks and
|
|
91
|
+
utility specs, without React), and `@plitzi/sdk-elements/elements/declarations`, which now also carries the
|
|
92
|
+
declarations' attribute types and the constants they are checked with. `RuleGroup` is exported by `@plitzi/sdk-shared`
|
|
93
|
+
with the document types that use it. `plitzi upgrade migrations` names every such import in a project, with the folder to
|
|
94
|
+
import it from instead.
|
|
95
|
+
- **`@plitzi/sdk-shared`'s root exports the document types, and only them** (`@plitzi/sdk-shared`): what the package
|
|
96
|
+
does is imported from its folder — `formatDate` from `@plitzi/sdk-shared/helpers`, `ThemeProvider` from
|
|
97
|
+
`@plitzi/sdk-shared/theme`, a GraphQL operation's types from `@plitzi/sdk-shared/network/graphql` — so a module that
|
|
98
|
+
imports a type from the root no longer loads every area of the package.
|
|
99
|
+
- **What one package alone used lives in that package** (`@plitzi/sdk-shared`, `@plitzi/sdk-elements`): the data
|
|
100
|
+
source hooks moved from `@plitzi/sdk-shared/dataSource/hooks` to `@plitzi/sdk-elements/dataSource`
|
|
101
|
+
(`useRegisterSource`, `useResolvedVariables`), and the Apollo links the builder's client is built with into the
|
|
102
|
+
builder.
|
|
103
|
+
- **The builder's panels are an entry of their own** (`@plitzi/sdk-style`, `@plitzi/sdk-variables`,
|
|
104
|
+
`@plitzi/sdk-elements`): the style inspector, the advanced style editor and `BuilderStyleContextProvider` are imported
|
|
105
|
+
from `@plitzi/sdk-style/builder`; the variables' lists and forms from `@plitzi/sdk-variables/builder`; the elements'
|
|
106
|
+
settings panels (`defaultElementsSettings`) from `@plitzi/sdk-elements/builder`. Each package's root keeps what a page
|
|
107
|
+
and a server use — `generateCache` no longer loads the inspector, on a server 227 modules down to 21.
|
|
108
|
+
|
|
109
|
+
## CLI
|
|
110
|
+
- **`plitzi upgrade`'s `renames` part is now `migrations`** (`@plitzi/cli`): what a version changed that a project's
|
|
111
|
+
own source must follow, one file per change in the CLI's `src/migrations/changes/` with the version it shipped in —
|
|
112
|
+
rewritten with `--write` when it has one right answer, said otherwise. The `--json` report carries `migrations` (each
|
|
113
|
+
with its `migration`, `since`, `file`, `line`, `what` and whether it was `written`) in place of `renames` and
|
|
114
|
+
`changes`. The changes of 0.38.0 (`canTemplate` → `canSnippet`, the `*Template` authoring names), 0.38.9 (a
|
|
115
|
+
`formControl` without `required` is optional) and 0.38.12 (`usePlitziServiceContext` → `usePlitzi`) are no longer
|
|
116
|
+
looked for: a project still on one of those versions makes them by hand.
|
|
117
|
+
|
|
118
|
+
- Updated dependencies [4f8dc37]
|
|
119
|
+
- @plitzi/sdk-auth@0.38.17
|
|
120
|
+
- @plitzi/sdk-event-bridge@0.38.17
|
|
121
|
+
- @plitzi/sdk-interactions@0.38.17
|
|
122
|
+
- @plitzi/sdk-navigation@0.38.17
|
|
123
|
+
- @plitzi/sdk-schema@0.38.17
|
|
124
|
+
- @plitzi/sdk-shared@0.38.17
|
|
125
|
+
|
|
3
126
|
## 0.38.16
|
|
4
127
|
|
|
5
128
|
### Patch Changes
|
|
@@ -2,7 +2,7 @@ import { getPlugins as e, processLocalCustomPlugins as t, processLocalPlugins as
|
|
|
2
2
|
import { defaultElements as r } from "../index.mjs";
|
|
3
3
|
import { useCallback as i, useMemo as a, useRef as o } from "react";
|
|
4
4
|
import { get as s, omit as c } from "@plitzi/plitzi-ui/helpers";
|
|
5
|
-
import l from "@plitzi/sdk-shared/elements
|
|
5
|
+
import { ComponentContext as l } from "@plitzi/sdk-shared/elements";
|
|
6
6
|
import { jsx as u } from "react/jsx-runtime";
|
|
7
7
|
//#region src/Component/ComponentProvider.tsx
|
|
8
8
|
var d = ({ localComponents: d, localCustomComponents: f, children: p }) => {
|
|
@@ -38,14 +38,14 @@ var d = ({ localComponents: d, localCustomComponents: f, children: p }) => {
|
|
|
38
38
|
[t.type]: t,
|
|
39
39
|
...e(t)
|
|
40
40
|
});
|
|
41
|
-
}), Object.keys(n).length === 0
|
|
41
|
+
}), Object.keys(n).length === 0 || (g.current = {
|
|
42
42
|
...h.current,
|
|
43
43
|
...n,
|
|
44
44
|
...m
|
|
45
45
|
}, h.current = {
|
|
46
46
|
...h.current,
|
|
47
47
|
...n
|
|
48
|
-
}, n
|
|
48
|
+
}), n;
|
|
49
49
|
}, [g, m]), y = i((e) => {
|
|
50
50
|
if (!e) return [];
|
|
51
51
|
Array.isArray(e) || (e = [e]);
|
|
@@ -2,8 +2,8 @@ import e from "./PluginRemote.mjs";
|
|
|
2
2
|
import { getRemoteSettings as t } from "./helpers/pluginSelector.mjs";
|
|
3
3
|
import n from "../elements/internal/NotFound/NotFound.mjs";
|
|
4
4
|
import { memo as r, use as i, useMemo as a } from "react";
|
|
5
|
-
import o from "@plitzi/sdk-shared/elements
|
|
6
|
-
import s from "@plitzi/sdk-shared/plugins/
|
|
5
|
+
import { ComponentContext as o } from "@plitzi/sdk-shared/elements";
|
|
6
|
+
import { PluginsContext as s } from "@plitzi/sdk-shared/plugins/react";
|
|
7
7
|
import { jsx as c } from "react/jsx-runtime";
|
|
8
8
|
var l = r(({ plitziJsxSkipHOC: r = !0, as: l = "", internalProps: u, children: d, ...f }) => {
|
|
9
9
|
let { components: p } = i(o), { plugins: m } = i(s), h = l ? p.current[l] : void 0, g = a(() => h ? void 0 : t({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { use as e, useCallback as t, useLayoutEffect as n, useState as r, useSyncExternalStore as i } from "react";
|
|
2
|
-
import { sharedContext as a } from "@plitzi/sdk-shared/helpers
|
|
2
|
+
import { sharedContext as a } from "@plitzi/sdk-shared/helpers";
|
|
3
3
|
import { jsx as o } from "react/jsx-runtime";
|
|
4
4
|
//#region src/Element/LayoutBody.tsx
|
|
5
5
|
var s = a("LayoutBodyContext", void 0), c = () => void 0, l = ({ bodies: e, children: t }) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import e from "./helpers/pluginSelector.mjs";
|
|
2
2
|
import { memo as t, use as n } from "react";
|
|
3
|
-
import r from "@plitzi/sdk-shared/elements
|
|
4
|
-
import i from "@plitzi/sdk-shared/plugins/
|
|
3
|
+
import { ComponentContext as r } from "@plitzi/sdk-shared/elements";
|
|
4
|
+
import { PluginsContext as i } from "@plitzi/sdk-shared/plugins/react";
|
|
5
5
|
var a = t(({ plitziElementLayout: t = void 0, type: a = "", internalProps: o }) => {
|
|
6
6
|
let { components: s } = n(r), { plugins: c } = n(i);
|
|
7
7
|
return e({
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import e from "./helpers/loadComponent.mjs";
|
|
2
2
|
import { Suspense as t, lazy as n, use as r, useEffect as i, useMemo as a, useState as o } from "react";
|
|
3
|
-
import s from "@plitzi/sdk-shared/
|
|
4
|
-
import {
|
|
3
|
+
import { emptyObject as s } from "@plitzi/sdk-shared/helpers";
|
|
4
|
+
import { ComponentContext as c } from "@plitzi/sdk-shared/elements";
|
|
5
5
|
import { jsx as l } from "react/jsx-runtime";
|
|
6
6
|
//#region src/Element/PluginRemote.tsx
|
|
7
|
-
var u = ({ url: u = "", type: d, internalProps: f, autoRegister: p = !0, plitziJsxSkipHOC: m = !1, plitziJsxProps: h =
|
|
8
|
-
let { register: g } = r(
|
|
7
|
+
var u = ({ url: u = "", type: d, internalProps: f, autoRegister: p = !0, plitziJsxSkipHOC: m = !1, plitziJsxProps: h = s }) => {
|
|
8
|
+
let { register: g } = r(c), [_, v] = o(!1);
|
|
9
9
|
i(() => v(!0), []);
|
|
10
10
|
let y = a(() => n(e(u, g, p, m, d)), [u, d]);
|
|
11
11
|
return _ ? m ? /* @__PURE__ */ l(t, { children: /* @__PURE__ */ l(y, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { use as e, useEffect as t, useMemo as n } from "react";
|
|
2
2
|
import { jsx as r } from "react/jsx-runtime";
|
|
3
|
-
import i from "@plitzi/sdk-interactions
|
|
3
|
+
import { InteractionsContext as i } from "@plitzi/sdk-interactions";
|
|
4
4
|
//#region src/Element/ReplicaProvider.tsx
|
|
5
5
|
var a = ({ children: a }) => {
|
|
6
6
|
let o = e(i), s = n(() => o.interactionsManager.createChildManager(), [o]), c = n(() => ({
|
|
@@ -3,9 +3,9 @@ import t from "./helpers/parseStyle.mjs";
|
|
|
3
3
|
import n from "./helpers/renderStaticTag.mjs";
|
|
4
4
|
import r from "./hooks/useRootElementInteractions.mjs";
|
|
5
5
|
import { use as i, useMemo as a } from "react";
|
|
6
|
-
import o from "@plitzi/sdk-shared/hooks
|
|
7
|
-
import s from "@plitzi/sdk-
|
|
8
|
-
import {
|
|
6
|
+
import { usePlitzi as o } from "@plitzi/sdk-shared/hooks";
|
|
7
|
+
import { motionAttributes as s } from "@plitzi/sdk-shared/schema";
|
|
8
|
+
import { InteractionsContext as c } from "@plitzi/sdk-interactions";
|
|
9
9
|
//#region src/Element/RootElement.tsx
|
|
10
10
|
var l = ({ ref: l, children: u, tag: d = "div", className: f = "", interactionTriggers: p, interactionCallbacks: m, style: h, ...g }) => {
|
|
11
11
|
let _ = a(() => t(h), [h]), v = e(), y = o(), b = y.settings.previewMode ?? !0, x = !!y.settings.debugMode;
|
|
@@ -17,7 +17,7 @@ var l = ({ ref: l, children: u, tag: d = "div", className: f = "", interactionTr
|
|
|
17
17
|
otherProps: g,
|
|
18
18
|
children: u
|
|
19
19
|
});
|
|
20
|
-
let { root: { baseElementId: S } } = y, C = !!i(
|
|
20
|
+
let { root: { baseElementId: S } } = y, C = !!i(c).interactionsManager, { id: w, rootId: T, style: E, plitziElementLayout: D, definition: { type: O, label: k, runtime: A, anchor: j, parentId: M, motion: N } } = v, P = s(N), F = A === "server" ? { "data-rsc-id": w } : void 0, I = D?.type === "component" && !M && D.rootId !== w ? D.rootId : void 0, L = y.settings.testAttributes === !1 ? void 0 : {
|
|
21
21
|
"data-plitzi-el": w,
|
|
22
22
|
...I === void 0 ? {} : { "data-plitzi-instance": I }
|
|
23
23
|
}, R = !x && (b || !O || T !== S) ? {} : {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { BUILTIN_ELEMENT_CALLBACKS as n } from "@plitzi/sdk-shared/authoring/elementCallbacks";
|
|
1
|
+
import { BUILTIN_ELEMENT_CALLBACKS as e, toBuilderParams as t, toInteractionCallback as n } from "@plitzi/sdk-shared/authoring";
|
|
3
2
|
//#region src/Element/helpers/getInteractions.ts
|
|
4
3
|
var r = (e, t) => (n) => {
|
|
5
4
|
let { category: r } = n;
|
|
@@ -14,13 +13,13 @@ var r = (e, t) => (n) => {
|
|
|
14
13
|
label: `Selector - ${e}`
|
|
15
14
|
}))] : [];
|
|
16
15
|
}, i = (i, a, o, s, c) => {
|
|
17
|
-
let l =
|
|
16
|
+
let l = e.setState, u = t(l.params), d = e.toggleState, f = t(d.params), p = {
|
|
18
17
|
type: "select",
|
|
19
18
|
options: r(i, a),
|
|
20
19
|
when: (e) => e.category === "attribute" || e.category === "state"
|
|
21
20
|
};
|
|
22
21
|
return {
|
|
23
|
-
setState:
|
|
22
|
+
setState: n("setState", l, o, {
|
|
24
23
|
title: `Update ${a.label}`,
|
|
25
24
|
postCallback: s,
|
|
26
25
|
params: {
|
|
@@ -48,7 +47,7 @@ var r = (e, t) => (n) => {
|
|
|
48
47
|
}
|
|
49
48
|
}
|
|
50
49
|
}),
|
|
51
|
-
toggleState:
|
|
50
|
+
toggleState: n("toggleState", d, c, {
|
|
52
51
|
title: `Toggle ${a.label}`,
|
|
53
52
|
postCallback: s,
|
|
54
53
|
params: {
|
|
@@ -6,8 +6,8 @@ import { omitKeys as i } from "../helpers/omitKeys.mjs";
|
|
|
6
6
|
import a from "../hooks/useElementInternal.mjs";
|
|
7
7
|
import o from "@plitzi/plitzi-ui/ErrorBoundary";
|
|
8
8
|
import { Profiler as s, use as c, useEffect as l, useId as u, useMemo as d, useRef as f } from "react";
|
|
9
|
-
import p from "@plitzi/sdk-event-bridge
|
|
10
|
-
import m from "@plitzi/sdk-shared/hooks
|
|
9
|
+
import { useEventBridge as p } from "@plitzi/sdk-event-bridge";
|
|
10
|
+
import { usePlitzi as m } from "@plitzi/sdk-shared/hooks";
|
|
11
11
|
import { useCommonStore as h } from "@plitzi/sdk-shared/store";
|
|
12
12
|
import { diffProps as g, tracingCollector as _ } from "@plitzi/sdk-shared/store/tracing";
|
|
13
13
|
import { jsx as v } from "react/jsx-runtime";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import e from "./useElement.mjs";
|
|
2
2
|
import { use as t, useCallback as n, useMemo as r } from "react";
|
|
3
|
-
import i from "@plitzi/sdk-shared/hooks
|
|
4
|
-
import a from "@plitzi/sdk-shared/builder/contexts
|
|
3
|
+
import { usePlitzi as i } from "@plitzi/sdk-shared/hooks";
|
|
4
|
+
import { BuilderContext as a } from "@plitzi/sdk-shared/builder/contexts";
|
|
5
5
|
//#region src/Element/hooks/useEditableContent.ts
|
|
6
6
|
var o = (e) => typeof e == "string" ? e : typeof e == "number" ? `${e}` : e == null ? "" : JSON.stringify(e), s = (s) => {
|
|
7
7
|
let { id: c } = e(), { settings: { previewMode: l } } = i(), u = t(a);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useMemo as e } from "react";
|
|
2
2
|
import { useCommonStore as t } from "@plitzi/sdk-shared/store";
|
|
3
|
-
import { isRecord as n } from "@plitzi/sdk-shared/helpers
|
|
3
|
+
import { isRecord as n } from "@plitzi/sdk-shared/helpers";
|
|
4
4
|
import { templatePaths as r } from "@plitzi/sdk-shared/helpers/twigWrapper";
|
|
5
5
|
//#region src/Element/hooks/useElementDataSource.ts
|
|
6
6
|
var i = ({ source: e, transformers: t, when: n }) => {
|
|
@@ -8,9 +8,9 @@ import o from "../helpers/parseStyleSelectors.mjs";
|
|
|
8
8
|
import { useMemo as s } from "react";
|
|
9
9
|
import { useCommonStore as c } from "@plitzi/sdk-shared/store";
|
|
10
10
|
import { get as l } from "@plitzi/plitzi-ui/helpers";
|
|
11
|
-
import u from "@plitzi/sdk-shared/dataSource
|
|
11
|
+
import { getBindingsDetails as u } from "@plitzi/sdk-shared/dataSource";
|
|
12
12
|
import { hasValidToken as d, processTwig as f, templatePaths as p } from "@plitzi/sdk-shared/helpers/twigWrapper";
|
|
13
|
-
import { COMPONENT_PROPS_SOURCE as m } from "@plitzi/sdk-shared/schema
|
|
13
|
+
import { COMPONENT_PROPS_SOURCE as m } from "@plitzi/sdk-shared/schema";
|
|
14
14
|
//#region src/Element/hooks/useElementInternal.ts
|
|
15
15
|
var h = { settled: /* @__PURE__ */ new Set([m]) }, g = (e, t, n) => {
|
|
16
16
|
let { queryParams: r = {}, routeParams: i = {}, variables: a = {}, origin: o = "", navigation: s, ...c } = n, l = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useEffect as e, useState as t } from "react";
|
|
2
|
-
import n from "@plitzi/sdk-shared/hooks
|
|
2
|
+
import { usePlitzi as n } from "@plitzi/sdk-shared/hooks";
|
|
3
3
|
//#region src/Element/hooks/useElementVisible.ts
|
|
4
4
|
var r = (e) => typeof e.checkVisibility == "function" ? e.checkVisibility() : e.getClientRects().length > 0, i = (i) => {
|
|
5
5
|
let { utils: { rootRef: a } } = n(), [o, s] = t(void 0);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isVisible as e } from "../helpers/isVisible.mjs";
|
|
2
2
|
import { useMemo as t } from "react";
|
|
3
3
|
import n from "clsx";
|
|
4
|
-
import { HIDDEN_CLASS as r } from "@plitzi/sdk-shared/style
|
|
4
|
+
import { HIDDEN_CLASS as r } from "@plitzi/sdk-shared/style";
|
|
5
5
|
//#region src/Element/hooks/useInternalClassName.ts
|
|
6
6
|
var i = ({ id: i, className: a, previewMode: o, baseElementId: s, plitziElementLayout: c, definition: l, elementState: u }) => {
|
|
7
7
|
let { items: d } = l, f = e(u.visibility);
|
|
@@ -4,9 +4,9 @@ import r from "../ServerStaticShell.mjs";
|
|
|
4
4
|
import { Fragment as i, isValidElement as a, use as o, useMemo as s, useRef as c, useSyncExternalStore as l } from "react";
|
|
5
5
|
import { useCommonStore as u } from "@plitzi/sdk-shared/store";
|
|
6
6
|
import { get as d } from "@plitzi/plitzi-ui/helpers";
|
|
7
|
-
import f from "@plitzi/sdk-shared/elements
|
|
7
|
+
import { ComponentContext as f } from "@plitzi/sdk-shared/elements";
|
|
8
8
|
import { passesFlagGate as p } from "@plitzi/sdk-shared/flags";
|
|
9
|
-
import m from "@plitzi/sdk-shared/plugins/
|
|
9
|
+
import { PluginsContext as m } from "@plitzi/sdk-shared/plugins/react";
|
|
10
10
|
import { jsx as h } from "react/jsx-runtime";
|
|
11
11
|
//#region src/Element/hooks/useInternalItems.tsx
|
|
12
12
|
var g = typeof window > "u", _ = "#layout-body", v = "#children", y = {}, b = () => () => {}, x = () => !0, S = () => !1, C = ({ id: C, definition: w, plitziElementLayout: T, children: E, previewMode: D, visible: O = !0 }) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useEffect as e, useMemo as t } from "react";
|
|
2
|
-
import { INTERVAL_TRIGGER as n, intervalOf as r } from "@plitzi/sdk-shared/helpers
|
|
2
|
+
import { INTERVAL_TRIGGER as n, intervalOf as r } from "@plitzi/sdk-shared/helpers";
|
|
3
3
|
//#region src/Element/hooks/useIntervalTriggers.ts
|
|
4
4
|
var i = ({ id: i, interactions: a, previewMode: o, interactionsManager: s }) => {
|
|
5
5
|
let c = t(() => [...new Set(Object.values(a ?? {}).flatMap((e) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useEffect as e, useMemo as t } from "react";
|
|
2
|
-
import { KEY_TRIGGER as n, isFieldEditing as r, keyPressCombo as i, parseKeys as a } from "@plitzi/sdk-shared/helpers
|
|
2
|
+
import { KEY_TRIGGER as n, isFieldEditing as r, keyPressCombo as i, parseKeys as a } from "@plitzi/sdk-shared/helpers";
|
|
3
3
|
//#region src/Element/hooks/useKeyTriggers.ts
|
|
4
4
|
var o = "input, textarea, select, [contenteditable=\"\"], [contenteditable=\"true\"]", s = (e) => e instanceof Element && e.closest(o) !== null, c = () => /Mac|iPhone|iPad|iPod/.test(navigator.userAgent), l = ({ id: o, interactions: l, previewMode: u, interactionsManager: d }) => {
|
|
5
5
|
let f = t(() => [...new Set(Object.values(l ?? {}).flatMap((e) => {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { useCallback as e, useContext as t, useRef as n, useSyncExternalStore as r } from "react";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { resolveLayoutChain as i } from "@plitzi/sdk-shared/schema";
|
|
3
|
+
import { StoreContext as a } from "@plitzi/nexus/react";
|
|
4
4
|
//#region src/Element/hooks/useLayoutChain.ts
|
|
5
5
|
var o = [], s = (e, t) => e.length === t.length && e.every((e, n) => e.layout === t[n].layout && e.slot === t[n].slot), c = (e) => typeof e == "object" && !!e && "definition" in e && "attributes" in e, l = (e) => (t) => {
|
|
6
6
|
let n = e(`schema.flat.${t}`);
|
|
7
7
|
return c(n) ? n : void 0;
|
|
8
8
|
}, u = (c, u) => {
|
|
9
|
-
let d = t(
|
|
10
|
-
let e = c && d ?
|
|
9
|
+
let d = t(a), f = n(o), p = e((e) => d ? d.subscribePath("schema.flat", e) : () => void 0, [d]), m = e(() => {
|
|
10
|
+
let e = c && d ? i(l((e) => d.getPath(e)), c, u) : o;
|
|
11
11
|
return s(f.current, e) || (f.current = e), f.current;
|
|
12
12
|
}, [
|
|
13
13
|
d,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import e from "./useElement.mjs";
|
|
2
2
|
import { use as t, useCallback as n } from "react";
|
|
3
|
-
import r from "@plitzi/sdk-shared/hooks
|
|
4
|
-
import i from "@plitzi/sdk-interactions
|
|
3
|
+
import { usePlitzi as r } from "@plitzi/sdk-shared/hooks";
|
|
4
|
+
import { InteractionsContext as i } from "@plitzi/sdk-interactions";
|
|
5
5
|
//#region src/Element/hooks/usePluginTrigger.ts
|
|
6
6
|
var a = (a) => {
|
|
7
7
|
let { id: o } = e(), { settings: { previewMode: s = !0 } } = r(), { interactionsManager: c } = t(i);
|
|
@@ -1,26 +1,25 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
import { interactionBasicTriggers as e, nativeEventsList as t } from "../helpers/elementConstants.mjs";
|
|
2
|
+
import n from "./useElementInteractions.mjs";
|
|
3
|
+
import r from "./useInternalClassName.mjs";
|
|
4
|
+
import i from "./useIntervalTriggers.mjs";
|
|
5
|
+
import a from "./useKeyTriggers.mjs";
|
|
6
|
+
import o from "./useScrollInteractions.mjs";
|
|
7
7
|
import { use as s, useCallback as c, useContext as l, useEffect as u, useEffectEvent as d, useMemo as f, useRef as p } from "react";
|
|
8
|
-
import {
|
|
9
|
-
import { get as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
15
|
-
import { pConsole as x } from "@plitzi/sdk-shared/devTools/utils/PlitziConsole";
|
|
8
|
+
import { emptyObject as m, isRecord as h } from "@plitzi/sdk-shared/helpers";
|
|
9
|
+
import { get as g } from "@plitzi/plitzi-ui/helpers";
|
|
10
|
+
import { liveSources as _ } from "@plitzi/sdk-shared/dataSource";
|
|
11
|
+
import { StoreContext as v } from "@plitzi/nexus/react";
|
|
12
|
+
import y from "clsx";
|
|
13
|
+
import { InteractionsContext as b } from "@plitzi/sdk-interactions";
|
|
14
|
+
import { pConsole as x } from "@plitzi/sdk-shared/devTools";
|
|
16
15
|
//#region src/Element/hooks/useRootElementInteractions.ts
|
|
17
|
-
var S = /* @__PURE__ */ new WeakSet(), C = (e) => "nativeEvent" in e &&
|
|
18
|
-
let { id: N, className: P, attributes: F, definition: I, definition: { interactions: L }, plitziElementLayout: R, elementState: z, setElementState: B } = w, { interactionsManager: V, useInteractions: H } = s(
|
|
16
|
+
var S = /* @__PURE__ */ new WeakSet(), C = (e) => "nativeEvent" in e && h(e.nativeEvent) ? e.nativeEvent : e, w = ({ elementContext: w, previewMode: T, debugMode: E, baseElementId: D, className: O, interactionTriggers: k, interactionCallbacks: A, otherProps: j, ref: M }) => {
|
|
17
|
+
let { id: N, className: P, attributes: F, definition: I, definition: { interactions: L }, plitziElementLayout: R, elementState: z, setElementState: B } = w, { interactionsManager: V, useInteractions: H } = s(b), U = c((e, t, n, r, i = !1) => {
|
|
19
18
|
i || e.preventDefault(), r && r(e);
|
|
20
19
|
let a = C(e);
|
|
21
20
|
S.has(a) || (i || S.add(a), V.interactionTrigger(t, n, { event: e }));
|
|
22
|
-
}, [V]), W = f(() => !T || !L ? {} : Object.values(L).filter((e) => e.type === "trigger" && e.action &&
|
|
23
|
-
let n =
|
|
21
|
+
}, [V]), W = f(() => !T || !L ? {} : Object.values(L).filter((e) => e.type === "trigger" && e.action && t.includes(e.action) && e.enabled).reduce((e, t) => {
|
|
22
|
+
let n = g(t, "params.propagateEvent", !1);
|
|
24
23
|
return {
|
|
25
24
|
...e,
|
|
26
25
|
[t.action]: (e) => U(e, N, t.action, j[t.action], n)
|
|
@@ -31,17 +30,17 @@ var S = /* @__PURE__ */ new WeakSet(), C = (e) => "nativeEvent" in e && m(e.nati
|
|
|
31
30
|
j,
|
|
32
31
|
T,
|
|
33
32
|
U
|
|
34
|
-
]), G = l(
|
|
33
|
+
]), G = l(v), K = c(() => {
|
|
35
34
|
let e = G?.getPath("runtime.sources");
|
|
36
|
-
return
|
|
35
|
+
return _(h(e) ? e : m, G?.getPath("runtime.state"), G?.getPath("schema.settings.computed"));
|
|
37
36
|
}, [G]), q = c(() => ({ dataSource: K() }), [K]), J = f(() => ({
|
|
38
|
-
...
|
|
37
|
+
...e,
|
|
39
38
|
...k
|
|
40
|
-
}), [k]), Y = p(null), X = M ?? Y, Z =
|
|
39
|
+
}), [k]), Y = p(null), X = M ?? Y, Z = n({
|
|
41
40
|
attributes: F,
|
|
42
41
|
definition: I,
|
|
43
42
|
setElementState: B
|
|
44
|
-
}), Q =
|
|
43
|
+
}), Q = o({
|
|
45
44
|
id: N,
|
|
46
45
|
label: I.label,
|
|
47
46
|
nodeRef: X,
|
|
@@ -63,12 +62,12 @@ var S = /* @__PURE__ */ new WeakSet(), C = (e) => "nativeEvent" in e && m(e.nati
|
|
|
63
62
|
Z
|
|
64
63
|
]),
|
|
65
64
|
getAdditionalParams: q
|
|
66
|
-
}),
|
|
65
|
+
}), a({
|
|
67
66
|
id: N,
|
|
68
67
|
interactions: L,
|
|
69
68
|
previewMode: T,
|
|
70
69
|
interactionsManager: V
|
|
71
|
-
}),
|
|
70
|
+
}), i({
|
|
72
71
|
id: N,
|
|
73
72
|
interactions: L,
|
|
74
73
|
previewMode: T,
|
|
@@ -92,7 +91,7 @@ var S = /* @__PURE__ */ new WeakSet(), C = (e) => "nativeEvent" in e && m(e.nati
|
|
|
92
91
|
K,
|
|
93
92
|
N
|
|
94
93
|
]);
|
|
95
|
-
let ee =
|
|
94
|
+
let ee = r({
|
|
96
95
|
id: N,
|
|
97
96
|
className: O,
|
|
98
97
|
previewMode: T,
|
|
@@ -102,7 +101,7 @@ var S = /* @__PURE__ */ new WeakSet(), C = (e) => "nativeEvent" in e && m(e.nati
|
|
|
102
101
|
plitziElementLayout: R
|
|
103
102
|
});
|
|
104
103
|
return {
|
|
105
|
-
className:
|
|
104
|
+
className: y(P, ee),
|
|
106
105
|
events: W,
|
|
107
106
|
nodeRef: X
|
|
108
107
|
};
|
|
@@ -16,7 +16,7 @@ declare const useRscData: <T>() => {
|
|
|
16
16
|
isServerElement: boolean;
|
|
17
17
|
/** A refresh asking about this element — or about the whole payload of this page — is in flight. */
|
|
18
18
|
refreshing: boolean;
|
|
19
|
-
refresh: (ids?: string[], params?: Record<string, string>, { fresh }?: Pick<import('@plitzi/sdk-shared').RscRefreshOptions, "fresh">) => Promise<void>;
|
|
19
|
+
refresh: (ids?: string[], params?: Record<string, string>, { fresh }?: Pick<import('@plitzi/sdk-shared/server').RscRefreshOptions, "fresh">) => Promise<void>;
|
|
20
20
|
/** Stops this element's refresh in flight, here and on the server; what it shows stays. */
|
|
21
21
|
cancel: () => void;
|
|
22
22
|
};
|
|
@@ -2,8 +2,7 @@ import e from "./useElement.mjs";
|
|
|
2
2
|
import { useCallback as t, useRef as n } from "react";
|
|
3
3
|
import { useCommonStore as r } from "@plitzi/sdk-shared/store";
|
|
4
4
|
import { useStoreById as i } from "@plitzi/nexus/react";
|
|
5
|
-
import { cancelRsc as a, currentRscLocation as o, rscDataPath as s } from "@plitzi/sdk-shared/server
|
|
6
|
-
import c from "@plitzi/sdk-shared/server/rsc/useRscRefresh";
|
|
5
|
+
import { cancelRsc as a, currentRscLocation as o, rscDataPath as s, useRscRefresh as c } from "@plitzi/sdk-shared/server";
|
|
7
6
|
//#region src/Element/hooks/useRscData.ts
|
|
8
7
|
var l = () => {
|
|
9
8
|
let { id: l, rootId: u } = e(), [[d = !1, f = !1, p = !1, m, h, g, _, v]] = r([
|
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
import { useEffect as e, useMemo as t } from "react";
|
|
2
|
-
import {
|
|
3
|
-
import { SCROLL_CALLBACKS as
|
|
4
|
-
import { SCROLL_BEHAVIORS as i, SCROLL_POSITIONS as a, SCROLL_TRIGGER as o, scrollDistance as s, scrollPosition as c, scrollState as l } from "@plitzi/sdk-shared/helpers/scroll";
|
|
2
|
+
import { SCROLL_BEHAVIORS as n, SCROLL_POSITIONS as r, SCROLL_TRIGGER as i, scrollDistance as a, scrollPosition as o, scrollState as s } from "@plitzi/sdk-shared/helpers";
|
|
3
|
+
import { SCROLL_CALLBACKS as c, toInteractionCallbacks as l } from "@plitzi/sdk-shared/authoring";
|
|
5
4
|
//#region src/Element/hooks/useScrollInteractions.ts
|
|
6
|
-
var u = (e) =>
|
|
7
|
-
let g = t(() =>
|
|
5
|
+
var u = (e) => n.find((t) => t === e) ?? "smooth", d = (e, t) => r.find((t) => t === e) ?? t, f = ({ id: n, label: r, nodeRef: f, interactions: p, previewMode: m, interactionsManager: h }) => {
|
|
6
|
+
let g = t(() => l(c, {
|
|
8
7
|
scrollBy: (e) => {
|
|
9
8
|
let t = f.current;
|
|
10
9
|
t?.scrollBy({
|
|
11
|
-
left:
|
|
12
|
-
top:
|
|
10
|
+
left: a(e.x, t.clientWidth) ?? 0,
|
|
11
|
+
top: a(e.y, t.clientHeight) ?? 0,
|
|
13
12
|
behavior: u(e.behavior)
|
|
14
13
|
});
|
|
15
14
|
},
|
|
16
15
|
scrollTo: (e) => {
|
|
17
16
|
let t = f.current;
|
|
18
17
|
t && t.scrollTo({
|
|
19
|
-
left:
|
|
20
|
-
top:
|
|
18
|
+
left: o(e.x, t.scrollWidth, t.clientWidth) ?? t.scrollLeft,
|
|
19
|
+
top: o(e.y, t.scrollHeight, t.clientHeight) ?? t.scrollTop,
|
|
21
20
|
behavior: u(e.behavior)
|
|
22
21
|
});
|
|
23
22
|
},
|
|
@@ -29,25 +28,25 @@ var u = (e) => i.find((t) => t === e) ?? "smooth", d = (e, t) => a.find((t) => t
|
|
|
29
28
|
});
|
|
30
29
|
}
|
|
31
30
|
}, {
|
|
32
|
-
scrollBy: { title: `Scroll ${
|
|
33
|
-
scrollTo: { title: `Scroll ${
|
|
34
|
-
scrollIntoView: { title: `Scroll to ${
|
|
35
|
-
}), [
|
|
31
|
+
scrollBy: { title: `Scroll ${r} by` },
|
|
32
|
+
scrollTo: { title: `Scroll ${r} to` },
|
|
33
|
+
scrollIntoView: { title: `Scroll to ${r}` }
|
|
34
|
+
}), [r, f]), _ = t(() => Object.values(p ?? {}).some((e) => e.type === "trigger" && e.action === i && e.enabled), [p]);
|
|
36
35
|
return e(() => {
|
|
37
36
|
let e = f.current;
|
|
38
37
|
if (!m || !_ || !e || typeof window > "u") return;
|
|
39
|
-
let t = 0,
|
|
38
|
+
let t = 0, r = () => {
|
|
40
39
|
t = 0;
|
|
41
|
-
let
|
|
42
|
-
h.interactionTrigger(
|
|
43
|
-
},
|
|
44
|
-
t === 0 && (t = window.requestAnimationFrame(
|
|
40
|
+
let r = s(e);
|
|
41
|
+
h.interactionTrigger(n, i, r);
|
|
42
|
+
}, a = () => {
|
|
43
|
+
t === 0 && (t = window.requestAnimationFrame(r));
|
|
45
44
|
};
|
|
46
|
-
return e.addEventListener("scroll",
|
|
47
|
-
e.removeEventListener("scroll",
|
|
45
|
+
return e.addEventListener("scroll", a, { passive: !0 }), t = window.requestAnimationFrame(r), () => {
|
|
46
|
+
e.removeEventListener("scroll", a), window.cancelAnimationFrame(t);
|
|
48
47
|
};
|
|
49
48
|
}, [
|
|
50
|
-
|
|
49
|
+
n,
|
|
51
50
|
h,
|
|
52
51
|
_,
|
|
53
52
|
f,
|