@docsector/docsector-reader 0.2.6 → 0.2.8

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/bin/docsector.js CHANGED
@@ -23,7 +23,7 @@ const packageRoot = resolve(__dirname, '..')
23
23
  const args = process.argv.slice(2)
24
24
  const command = args[0]
25
25
 
26
- const VERSION = '0.2.3'
26
+ const VERSION = '0.2.8'
27
27
 
28
28
  const HELP = `
29
29
  Docsector Reader v${VERSION}
@@ -71,7 +71,7 @@ function getTemplatePackageJson (name) {
71
71
  serve: 'docsector serve'
72
72
  },
73
73
  dependencies: {
74
- '@docsector/docsector-reader': '^0.2.3',
74
+ '@docsector/docsector-reader': '^0.2.8',
75
75
  '@quasar/extras': '^1.16.12',
76
76
  'quasar': '^2.16.6',
77
77
  'vue': '^3.5.13',
@@ -164,13 +164,106 @@ export default buildMessages({ langModules, mdModules, pages, boot })
164
164
 
165
165
  const TEMPLATE_I18N_HJSON = `\
166
166
  {
167
- // Main navigation and UI labels for your documentation
168
- nav: {
169
- overview: Overview
167
+ // @ Pages dynamic content injected by buildMessages
168
+ _: {
169
+ home: {
170
+ texts: [
171
+ 'The official documentation of ',
172
+ 'Built with ',
173
+ 'Start exploring the docs below!'
174
+ ]
175
+ }
176
+
177
+ guide: {}
178
+ }
179
+
180
+ // @ Page actions
181
+ page: {
182
+ edit: {
183
+ github: {
184
+ start: 'Start this page'
185
+ complete: 'Complete this page'
186
+ edit: 'Edit this page'
187
+ }
188
+ progress: 'Translation Progress'
189
+ translations: 'Available translations'
190
+ anchor: 'Anchor navigation'
191
+ of: 'of'
192
+ }
193
+ nav: {
194
+ prev: 'Previous page'
195
+ next: 'Next page'
196
+ }
197
+ }
198
+
199
+ // @ Menu
200
+ menu: {
201
+ search: 'Search'
202
+
203
+ home: 'Home'
204
+ changelog: 'Changelog'
205
+ roadmap: 'Roadmap'
206
+ sponsor: 'Sponsor'
207
+ explore: 'Explore GitHub Repositories'
208
+
209
+ status: {
210
+ empty: {
211
+ _: 'empty'
212
+ tooltip: 'This page is empty!'
213
+ }
214
+ draft: {
215
+ _: 'draft'
216
+ tooltip: 'This page is under construction.'
217
+ }
218
+ }
219
+
220
+ settings: 'Settings'
221
+
222
+ _404: '404 Error - Not Found'
223
+ }
224
+
225
+ // @ Submenus (tabs)
226
+ submenu: {
227
+ guides: 'Guides'
228
+ manuals: 'Manuals'
229
+ references: 'References'
230
+
231
+ overview: 'Overview'
232
+ showcase: 'Showcase'
233
+ versus: 'Vs'
234
+
235
+ changelog: 'Changelog'
236
+ }
237
+
238
+ // @ System
239
+ system: {
240
+ documentation: 'Documentation'
241
+ support: 'Sponsor this project'
242
+ backToTop: 'Back to top'
243
+ }
244
+
245
+ // @ Settings
246
+ settings: {
247
+ general: {
248
+ _: 'General Settings'
249
+ language: {
250
+ _: 'Language'
251
+ }
252
+ }
253
+ appearance: {
254
+ _: 'Appearance'
255
+ background: {
256
+ _: 'Background Color'
257
+ }
258
+ }
170
259
  }
171
260
 
172
- // Page-specific translations (auto-loaded from pages/*.md)
173
- pages: {}
261
+ changelog: {}
262
+
263
+ _a: ' and '
264
+ _o: ' or '
265
+ _f: ' files '
266
+ _s: 'Source Code'
174
267
  }
175
268
  `
176
269
 
@@ -218,7 +311,8 @@ export default {
218
311
  meta: {
219
312
  'en-US': {
220
313
  overview: {
221
- _translations: null
314
+ _translations: null,
315
+ _sections: null
222
316
  }
223
317
  }
224
318
  }
@@ -227,41 +321,306 @@ export default {
227
321
 
228
322
  const TEMPLATE_BOOT_PAGE = `\
229
323
  <template>
230
- <q-page class="flex flex-center column q-pa-xl">
231
- <h1 class="text-h3 text-weight-bold q-mb-md">
232
- Welcome to your Documentation
233
- </h1>
234
- <p class="text-subtitle1 text-grey-7">
235
- Edit <code>src/pages/@/BootPage.vue</code> to customize this page.
236
- </p>
237
- <q-btn
238
- color="primary"
239
- label="Getting Started"
240
- to="/en-US/guide/getting-started/overview"
241
- class="q-mt-lg"
242
- />
324
+ <q-page-container>
325
+ <q-page class="boot-page">
326
+ <!-- Hero Section -->
327
+ <div class="hero-section">
328
+ <div class="hero-content">
329
+ <div class="hero-icon-container">
330
+ <q-icon name="auto_stories" size="64px" color="white" />
331
+ </div>
332
+ <h1 class="hero-title">{{ projectName }}</h1>
333
+ <p class="hero-subtitle">{{ $t('_.home.texts[0]') }}{{ projectName }}</p>
334
+ <p class="hero-description">{{ $t('_.home.texts[2]') }}</p>
335
+ <div class="hero-actions">
336
+ <q-btn
337
+ unelevated
338
+ color="white"
339
+ text-color="primary"
340
+ label="Get Started"
341
+ icon="rocket_launch"
342
+ to="/guide/getting-started/overview"
343
+ class="hero-btn"
344
+ size="lg"
345
+ no-caps
346
+ />
347
+ <q-btn
348
+ v-if="projectUrl !== '#'"
349
+ outline
350
+ color="white"
351
+ label="GitHub"
352
+ icon="fab fa-github"
353
+ @click="openURL(projectUrl)"
354
+ class="hero-btn"
355
+ size="lg"
356
+ no-caps
357
+ />
358
+ </div>
359
+ </div>
360
+ </div>
361
+
362
+ <!-- Features Section -->
363
+ <div class="features-section">
364
+ <div class="features-grid">
365
+ <div class="feature-card">
366
+ <q-icon name="edit_note" size="40px" color="primary" />
367
+ <h3>Markdown Powered</h3>
368
+ <p>Write your documentation in Markdown. Pages are automatically converted into beautiful, navigable content.</p>
369
+ </div>
370
+ <div class="feature-card">
371
+ <q-icon name="translate" size="40px" color="primary" />
372
+ <h3>Multi-language</h3>
373
+ <p>Built-in i18n support. Add translations by creating locale files — no extra configuration needed.</p>
374
+ </div>
375
+ <div class="feature-card">
376
+ <q-icon name="palette" size="40px" color="primary" />
377
+ <h3>Beautiful UI</h3>
378
+ <p>Powered by Quasar Framework. Responsive, accessible, and production-ready out of the box.</p>
379
+ </div>
380
+ <div class="feature-card">
381
+ <q-icon name="bolt" size="40px" color="primary" />
382
+ <h3>Lightning Fast</h3>
383
+ <p>Vite-powered dev server with hot-reload. See your changes instantly as you write.</p>
384
+ </div>
385
+ <div class="feature-card">
386
+ <q-icon name="search" size="40px" color="primary" />
387
+ <h3>Full-text Search</h3>
388
+ <p>Instant client-side search across all your documentation pages and translations.</p>
389
+ </div>
390
+ <div class="feature-card">
391
+ <q-icon name="settings" size="40px" color="primary" />
392
+ <h3>Easy Configuration</h3>
393
+ <p>One config file for branding, links, languages, and GitHub integration.</p>
394
+ </div>
395
+ </div>
396
+ </div>
397
+
398
+ <!-- Quick Start Section -->
399
+ <div class="quickstart-section">
400
+ <h2 class="section-title">Quick Links</h2>
401
+ <div class="quickstart-grid">
402
+ <q-card flat bordered class="quickstart-card" clickable @click="$router.push('/guide/getting-started/overview')">
403
+ <q-card-section horizontal>
404
+ <q-card-section class="flex flex-center" style="width: 60px;">
405
+ <q-icon name="flag" size="28px" color="primary" />
406
+ </q-card-section>
407
+ <q-card-section>
408
+ <div class="text-subtitle1 text-weight-bold">Getting Started</div>
409
+ <div class="text-caption text-grey-7">Installation, setup, and your first page</div>
410
+ </q-card-section>
411
+ <q-space />
412
+ <q-card-section class="flex flex-center">
413
+ <q-icon name="chevron_right" color="grey-5" />
414
+ </q-card-section>
415
+ </q-card-section>
416
+ </q-card>
417
+ </div>
418
+ </div>
419
+
420
+ <!-- Footer -->
421
+ <div class="boot-footer">
422
+ <p>{{ $t('_.home.texts[1]') }}
423
+ <a :href="projectUrl" target="_blank" class="footer-link">Docsector Reader</a>
424
+ </p>
425
+ </div>
243
426
  </q-page>
427
+ </q-page-container>
244
428
  </template>
245
429
 
246
430
  <script setup>
431
+ import { openURL } from 'quasar'
432
+ import docsectorConfig from 'docsector.config.js'
433
+
247
434
  defineOptions({ name: 'BootPage' })
435
+
436
+ const projectName = docsectorConfig.branding?.name || 'My Documentation'
437
+ const projectUrl = docsectorConfig.links?.github || '#'
248
438
  </script>
439
+
440
+ <style lang="sass" scoped>
441
+ .boot-page
442
+ padding: 0 !important
443
+
444
+ // Hero
445
+ .hero-section
446
+ background: linear-gradient(135deg, #655529 0%, #8b7340 50%, #a08850 100%)
447
+ color: white
448
+ padding: 80px 24px 60px
449
+ text-align: center
450
+ position: relative
451
+ overflow: hidden
452
+
453
+ &::before
454
+ content: ''
455
+ position: absolute
456
+ top: -50%
457
+ left: -50%
458
+ width: 200%
459
+ height: 200%
460
+ background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 60%)
461
+ animation: pulse 8s ease-in-out infinite
462
+
463
+ @keyframes pulse
464
+ 0%, 100%
465
+ transform: scale(1)
466
+ 50%
467
+ transform: scale(1.1)
468
+
469
+ .hero-content
470
+ position: relative
471
+ z-index: 1
472
+ max-width: 700px
473
+ margin: 0 auto
474
+
475
+ .hero-icon-container
476
+ margin-bottom: 24px
477
+ .q-icon
478
+ opacity: 0.9
479
+
480
+ .hero-title
481
+ font-size: 2.8rem
482
+ font-weight: 700
483
+ margin: 0 0 12px
484
+ line-height: 1.2
485
+ letter-spacing: -0.02em
486
+
487
+ .hero-subtitle
488
+ font-size: 1.2rem
489
+ opacity: 0.9
490
+ margin: 0 0 8px
491
+ font-weight: 400
492
+
493
+ .hero-description
494
+ font-size: 1rem
495
+ opacity: 0.7
496
+ margin: 0 0 32px
497
+
498
+ .hero-actions
499
+ display: flex
500
+ gap: 16px
501
+ justify-content: center
502
+ flex-wrap: wrap
503
+
504
+ .hero-btn
505
+ border-radius: 8px
506
+ padding: 8px 28px
507
+ font-weight: 600
508
+
509
+ // Features
510
+ .features-section
511
+ padding: 60px 24px
512
+ max-width: 1100px
513
+ margin: 0 auto
514
+
515
+ .features-grid
516
+ display: grid
517
+ grid-template-columns: repeat(auto-fit, minmax(280px, 1fr))
518
+ gap: 24px
519
+
520
+ .feature-card
521
+ padding: 28px 24px
522
+ border-radius: 12px
523
+ border: 1px solid #e8e8e8
524
+ transition: transform 0.2s, box-shadow 0.2s
525
+ text-align: center
526
+
527
+ &:hover
528
+ transform: translateY(-4px)
529
+ box-shadow: 0 8px 25px rgba(0,0,0,0.08)
530
+
531
+ h3
532
+ font-size: 1.1rem
533
+ font-weight: 600
534
+ margin: 16px 0 8px
535
+ color: #333
536
+
537
+ p
538
+ font-size: 0.9rem
539
+ color: #666
540
+ line-height: 1.5
541
+ margin: 0
542
+
543
+ // Quick Start
544
+ .quickstart-section
545
+ padding: 40px 24px 60px
546
+ max-width: 700px
547
+ margin: 0 auto
548
+
549
+ .section-title
550
+ font-size: 1.6rem
551
+ font-weight: 700
552
+ text-align: center
553
+ margin: 0 0 24px
554
+ color: #333
555
+
556
+ .quickstart-grid
557
+ display: flex
558
+ flex-direction: column
559
+ gap: 12px
560
+
561
+ .quickstart-card
562
+ border-radius: 10px
563
+ transition: box-shadow 0.2s
564
+ cursor: pointer
565
+
566
+ &:hover
567
+ box-shadow: 0 4px 15px rgba(0,0,0,0.1)
568
+
569
+ // Footer
570
+ .boot-footer
571
+ text-align: center
572
+ padding: 24px
573
+ border-top: 1px solid #e8e8e8
574
+ color: #999
575
+ font-size: 0.85rem
576
+
577
+ .footer-link
578
+ color: #655529
579
+ text-decoration: none
580
+ font-weight: 500
581
+
582
+ &:hover
583
+ text-decoration: underline
584
+
585
+ // Dark mode
586
+ body.body--dark
587
+ .feature-card
588
+ border-color: #333
589
+ h3
590
+ color: #e0e0e0
591
+ p
592
+ color: #aaa
593
+
594
+ .section-title
595
+ color: #e0e0e0
596
+
597
+ .boot-footer
598
+ border-color: #333
599
+ .footer-link
600
+ color: #c4a856
601
+ </style>
249
602
  `
250
603
 
251
604
  const TEMPLATE_404_PAGE = `\
252
605
  <template>
606
+ <q-page-container>
253
607
  <q-page class="flex flex-center column q-pa-xl">
254
- <h1 class="text-h3 text-weight-bold q-mb-md">404</h1>
255
- <p class="text-subtitle1 text-grey-7">
256
- Page not found.
608
+ <q-icon name="search_off" size="80px" color="grey-5" class="q-mb-lg" />
609
+ <h1 class="text-h3 text-weight-bold q-mb-sm" style="color: #333;">404</h1>
610
+ <p class="text-subtitle1 text-grey-6 q-mb-lg">
611
+ The page you're looking for doesn't exist.
257
612
  </p>
258
613
  <q-btn
259
- flat
614
+ unelevated
260
615
  color="primary"
261
- label="Go Home"
616
+ label="Back to Home"
617
+ icon="home"
262
618
  to="/"
619
+ no-caps
620
+ style="border-radius: 8px;"
263
621
  />
264
622
  </q-page>
623
+ </q-page-container>
265
624
  </template>
266
625
 
267
626
  <script setup>
@@ -310,29 +669,64 @@ npm-debug.log*
310
669
  `
311
670
 
312
671
  const TEMPLATE_GETTING_STARTED_MD = `\
313
- # Getting Started
314
-
315
- Welcome to your documentation project!
316
-
317
672
  ## Installation
318
673
 
674
+ Create a new Docsector documentation project:
675
+
319
676
  \\\`\\\`\\\`bash
677
+ npx @docsector/docsector-reader init my-docs
678
+ cd my-docs
320
679
  npm install
321
680
  \\\`\\\`\\\`
322
681
 
323
- ## Development
682
+ ## Development Server
683
+
684
+ Start the development server with hot-reload:
324
685
 
325
686
  \\\`\\\`\\\`bash
326
687
  npm run dev
327
688
  \\\`\\\`\\\`
328
689
 
329
- Your documentation will be available at **http://localhost:8181**.
690
+ Open **http://localhost:8181** in your browser.
691
+
692
+ ## Project Structure
693
+
694
+ Here's an overview of the project files:
695
+
696
+ | File / Folder | Description |
697
+ | --- | --- |
698
+ | \\\`docsector.config.js\\\` | Branding, links, languages, and GitHub config |
699
+ | \\\`quasar.config.js\\\` | Quasar/Vite build configuration (via factory) |
700
+ | \\\`src/pages/index.js\\\` | Page registry — defines all documentation pages |
701
+ | \\\`src/pages/boot.js\\\` | Boot metadata for the home page |
702
+ | \\\`src/pages/@/\\\` | Special pages (Home, 404) |
703
+ | \\\`src/pages/guide/\\\` | Guide pages (Markdown files) |
704
+ | \\\`src/i18n/languages/\\\` | Translation files (HJSON format) |
705
+ | \\\`src/css/app.sass\\\` | Custom styles |
706
+ | \\\`public/images/\\\` | Static assets (logo, flags, icons) |
707
+
708
+ ## Adding a Page
709
+
710
+ 1. Register the page in \\\`src/pages/index.js\\\`
711
+ 2. Create the Markdown file at \\\`src/pages/{type}/{path}.overview.{lang}.md\\\`
712
+ 3. The page will automatically appear in the sidebar navigation
330
713
 
331
- ## Next Steps
714
+ ## Customization
715
+
716
+ Edit \\\`docsector.config.js\\\` to change:
717
+
718
+ - **Branding** — logo, name, version
719
+ - **Links** — GitHub, changelog, sponsor
720
+ - **Languages** — add or remove supported locales
721
+ - **GitHub** — edit page base URL
722
+
723
+ ## Building for Production
724
+
725
+ \\\`\\\`\\\`bash
726
+ npm run build
727
+ \\\`\\\`\\\`
332
728
 
333
- - Edit pages in \\\`src/pages/\\\`
334
- - Add languages in \\\`src/i18n/languages/\\\`
335
- - Customize branding in \\\`docsector.config.js\\\`
729
+ The optimized SPA output will be in \\\`dist/spa/\\\`.
336
730
  `
337
731
 
338
732
  // =============================================================================
@@ -409,8 +803,7 @@ function initProject (name) {
409
803
  'src/i18n/languages',
410
804
  'src/pages',
411
805
  'src/pages/@',
412
- 'src/pages/getting-started',
413
- 'src/pages/getting-started/en-US',
806
+ 'src/pages/guide',
414
807
  'public',
415
808
  'public/images',
416
809
  'public/images/icons',
@@ -436,7 +829,7 @@ function initProject (name) {
436
829
  ['src/pages/boot.js', TEMPLATE_PAGES_BOOT],
437
830
  ['src/pages/@/BootPage.vue', TEMPLATE_BOOT_PAGE],
438
831
  ['src/pages/@/404Page.vue', TEMPLATE_404_PAGE],
439
- ['src/pages/getting-started/en-US/overview.md', TEMPLATE_GETTING_STARTED_MD]
832
+ ['src/pages/guide/getting-started.overview.en-US.md', TEMPLATE_GETTING_STARTED_MD]
440
833
  ]
441
834
 
442
835
  for (const [filePath, content] of files) {
@@ -466,9 +859,8 @@ function initProject (name) {
466
859
  console.log(' ├── @/')
467
860
  console.log(' │ ├── BootPage.vue')
468
861
  console.log(' │ └── 404Page.vue')
469
- console.log(' └── getting-started/')
470
- console.log(' └── en-US/')
471
- console.log(' └── overview.md')
862
+ console.log(' └── guide/')
863
+ console.log(' └── getting-started.overview.en-US.md')
472
864
 
473
865
  console.log('\n Next steps:\n')
474
866
  console.log(` cd ${name}`)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docsector/docsector-reader",
3
- "version": "0.2.6",
3
+ "version": "0.2.8",
4
4
  "description": "A documentation rendering engine built with Vue 3, Quasar v2 and Vite. Transform Markdown into beautiful, navigable documentation sites.",
5
5
  "productName": "Docsector Reader",
6
6
  "author": "Rodrigo de Araujo Vieira",
@@ -180,6 +180,16 @@ export function createQuasarConfig (options = {}) {
180
180
  'hjson', 'q-colorize-mixin'
181
181
  ]
182
182
 
183
+ // Exclude boot files from pre-bundling.
184
+ // Boot files (especially boot/i18n) import the consumer's src/i18n/index.js
185
+ // which uses import.meta.glob — a compile-time Vite directive that only
186
+ // works in source files. If pre-bundled, the glob calls become dead code
187
+ // and no i18n messages are loaded.
188
+ viteConf.optimizeDeps.exclude = [
189
+ ...(viteConf.optimizeDeps.exclude || []),
190
+ 'boot/i18n', 'boot/store', 'boot/QZoom', 'boot/axios'
191
+ ]
192
+
183
193
  if (!isStandalone) {
184
194
  // --- Consumer project mode ---
185
195
  // Allow Vite to serve files from the package root (needed for symlinked/npm-linked packages)