-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
478e173
commit 2450fac
Showing
24 changed files
with
1,292 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
apps/sfy-eu-blocks-app/theme-extension-elements/.storybook/main.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { dirname, join } from 'path'; | ||
|
||
/** | ||
* This function is used to resolve the absolute path of a package. | ||
* It is needed in projects that use Yarn PnP or are set up within a monorepo. | ||
* | ||
* https://storybook.js.org/docs/faq#how-do-i-fix-module-resolution-in-special-environments | ||
*/ | ||
function getAbsolutePath(value) { | ||
return dirname(require.resolve(join(value, 'package.json'))); | ||
} | ||
|
||
/** @type { import('@storybook/react-vite').StorybookConfig } */ | ||
const config = { | ||
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'], | ||
addons: [ | ||
getAbsolutePath('@storybook/addon-links'), | ||
getAbsolutePath('@storybook/addon-essentials'), | ||
getAbsolutePath('@storybook/addon-interactions') | ||
], | ||
framework: { | ||
name: getAbsolutePath('@storybook/web-components-vite'), | ||
options: {} | ||
}, | ||
docs: { | ||
autodocs: 'tag' | ||
} | ||
}; | ||
|
||
export default config; |
13 changes: 13 additions & 0 deletions
13
apps/sfy-eu-blocks-app/theme-extension-elements/.storybook/preview.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** @type { import('@storybook/react').Preview } */ | ||
const preview = { | ||
parameters: { | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/i | ||
} | ||
} | ||
} | ||
}; | ||
|
||
export default preview; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# `@repo/sfy-eu-blocks-app-extension-elements` |
39 changes: 39 additions & 0 deletions
39
apps/sfy-eu-blocks-app/theme-extension-elements/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"name": "@repo/sfy-eu-blocks-app-extension-elements", | ||
"private": true, | ||
"version": "0.0.0", | ||
"type": "module", | ||
"scripts": { | ||
"build": "tsc -b && vite build", | ||
"start": "vite preview", | ||
"start:dev": "vite", | ||
"storybook:start": "storybook dev -p 6006", | ||
"storybook:build": "storybook build", | ||
"lint": "eslint --ext .js,.ts,.jsx,.tsx src/", | ||
"clean": "shx rm -rf dist && shx rm -rf node_modules && shx rm -rf .turbo", | ||
"install:clean": "pnpm run clean && pnpm install", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"dependencies": { | ||
"solid-element": "^1.8.1", | ||
"solid-js": "^1.8.21" | ||
}, | ||
"devDependencies": { | ||
"@storybook/addon-essentials": "^8.2.9", | ||
"@storybook/addon-interactions": "^8.2.9", | ||
"@storybook/addon-links": "^8.2.9", | ||
"@storybook/blocks": "^8.2.9", | ||
"@storybook/test": "^8.2.9", | ||
"@storybook/web-components": "^8.2.9", | ||
"@storybook/web-components-vite": "^8.2.9", | ||
"autoprefixer": "^10.4.20", | ||
"daisyui": "^4.12.10", | ||
"postcss": "^8.4.41", | ||
"storybook": "^8.2.9", | ||
"tailwindcss": "^3.4.10", | ||
"typescript": "^5.5.4", | ||
"vite": "^5.4.2", | ||
"vite-plugin-shopify": "^3.0.1", | ||
"vite-plugin-solid": "^2.10.2" | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
apps/sfy-eu-blocks-app/theme-extension-elements/postcss.config.cjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/** @type {import('postcss-load-config').Config} */ | ||
module.exports = { | ||
plugins: { | ||
tailwindcss: { | ||
config: './tailwind.config.js' | ||
}, | ||
autoprefixer: {} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; |
16 changes: 16 additions & 0 deletions
16
apps/sfy-eu-blocks-app/theme-extension-elements/src/elements/EnergyLabel.stories.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import type { Meta, StoryObj } from '@storybook/web-components'; | ||
|
||
import { EnergyLabelElement } from './EnergyLabel'; | ||
|
||
// More on how to set up stories at: https://storybook.js.org/docs/7.0/web-components/writing-stories/introduction | ||
const meta = { | ||
title: 'ui/EnergyLabel', | ||
tags: ['autodocs'], | ||
render: (args) => new EnergyLabelElement(args) | ||
} satisfies Meta<typeof EnergyLabelElement>; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Default: Story = {}; |
13 changes: 13 additions & 0 deletions
13
apps/sfy-eu-blocks-app/theme-extension-elements/src/elements/EnergyLabel.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { customElement, noShadowDOM } from 'solid-element'; | ||
|
||
import '../app.css'; | ||
|
||
export const EnergyLabelElement = customElement( | ||
'energy-label-element', | ||
{}, // TODO: Figure out what props to pass | ||
() => { | ||
noShadowDOM(); | ||
|
||
return <div>Hello world</div>; | ||
} | ||
); |
1 change: 1 addition & 0 deletions
1
apps/sfy-eu-blocks-app/theme-extension-elements/src/vite-env.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/// <reference types="vite/client" /> |
8 changes: 8 additions & 0 deletions
8
apps/sfy-eu-blocks-app/theme-extension-elements/tailwind.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** @type {import('tailwindcss').Config} */ | ||
module.exports = { | ||
content: ['./src/**/*.{js,jsx,ts,tsx}'], | ||
theme: { | ||
extend: {} | ||
}, | ||
plugins: [require('daisyui')] | ||
}; |
28 changes: 28 additions & 0 deletions
28
apps/sfy-eu-blocks-app/theme-extension-elements/tsconfig.app.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"compilerOptions": { | ||
"composite": true, | ||
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", | ||
"target": "ES2020", | ||
"useDefineForClassFields": true, | ||
"module": "ESNext", | ||
"lib": ["ES2020", "DOM", "DOM.Iterable"], | ||
"skipLibCheck": true, | ||
|
||
/* Bundler mode */ | ||
"moduleResolution": "bundler", | ||
"allowImportingTsExtensions": true, | ||
"resolveJsonModule": true, | ||
"isolatedModules": true, | ||
"moduleDetection": "force", | ||
"noEmit": true, | ||
"jsx": "preserve", | ||
"jsxImportSource": "solid-js", | ||
|
||
/* Linting */ | ||
"strict": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"noFallthroughCasesInSwitch": true | ||
}, | ||
"include": ["src"] | ||
} |
11 changes: 11 additions & 0 deletions
11
apps/sfy-eu-blocks-app/theme-extension-elements/tsconfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"files": [], | ||
"references": [ | ||
{ | ||
"path": "./tsconfig.app.json" | ||
}, | ||
{ | ||
"path": "./tsconfig.node.json" | ||
} | ||
] | ||
} |
13 changes: 13 additions & 0 deletions
13
apps/sfy-eu-blocks-app/theme-extension-elements/tsconfig.node.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"compilerOptions": { | ||
"composite": true, | ||
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo", | ||
"skipLibCheck": true, | ||
"module": "ESNext", | ||
"moduleResolution": "bundler", | ||
"allowSyntheticDefaultImports": true, | ||
"strict": true, | ||
"noEmit": true | ||
}, | ||
"include": ["vite.config.ts"] | ||
} |
27 changes: 27 additions & 0 deletions
27
apps/sfy-eu-blocks-app/theme-extension-elements/vite.config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { defineConfig } from 'vite'; | ||
import shopify from 'vite-plugin-shopify'; | ||
import solid from 'vite-plugin-solid'; | ||
|
||
export default defineConfig({ | ||
build: { | ||
minify: true, | ||
cssMinify: true, | ||
rollupOptions: { | ||
output: { | ||
manualChunks: { | ||
solid: ['solid-js', 'solid-element'] | ||
} | ||
} | ||
} | ||
}, | ||
plugins: [ | ||
shopify({ | ||
themeRoot: '../theme-extension', | ||
// entrypointsDir: "./src", | ||
additionalEntrypoints: ['./src/elements/EnergyLabel.tsx'], | ||
sourceCodeDir: './src', | ||
snippetFile: 'vite-tag.liquid' | ||
}), | ||
solid() | ||
] | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
assets/**/*.js | ||
assets/**/*.css | ||
.vite/ |
20 changes: 20 additions & 0 deletions
20
apps/sfy-eu-blocks-app/theme-extension/blocks/energy_label.liquid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{% liquid | ||
# Relative to entrypointsDir | ||
render 'vite-tag' with '/src/elements/EnergyLabel.tsx' | ||
%} | ||
|
||
{% style %} | ||
{{ block.settings.custom_css }} | ||
{% endstyle %} | ||
|
||
<energy-label-element | ||
default-rating='{{ block.settings.default_rating }}' | ||
></energy-label-element> | ||
|
||
{% schema %} | ||
{ | ||
"name": "Energy Label Extension", | ||
"target": "section", | ||
"settings": [] | ||
} | ||
{% endschema %} |
2 changes: 2 additions & 0 deletions
2
apps/sfy-eu-blocks-app/theme-extension/locales/en.default.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{ | ||
} |
2 changes: 2 additions & 0 deletions
2
apps/sfy-eu-blocks-app/theme-extension/shopify.extension.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
name = "theme-extension" | ||
type = "theme" |
10 changes: 10 additions & 0 deletions
10
apps/sfy-eu-blocks-app/theme-extension/snippets/vite-tag.liquid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{% comment %} | ||
IMPORTANT: This snippet is automatically generated by vite-plugin-shopify. | ||
Do not attempt to modify this file directly, as any changes will be overwritten by the next build. | ||
{% endcomment %} | ||
{% assign path = vite-tag | replace: '~/', '../' | replace: '@/', '../' %} | ||
{% if path == "/src/elements/EnergyLabel.tsx" or path == "../elements/EnergyLabel.tsx" %} | ||
<script src="{{ 'EnergyLabel-3kwuNF6Y.js' | asset_url | split: '?' | first }}" type="module" crossorigin="anonymous"></script> | ||
<link rel="modulepreload" href="{{ 'solid-CKvf5k5P.js' | asset_url | split: '?' | first }}" crossorigin="anonymous"> | ||
{{ 'EnergyLabel-2GWgx4jR.css' | asset_url | split: '?' | first | stylesheet_tag: preload: preload_stylesheet }} | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 0 additions & 8 deletions
8
apps/sfy-playground-app/theme-extension/locales/en.default.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,2 @@ | ||
{ | ||
"ratings": { | ||
"stars": { | ||
"label": "Ratings" | ||
}, | ||
"home": { | ||
"recommendationText": "Recommended Product!" | ||
} | ||
} | ||
} |
Oops, something went wrong.