create-knapsack 4.101.6 → 4.101.7

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 (36) hide show
  1. package/.temp/packages/knapsack/data/db.yml +9 -0
  2. package/.temp/packages/knapsack/data/knapsack.asset-sets.json +4 -0
  3. package/.temp/packages/knapsack/data/knapsack.design-tokens.json +1 -0
  4. package/.temp/packages/knapsack/data/knapsack.files.json +3 -0
  5. package/.temp/packages/knapsack/data/knapsack.navs.yml +2 -0
  6. package/.temp/packages/knapsack/data/knapsack.patterns.json +35 -0
  7. package/.temp/packages/knapsack/dist/meta/ks-meta.json +1 -0
  8. package/.temp/packages/knapsack/dist/tokens/design-tokens.android.xml +3 -0
  9. package/.temp/packages/knapsack/dist/tokens/design-tokens.cjs +1 -0
  10. package/.temp/packages/knapsack/dist/tokens/design-tokens.css +2 -0
  11. package/.temp/packages/knapsack/dist/tokens/design-tokens.css.scss +2 -0
  12. package/.temp/packages/knapsack/dist/tokens/design-tokens.d.cts +1 -0
  13. package/.temp/packages/knapsack/dist/tokens/design-tokens.d.mts +1 -0
  14. package/.temp/packages/knapsack/dist/tokens/design-tokens.d.ts +1 -0
  15. package/.temp/packages/knapsack/dist/tokens/design-tokens.js +1 -0
  16. package/.temp/packages/knapsack/dist/tokens/design-tokens.json +1 -0
  17. package/.temp/packages/knapsack/dist/tokens/design-tokens.less +1 -0
  18. package/.temp/packages/knapsack/dist/tokens/design-tokens.mjs +1 -0
  19. package/.temp/packages/knapsack/dist/tokens/design-tokens.nested.json +1 -0
  20. package/.temp/packages/knapsack/dist/tokens/design-tokens.scss +1 -0
  21. package/.temp/packages/knapsack/dist/tokens/design-tokens.style-dictionary.json +1 -0
  22. package/.temp/packages/knapsack/dist/tokens/design-tokens.swift +3 -0
  23. package/.temp/packages/knapsack/dist/tokens/design-tokens.w3c-spec.json +1 -0
  24. package/.temp/packages/knapsack/knapsack.config.cjs +26 -0
  25. package/.temp/packages/knapsack/node_modules/.cache/@knapsack/app/app-client-data.json +1 -0
  26. package/.temp/packages/knapsack/node_modules/.cache/@knapsack/app/build-meta.json +1 -0
  27. package/.temp/packages/knapsack/node_modules/.cache/@knapsack/app/discovery.json +1 -0
  28. package/.temp/packages/knapsack/node_modules/.cache/@knapsack/app/hydrate.renderer-react.json +1 -0
  29. package/.temp/packages/knapsack/node_modules/.cache/@knapsack/app/knapsack-renderer-react/apps_client_libs_renderer-react-components_dist_demo-wrapper_js.chunk.20c0c772eb90cf4a5c1b.js +22 -0
  30. package/.temp/packages/knapsack/node_modules/.cache/@knapsack/app/knapsack-renderer-react/ks-pattern-import-global-setup.js +17 -0
  31. package/.temp/packages/knapsack/node_modules/.cache/@knapsack/app/knapsack-renderer-react/main.bundle.20c0c772eb90cf4a5c1b.js +4225 -0
  32. package/.temp/packages/knapsack/node_modules/.cache/@knapsack/app/knapsack-renderer-react/manifest.json +4 -0
  33. package/.temp/packages/knapsack/node_modules/.cache/@knapsack/app/renderer-client/renderer-client.mjs +132 -0
  34. package/.temp/packages/knapsack/node_modules/.cache/@knapsack/app/renderer-discovery-react.json +1 -0
  35. package/.temp/packages/knapsack/package.json +17 -0
  36. package/package.json +15 -15
@@ -0,0 +1,4 @@
1
+ {
2
+ "main.js": "/knapsack-renderer-react/main.bundle.20c0c772eb90cf4a5c1b.js",
3
+ "apps_client_libs_renderer-react-components_dist_demo-wrapper_js.chunk.js": "/knapsack-renderer-react/apps_client_libs_renderer-react-components_dist_demo-wrapper_js.chunk.20c0c772eb90cf4a5c1b.js"
4
+ }
@@ -0,0 +1,132 @@
1
+ const metaTag = document.getElementById('ks-meta');
2
+ const metaString = metaTag?.innerText;
3
+ const meta = JSON.parse(metaString ?? '{}');
4
+ const {
5
+ websocketsPort
6
+ } = meta;
7
+ // an extra check in case the meta tag is wrong
8
+ const isReallyInIframe = window.parent !== window;
9
+
10
+ /**
11
+ * A type-safe wrapper for `window.parent.postMessage()`
12
+ */
13
+ function postMessage(message) {
14
+ window.parent.postMessage(message, '*');
15
+ }
16
+ if (websocketsPort) {
17
+ if ('WebSocket' in window && window.location.hostname === 'localhost') {
18
+ const protocol = window.location.protocol === 'https:' ? 'wss' : 'ws';
19
+ const socket = new window.WebSocket(`${protocol}://localhost:${websocketsPort}`);
20
+ socket.addEventListener('message', msg => {
21
+ const theMsg = JSON.parse(msg?.data ?? {});
22
+ if (!theMsg?.event) return;
23
+ const event = theMsg.event;
24
+ switch (event) {
25
+ case 'RENDERER_CLIENT_RELOAD':
26
+ window.location.reload();
27
+ break;
28
+ }
29
+ });
30
+ }
31
+ }
32
+ if (isReallyInIframe) {
33
+ /**
34
+ * Prevents the natural click behavior of any links within the iframe.
35
+ * Otherwise the iframe reloads with the current page or follows the url provided.
36
+ */
37
+ const links = document.querySelectorAll('a');
38
+ links.forEach(link => {
39
+ link.addEventListener('click', e => {
40
+ e.preventDefault();
41
+ });
42
+ });
43
+ let resizeTimeoutId;
44
+ let scrollDebounceTimer;
45
+
46
+ /**
47
+ * Sends a message to the parent window with the current height and width of the iframe's content.
48
+ * Search code base for the value in `event.type` to see how it's used.
49
+ */
50
+ function sendResizeEvent({
51
+ height,
52
+ width
53
+ }) {
54
+ clearTimeout(resizeTimeoutId);
55
+ // slight delay to prevent spamming the parent window with resize events
56
+ resizeTimeoutId = setTimeout(() => {
57
+ postMessage({
58
+ type: 'ksRendererClient.contentResized',
59
+ // round up to the nearest pixel
60
+ height: Math.ceil(height),
61
+ width: Math.ceil(width)
62
+ });
63
+ }, 100);
64
+ }
65
+
66
+ /**
67
+ * Sends a message to the parent window with the current scroll position of the iframe's content.
68
+ */
69
+ function sendScrollEvent() {
70
+ // Clear any existing timeout
71
+ window.clearTimeout(scrollDebounceTimer);
72
+
73
+ // Set new timeout - only send position after 150ms of no scrolling
74
+ scrollDebounceTimer = window.setTimeout(() => {
75
+ const scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
76
+ const scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
77
+ postMessage({
78
+ type: 'ksRendererClient.scrollPosition',
79
+ scrollTop,
80
+ scrollLeft
81
+ });
82
+ }, 150);
83
+ }
84
+ window.addEventListener('message', event => {
85
+ switch (event.data?.type) {
86
+ case 'ksRendererClient.updateScrollPosition':
87
+ {
88
+ if (document.documentElement) {
89
+ document.documentElement.scrollTop = event.data.scrollTop;
90
+ document.documentElement.scrollLeft = event.data.scrollLeft;
91
+ }
92
+ if (document.body) {
93
+ document.body.scrollTop = event.data.scrollTop;
94
+ document.body.scrollLeft = event.data.scrollLeft;
95
+ }
96
+ break;
97
+ }
98
+ default:
99
+ {
100
+ const _exhaustiveCheck = event.data?.type;
101
+ console.log('Unhandled message type:', _exhaustiveCheck);
102
+ }
103
+ }
104
+ });
105
+ window.addEventListener('scroll', sendScrollEvent, {
106
+ passive: true
107
+ });
108
+ // Send ready message when content is fully loaded
109
+ window.addEventListener('load', () => {
110
+ postMessage({
111
+ type: 'ksRendererClient.ready'
112
+ });
113
+ });
114
+ if (ResizeObserver) {
115
+ // watch for any changes to the content's width/height
116
+ const resizeObserver = new ResizeObserver(entries => {
117
+ const [entry] = entries;
118
+ if (!entry) return;
119
+ const {
120
+ height,
121
+ width
122
+ } = entry.contentRect;
123
+ sendResizeEvent({
124
+ height,
125
+ width
126
+ });
127
+ });
128
+
129
+ // watch the <body> element
130
+ resizeObserver.observe(document.body);
131
+ }
132
+ }
@@ -0,0 +1 @@
1
+ {"rendererId":"react","meta":{"id":"react","title":"React","aliasUse":"optional","aliasTitle":"Named Export","aliasIsJsNamedExport":true,"aliasDescription":"If `export X` was used instead of `export default`, then provide X.","enableDataDemos":true,"enableTemplateDemos":true,"hasSlotsSupport":true,"hasSlotOptionsSupport":true,"version":"4.101.6","hasInferSpecSupport":true,"syntaxHighlightingLanguage":"jsx","hasTemplateSuggestionsSupport":true,"prototypingTemplate":{"path":"@knapsack/renderer-react/prototype-template","spec":{"isInferred":false,"props":{"type":"object","properties":{}},"slots":{"children":{"title":"Children"}}}}},"codeSrcsByPath":{},"templates":[]}
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "@my-org/knapsack",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "scripts": {
6
+ "build": "knapsack build",
7
+ "start": "knapsack start",
8
+ "serve": "NODE_ENV=production knapsack serve",
9
+ "test": "knapsack test"
10
+ },
11
+ "dependencies": {
12
+ "@knapsack/app": "^4.101.6",
13
+ "@knapsack/renderer-react": "^4.101.6"
14
+ },
15
+ "author": "KnapsackBot 53622700+KnapsackBot@users.noreply.github.com",
16
+ "license": "ISC"
17
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-knapsack",
3
3
  "description": "Create & Setup Knapsack Workspaces",
4
- "version": "4.101.6",
4
+ "version": "4.101.7",
5
5
  "bin": "bin.js",
6
6
  "type": "module",
7
7
  "sideEffects": false,
@@ -17,21 +17,21 @@
17
17
  },
18
18
  "author": "Knapsack (https://www.knapsack.cloud)",
19
19
  "dependencies": {
20
- "@knapsack/core": "4.101.6",
21
- "@knapsack/creator-utils": "4.101.6",
22
- "@knapsack/file-utils": "4.101.6",
23
- "@knapsack/utils": "4.101.6"
20
+ "@knapsack/core": "4.101.7",
21
+ "@knapsack/creator-utils": "4.101.7",
22
+ "@knapsack/file-utils": "4.101.7",
23
+ "@knapsack/utils": "4.101.7"
24
24
  },
25
25
  "devDependencies": {
26
- "@knapsack/app": "4.101.6",
27
- "@knapsack/eslint-config-starter": "4.101.6",
28
- "@knapsack/renderer-angular": "4.101.6",
29
- "@knapsack/renderer-hbs": "4.101.6",
30
- "@knapsack/renderer-react": "4.101.6",
31
- "@knapsack/renderer-twig": "4.101.6",
32
- "@knapsack/renderer-vue": "4.101.6",
33
- "@knapsack/types": "4.101.6",
34
- "@knapsack/typescript-config-starter": "4.101.6",
26
+ "@knapsack/app": "4.101.7",
27
+ "@knapsack/eslint-config-starter": "4.101.7",
28
+ "@knapsack/renderer-angular": "4.101.7",
29
+ "@knapsack/renderer-hbs": "4.101.7",
30
+ "@knapsack/renderer-react": "4.101.7",
31
+ "@knapsack/renderer-twig": "4.101.7",
32
+ "@knapsack/renderer-vue": "4.101.7",
33
+ "@knapsack/types": "4.101.7",
34
+ "@knapsack/typescript-config-starter": "4.101.7",
35
35
  "eslint": "^9.20.0",
36
36
  "typescript": "^6.0.3",
37
37
  "vitest": "^4.1.11"
@@ -46,5 +46,5 @@
46
46
  "directory": "kits/create-knapsack",
47
47
  "type": "git"
48
48
  },
49
- "gitHead": "5afb6430632187c3199c30667ee386fdf58b8e8f"
49
+ "gitHead": "611a3384bf735da2a6b1de78479a5d10b26172b1"
50
50
  }