@docsector/docsector-reader 3.5.0 → 4.0.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.
Files changed (53) hide show
  1. package/README.md +11 -11
  2. package/bin/docsector.js +1 -283
  3. package/package.json +1 -1
  4. package/public/images/cards/getting-started-cover.svg +60 -0
  5. package/public/images/cards/quick-links-cover.svg +71 -0
  6. package/src/components/{DPageBlockquote.vue → DBlockBlockquote.vue} +4 -0
  7. package/src/components/DBlockCards.vue +223 -0
  8. package/src/components/{DPageEmbeddedUrl.vue → DBlockEmbeddedUrl.vue} +1 -1
  9. package/src/components/{DPageExpandable.vue → DBlockExpandable.vue} +4 -0
  10. package/src/components/{DPageFile.vue → DBlockFile.vue} +1 -1
  11. package/src/components/{DPageImage.vue → DBlockImage.vue} +1 -1
  12. package/src/components/{DMermaidDiagram.vue → DBlockMermaidDiagram.vue} +4 -0
  13. package/src/components/{DQuickLinks.vue → DBlockQuickLinks.vue} +4 -0
  14. package/src/components/{DPageSourceCode.vue → DBlockSourceCode.vue} +6 -1
  15. package/src/components/DBlockStepper.vue +210 -0
  16. package/src/components/DBlockTimeline.vue +319 -0
  17. package/src/components/DPageTokens.vue +51 -18
  18. package/src/components/page-section-tokens.js +334 -9
  19. package/src/i18n/languages/en-US.hjson +5 -0
  20. package/src/i18n/languages/pt-BR.hjson +5 -0
  21. package/src/pages/guide/i18n-and-markdown.overview.en-US.md +6 -6
  22. package/src/pages/guide/i18n-and-markdown.overview.pt-BR.md +6 -6
  23. package/src/pages/guide/theming.overview.en-US.md +1 -1
  24. package/src/pages/guide/theming.overview.pt-BR.md +1 -1
  25. package/src/pages/manual/content/blocks/cards.overview.en-US.md +32 -0
  26. package/src/pages/manual/content/blocks/cards.overview.pt-BR.md +32 -0
  27. package/src/pages/manual/content/blocks/cards.showcase.en-US.md +39 -0
  28. package/src/pages/manual/content/blocks/cards.showcase.pt-BR.md +39 -0
  29. package/src/pages/manual/content/blocks/embedded-urls.overview.en-US.md +3 -3
  30. package/src/pages/manual/content/blocks/embedded-urls.overview.pt-BR.md +3 -3
  31. package/src/pages/manual/content/blocks/embedded-urls.showcase.en-US.md +8 -8
  32. package/src/pages/manual/content/blocks/embedded-urls.showcase.pt-BR.md +8 -8
  33. package/src/pages/manual/content/blocks/expandable.overview.en-US.md +8 -8
  34. package/src/pages/manual/content/blocks/expandable.overview.pt-BR.md +8 -8
  35. package/src/pages/manual/content/blocks/expandable.showcase.en-US.md +6 -6
  36. package/src/pages/manual/content/blocks/expandable.showcase.pt-BR.md +6 -6
  37. package/src/pages/manual/content/blocks/files.overview.en-US.md +3 -3
  38. package/src/pages/manual/content/blocks/files.overview.pt-BR.md +3 -3
  39. package/src/pages/manual/content/blocks/files.showcase.en-US.md +5 -5
  40. package/src/pages/manual/content/blocks/files.showcase.pt-BR.md +5 -5
  41. package/src/pages/manual/content/blocks/quick-links.overview.en-US.md +4 -4
  42. package/src/pages/manual/content/blocks/quick-links.overview.pt-BR.md +4 -4
  43. package/src/pages/manual/content/blocks/quick-links.showcase.en-US.md +9 -9
  44. package/src/pages/manual/content/blocks/quick-links.showcase.pt-BR.md +9 -9
  45. package/src/pages/manual/content/blocks/stepper.overview.en-US.md +59 -0
  46. package/src/pages/manual/content/blocks/stepper.overview.pt-BR.md +59 -0
  47. package/src/pages/manual/content/blocks/stepper.showcase.en-US.md +115 -0
  48. package/src/pages/manual/content/blocks/stepper.showcase.pt-BR.md +115 -0
  49. package/src/pages/manual/content/blocks/timeline.overview.en-US.md +47 -0
  50. package/src/pages/manual/content/blocks/timeline.overview.pt-BR.md +47 -0
  51. package/src/pages/manual/content/blocks/timeline.showcase.en-US.md +170 -0
  52. package/src/pages/manual/content/blocks/timeline.showcase.pt-BR.md +170 -0
  53. package/src/pages/manual.index.js +84 -0
@@ -0,0 +1,319 @@
1
+ <script setup>
2
+ import { computed } from 'vue'
3
+ import { useQuasar } from 'quasar'
4
+ import { useI18n } from 'vue-i18n'
5
+
6
+ defineOptions({
7
+ name: 'DBlockTimeline'
8
+ })
9
+
10
+ const props = defineProps({
11
+ items: {
12
+ type: Array,
13
+ default: () => []
14
+ }
15
+ })
16
+
17
+ const $q = useQuasar()
18
+ const { locale } = useI18n()
19
+
20
+ const timelineLayout = computed(() => {
21
+ return $q.screen.lt.sm ? 'dense' : 'comfortable'
22
+ })
23
+
24
+ const formatDate = (rawDate = '') => {
25
+ const normalized = String(rawDate).trim()
26
+ const isoMatch = normalized.match(/^(\d{4})-(\d{2})-(\d{2})$/)
27
+
28
+ if (isoMatch) {
29
+ const [, year, month, day] = isoMatch
30
+ const parsed = new Date(Number(year), Number(month) - 1, Number(day), 12)
31
+
32
+ return new Intl.DateTimeFormat(locale.value, {
33
+ year: 'numeric',
34
+ month: 'long',
35
+ day: 'numeric'
36
+ }).format(parsed)
37
+ }
38
+
39
+ const parsed = new Date(normalized)
40
+ if (Number.isNaN(parsed.getTime())) {
41
+ return normalized
42
+ }
43
+
44
+ return new Intl.DateTimeFormat(locale.value, {
45
+ year: 'numeric',
46
+ month: 'long',
47
+ day: 'numeric'
48
+ }).format(parsed)
49
+ }
50
+
51
+ const stripHtmlTags = (value = '') => {
52
+ return String(value)
53
+ .replace(/<[^>]+>/g, ' ')
54
+ .replace(/&quot;/g, '"')
55
+ .replace(/&#39;|&apos;/g, "'")
56
+ .replace(/&lt;/g, '<')
57
+ .replace(/&gt;/g, '>')
58
+ .replace(/&amp;/g, '&')
59
+ .replace(/\s+/g, ' ')
60
+ .trim()
61
+ }
62
+
63
+ const getTitleTokenIndex = (tokens = []) => {
64
+ return tokens.findIndex((token) => {
65
+ return typeof token?.content === 'string' && stripHtmlTags(token.content) !== ''
66
+ })
67
+ }
68
+
69
+ const entries = computed(() => {
70
+ return props.items.map((item, index) => {
71
+ const titleTokenIndex = getTitleTokenIndex(item.tokens)
72
+ const titleText = titleTokenIndex === -1
73
+ ? `Update ${index + 1}`
74
+ : stripHtmlTags(item.tokens[titleTokenIndex].content)
75
+
76
+ return {
77
+ ...item,
78
+ formattedDate: formatDate(item.date),
79
+ titleText,
80
+ tags: item.tags.map((tag) => ({
81
+ label: tag?.label || '',
82
+ color: tag?.color || '',
83
+ textColor: tag?.textColor || '',
84
+ icon: tag?.icon || ''
85
+ })),
86
+ tokens: titleTokenIndex !== -1 && item.tokens[titleTokenIndex]?.tag === 'p'
87
+ ? item.tokens.filter((_, tokenIndex) => tokenIndex !== titleTokenIndex)
88
+ : item.tokens
89
+ }
90
+ })
91
+ })
92
+ </script>
93
+
94
+ <template>
95
+ <div v-if="entries.length" class="d-timeline">
96
+ <q-timeline
97
+ color="secondary"
98
+ :layout="timelineLayout"
99
+ side="right"
100
+ :dark="$q.dark.isActive"
101
+ class="d-timeline__shell"
102
+ >
103
+ <q-timeline-entry
104
+ v-for="(item, index) in entries"
105
+ :id="item.anchorId"
106
+ :key="`${item.anchorId}-${index}`"
107
+ class="d-timeline__entry"
108
+ >
109
+ <template #title>
110
+ <span class="d-timeline__title-row">
111
+ <span class="d-timeline__title-text">{{ item.titleText }}</span>
112
+
113
+ <a
114
+ class="d-timeline__anchor"
115
+ :href="`#${item.anchorId}`"
116
+ aria-label="Direct link to timeline item"
117
+ >
118
+ <q-icon name="link" size="16px" aria-hidden="true" />
119
+ </a>
120
+ </span>
121
+ </template>
122
+
123
+ <template #subtitle>
124
+ <span class="d-timeline__subtitle-text">{{ item.formattedDate }}</span>
125
+ </template>
126
+
127
+ <div class="d-timeline__body">
128
+ <div v-if="item.tags.length" class="d-timeline__tags">
129
+ <q-chip
130
+ v-for="(tag, tagIndex) in item.tags"
131
+ :key="`${item.anchorId}-${tag.label}-${tagIndex}`"
132
+ dense
133
+ square
134
+ :icon="tag.icon || void 0"
135
+ :color="tag.color || void 0"
136
+ :text-color="tag.textColor || void 0"
137
+ :class="[
138
+ 'd-timeline__tag',
139
+ { 'd-timeline__tag--default': tag.color === '' }
140
+ ]"
141
+ >
142
+ {{ tag.label }}
143
+ </q-chip>
144
+ </div>
145
+
146
+ <slot :item="item" :index="index" />
147
+ </div>
148
+ </q-timeline-entry>
149
+ </q-timeline>
150
+ </div>
151
+ </template>
152
+
153
+ <style lang="sass">
154
+ body.body--light
155
+ --d-timeline-title: #1d2733
156
+ --d-timeline-subtitle: #7d5516
157
+ --d-timeline-anchor-bg: rgba(150, 105, 39, 0.08)
158
+ --d-timeline-anchor-bg-hover: rgba(150, 105, 39, 0.16)
159
+ --d-timeline-anchor-text: #7d5516
160
+ --d-timeline-tag-bg: rgba(150, 105, 39, 0.1)
161
+ --d-timeline-tag-text: #6b4a18
162
+
163
+ body.body--dark
164
+ --d-timeline-title: #f5f7fa
165
+ --d-timeline-subtitle: #f4d394
166
+ --d-timeline-anchor-bg: rgba(255, 232, 190, 0.08)
167
+ --d-timeline-anchor-bg-hover: rgba(255, 232, 190, 0.16)
168
+ --d-timeline-anchor-text: #f4d394
169
+ --d-timeline-tag-bg: rgba(255, 232, 190, 0.1)
170
+ --d-timeline-tag-text: #f7e0b3
171
+
172
+ .d-timeline
173
+ margin: 1.5rem 0
174
+ --d-timeline-sticky-top: 0.75rem
175
+
176
+ .d-timeline__shell
177
+ &.q-timeline--comfortable
178
+ .q-timeline__subtitle
179
+ width: 1%
180
+ white-space: nowrap
181
+
182
+ > span
183
+ position: sticky
184
+ position: -webkit-sticky
185
+ top: var(--d-timeline-sticky-top)
186
+ display: inline-block
187
+ z-index: 1
188
+
189
+ .q-timeline__dot
190
+ position: sticky !important
191
+ position: -webkit-sticky !important
192
+ top: var(--d-timeline-sticky-top)
193
+ bottom: auto !important
194
+ z-index: 2
195
+
196
+ &:after
197
+ top: 25px
198
+
199
+ &:before
200
+ top: 6px
201
+ content: ''
202
+ &:after
203
+ bottom: -3px
204
+ content: ''
205
+
206
+ .q-timeline__content
207
+ padding-left: 0 !important
208
+
209
+ .q-timeline__title
210
+ padding-top: 0 !important
211
+ padding-left: 0 !important
212
+
213
+ .d-timeline__entry:last-child
214
+ .q-timeline__dot:after
215
+ content: '' !important
216
+
217
+ .q-timeline__title
218
+ margin: 0
219
+ padding: 0
220
+ font-size: 1.3rem
221
+ font-weight: 700
222
+ line-height: 1.35
223
+ color: var(--d-timeline-title)
224
+ cursor: default
225
+ user-select: text
226
+
227
+ &:before,
228
+ &:after,
229
+ &:hover:after
230
+ content: none
231
+
232
+ &:hover
233
+ color: var(--d-timeline-title)
234
+
235
+ .q-timeline__subtitle
236
+ color: var(--d-timeline-subtitle)
237
+ font-size: 0.84rem
238
+ font-weight: 700
239
+ line-height: 1.35
240
+ letter-spacing: 0.06em
241
+ text-transform: uppercase
242
+
243
+ .q-timeline__content
244
+ min-width: 0
245
+
246
+ .d-timeline__entry
247
+ .q-timeline__content > :last-child
248
+ margin-bottom: 0
249
+
250
+ .d-timeline__title-row
251
+ display: flex
252
+ align-items: flex-start
253
+ justify-content: space-between
254
+ gap: 0.75rem
255
+ width: 100%
256
+
257
+ .d-timeline__title-text
258
+ min-width: 0
259
+
260
+ .d-timeline__subtitle-text
261
+ display: inline-block
262
+ min-width: 0
263
+ margin-top: 4px
264
+
265
+ .d-timeline__body
266
+ min-width: 0
267
+
268
+ > :first-child
269
+ margin-top: 0
270
+
271
+ .d-timeline__tags
272
+ display: flex
273
+ flex-wrap: wrap
274
+ gap: 0.45rem
275
+ margin: 0 0 0.8rem
276
+
277
+ .d-timeline__tag
278
+ margin: 0
279
+
280
+ .d-timeline__tag--default
281
+ background: var(--d-timeline-tag-bg)
282
+ color: var(--d-timeline-tag-text)
283
+ font-weight: 600
284
+
285
+ .d-timeline__anchor
286
+ flex: none
287
+ display: inline-flex
288
+ align-items: center
289
+ justify-content: center
290
+ width: 2rem
291
+ height: 2rem
292
+ border-radius: 999px
293
+ background: var(--d-timeline-anchor-bg)
294
+ color: var(--d-timeline-anchor-text)
295
+ text-decoration: none
296
+ font-size: 1rem
297
+ font-weight: 700
298
+ transition: background-color 0.2s ease, transform 0.2s ease
299
+
300
+ &:hover,
301
+ &:focus-visible
302
+ background: var(--d-timeline-anchor-bg-hover)
303
+ transform: translateY(-1px)
304
+
305
+ @media (max-width: 599px)
306
+ .d-timeline__shell
307
+ .q-timeline__title
308
+ font-size: 1.16rem
309
+
310
+ .q-timeline__subtitle
311
+ font-size: 0.78rem
312
+
313
+ .d-timeline__title-row
314
+ gap: 0.55rem
315
+
316
+ .d-timeline__anchor
317
+ width: 1.8rem
318
+ height: 1.8rem
319
+ </style>
@@ -19,14 +19,17 @@ import DH3 from './DH3.vue'
19
19
  import DH4 from './DH4.vue'
20
20
  import DH5 from './DH5.vue'
21
21
  import DH6 from './DH6.vue'
22
- import DPageSourceCode from './DPageSourceCode.vue'
23
- import DMermaidDiagram from './DMermaidDiagram.vue'
24
- import DPageBlockquote from './DPageBlockquote.vue'
25
- import DPageImage from './DPageImage.vue'
26
- import DPageFile from './DPageFile.vue'
27
- import DPageEmbeddedUrl from './DPageEmbeddedUrl.vue'
28
- import DQuickLinks from './DQuickLinks.vue'
29
- import DPageExpandable from './DPageExpandable.vue'
22
+ import DBlockSourceCode from './DBlockSourceCode.vue'
23
+ import DBlockMermaidDiagram from './DBlockMermaidDiagram.vue'
24
+ import DBlockBlockquote from './DBlockBlockquote.vue'
25
+ import DBlockImage from './DBlockImage.vue'
26
+ import DBlockFile from './DBlockFile.vue'
27
+ import DBlockEmbeddedUrl from './DBlockEmbeddedUrl.vue'
28
+ import DBlockCards from './DBlockCards.vue'
29
+ import DBlockQuickLinks from './DBlockQuickLinks.vue'
30
+ import DBlockTimeline from './DBlockTimeline.vue'
31
+ import DBlockExpandable from './DBlockExpandable.vue'
32
+ import DBlockStepper from './DBlockStepper.vue'
30
33
  </script>
31
34
 
32
35
  <template>
@@ -80,7 +83,7 @@ import DPageExpandable from './DPageExpandable.vue'
80
83
  v-html="token.content"
81
84
  ></div>
82
85
 
83
- <d-page-image
86
+ <d-block-image
84
87
  v-else-if="token.tag === 'image'"
85
88
  :content="token.content"
86
89
  :caption-html="token.captionHtml"
@@ -91,14 +94,14 @@ import DPageExpandable from './DPageExpandable.vue'
91
94
  v-html="token.content"
92
95
  ></p>
93
96
 
94
- <d-page-blockquote
97
+ <d-block-blockquote
95
98
  v-else-if="token.tag === 'blockquote'"
96
99
  :message="token.alertType"
97
100
  >
98
101
  <div v-html="token.content"></div>
99
- </d-page-blockquote>
102
+ </d-block-blockquote>
100
103
 
101
- <d-page-file
104
+ <d-block-file
102
105
  v-else-if="token.tag === 'file'"
103
106
  :src="token.src"
104
107
  :title="token.title"
@@ -106,14 +109,14 @@ import DPageExpandable from './DPageExpandable.vue'
106
109
  :caption="token.caption"
107
110
  />
108
111
 
109
- <d-page-embedded-url
112
+ <d-block-embedded-url
110
113
  v-else-if="token.tag === 'embedded-url'"
111
114
  :url="token.url"
112
115
  :title="token.title"
113
116
  :caption="token.caption"
114
117
  />
115
118
 
116
- <d-page-source-code
119
+ <d-block-source-code
117
120
  v-else-if="token.tag === 'code'"
118
121
  :index="id + token.codeIndex"
119
122
  :text="token.content"
@@ -123,18 +126,48 @@ import DPageExpandable from './DPageExpandable.vue'
123
126
  :tabs="token.tabs"
124
127
  />
125
128
 
126
- <d-mermaid-diagram
129
+ <d-block-mermaid-diagram
127
130
  v-else-if="token.tag === 'mermaid'"
128
131
  :content="token.content"
129
132
  />
130
133
 
131
- <d-quick-links
134
+ <d-block-cards
135
+ v-else-if="token.tag === 'cards'"
136
+ :title="token.title"
137
+ :items="token.items"
138
+ />
139
+
140
+ <d-block-quick-links
132
141
  v-else-if="token.tag === 'quick-links'"
133
142
  :title="token.title"
134
143
  :items="token.items"
135
144
  />
136
145
 
137
- <d-page-expandable
146
+ <d-block-timeline
147
+ v-else-if="token.tag === 'timeline'"
148
+ :items="token.items"
149
+ >
150
+ <template #default="{ item }">
151
+ <d-page-tokens
152
+ :id="id"
153
+ :tokens="item.tokens"
154
+ />
155
+ </template>
156
+ </d-block-timeline>
157
+
158
+ <d-block-stepper
159
+ v-else-if="token.tag === 'stepper'"
160
+ :steps="token.steps"
161
+ >
162
+ <template #default="{ step }">
163
+ <d-page-tokens
164
+ :id="id"
165
+ :tokens="step.tokens"
166
+ />
167
+ </template>
168
+ </d-block-stepper>
169
+
170
+ <d-block-expandable
138
171
  v-else-if="token.tag === 'expandable'"
139
172
  :title="token.title"
140
173
  :open="token.open"
@@ -143,6 +176,6 @@ import DPageExpandable from './DPageExpandable.vue'
143
176
  :id="id"
144
177
  :tokens="token.tokens"
145
178
  />
146
- </d-page-expandable>
179
+ </d-block-expandable>
147
180
  </template>
148
181
  </template>