Skip to content

Commit 69772a9

Browse files
authored
Merge pull request #448 from marp-team/transition-v2
Update transition experiment for bespoke template (second iteration)
2 parents fd9e0a2 + b36f2b6 commit 69772a9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+3101
-984
lines changed

.stylelintrc.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,23 @@ rules:
1111
- true
1212
- ignoreProperties:
1313
- content-visibility
14+
selector-pseudo-element-no-unknown:
15+
- true
16+
- ignorePseudoElements:
17+
- /^page-transition-/
18+
selector-type-no-unknown:
19+
- true
20+
- ignoreTypes:
21+
- __bespoke_marp_transition_osc__
1422
scss/at-rule-no-unknown:
1523
- true
24+
25+
overrides:
26+
- files:
27+
- src/engine/transition/keyframes/**/*.scss
28+
- src/engine/transition/keyframes/**/*.css
29+
rules:
30+
block-no-empty:
31+
- null
32+
keyframes-name-pattern:
33+
- marp-(incoming-|outgoing-)?transition-(backward-)?__builtin__[a-z0-9-]+

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
## [Unreleased]
44

5+
### Changed
6+
7+
- ⚡️ Updates of experimental transition for bespoke template `--bespoke.transition` ([#447](https://github.com/marp-team/marp-cli/issues/447), [#448](https://github.com/marp-team/marp-cli/pull/448))
8+
- More built-in transitions (5 transitions -> 33 transitions)
9+
- Define custom transitions by `@keyframes` declaration in CSS
10+
- Update spec of `transition` local directive
11+
- Opt-out transition animation by preferring `prefers-reduced-motion` media query
12+
513
## v1.7.2 - 2022-04-24
614

715
### Changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,9 +271,9 @@ The `bespoke` template is using [Bespoke.js](https://github.com/bespokejs/bespok
271271
- **Fragmented list**: Recognize [Marpit's fragmented list](https://github.com/marp-team/marpit/issues/145) and appear list one-by-one if used `*` and `1)` as the bullet marker.
272272
- **Presenter view**: Open presenter view in external window by hitting <kbd>p</kbd> key.
273273
- **Progress bar** (optional): By setting `--bespoke.progress` option, you can add a progress bar on the top of the deck.
274-
- [**Slide transitions** _(EXPERIMENTAL)_][transitions]: You may turn on slide transitions support powered by [Shared Element Transitions API proposal](https://github.com/WICG/shared-element-transitions) by `--bespoke.transition` option. Refer to [marp-team/marp-cli#382][transitions] for details.
274+
- [**Slide transitions** _(EXPERIMENTAL)_][transitions]: You may turn on slide transitions support powered by [Shared Element Transitions API proposal](https://github.com/WICG/shared-element-transitions) by `--bespoke.transition` option. Refer to [marp-team/marp-cli#447][transitions] for details.
275275

276-
[transitions]: https://github.com/marp-team/marp-cli/issues/382
276+
[transitions]: https://github.com/marp-team/marp-cli/issues/447
277277

278278
> ℹ️ Presenter view may be disabled if [the browser restricted using localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API/Using_the_Web_Storage_API#Feature-detecting_localStorage) (e.g. Open HTML in the old Safari with private browsing, or open the _local_ HTML file with Chrome that has blocked 3rd party cookies in `chrome://settings/content/cookies`).
279279

package.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@
4141
"pkg": {
4242
"scripts": "lib/**/*.js"
4343
},
44+
"browserslist": [
45+
"> 1% and last 3 versions",
46+
"Firefox ESR"
47+
],
4448
"scripts": {
4549
"build": "yarn -s clean && rollup -c",
4650
"build:standalone": "run-s build standalone",
@@ -74,7 +78,7 @@
7478
"@tsconfig/node12": "^1.0.9",
7579
"@types/cheerio": "^0.22.31",
7680
"@types/express": "^4.17.13",
77-
"@types/jest": "^27.4.1",
81+
"@types/jest": "^27.5.1",
7882
"@types/markdown-it": "^12.2.3",
7983
"@types/node": "~16.11.25",
8084
"@types/pug": "^2.0.6",
@@ -100,7 +104,8 @@
100104
"globby": "^13.1.1",
101105
"image-size": "^1.0.1",
102106
"is-docker": "^3.0.0",
103-
"jest": "^27.5.1",
107+
"jest": "^28.1.0",
108+
"jest-environment-jsdom": "^28.1.0",
104109
"jest-junit": "^13.1.0",
105110
"nanoid": "^3.3.2",
106111
"npm-run-all": "^4.1.5",
@@ -127,7 +132,7 @@
127132
"stylelint-config-standard-scss": "^3.0.0",
128133
"supertest": "^6.2.2",
129134
"tar-stream": "^2.2.0",
130-
"ts-jest": "^27.1.4",
135+
"ts-jest": "^28.0.2",
131136
"ts-key-enum": "^3.0.11",
132137
"tslib": "^2.3.1",
133138
"typed-emitter": "^2.1.0",

postcss.config.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const autoprefixer = require('autoprefixer')
2+
const cssnano = require('cssnano')
3+
const postcssUrl = require('postcss-url')
4+
5+
const plugins = (opts = {}) => {
6+
const preserveEmptyDefinitions = opts.preserveEmptyDefinitions || false
7+
8+
return [
9+
postcssUrl({
10+
filter: '**/assets/**/*.svg',
11+
encodeType: 'base64',
12+
url: 'inline',
13+
}),
14+
autoprefixer(),
15+
cssnano({
16+
preset: [
17+
'default',
18+
{ autoprefixer: false, discardEmpty: !preserveEmptyDefinitions },
19+
],
20+
}),
21+
]
22+
}
23+
24+
module.exports = Object.assign(() => ({ plugins: plugins() }), { plugins })

rollup.config.js

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ import { nodeResolve } from '@rollup/plugin-node-resolve'
66
import replace from '@rollup/plugin-replace'
77
import typescript from '@rollup/plugin-typescript'
88
import url from '@rollup/plugin-url'
9-
import autoprefixer from 'autoprefixer'
109
import builtinModules from 'builtin-modules'
11-
import cssnano from 'cssnano'
12-
import postcssUrl from 'postcss-url'
1310
import license from 'rollup-plugin-license'
1411
import postcss from 'rollup-plugin-postcss'
1512
import pugPlugin from 'rollup-plugin-pug'
@@ -40,18 +37,7 @@ const plugins = (opts = {}) => [
4037
}),
4138
commonjs(),
4239
typescript({ noEmitOnError: false }),
43-
postcss({
44-
inject: false,
45-
plugins: [
46-
postcssUrl({
47-
filter: '**/assets/**/*.svg',
48-
encodeType: 'base64',
49-
url: 'inline',
50-
}),
51-
autoprefixer(),
52-
cssnano({ preset: 'default' }),
53-
],
54-
}),
40+
postcss({ inject: false }),
5541
pugPlugin({ pugRuntime: 'pug-runtime' }),
5642
url({
5743
sourceDir: path.join(__dirname, 'lib'),

src/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ export class MarpCLIConfig {
130130
(preview
131131
? ''
132132
: `Recommend to use with ${chalk.yellow`--preview`} option for trying transitions. `) +
133-
`Track the latest information at ${chalk.blueBright`https://github.com/marp-team/marp-cli/issues/382`}.`
133+
`Track the latest information at ${chalk.blueBright`https://github.com/marp-team/marp-cli/issues/447`}.`
134134
)
135135
}
136136

src/converter.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { silence, warn } from './cli'
88
import { Engine, ResolvedEngine } from './engine'
99
import infoPlugin, { engineInfo, EngineInfo } from './engine/info-plugin'
1010
import metaPlugin from './engine/meta-plugin'
11+
import { engineTransition, EngineTransition } from './engine/transition-plugin'
1112
import { error } from './error'
1213
import { File, FileType } from './file'
1314
import templates, {
@@ -163,11 +164,13 @@ export class Converter {
163164

164165
const ret = engine.render(stripBOM(`${markdown}${additionals}`))
165166
const info = engine[engineInfo]
167+
const transition: EngineTransition | undefined =
168+
engine[engineTransition]
166169

167170
if (isFile(file))
168171
this.options.themeSet.observe(file.absolutePath, info?.theme)
169172

170-
return { ...ret, ...info! }
173+
return { ...ret, ...info!, transition }
171174
},
172175
})
173176
}

0 commit comments

Comments
 (0)