pict-section-inlinedocumentation 0.0.1

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 (51) hide show
  1. package/README.md +107 -0
  2. package/docs/.nojekyll +0 -0
  3. package/docs/README.md +83 -0
  4. package/docs/_cover.md +15 -0
  5. package/docs/_sidebar.md +24 -0
  6. package/docs/_topbar.md +8 -0
  7. package/docs/_version.json +7 -0
  8. package/docs/api-reference.md +185 -0
  9. package/docs/architecture.md +103 -0
  10. package/docs/css/docuserve.css +327 -0
  11. package/docs/embedding-level1-sidebar.md +92 -0
  12. package/docs/embedding-level2-routes.md +86 -0
  13. package/docs/embedding-level3-tooltips.md +97 -0
  14. package/docs/embedding-level4-autogen.md +126 -0
  15. package/docs/index.html +39 -0
  16. package/docs/overview.md +42 -0
  17. package/docs/quickstart.md +95 -0
  18. package/docs/reference.md +73 -0
  19. package/docs/retold-catalog.json +181 -0
  20. package/docs/retold-keyword-index.json +4374 -0
  21. package/example_applications/basic/docs/README.md +40 -0
  22. package/example_applications/basic/docs/_sidebar.md +4 -0
  23. package/example_applications/basic/docs/_topics.json +10 -0
  24. package/example_applications/basic/docs/advanced-topics.md +47 -0
  25. package/example_applications/basic/docs/getting-started.md +70 -0
  26. package/example_applications/basic/index.html +100 -0
  27. package/example_applications/bookshop/.quackage.json +10 -0
  28. package/example_applications/bookshop/Pict-Application-Bookshop-Configuration.json +15 -0
  29. package/example_applications/bookshop/Pict-Application-Bookshop.js +218 -0
  30. package/example_applications/bookshop/data/BookshopData.json +65 -0
  31. package/example_applications/bookshop/data/pict_documentation_topics.json +46 -0
  32. package/example_applications/bookshop/docs/_sidebar.md +6 -0
  33. package/example_applications/bookshop/docs/book-detail.md +21 -0
  34. package/example_applications/bookshop/docs/book-list.md +21 -0
  35. package/example_applications/bookshop/docs/search-filter.md +18 -0
  36. package/example_applications/bookshop/docs/store.md +29 -0
  37. package/example_applications/bookshop/docs/welcome.md +23 -0
  38. package/example_applications/bookshop/html/index.html +236 -0
  39. package/example_applications/bookshop/package.json +34 -0
  40. package/example_applications/bookshop/views/PictView-Bookshop-BookList.js +324 -0
  41. package/example_applications/bookshop/views/PictView-Bookshop-HelpToggle.js +44 -0
  42. package/example_applications/bookshop/views/PictView-Bookshop-Store.js +271 -0
  43. package/package.json +55 -0
  44. package/source/Pict-Section-InlineDocumentation.js +10 -0
  45. package/source/providers/Pict-Provider-InlineDocumentation.js +1995 -0
  46. package/source/views/Pict-View-InlineDocumentation-Content.js +542 -0
  47. package/source/views/Pict-View-InlineDocumentation-Layout.js +206 -0
  48. package/source/views/Pict-View-InlineDocumentation-Nav.js +475 -0
  49. package/source/views/Pict-View-InlineDocumentation-TopicManager.js +1623 -0
  50. package/test/Browser_Integration_tests.js +1449 -0
  51. package/test/Pict-Section-InlineDocumentation_test.js +1285 -0
@@ -0,0 +1,44 @@
1
+ const libPictView = require('pict-view');
2
+
3
+ const _ViewConfiguration =
4
+ {
5
+ ViewIdentifier: "Bookshop-HelpToggle",
6
+
7
+ DefaultRenderable: "Bookshop-HelpToggle-Display",
8
+ DefaultDestinationAddress: "#Bookshop-Help-Toggle-Container",
9
+
10
+ AutoRender: false,
11
+
12
+ CSS: /*css*/`
13
+ `,
14
+
15
+ Templates:
16
+ [
17
+ {
18
+ Hash: "Bookshop-HelpToggle-Template",
19
+ Template: /*html*/`<span></span>`
20
+ }
21
+ ],
22
+
23
+ Renderables:
24
+ [
25
+ {
26
+ RenderableHash: "Bookshop-HelpToggle-Display",
27
+ TemplateHash: "Bookshop-HelpToggle-Template",
28
+ DestinationAddress: "#Bookshop-Help-Toggle-Container",
29
+ RenderMethod: "replace"
30
+ }
31
+ ]
32
+ };
33
+
34
+ class BookshopHelpToggleView extends libPictView
35
+ {
36
+ constructor(pFable, pOptions, pServiceHash)
37
+ {
38
+ super(pFable, pOptions, pServiceHash);
39
+ }
40
+ }
41
+
42
+ module.exports = BookshopHelpToggleView;
43
+
44
+ module.exports.default_configuration = _ViewConfiguration;
@@ -0,0 +1,271 @@
1
+ const libPictView = require('pict-view');
2
+
3
+ const _ViewConfiguration =
4
+ {
5
+ ViewIdentifier: "Bookshop-Store",
6
+
7
+ DefaultRenderable: "Bookshop-Store-Display",
8
+ DefaultDestinationAddress: "#Bookshop-Content-Container",
9
+
10
+ AutoRender: false,
11
+
12
+ CSS: /*css*/`
13
+ .bookshop-store {
14
+ padding: 0;
15
+ }
16
+ .bookshop-store-back {
17
+ display: inline-flex;
18
+ align-items: center;
19
+ gap: 0.3em;
20
+ padding: 0.4em 0.8em;
21
+ border: 1px solid #D4A373;
22
+ border-radius: 4px;
23
+ background: #fff;
24
+ color: #264653;
25
+ cursor: pointer;
26
+ font-size: 0.85em;
27
+ margin-bottom: 1.25em;
28
+ transition: background 0.15s;
29
+ }
30
+ .bookshop-store-back:hover {
31
+ background: #F5F0E8;
32
+ }
33
+ .bookshop-store-detail {
34
+ display: flex;
35
+ gap: 2em;
36
+ }
37
+ .bookshop-store-cover {
38
+ width: 200px;
39
+ height: 300px;
40
+ border-radius: 6px;
41
+ object-fit: cover;
42
+ flex-shrink: 0;
43
+ background: #F0ECE4;
44
+ box-shadow: 0 2px 12px rgba(38,70,83,0.12);
45
+ }
46
+ .bookshop-store-info {
47
+ flex: 1;
48
+ min-width: 0;
49
+ }
50
+ .bookshop-store-title {
51
+ font-size: 1.75em;
52
+ font-weight: 700;
53
+ color: #264653;
54
+ margin: 0 0 0.15em;
55
+ }
56
+ .bookshop-store-author {
57
+ font-size: 1.1em;
58
+ color: #8A7F72;
59
+ margin: 0 0 0.75em;
60
+ }
61
+ .bookshop-store-genre-badge {
62
+ display: inline-block;
63
+ font-size: 0.8em;
64
+ padding: 0.2em 0.6em;
65
+ background: #264653;
66
+ color: #FAEDCD;
67
+ border-radius: 4px;
68
+ margin-bottom: 1em;
69
+ }
70
+ .bookshop-store-description {
71
+ line-height: 1.7;
72
+ color: #423D37;
73
+ margin: 0.75em 0 1.25em;
74
+ font-size: 1em;
75
+ }
76
+ .bookshop-store-price {
77
+ font-size: 2em;
78
+ font-weight: 700;
79
+ color: #2E7D74;
80
+ margin-bottom: 0.3em;
81
+ }
82
+ .bookshop-store-stock {
83
+ font-size: 0.9em;
84
+ font-weight: 600;
85
+ margin-bottom: 1.25em;
86
+ }
87
+ .bookshop-store-stock.in-stock {
88
+ color: #2E7D74;
89
+ }
90
+ .bookshop-store-stock.out-of-stock {
91
+ color: #E76F51;
92
+ }
93
+ .bookshop-store-add-cart {
94
+ display: inline-block;
95
+ padding: 0.6em 1.5em;
96
+ background: #E76F51;
97
+ color: #fff;
98
+ border: none;
99
+ border-radius: 5px;
100
+ font-size: 1em;
101
+ font-weight: 600;
102
+ cursor: pointer;
103
+ transition: background 0.15s;
104
+ }
105
+ .bookshop-store-add-cart:hover {
106
+ background: #D4603F;
107
+ }
108
+ .bookshop-store-add-cart:disabled {
109
+ background: #C4BAA8;
110
+ cursor: not-allowed;
111
+ }
112
+ `,
113
+
114
+ Templates:
115
+ [
116
+ {
117
+ Hash: "Bookshop-Store-Template",
118
+ Template: /*html*/`<div class="bookshop-store" id="Bookshop-Store-Body"></div>`
119
+ }
120
+ ],
121
+
122
+ Renderables:
123
+ [
124
+ {
125
+ RenderableHash: "Bookshop-Store-Display",
126
+ TemplateHash: "Bookshop-Store-Template",
127
+ DestinationAddress: "#Bookshop-Content-Container",
128
+ RenderMethod: "replace"
129
+ }
130
+ ]
131
+ };
132
+
133
+ class BookshopStoreView extends libPictView
134
+ {
135
+ constructor(pFable, pOptions, pServiceHash)
136
+ {
137
+ super(pFable, pOptions, pServiceHash);
138
+ }
139
+
140
+ onAfterRender()
141
+ {
142
+ this._renderStore();
143
+ return super.onAfterRender();
144
+ }
145
+
146
+ _renderStore()
147
+ {
148
+ if (typeof document === 'undefined')
149
+ {
150
+ return;
151
+ }
152
+
153
+ let tmpContainer = document.getElementById('Bookshop-Store-Body');
154
+ if (!tmpContainer)
155
+ {
156
+ return;
157
+ }
158
+
159
+ let tmpState = this.pict.AppData.Bookshop;
160
+ let tmpBook = tmpState.CurrentBook;
161
+
162
+ if (!tmpBook)
163
+ {
164
+ tmpContainer.innerHTML = '<p>No book selected.</p>';
165
+ return;
166
+ }
167
+
168
+ let tmpStockClass = tmpBook.InStock ? 'in-stock' : 'out-of-stock';
169
+ let tmpStockText = tmpBook.InStock ? 'In Stock' : 'Out of Stock';
170
+ let tmpDisabled = tmpBook.InStock ? '' : ' disabled';
171
+
172
+ let tmpHTML = '';
173
+
174
+ // Back button
175
+ tmpHTML += '<button class="bookshop-store-back" id="Bookshop-Store-Back" data-d-tooltip="back-to-catalog">';
176
+ tmpHTML += '&#x2190; Back to Catalog';
177
+ tmpHTML += '</button>';
178
+ tmpHTML += ' <span data-d-tooltip="navigation-info" data-d-tooltip-icon></span>';
179
+
180
+ // Section header with help button
181
+ tmpHTML += '<div class="bookshop-section-header">';
182
+ tmpHTML += '<h2 class="bookshop-section-title">Store</h2>';
183
+ tmpHTML += '<button class="bookshop-help-btn" id="Bookshop-Help-Store" title="Help: Store Page">?</button>';
184
+ tmpHTML += '</div>';
185
+
186
+ // Detail layout
187
+ tmpHTML += '<div class="bookshop-store-detail">';
188
+
189
+ // Cover
190
+ tmpHTML += '<img class="bookshop-store-cover" src="' + tmpBook.Cover + '" alt="' + tmpBook.Title + '">';
191
+
192
+ // Info
193
+ tmpHTML += '<div class="bookshop-store-info">';
194
+ tmpHTML += '<h1 class="bookshop-store-title">' + tmpBook.Title + '</h1>';
195
+ tmpHTML += '<p class="bookshop-store-author" data-d-tooltip="store-author">by ' + tmpBook.Author + '</p>';
196
+ tmpHTML += '<span class="bookshop-store-genre-badge" data-d-tooltip="genre-badge">' + tmpBook.Genre + '</span>';
197
+ tmpHTML += '<p class="bookshop-store-description">' + tmpBook.Description + '</p>';
198
+ tmpHTML += '<div class="bookshop-store-price" data-d-tooltip="store-price">$' + tmpBook.Price.toFixed(2) + '</div>';
199
+ tmpHTML += '<div class="bookshop-store-stock ' + tmpStockClass + '" data-d-tooltip="store-stock">' + tmpStockText + '</div>';
200
+ tmpHTML += '<button class="bookshop-store-add-cart" id="Bookshop-Store-AddCart"' + tmpDisabled + ' data-d-tooltip="add-to-cart">Add to Cart</button>';
201
+ tmpHTML += ' <span data-d-tooltip="cart-info" data-d-tooltip-icon></span>';
202
+ tmpHTML += '</div>';
203
+
204
+ tmpHTML += '</div>';
205
+
206
+ tmpContainer.innerHTML = tmpHTML;
207
+
208
+ // Wire handlers
209
+ this._wireHandlers(tmpContainer);
210
+
211
+ // Scan for tooltip placeholders
212
+ let tmpDocProvider = this.pict.providers['Pict-InlineDocumentation'];
213
+ if (tmpDocProvider)
214
+ {
215
+ tmpDocProvider.scanTooltips();
216
+ }
217
+ }
218
+
219
+ _wireHandlers(pContainer)
220
+ {
221
+ let tmpApp = this.pict.PictApplication;
222
+
223
+ let tmpBackBtn = pContainer.querySelector('#Bookshop-Store-Back');
224
+ if (tmpBackBtn)
225
+ {
226
+ tmpBackBtn.addEventListener('click', () =>
227
+ {
228
+ if (tmpApp)
229
+ {
230
+ tmpApp.showBookList();
231
+ }
232
+ });
233
+ }
234
+
235
+ let tmpAddCartBtn = pContainer.querySelector('#Bookshop-Store-AddCart');
236
+ if (tmpAddCartBtn)
237
+ {
238
+ tmpAddCartBtn.addEventListener('click', () =>
239
+ {
240
+ let tmpBook = this.pict.AppData.Bookshop.CurrentBook;
241
+ if (tmpBook && tmpBook.InStock)
242
+ {
243
+ tmpAddCartBtn.textContent = 'Added!';
244
+ tmpAddCartBtn.disabled = true;
245
+ setTimeout(() =>
246
+ {
247
+ tmpAddCartBtn.textContent = 'Add to Cart';
248
+ tmpAddCartBtn.disabled = false;
249
+ }, 1500);
250
+ }
251
+ });
252
+ }
253
+
254
+ let tmpHelpStore = pContainer.querySelector('#Bookshop-Help-Store');
255
+ if (tmpHelpStore)
256
+ {
257
+ tmpHelpStore.addEventListener('click', (pEvent) =>
258
+ {
259
+ pEvent.stopPropagation();
260
+ if (tmpApp)
261
+ {
262
+ tmpApp.showHelp('BOOKSHOP-STORE');
263
+ }
264
+ });
265
+ }
266
+ }
267
+ }
268
+
269
+ module.exports = BookshopStoreView;
270
+
271
+ module.exports.default_configuration = _ViewConfiguration;
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "pict-section-inlinedocumentation",
3
+ "version": "0.0.1",
4
+ "description": "Pict embeddable inline documentation browser with topic support",
5
+ "main": "source/Pict-Section-InlineDocumentation.js",
6
+ "scripts": {
7
+ "start": "node source/Pict-Section-InlineDocumentation.js",
8
+ "test": "npx quack test",
9
+ "tests": "npx quack test -g",
10
+ "coverage": "npx quack coverage",
11
+ "build": "npx quack build",
12
+ "test-browser": "npx mocha test/Browser_Integration_tests.js --timeout 60000"
13
+ },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/stevenvelozo/pict-section-inlinedocumentation.git"
17
+ },
18
+ "author": "steven velozo <steven@velozo.com>",
19
+ "license": "MIT",
20
+ "bugs": {
21
+ "url": "https://github.com/stevenvelozo/pict-section-inlinedocumentation/issues"
22
+ },
23
+ "homepage": "https://github.com/stevenvelozo/pict-section-inlinedocumentation#readme",
24
+ "dependencies": {
25
+ "pict-provider": "^1.0.12",
26
+ "pict-section-content": "^0.0.11",
27
+ "pict-section-markdowneditor": "file:../pict-section-markdowneditor",
28
+ "pict-section-modal": "file:../pict-section-modal",
29
+ "pict-view": "^1.0.67"
30
+ },
31
+ "devDependencies": {
32
+ "pict": "^1.0.361",
33
+ "pict-docuserve": "^0.1.5",
34
+ "puppeteer": "^24.40.0",
35
+ "quackage": "^1.1.0"
36
+ },
37
+ "mocha": {
38
+ "diff": true,
39
+ "extension": [
40
+ "js"
41
+ ],
42
+ "package": "./package.json",
43
+ "reporter": "spec",
44
+ "slow": "75",
45
+ "timeout": "5000",
46
+ "ui": "tdd",
47
+ "watch-files": [
48
+ "source/**/*.js",
49
+ "test/**/*.js"
50
+ ],
51
+ "watch-ignore": [
52
+ "lib/vendor"
53
+ ]
54
+ }
55
+ }
@@ -0,0 +1,10 @@
1
+ // The container for all the Pict-Section-InlineDocumentation related code.
2
+
3
+ // The main inline documentation provider (primary API surface)
4
+ module.exports = require('./providers/Pict-Provider-InlineDocumentation.js');
5
+
6
+ // Exported views for advanced usage
7
+ module.exports.InlineDocumentationLayoutView = require('./views/Pict-View-InlineDocumentation-Layout.js');
8
+ module.exports.InlineDocumentationContentView = require('./views/Pict-View-InlineDocumentation-Content.js');
9
+ module.exports.InlineDocumentationNavView = require('./views/Pict-View-InlineDocumentation-Nav.js');
10
+ module.exports.InlineDocumentationTopicManagerView = require('./views/Pict-View-InlineDocumentation-TopicManager.js');