astro-tractstack 2.0.8 → 2.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +4 -6
- package/package.json +1 -1
- package/templates/css/custom.css +0 -6
- package/templates/src/components/codehooks/EpinetDurationSelector.tsx +1 -1
- package/templates/src/components/codehooks/FeaturedArticleSetup.tsx +2 -1
- package/templates/src/components/codehooks/ProductGridSetup.tsx +4 -4
- package/templates/src/components/compositor/Compositor.tsx +335 -16
- package/templates/src/components/compositor/Node.tsx +86 -6
- package/templates/src/components/compositor/nodes/RenderChildren.tsx +3 -6
- package/templates/src/components/compositor/nodes/tagElements/NodeA.tsx +2 -1
- package/templates/src/components/compositor/nodes/tagElements/NodeAnchorComponent.tsx +11 -19
- package/templates/src/components/compositor/nodes/tagElements/NodeBasicTag.tsx +120 -6
- package/templates/src/components/compositor/nodes/tagElements/NodeButton.tsx +1 -1
- package/templates/src/components/compositor/nodes/tagElements/NodeText.tsx +78 -8
- package/templates/src/components/edit/SettingsPanel.tsx +1 -1
- package/templates/src/components/edit/ToolMode.tsx +93 -22
- package/templates/src/components/edit/pane/AddPanePanel_break.tsx +2 -1
- package/templates/src/components/edit/pane/AddPanePanel_codehook.tsx +2 -1
- package/templates/src/components/edit/pane/AddPanePanel_reuse.tsx +1 -1
- package/templates/src/components/edit/pane/PageGen_preview.tsx +2 -1
- package/templates/src/components/edit/panels/StyleElementPanel_update.tsx +9 -5
- package/templates/src/components/edit/state/SaveModal.tsx +84 -14
- package/templates/src/components/edit/widgets/InteractiveDisclosureWidget.tsx +2 -2
- package/templates/src/components/search/SearchModal.tsx +2 -1
- package/templates/src/components/search/SearchResults.tsx +2 -1
- package/templates/src/components/search/SearchWrapper.tsx +1 -1
- package/templates/src/components/storykeep/Dashboard_Analytics.tsx +1 -1
- package/templates/src/components/storykeep/controls/content/BeliefForm.tsx +3 -5
- package/templates/src/components/storykeep/controls/content/BeliefTable.tsx +1 -1
- package/templates/src/components/storykeep/controls/content/MenuTable.tsx +1 -1
- package/templates/src/components/storykeep/controls/content/StoryFragmentTable.tsx +1 -1
- package/templates/src/components/widgets/ImpressionWrapper.tsx +1 -1
- package/templates/src/hooks/useFormState.ts +3 -4
- package/templates/src/stores/nodes.ts +813 -19
- package/templates/src/stores/selection.ts +41 -0
- package/templates/src/types/compositorTypes.ts +1 -0
- package/templates/src/types/nodeProps.ts +12 -0
- package/templates/src/utils/compositor/nodesHelper.ts +2 -2
- package/utils/inject-files.ts +4 -6
- package/templates/src/components/compositor/elements/PlayButton.tsx +0 -19
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { map } from 'nanostores';
|
|
2
|
+
|
|
3
|
+
export type SelectionRange = {
|
|
4
|
+
blockNodeId: string | null;
|
|
5
|
+
lcaNodeId: string | null;
|
|
6
|
+
startNodeId: string | null;
|
|
7
|
+
startCharOffset: number;
|
|
8
|
+
endNodeId: string | null;
|
|
9
|
+
endCharOffset: number;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type SelectionBox = {
|
|
13
|
+
top: number;
|
|
14
|
+
left: number;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export interface SelectionStoreState extends SelectionRange {
|
|
18
|
+
isDragging: boolean;
|
|
19
|
+
isActive: boolean;
|
|
20
|
+
selectionBox: SelectionBox | null;
|
|
21
|
+
pendingAction: 'style' | 'link' | null;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const DEFAULT_SELECTION_STATE: SelectionStoreState = {
|
|
25
|
+
isDragging: false,
|
|
26
|
+
isActive: false,
|
|
27
|
+
blockNodeId: null,
|
|
28
|
+
lcaNodeId: null,
|
|
29
|
+
startNodeId: null,
|
|
30
|
+
startCharOffset: 0,
|
|
31
|
+
endNodeId: null,
|
|
32
|
+
endCharOffset: 0,
|
|
33
|
+
selectionBox: null,
|
|
34
|
+
pendingAction: null,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const selectionStore = map<SelectionStoreState>(DEFAULT_SELECTION_STATE);
|
|
38
|
+
|
|
39
|
+
export function resetSelectionStore() {
|
|
40
|
+
selectionStore.set(DEFAULT_SELECTION_STATE);
|
|
41
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { MouseEvent } from 'react';
|
|
1
2
|
import { NodesContext } from '@/stores/nodes';
|
|
2
3
|
import type { BrandConfig } from './tractstack';
|
|
3
4
|
import type { Tag } from './compositorTypes';
|
|
@@ -11,11 +12,22 @@ export interface WidgetProps {
|
|
|
11
12
|
value3: string;
|
|
12
13
|
}
|
|
13
14
|
|
|
15
|
+
export type SelectionOrigin = {
|
|
16
|
+
blockNodeId: string;
|
|
17
|
+
lcaNodeId: string;
|
|
18
|
+
startNodeId: string;
|
|
19
|
+
startCharOffset: number;
|
|
20
|
+
endNodeId: string;
|
|
21
|
+
endCharOffset: number;
|
|
22
|
+
};
|
|
23
|
+
|
|
14
24
|
export type NodeProps = {
|
|
15
25
|
nodeId: string;
|
|
16
26
|
config?: BrandConfig;
|
|
17
27
|
ctx?: NodesContext;
|
|
18
28
|
first?: boolean;
|
|
29
|
+
onDragStart?: (origin: SelectionOrigin, e: MouseEvent<HTMLElement>) => void;
|
|
30
|
+
isSelectableText?: boolean;
|
|
19
31
|
};
|
|
20
32
|
|
|
21
33
|
export type NodeTagProps = NodeProps & { tagName: keyof JSX.IntrinsicElements };
|
|
@@ -139,8 +139,8 @@ function extractNodesFromDOM(
|
|
|
139
139
|
|
|
140
140
|
// Only skip if null or undefined, but keep empty strings and whitespace
|
|
141
141
|
if (text !== null && text !== undefined) {
|
|
142
|
-
// Remove zero-width spaces
|
|
143
|
-
text = text.replace(
|
|
142
|
+
// Remove zero-width spaces
|
|
143
|
+
text = text.replace(/\u200B/g, '');
|
|
144
144
|
|
|
145
145
|
result.push({
|
|
146
146
|
id: ulid(),
|
package/utils/inject-files.ts
CHANGED
|
@@ -382,12 +382,6 @@ export async function injectTemplateFiles(
|
|
|
382
382
|
src: resolve('../templates/src/components/compositor/elements/Svg.tsx'),
|
|
383
383
|
dest: 'src/components/compositor/elements/Svg.tsx',
|
|
384
384
|
},
|
|
385
|
-
{
|
|
386
|
-
src: resolve(
|
|
387
|
-
'../templates/src/components/compositor/elements/PlayButton.tsx'
|
|
388
|
-
),
|
|
389
|
-
dest: 'src/components/compositor/elements/PlayButton.tsx',
|
|
390
|
-
},
|
|
391
385
|
// Compositor panels
|
|
392
386
|
{
|
|
393
387
|
src: resolve(
|
|
@@ -584,6 +578,10 @@ export async function injectTemplateFiles(
|
|
|
584
578
|
src: resolve('../templates/src/stores/nodesHistory.ts'),
|
|
585
579
|
dest: 'src/stores/nodesHistory.ts',
|
|
586
580
|
},
|
|
581
|
+
{
|
|
582
|
+
src: resolve('../templates/src/stores/selection.ts'),
|
|
583
|
+
dest: 'src/stores/selection.ts',
|
|
584
|
+
},
|
|
587
585
|
|
|
588
586
|
// AAI utils
|
|
589
587
|
{
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export const PlayButton = () => {
|
|
2
|
-
return (
|
|
3
|
-
<svg
|
|
4
|
-
viewBox="0 0 459 459"
|
|
5
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
6
|
-
preserveAspectRatio="xMidYMid meet"
|
|
7
|
-
className="inline-block"
|
|
8
|
-
style={{ height: `1em` }}
|
|
9
|
-
>
|
|
10
|
-
<path
|
|
11
|
-
d="M229.5,0C102.751,0,0,102.751,0,229.5S102.751,459,229.5,459S459,356.249,459,229.5S356.249,0,229.5,0z M310.292,239.651
|
|
12
|
-
l-111.764,76.084c-3.761,2.56-8.63,2.831-12.652,0.704c-4.022-2.128-6.538-6.305-6.538-10.855V153.416
|
|
13
|
-
c0-4.55,2.516-8.727,6.538-10.855c4.022-2.127,8.891-1.857,12.652,0.704l111.764,76.084c3.359,2.287,5.37,6.087,5.37,10.151
|
|
14
|
-
C315.662,233.564,313.652,237.364,310.292,239.651z"
|
|
15
|
-
fill="currentColor"
|
|
16
|
-
/>
|
|
17
|
-
</svg>
|
|
18
|
-
);
|
|
19
|
-
};
|