Skip to content

Commit 2fd55e8

Browse files
author
Dobromir Hristov
authored
Revert "Add DeviceFrames support (#515)" (#526)
This reverts commit 1621056.
1 parent 1621056 commit 2fd55e8

16 files changed

+67
-662
lines changed

bin/check-source

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
1818

1919
function replace_acceptable_years() {
2020
# this needs to replace all acceptable forms with 'YEARS'
21-
sed -e 's/20[12][78901]-20[12][890123]/YEARS/' -e 's/20[12][890123]/YEARS/'
21+
sed -e 's/20[12][78901]-20[12][89012]/YEARS/' -e 's/20[12][89012]/YEARS/'
2222
}
2323

2424
printf "=> Checking license headers… "

src/components/Asset.vue

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!--
22
This source file is part of the Swift.org open source project
33

4-
Copyright (c) 2021-2023 Apple Inc. and the Swift project authors
4+
Copyright (c) 2021 Apple Inc. and the Swift project authors
55
Licensed under Apache License v2.0 with Runtime Library Exception
66

77
See https://swift.org/LICENSE.txt for license information
@@ -55,10 +55,6 @@ export default {
5555
type: Boolean,
5656
default: true,
5757
},
58-
deviceFrame: {
59-
type: String,
60-
required: false,
61-
},
6258
},
6359
computed: {
6460
rawAsset() {
@@ -107,7 +103,6 @@ export default {
107103
muted: this.videoMuted,
108104
autoplays: this.prefersReducedMotion ? false : this.videoAutoplays,
109105
posterVariants: this.videoPoster ? this.videoPoster.variants : [],
110-
deviceFrame: this.deviceFrame,
111106
};
112107
},
113108
assetListeners() {

src/components/ConditionalWrapper.vue

-28
This file was deleted.

src/components/ContentNode.vue

+20-34
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!--
22
This source file is part of the Swift.org open source project
33

4-
Copyright (c) 2021-2023 Apple Inc. and the Swift project authors
4+
Copyright (c) 2021 Apple Inc. and the Swift project authors
55
Licensed under Apache License v2.0 with Runtime Library Exception
66

77
See https://swift.org/LICENSE.txt for license information
@@ -28,7 +28,6 @@ import Row from './ContentNode/Row.vue';
2828
import TabNavigator from './ContentNode/TabNavigator.vue';
2929
import TaskList from './ContentNode/TaskList.vue';
3030
import LinksBlock from './ContentNode/LinksBlock.vue';
31-
import DeviceFrame from './ContentNode/DeviceFrame.vue';
3231

3332
export const BlockType = {
3433
aside: 'aside',
@@ -217,14 +216,9 @@ function renderNode(createElement, references) {
217216
abstract = [],
218217
anchor,
219218
title,
220-
...metadata
221219
},
222-
...rest
220+
...node
223221
}) => {
224-
const node = {
225-
...rest,
226-
metadata,
227-
};
228222
const figureContent = [renderChildren([node])];
229223
if ((title && abstract.length) || abstract.length) {
230224
// if there is a `title`, it should be above, otherwise below
@@ -236,14 +230,6 @@ function renderNode(createElement, references) {
236230
return createElement(Figure, { props: { anchor } }, figureContent);
237231
};
238232

239-
const renderDeviceFrame = ({ metadata: { deviceFrame }, ...node }) => (
240-
createElement(DeviceFrame, {
241-
props: {
242-
device: deviceFrame,
243-
},
244-
}, renderChildren([node]))
245-
);
246-
247233
return function render(node) {
248234
switch (node.type) {
249235
case BlockType.aside: {
@@ -349,14 +335,14 @@ function renderNode(createElement, references) {
349335
if (node.metadata && node.metadata.abstract) {
350336
return renderFigure(node);
351337
}
352-
if (!references[node.identifier]) return null;
353-
const { deviceFrame } = node.metadata || {};
354-
return createElement(BlockVideo, {
355-
props: {
356-
identifier: node.identifier,
357-
deviceFrame,
358-
},
359-
});
338+
339+
return references[node.identifier] ? (
340+
createElement(BlockVideo, {
341+
props: {
342+
identifier: node.identifier,
343+
},
344+
})
345+
) : null;
360346
}
361347
case BlockType.row: {
362348
const columns = node.numberOfColumns ? { large: node.numberOfColumns } : undefined;
@@ -407,16 +393,16 @@ function renderNode(createElement, references) {
407393
}
408394

409395
const image = references[node.identifier];
410-
if (!image) return null;
411-
if (node.metadata && node.metadata.deviceFrame) {
412-
return renderDeviceFrame(node);
413-
}
414-
return createElement(InlineImage, {
415-
props: {
416-
alt: image.alt,
417-
variants: image.variants,
418-
},
419-
});
396+
return image ? (
397+
createElement(InlineImage, {
398+
props: {
399+
alt: image.alt,
400+
variants: image.variants,
401+
},
402+
})
403+
) : (
404+
null
405+
);
420406
}
421407
case InlineType.link:
422408
// Note: `InlineType.link` has been deprecated, but may still be found in old JSON.

src/components/ContentNode/BlockVideo.vue

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!--
22
This source file is part of the Swift.org open source project
33

4-
Copyright (c) 2021-2023 Apple Inc. and the Swift project authors
4+
Copyright (c) 2021 Apple Inc. and the Swift project authors
55
Licensed under Apache License v2.0 with Runtime Library Exception
66

77
See https://swift.org/LICENSE.txt for license information
@@ -15,7 +15,6 @@
1515
:video-muted="false"
1616
:showsReplayButton="!isClientMobile"
1717
:showsVideoControls="isClientMobile"
18-
:deviceFrame="deviceFrame"
1918
/>
2019
</template>
2120

@@ -32,10 +31,6 @@ export default {
3231
type: String,
3332
required: true,
3433
},
35-
deviceFrame: {
36-
type: String,
37-
required: false,
38-
},
3934
},
4035
};
4136
</script>

src/components/ContentNode/DeviceFrame.vue

-137
This file was deleted.

src/components/ReplayableVideoAsset.vue

+4-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!--
22
This source file is part of the Swift.org open source project
33

4-
Copyright (c) 2021-2023 Apple Inc. and the Swift project authors
4+
Copyright (c) 2021 Apple Inc. and the Swift project authors
55
Licensed under Apache License v2.0 with Runtime Library Exception
66

77
See https://swift.org/LICENSE.txt for license information
@@ -17,15 +17,14 @@
1717
:showsControls="showsControls"
1818
:muted="muted"
1919
:posterVariants="posterVariants"
20-
:deviceFrame="deviceFrame"
2120
@pause="onPause"
2221
@playing="onVideoPlaying"
2322
@ended="onVideoEnd"
2423
/>
2524
<a
2625
class="replay-button"
2726
href="#"
28-
:class="{ visible: showsReplayButton }"
27+
:class="{ visible: this.showsReplayButton }"
2928
@click.prevent="replay"
3029
>
3130
{{ text }}
@@ -68,10 +67,6 @@ export default {
6867
type: Array,
6968
default: () => [],
7069
},
71-
deviceFrame: {
72-
type: String,
73-
required: false,
74-
},
7570
},
7671
computed: {
7772
text: ({ played }) => (played ? 'Replay' : 'Play'),
@@ -84,7 +79,7 @@ export default {
8479
},
8580
methods: {
8681
async replay() {
87-
const videoPlayer = this.$refs.asset.$refs.video;
82+
const videoPlayer = this.$refs.asset.$el;
8883
if (videoPlayer) {
8984
await videoPlayer.play();
9085
this.showsReplayButton = false;
@@ -110,7 +105,7 @@ export default {
110105
<style scoped lang="scss">
111106
@import 'docc-render/styles/_core.scss';
112107

113-
.video-replay-container .replay-button {
108+
.replay-button {
114109
display: flex;
115110
align-items: center;
116111
justify-content: center;

0 commit comments

Comments
 (0)